@faststore/components 2.0.101-alpha.0 → 2.0.103-alpha.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.
- package/dist/atoms/Button/Button.js +1 -1
- package/dist/atoms/Button/Button.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/molecules/OrderSummary/OrderSummary.d.ts +35 -0
- package/dist/molecules/OrderSummary/OrderSummary.js +16 -0
- package/dist/molecules/OrderSummary/OrderSummary.js.map +1 -0
- package/dist/molecules/OrderSummary/index.d.ts +2 -0
- package/dist/molecules/OrderSummary/index.js +2 -0
- package/dist/molecules/OrderSummary/index.js.map +1 -0
- package/dist/organisms/CartSidebar/CartSidebar.d.ts +40 -0
- package/dist/organisms/CartSidebar/CartSidebar.js +18 -0
- package/dist/organisms/CartSidebar/CartSidebar.js.map +1 -0
- package/dist/organisms/CartSidebar/CartSidebarFooter.d.ts +5 -0
- package/dist/organisms/CartSidebar/CartSidebarFooter.js +6 -0
- package/dist/organisms/CartSidebar/CartSidebarFooter.js.map +1 -0
- package/dist/organisms/CartSidebar/CartSidebarList.d.ts +5 -0
- package/dist/organisms/CartSidebar/CartSidebarList.js +7 -0
- package/dist/organisms/CartSidebar/CartSidebarList.js.map +1 -0
- package/dist/organisms/CartSidebar/index.d.ts +4 -0
- package/dist/organisms/CartSidebar/index.js +4 -0
- package/dist/organisms/CartSidebar/index.js.map +1 -0
- package/dist/organisms/ImageGallery/ImageGallery.d.ts +42 -0
- package/dist/organisms/ImageGallery/ImageGallery.js +10 -0
- package/dist/organisms/ImageGallery/ImageGallery.js.map +1 -0
- package/dist/organisms/ImageGallery/ImageGallerySelector.d.ts +31 -0
- package/dist/organisms/ImageGallery/ImageGallerySelector.js +46 -0
- package/dist/organisms/ImageGallery/ImageGallerySelector.js.map +1 -0
- package/dist/organisms/ImageGallery/ImageZoom.d.ts +7 -0
- package/dist/organisms/ImageGallery/ImageZoom.js +6 -0
- package/dist/organisms/ImageGallery/ImageZoom.js.map +1 -0
- package/dist/organisms/ImageGallery/index.d.ts +6 -0
- package/dist/organisms/ImageGallery/index.js +4 -0
- package/dist/organisms/ImageGallery/index.js.map +1 -0
- package/dist/organisms/SlideOver/SlideOver.js +1 -1
- package/dist/organisms/SlideOver/SlideOver.js.map +1 -1
- package/package.json +2 -2
- package/src/atoms/Button/Button.tsx +1 -1
- package/src/index.ts +21 -0
- package/src/molecules/OrderSummary/OrderSummary.tsx +110 -0
- package/src/molecules/OrderSummary/index.tsx +2 -0
- package/src/organisms/CartSidebar/CartSidebar.tsx +95 -0
- package/src/organisms/CartSidebar/CartSidebarFooter.tsx +7 -0
- package/src/organisms/CartSidebar/CartSidebarList.tsx +9 -0
- package/src/organisms/CartSidebar/index.ts +4 -0
- package/src/organisms/ImageGallery/ImageGallery.tsx +85 -0
- package/src/organisms/ImageGallery/ImageGallerySelector.tsx +148 -0
- package/src/organisms/ImageGallery/ImageZoom.tsx +14 -0
- package/src/organisms/ImageGallery/index.ts +8 -0
- package/src/organisms/SlideOver/SlideOver.tsx +1 -0
|
@@ -6,7 +6,7 @@ const Button = forwardRef(function Button({ children, variant, inverse, size = '
|
|
|
6
6
|
loadingLabel,
|
|
7
7
|
React.createElement(Loader, { variant: variant === 'primary' && !inverse ? 'light' : 'dark' }))),
|
|
8
8
|
React.isValidElement(icon) && iconPosition === 'left' && React.createElement("span", { "data-fs-button-icon": true }, icon),
|
|
9
|
-
React.createElement("span", null, children),
|
|
9
|
+
children && React.createElement("span", null, children),
|
|
10
10
|
React.isValidElement(icon) && iconPosition === 'right' && React.createElement("span", { "data-fs-button-icon": true }, icon)));
|
|
11
11
|
});
|
|
12
12
|
export default Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/atoms/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM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AAO,EAC/B,QAAQ,EAAE,QAAQ,iBACL,MAAM,KACf,UAAU;QAEb,OAAO,IAAI,CACV;YACG,YAAY;YACb,oBAAC,MAAM,IACL,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,GAC7D,CACA,CACL;QACA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,YAAY,KAAK,MAAM,IAAI,6DAA2B,IAAI,CAAQ;QAChG,QAAQ,IAAI,kCAAO,QAAQ,CAAQ;QACnC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,YAAY,KAAK,OAAO,IAAI,6DAA2B,IAAI,CAAQ,CAC3F,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export { default as LinkButton } from './molecules/LinkButton';
|
|
|
55
55
|
export type { LinkButtonProps } from './molecules/LinkButton';
|
|
56
56
|
export { default as Modal, ModalHeader, ModalBody } from './molecules/Modal';
|
|
57
57
|
export type { ModalProps, ModalHeaderProps } from './molecules/Modal';
|
|
58
|
+
export { default as OrderSummary } from './molecules/OrderSummary';
|
|
59
|
+
export type { OrderSummaryProps } from './molecules/OrderSummary';
|
|
58
60
|
export { default as ProductCard, ProductCardImage, ProductCardContent, } from './molecules/ProductCard';
|
|
59
61
|
export type { ProductCardProps, ProductCardImageProps, ProductCardContentProps, } from './molecules/ProductCard';
|
|
60
62
|
export { default as ProductTitle } from './molecules/ProductTitle';
|
|
@@ -95,10 +97,14 @@ export { default as ToggleField } from './molecules/ToggleField';
|
|
|
95
97
|
export type { ToggleFieldProps } from './molecules/ToggleField';
|
|
96
98
|
export { default as QuantitySelector } from './molecules/QuantitySelector';
|
|
97
99
|
export type { QuantitySelectorProps } from './molecules/QuantitySelector';
|
|
100
|
+
export { default as CartSidebar, CartSidebarList, CartSidebarFooter, } from './organisms/CartSidebar';
|
|
101
|
+
export type { CartSidebarProps } from './organisms/CartSidebar';
|
|
98
102
|
export { default as Filter, FilterFacetBoolean, FilterFacetBooleanItem, FilterFacetRange, FilterFacets, FilterSlider, } from './organisms/Filter';
|
|
99
103
|
export type { FilterFacetBooleanItemProps, FilterFacetRangeProps, FilterFacetsProps, FilterProps, FilterSliderProps, } from './organisms/Filter';
|
|
100
104
|
export { default as Hero, HeroImage, HeroHeader } from './organisms/Hero';
|
|
101
105
|
export type { HeroProps, HeroImageProps, HeroHeaderProps, } from './organisms/Hero';
|
|
106
|
+
export { default as ImageGallery, ImageGallerySelector, ImageZoom, } from './organisms/ImageGallery';
|
|
107
|
+
export type { ImageElementData, ImageGalleryProps, ImageGallerySelectorProps, ImageZoomProps, } from './organisms/ImageGallery';
|
|
102
108
|
export { default as OutOfStock } from './organisms/OutOfStock';
|
|
103
109
|
export type { OutOfStockProps } from './organisms/OutOfStock';
|
|
104
110
|
export { default as PaymentMethods } from './organisms/PaymentMethods';
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export { default as Gift, GiftContent, GiftImage } from './molecules/Gift';
|
|
|
31
31
|
export { default as InputField } from './molecules/InputField';
|
|
32
32
|
export { default as LinkButton } from './molecules/LinkButton';
|
|
33
33
|
export { default as Modal, ModalHeader, ModalBody } from './molecules/Modal';
|
|
34
|
+
export { default as OrderSummary } from './molecules/OrderSummary';
|
|
34
35
|
export { default as ProductCard, ProductCardImage, ProductCardContent, } from './molecules/ProductCard';
|
|
35
36
|
export { default as ProductTitle } from './molecules/ProductTitle';
|
|
36
37
|
export { default as RadioField } from './molecules/RadioField';
|
|
@@ -53,8 +54,10 @@ export { default as Toggle } from './molecules/Toggle';
|
|
|
53
54
|
export { default as ToggleField } from './molecules/ToggleField';
|
|
54
55
|
export { default as QuantitySelector } from './molecules/QuantitySelector';
|
|
55
56
|
// Organisms
|
|
57
|
+
export { default as CartSidebar, CartSidebarList, CartSidebarFooter, } from './organisms/CartSidebar';
|
|
56
58
|
export { default as Filter, FilterFacetBoolean, FilterFacetBooleanItem, FilterFacetRange, FilterFacets, FilterSlider, } from './organisms/Filter';
|
|
57
59
|
export { default as Hero, HeroImage, HeroHeader } from './organisms/Hero';
|
|
60
|
+
export { default as ImageGallery, ImageGallerySelector, ImageZoom, } from './organisms/ImageGallery';
|
|
58
61
|
export { default as OutOfStock } from './organisms/OutOfStock';
|
|
59
62
|
export { default as PaymentMethods } from './organisms/PaymentMethods';
|
|
60
63
|
export { default as PriceRange } from './organisms/PriceRange';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,SAAS,CAAA;AAEvB,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe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oB,EACpB,SAAS,GACV,MAAM,0BAA0B,CAAA;AAQjC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAG9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGtE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAG9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAGhE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAG9E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HTMLAttributes } from 'react';
|
|
3
|
+
export interface OrderSummaryProps extends HTMLAttributes<HTMLUListElement> {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
6
|
+
* testing-library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Label for the subtotal value of the order. Will only show if subtotalValue is provided.
|
|
11
|
+
*/
|
|
12
|
+
subtotalLabel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Subtotal value of the order. If provided, subtotal label and value will be shown.
|
|
15
|
+
*/
|
|
16
|
+
subtotalValue?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Label for the discount value for the order. Will only show if discountValue is provided.
|
|
19
|
+
*/
|
|
20
|
+
discountLabel?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Discount value for the order. If provided, discount label and value will be shown.
|
|
23
|
+
*/
|
|
24
|
+
discountValue?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Label for the total value of the order.
|
|
27
|
+
*/
|
|
28
|
+
totalLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Total value of the order.
|
|
31
|
+
*/
|
|
32
|
+
totalValue?: string;
|
|
33
|
+
}
|
|
34
|
+
declare const OrderSummary: React.ForwardRefExoticComponent<OrderSummaryProps & React.RefAttributes<HTMLUListElement>>;
|
|
35
|
+
export default OrderSummary;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { List } from '../../';
|
|
3
|
+
const OrderSummary = forwardRef(function OrderSummary({ testId = 'fs-order-summary', subtotalLabel, subtotalValue, discountLabel = 'Discount', discountValue, totalLabel = 'Total', totalValue, ...otherProps }, ref) {
|
|
4
|
+
return (React.createElement(List, { ref: ref, "data-fs-order-summary": true, "data-testid": testId, ...otherProps },
|
|
5
|
+
subtotalValue ? (React.createElement("li", { "data-fs-order-summary-subtotal": true },
|
|
6
|
+
React.createElement("span", { "data-fs-order-summary-subtotal-label": true, "data-testid": `${testId}-subtotal-label` }, subtotalLabel),
|
|
7
|
+
React.createElement("span", { "data-fs-order-summary-subtotal-value": true, "data-testid": `${testId}-subtotal-value` }, subtotalValue))) : null,
|
|
8
|
+
discountValue ? (React.createElement("li", { "data-fs-order-summary-discount": true },
|
|
9
|
+
React.createElement("span", { "data-fs-order-summary-discount-label": true, "data-testid": `${testId}-discount-label` }, discountLabel),
|
|
10
|
+
React.createElement("span", { "data-fs-order-summary-discount-value": true, "data-testid": `${testId}-discount-value` }, discountValue))) : null,
|
|
11
|
+
React.createElement("li", { "data-fs-order-summary-total": true },
|
|
12
|
+
React.createElement("span", { "data-fs-order-summary-total-label": true, "data-testid": `${testId}-total-label` }, totalLabel),
|
|
13
|
+
React.createElement("span", { "data-fs-order-summary-total-value": true, "data-testid": `${testId}-total-value` }, totalValue))));
|
|
14
|
+
});
|
|
15
|
+
export default OrderSummary;
|
|
16
|
+
//# sourceMappingURL=OrderSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderSummary.js","sourceRoot":"","sources":["../../../src/molecules/OrderSummary/OrderSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAkC7B,MAAM,YAAY,GAAG,UAAU,CAC7B,SAAS,YAAY,CACnB,EACE,MAAM,GAAG,kBAAkB,EAC3B,aAAa,EACb,aAAa,EACb,aAAa,GAAG,UAAU,EAC1B,aAAa,EACb,UAAU,GAAG,OAAO,EACpB,UAAU,EACV,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,oBAAC,IAAI,IACH,GAAG,EAAE,GAAG,gDAEK,MAAM,KACf,UAAU;QAEb,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACP,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACR;YACE,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN;YACP,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN,CACJ,CACA,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/OrderSummary/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { SlideOverDirection, SlideOverWidthSize } from '../SlideOver';
|
|
4
|
+
export interface CartSidebarProps {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
7
|
+
* testing-library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Title for the CartSidebar component.
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Represents the side that the CartSidebar comes from.
|
|
16
|
+
*/
|
|
17
|
+
direction?: SlideOverDirection;
|
|
18
|
+
/**
|
|
19
|
+
* Represents the size of the CartSidebar.
|
|
20
|
+
*/
|
|
21
|
+
size?: SlideOverWidthSize;
|
|
22
|
+
/**
|
|
23
|
+
* Total of item in the Cart.
|
|
24
|
+
*/
|
|
25
|
+
totalItems: number;
|
|
26
|
+
/**
|
|
27
|
+
* A React component that will be rendered as an icon on the Alert component.
|
|
28
|
+
*/
|
|
29
|
+
alertIcon?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The content for Alert component.
|
|
32
|
+
*/
|
|
33
|
+
alertText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Function called when Close Button is clicked.
|
|
36
|
+
*/
|
|
37
|
+
onClose: () => void;
|
|
38
|
+
}
|
|
39
|
+
declare function CartSidebar({ testId, title, size, direction, totalItems, children, alertIcon, alertText, onClose, }: PropsWithChildren<CartSidebarProps>): JSX.Element;
|
|
40
|
+
export default CartSidebar;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert, Badge, SlideOver, SlideOverHeader, useFadeEffect, useUI, } from '../../';
|
|
3
|
+
function CartSidebar({ testId = 'fs-cart-sidebar', title = 'Your Cart', size = 'partial', direction = 'rightSide', totalItems, children, alertIcon, alertText, onClose, }) {
|
|
4
|
+
const { fade, fadeOut } = useFadeEffect();
|
|
5
|
+
const { closeCart } = useUI();
|
|
6
|
+
return (React.createElement(SlideOver, { "data-fs-cart-sidebar": true, isOpen: true, fade: fade, onDismiss: fadeOut, size: size, direction: direction, onTransitionEnd: () => fade === 'out' && closeCart(), testId: testId },
|
|
7
|
+
React.createElement(SlideOverHeader, { closeBtnProps: { testId: 'fs-cart-sidebar-button-close' }, onClose: () => {
|
|
8
|
+
onClose();
|
|
9
|
+
fadeOut();
|
|
10
|
+
} },
|
|
11
|
+
React.createElement("h2", { "data-fs-cart-sidebar-title": true },
|
|
12
|
+
title,
|
|
13
|
+
React.createElement(Badge, { variant: "info" }, totalItems))),
|
|
14
|
+
alertText && React.createElement(Alert, { icon: alertIcon }, alertText),
|
|
15
|
+
children));
|
|
16
|
+
}
|
|
17
|
+
export default CartSidebar;
|
|
18
|
+
//# sourceMappingURL=CartSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CartSidebar.js","sourceRoot":"","sources":["../../../src/organisms/CartSidebar/CartSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAGhD,OAAO,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,eAAe,EACf,aAAa,EACb,KAAK,GACN,MAAM,QAAQ,CAAA;AAwCf,SAAS,WAAW,CAAC,EACnB,MAAM,GAAG,iBAAiB,EAC1B,KAAK,GAAG,WAAW,EACnB,IAAI,GAAG,SAAS,EAChB,SAAS,GAAG,WAAW,EACvB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,GAC6B;IACpC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAAA;IACzC,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,CAAA;IAE7B,OAAO,CACL,oBAAC,SAAS,kCAER,MAAM,QACN,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,OAAO,EAClB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,KAAK,KAAK,IAAI,SAAS,EAAE,EACpD,MAAM,EAAE,MAAM;QAEd,oBAAC,eAAe,IACd,aAAa,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE,EACzD,OAAO,EAAE,GAAG,EAAE;gBACZ,OAAO,EAAE,CAAA;gBACT,OAAO,EAAE,CAAA;YACX,CAAC;YAED;gBACG,KAAK;gBACN,oBAAC,KAAK,IAAC,OAAO,EAAC,MAAM,IAAE,UAAU,CAAS,CACvC,CACW;QAEjB,SAAS,IAAI,oBAAC,KAAK,IAAC,IAAI,EAAE,SAAS,IAAG,SAAS,CAAS;QACxD,QAAQ,CACC,CACb,CAAA;AACH,CAAC;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CartSidebarFooter.js","sourceRoot":"","sources":["../../../src/organisms/CartSidebar/CartSidebarFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAExC,SAAS,iBAAiB,CAAC,EAAE,QAAQ,EAA2B;IAC9D,OAAO,uEAAqC,QAAQ,CAAU,CAAA;AAChE,CAAC;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List } from '../../';
|
|
3
|
+
function CartSidebarList({ children }) {
|
|
4
|
+
return React.createElement(List, { "data-fs-cart-sidebar-list": true }, children);
|
|
5
|
+
}
|
|
6
|
+
export default CartSidebarList;
|
|
7
|
+
//# sourceMappingURL=CartSidebarList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CartSidebarList.js","sourceRoot":"","sources":["../../../src/organisms/CartSidebar/CartSidebarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,SAAS,eAAe,CAAC,EAAE,QAAQ,EAA2B;IAC5D,OAAO,oBAAC,IAAI,yCAA4B,QAAQ,CAAQ,CAAA;AAC1D,CAAC;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/organisms/CartSidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HTMLAttributes, FunctionComponent } from 'react';
|
|
3
|
+
type ImageComponentType = FunctionComponent<{
|
|
4
|
+
url: string;
|
|
5
|
+
alternateName?: string;
|
|
6
|
+
loading?: 'eager' | 'lazy';
|
|
7
|
+
}>;
|
|
8
|
+
export interface ImageElementData {
|
|
9
|
+
/**
|
|
10
|
+
* Image URL.
|
|
11
|
+
*/
|
|
12
|
+
url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Alternative text description of the image.
|
|
15
|
+
*/
|
|
16
|
+
alternateName: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ImageGalleryProps extends HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
/**
|
|
20
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
21
|
+
* testing-library, and jest).
|
|
22
|
+
*/
|
|
23
|
+
testId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* List of images that should be rendered.
|
|
26
|
+
*/
|
|
27
|
+
images: ImageElementData[];
|
|
28
|
+
/**
|
|
29
|
+
* Function that returns a React component that will be used to render images.
|
|
30
|
+
*/
|
|
31
|
+
ImageComponent: ImageComponentType;
|
|
32
|
+
/**
|
|
33
|
+
* The currently active thumbnail.
|
|
34
|
+
*/
|
|
35
|
+
selectedImageIdx: number;
|
|
36
|
+
/**
|
|
37
|
+
* Event handler for clicks on each thumbnail.
|
|
38
|
+
*/
|
|
39
|
+
setSelectedImageIdx: (idx: number) => void;
|
|
40
|
+
}
|
|
41
|
+
declare const ImageGallery: React.ForwardRefExoticComponent<ImageGalleryProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export default ImageGallery;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { ImageGallerySelector } from '../..';
|
|
3
|
+
const ImageGallery = forwardRef(function ImageGallery({ images, children, ImageComponent, selectedImageIdx, setSelectedImageIdx, testId = 'fs-image-gallery', ...otherProps }, ref) {
|
|
4
|
+
const hasSelector = images.length > 1;
|
|
5
|
+
return (React.createElement("section", { ref: ref, "data-fs-image-gallery": hasSelector ? 'with-selector' : 'without-selector', "data-testid": testId, ...otherProps },
|
|
6
|
+
children,
|
|
7
|
+
hasSelector && (React.createElement(ImageGallerySelector, { images: images, onSelect: setSelectedImageIdx, currentImageIdx: selectedImageIdx, ImageComponent: ImageComponent }))));
|
|
8
|
+
});
|
|
9
|
+
export default ImageGallery;
|
|
10
|
+
//# sourceMappingURL=ImageGallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageGallery.js","sourceRoot":"","sources":["../../../src/organisms/ImageGallery/ImageGallery.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AA2C5C,MAAM,YAAY,GAAG,UAAU,CAC7B,SAAS,YAAY,CACnB,EACE,MAAM,EACN,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,GAAG,kBAAkB,EAC3B,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAErC,OAAO,CACL,iCACE,GAAG,EAAE,GAAG,2BAEN,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB,iBAEvC,MAAM,KACf,UAAU;QAEb,QAAQ;QACR,WAAW,IAAI,CACd,oBAAC,oBAAoB,IACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,mBAAmB,EAC7B,eAAe,EAAE,gBAAgB,EACjC,cAAc,EAAE,cAAc,GAC9B,CACH,CACO,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AriaAttributes } from 'react';
|
|
2
|
+
import type { ImageGalleryProps } from '.';
|
|
3
|
+
export interface ImageGallerySelectorProps extends Pick<ImageGalleryProps, 'images' | 'ImageComponent'> {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
6
|
+
* testing-library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The currently active thumbnail.
|
|
11
|
+
*/
|
|
12
|
+
currentImageIdx: number;
|
|
13
|
+
/**
|
|
14
|
+
* For accessibility purposes, define a string that labels the current element.
|
|
15
|
+
*/
|
|
16
|
+
'aria-label'?: AriaAttributes['aria-label'];
|
|
17
|
+
/**
|
|
18
|
+
* For accessibility purposes, define a string that labels the left navigation icon button.
|
|
19
|
+
*/
|
|
20
|
+
navigationButtonLeftAriaLabel?: AriaAttributes['aria-label'];
|
|
21
|
+
/**
|
|
22
|
+
* For accessibility purposes, define a string that labels the right navigation button icon.
|
|
23
|
+
*/
|
|
24
|
+
navigationButtonRightAriaLabel?: AriaAttributes['aria-label'];
|
|
25
|
+
/**
|
|
26
|
+
* Event handler for clicks on each thumbnail.
|
|
27
|
+
*/
|
|
28
|
+
onSelect: (imageIdx: number) => void;
|
|
29
|
+
}
|
|
30
|
+
declare function ImageGallerySelector({ images, onSelect, ImageComponent, currentImageIdx, testId, 'aria-label': ariaLabel, navigationButtonLeftAriaLabel, navigationButtonRightAriaLabel, }: ImageGallerySelectorProps): JSX.Element;
|
|
31
|
+
export default ImageGallerySelector;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useRef, useState, useCallback } from 'react';
|
|
2
|
+
import { InView } from 'react-intersection-observer';
|
|
3
|
+
import { Button, Icon, IconButton } from '../..';
|
|
4
|
+
const SCROLL_MARGIN_VALUE = 400;
|
|
5
|
+
const moveScroll = (container, value) => {
|
|
6
|
+
if (container) {
|
|
7
|
+
if (container.scrollHeight > container.clientHeight) {
|
|
8
|
+
// TODO: Temporary workaround for scroll-behavior with scrollTop – Safari 15.4) https://developer.apple.com/forums/thread/703294
|
|
9
|
+
container.style.overflow = 'auto';
|
|
10
|
+
window.requestAnimationFrame(() => container.scrollTo({ top: value, behavior: 'smooth' }));
|
|
11
|
+
setTimeout(() => (container.style.overflow = 'hidden'), 2000);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
container.scrollLeft += value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const hasScroll = (container) => {
|
|
19
|
+
if (container) {
|
|
20
|
+
return (container.scrollHeight > container.clientHeight ||
|
|
21
|
+
container.scrollWidth > container.clientWidth);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
function ImageGallerySelector({ images, onSelect, ImageComponent, currentImageIdx, testId = 'fs-image-gallery-selector', 'aria-label': ariaLabel = 'Product Images', navigationButtonLeftAriaLabel = 'Backward slide image selector', navigationButtonRightAriaLabel = 'Forward slide image selector', }) {
|
|
26
|
+
const elementsRef = useRef(null);
|
|
27
|
+
const elementHasScroll = hasScroll(elementsRef.current);
|
|
28
|
+
const [firstImageInView, setFirstImageInView] = useState(true);
|
|
29
|
+
const [lastImageInView, setLastImageInView] = useState(true);
|
|
30
|
+
const inViewChange = useCallback((idx, inView) => {
|
|
31
|
+
idx === 0 && setFirstImageInView(inView);
|
|
32
|
+
idx === images.length - 1 && setLastImageInView(inView);
|
|
33
|
+
}, [images.length]);
|
|
34
|
+
return (React.createElement("section", { "data-fs-image-gallery-selector": true, "data-testid": testId, "aria-label": ariaLabel, "aria-roledescription": "carousel" },
|
|
35
|
+
elementHasScroll && !firstImageInView && (React.createElement("div", { "data-fs-image-gallery-selector-control": true },
|
|
36
|
+
React.createElement(IconButton, { "data-fs-image-gallery-selector-control-button": true, "aria-label": navigationButtonLeftAriaLabel, icon: React.createElement(Icon, { name: "ArrowLeft" }), size: "small", onClick: () => moveScroll(elementsRef.current, -SCROLL_MARGIN_VALUE) }))),
|
|
37
|
+
React.createElement("div", { "data-fs-image-gallery-selector-elements": true, ref: elementsRef }, images.map((image, idx) => {
|
|
38
|
+
return (React.createElement(InView, { key: idx, onChange: (inView) => inViewChange(idx, inView) },
|
|
39
|
+
React.createElement(Button, { key: idx, "aria-label": `${image.alternateName} - Image ${idx + 1} of ${images.length}`, onClick: () => onSelect(idx), "data-fs-image-gallery-selector-thumbnail": idx === currentImageIdx ? 'selected' : 'true' },
|
|
40
|
+
React.createElement(ImageComponent, { url: image.url ?? '', loading: idx === 0 ? 'eager' : 'lazy', alternateName: image.alternateName ?? '' }))));
|
|
41
|
+
})),
|
|
42
|
+
elementHasScroll && !lastImageInView && (React.createElement("div", { "data-fs-image-gallery-selector-control": true },
|
|
43
|
+
React.createElement(IconButton, { "data-fs-image-gallery-selector-control-button": true, "aria-label": navigationButtonRightAriaLabel, icon: React.createElement(Icon, { name: "ArrowLeft" }), size: "small", onClick: () => moveScroll(elementsRef.current, +SCROLL_MARGIN_VALUE) })))));
|
|
44
|
+
}
|
|
45
|
+
export default ImageGallerySelector;
|
|
46
|
+
//# sourceMappingURL=ImageGallerySelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageGallerySelector.js","sourceRoot":"","sources":["../../../src/organisms/ImageGallery/ImageGallerySelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,O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AAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,8CAE1B,GAAG,KAAK,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;oBAG/C,oBAAC,cAAc,IACb,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,EACpB,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EACrC,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,EAAE,GACxC,CACK,CACF,CACV,CAAA;QACH,CAAC,CAAC,CACE;QACL,gBAAgB,IAAI,CAAC,eAAe,IAAI,CACvC;YACE,oBAAC,UAAU,yEAEG,8BAA8B,EAC1C,IAAI,EAAE,oBAAC,IAAI,IAAC,IAAI,EAAC,WAAW,GAAG,EAC/B,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CACZ,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,mBAAmB,CAAC,GAEvD,CACE,CACP,CACO,CACX,CAAA;AACH,CAAC;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageZoom.js","sourceRoot":"","sources":["../../../src/organisms/ImageGallery/ImageZoom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAqC,EAAE,EAAE;IACpE,OAAO,0CAAG,QAAQ,CAAI,CAAA;AACxB,CAAC,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default } from './ImageGallery';
|
|
2
|
+
export type { ImageGalleryProps, ImageElementData } from './ImageGallery';
|
|
3
|
+
export { default as ImageGallerySelector } from './ImageGallerySelector';
|
|
4
|
+
export type { ImageGallerySelectorProps } from './ImageGallerySelector';
|
|
5
|
+
export { default as ImageZoom } from './ImageZoom';
|
|
6
|
+
export type { ImageZoomProps } from './ImageZoom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/organisms/ImageGallery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAGxC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAGxE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Modal } from '../../';
|
|
3
3
|
function SlideOver({ isOpen, direction = 'leftSide', size = 'full', fade = 'out', children, onDismiss, testId = 'fs-slide-over', ...otherProps }) {
|
|
4
|
-
return (React.createElement(Modal, { "data-fs-modal": null, "data-fs-slide-over": true, "data-fs-slide-over-direction": direction, "data-fs-slide-over-size": size, "data-fs-slide-over-state": fade, isOpen: isOpen, onDismiss: onDismiss, ...otherProps }, children));
|
|
4
|
+
return (React.createElement(Modal, { "data-fs-modal": null, "data-fs-slide-over": true, "data-fs-slide-over-direction": direction, "data-fs-slide-over-size": size, "data-fs-slide-over-state": fade, isOpen: isOpen, onDismiss: onDismiss, testId: testId, ...otherProps }, children));
|
|
5
5
|
}
|
|
6
6
|
export default SlideOver;
|
|
7
7
|
//# sourceMappingURL=SlideOver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlideOver.js","sourceRoot":"","sources":["../../../src/organisms/SlideOver/SlideOver.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAkC9B,SAAS,SAAS,CAAC,EACjB,MAAM,EACN,SAAS,GAAG,UAAU,EACtB,IAAI,GAAG,MAAM,EACb,IAAI,GAAG,KAAK,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,GAAG,eAAe,EACxB,GAAG,UAAU,EACE;IACf,OAAO,CACL,oBAAC,KAAK,qBACW,IAAI,8DAEW,SAAS,6BACd,IAAI,8BACH,IAAI,EAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"SlideOver.js","sourceRoot":"","sources":["../../../src/organisms/SlideOver/SlideOver.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAkC9B,SAAS,SAAS,CAAC,EACjB,MAAM,EACN,SAAS,GAAG,UAAU,EACtB,IAAI,GAAG,MAAM,EACb,IAAI,GAAG,KAAK,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,GAAG,eAAe,EACxB,GAAG,UAAU,EACE;IACf,OAAO,CACL,oBAAC,KAAK,qBACW,IAAI,8DAEW,SAAS,6BACd,IAAI,8BACH,IAAI,EAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,KACV,UAAU,IAEb,QAAQ,CACH,CACT,CAAA;AACH,CAAC;AAED,eAAe,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.103-alpha.0",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"author": "Emerson Laurentino @emersonlaurentino",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"node": "16.18.0",
|
|
31
31
|
"yarn": "1.19.1"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "cac804588d1f91794f39bf7b7ce8e18234a7286a"
|
|
34
34
|
}
|
|
@@ -82,7 +82,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
|
82
82
|
</p>
|
|
83
83
|
)}
|
|
84
84
|
{React.isValidElement(icon) && iconPosition === 'left' && <span data-fs-button-icon>{icon}</span>}
|
|
85
|
-
<span>{children}</span>
|
|
85
|
+
{children && <span>{children}</span>}
|
|
86
86
|
{React.isValidElement(icon) && iconPosition === 'right' && <span data-fs-button-icon>{icon}</span>}
|
|
87
87
|
</button>
|
|
88
88
|
)
|
package/src/index.ts
CHANGED
|
@@ -95,6 +95,8 @@ export { default as LinkButton } from './molecules/LinkButton'
|
|
|
95
95
|
export type { LinkButtonProps } from './molecules/LinkButton'
|
|
96
96
|
export { default as Modal, ModalHeader, ModalBody } from './molecules/Modal'
|
|
97
97
|
export type { ModalProps, ModalHeaderProps } from './molecules/Modal'
|
|
98
|
+
export { default as OrderSummary } from './molecules/OrderSummary'
|
|
99
|
+
export type { OrderSummaryProps } from './molecules/OrderSummary'
|
|
98
100
|
export {
|
|
99
101
|
default as ProductCard,
|
|
100
102
|
ProductCardImage,
|
|
@@ -189,6 +191,13 @@ export { default as QuantitySelector } from './molecules/QuantitySelector'
|
|
|
189
191
|
export type { QuantitySelectorProps } from './molecules/QuantitySelector'
|
|
190
192
|
|
|
191
193
|
// Organisms
|
|
194
|
+
export {
|
|
195
|
+
default as CartSidebar,
|
|
196
|
+
CartSidebarList,
|
|
197
|
+
CartSidebarFooter,
|
|
198
|
+
} from './organisms/CartSidebar'
|
|
199
|
+
export type { CartSidebarProps } from './organisms/CartSidebar'
|
|
200
|
+
|
|
192
201
|
export {
|
|
193
202
|
default as Filter,
|
|
194
203
|
FilterFacetBoolean,
|
|
@@ -212,6 +221,18 @@ export type {
|
|
|
212
221
|
HeroHeaderProps,
|
|
213
222
|
} from './organisms/Hero'
|
|
214
223
|
|
|
224
|
+
export {
|
|
225
|
+
default as ImageGallery,
|
|
226
|
+
ImageGallerySelector,
|
|
227
|
+
ImageZoom,
|
|
228
|
+
} from './organisms/ImageGallery'
|
|
229
|
+
export type {
|
|
230
|
+
ImageElementData,
|
|
231
|
+
ImageGalleryProps,
|
|
232
|
+
ImageGallerySelectorProps,
|
|
233
|
+
ImageZoomProps,
|
|
234
|
+
} from './organisms/ImageGallery'
|
|
235
|
+
|
|
215
236
|
export { default as OutOfStock } from './organisms/OutOfStock'
|
|
216
237
|
export type { OutOfStockProps } from './organisms/OutOfStock'
|
|
217
238
|
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
import { List } from '../../'
|
|
5
|
+
|
|
6
|
+
export interface OrderSummaryProps extends HTMLAttributes<HTMLUListElement> {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
9
|
+
* testing-library, and jest).
|
|
10
|
+
*/
|
|
11
|
+
testId?: string
|
|
12
|
+
/**
|
|
13
|
+
* Label for the subtotal value of the order. Will only show if subtotalValue is provided.
|
|
14
|
+
*/
|
|
15
|
+
subtotalLabel?: string
|
|
16
|
+
/**
|
|
17
|
+
* Subtotal value of the order. If provided, subtotal label and value will be shown.
|
|
18
|
+
*/
|
|
19
|
+
subtotalValue?: string
|
|
20
|
+
/**
|
|
21
|
+
* Label for the discount value for the order. Will only show if discountValue is provided.
|
|
22
|
+
*/
|
|
23
|
+
discountLabel?: string
|
|
24
|
+
/**
|
|
25
|
+
* Discount value for the order. If provided, discount label and value will be shown.
|
|
26
|
+
*/
|
|
27
|
+
discountValue?: string
|
|
28
|
+
/**
|
|
29
|
+
* Label for the total value of the order.
|
|
30
|
+
*/
|
|
31
|
+
totalLabel?: string
|
|
32
|
+
/**
|
|
33
|
+
* Total value of the order.
|
|
34
|
+
*/
|
|
35
|
+
totalValue?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const OrderSummary = forwardRef<HTMLUListElement, OrderSummaryProps>(
|
|
39
|
+
function OrderSummary(
|
|
40
|
+
{
|
|
41
|
+
testId = 'fs-order-summary',
|
|
42
|
+
subtotalLabel,
|
|
43
|
+
subtotalValue,
|
|
44
|
+
discountLabel = 'Discount',
|
|
45
|
+
discountValue,
|
|
46
|
+
totalLabel = 'Total',
|
|
47
|
+
totalValue,
|
|
48
|
+
...otherProps
|
|
49
|
+
},
|
|
50
|
+
ref
|
|
51
|
+
) {
|
|
52
|
+
return (
|
|
53
|
+
<List
|
|
54
|
+
ref={ref}
|
|
55
|
+
data-fs-order-summary
|
|
56
|
+
data-testid={testId}
|
|
57
|
+
{...otherProps}
|
|
58
|
+
>
|
|
59
|
+
{subtotalValue ? (
|
|
60
|
+
<li data-fs-order-summary-subtotal>
|
|
61
|
+
<span
|
|
62
|
+
data-fs-order-summary-subtotal-label
|
|
63
|
+
data-testid={`${testId}-subtotal-label`}
|
|
64
|
+
>
|
|
65
|
+
{subtotalLabel}
|
|
66
|
+
</span>
|
|
67
|
+
<span
|
|
68
|
+
data-fs-order-summary-subtotal-value
|
|
69
|
+
data-testid={`${testId}-subtotal-value`}
|
|
70
|
+
>
|
|
71
|
+
{subtotalValue}
|
|
72
|
+
</span>
|
|
73
|
+
</li>
|
|
74
|
+
) : null}
|
|
75
|
+
{discountValue ? (
|
|
76
|
+
<li data-fs-order-summary-discount>
|
|
77
|
+
<span
|
|
78
|
+
data-fs-order-summary-discount-label
|
|
79
|
+
data-testid={`${testId}-discount-label`}
|
|
80
|
+
>
|
|
81
|
+
{discountLabel}
|
|
82
|
+
</span>
|
|
83
|
+
<span
|
|
84
|
+
data-fs-order-summary-discount-value
|
|
85
|
+
data-testid={`${testId}-discount-value`}
|
|
86
|
+
>
|
|
87
|
+
{discountValue}
|
|
88
|
+
</span>
|
|
89
|
+
</li>
|
|
90
|
+
) : null}
|
|
91
|
+
<li data-fs-order-summary-total>
|
|
92
|
+
<span
|
|
93
|
+
data-fs-order-summary-total-label
|
|
94
|
+
data-testid={`${testId}-total-label`}
|
|
95
|
+
>
|
|
96
|
+
{totalLabel}
|
|
97
|
+
</span>
|
|
98
|
+
<span
|
|
99
|
+
data-fs-order-summary-total-value
|
|
100
|
+
data-testid={`${testId}-total-value`}
|
|
101
|
+
>
|
|
102
|
+
{totalValue}
|
|
103
|
+
</span>
|
|
104
|
+
</li>
|
|
105
|
+
</List>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
export default OrderSummary
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Alert,
|
|
6
|
+
Badge,
|
|
7
|
+
SlideOver,
|
|
8
|
+
SlideOverHeader,
|
|
9
|
+
useFadeEffect,
|
|
10
|
+
useUI,
|
|
11
|
+
} from '../../'
|
|
12
|
+
|
|
13
|
+
import { SlideOverDirection, SlideOverWidthSize } from '../SlideOver'
|
|
14
|
+
|
|
15
|
+
export interface CartSidebarProps {
|
|
16
|
+
/**
|
|
17
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
18
|
+
* testing-library, and jest).
|
|
19
|
+
*/
|
|
20
|
+
testId?: string
|
|
21
|
+
/**
|
|
22
|
+
* Title for the CartSidebar component.
|
|
23
|
+
*/
|
|
24
|
+
title?: string
|
|
25
|
+
/**
|
|
26
|
+
* Represents the side that the CartSidebar comes from.
|
|
27
|
+
*/
|
|
28
|
+
direction?: SlideOverDirection
|
|
29
|
+
/**
|
|
30
|
+
* Represents the size of the CartSidebar.
|
|
31
|
+
*/
|
|
32
|
+
size?: SlideOverWidthSize
|
|
33
|
+
/**
|
|
34
|
+
* Total of item in the Cart.
|
|
35
|
+
*/
|
|
36
|
+
totalItems: number
|
|
37
|
+
/**
|
|
38
|
+
* A React component that will be rendered as an icon on the Alert component.
|
|
39
|
+
*/
|
|
40
|
+
alertIcon?: ReactNode
|
|
41
|
+
/**
|
|
42
|
+
* The content for Alert component.
|
|
43
|
+
*/
|
|
44
|
+
alertText?: string
|
|
45
|
+
/**
|
|
46
|
+
* Function called when Close Button is clicked.
|
|
47
|
+
*/
|
|
48
|
+
onClose: () => void
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CartSidebar({
|
|
52
|
+
testId = 'fs-cart-sidebar',
|
|
53
|
+
title = 'Your Cart',
|
|
54
|
+
size = 'partial',
|
|
55
|
+
direction = 'rightSide',
|
|
56
|
+
totalItems,
|
|
57
|
+
children,
|
|
58
|
+
alertIcon,
|
|
59
|
+
alertText,
|
|
60
|
+
onClose,
|
|
61
|
+
}: PropsWithChildren<CartSidebarProps>) {
|
|
62
|
+
const { fade, fadeOut } = useFadeEffect()
|
|
63
|
+
const { closeCart } = useUI()
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<SlideOver
|
|
67
|
+
data-fs-cart-sidebar
|
|
68
|
+
isOpen
|
|
69
|
+
fade={fade}
|
|
70
|
+
onDismiss={fadeOut}
|
|
71
|
+
size={size}
|
|
72
|
+
direction={direction}
|
|
73
|
+
onTransitionEnd={() => fade === 'out' && closeCart()}
|
|
74
|
+
testId={testId}
|
|
75
|
+
>
|
|
76
|
+
<SlideOverHeader
|
|
77
|
+
closeBtnProps={{ testId: 'fs-cart-sidebar-button-close' }}
|
|
78
|
+
onClose={() => {
|
|
79
|
+
onClose()
|
|
80
|
+
fadeOut()
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<h2 data-fs-cart-sidebar-title>
|
|
84
|
+
{title}
|
|
85
|
+
<Badge variant="info">{totalItems}</Badge>
|
|
86
|
+
</h2>
|
|
87
|
+
</SlideOverHeader>
|
|
88
|
+
|
|
89
|
+
{alertText && <Alert icon={alertIcon}>{alertText}</Alert>}
|
|
90
|
+
{children}
|
|
91
|
+
</SlideOver>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default CartSidebar
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, FunctionComponent } from 'react'
|
|
3
|
+
|
|
4
|
+
import { ImageGallerySelector } from '../..'
|
|
5
|
+
|
|
6
|
+
type ImageComponentType = FunctionComponent<{
|
|
7
|
+
url: string
|
|
8
|
+
alternateName?: string
|
|
9
|
+
loading?: 'eager' | 'lazy'
|
|
10
|
+
}>
|
|
11
|
+
|
|
12
|
+
export interface ImageElementData {
|
|
13
|
+
/**
|
|
14
|
+
* Image URL.
|
|
15
|
+
*/
|
|
16
|
+
url: string
|
|
17
|
+
/**
|
|
18
|
+
* Alternative text description of the image.
|
|
19
|
+
*/
|
|
20
|
+
alternateName: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ImageGalleryProps extends HTMLAttributes<HTMLDivElement> {
|
|
24
|
+
/**
|
|
25
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
26
|
+
* testing-library, and jest).
|
|
27
|
+
*/
|
|
28
|
+
testId?: string
|
|
29
|
+
/**
|
|
30
|
+
* List of images that should be rendered.
|
|
31
|
+
*/
|
|
32
|
+
images: ImageElementData[]
|
|
33
|
+
/**
|
|
34
|
+
* Function that returns a React component that will be used to render images.
|
|
35
|
+
*/
|
|
36
|
+
ImageComponent: ImageComponentType
|
|
37
|
+
/**
|
|
38
|
+
* The currently active thumbnail.
|
|
39
|
+
*/
|
|
40
|
+
selectedImageIdx: number
|
|
41
|
+
/**
|
|
42
|
+
* Event handler for clicks on each thumbnail.
|
|
43
|
+
*/
|
|
44
|
+
setSelectedImageIdx: (idx: number) => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const ImageGallery = forwardRef<HTMLDivElement, ImageGalleryProps>(
|
|
48
|
+
function ImageGallery(
|
|
49
|
+
{
|
|
50
|
+
images,
|
|
51
|
+
children,
|
|
52
|
+
ImageComponent,
|
|
53
|
+
selectedImageIdx,
|
|
54
|
+
setSelectedImageIdx,
|
|
55
|
+
testId = 'fs-image-gallery',
|
|
56
|
+
...otherProps
|
|
57
|
+
},
|
|
58
|
+
ref
|
|
59
|
+
) {
|
|
60
|
+
const hasSelector = images.length > 1
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<section
|
|
64
|
+
ref={ref}
|
|
65
|
+
data-fs-image-gallery={
|
|
66
|
+
hasSelector ? 'with-selector' : 'without-selector'
|
|
67
|
+
}
|
|
68
|
+
data-testid={testId}
|
|
69
|
+
{...otherProps}
|
|
70
|
+
>
|
|
71
|
+
{children}
|
|
72
|
+
{hasSelector && (
|
|
73
|
+
<ImageGallerySelector
|
|
74
|
+
images={images}
|
|
75
|
+
onSelect={setSelectedImageIdx}
|
|
76
|
+
currentImageIdx={selectedImageIdx}
|
|
77
|
+
ImageComponent={ImageComponent}
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
80
|
+
</section>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
export default ImageGallery
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React, { useRef, useState, useCallback } from 'react'
|
|
2
|
+
import type { AriaAttributes } from 'react'
|
|
3
|
+
import { InView } from 'react-intersection-observer'
|
|
4
|
+
import { Button, Icon, IconButton } from '../..'
|
|
5
|
+
|
|
6
|
+
import type { ImageGalleryProps } from '.'
|
|
7
|
+
|
|
8
|
+
export interface ImageGallerySelectorProps
|
|
9
|
+
extends Pick<ImageGalleryProps, 'images' | 'ImageComponent'> {
|
|
10
|
+
/**
|
|
11
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
12
|
+
* testing-library, and jest).
|
|
13
|
+
*/
|
|
14
|
+
testId?: string
|
|
15
|
+
/**
|
|
16
|
+
* The currently active thumbnail.
|
|
17
|
+
*/
|
|
18
|
+
currentImageIdx: number
|
|
19
|
+
/**
|
|
20
|
+
* For accessibility purposes, define a string that labels the current element.
|
|
21
|
+
*/
|
|
22
|
+
'aria-label'?: AriaAttributes['aria-label']
|
|
23
|
+
/**
|
|
24
|
+
* For accessibility purposes, define a string that labels the left navigation icon button.
|
|
25
|
+
*/
|
|
26
|
+
navigationButtonLeftAriaLabel?: AriaAttributes['aria-label']
|
|
27
|
+
/**
|
|
28
|
+
* For accessibility purposes, define a string that labels the right navigation button icon.
|
|
29
|
+
*/
|
|
30
|
+
navigationButtonRightAriaLabel?: AriaAttributes['aria-label']
|
|
31
|
+
/**
|
|
32
|
+
* Event handler for clicks on each thumbnail.
|
|
33
|
+
*/
|
|
34
|
+
onSelect: (imageIdx: number) => void
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const SCROLL_MARGIN_VALUE = 400
|
|
38
|
+
|
|
39
|
+
const moveScroll = (container: HTMLDivElement | null, value: number) => {
|
|
40
|
+
if (container) {
|
|
41
|
+
if (container.scrollHeight > container.clientHeight) {
|
|
42
|
+
// TODO: Temporary workaround for scroll-behavior with scrollTop – Safari 15.4) https://developer.apple.com/forums/thread/703294
|
|
43
|
+
container.style.overflow = 'auto'
|
|
44
|
+
window.requestAnimationFrame(() =>
|
|
45
|
+
container.scrollTo({ top: value, behavior: 'smooth' })
|
|
46
|
+
)
|
|
47
|
+
setTimeout(() => (container.style.overflow = 'hidden'), 2000)
|
|
48
|
+
} else {
|
|
49
|
+
container.scrollLeft += value
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const hasScroll = (container: HTMLDivElement | null): boolean => {
|
|
55
|
+
if (container) {
|
|
56
|
+
return (
|
|
57
|
+
container.scrollHeight > container.clientHeight ||
|
|
58
|
+
container.scrollWidth > container.clientWidth
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function ImageGallerySelector({
|
|
66
|
+
images,
|
|
67
|
+
onSelect,
|
|
68
|
+
ImageComponent,
|
|
69
|
+
currentImageIdx,
|
|
70
|
+
testId = 'fs-image-gallery-selector',
|
|
71
|
+
'aria-label': ariaLabel = 'Product Images',
|
|
72
|
+
navigationButtonLeftAriaLabel = 'Backward slide image selector',
|
|
73
|
+
navigationButtonRightAriaLabel = 'Forward slide image selector',
|
|
74
|
+
}: ImageGallerySelectorProps) {
|
|
75
|
+
const elementsRef = useRef<HTMLDivElement>(null)
|
|
76
|
+
const elementHasScroll = hasScroll(elementsRef.current)
|
|
77
|
+
const [firstImageInView, setFirstImageInView] = useState(true)
|
|
78
|
+
const [lastImageInView, setLastImageInView] = useState(true)
|
|
79
|
+
|
|
80
|
+
const inViewChange= useCallback((idx: number, inView: boolean) => {
|
|
81
|
+
idx === 0 && setFirstImageInView(inView)
|
|
82
|
+
idx === images.length - 1 && setLastImageInView(inView)
|
|
83
|
+
}, [images.length])
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<section
|
|
87
|
+
data-fs-image-gallery-selector
|
|
88
|
+
data-testid={testId}
|
|
89
|
+
aria-label={ariaLabel}
|
|
90
|
+
aria-roledescription="carousel"
|
|
91
|
+
>
|
|
92
|
+
{elementHasScroll && !firstImageInView && (
|
|
93
|
+
<div data-fs-image-gallery-selector-control>
|
|
94
|
+
<IconButton
|
|
95
|
+
data-fs-image-gallery-selector-control-button
|
|
96
|
+
aria-label={navigationButtonLeftAriaLabel}
|
|
97
|
+
icon={<Icon name="ArrowLeft" />}
|
|
98
|
+
size="small"
|
|
99
|
+
onClick={() =>
|
|
100
|
+
moveScroll(elementsRef.current, -SCROLL_MARGIN_VALUE)
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
<div data-fs-image-gallery-selector-elements ref={elementsRef}>
|
|
106
|
+
{images.map((image, idx) => {
|
|
107
|
+
return (
|
|
108
|
+
<InView
|
|
109
|
+
key={idx}
|
|
110
|
+
onChange={(inView) => inViewChange(idx, inView)}>
|
|
111
|
+
<Button
|
|
112
|
+
key={idx}
|
|
113
|
+
aria-label={`${image.alternateName} - Image ${idx + 1} of ${
|
|
114
|
+
images.length
|
|
115
|
+
}`}
|
|
116
|
+
onClick={() => onSelect(idx)}
|
|
117
|
+
data-fs-image-gallery-selector-thumbnail={
|
|
118
|
+
idx === currentImageIdx ? 'selected' : 'true'
|
|
119
|
+
}
|
|
120
|
+
>
|
|
121
|
+
<ImageComponent
|
|
122
|
+
url={image.url ?? ''}
|
|
123
|
+
loading={idx === 0 ? 'eager' : 'lazy'}
|
|
124
|
+
alternateName={image.alternateName ?? ''}
|
|
125
|
+
/>
|
|
126
|
+
</Button>
|
|
127
|
+
</InView>
|
|
128
|
+
)
|
|
129
|
+
})}
|
|
130
|
+
</div>
|
|
131
|
+
{elementHasScroll && !lastImageInView && (
|
|
132
|
+
<div data-fs-image-gallery-selector-control>
|
|
133
|
+
<IconButton
|
|
134
|
+
data-fs-image-gallery-selector-control-button
|
|
135
|
+
aria-label={navigationButtonRightAriaLabel}
|
|
136
|
+
icon={<Icon name="ArrowLeft" />}
|
|
137
|
+
size="small"
|
|
138
|
+
onClick={() =>
|
|
139
|
+
moveScroll(elementsRef.current, +SCROLL_MARGIN_VALUE)
|
|
140
|
+
}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</section>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export default ImageGallerySelector
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { PropsWithChildren } from 'react'
|
|
3
|
+
|
|
4
|
+
// TODO: Implements zoom feature to the selected image (Coming Soon)
|
|
5
|
+
export interface ImageZoomProps {
|
|
6
|
+
helpMessage?: string
|
|
7
|
+
zoomFactor?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ImageZoom = ({ children }: PropsWithChildren<ImageZoomProps>) => {
|
|
11
|
+
return <>{children}</>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default ImageZoom
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default } from './ImageGallery'
|
|
2
|
+
export type { ImageGalleryProps, ImageElementData } from './ImageGallery'
|
|
3
|
+
|
|
4
|
+
export { default as ImageGallerySelector } from './ImageGallerySelector'
|
|
5
|
+
export type { ImageGallerySelectorProps } from './ImageGallerySelector'
|
|
6
|
+
|
|
7
|
+
export { default as ImageZoom } from './ImageZoom'
|
|
8
|
+
export type { ImageZoomProps } from './ImageZoom'
|