@faststore/core 0.3.15 → 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.
- package/CHANGELOG.md +29 -0
- package/cypress/integration/analytics.test.js +3 -3
- package/cypress/integration/plp.test.js +1 -1
- package/package.json +4 -4
- package/src/Layout.tsx +6 -1
- package/src/components/cart/CartItem/CartItem.tsx +2 -2
- package/src/components/cart/CartSidebar/CartSidebar.tsx +5 -6
- 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/FooterLinks.tsx +16 -12
- package/src/components/search/Filter/Facets.stories.mdx +9 -9
- package/src/components/search/Filter/Facets.tsx +69 -61
- 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/ProducDetailsContent/ProductDetailsContent.tsx +147 -149
- package/src/components/sections/ProductDetails/ProductDetails.tsx +2 -2
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
- package/src/components/ui/Gift/Gift.tsx +7 -13
- package/src/components/ui/ShippingSimulation/ShippingSimulation.stories.mdx +0 -27
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +6 -13
- package/src/components/ui/ShippingSimulation/shipping-simulation.module.scss +0 -39
- package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
- package/tsconfig.json +1 -1
- package/src/components/sections/ProducDetailsContent/product-details-content.module.scss +0 -41
- 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/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/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
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import Alert from '.'
|
|
4
|
-
import Icon from '../Icon'
|
|
5
|
-
import {
|
|
6
|
-
TokenTable,
|
|
7
|
-
TokenRow,
|
|
8
|
-
TokenDivider,
|
|
9
|
-
BestPractices,
|
|
10
|
-
BestPracticesRule,
|
|
11
|
-
} from 'src/../.storybook/components'
|
|
12
|
-
|
|
13
|
-
<Meta
|
|
14
|
-
title="Molecules/Alert"
|
|
15
|
-
argTypes={{
|
|
16
|
-
icon: { control: { disable: true } },
|
|
17
|
-
}}
|
|
18
|
-
component={Alert}
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
export const Template = (args) => (
|
|
22
|
-
<Alert {...args}>Free shipping starts at $300</Alert>
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
<header>
|
|
26
|
-
|
|
27
|
-
# Alert
|
|
28
|
-
|
|
29
|
-
Alerts display short messages related to the behavior of a system, feature or page.
|
|
30
|
-
|
|
31
|
-
</header>
|
|
32
|
-
|
|
33
|
-
## Overview
|
|
34
|
-
|
|
35
|
-
The `Alert` component uses [FastStore UI Alert](https://www.faststore.dev/reference/ui/molecules/Alert) as base.
|
|
36
|
-
|
|
37
|
-
<Canvas isColumn>
|
|
38
|
-
<Story
|
|
39
|
-
name="overview-default"
|
|
40
|
-
args={{
|
|
41
|
-
icon: <Icon name="Truck" width={24} height={24} />,
|
|
42
|
-
link: { text: 'Buy now', to: '/' },
|
|
43
|
-
dismissible: true,
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
{Template.bind({})}
|
|
47
|
-
</Story>
|
|
48
|
-
<Story name="overview-clean">{Template.bind({})}</Story>
|
|
49
|
-
</Canvas>
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Usage
|
|
54
|
-
|
|
55
|
-
`import Alert from '../components/ui/Alert'`
|
|
56
|
-
|
|
57
|
-
<Canvas>
|
|
58
|
-
<Story
|
|
59
|
-
name="default"
|
|
60
|
-
args={{
|
|
61
|
-
icon: <Icon name="Truck" width={24} height={24} />,
|
|
62
|
-
link: { text: 'Buy now', to: '/' },
|
|
63
|
-
dismissible: true,
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
{Template.bind({})}
|
|
67
|
-
</Story>
|
|
68
|
-
</Canvas>
|
|
69
|
-
|
|
70
|
-
<ArgsTable story="default" />
|
|
71
|
-
|
|
72
|
-
<TokenTable>
|
|
73
|
-
<TokenRow token="--fs-alert-height" value="var(--fs-spacing-7)" />
|
|
74
|
-
<TokenRow token="--fs-alert-padding-left" value="var(--fs-spacing-3)" />
|
|
75
|
-
<TokenRow
|
|
76
|
-
token="--fs-alert-padding-right"
|
|
77
|
-
value="var(--fs-alert-padding-left)"
|
|
78
|
-
/>
|
|
79
|
-
<TokenDivider />
|
|
80
|
-
<TokenRow
|
|
81
|
-
token="--fs-alert-bkg-color"
|
|
82
|
-
value="var(--fs-color-highlighted-bkg)"
|
|
83
|
-
isColor
|
|
84
|
-
/>
|
|
85
|
-
<TokenDivider />
|
|
86
|
-
<TokenRow
|
|
87
|
-
token="--fs-alert-text-color"
|
|
88
|
-
value="var(--fs-color-highlighted-text)"
|
|
89
|
-
isColor
|
|
90
|
-
/>
|
|
91
|
-
<TokenRow token="--fs-alert-text-size" value="var(--fs-text-size-1)" />
|
|
92
|
-
</TokenTable>
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Nested Elements
|
|
97
|
-
|
|
98
|
-
### Link
|
|
99
|
-
|
|
100
|
-
<TokenTable>
|
|
101
|
-
<TokenRow
|
|
102
|
-
token="--fs-alert-link-color"
|
|
103
|
-
value="var(--fs-alert-text-color)"
|
|
104
|
-
globalValue="var(--fs-color-highlighted-text)"
|
|
105
|
-
isColor
|
|
106
|
-
/>
|
|
107
|
-
<TokenRow
|
|
108
|
-
token="--fs-alert-link-color-visited"
|
|
109
|
-
value="var(--fs-alert-text-color)"
|
|
110
|
-
globalValue="var(--fs-color-highlighted-text)"
|
|
111
|
-
isColor
|
|
112
|
-
/>
|
|
113
|
-
</TokenTable>
|
|
114
|
-
|
|
115
|
-
### Button
|
|
116
|
-
|
|
117
|
-
<TokenTable>
|
|
118
|
-
<TokenRow
|
|
119
|
-
token="--fs-alert-button-text-color"
|
|
120
|
-
value="var(--fs-alert-text-color)"
|
|
121
|
-
globalValue="var(--fs-color-highlighted-text)"
|
|
122
|
-
isColor
|
|
123
|
-
/>
|
|
124
|
-
<TokenRow
|
|
125
|
-
token="--fs-alert-button-bkg-color"
|
|
126
|
-
value="var(--fs-alert-bkg-color)"
|
|
127
|
-
globalValue="var(--fs-color-highlighted-bkg)"
|
|
128
|
-
isColor
|
|
129
|
-
/>
|
|
130
|
-
<TokenRow
|
|
131
|
-
token="--fs-alert-button-border-radius"
|
|
132
|
-
value="var(--fs-border-radius)"
|
|
133
|
-
/>
|
|
134
|
-
</TokenTable>
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
<BestPractices>
|
|
139
|
-
<BestPracticesRule
|
|
140
|
-
recommendedUsage={
|
|
141
|
-
<Alert
|
|
142
|
-
icon={<Icon name="ShieldCheck" width={24} height={24} />}
|
|
143
|
-
link={{ text: 'Buy Now', to: '/' }}
|
|
144
|
-
dismissible
|
|
145
|
-
>
|
|
146
|
-
Free shipping starts at $300
|
|
147
|
-
</Alert>
|
|
148
|
-
}
|
|
149
|
-
recommendedDescription="Write short messages to inform about the behavior of a system, feature, or page. Consider using 30 to 40 characters max."
|
|
150
|
-
discouragedUsage={
|
|
151
|
-
<Alert
|
|
152
|
-
icon={<Icon name="ShieldCheck" width={24} height={24} />}
|
|
153
|
-
link={{ text: 'Really long link to add here', to: '/' }}
|
|
154
|
-
dismissible
|
|
155
|
-
>
|
|
156
|
-
Alert with a veeeery long description lorem ipsum dolor sit amet,
|
|
157
|
-
consectetur adipiscing elit. Donec sollicitudin erat non felis feugiat
|
|
158
|
-
porta. Nam vitae turpis metus. Maecenas feugiat justo tristique libero
|
|
159
|
-
ultricies.
|
|
160
|
-
</Alert>
|
|
161
|
-
}
|
|
162
|
-
discouragedDescription="Don't use long texts. Important information can be lost."
|
|
163
|
-
/>
|
|
164
|
-
</BestPractices>
|
|
@@ -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
|