@faststore/core 0.3.16 → 2.0.65-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 (136) hide show
  1. package/.storybook/storybook.css +1 -0
  2. package/.turbo/turbo-build.log +50 -0
  3. package/.turbo/turbo-lint.log +2 -0
  4. package/@generated/graphql/index.ts +27 -3
  5. package/@generated/graphql/persisted.json +1 -1
  6. package/CHANGELOG.md +127 -169
  7. package/README.md +2 -2
  8. package/cypress/integration/analytics.test.js +4 -4
  9. package/cypress/integration/cart.test.js +2 -2
  10. package/cypress/integration/plp.test.js +9 -9
  11. package/package.json +9 -10
  12. package/src/Layout.tsx +7 -2
  13. package/src/components/cart/CartItem/CartItem.tsx +30 -71
  14. package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
  15. package/src/components/cart/CartSidebar/CartSidebar.tsx +13 -17
  16. package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
  17. package/src/components/common/Alert/Alert.tsx +6 -22
  18. package/src/components/common/Footer/Footer.stories.mdx +1 -1
  19. package/src/components/common/Footer/Footer.tsx +5 -38
  20. package/src/components/common/Footer/FooterFlags.tsx +23 -0
  21. package/src/components/common/Footer/FooterLinks.tsx +16 -12
  22. package/src/components/common/Footer/footer.module.scss +2 -28
  23. package/src/components/common/Footer/index.ts +1 -0
  24. package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
  25. package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
  26. package/src/components/common/Navbar/Navbar.tsx +1 -1
  27. package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
  28. package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
  29. package/src/components/common/Toast/Toast.tsx +1 -1
  30. package/src/components/product/ProductCard/ProductCard.tsx +44 -59
  31. package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
  32. package/src/components/regionalization/Regionalization.stories.mdx +24 -6
  33. package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
  34. package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
  35. package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
  36. package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
  37. package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
  38. package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
  39. package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
  40. package/src/components/search/Filter/Facets.stories.mdx +10 -10
  41. package/src/components/search/Filter/Facets.tsx +69 -61
  42. package/src/components/search/Filter/Filter.stories.mdx +1 -1
  43. package/src/components/search/Filter/Filter.tsx +1 -1
  44. package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
  45. package/src/components/search/Filter/FilterSlider.tsx +2 -2
  46. package/src/components/search/Filter/facets.module.scss +16 -16
  47. package/src/components/search/Search.stories.mdx +28 -24
  48. package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
  49. package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
  50. package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
  51. package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
  52. package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
  53. package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
  54. package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -4
  55. package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
  56. package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
  57. package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
  58. package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
  59. package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
  60. package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
  61. package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
  62. package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
  63. package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
  64. package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
  65. package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
  66. package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
  67. package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
  68. package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
  69. package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
  70. package/src/components/ui/Gift/Gift.tsx +18 -27
  71. package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
  72. package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
  73. package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
  74. package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
  75. package/src/components/ui/Tiles/tiles.module.scss +11 -13
  76. package/src/components/ui/Toast/Toast.stories.mdx +1 -1
  77. package/src/components/ui/Toast/Toast.tsx +1 -1
  78. package/src/pages/_app.tsx +1 -1
  79. package/src/sdk/cart/index.ts +5 -0
  80. package/src/sdk/cart/useBuyButton.ts +1 -1
  81. package/src/sdk/cart/useCartToggleButton.ts +1 -1
  82. package/src/styles/vendors/include-media.scss +1 -1
  83. package/tsconfig.json +4 -6
  84. package/.eslintrc.json +0 -3
  85. package/.github/CODEOWNERS +0 -2
  86. package/.github/workflows/release.yml +0 -42
  87. package/.release-it.json +0 -32
  88. package/src/components/cart/CartItem/cart-item.module.scss +0 -68
  89. package/src/components/product/ProductCard/product-card.module.scss +0 -254
  90. package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
  91. package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
  92. package/src/components/skeletons/Shimmer/index.ts +0 -1
  93. package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
  94. package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
  95. package/src/components/skeletons/Skeleton/index.ts +0 -1
  96. package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
  97. package/src/components/skeletons/Skeletons.stories.mdx +0 -177
  98. package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
  99. package/src/components/ui/Accordion/Accordion.tsx +0 -39
  100. package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
  101. package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
  102. package/src/components/ui/Accordion/accordion.module.scss +0 -65
  103. package/src/components/ui/Accordion/index.ts +0 -2
  104. package/src/components/ui/Alert/Alert.stories.mdx +0 -164
  105. package/src/components/ui/Alert/Alert.tsx +0 -81
  106. package/src/components/ui/Alert/alert.module.scss +0 -93
  107. package/src/components/ui/Alert/index.ts +0 -1
  108. package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
  109. package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
  110. package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
  111. package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
  112. package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
  113. package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
  114. package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
  115. package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
  116. package/src/components/ui/Dropdown/index.ts +0 -4
  117. package/src/components/ui/Gift/Gift.stories.mdx +0 -99
  118. package/src/components/ui/Gift/gift.module.scss +0 -94
  119. package/src/components/ui/Modal/Modal.stories.mdx +0 -144
  120. package/src/components/ui/Modal/Modal.tsx +0 -43
  121. package/src/components/ui/Modal/index.ts +0 -1
  122. package/src/components/ui/Modal/modal.module.scss +0 -46
  123. package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
  124. package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
  125. package/src/components/ui/PriceRange/index.ts +0 -1
  126. package/src/components/ui/PriceRange/price-range.module.scss +0 -176
  127. package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
  128. package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
  129. package/src/components/ui/ProductTitle/index.ts +0 -1
  130. package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
  131. package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
  132. package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
  133. package/src/components/ui/QuantitySelector/index.ts +0 -1
  134. package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
  135. package/src/sdk/ui/Provider.tsx +0 -151
  136. package/src/sdk/ui/useFadeEffect.ts +0 -21
