@faststore/components 2.0.69-alpha.0 → 2.0.73-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.
Files changed (92) hide show
  1. package/dist/assets/ClockClockwise.d.ts +3 -0
  2. package/dist/assets/ClockClockwise.js +10 -0
  3. package/dist/assets/ClockClockwise.js.map +1 -0
  4. package/dist/assets/index.d.ts +1 -0
  5. package/dist/assets/index.js +1 -0
  6. package/dist/assets/index.js.map +1 -1
  7. package/dist/atoms/Price/Price.d.ts +4 -0
  8. package/dist/atoms/Price/Price.js +5 -2
  9. package/dist/atoms/Price/Price.js.map +1 -1
  10. package/dist/index.d.ts +11 -3
  11. package/dist/index.js +6 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/molecules/CartItem/CartItem.js +2 -2
  14. package/dist/molecules/CartItem/CartItem.js.map +1 -1
  15. package/dist/molecules/Gift/GiftContent.d.ts +23 -0
  16. package/dist/molecules/Gift/GiftContent.js +10 -2
  17. package/dist/molecules/Gift/GiftContent.js.map +1 -1
  18. package/dist/molecules/Modal/ModalHeader.d.ts +2 -2
  19. package/dist/molecules/Modal/ModalHeader.js +2 -2
  20. package/dist/molecules/Modal/ModalHeader.js.map +1 -1
  21. package/dist/molecules/ProductCard/ProductCardContent.js +2 -2
  22. package/dist/molecules/ProductCard/ProductCardContent.js.map +1 -1
  23. package/dist/molecules/SearchHistory/SearchHistory.d.ts +21 -0
  24. package/dist/molecules/SearchHistory/SearchHistory.js +11 -0
  25. package/dist/molecules/SearchHistory/SearchHistory.js.map +1 -0
  26. package/dist/molecules/SearchHistory/SearchHistoryTerm.d.ts +23 -0
  27. package/dist/molecules/SearchHistory/SearchHistoryTerm.js +11 -0
  28. package/dist/molecules/SearchHistory/SearchHistoryTerm.js.map +1 -0
  29. package/dist/molecules/SearchHistory/index.d.ts +4 -0
  30. package/dist/molecules/SearchHistory/index.js +3 -0
  31. package/dist/molecules/SearchHistory/index.js.map +1 -0
  32. package/dist/molecules/SearchProductCard/SearchProductCard.d.ts +20 -0
  33. package/dist/molecules/SearchProductCard/SearchProductCard.js +8 -0
  34. package/dist/molecules/SearchProductCard/SearchProductCard.js.map +1 -0
  35. package/dist/molecules/SearchProductCard/SearchProductCardContent.d.ts +20 -0
  36. package/dist/molecules/SearchProductCard/SearchProductCardContent.js +11 -0
  37. package/dist/molecules/SearchProductCard/SearchProductCardContent.js.map +1 -0
  38. package/dist/molecules/SearchProductCard/SearchProductCardImage.d.ts +10 -0
  39. package/dist/molecules/SearchProductCard/SearchProductCardImage.js +6 -0
  40. package/dist/molecules/SearchProductCard/SearchProductCardImage.js.map +1 -0
  41. package/dist/molecules/SearchProductCard/index.d.ts +6 -0
  42. package/dist/molecules/SearchProductCard/index.js +4 -0
  43. package/dist/molecules/SearchProductCard/index.js.map +1 -0
  44. package/dist/molecules/SearchTop/SearchTop.d.ts +22 -0
  45. package/dist/molecules/SearchTop/SearchTop.js +11 -0
  46. package/dist/molecules/SearchTop/SearchTop.js.map +1 -0
  47. package/dist/molecules/SearchTop/SearchTopTerm.d.ts +23 -0
  48. package/dist/molecules/SearchTop/SearchTopTerm.js +11 -0
  49. package/dist/molecules/SearchTop/SearchTopTerm.js.map +1 -0
  50. package/dist/molecules/SearchTop/index.d.ts +4 -0
  51. package/dist/molecules/SearchTop/index.js +3 -0
  52. package/dist/molecules/SearchTop/index.js.map +1 -0
  53. package/dist/organisms/Hero/{HeroHeading.d.ts → HeroHeader.d.ts} +3 -3
  54. package/dist/organisms/Hero/{HeroHeading.js → HeroHeader.js} +3 -3
  55. package/dist/organisms/Hero/HeroHeader.js.map +1 -0
  56. package/dist/organisms/Hero/index.d.ts +2 -2
  57. package/dist/organisms/Hero/index.js +1 -1
  58. package/dist/organisms/Hero/index.js.map +1 -1
  59. package/dist/organisms/SlideOver/SlideOver.d.ts +34 -0
  60. package/dist/organisms/SlideOver/SlideOver.js +7 -0
  61. package/dist/organisms/SlideOver/SlideOver.js.map +1 -0
  62. package/dist/organisms/SlideOver/SlideOverHeader.d.ts +16 -0
  63. package/dist/organisms/SlideOver/SlideOverHeader.js +10 -0
  64. package/dist/organisms/SlideOver/SlideOverHeader.js.map +1 -0
  65. package/dist/organisms/SlideOver/index.d.ts +4 -0
  66. package/dist/organisms/SlideOver/index.js +3 -0
  67. package/dist/organisms/SlideOver/index.js.map +1 -0
  68. package/package.json +4 -4
  69. package/src/assets/ClockClockwise.tsx +56 -0
  70. package/src/assets/index.ts +1 -0
  71. package/src/atoms/Price/Price.tsx +8 -0
  72. package/src/index.ts +29 -6
  73. package/src/molecules/CartItem/CartItem.tsx +2 -0
  74. package/src/molecules/Gift/GiftContent.tsx +48 -2
  75. package/src/molecules/Modal/ModalHeader.tsx +3 -3
  76. package/src/molecules/ProductCard/ProductCardContent.tsx +2 -0
  77. package/src/molecules/SearchHistory/SearchHistory.tsx +44 -0
  78. package/src/molecules/SearchHistory/SearchHistoryTerm.tsx +44 -0
  79. package/src/molecules/SearchHistory/index.ts +5 -0
  80. package/src/molecules/SearchProductCard/SearchProductCard.tsx +54 -0
  81. package/src/molecules/SearchProductCard/SearchProductCardContent.tsx +51 -0
  82. package/src/molecules/SearchProductCard/SearchProductCardImage.tsx +31 -0
  83. package/src/molecules/SearchProductCard/index.ts +8 -0
  84. package/src/molecules/SearchTop/SearchTop.tsx +53 -0
  85. package/src/molecules/SearchTop/SearchTopTerm.tsx +46 -0
  86. package/src/molecules/SearchTop/index.ts +5 -0
  87. package/src/organisms/Hero/{HeroHeading.tsx → HeroHeader.tsx} +4 -4
  88. package/src/organisms/Hero/index.tsx +2 -2
  89. package/src/organisms/SlideOver/SlideOver.tsx +65 -0
  90. package/src/organisms/SlideOver/SlideOverHeader.tsx +40 -0
  91. package/src/organisms/SlideOver/index.ts +5 -0
  92. package/dist/organisms/Hero/HeroHeading.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ import React, { forwardRef } from 'react'
