@faststore/core 0.3.16 → 0.3.17

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 (53) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/cypress/integration/analytics.test.js +3 -3
  3. package/cypress/integration/plp.test.js +1 -1
  4. package/package.json +4 -4
  5. package/src/Layout.tsx +6 -1
  6. package/src/components/cart/CartItem/CartItem.tsx +2 -2
  7. package/src/components/cart/CartSidebar/CartSidebar.tsx +5 -6
  8. package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
  9. package/src/components/common/Alert/Alert.tsx +6 -22
  10. package/src/components/common/Footer/Footer.stories.mdx +1 -1
  11. package/src/components/common/Footer/FooterLinks.tsx +16 -12
  12. package/src/components/search/Filter/Facets.stories.mdx +9 -9
  13. package/src/components/search/Filter/Facets.tsx +69 -61
  14. package/src/components/search/Filter/facets.module.scss +16 -16
  15. package/src/components/search/Search.stories.mdx +28 -24
  16. package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
  17. package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
  18. package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
  19. package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
  20. package/src/components/sections/ProductDetails/ProductDetails.tsx +2 -2
  21. package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
  22. package/src/components/ui/Gift/Gift.tsx +7 -13
  23. package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
  24. package/tsconfig.json +1 -1
  25. package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
  26. package/src/components/ui/Accordion/Accordion.tsx +0 -39
  27. package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
  28. package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
  29. package/src/components/ui/Accordion/accordion.module.scss +0 -65
  30. package/src/components/ui/Accordion/index.ts +0 -2
  31. package/src/components/ui/Alert/Alert.stories.mdx +0 -164
  32. package/src/components/ui/Alert/Alert.tsx +0 -81
  33. package/src/components/ui/Alert/alert.module.scss +0 -93
  34. package/src/components/ui/Alert/index.ts +0 -1
  35. package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
  36. package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
  37. package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
  38. package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
  39. package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
  40. package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
  41. package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
  42. package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
  43. package/src/components/ui/Dropdown/index.ts +0 -4
  44. package/src/components/ui/Gift/Gift.stories.mdx +0 -99
  45. package/src/components/ui/Gift/gift.module.scss +0 -94
  46. package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
  47. package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
  48. package/src/components/ui/PriceRange/index.ts +0 -1
  49. package/src/components/ui/PriceRange/price-range.module.scss +0 -176
  50. package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
  51. package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
  52. package/src/components/ui/QuantitySelector/index.ts +0 -1
  53. package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
