@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
@@ -1,254 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-product-card {
4
- // --------------------------------------------------------
5
- // Design Tokens for Product Card
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
- --fs-product-card-padding : var(--fs-spacing-1) var(--fs-spacing-1) var(--fs-spacing-2) var(--fs-spacing-1);
10
- --fs-product-card-gap : var(--fs-grid-gap-2);
11
- --fs-product-card-min-width : 10rem;
12
-
13
- --fs-product-card-shadow : var(--fs-shadow);
14
- --fs-product-card-shadow-hover : var(--fs-shadow-hover);
15
-
16
- --fs-product-card-bkg-color : var(--fs-color-body-bkg);
17
- --fs-product-card-bkg-color-hover : var(--fs-product-card-bkg-color);
18
- --fs-product-card-bkg-color-focus : var(--fs-product-card-bkg-color-hover);
19
-
20
- --fs-product-card-border-radius : var(--fs-border-radius);
21
- --fs-product-card-border-width : var(--fs-border-width);
22
- --fs-product-card-border-color : var(--fs-border-color-light);
23
- --fs-product-card-border-color-hover : var(--fs-border-color-hover);
24
-
25
- --fs-product-card-transition-function : var(--fs-transition-function);
26
- --fs-product-card-transition-property : var(--fs-transition-property);
27
- --fs-product-card-transition-timing : var(--fs-transition-timing);
28
-
29
- // Content
30
- --fs-product-card-content-padding : var(--fs-spacing-2) 0 0 0;
31
-
32
- // Image
33
- --fs-product-card-img-radius : var(--fs-product-card-border-radius);
34
- --fs-product-card-img-scale-hover : 1;
35
-
36
- // Title
37
- --fs-product-card-title-color : var(--fs-color-text);
38
- --fs-product-card-title-size : var(--fs-text-size-base);
39
- --fs-product-card-title-weight : var(--fs-text-weight-regular);
40
- --fs-product-card-title-max-lines : var(--fs-text-max-lines);
41
-
42
- // Price
43
- --fs-product-card-price-color : var(--fs-color-text);
44
- --fs-product-card-price-size : var(--fs-text-size-base);
45
- --fs-product-card-price-listing-color : var(--fs-color-text-light);
46
- --fs-product-card-price-listing-size : var(--fs-text-size-legend);
47
-
48
- // Description
49
- --fs-product-card-description-color : var(--fs-color-text);
50
- --fs-product-card-description-size : var(--fs-text-size-legend);
51
-
52
- // Subtitle
53
- --fs-product-card-subtitle-color : var(--fs-color-text-light);
54
- --fs-product-card-subtitle-size : var(--fs-text-size-tiny);
55
-
56
- // Wide
57
- --fs-product-card-wide-padding : 0;
58
- --fs-product-card-wide-content-padding : var(--fs-spacing-2);
59
- --fs-product-card-wide-bkg-color : var(--fs-color-neutral-bkg);
60
- --fs-product-card-wide-min-width : 9rem;
61
-
62
- // --------------------------------------------------------
63
- // Structural Styles
64
- // --------------------------------------------------------
65
-
66
- position: relative;
67
- display: grid;
68
- grid-template-rows: minmax(0, max-content);
69
- grid-auto-flow: row;
70
- min-width: var(--fs-product-card-min-width);
71
- height: 100%;
72
- padding: var(--fs-product-card-padding);
73
- background-color: var(--fs-product-card-bkg-color);
74
- border: var(--fs-product-card-border-width) solid transparent;
75
- border-radius: var(--fs-product-card-border-radius);
76
- box-shadow: var(--fs-product-card-shadow);
77
- transition: var(--fs-product-card-transition-property) var(--fs-product-card-transition-timing) var(--fs-product-card-transition-function);
78
-
79
- &:focus-within {
80
- @include focus-ring;
81
-
82
- background-color: var(--fs-product-card-bkg-color-focus);
83
- }
84
-
85
- @media (hover: hover) {
86
- &:hover {
87
- background-color: var(--fs-product-card-bkg-color-hover);
88
- border-color: var(--fs-product-card-border-color-hover);
89
- box-shadow: var(--fs-product-card-shadow-hover);
90
- [data-fs-product-card-image] img { transform: scale(var(--fs-product-card-img-scale-hover)); }
91
- }
92
- }
93
-
94
- [data-fs-product-card-image] {
95
- position: relative;
96
- display: flex;
97
- justify-content: center;
98
- overflow: hidden;
99
- border-radius: var(--fs-product-card-img-radius);
100
-
101
- img {
102
- transition: var(--fs-product-card-transition-property) var(--fs-product-card-transition-timing) var(--fs-product-card-transition-function);
103
- }
104
- }
105
-
106
- [data-fs-product-card-content] {
107
- display: grid;
108
- grid-template-rows: 1fr auto;
109
- padding: var(--fs-product-card-content-padding);
110
-
111
- [data-fs-link] {
112
- min-height: 100%;
113
- padding: 0;
114
- color: var(--fs-product-card-title-color);
115
- text-decoration: none;
116
- outline: none;
117
-
118
- &::after {
119
- position: absolute;
120
- top: 0;
121
- right: 0;
122
- bottom: 0;
123
- left: 0;
124
- display: block;
125
- content: "";
126
- }
127
- }
128
-
129
- [data-fs-badge],
130
- [data-fs-product-card-actions] { margin-top: var(--fs-spacing-2); }
131
- }
132
-
133
- [data-fs-product-card-actions] {
134
- display: flex;
135
- align-items: flex-end;
136
- }
137
-
138
- [data-fs-product-card-title] {
139
- font-size: var(--fs-product-card-title-size);
140
- font-weight: var(--fs-product-card-title-weight);
141
- line-height: 1.25;
142
- color: var(--fs-product-card-title-color);
143
-
144
- @include truncate-title(var(--fs-product-card-title-max-lines));
145
- }
146
-
147
- [data-fs-product-card-prices] {
148
- display: inline-flex;
149
- align-content: center;
150
-
151
- [data-variant="spot"] {
152
- font-size: var(--fs-product-card-price-size);
153
- color: var(--fs-product-card-price-color);
154
- }
155
-
156
- [data-variant="listing"] {
157
- font-size: var(--fs-product-card-price-listing-size);
158
- color: var(--fs-product-card-price-listing-color);
159
- }
160
- }
161
-
162
- [data-fs-product-card-footer] {
163
- display: flex;
164
- gap: var(--fs-product-card-gap);
165
- align-items: center;
166
- justify-content: space-between;
167
- margin-top: var(--fs-product-card-gap);
168
-
169
- small {
170
- display: block;
171
- font-size: var(--fs-product-card-subtitle-size);
172
- color: var(--fs-product-card-subtitle-color);
173
- }
174
- }
175
-
176
- // --------------------------------------------------------
177
- // Variants Styles
178
- // --------------------------------------------------------
179
-
180
- &[data-fs-product-card-bordered="true"] {
181
- border: var(--fs-product-card-border-width) solid var(--fs-product-card-border-color);
182
-
183
- @media (hover: hover) {
184
- &:hover {
185
- border-color: var(--fs-product-card-border-color-hover);
186
- }
187
- }
188
- }
189
-
190
- &[data-fs-product-card-variant="wide"] {
191
- --fs-product-card-padding : var(--fs-product-card-wide-padding);
192
- --fs-product-card-content-padding : var(--fs-product-card-wide-content-padding);
193
- --fs-product-card-bkg-color : var(--fs-product-card-wide-bkg-color);
194
- --fs-product-card-min-width : var(--fs-product-card-wide-min-width);
195
-
196
- grid-template-rows: 1fr auto;
197
-
198
- @include media(">=tablet") {
199
- grid-template-rows: 5fr 2fr;
200
-
201
- &[data-fs-product-card-actionable="true"] {
202
- grid-template-rows: 10fr 7fr;
203
- }
204
- }
205
-
206
- @include media(">=notebook") {
207
- &[data-fs-product-card-actionable="true"] {
208
- grid-template-rows: 6fr 3fr;
209
- }
210
-
211
- grid-template-rows: 4fr 1fr;
212
- }
213
-
214
- [data-fs-product-card-content] {
215
- @include media(">=notebook") {
216
- display: grid;
217
- grid-template-rows: auto;
218
- grid-template-columns: 1fr auto;
219
- gap: var(--fs-product-card-gap);
220
- }
221
- }
222
-
223
- [data-product-card-image] {
224
- border-radius: 0;
225
- }
226
-
227
- [data-fs-badge] {
228
- @include media(">=notebook") {
229
- grid-row: 1;
230
- grid-column: 2;
231
- margin-top: 0;
232
- }
233
- }
234
- }
235
-
236
- &[data-fs-product-card-variant="horizontal"] {
237
- grid-template-rows: auto;
238
- grid-template-columns: 40% 1fr;
239
- grid-auto-flow: column;
240
- gap: var(--fs-product-card-gap);
241
- min-width: calc(var(--fs-product-card-min-width) * 1.5);
242
-
243
- [data-product-card-image] { grid-row: span 2; }
244
-
245
- [data-fs-product-card-content] {
246
- display: grid;
247
- grid-row: 1;
248
- gap: calc(var(--fs-product-card-gap) / 2);
249
- }
250
-
251
- [data-fs-badge] { align-self: end; }
252
- [data-fs-product-card-prices] { margin-bottom: 0; }
253
- }
254
- }
@@ -1,79 +0,0 @@
1
- .fs-regionalization-modal-content {
2
- // --------------------------------------------------------
3
- // Design Tokens for Regionalization Modal
4
- // --------------------------------------------------------
5
-
6
- // Default properties
7
- --fs-regionalization-modal-padding : var(--fs-spacing-1) var(--fs-spacing-4) var(--fs-spacing-5);
8
- --fs-regionalization-modal-background-color : var(--fs-color-body-bkg);
9
- --fs-regionalization-modal-border-radius : var(--fs-border-radius);
10
-
11
- // Header
12
- --fs-regionalization-modal-header-padding : var(--fs-spacing-4) var(--fs-spacing-7) var(--fs-spacing-4) var(--fs-spacing-4);
13
-
14
- // Title
15
- --fs-regionalization-modal-title-margin-bottom : .625rem;
16
- --fs-regionalization-modal-title-size : var(--fs-text-size-lead);
17
- --fs-regionalization-modal-title-weight : var(--fs-text-weight-bold);
18
- --fs-regionalization-modal-title-line-height : 1.2;
19
-
20
- // Description
21
- --fs-regionalization-modal-description-size : var(--fs-text-size-body);
22
- --fs-regionalization-modal-description-line-height : 1.5;
23
- --fs-regionalization-modal-description-color : var(--fs-color-text-light);
24
-
25
- // Close Button
26
- --fs-regionalization-modal-close-button-position-top : 0;
27
- --fs-regionalization-modal-close-button-position-right : 0;
28
-
29
- // Link
30
- --fs-regionalization-modal-link-padding : 0;
31
- --fs-regionalization-modal-link-color : var(--fs-color-link);
32
- --fs-regionalization-modal-link-margin-right : var(--fs-spacing-0);
33
-
34
- position: relative;
35
- background-color: var(--fs-regionalization-modal-background-color);
36
- border-radius: var(--fs-regionalization-modal-border-radius);
37
-
38
- [data-fs-regionalization-modal-header] {
39
- padding: var(--fs-regionalization-modal-header-padding);
40
-
41
- [data-fs-regionalization-modal-title] {
42
- margin-bottom: var(--fs-regionalization-modal-title-margin-bottom);
43
- font-size: var(--fs-regionalization-modal-title-size);
44
- font-weight: var(--fs-regionalization-modal-title-weight);
45
- line-height: var(--fs-regionalization-modal-title-line-height);
46
- }
47
-
48
- [data-fs-regionalization-modal-description] {
49
- font-size: var(--fs-regionalization-modal-description-size);
50
- line-height: var(--fs-regionalization-modal-description-line-height);
51
- color: var(--fs-regionalization-modal-description-color);
52
- }
53
-
54
- [data-fs-regionalization-modal-button] {
55
- position: absolute;
56
- top: var(--fs-regionalization-modal-close-button-position-top);
57
- right: var(--fs-regionalization-modal-close-button-position-right);
58
- }
59
- }
60
-
61
- [data-fs-regionalization-modal-body] {
62
- padding: var(--fs-regionalization-modal-padding);
63
-
64
- [data-fs-regionalization-modal-input] {
65
- margin-bottom: var(--fs-spacing-6);
66
- }
67
-
68
- [data-fs-regionalization-modal-link] {
69
- display: flex;
70
- flex-direction: row;
71
- align-content: flex-start;
72
- align-items: center;
73
- justify-content: flex-start;
74
- padding: var(--fs-regionalization-modal-link-padding);
75
- margin-right: var(--fs-regionalization-modal-link-margin-right);
76
- color: var(--fs-regionalization-modal-link-color);
77
- }
78
- }
79
- }
@@ -1,11 +0,0 @@
1
- import styles from './shimmer.module.scss'
2
-
3
- function Shimmer() {
4
- return (
5
- <div className={styles.fsShimmer} data-fs-shimmer-wrapper>
6
- <div data-fs-shimmer />
7
- </div>
8
- )
9
- }
10
-
11
- export default Shimmer
@@ -1 +0,0 @@
1
- export { default } from './Shimmer'
@@ -1,43 +0,0 @@
1
- .fs-shimmer {
2
- // --------------------------------------------------------
3
- // Design Tokens for Shimmer
4
- // --------------------------------------------------------
5
-
6
- // Default properties
7
- --fs-shimmer-wrapper-transition-timing : 850ms;
8
- --fs-shimmer-wrapper-transition-function : linear;
9
- --fs-shimmer-wrapper-transition-iteration : infinite;
10
-
11
- // Shimmer
12
- --fs-shimmer-width : 50%;
13
- --fs-shimmer-height : 100%;
14
- --fs-shimmer-bkg-color : rgb(255 255 255 / 20%);
15
- --fs-shimmer-box-shadow : 0 0 var(--fs-spacing-5) var(--fs-spacing-5) rgb(255 255 255 / 20%);
16
-
17
- // --------------------------------------------------------
18
- // Structural Styles
19
- // --------------------------------------------------------
20
-
21
- /*
22
- * Parent must have `position: relative` and `overflow: hidden`
23
- * in order to the effect to work properly.
24
- */
25
- position: absolute;
26
- top: 0;
27
- left: 0;
28
- width: 100vw;
29
- height: 100%;
30
- animation: loading var(--fs-shimmer-wrapper-transition-timing) var(--fs-shimmer-wrapper-transition-iteration) var(--fs-shimmer-wrapper-transition-function);
31
-
32
- [data-fs-shimmer] {
33
- width: var(--fs-shimmer-width);
34
- height: var(--fs-shimmer-height);
35
- background: var(--fs-shimmer-bkg-color);
36
- box-shadow: var(--fs-shimmer-box-shadow);
37
- }
38
- }
39
-
40
- @keyframes loading {
41
- 0% { transform: translate3d(-50vw, 0, 0); }
42
- 100% { transform: translate3d(0, 0, 0); }
43
- }
@@ -1,49 +0,0 @@
1
- import type { PropsWithChildren } from 'react'
2
- import { Skeleton as UISkeleton } from '@faststore/ui'
3
-
4
- import Shimmer from '../Shimmer'
5
- import styles from './skeleton.module.scss'
6
-
7
- type Variant = 'text' | 'button' | 'image' | 'badge'
8
-
9
- interface SkeletonProps {
10
- /**
11
- * Control whether skeleton should be visible or not.
12
- */
13
- loading?: boolean
14
- /**
15
- * Control whether the shimmer effect should be displayed or not.
16
- */
17
- shimmer?: boolean
18
- /**
19
- * Specifies the skeleton element variant.
20
- */
21
- variant: Variant
22
- }
23
-
24
- function Skeleton({
25
- variant,
26
- children,
27
- loading = true,
28
- shimmer = false,
29
- ...otherProps
30
- }: PropsWithChildren<SkeletonProps>) {
31
- return loading ? (
32
- <div
33
- data-fs-skeleton-wrapper
34
- className={styles.fsSkeleton}
35
- data-fs-skeleton-shimmer={shimmer}
36
- >
37
- <UISkeleton
38
- data-fs-skeleton
39
- data-fs-skeleton-variant={variant}
40
- {...otherProps}
41
- />
42
- {shimmer && <Shimmer />}
43
- </div>
44
- ) : (
45
- <>{children}</>
46
- )
47
- }
48
-
49
- export default Skeleton
@@ -1 +0,0 @@
1
- export { default } from './Skeleton'
@@ -1,77 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-skeleton {
4
- // --------------------------------------------------------
5
- // Design Tokens for Skeleton
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
- --fs-skeleton-bkg-color : var(--fs-color-disabled-bkg);
10
- --fs-skeleton-border-radius : var(--fs-border-radius);
11
-
12
- // Text
13
- --fs-skeleton-text-width : 100%;
14
- --fs-skeleton-text-height : var(--fs-spacing-4);
15
-
16
- // Button
17
- --fs-skeleton-button-width : var(--fs-spacing-13);
18
- --fs-skeleton-button-height : var(--fs-spacing-5);
19
- --fs-skeleton-button-gap : var(--fs-spacing-2);
20
- --fs-skeleton-button-border-radius : var(--fs-skeleton-border-radius);
21
-
22
- // Image
23
- --fs-skeleton-image-height-mobile : 45vw;
24
- --fs-skeleton-image-height-desktop : 12.188rem;
25
- --fs-skeleton-image-border-radius : var(--fs-skeleton-border-radius);
26
-
27
- // Badge
28
- --fs-skeleton-badge-width : 40%;
29
- --fs-skeleton-badge-height : var(--fs-spacing-5);
30
- --fs-skeleton-badge-border-radius : var(--fs-border-radius-pill);
31
-
32
- // --------------------------------------------------------
33
- // Structural Styles
34
- // --------------------------------------------------------
35
-
36
- &[data-fs-skeleton-shimmer="true"] {
37
- position: relative;
38
- overflow: hidden;
39
- }
40
-
41
- [data-fs-skeleton] {
42
- overflow: hidden;
43
- background: var(--fs-skeleton-bkg-color);
44
- border-radius: var(--fs-skeleton-border-radius);
45
-
46
- // --------------------------------------------------------
47
- // Variants Styles
48
- // --------------------------------------------------------
49
-
50
- &[data-fs-skeleton-variant="text"] {
51
- width: var(--fs-skeleton-text-width);
52
- height: var(--fs-skeleton-text-height);
53
- }
54
-
55
- &[data-fs-skeleton-variant="button"] {
56
- column-gap: var(--fs-skeleton-button-gap);
57
- width: var(--fs-skeleton-button-width);
58
- height: var(--fs-skeleton-button-height);
59
- border-radius: var(--fs-skeleton-button-border-radius);
60
- }
61
-
62
- &[data-fs-skeleton-variant="image"] {
63
- height: var(--fs-skeleton-image-height-mobile);
64
- border-radius: var(--fs-skeleton-image-border-radius);
65
-
66
- @include media(">=notebook") {
67
- height: var(--fs-skeleton-image-height-desktop);
68
- }
69
- }
70
-
71
- &[data-fs-skeleton-variant="badge"] {
72
- width: var(--fs-skeleton-badge-width);
73
- height: var(--fs-skeleton-badge-height);
74
- border-radius: var(--fs-skeleton-badge-border-radius);
75
- }
76
- }
77
- }
@@ -1,177 +0,0 @@
1
- import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import { TokenTable, TokenRow } from 'src/../.storybook/components'
4
- import { SectionList, SectionItem } from 'src/../.storybook/components'
5
-
6
- import Skeleton from './Skeleton'
7
- import FilterSkeleton from './FilterSkeleton'
8
- import ProductCardSkeleton from './ProductCardSkeleton'
9
-
10
- import Icon from 'src/components/ui/Icon'
11
-
12
- export const TemplateSkeleton = ({ ...args }) => <Skeleton {...args} />
13
-
14
- <Meta
15
- component={Skeleton}
16
- title="Features/Skeletons/Overview"
17
- argTypes={{
18
- loading: {
19
- control: 'boolean',
20
- table: { type: 'boolean', summary: true },
21
- },
22
- shimmer: {
23
- control: 'boolean',
24
- table: { type: 'boolean', summary: false },
25
- },
26
- }}
27
- />
28
-
29
- <header>
30
-
31
- # Skeletons
32
-
33
- This feature improves the store's experience and perceived performance through loading placeholders.
34
-
35
- </header>
36
-
37
- ## Overview
38
-
39
- `Skeletons` are like an element's or section's wireframe. It's a placeholder
40
- that simulates the layout of these elements/sections while data is being loaded.
41
-
42
- Instead of showing a blank page, displaying `Skeletons` while loading content makes the user feel like the store is more responsive and faster.
43
-
44
- Also by using `Skeletons` the store will be less likely to experience [Cumulative Layout Shilf (or CLS)](https://web.dev/i18n/en/cls/).
45
-
46
- ---
47
-
48
- ## Usage
49
-
50
- The `Skeleton` component is used as placeholder for the primitive elements (e.g. texts, buttons), being part of the related components.
51
-
52
- `import Skeleton from 'src/components/skeletons/Skeleton'`
53
-
54
- <Canvas className="canvas-skeletons">
55
- <Story name="Usage" args={{ loading: true, shimmer: false, variant: 'text' }}>
56
- {TemplateSkeleton.bind({})}
57
- </Story>
58
- </Canvas>
59
-
60
- <ArgsTable story="Usage" />
61
-
62
- <TokenTable>
63
- <TokenRow
64
- token="--fs-skeleton-bkg-color"
65
- value="var(--fs-color-disabled-bkg)"
66
- isColor
67
- />
68
- <TokenRow
69
- token="--fs-skeleton-border-radius"
70
- value="var(--fs-border-radius)"
71
- />
72
- </TokenTable>
73
-
74
- ---
75
-
76
- ## Variants
77
-
78
- ### Text
79
-
80
- <Canvas className="canvas-skeletons">
81
- <Story name="Text" args={{ loading: true, shimmer: true, variant: 'text' }}>
82
- {TemplateSkeleton.bind({})}
83
- </Story>
84
- </Canvas>
85
-
86
- <TokenTable>
87
- <TokenRow token="--fs-skeleton-text-width" value="100%" />
88
- <TokenRow token="--fs-skeleton-text-height" value="var(--fs-spacing-4)" />
89
- </TokenTable>
90
-
91
- ### Button
92
-
93
- <Canvas className="canvas-skeletons">
94
- <Story
95
- name="Button"
96
- args={{ loading: true, shimmer: true, variant: 'button' }}
97
- >
98
- {TemplateSkeleton.bind({})}
99
- </Story>
100
- </Canvas>
101
-
102
- <TokenTable>
103
- <TokenRow token="--fs-skeleton-button-width" value="var(--fs-spacing-13)" />
104
- <TokenRow token="--fs-skeleton-button-height" value="var(--fs-spacing-5)" />
105
- <TokenRow token="--fs-skeleton-button-gap" value="var(--fs-spacing-2)" />
106
- <TokenRow
107
- token="--fs-skeleton-button-border-radius"
108
- value="var(--fs-skeleton-border-radius)"
109
- />
110
- </TokenTable>
111
-
112
- ### Image
113
-
114
- <Canvas className="canvas-skeletons">
115
- <Story name="Image" args={{ loading: true, shimmer: true, variant: 'image' }}>
116
- {TemplateSkeleton.bind({})}
117
- </Story>
118
- </Canvas>
119
-
120
- <TokenTable>
121
- <TokenRow token="--fs-skeleton-image-height-mobile" value="45vw" />
122
- <TokenRow token="--fs-skeleton-image-height-desktop" value="12.188rem" />
123
- <TokenRow
124
- token="--fs-skeleton-image-border-radius"
125
- value="var(--fs-skeleton-border-radius)"
126
- />
127
- </TokenTable>
128
-
129
- ### Badge
130
-
131
- <Canvas className="canvas-skeletons">
132
- <Story name="Badge" args={{ loading: true, shimmer: true, variant: 'badge' }}>
133
- {TemplateSkeleton.bind({})}
134
- </Story>
135
- </Canvas>
136
-
137
- <TokenTable>
138
- <TokenRow token="--fs-skeleton-badge-height-mobile" value="45%" />
139
- <TokenRow
140
- token="--fs-skeleton-badge-height-desktop"
141
- value="var(--fs-spacing-5)"
142
- />
143
- <TokenRow
144
- token="--fs-skeleton-badge-border-radius"
145
- value="var(--fs-skeleton-border-radius)"
146
- />
147
- </TokenTable>
148
-
149
- ---
150
-
151
- ## Components
152
-
153
- <SectionList grid="grid" classes="sbdocs-skeletons">
154
- <SectionItem
155
- title="Filter Skeleton"
156
- actionPath="../?path=/docs/features-skeletons-filterskeleton--usage"
157
- description={
158
- <>
159
- Loading placeholder for the <code>Filter</code> used in PLP.
160
- </>
161
- }
162
- >
163
- <FilterSkeleton loading />
164
- </SectionItem>
165
- <SectionItem
166
- title="Product Card Skeleton"
167
- actionPath="../?path=/docs/features-skeletons-productcardskeleton--usage"
168
- description={
169
- <>
170
- Loading placeholder for the <code>ProductCard</code> used in several
171
- sections of the store.
172
- </>
173
- }
174
- >
175
- <ProductCardSkeleton variant="wide" displayButton />
176
- </SectionItem>
177
- </SectionList>