2
+ import { Price } from '../../'
3
+ import type { PriceFormatter } from '../../atoms/Price/Price'
4
+
5
+ interface Price {
6
+ value: number
7
+ listPrice: number
8
+ formatter: PriceFormatter
9
+ }
10
+
11
+ export type SearchProductCardContentProps = {
12
+ /**
13
+ * Specifies the product's title.
14
+ */
15
+ title: string
16
+ /**
17
+ * Specifies product's prices.
18
+ */
19
+ price: Price
20
+ }
21
+
22
+ const SearchProductCardContent = forwardRef<
23
+ HTMLElement,
24
+ SearchProductCardContentProps
25
+ >(function SearchProductCardContent({ price, title, ...otherProps }, ref) {
26
+ return (
27
+ <section ref={ref} data-fs-search-product-card-content {...otherProps}>
28
+ <p data-fs-search-product-card-title>{title}</p>
29
+ <span data-fs-search-product-card-prices>
30
+ <Price
31
+ value={price?.listPrice ? price.listPrice : 0}
32
+ formatter={price?.formatter}
33
+ testId="list-price"
34
+ data-value={price?.listPrice}
35
+ variant="listing"
36
+ SRText="Original price:"
37
+ />
38
+ <Price
39
+ value={price?.value ? price.value : 0}
40
+ formatter={price?.formatter}
41
+ testId="price"
42
+ data-value={price?.value}
43
+ variant="spot"
44
+ SRText="Price:"
45
+ />
46
+ </span>
47
+ </section>
48
+ )
49
+ })
50
+
51
+ export default SearchProductCardContent
@@ -0,0 +1,31 @@
1
+ import type { HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+
4
+ export interface SearchProductCardImageProps
5
+ extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
8
+ */
9
+ testId?: string
10
+ }
11
+
12
+ const SearchProductCardImage = forwardRef<
13
+ HTMLDivElement,
14
+ SearchProductCardImageProps
15
+ >(function SearchProductCardImage(
16
+ { testId = 'fs-search-product-card-image', children, ...otherProps },
17
+ ref
18
+ ) {
19
+ return (
20
+ <div
21
+ ref={ref}
22
+ data-fs-search-product-card-image
23
+ data-testid={testId}
24
+ {...otherProps}
25
+ >
26
+ {children}
27
+ </div>
28
+ )
29
+ })
30
+
31
+ export default SearchProductCardImage
@@ -0,0 +1,8 @@
1
+ export { default } from './SearchProductCard'
2
+ export type { SearchProductCardProps } from './SearchProductCard'
3
+
4
+ export { default as SearchProductCardImage } from './SearchProductCardImage'
5
+ export type { SearchProductCardImageProps } from './SearchProductCardImage'
6
+
7
+ export { default as SearchProductCardContent } from './SearchProductCardContent'
8
+ export type { SearchProductCardContentProps } from './SearchProductCardContent'
@@ -0,0 +1,53 @@
1
+ import React from 'react'
2
+ import { forwardRef } from 'react'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ import { List } from '../../'
6
+
7
+ export interface SearchTopProps extends HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
10
+ */
11
+ testId?: string
12
+ /**
13
+ * Title attribute for the <section> tag rendered by this component.
14
+ */
15
+ title: string
16
+ /**
17
+ * Defines the the message displayed while loading.
18
+ */
19
+ loadingMessage?: string
20
+ /**
21
+ * Enables a loading state.
22
+ */
23
+ isLoading?: boolean
24
+ }
25
+
26
+ const SearchTop = forwardRef<HTMLDivElement, SearchTopProps>(function SearchTop(
27
+ {
28
+ testId = 'fs-top-search',
29
+ title = 'Top Search',
30
+ loadingMessage = 'Loading...',
31
+ isLoading,
32
+ children,
33
+ ...otherProps
34
+ },
35
+ ref
36
+ ) {
37
+ return (
38
+ <section ref={ref} data-testid={testId} data-fs-search-top {...otherProps}>
39
+ {isLoading ? (
40
+ <p data-fs-search-top-input-loading-text>{loadingMessage}</p>
41
+ ) : (
42
+ <>
43
+ <header data-fs-search-top-header>
44
+ <p data-fs-search-top-title>{title}</p>
45
+ </header>
46
+ <List as="ol">{children}</List>
47
+ </>
48
+ )}
49
+ </section>
50
+ )
51
+ })
52
+
53
+ export default SearchTop
@@ -0,0 +1,46 @@
1
+ import React from 'react'
2
+ import { forwardRef } from 'react'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ import { Badge, Link, LinkProps, LinkElementType } from '../../'
6
+
7
+ export interface SearchTopTermProps extends HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
10
+ */
11
+ testId?: string
12
+ /**
13
+ * Search term to be shown.
14
+ */
15
+ value: string
16
+ /**
17
+ * Props for the `<Link>` rendered by this component.
18
+ */
19
+ linkProps?: Partial<LinkProps<LinkElementType>>
20
+ /**
21
+ * Current term's position in a list of search terms.
22
+ */
23
+ index: number
24
+ }
25
+
26
+ const SearchTopTerm = forwardRef<HTMLDivElement, SearchTopTermProps>(
27
+ function SearchTopTerm({
28
+ testId = 'fs-top-search-term',
29
+ value,
30
+ linkProps,
31
+ index,
32
+ }) {
33
+ return (
34
+ <li data-fs-search-top-item data-testid={testId}>
35
+ <Link {...linkProps} data-fs-search-top-item-link variant="display">
36
+ <Badge data-fs-search-top-item-badge variant="info">
37
+ {index + 1}
38
+ </Badge>
39
+ {value}
40
+ </Link>
41
+ </li>
42
+ )
43
+ }
44
+ )
45
+
46
+ export default SearchTopTerm
@@ -0,0 +1,5 @@
1
+ export { default } from './SearchTop'
2
+ export type { SearchTopProps } from './SearchTop'
3
+
4
+ export { default as SearchTopTerm } from './SearchTopTerm'
5
+ export type { SearchTopTermProps } from './SearchTopTerm'
@@ -5,7 +5,7 @@ import { ArrowRight } from '../../assets'
5
5
 
