@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,115 +0,0 @@
1
- import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import Dropdown, { DropdownButton, DropdownMenu, DropdownItem } from '.'
4
- import Icon from '../Icon'
5
-
6
- import style from 'src/components/ui/Button/button.module.scss'
7
-
8
- import {
9
- TokenTable,
10
- TokenRow,
11
- TokenDivider,
12
- } from 'src/../.storybook/components'
13
-
14
- <Meta title="Molecules/Dropdown/DropdownMenu" component={DropdownMenu} />
15
-
16
- export const Template = (args) => (
17
- <Dropdown>
18
- <DropdownButton
19
- className={style.fsButton}
20
- data-fs-button-variant="tertiary"
21
- >
22
- <Icon name="CaretDown" width="18" height="18" weight="bold" />
23
- <span>Dropdown Menu</span>
24
- </DropdownButton>
25
- <DropdownMenu {...args}>
26
- <DropdownItem>Dropdown Item 1</DropdownItem>
27
- <DropdownItem>Dropdown Item 2</DropdownItem>
28
- <DropdownItem>Dropdown Item 3</DropdownItem>
29
- </DropdownMenu>
30
- </Dropdown>
31
- )
32
-
33
- export const TemplateSmall = (args) => (
34
- <Dropdown>
35
- <DropdownButton
36
- className={style.fsButton}
37
- data-fs-button-variant="tertiary"
38
- >
39
- <Icon name="CaretDown" width="18" height="18" weight="bold" />
40
- <span>Dropdown Menu Small</span>
41
- </DropdownButton>
42
- <DropdownMenu size="small">
43
- <DropdownItem>Dropdown Item 1</DropdownItem>
44
- <DropdownItem>Dropdown Item 2</DropdownItem>
45
- <DropdownItem>Dropdown Item 3</DropdownItem>
46
- </DropdownMenu>
47
- </Dropdown>
48
- )
49
-
50
- <header>
51
-
52
- # Dropdown Menu
53
-
54
- Displays a set of actions/items to the user, usually used to show a menu of options.
55
-
56
- </header>
57
-
58
- ## Overview
59
-
60
- The `DropdownMenu` is part of [Dropdown](?path=/docs/molecules-dropdown-default--default-story) component.
61
-
62
- <Canvas>
63
- <Story name="overview-default">{Template.bind({})}</Story>
64
- <Story name="overview-small">{TemplateSmall.bind({})}</Story>
65
- </Canvas>
66
-
67
- ---
68
-
69
- ## Usage
70
-
71
- `import Dropdown, { DropdownButton, DropdownMenu, DropdownItem } from '../components/ui/Dropdown'`
72
-
73
- <Canvas>
74
- <Story name="default">{Template.bind({})}</Story>
75
- </Canvas>
76
-
77
- <ArgsTable story="default" />
78
-
79
- <TokenTable>
80
- <TokenRow
81
- token="--fs-dropdown-menu-bkg-color"
82
- value="var(--fs-color-tertiary-bkg)"
83
- isColor
84
- />
85
- <TokenRow
86
- token="--fs-dropdown-menu-border-radius"
87
- value="var(--fs-border-radius)"
88
- />
89
- <TokenRow
90
- token="--fs-dropdown-menu-box-shadow"
91
- value="var(--fs-shadow-hover)"
92
- />
93
- </TokenTable>
94
-
95
- ---
96
-
97
- ## Variants
98
-
99
- ### Small
100
-
101
- <Canvas>
102
- <Story name="dropdown-menu-small">{TemplateSmall.bind({})}</Story>
103
- </Canvas>
104
-
105
- <TokenTable>
106
- <TokenRow token="--fs-dropdown-item-small-min-height" value="1.75rem" />
107
- <TokenRow
108
- token="--fs-dropdown-item-small-padding"
109
- value="var(--fs-spacing-0) var(--fs-spacing-2) var(--fs-spacing-0) var(--fs-spacing-1)"
110
- />
111
- <TokenRow
112
- token="--fs-dropdown-item-small-text-size"
113
- value="var(--fs-text-size-1)"
114
- />
115
- </TokenTable>
@@ -1,34 +0,0 @@
1
- import { DropdownMenu as UIDropdownMenu } from '@faststore/ui'
2
- import type { DropdownMenuProps } from '@faststore/ui'
3
-
4
- import styles from './dropdown.module.scss'
5
-
6
- export type Size = 'small' | 'regular'
7
-
8
- export type Props = DropdownMenuProps & {
9
- /**
10
- * Specifies the size variant
11
- */
12
- size?: Size
13
- }
14
-
15
- function DropdownMenu({
16
- children,
17
- size = 'regular',
18
- testId = 'store-dropdown-menu',
19
- ...otherProps
20
- }: Props) {
21
- return (
22
- <UIDropdownMenu
23
- data-fs-dropdown-menu
24
- data-fs-dropdown-menu-size={size}
25
- className={styles.fsDropdownMenu}
26
- data-testid={testId}
27
- {...otherProps}
28
- >
29
- {children}
30
- </UIDropdownMenu>
31
- )
32
- }
33
-
34
- export default DropdownMenu
@@ -1,101 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-dropdown-menu {
4
- // --------------------------------------------------------
5
- // Design Tokens for Dropdown Menu
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
-
10
- --fs-dropdown-menu-bkg-color : var(--fs-color-tertiary-bkg);
11
- --fs-dropdown-menu-border-radius : var(--fs-border-radius);
12
- --fs-dropdown-menu-box-shadow : var(--fs-shadow-hover);
13
-
14
- // Item
15
- --fs-dropdown-item-min-height : 2.375rem;
16
- --fs-dropdown-item-padding : var(--fs-spacing-1) var(--fs-spacing-2) var(--fs-spacing-1) var(--fs-spacing-1);
17
-
18
- --fs-dropdown-item-text-size : var(--fs-text-size-base);
19
- --fs-dropdown-item-text-weight : var(--fs-text-weight-regular);
20
-
21
- --fs-dropdown-item-color : var(--fs-color-link);
22
- --fs-dropdown-item-bkg-color : var(--fs-color-tertiary-bkg-light);
23
- --fs-dropdown-item-bkg-color-hover : var(--fs-color-primary-bkg-light);
24
-
25
- --fs-dropdown-item-border-bottom-color : var(--fs-border-color-light);
26
-
27
- // Icon
28
- --fs-dropdown-item-icon-min-width : 1.125rem;
29
- --fs-dropdown-item-icon-margin-right : var(--fs-spacing-0);
30
- --fs-dropdown-item-icon-margin-top : calc(-1 * var(--fs-spacing-1));
31
-
32
- // Small
33
- --fs-dropdown-item-small-min-height : 1.75rem;
34
- --fs-dropdown-item-small-padding : var(--fs-spacing-0) var(--fs-spacing-2) var(--fs-spacing-0) var(--fs-spacing-1);
35
- --fs-dropdown-item-small-text-size : var(--fs-text-size-1);
36
-
37
- // --------------------------------------------------------
38
- // Structural Styles
39
- // --------------------------------------------------------
40
-
41
- display: flex;
42
- flex-direction: column;
43
- align-items: flex-start;
44
- margin-top: var(--fs-spacing-0);
45
- overflow: hidden;
46
- background: var(--fs-dropdown-menu-bkg-color);
47
- border-radius: var(--fs-dropdown-menu-border-radius);
48
- box-shadow: var(--fs-dropdown-menu-box-shadow);
49
-
50
- [data-fs-dropdown-item] {
51
- display: flex;
52
- align-items: center;
53
- width: 100%;
54
- min-height: var(--fs-dropdown-item-min-height);
55
- padding: var(--fs-dropdown-item-padding);
56
- overflow: hidden;
57
- font-size: var(--fs-dropdown-item-text-size);
58
- font-weight: var(--fs-dropdown-item-text-weight);
59
- color: var(--fs-dropdown-item-color);
60
- text-align: left;
61
- text-overflow: ellipsis;
62
- white-space: nowrap;
63
- cursor: pointer;
64
- background-color: var(--fs-dropdown-item-bkg-color);
65
- border-width: 0;
66
-
67
- &:not(:last-child) {
68
- border-bottom: 1px solid var(--fs-dropdown-item-border-bottom-color);
69
- }
70
-
71
- @include media(">=notebook") {
72
- &:focus, &:hover {
73
- text-decoration: underline;
74
- background-color: var(--fs-dropdown-item-bkg-color-hover);
75
- outline: none;
76
- }
77
- }
78
-
79
- [data-fs-dropdown-item-icon] {
80
- display: flex;
81
- min-width: var(--fs-dropdown-item-icon-min-width);
82
- margin-right: var(--fs-dropdown-item-icon-margin-right);
83
- }
84
- }
85
-
86
- // --------------------------------------------------------
87
- // Variants Styles
88
- // --------------------------------------------------------
89
-
90
- &[data-fs-dropdown-menu-size="small"] {
91
- [data-fs-dropdown-item] {
92
- min-height: var(--fs-dropdown-item-small-min-height);
93
- padding: var(--fs-dropdown-item-small-padding);
94
- font-size: var(--fs-dropdown-item-small-text-size);
95
- }
96
- }
97
-
98
- [data-fs-breadcrumb-dropdown-item] [data-fs-dropdown-item-icon] {
99
- margin-top: var(--fs-dropdown-item-icon-margin-top);
100
- }
101
- }
@@ -1,4 +0,0 @@
1
- export { default } from './Dropdown'
2
- export { default as DropdownButton } from './DropdownButton'
3
- export { default as DropdownMenu } from './DropdownMenu'
4
- export { default as DropdownItem } from './DropdownItem'
@@ -1,99 +0,0 @@
1
- import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import Gift from '.'
4
- import {
5
- TokenTable,
6
- TokenRow,
7
- TokenDivider,
8
- } from 'src/../.storybook/components'
9
- import { product } from 'src/../.storybook/mocks'
10
-
11
- <Meta
12
- title="Molecules/Gift"
13
- argTypes={{
14
- icon: { control: { disable: true } },
15
- }}
16
- component={Gift}
17
- />
18
-
19
- export const Template = (args) => <Gift product={product} {...args} />
20
-
21
- <header>
22
-
23
- # Gift
24
-
25
- It displays an additional item to purchase as a gift.
26
-
27
- </header>
28
-
29
- ## Overview
30
-
31
- The `Gift` component uses [FastStore UI Gift](https://www.faststore.dev/reference/ui/molecules) as base.
32
-
33
- ---
34
-
35
- ## Usage
36
-
37
- `import Gift from '../components/ui/Gift'`
38
-
39
- <Canvas>
40
- <Story name="Default">{Template.bind({})}</Story>
41
- </Canvas>
42
-
43
- <ArgsTable story="Default" />
44
-
45
- <TokenTable>
46
- <TokenRow token="--fs-gift-height" value="var(--fs-spacing-12)" />
47
- <TokenDivider />
48
- <TokenRow token="--fs-gift-border-width" value="var(--fs-border-width)" />
49
- <TokenRow
50
- token="--fs-gift-border-color"
51
- value="var(--fs-border-color-light)"
52
- isColor
53
- />
54
- <TokenRow token="--fs-gift-border-radius" value="var(--fs-border-radius)" />
55
- </TokenTable>
56
-
57
- ---
58
-
59
- ## Nested Elements
60
-
61
- ### Content
62
-
63
- <TokenTable>
64
- <TokenRow
65
- token="--fs-gift-content-padding"
66
- value="var(--fs-gift-gap) var(--fs-gift-gap) var(--fs-gift-gap) 0"
67
- />
68
- <TokenRow token="--fs-gift-content-row-gap" value="var(--fs-spacing-0)" />
69
- </TokenTable>
70
-
71
- ### Title
72
-
73
- <TokenTable>
74
- <TokenRow token="--fs-gift-title-line-height" value="1.25" />
75
- <TokenRow token="--fs-gift-title-size" value="var(--fs-text-size-body)" />
76
- <TokenRow
77
- token="--fs-gift-title-color"
78
- value="var(--fs-color-text)"
79
- isColor
80
- />
81
- </TokenTable>
82
-
83
- ### Icon
84
-
85
- <TokenTable>
86
- <TokenRow token="--fs-gift-icon-size" value="1.75rem" />
87
- <TokenRow token="--fs-gift-icon-padding" value="var(--fs-spacing-0)" />
88
- <TokenRow
89
- token="--fs-gift-icon-color"
90
- value="var(--fs-gift-title-color)"
91
- globalValue="var(--fs-color-text)"
92
- isColor
93
- />
94
- <TokenRow
95
- token="--fs-gift-icon-bkg-color"
96
- value="var(--fs-color-body-bkg)"
97
- isColor
98
- />
99
- </TokenTable>
@@ -1,94 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-gift {
4
- // --------------------------------------------------------
5
- // Design Tokens for Gift
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
-
10
- --fs-gift-height : var(--fs-spacing-12);
11
-
12
- --fs-gift-border-width : var(--fs-border-width);
13
- --fs-gift-border-color : var(--fs-border-color-light);
14
- --fs-gift-border-radius : var(--fs-border-radius);
15
-
16
- // Content
17
- --fs-gift-content-padding : var(--fs-spacing-1) var(--fs-spacing-2);
18
- --fs-gift-content-row-gap : var(--fs-spacing-0);
19
-
20
- // Title
21
- --fs-gift-title-line-height : 1.25;
22
- --fs-gift-title-size : var(--fs-text-size-body);
23
- --fs-gift-title-color : var(--fs-color-text);
24
-
25
- // Icon
26
- --fs-gift-icon-size : 1.75rem; // 28px
27
- --fs-gift-icon-padding : var(--fs-spacing-0);
28
- --fs-gift-icon-color : var(--fs-gift-title-color);
29
- --fs-gift-icon-bkg-color : var(--fs-color-body-bkg);
30
-
31
- // --------------------------------------------------------
32
- // Structural Styles
33
- // --------------------------------------------------------
34
-
35
- position: relative;
36
-
37
- [data-fs-gift-wrapper] {
38
- display: grid;
39
- grid-template-columns: var(--fs-gift-height) repeat(4, 1fr);
40
- align-items: flex-start;
41
- height: var(--fs-gift-height);
42
- overflow: hidden;
43
- border: var(--fs-gift-border-width) solid var(--fs-gift-border-color);
44
- border-radius: var(--fs-gift-border-radius);
45
- }
46
-
47
- [data-fs-gift-image] {
48
- height: 100%;
49
- overflow: hidden;
50
-
51
- img {
52
- object-fit: cover;
53
- width: 100%;
54
- height: 100%;
55
- }
56
- }
57
-
58
- [data-fs-gift-content] {
59
- display: grid;
60
- grid-column: 2 / span 4;
61
- row-gap: var(--fs-gift-content-row-gap);
62
- padding: var(--fs-gift-content-padding);
63
- }
64
-
65
- [data-fs-gift-product-title] {
66
- font-size: var(--fs-gift-title-size);
67
- line-height: var(--fs-gift-title-line-height);
68
- color: var(--fs-gift-title-color);
69
-
70
- @include truncate-title;
71
- }
72
-
73
- [data-fs-gift-product-summary] {
74
- display: flex;
75
- align-items: center;
76
-
77
- [data-fs-badge] {
78
- margin-left: var(--fs-spacing-1);
79
- }
80
- }
81
-
82
- [data-fs-gift-icon] {
83
- position: absolute;
84
- top: calc(-1 * var(--fs-gift-icon-size) / 2);
85
- left: calc(-1 * var(--fs-gift-icon-size) / 2);
86
- width: var(--fs-gift-icon-size);
87
- height: var(--fs-gift-icon-size);
88
- padding: var(--fs-gift-icon-padding);
89
- color: var(--fs-gift-icon-color);
90
- background-color: var(--fs-gift-icon-bkg-color);
91
- border: var(--fs-gift-border-width) solid var(--fs-gift-border-color);
92
- border-radius: var(--fs-border-radius-circle);
93
- }
94
- }
@@ -1,144 +0,0 @@
1
- import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import { Button, LinkButton } from '@faststore/ui'
4
-
5
- import UIProvider, { useUI } from 'src/sdk/ui/Provider'
6
- import { RegionalizationModalContent } from 'src/components/regionalization/RegionalizationModal'
7
-
8
- import Modal from '.'
9
- import Icon from '../Icon'
10
- import {
11
- TokenTable,
12
- TokenRow,
13
- TokenDivider,
14
- } from 'src/../.storybook/components'
15
-
16
- <Meta title="Molecules/Modal" component={Modal} />
17
-
18
- export const ModalTemplate = (args) => {
19
- const { modal, openModal } = useUI()
20
- return (
21
- <div>
22
- <Button variant="primary" onClick={() => openModal()}>
23
- Open Modal
24
- </Button>
25
- {modal && (
26
- <Modal>
27
- {({ fadeOut }) => (
28
- <div
29
- style={{
30
- display: 'flex',
31
- alignItems: 'center',
32
- flexDirection: 'column',
33
- padding: '3rem',
34
- backgroundColor: 'white',
35
- }}
36
- >
37
- <h1
38
- style={{
39
- fontSize: '2rem',
40
- paddingBottom: '1rem',
41
- }}
42
- >
43
- Hello, i'm a Modal!
44
- </h1>
45
- <Button onClick={fadeOut}>Close Modal</Button>
46
- </div>
47
- )}
48
- </Modal>
49
- )}
50
- </div>
51
- )
52
- }
53
-
54
- export const Template = (args) => {
55
- return (
56
- <UIProvider>
57
- <ModalTemplate />
58
- </UIProvider>
59
- )
60
- }
61
-
62
- <header>
63
-
64
- # Modal
65
-
66
- Modals are dialog windows that sit on top of an application's main view. Once a Modal is open, interactions with the content behind it are blocked.
67
-
68
- </header>
69
-
70
- ## Overview
71
-
72
- The `Modal` component uses [FastStore UI Modal](https://www.faststore.dev/reference/ui/molecules/Modal) as base.
73
-
74
- ---
75
-
76
- ## Usage
77
-
78
- `import Modal from 'src/components/ui/Modal'`
79
-
80
- <Canvas>
81
- <Story name="Overview">{Template.bind({})}</Story>
82
- </Canvas>
83
-
84
- ---
85
-
86
- <TokenTable>
87
- <TokenRow token="--fs-modal-position-top" value="30vh" />
88
- <TokenRow token="--fs-modal-position-right" value="var(--fs-spacing-4)" />
89
- <TokenRow token="--fs-modal-position-left" value="var(--fs-spacing-4)" />
90
- <TokenRow
91
- token="--fs-modal-max-width"
92
- value="calc(var(--fs-grid-breakpoint-desktop) / 3)"
93
- />
94
- <TokenRow token="--fs-modal-min-height" value="var(--fs-spacing-5)" />
95
- <TokenRow token="--fs-modal-margin" value="auto" />
96
- <TokenRow token="--fs-modal-border-radius" value="var(--fs-spacing-0)" />
97
- <TokenDivider />
98
- <TokenRow token="--fs-modal-width-tablet" value="calc(100vw / 3)" />
99
- <TokenRow
100
- token="--fs-modal-min-width-tablet"
101
- value="calc(var(--fs-grid-breakpoint-desktop) / 3)"
102
- />
103
- <TokenDivider />
104
- <TokenRow
105
- token="--fs-modal-transition-timing"
106
- value="var(--fs-transition-timing)"
107
- />
108
- <TokenRow token="--fs-modal-transition-property" value="transform" />
109
- <TokenRow token="--fs-modal-transition-in-function" value="ease-in" />
110
- <TokenRow token="--fs-modal-transition-out-function" value="ease-out" />
111
- </TokenTable>
112
-
113
- ---
114
-
115
- ## Use Cases
116
-
117
- <section className="sbdocs-list">
118
- <ul className="sbdocs-ul-row">
119
- <li>
120
- <div>
121
- <UIProvider>
122
- <RegionalizationModalContent onClose={() => {}} />
123
- </UIProvider>
124
- </div>
125
- <article className="sbdocs-list-text">
126
- <h3>RegionalizationModal</h3>
127
- <p>
128
- It's the modal that, trigged by <code>RegionalizationButton</code> or{' '}
129
- <code>RegionalizationBar</code>, shows the user the{' '}
130
- <code>RegionalizationInput</code> search.
131
- </p>
132
- <LinkButton
133
- size="small"
134
- variant="tertiary"
135
- href="../?path=/docs/features-regionalization-regionalizationmodal--overview"
136
- icon={<Icon name="ArrowRight" width="18" height="18" weight="bold" />}
137
- iconPosition="right"
138
- >
139
- See more
140
- </LinkButton>
141
- </article>
142
- </li>
143
- </ul>
144
- </section>
@@ -1,43 +0,0 @@
1
- import type { ModalProps as UIModalProps } from '@faststore/ui'
2
- import { Modal as UIModal } from '@faststore/ui'
3
- import type { ReactNode } from 'react'
4
-
5
- import { useUI } from 'src/sdk/ui/Provider'
6
- import { useFadeEffect } from 'src/sdk/ui/useFadeEffect'
7
-
8
- import styles from './modal.module.scss'
9
-
10
- export type ModalChildrenProps = {
11
- fade: 'in' | 'out'
12
- fadeOut: () => void
13
- fadeIn: () => void
14
- }
15
-
16
- type ModalChildrenFunction = (props: ModalChildrenProps) => ReactNode
17
-
18
- export type ModalProps = Omit<UIModalProps, 'isOpen' | 'children'> & {
19
- children: ModalChildrenFunction | ReactNode
20
- }
21
-
22
- function Modal({ className, children, ...props }: ModalProps) {
23
- const { closeModal } = useUI()
24
- const { fade, fadeOut, fadeIn } = useFadeEffect()
25
-
26
- return (
27
- <UIModal
28
- onDismiss={fadeOut}
29
- onTransitionEnd={() => fade === 'out' && closeModal()}
30
- data-fs-modal
31
- data-fs-modal-state={fade}
32
- className={`${styles.fsModal} ${className}`}
33
- {...props}
34
- isOpen
35
- >
36
- {typeof children === 'function'
37
- ? children({ fade, fadeOut, fadeIn })
38
- : children}
39
- </UIModal>
40
- )
41
- }
42
-
43
- export default Modal
@@ -1 +0,0 @@
1
- export { default } from './Modal'
@@ -1,46 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-modal {
4
- // --------------------------------------------------------
5
- // Design Tokens for Modal
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
- --fs-modal-position-top : 30vh;
10
- --fs-modal-position-right : var(--fs-spacing-4);
11
- --fs-modal-position-left : var(--fs-spacing-4);
12
- --fs-modal-max-width : calc(var(--fs-grid-breakpoint-desktop) / 3);
13
- --fs-modal-min-height : var(--fs-spacing-5);
14
- --fs-modal-margin : auto;
15
-
16
- --fs-modal-width-tablet : calc(100vw / 3);
17
- --fs-modal-min-width-tablet : calc(var(--fs-grid-breakpoint-desktop) / 3);
18
-
19
- --fs-modal-transition-timing : var(--fs-transition-timing);
20
- --fs-modal-transition-property : transform;
21
- --fs-modal-transition-in-function : ease-in;
22
- --fs-modal-transition-out-function : ease-in;
23
-
24
- position: fixed;
25
- top: var(--fs-modal-position-top);
26
- right: var(--fs-modal-position-right);
27
- left: var(--fs-modal-position-left);
28
- max-width: var(--fs-modal-max-width);
29
- min-height: var(--fs-modal-min-height);
30
- margin: var(--fs-modal-margin);
31
-
32
- @include media(">=tablet") {
33
- width: var(--fs-modal-width-tablet);
34
- min-width: var(--fs-modal-min-width-tablet);
35
- }
36
-
37
- &[data-fs-modal-state="in"] {
38
- transition: var(--fs-modal-transition-property) var(--fs-modal-transition-timing) var(--fs-modal-transition-in-function);
39
- transform: translate3d(0, 0, 0);
40
- }
41
-
42
- &[data-fs-modal-state="out"] {
43
- transition: var(--fs-modal-transition-property) var(--fs-modal-transition-timing) var(--fs-modal-transition-in-function);
44
- transform: translate3d(0, 50%, 0);
45
- }
46
- }