@@ -1,81 +0,0 @@
1
- import {
2
- Alert as UIAlert,
3
- Icon as UIIcon,
4
- Button as UIButton,
5
- } from '@faststore/ui'
6
- import { useCallback } from 'react'
7
- import type { ReactNode, MouseEvent } from 'react'
8
- import type { AlertProps } from '@faststore/ui'
9
-
10
- import Link from 'src/components/ui/Link'
11
- import Icon from 'src/components/ui/Icon'
12
-
13
- import styles from './alert.module.scss'
14
-
15
- export type Props = AlertProps & {
16
- /**
17
- * Icon component for additional customization
18
- */
19
- icon?: ReactNode
20
- /**
21
- * Enables dismissible feature
22
- */
23
- dismissible?: boolean
24
- /**
25
- * The href and label used at the link
26
- */
27
- link?: {
28
- to: string
29
- text: string
30
- }
31
- onClose?: (event: MouseEvent<HTMLElement>) => void
32
- }
33
-
34
- function Alert({
35
- children,
36
- icon,
37
- dismissible,
38
- link,
39
- onClose,
40
- ...otherProps
41
- }: Props) {
42
- const handleClose = useCallback(
43
- (event: MouseEvent<HTMLElement>) => {
44
- if (event.defaultPrevented) {
45
- return
46
- }
47
-
48
- onClose?.(event)
49
- },
50
- [onClose]
51
- )
52
-
53
- return (
54
- <UIAlert
55
- data-fs-alert
56
- data-fs-alert-dismissible={dismissible}
57
- className={styles.fsAlert}
58
- {...otherProps}
59
- >
60
- {icon && <UIIcon component={icon} />}
61
-
62
- <p data-fs-alert-content>{children}</p>
63
-
64
- {link && (
65
- <Link data-fs-alert-link variant="inline" href={link.to}>
66
- {link.text}
67
- </Link>
68
- )}
69
-
70
- {dismissible && (
71
- <UIButton data-fs-alert-button aria-label="Close" onClick={handleClose}>
72
- <span>
73
- <Icon name="X" width={18} height={18} weight="bold" />
74
- </span>
75
- </UIButton>
76
- )}
77
- </UIAlert>
78
- )
79
- }
80
-
81
- export default Alert
@@ -1,93 +0,0 @@
1
- .fs-alert {
2
- // --------------------------------------------------------
3
- // Design Tokens for Toast
4
- // --------------------------------------------------------
5
-
6
- // Default properties
7
- --fs-alert-height : var(--fs-spacing-7);
8
- --fs-alert-padding-left : var(--fs-spacing-3);
9
- --fs-alert-padding-right : var(--fs-alert-padding-left);
10
-
11
- --fs-alert-bkg-color : var(--fs-color-highlighted-bkg);
12
-
13
- --fs-alert-text-color : var(--fs-color-highlighted-text);
14
- --fs-alert-text-size : var(--fs-text-size-1);
15
-
16
- // Link
17
- --fs-alert-link-color : var(--fs-alert-text-color);
18
- --fs-alert-link-color-visited : var(--fs-alert-text-color);
19
-
20
- // Button
21
- --fs-alert-button-text-color : var(--fs-alert-text-color);
22
- --fs-alert-button-bkg-color : var(--fs-alert-bkg-color);
23
- --fs-alert-button-border-radius : var(--fs-border-radius);
24
-
25
- // --------------------------------------------------------
26
- // Structural Styles
27
- // --------------------------------------------------------
28
-
29
- display: flex;
30
- align-items: center;
31
- height: var(--fs-alert-height);
32
- padding-right: var(--fs-alert-padding-right);
33
- padding-left: var(--fs-alert-padding-left);
34
- font-size: var(--fs-alert-text-size);
35
- color: var(--fs-alert-text-color);
36
- background-color: var(--fs-alert-bkg-color);
37
-
38
- [data-fs-icon] {
39
- padding-right: var(--fs-spacing-1);
40
- margin: 0;
41
- }
42
-
43
- [data-fs-alert-content] {
44
- overflow: hidden;
45
- text-overflow: ellipsis;
46
- white-space: nowrap;
47
- }
48
-
49
- span { font-weight: var(--fs-text-weight-bold); }
50
-
51
- [data-fs-alert-link] {
52
- min-width: 0;
53
- height: var(--fs-alert-height);
54
- padding: 0 var(--fs-spacing-1);
55
- overflow: hidden;
56
- font-weight: var(--fs-text-weight-bold);
57
- line-height: var(--fs-alert-height);
58
- color: var(--fs-alert-link-color);
59
- text-overflow: ellipsis;
60
- white-space: nowrap;
61
-
62
- &:visited { color: var(--fs-alert-link-color-visited); }
63
- }
64
-
65
- [data-fs-alert-button] {
66
- min-width: var(--fs-control-tap-size);
67
- height: 100%;
68
- padding: var(--fs-spacing-0);
69
- margin-left: auto;
70
- color: var(--fs-alert-button-text-color);
71
- background-color: var(--fs-alert-button-bkg-color);
72
-
73
- > span {
74
- display: flex;
75
- align-items: center;
76
- justify-content: center;
77
- width: 100%;
78
- height: 100%;
79
- background-color: var(--fs-alert-button-bkg-color);
80
- border-radius: var(--fs-alert-button-border-radius);
81
- }
82
-
83
- &:hover span { filter: brightness(0.95); }
84
- }
85
-
86
- // --------------------------------------------------------
87
- // Variants Styles
88
- // --------------------------------------------------------
89
-
90
- &[data-fs-alert-dismissible="true"] {
91
- padding-right: 0;
92
- }
93
- }
@@ -1 +0,0 @@
1
- export { default } from './Alert'
@@ -1,232 +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/Overview" />
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</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 TemplateWithIcon = (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 Item w/ Icon</span>
41
- </DropdownButton>
42
- <DropdownMenu {...args}>
43
- <DropdownItem icon={<Icon name="User" width={24} height={24} />}>
44
- My Account
45
- </DropdownItem>
46
- <DropdownItem icon={<Icon name="Calendar" width={24} height={24} />}>
47
- My Orders
48
- </DropdownItem>
49
- <DropdownItem icon={<Icon name="Gift" width={24} height={24} />}>
50
- Gifts
51
- </DropdownItem>
52
- </DropdownMenu>
53
- </Dropdown>
54
- )
55
-
56
- export const TemplateSmall = (args) => (
57
- <Dropdown>
58
- <DropdownButton
59
- className={style.fsButton}
60
- data-fs-button-variant="tertiary"
61
- >
62
- <Icon name="CaretDown" width="18" height="18" weight="bold" />
63
- <span>Dropdown Small</span>
64
- </DropdownButton>
65
- <DropdownMenu size="small">
66
- <DropdownItem>Dropdown Item 1</DropdownItem>
67
- <DropdownItem>Dropdown Item 2</DropdownItem>
68
- <DropdownItem>Dropdown Item 3</DropdownItem>
69
- </DropdownMenu>
70
- </Dropdown>
71
- )
72
-
73
- export const TemplateWithIconSmall = (args) => (
74
- <Dropdown>
75
- <DropdownButton
76
- className={style.fsButton}
77
- data-fs-button-variant="tertiary"
78
- >
79
- <Icon name="CaretDown" width="18" height="18" weight="bold" />
80
- <span>Dropdown Small Item w/ Icon</span>
81
- </DropdownButton>
82
- <DropdownMenu size="small">
83
- <DropdownItem
84
- icon={<Icon name="ArrowElbowDownRight" width={18} height={18} />}
85
- >
86
- Item 1
87
- </DropdownItem>
88
- <DropdownItem
89
- icon={<Icon name="ArrowElbowDownRight" width={18} height={18} />}
90
- >
91
- Item 2
92
- </DropdownItem>
93
- <DropdownItem
94
- icon={<Icon name="ArrowElbowDownRight" width={18} height={18} />}
95
- >
96
- Item 3
97
- </DropdownItem>
98
- </DropdownMenu>
99
- </Dropdown>
100
- )
101
-
102
- <header>
103
-
104
- # Dropdown
105
-
106
- Displays a set of actions/items to the user, usually used to show a menu of options.
107
-
108
- </header>
109
-
110
- ## Overview
111
-
112
- The `Dropdown` component uses [FastStore UI Dropdown](https://www.faststore.dev/reference/ui/molecules) as base.
113
-
114
- <!-- Dropdown documentation is currently missing on faststore.dev -->
115
-
116
- <Canvas>
117
- <Story name="overview-default">{Template.bind({})}</Story>
118
- <Story name="overview-default-icon">{TemplateWithIcon.bind({})}</Story>
119
- <Story name="overview-small">{TemplateSmall.bind({})}</Story>
120
- <Story name="overview-small-icon">{TemplateWithIconSmall.bind({})}</Story>
121
- </Canvas>
122
-
123
- ---
124
-
125
- ## Usage
126
-
127
- `import Dropdown, { DropdownButton, DropdownMenu, DropdownItem } from '../components/ui/Dropdown'`
128
-
129
- <Canvas>
130
- <Story name="default">{Template.bind({})}</Story>
131
- </Canvas>
132
-
133
- ---
134
-
135
- ## Compound Components
136
-
137
- <section className="sbdocs-section">
138
- <article>
139
- <div style={{ height: '225px' }}>
140
- <a href="?path=/docs/molecules-dropdown-dropdownmenu--default-story"><img src="https://vtexhelp.vtexassets.com/assets/docs/src/dropdown-menu-example___04945d62ffacf3021e59361ccf558430.png"/></a>
141
- </div>
142
- <article className="sbdocs-section-text">
143
- <h3>Dropdown Menu</h3>
144
- <p>
145
- Displays a set of actions/items to the user, usually used to show a menu of options.
146
- </p>
147
- </article>
148
-
149
- </article>
150
- <article>
151
- <div style={{ height: '225px' }}>
152
- <a href="?path=/docs/molecules-dropdown-dropdownitem--default-story"><img width="245px" src="https://vtexhelp.vtexassets.com/assets/docs/src/dropdown-item-example___30ebe9491ad7db1230ac9e3a7729d9be.png"/></a>
153
- </div>
154
- <article className="sbdocs-section-text">
155
- <h3>Dropdown Item</h3>
156
- <p>An item of a set of items on <code>DropdownMenu</code>.</p>
157
- </article>
158
- </article>
159
- </section>
160
-
161
- ---
162
-
163
- ## Accessibility
164
-
165
- ### Keyboard Interactions
166
-
167
- <section>
168
- <table className="sbdocs-table-free">
169
- <thead>
170
- <tr>
171
- <th>Key</th>
172
- <th>Description</th>
173
- </tr>
174
- </thead>
175
- <tbody>
176
- <tr>
177
- <td>
178
- <code>Enter</code>
179
- </td>
180
- <td>
181
- When focusing on <code>DropdownButton</code>, the Dropdown menu opens
182
- and focuses the first <code>DropdownItem</code>
183
- </td>
184
- </tr>
185
- <tr>
186
- <td>
187
- <code>ArrowDown</code>
188
- </td>
189
- <td>
190
- When focusing on an item, moves focus to the next{' '}
191
- <code>DropdownItem</code>
192
- </td>
193
- </tr>
194
- <tr>
195
- <td>
196
- <code>ArrowUp</code>
197
- </td>
198
- <td>
199
- When focusing on an item, moves focus to the previous{' '}
200
- <code>DropdownItem</code>
201
- </td>
202
- </tr>
203
- <tr>
204
- <td>
205
- <code>Escape</code>
206
- </td>
207
- <td>
208
- Closes <code>DropdownMenu</code> and moves focus to{' '}
209
- <code>DropdownButton</code>
210
- </td>
211
- </tr>
212
- <tr>
213
- <td>
214
- <code>Home</code>
215
- </td>
216
- <td>
217
- When <code>DropdownMenu</code> is open, move focus to the first{' '}
218
- <code>DropdownItem</code>
219
- </td>
220
- </tr>
221
- <tr>
222
- <td>
223
- <code>End</code>
224
- </td>
225
- <td>
226
- When <code>DropdownMenu</code> is open, move focus to the last{' '}
227
- <code>DropdownItem</code>
228
- </td>
229
- </tr>
230
- </tbody>
231
- </table>
232
- </section>
@@ -1,12 +0,0 @@
1
- import { Dropdown as UIDropdown } from '@faststore/ui'
2
- import type { DropdownProps } from '@faststore/ui'
3
-
4
- const Dropdown = ({ children, ...otherProps }: DropdownProps) => {
5
- return (
6
- <UIDropdown data-fs-dropdown {...otherProps}>
7
- {children}
8
- </UIDropdown>
9
- )
10
- }
11
-
12
- export default Dropdown
@@ -1,20 +0,0 @@
1
- import { DropdownButton as UIDropdownButton } from '@faststore/ui'
2
- import type { DropdownButtonProps } from '@faststore/ui'
3
-
4
- function DropdownButton({
5
- children,
6
- testId = 'store-dropdown-button',
7
- ...otherProps
8
- }: DropdownButtonProps) {
9
- return (
10
- <UIDropdownButton
11
- data-fs-dropdown-button
12
- data-testid={testId}
13
- {...otherProps}
14
- >
15
- {children}
16
- </UIDropdownButton>
17
- )
18
- }
19
-
20
- export default DropdownButton
@@ -1,139 +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/DropdownItem" component={DropdownItem} />
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 Item</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 TemplateWithIcon = (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 Item w/ Icon</span>
41
- </DropdownButton>
42
- <DropdownMenu {...args}>
43
- <DropdownItem icon={<Icon name="User" width={24} height={24} />}>
44
- My Account
45
- </DropdownItem>
46
- <DropdownItem icon={<Icon name="Calendar" width={24} height={24} />}>
47
- My Orders
48
- </DropdownItem>
49
- <DropdownItem icon={<Icon name="Gift" width={24} height={24} />}>
50
- Gifts
51
- </DropdownItem>
52
- </DropdownMenu>
53
- </Dropdown>
54
- )
55
-
56
- <header>
57
-
58
- # Dropdown Item
59
-
60
- An item of a set of items on `DropdownMenu`.
61
-
62
- </header>
63
-
64
- ## Overview
65
-
66
- The `DropdownItem` is part of [Dropdown](?path=/docs/molecules-dropdown-default--default-story) component.
67
-
68
- <Canvas>
69
- <Story name="overview-default">{Template.bind({})}</Story>
70
- <Story name="overview-icon">{TemplateWithIcon.bind({})}</Story>
71
- </Canvas>
72
-
73
- ---
74
-
75
- ## Usage
76
-
77
- `import Dropdown, { DropdownButton, DropdownMenu, DropdownItem } from '../components/ui/Dropdown'`
78
-
79
- <Canvas>
80
- <Story name="default">{Template.bind({})}</Story>
81
- </Canvas>
82
-
83
- <ArgsTable story="default" />
84
-
85
- <TokenTable>
86
- <TokenRow token="--fs-dropdown-item-min-height" value="2.375rem" />
87
- <TokenRow
88
- token="--fs-dropdown-item-padding"
89
- value="var(--fs-spacing-1) var(--fs-spacing-2) var(--fs-spacing-1) var(--fs-spacing-1)"
90
- />
91
- <TokenDivider />
92
- <TokenRow
93
- token="--fs-dropdown-item-text-size"
94
- value="var(--fs-text-size-base)"
95
- />
96
- <TokenRow
97
- token="--fs-dropdown-item-text-weight"
98
- value="var(--fs-text-weight-regular)"
99
- />
100
- <TokenDivider />
101
- <TokenRow
102
- token="--fs-dropdown-item-color"
103
- value="var(--fs-color-link)"
104
- isColor
105
- />
106
- <TokenRow
107
- token="--fs-dropdown-item-bkg-color"
108
- value="var(--fs-color-tertiary-bkg-light)"
109
- isColor
110
- />
111
- <TokenRow
112
- token="--fs-dropdown-item-bkg-color-hover"
113
- value="var(--fs-color-primary-bkg-light)"
114
- isColor
115
- />
116
- <TokenDivider />
117
- <TokenRow
118
- token="--fs-dropdown-item-border-bottom-color"
119
- value="var(--fs-border-color-light)"
120
- />
121
- </TokenTable>
122
-
123
- ---
124
-
125
- ## Nested Elements
126
-
127
- ### Dropdown Item with Icon
128
-
129
- <TokenTable>
130
- <TokenRow token="--fs-dropdown-item-icon-min-width" value="1.125rem" />
131
- <TokenRow
132
- token="--fs-dropdown-item-icon-margin-right"
133
- value="var(--fs-spacing-0)"
134
- />
135
- <TokenRow
136
- token="--fs-dropdown-item-icon-margin-top"
137
- value="calc(-1 * var(--fs-spacing-1))"
138
- />
139
- </TokenTable>
@@ -1,26 +0,0 @@
1
- import type { DropdownItemProps } from '@faststore/ui'
2
- import { DropdownItem as UIDropdownItem, Icon as UIIcon } from '@faststore/ui'
3
- import type { ReactNode } from 'react'
4
-
5
- export type Props = DropdownItemProps & {
6
- /**
7
- * Icon component for additional customization
8
- */
9
- icon?: ReactNode
10
- }
11
-
12
- function DropdownItem({
13
- children,
14
- icon,
15
- testId = 'store-dropdown-item',
16
- ...otherProps
17
- }: Props) {
18
- return (
19
- <UIDropdownItem data-fs-dropdown-item data-testid={testId} {...otherProps}>
20
- {icon && <UIIcon component={icon} data-fs-dropdown-item-icon />}
21
- {children}
22
- </UIDropdownItem>
23
- )
24
- }
25
-
26
- export default DropdownItem