6
6
  import { useHero } from './Hero'
7
7
 
8
- export interface HeroHeadingProps extends HTMLAttributes<HTMLDivElement> {
8
+ export interface HeroHeaderProps extends HTMLAttributes<HTMLDivElement> {
9
9
  /**
10
10
  * Content for the h1 tag.
11
11
  */
@@ -32,8 +32,8 @@ export interface HeroHeadingProps extends HTMLAttributes<HTMLDivElement> {
32
32
  testId?: string
33
33
  }
34
34
 
35
- const HeroHeading = forwardRef<HTMLDivElement, HeroHeadingProps>(
36
- function HeroHeading(
35
+ const HeroHeader = forwardRef<HTMLDivElement, HeroHeaderProps>(
36
+ function HeroHeader(
37
37
  {
38
38
  icon,
39
39
  link,
@@ -79,4 +79,4 @@ const HeroHeading = forwardRef<HTMLDivElement, HeroHeadingProps>(
79
79
  }
80
80
  )
81
81
 
82
- export default HeroHeading
82
+ export default HeroHeader
@@ -4,5 +4,5 @@ export type { HeroProps } from './Hero'
4
4
  export { default as HeroImage } from './HeroImage'
5
5
  export type { HeroImageProps } from './HeroImage'
6
6
 
7
- export { default as HeroHeading } from './HeroHeading'
8
- export type { HeroHeadingProps } from './HeroHeading'
7
+ export { default as HeroHeader } from './HeroHeader'
8
+ export type { HeroHeaderProps } from './HeroHeader'
@@ -0,0 +1,65 @@
1
+ import React from 'react'
2
+ import type { ReactNode } from 'react'
3
+
4
+ import { Modal } from '../../'
5
+ import type { ModalProps } from '../../'
6
+
7
+ type Direction = 'leftSide' | 'rightSide'
8
+ type WidthSize = 'full' | 'partial'
9
+
10
+ export type SlideOverProps = Omit<ModalProps, 'title'> & {
11
+ /**
12
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
13
+ */
14
+ testId?: string
15
+ /**
16
+ * A boolean value that represents the state of the SlideOver
17
+ */
18
+ isOpen: boolean
19
+ /**
20
+ * Represents the side that the SlideOver comes from.
21
+ */
22
+ direction: Direction
23
+ /**
24
+ * Represents the size of the SlideOver.
25
+ */
26
+ size: WidthSize
27
+ /**
28
+ * Represents the fade effect of the SlideOver.
29
+ */
30
+ fade: 'in' | 'out'
31
+ /**
32
+ * This function is called whenever the user clicks outside.
33
+ * the modal content
34
+ */
35
+ onDismiss?: () => void
36
+ children: ReactNode
37
+ }
38
+
39
+ function SlideOver({
40
+ isOpen,
41
+ direction = 'leftSide',
42
+ size = 'full',
43
+ fade = 'out',
44
+ children,
45
+ onDismiss,
46
+ testId = 'fs-slide-over',
47
+ ...otherProps
48
+ }: SlideOverProps) {
49
+ return (
50
+ <Modal
51
+ data-fs-modal={null}
52
+ data-fs-slide-over
53
+ data-fs-slide-over-direction={direction}
54
+ data-fs-slide-over-size={size}
55
+ data-fs-slide-over-state={fade}
56
+ isOpen={isOpen}
57
+ onDismiss={onDismiss}
58
+ {...otherProps}
59
+ >
60
+ {children}
61
+ </Modal>
62
+ )
63
+ }
64
+
65
+ export default SlideOver
@@ -0,0 +1,40 @@
1
+ import React, { HTMLAttributes } from 'react'
2
+ import type { ReactNode } from 'react'
3
+ import { X } from '../../assets'
4
+ import { IconButton } from '../../'
5
+ import type { IconButtonProps } from '../../'
6
+
7
+ export interface SlideOverHeaderProps
8
+ extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
9
+ /**
10
+ * A react component to be used as the title in the header.
11
+ */
12
+ children: ReactNode
13
+ /**
14
+ * Props for the Close Button component.
15
+ */
16
+ closeBtnProps?: Partial<Omit<IconButtonProps, 'onClick'>>
17
+
18
+ onClose: () => void
19
+ }
20
+
21
+ const SlideOverHeader = ({
22
+ onClose,
23
+ children,
24
+ closeBtnProps = {},
25
+ }: SlideOverHeaderProps) => {
26
+ return (
27
+ <header data-fs-slide-over-header>
28
+ {children}
29
+ <IconButton
30
+ data-fs-slide-over-header-icon
31
+ aria-label="Close"
32
+ icon={<X />}
33
+ onClick={onClose}
34
+ {...closeBtnProps}
35
+ />
36
+ </header>
37
+ )
38
+ }
39
+
40
+ export default SlideOverHeader
@@ -0,0 +1,5 @@
1
+ export { default } from './SlideOver'
2
+ export type { SlideOverProps } from './SlideOver'
3
+
4
+ export { default as SlideOverHeader } from './SlideOverHeader'
5
+ export type { SlideOverHeaderProps } from './SlideOverHeader'
@@ -1 +0,0 @@
1
- {"version":3,"file":"HeroHeading.js","sourceRoot":"","sources":["../../../src/organisms/Hero/HeroHeading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AA6BhC,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EACE,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,GAAG,iBAAiB,EAC1B,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,EAAE,CAAA;IAE3C,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,+CAEK,MAAM,KACf,UAAU;QAEd,2DAA0B,SAAS,EAAC,iBAAiB;YACnD;gBACE,0DAAwB,KAAK,CAAM;gBACnC,4DAA0B,QAAQ,CAAK;gBACtC,CAAC,CAAC,IAAI,IAAI,CACT,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,YAAY,KAAK,MAAM,EAChC,IAAI,EAAE,oBAAC,UAAU,OAAG,EACpB,YAAY,EAAC,OAAO,IAEnB,QAAQ,CACE,CACd,CACG;YACL,IAAI,IAAI,OAAO,KAAK,WAAW,IAAI,CAClC,oBAAC,IAAI,+BAAmB,SAAS,EAAE,IAAI,GAAI,CAC5C,CACG,CACC,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}