@@ -22,11 +22,6 @@
22
22
  --fs-footer-title-weight : var(--fs-text-weight-bold);
23
23
  --fs-footer-title-margin-bottom : var(--fs-spacing-1);
24
24
 
25
- // Payment Methods
26
- --fs-footer-payment-methods-flags-border-width : var(--fs-border-width);
27
- --fs-footer-payment-methods-flags-border-color : var(--fs-color-neutral-3);
28
- --fs-footer-payment-methods-flags-border-radius : var(--fs-border-radius-small);
29
-
30
25
  // --------------------------------------------------------
31
26
  // Structural Styles
32
27
  // --------------------------------------------------------
@@ -108,7 +103,7 @@
108
103
  }
109
104
 
110
105
  [data-fs-footer-social],
111
- [data-fs-footer-payment-methods] {
106
+ [data-fs-payment-methods] {
112
107
  @include media(">=notebook") {
113
108
  grid-column: 11 / span 2;
114
109
  margin-left: calc(-1 * var(--fs-spacing-3));
@@ -142,7 +137,7 @@
142
137
  }
143
138
  }
144
139
 
145
- [data-fs-footer-payment-methods] {
140
+ [data-fs-payment-methods] {
146
141
  @include media("<notebook") {
147
142
  margin: var(--fs-footer-spacing-vertical-mobile) auto;
148
143
  }
@@ -158,27 +153,6 @@
158
153
  }
159
154
  }
160
155
 
161
- [data-payment-methods-flags] {
162
- svg {
163
- border: var(--fs-footer-payment-methods-flags-border-width) solid var(--fs-footer-payment-methods-flags-border-color);
164
- border-radius: var(--fs-footer-payment-methods-flags-border-radius);
165
- }
166
-
167
- [data-fs-list] {
168
- display: grid;
169
- grid-template-columns: repeat(4, minmax(0, max-content));
170
- row-gap: var(--fs-spacing-1);
171
- justify-content: space-between;
172
- margin-top: var(--fs-spacing-3);
173
-
174
- li { display: flex; }
175
-
176
- @include media("<notebook") {
177
- column-gap: var(--fs-grid-gap-2);
178
- }
179
- }
180
- }
181
-
182
156
  [data-fs-footer-copyright] {
183
157
  p + p {
184
158
  margin: var(--fs-spacing-2) auto;
@@ -1,2 +1,3 @@
1
1
  export { default } from './Footer'
2
2
  export { default as FooterLinks } from './FooterLinks'
3
+ export { default as FooterFlags } from './FooterFlags'
@@ -1,6 +1,6 @@
1
1
  import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
2
 
3
- import UIProvider from 'src/sdk/ui/Provider'
3
+ import { UIProvider } from '@faststore/ui'
4
4
 
5
5
  import { NavLinks } from '.'
6
6
 
@@ -1,4 +1,4 @@
1
- import UIProvider from 'src/sdk/ui/Provider'
1
+ import { UIProvider } from '@faststore/ui'
2
2
 
3
3
  import Navbar, { NavLinks } from '.'
4
4
 
@@ -9,7 +9,7 @@ import Icon from 'src/components/ui/Icon'
9
9
  import Link from 'src/components/ui/Link'
10
10
  import Logo from 'src/components/ui/Logo'
11
11
  import { mark } from 'src/sdk/tests/mark'
12
- import { useUI } from 'src/sdk/ui/Provider'
12
+ import { useUI } from '@faststore/ui'
13
13
  import useScrollDirection from 'src/sdk/ui/useScrollDirection'
14
14
 
15
15
  import styles from './navbar.module.scss'
@@ -1,6 +1,6 @@
1
1
  import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
2
 
3
- import UIProvider, { useUI } from 'src/sdk/ui/Provider'
3
+ import { UIProvider, useUI } from '@faststore/ui'
4
4
 
5
5
  import { Button } from '@faststore/ui'
6
6
  import Icon from 'src/components/ui/Icon'
@@ -7,8 +7,8 @@ import Link from 'src/components/ui/Link'
7
7
  import Logo from 'src/components/ui/Logo'
8
8
  import SlideOver from 'src/components/ui/SlideOver'
9
9
  import { mark } from 'src/sdk/tests/mark'
10
- import { useUI } from 'src/sdk/ui/Provider'
11
- import { useFadeEffect } from 'src/sdk/ui/useFadeEffect'
10
+ import { useUI } from '@faststore/ui'
11
+ import { useFadeEffect } from '@faststore/ui'
12
12
 
13
13
  import styles from './navbar-slider.module.scss'
14
14
  import NavLinks from './NavLinks'
@@ -1,7 +1,7 @@
1
1
  import { lazy, Suspense, useEffect } from 'react'
2
2
 
3
3
  import { useCart } from 'src/sdk/cart'
4
- import { useUI } from 'src/sdk/ui/Provider'
4
+ import { useUI } from '@faststore/ui'
5
5
 
6
6
  const UIToast = lazy(() => import('src/components/ui/Toast'))
7
7
 
@@ -1,22 +1,16 @@
1
1
  import {
2
2
  ProductCard as UIProductCard,
3
- ProductCardActions as UIProductCardActions,
4
3
  ProductCardContent as UIProductCardContent,
5
4
  ProductCardImage as UIProductCardImage,
6
- Badge as UIBadge,
7
- DiscountBadge as UIDiscountBadge,
8
5
  } from '@faststore/ui'
9
6
  import { gql } from '@faststore/graphql-utils'
10
7
  import { memo } from 'react'
11
- import type { ReactNode } from 'react'
12
8
 
13
- import Link from 'src/components/ui/Link'
14
9
  import { Image } from 'src/components/ui/Image'
15
- import Price from 'src/components/ui/Price'
16
10
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
17
11
  import { useProductLink } from 'src/sdk/product/useProductLink'
18
12
  import type { ProductSummary_ProductFragment } from '@generated/graphql'
19
- import styles from 'src/components/product/ProductCard/product-card.module.scss'
13
+ import NextLink from 'next/link'
20
14
 
21
15
  type Variant = 'wide' | 'default'
22
16
 
@@ -36,18 +30,33 @@ export interface ProductCardProps {
36
30
  */
37
31
  aspectRatio?: number
38
32
  /**
39
- * Enables a BuyButton to the component.
33
+ * Specifies Rating Value of the product.
40
34
  */
41
- BuyButton?: ReactNode
35
+ ratingValue?: number
36
+ /**
37
+ * Callback function when button is clicked.
38
+ */
39
+ onButtonClick?: () => void
40
+ /**
41
+ * Specifies the button's label.
42
+ */
43
+ buttonLabel?: string
44
+ /**
45
+ * Enables a DiscountBadge to the component.
46
+ */
47
+ showDiscountBadge?: boolean
42
48
  }
43
49
 
44
50
  function ProductCard({
45
51
  product,
46
52
  index,
47
- variant = 'default',
48
53
  bordered = false,
54
+ variant = 'default',
49
55
  aspectRatio = 1,
50
- BuyButton,
56
+ ratingValue,
57
+ buttonLabel = 'Add',
58
+ onButtonClick,
59
+ showDiscountBadge = true,
51
60
  ...otherProps
52
61
  }: ProductCardProps) {
53
62
  const {
@@ -60,20 +69,24 @@ function ProductCard({
60
69
  },
61
70
  } = product
62
71
 
63
- const linkProps = useProductLink({ product, selectedOffer: 0, index })
72
+ const linkProps = {
73
+ ...useProductLink({ product, selectedOffer: 0, index }),
74
+ as: NextLink,
75
+ passHref: true,
76
+ legacyBehavior: false,
77
+ }
78
+
64
79
  const outOfStock = availability !== 'https://schema.org/InStock'
65
80
 
66
81
  return (
67
82
  <UIProductCard
68
- data-fs-product-card
69
- data-fs-product-card-variant={variant}
70
- data-fs-product-card-bordered={bordered}
71
- data-fs-product-card-actionable={!!BuyButton}
83
+ outOfStock={outOfStock}
84
+ bordered={bordered}
85
+ variant={variant}
72
86
  data-fs-product-card-sku={sku}
73
- className={styles.fsProductCard}
74
87
  {...otherProps}
75
88
  >
76
- <UIProductCardImage data-fs-product-card-image>
89
+ <UIProductCardImage aspectRatio={aspectRatio}>
77
90
  <Image
78
91
  src={img.url}
79
92
  alt={img.alternateName}
@@ -83,47 +96,19 @@ function ProductCard({
83
96
  loading="lazy"
84
97
  />
85
98
  </UIProductCardImage>
86
-
87
- <UIProductCardContent data-fs-product-card-content>
88
- <div data-fs-product-card-heading>
89
- <h3 data-fs-product-card-title>
90
- <Link {...linkProps} title={name}>
91
- {name}
92
- </Link>
93
- </h3>
94
- <div data-fs-product-card-prices>
95
- <Price
96
- value={listPrice}
97
- formatter={useFormattedPrice}
98
- testId="list-price"
99
- data-value={listPrice}
100
- variant="listing"
101
- classes="text__legend"
102
- SRText="Original price:"
103
- />
104
- <Price
105
- value={spotPrice}
106
- formatter={useFormattedPrice}
107
- testId="price"
108
- data-value={spotPrice}
109
- variant="spot"
110
- classes="text__body"
111
- SRText="Sale Price:"
112
- />
113
- </div>
114
- </div>
115
-
116
- {outOfStock ? (
117
- <UIBadge>Out of stock</UIBadge>
118
- ) : (
119
- <UIDiscountBadge listPrice={listPrice} spotPrice={spotPrice} />
120
- )}
121
- {!!BuyButton && (
122
- <UIProductCardActions data-fs-product-card-actions>
123
- {BuyButton}
124
- </UIProductCardActions>
125
- )}
126
- </UIProductCardContent>
99
+ <UIProductCardContent
100
+ title={name}
101
+ price={{
102
+ value: spotPrice,
103
+ listPrice: listPrice,
104
+ formatter: useFormattedPrice,
105
+ }}
106
+ ratingValue={ratingValue}
107
+ outOfStock={outOfStock}
108
+ onButtonClick={onButtonClick}
109
+ linkProps={linkProps}
110
+ showDiscountBadge={showDiscountBadge}
111
+ />
127
112
  </UIProductCard>
128
113
  )
129
114
  }
@@ -17,8 +17,13 @@ interface Props {
17
17
  }
18
18
 
19
19
  function ProductGrid({ products, page, pageSize }: Props) {
20
+ const aspectRatio = 1
21
+
20
22
  return (
21
- <ProductGridSkeleton loading={products.length === 0}>
23
+ <ProductGridSkeleton
24
+ aspectRatio={aspectRatio}
25
+ loading={products.length === 0}
26
+ >
22
27
  <ul data-fs-product-grid className={styles.fsProductGrid}>
23
28
  {products.map(({ node: product }, idx) => (
24
29
  <li key={`${product.id}`}>
@@ -26,6 +31,7 @@ function ProductGrid({ products, page, pageSize }: Props) {
26
31
  product={product}
27
32
  index={pageSize * page + idx + 1}
28
33
  bordered
34
+ aspectRatio={aspectRatio}
29
35
  />
30
36
  </li>
31
37
  ))}
@@ -1,4 +1,4 @@
1
- import UIProvider, { useUI } from 'src/sdk/ui/Provider'
1
+ import { UIProvider, useUI, Button } from '@faststore/ui'
2
2
 
3
3
  import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
4
4
 
@@ -15,7 +15,7 @@ import Icon from '../ui/Icon'
15
15
  <Meta title="Features/Regionalization/Overview" />
16
16
 
17
17
  export const TemplateRegionalizationModal = () => {
18
- const { modal, openModal } = useUI()
18
+ const { modal } = useUI()
19
19
  return <>{modal && <RegionalizationModal />}</>
20
20
  }
21
21
 
@@ -31,6 +31,26 @@ export const TemplateButtonWithProvider = () => {
31
31
  )
32
32
  }
33
33
 
34
+ export const RegionalizationModalContentTemplate = () => {
35
+ const { modal, openModal } = useUI()
36
+ return (
37
+ <div>
38
+ <Button variant="primary" onClick={() => openModal()}>
39
+ Open Regionalization Modal
40
+ </Button>
41
+ {modal && <RegionalizationModal />}
42
+ </div>
43
+ )
44
+ }
45
+
46
+ export const TemplateOverview = (args) => {
47
+ return (
48
+ <UIProvider>
49
+ <RegionalizationModalContentTemplate onClose={() => {}} />
50
+ </UIProvider>
51
+ )
52
+ }
53
+
34
54
  <header>
35
55
 
36
56
  # Regionalization
@@ -120,9 +140,7 @@ With the Regionalization feature enabled, if a customer enters their Postal Code
120
140
  </li>
121
141
  <li>
122
142
  <div>
123
- <UIProvider>
124
- <RegionalizationModalContent onClose={() => {}} />
125
- </UIProvider>
143
+ <TemplateOverview />
126
144
  </div>
127
145
  <article className="sbdocs-list-text">
128
146
  <h3>RegionalizationModal</h3>
@@ -153,7 +171,7 @@ On your `Layout.tsx` file:
153
171
 
154
172
  ```jsx
155
173
  import RegionalizationModal from '../components/regionalization/RegionalizationModal'
156
- import { useUI } from 'src/sdk/ui/Provider'
174
+ import { useUI } from '@faststore/ui'
157
175
  ```
158
176
 
159
177
  and inside your `Layout` component:
@@ -1,4 +1,4 @@
1
- import UIProvider, { useUI } from 'src/sdk/ui/Provider'
1
+ import { UIProvider, useUI } from '@faststore/ui'
2
2
 
3
3
  import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
4
4
 
@@ -3,7 +3,7 @@ import { Button as UIButton } from '@faststore/ui'
3
3
 
4
4
  import Icon from 'src/components/ui/Icon'
5
5
  import { useSession } from 'src/sdk/session'
6
- import { useUI } from 'src/sdk/ui/Provider'
6
+ import { useUI } from '@faststore/ui'
7
7
 
8
8
  import styles from './regionalization-bar.module.scss'
9
9
 
@@ -2,7 +2,7 @@ import { Button as UIButton } from '@faststore/ui'
2
2
 
3
3
  import Icon from 'src/components/ui/Icon'
4
4
  import { useSession } from 'src/sdk/session'
5
- import { useUI } from 'src/sdk/ui/Provider'
5
+ import { useUI } from '@faststore/ui'
6
6
 
7
7
  function RegionButton() {
8
8
  const { openModal } = useUI()
@@ -1,5 +1,6 @@
1
1
  import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
- import UIProvider, { useUI } from 'src/sdk/ui/Provider'
2
+
3
+ import { UIProvider, useUI, Modal, Button } from '@faststore/ui'
3
4
 
4
5
  import RegionalizationModal, { RegionalizationModalContent } from '.'
5
6
  import RegionalizationButton from 'src/components/regionalization/RegionalizationButton'
@@ -35,10 +36,22 @@ export const Template = (args) => {
35
36
  )
36
37
  }
37
38
 
38
- export const RegionalizationModalContentTemplate = (args) => {
39
+ export const RegionalizationModalContentTemplate = () => {
40
+ const { modal, openModal } = useUI()
41
+ return (
42
+ <div>
43
+ <Button variant="primary" onClick={() => openModal()}>
44
+ Open Regionalization Modal
45
+ </Button>
46
+ {modal && <RegionalizationModal />}
47
+ </div>
48
+ )
49
+ }
50
+
51
+ export const TemplateOverview = (args) => {
39
52
  return (
40
53
  <UIProvider>
41
- <RegionalizationModalContent onClose={() => {}} />
54
+ <RegionalizationModalContentTemplate onClose={() => {}} />
42
55
  </UIProvider>
43
56
  )
44
57
  }
@@ -56,7 +69,7 @@ This component calls a modal with some regionalization configurations.
56
69
  The `RegionalizationModal` is part of [Regionalization](?path=/docs/features-regionalization-overview--default-button) feature and uses [Modal](/docs/molecules-modal--overview) as a base.
57
70
 
58
71
  <Canvas style={{ backgroundColor: 'var(--fs-color-neutral-1)' }}>
59
- <Story name="Overview">{RegionalizationModalContentTemplate.bind({})}</Story>
72
+ <Story name="Overview">{TemplateOverview.bind({})}</Story>
60
73
  </Canvas>
61
74
 
62
75
  ---
@@ -1,12 +1,11 @@
1
- import Modal from 'src/components/ui/Modal'
2
-
3
- import { RegionalizationModalContent } from '.'
1
+ import { Modal as UIModal } from '@faststore/ui'
2
+ import RegionalizationModalContent from './RegionalizationModalContent'
4
3
 
5
4
  function RegionalizationModal() {
6
5
  return (
7
- <Modal>
6
+ <UIModal>
8
7
  {({ fadeOut }) => <RegionalizationModalContent onClose={fadeOut} />}
9
- </Modal>
8
+ </UIModal>
10
9
  )
11
10
  }
12
11
 
@@ -1,12 +1,15 @@
1
- import { IconButton as UIIconButton } from '@faststore/ui'
1
+ import {
2
+ ModalBody as UIModalBody,
3
+ ModalHeader as UIModalHeader,
4
+ } from '@faststore/ui'
2
5
 
3
6
  import RegionalizationInput from 'src/components/regionalization/RegionalizationInput'
4
7
  import Icon from 'src/components/ui/Icon'
5
8
  import Link from 'src/components/ui/Link'
6
9
 
7
- import styles from './regionalization-modal-content.module.scss'
10
+ import styles from './regionalization-modal-body.module.scss'
8
11
 
9
- export type RegionalizationModalContentProps = {
12
+ export interface RegionalizationModalContentProps {
10
13
  onClose?: () => void
11
14
  }
12
15
 
@@ -14,35 +17,25 @@ function RegionalizationModalContent({
14
17
  onClose,
15
18
  }: RegionalizationModalContentProps) {
16
19
  return (
17
- <div
18
- data-fs-regionalization-modal-content
19
- className={styles.fsRegionalizationModalContent}
20
- >
21
- <header data-fs-regionalization-modal-header>
22
- {onClose && (
23
- <UIIconButton
24
- onClick={() => onClose?.()}
25
- data-fs-regionalization-modal-button
26
- aria-label="Close Regionalization Modal"
27
- data-testid="regionalization-modal-button-close"
28
- icon={<Icon name="X" width={30} height={30} />}
29
- />
30
- )}
31
- <p data-fs-regionalization-modal-title>Set your location</p>
32
- <p data-fs-regionalization-modal-description>
33
- Prices, offers and availability may vary according to your location.
34
- </p>
35
- </header>
36
- <div data-fs-regionalization-modal-body>
20
+ <>
21
+ <UIModalHeader
22
+ onClose={() => onClose()}
23
+ title="Set your location"
24
+ description="Prices, offers and availability may vary according to your location."
25
+ closeButtonProps={{
26
+ 'aria-label': 'Close Regionalization Modal',
27
+ }}
28
+ />
29
+ <UIModalBody className={styles.fsRegionalizationModalBody}>
37
30
  <div data-fs-regionalization-modal-input>
38
- <RegionalizationInput closeModal={() => onClose?.()} />
31
+ <RegionalizationInput closeModal={() => onClose()} />
39
32
  </div>
40
33
  <Link href="/" data-fs-regionalization-modal-link>
41
34
  {"I don't know my Postal Code"}
42
35
  <Icon name="ArrowSquareOut" width={18} height={18} />
43
36
  </Link>
44
- </div>
45
- </div>
37
+ </UIModalBody>
38
+ </>
46
39
  )
47
40
  }
48
41
 
@@ -0,0 +1,25 @@
1
+ .fs-regionalization-modal-body {
2
+ // --------------------------------------------------------
3
+ // Design Tokens for Regionalization Modal
4
+ // --------------------------------------------------------
5
+
6
+ // Link
7
+ --fs-regionalization-modal-link-padding: 0;
8
+ --fs-regionalization-modal-link-color: var(--fs-color-link);
9
+ --fs-regionalization-modal-link-margin-right: var(--fs-spacing-0);
10
+
11
+ [data-fs-regionalization-modal-input] {
12
+ margin-bottom: var(--fs-spacing-6);
13
+ }
14
+
15
+ [data-fs-regionalization-modal-link] {
16
+ display: flex;
17
+ flex-direction: row;
18
+ align-content: flex-start;
19
+ align-items: center;
20
+ justify-content: flex-start;
21
+ padding: var(--fs-regionalization-modal-link-padding);
22
+ margin-right: var(--fs-regionalization-modal-link-margin-right);
23
+ color: var(--fs-regionalization-modal-link-color);
24
+ }
25
+ }
@@ -1,7 +1,7 @@
1
1
  import { SearchProvider } from '@faststore/sdk'
2
2
  import { useSearch } from '@faststore/sdk'
3
3
 
4
- import UIProvider, { useUI } from 'src/sdk/ui/Provider'
4
+ import { UIProvider, useUI } from '@faststore/ui'
5
5
  import { validateSession } from 'src/sdk/session'
6
6
  import { useFilter } from './useFilter'
7
7
 
@@ -134,7 +134,7 @@ Facets represent the <code>Filter</code> details and allow users to refine their
134
134
 
135
135
  ## Overview
136
136
 
137
- The `Facets` component uses the [Accordion](?path=/docs/molecules-accordion-overview--default-story), [Checkbox](?path=/docs/atoms-checkbox--overview-default), [PriceRange](?path=/docs/molecules-pricerange--overview-default), and [Badge](?path=/docs/molecules-badge--default) components.
137
+ The `Facets` component uses the Accordion, [Checkbox](?path=/docs/atoms-checkbox--overview-default), PriceRange, and [Badge](?path=/docs/molecules-badge--default) components.
138
138
 
139
139
  ---
140
140
 
@@ -194,30 +194,30 @@ The `Facets` component uses the [Accordion](?path=/docs/molecules-accordion-over
194
194
 
195
195
  <TokenTable>
196
196
  <TokenRow
197
- token="--fs-facets-accordion-item-button-text-size"
197
+ token="--fs-facets-accordion-button-text-size"
198
198
  value="var(--fs-text-size-lead)"
199
199
  />
200
200
  <TokenRow
201
- token="--fs-facets-accordion-item-button-text-weight"
201
+ token="--fs-facets-accordion-button-text-weight"
202
202
  value="var(--fs-text-weight-regular)"
203
203
  />
204
- <TokenRow token="--fs-facets-accordion-item-button-line-height" value="1.5" />
204
+ <TokenRow token="--fs-facets-accordion-button-line-height" value="1.5" />
205
205
  <TokenDivider />
206
206
  <TokenRow
207
- token="--fs-facets-accordion-item-button-text-weight-notebook"
207
+ token="--fs-facets-accordion-button-text-weight-notebook"
208
208
  value="var(--fs-text-size-2)"
209
209
  />
210
210
  <TokenRow
211
- token="--fs-facets-accordion-item-button-line-height-notebook"
211
+ token="--fs-facets-accordion-button-line-height-notebook"
212
212
  value="1.25"
213
213
  />
214
214
  <TokenRow
215
- token="--fs-facets-accordion-item-button-padding-right-notebook"
215
+ token="--fs-facets-accordion-button-padding-right-notebook"
216
216
  value="var(--fs-spacing-4)"
217
217
  />
218
218
  <TokenRow
219
- token="--fs-facets-accordion-item-button-padding-left-notebook"
220
- value="var(--fs-facets-accordion-item-button-padding-right-notebook)"
219
+ token="--fs-facets-accordion-button-padding-left-notebook"
220
+ value="var(--fs-facets-accordion-button-padding-right-notebook)"
221
221
  />
222
222
  </TokenTable>
223
223