@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.
- package/.storybook/storybook.css +1 -0
- package/.turbo/turbo-build.log +50 -0
- package/.turbo/turbo-lint.log +2 -0
- package/@generated/graphql/index.ts +27 -3
- package/@generated/graphql/persisted.json +1 -1
- package/CHANGELOG.md +127 -169
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +4 -4
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +9 -9
- package/package.json +9 -10
- package/src/Layout.tsx +7 -2
- package/src/components/cart/CartItem/CartItem.tsx +30 -71
- package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
- package/src/components/cart/CartSidebar/CartSidebar.tsx +13 -17
- package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
- package/src/components/common/Alert/Alert.tsx +6 -22
- package/src/components/common/Footer/Footer.stories.mdx +1 -1
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- package/src/components/common/Footer/FooterLinks.tsx +16 -12
- package/src/components/common/Footer/footer.module.scss +2 -28
- package/src/components/common/Footer/index.ts +1 -0
- package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.tsx +1 -1
- package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
- package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
- package/src/components/common/Toast/Toast.tsx +1 -1
- package/src/components/product/ProductCard/ProductCard.tsx +44 -59
- package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
- package/src/components/regionalization/Regionalization.stories.mdx +24 -6
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
- package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
- package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
- package/src/components/search/Filter/Facets.stories.mdx +10 -10
- package/src/components/search/Filter/Facets.tsx +69 -61
- package/src/components/search/Filter/Filter.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.tsx +1 -1
- package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
- package/src/components/search/Filter/FilterSlider.tsx +2 -2
- package/src/components/search/Filter/facets.module.scss +16 -16
- package/src/components/search/Search.stories.mdx +28 -24
- package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
- package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
- package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
- package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
- package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -4
- package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
- package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
- package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
- package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
- package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
- package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
- package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
- package/src/components/ui/Gift/Gift.tsx +18 -27
- package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
- package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
- package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
- package/src/components/ui/Tiles/tiles.module.scss +11 -13
- package/src/components/ui/Toast/Toast.stories.mdx +1 -1
- package/src/components/ui/Toast/Toast.tsx +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/sdk/cart/index.ts +5 -0
- package/src/sdk/cart/useBuyButton.ts +1 -1
- package/src/sdk/cart/useCartToggleButton.ts +1 -1
- package/src/styles/vendors/include-media.scss +1 -1
- package/tsconfig.json +4 -6
- package/.eslintrc.json +0 -3
- package/.github/CODEOWNERS +0 -2
- package/.github/workflows/release.yml +0 -42
- package/.release-it.json +0 -32
- package/src/components/cart/CartItem/cart-item.module.scss +0 -68
- package/src/components/product/ProductCard/product-card.module.scss +0 -254
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
- package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
- package/src/components/skeletons/Shimmer/index.ts +0 -1
- package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
- package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
- package/src/components/skeletons/Skeleton/index.ts +0 -1
- package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
- package/src/components/skeletons/Skeletons.stories.mdx +0 -177
- package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
- package/src/components/ui/Accordion/Accordion.tsx +0 -39
- package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
- package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
- package/src/components/ui/Accordion/accordion.module.scss +0 -65
- package/src/components/ui/Accordion/index.ts +0 -2
- package/src/components/ui/Alert/Alert.stories.mdx +0 -164
- package/src/components/ui/Alert/Alert.tsx +0 -81
- package/src/components/ui/Alert/alert.module.scss +0 -93
- package/src/components/ui/Alert/index.ts +0 -1
- package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
- package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
- package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
- package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
- package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
- package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
- package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
- package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
- package/src/components/ui/Dropdown/index.ts +0 -4
- package/src/components/ui/Gift/Gift.stories.mdx +0 -99
- package/src/components/ui/Gift/gift.module.scss +0 -94
- package/src/components/ui/Modal/Modal.stories.mdx +0 -144
- package/src/components/ui/Modal/Modal.tsx +0 -43
- package/src/components/ui/Modal/index.ts +0 -1
- package/src/components/ui/Modal/modal.module.scss +0 -46
- package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
- package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
- package/src/components/ui/PriceRange/index.ts +0 -1
- package/src/components/ui/PriceRange/price-range.module.scss +0 -176
- package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
- package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
- package/src/components/ui/ProductTitle/index.ts +0 -1
- package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
- package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
- package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
- package/src/components/ui/QuantitySelector/index.ts +0 -1
- package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
- package/src/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
|
@@ -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
|