@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.
- package/CHANGELOG.md +22 -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 +146 -146
- 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/SkuSelector/sku-selector.module.scss +1 -1
- package/tsconfig.json +1 -1
- 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,222 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
import { List as UIList, LinkButton as UILinkButton } from '@faststore/ui'
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
|
|
5
|
-
import Accordion, { AccordionItem } from '.'
|
|
6
|
-
import Icon from '../Icon'
|
|
7
|
-
|
|
8
|
-
<Meta
|
|
9
|
-
component={Accordion}
|
|
10
|
-
title="Molecules/Accordion/Overview"
|
|
11
|
-
argTypes={{
|
|
12
|
-
expandedIndices: { control: { disable: true } },
|
|
13
|
-
}}
|
|
14
|
-
/>
|
|
15
|
-
|
|
16
|
-
export const values = Array.from({ length: 3 }).map((_, i) => `Item ${i + 1}`)
|
|
17
|
-
|
|
18
|
-
export const items = [
|
|
19
|
-
{
|
|
20
|
-
title: 'Title 1',
|
|
21
|
-
values: [...values],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
title: 'Title 2',
|
|
25
|
-
values: [...values],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
title: 'Title 3',
|
|
29
|
-
values: [...values],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
title: 'Title 4',
|
|
33
|
-
values: [...values],
|
|
34
|
-
},
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
export const Template = () => {
|
|
38
|
-
const [indices, setIndices] = useState([])
|
|
39
|
-
const onChange = (index) => {
|
|
40
|
-
setIndices([index])
|
|
41
|
-
}
|
|
42
|
-
return (
|
|
43
|
-
<Accordion expandedIndices={indices} onChange={onChange}>
|
|
44
|
-
{items.map((item, index) => (
|
|
45
|
-
<AccordionItem
|
|
46
|
-
key={item.title}
|
|
47
|
-
isExpanded={indices.includes(index)}
|
|
48
|
-
buttonLabel={item.title}
|
|
49
|
-
>
|
|
50
|
-
<UIList>
|
|
51
|
-
{item.values.map((label) => {
|
|
52
|
-
return <li key={label}>{label}</li>
|
|
53
|
-
})}
|
|
54
|
-
</UIList>
|
|
55
|
-
</AccordionItem>
|
|
56
|
-
))}
|
|
57
|
-
</Accordion>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const TemplateMultiple = () => {
|
|
62
|
-
const [indexes, setIndexes] = useState(new Set([]))
|
|
63
|
-
const onChange = (index) => {
|
|
64
|
-
if (indexes.has(index)) {
|
|
65
|
-
indexes.delete(index)
|
|
66
|
-
setIndexes(new Set(indexes))
|
|
67
|
-
} else {
|
|
68
|
-
setIndexes(new Set(indexes.add(index)))
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return (
|
|
72
|
-
<Accordion expandedIndices={indexes} onChange={onChange}>
|
|
73
|
-
{items.map((item, index) => (
|
|
74
|
-
<AccordionItem
|
|
75
|
-
key={item.title}
|
|
76
|
-
isExpanded={indexes.has(index)}
|
|
77
|
-
buttonLabel={item.title}
|
|
78
|
-
>
|
|
79
|
-
<UIList>
|
|
80
|
-
{item.values.map((name) => (
|
|
81
|
-
<li key={name}>{name}</li>
|
|
82
|
-
))}
|
|
83
|
-
</UIList>
|
|
84
|
-
</AccordionItem>
|
|
85
|
-
))}
|
|
86
|
-
</Accordion>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export const TemplateOneItem = () => {
|
|
91
|
-
const [indexes, setIndexes] = useState(new Set([0]))
|
|
92
|
-
const onChange = (index) => {
|
|
93
|
-
if (indexes.has(index)) {
|
|
94
|
-
indexes.delete(index)
|
|
95
|
-
setIndexes(new Set(indexes))
|
|
96
|
-
} else {
|
|
97
|
-
setIndexes(new Set(indexes.add(index)))
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return (
|
|
101
|
-
<Accordion expandedIndices={indexes} onChange={onChange}>
|
|
102
|
-
<AccordionItem isExpanded={indexes.has(0)} buttonLabel="Title 1">
|
|
103
|
-
<UIList>
|
|
104
|
-
{values.map((label) => {
|
|
105
|
-
return <li key={label}>{label}</li>
|
|
106
|
-
})}
|
|
107
|
-
</UIList>
|
|
108
|
-
</AccordionItem>
|
|
109
|
-
</Accordion>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
<header>
|
|
114
|
-
|
|
115
|
-
# Accordion
|
|
116
|
-
|
|
117
|
-
Accordion displays an expandable/collapsible list of items.
|
|
118
|
-
|
|
119
|
-
</header>
|
|
120
|
-
|
|
121
|
-
## Overview
|
|
122
|
-
|
|
123
|
-
The `Accordion` component uses [FastStore UI Accordion](https://www.faststore.dev/reference/ui/molecules/Accordion) as base.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Usage
|
|
128
|
-
|
|
129
|
-
`import Accordion, { AccordionItem } from 'src/components/ui/Accordion'`
|
|
130
|
-
|
|
131
|
-
<Canvas>
|
|
132
|
-
<Story name="default">{Template.bind({})}</Story>
|
|
133
|
-
</Canvas>
|
|
134
|
-
|
|
135
|
-
<ArgsTable story="default" />
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Variants
|
|
140
|
-
|
|
141
|
-
### Accordion Single Open
|
|
142
|
-
|
|
143
|
-
<Canvas>
|
|
144
|
-
<Story name="overview-default">{Template.bind({})}</Story>
|
|
145
|
-
</Canvas>
|
|
146
|
-
|
|
147
|
-
### Accordion Multiple Open
|
|
148
|
-
|
|
149
|
-
<Canvas>
|
|
150
|
-
<Story name="overview-multiple-expanded">{TemplateMultiple.bind({})}</Story>
|
|
151
|
-
</Canvas>
|
|
152
|
-
|
|
153
|
-
## Compound Components
|
|
154
|
-
|
|
155
|
-
<section className="sbdocs-list">
|
|
156
|
-
<ul className="sbdocs-ul-row">
|
|
157
|
-
<li>
|
|
158
|
-
<div>
|
|
159
|
-
<div style={{ width: '50%', height: '180px', paddingTop: '20px' }}>
|
|
160
|
-
<TemplateOneItem />
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
<article className="sbdocs-list-text">
|
|
164
|
-
<h3>Accordion Item</h3>
|
|
165
|
-
<p>
|
|
166
|
-
An item of the <code>Accordion</code> component.
|
|
167
|
-
</p>
|
|
168
|
-
<UILinkButton
|
|
169
|
-
size="small"
|
|
170
|
-
variant="tertiary"
|
|
171
|
-
href="../?path=/docs/molecules-accordion-accordionitem--default-story"
|
|
172
|
-
icon={<Icon name="ArrowRight" width="18" height="18" weight="bold" />}
|
|
173
|
-
iconPosition="right"
|
|
174
|
-
>
|
|
175
|
-
See more
|
|
176
|
-
</UILinkButton>
|
|
177
|
-
</article>
|
|
178
|
-
</li>
|
|
179
|
-
</ul>
|
|
180
|
-
</section>
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Use Cases
|
|
185
|
-
|
|
186
|
-
<section className="sbdocs-list">
|
|
187
|
-
<ul className="sbdocs-ul-row">
|
|
188
|
-
<li>
|
|
189
|
-
<article className="sbdocs-list-text">
|
|
190
|
-
<h3>ProductDetailsContent</h3>
|
|
191
|
-
<p>
|
|
192
|
-
Used by the <code>ProductDetailsContent</code> component to organize
|
|
193
|
-
product information in different sections.
|
|
194
|
-
</p>
|
|
195
|
-
<UILinkButton
|
|
196
|
-
size="small"
|
|
197
|
-
variant="tertiary"
|
|
198
|
-
href="../?path=/docs/organisms-productdetailscontent--default-story"
|
|
199
|
-
icon={<Icon name="ArrowRight" width="18" height="18" weight="bold" />}
|
|
200
|
-
iconPosition="right"
|
|
201
|
-
>
|
|
202
|
-
See more
|
|
203
|
-
</UILinkButton>
|
|
204
|
-
</article>
|
|
205
|
-
<article className="sbdocs-list-text">
|
|
206
|
-
<h3>Footer</h3>
|
|
207
|
-
<p>
|
|
208
|
-
Used by the <code>Footer</code> component on mobile devices.
|
|
209
|
-
</p>
|
|
210
|
-
<UILinkButton
|
|
211
|
-
size="small"
|
|
212
|
-
variant="tertiary"
|
|
213
|
-
href="../?path=/docs/organisms-footer--default-story"
|
|
214
|
-
icon={<Icon name="ArrowRight" width="18" height="18" weight="bold" />}
|
|
215
|
-
iconPosition="right"
|
|
216
|
-
>
|
|
217
|
-
See more
|
|
218
|
-
</UILinkButton>
|
|
219
|
-
</article>
|
|
220
|
-
</li>
|
|
221
|
-
</ul>
|
|
222
|
-
</section>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { AccordionProps } from '@faststore/ui'
|
|
2
|
-
import { Accordion as UIAccordion } from '@faststore/ui'
|
|
3
|
-
import { forwardRef } from 'react'
|
|
4
|
-
|
|
5
|
-
import styles from './accordion.module.scss'
|
|
6
|
-
|
|
7
|
-
interface Props extends Omit<AccordionProps, 'indices'> {
|
|
8
|
-
/**
|
|
9
|
-
* Indices that indicate which accordion items are opened.
|
|
10
|
-
*/
|
|
11
|
-
expandedIndices: Iterable<number>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const Accordion = forwardRef<HTMLDivElement, Props>(function Accordion(
|
|
15
|
-
{
|
|
16
|
-
expandedIndices,
|
|
17
|
-
onChange,
|
|
18
|
-
children,
|
|
19
|
-
testId = 'store-accordion',
|
|
20
|
-
...otherProps
|
|
21
|
-
},
|
|
22
|
-
ref
|
|
23
|
-
) {
|
|
24
|
-
return (
|
|
25
|
-
<UIAccordion
|
|
26
|
-
className={styles.fsAccordion}
|
|
27
|
-
data-fs-accordion
|
|
28
|
-
ref={ref}
|
|
29
|
-
onChange={onChange}
|
|
30
|
-
data-testid={testId}
|
|
31
|
-
indices={expandedIndices}
|
|
32
|
-
{...otherProps}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</UIAccordion>
|
|
36
|
-
)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
export default Accordion
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
import { List as UIList } from '@faststore/ui'
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
|
|
5
|
-
import Accordion, { AccordionItem } from '.'
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
AccordionButton as UIAccordionButton,
|
|
9
|
-
AccordionItem as UIAccordionItem,
|
|
10
|
-
AccordionPanel as UIAccordionPanel,
|
|
11
|
-
Icon as UIIcon,
|
|
12
|
-
} from '@faststore/ui'
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
TokenTable,
|
|
16
|
-
TokenRow,
|
|
17
|
-
TokenDivider,
|
|
18
|
-
} from 'src/../.storybook/components'
|
|
19
|
-
|
|
20
|
-
<Meta
|
|
21
|
-
title="Molecules/Accordion/AccordionItem"
|
|
22
|
-
component={AccordionItem}
|
|
23
|
-
argTypes={{
|
|
24
|
-
isExpanded: { control: 'boolean' },
|
|
25
|
-
buttonLabel: { defaultValue: 'Title 1' },
|
|
26
|
-
}}
|
|
27
|
-
/>
|
|
28
|
-
|
|
29
|
-
export const values = Array.from({ length: 5 }).map((_, i) => `Item ${i + 1}`)
|
|
30
|
-
|
|
31
|
-
export const Template = (args) => {
|
|
32
|
-
const [indexes, setIndexes] = useState(new Set([]))
|
|
33
|
-
const onChange = (index) => {
|
|
34
|
-
if (indexes.has(index)) {
|
|
35
|
-
indexes.delete(index)
|
|
36
|
-
setIndexes(new Set(indexes))
|
|
37
|
-
} else {
|
|
38
|
-
setIndexes(new Set(indexes.add(index)))
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return (
|
|
42
|
-
<Accordion expandedIndices={indexes} onChange={onChange}>
|
|
43
|
-
<AccordionItem {...args}>
|
|
44
|
-
<UIList>
|
|
45
|
-
{values.map((label) => {
|
|
46
|
-
return <li key={label}>{label}</li>
|
|
47
|
-
})}
|
|
48
|
-
</UIList>
|
|
49
|
-
</AccordionItem>
|
|
50
|
-
</Accordion>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
<header>
|
|
55
|
-
|
|
56
|
-
# Accordion Item
|
|
57
|
-
|
|
58
|
-
An item of a set of items on `Accordion`.
|
|
59
|
-
|
|
60
|
-
</header>
|
|
61
|
-
|
|
62
|
-
## Overview
|
|
63
|
-
|
|
64
|
-
The `AccordionItem` is part of [Accordion](?path=/docs/molecules-accordion-overview--default-story) component.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Usage
|
|
69
|
-
|
|
70
|
-
`import Accordion, { AccordionItem } from 'src/components/ui/Accordion'`
|
|
71
|
-
|
|
72
|
-
<Canvas>
|
|
73
|
-
<Story name="default">{Template.bind({})}</Story>
|
|
74
|
-
</Canvas>
|
|
75
|
-
|
|
76
|
-
<ArgsTable story="default" />
|
|
77
|
-
|
|
78
|
-
<TokenTable>
|
|
79
|
-
<TokenRow
|
|
80
|
-
token="--fs-accordion-item-border-bottom-width"
|
|
81
|
-
value="var(--fs-border-width)"
|
|
82
|
-
/>
|
|
83
|
-
<TokenRow
|
|
84
|
-
token="--fs-accordion-item-border-bottom-color"
|
|
85
|
-
value="var(--fs-border-color-light)"
|
|
86
|
-
isColor
|
|
87
|
-
/>
|
|
88
|
-
</TokenTable>
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Nested Elements
|
|
93
|
-
|
|
94
|
-
### Button
|
|
95
|
-
|
|
96
|
-
<TokenTable>
|
|
97
|
-
<TokenRow
|
|
98
|
-
token="--fs-accordion-item-button-padding"
|
|
99
|
-
value="var(--fs-spacing-3) 0"
|
|
100
|
-
/>
|
|
101
|
-
<TokenRow
|
|
102
|
-
token="--fs-accordion-item-button-color"
|
|
103
|
-
value="var(--fs-color-text)"
|
|
104
|
-
isColor
|
|
105
|
-
/>
|
|
106
|
-
<TokenRow token="--fs-accordion-item-button-bkg-color" value="transparent" />
|
|
107
|
-
</TokenTable>
|
|
108
|
-
|
|
109
|
-
### Panel
|
|
110
|
-
|
|
111
|
-
<TokenTable>
|
|
112
|
-
<TokenRow
|
|
113
|
-
token="--fs-accordion-item-panel-padding-bottom"
|
|
114
|
-
value="var(--fs-spacing-4)"
|
|
115
|
-
/>
|
|
116
|
-
</TokenTable>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { AccordionItemProps } from '@faststore/ui'
|
|
2
|
-
import {
|
|
3
|
-
AccordionButton as UIAccordionButton,
|
|
4
|
-
AccordionItem as UIAccordionItem,
|
|
5
|
-
AccordionPanel as UIAccordionPanel,
|
|
6
|
-
Icon as UIIcon,
|
|
7
|
-
} from '@faststore/ui'
|
|
8
|
-
import { forwardRef } from 'react'
|
|
9
|
-
import type { ReactNode } from 'react'
|
|
10
|
-
|
|
11
|
-
import Icon from 'src/components/ui/Icon'
|
|
12
|
-
|
|
13
|
-
type Props = Omit<AccordionItemProps<'article' | 'div'>, 'ref'> & {
|
|
14
|
-
/**
|
|
15
|
-
* Attribute to check whether the item is expanded or not.
|
|
16
|
-
*/
|
|
17
|
-
isExpanded: boolean
|
|
18
|
-
/**
|
|
19
|
-
* Label for Accordion button
|
|
20
|
-
*/
|
|
21
|
-
buttonLabel?: ReactNode
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const AccordionItem = forwardRef<HTMLDivElement, Props>(function AccordionItem(
|
|
25
|
-
{
|
|
26
|
-
children,
|
|
27
|
-
isExpanded,
|
|
28
|
-
index = 0,
|
|
29
|
-
buttonLabel = '',
|
|
30
|
-
testId = 'store-accordion-item',
|
|
31
|
-
as,
|
|
32
|
-
...otherProps
|
|
33
|
-
},
|
|
34
|
-
ref
|
|
35
|
-
) {
|
|
36
|
-
return (
|
|
37
|
-
<UIAccordionItem
|
|
38
|
-
ref={ref}
|
|
39
|
-
index={index}
|
|
40
|
-
data-testid={`${testId}-item`}
|
|
41
|
-
data-fs-accordion-item
|
|
42
|
-
as={as}
|
|
43
|
-
{...otherProps}
|
|
44
|
-
>
|
|
45
|
-
<UIAccordionButton
|
|
46
|
-
className="text__title-subsection"
|
|
47
|
-
data-fs-accordion-item-button
|
|
48
|
-
data-testid={`${testId}-button`}
|
|
49
|
-
>
|
|
50
|
-
{buttonLabel}
|
|
51
|
-
<UIIcon
|
|
52
|
-
data-testid={`${testId}-button-icon`}
|
|
53
|
-
data-fs-accordion-item-button-icon
|
|
54
|
-
component={
|
|
55
|
-
<>
|
|
56
|
-
<Icon
|
|
57
|
-
data-icon={isExpanded ? 'expanded' : true}
|
|
58
|
-
name="MinusCircle"
|
|
59
|
-
width={24}
|
|
60
|
-
height={24}
|
|
61
|
-
/>
|
|
62
|
-
<Icon
|
|
63
|
-
data-icon={isExpanded ? true : 'collapsed'}
|
|
64
|
-
name="PlusCircle"
|
|
65
|
-
width={24}
|
|
66
|
-
height={24}
|
|
67
|
-
/>
|
|
68
|
-
</>
|
|
69
|
-
}
|
|
70
|
-
/>
|
|
71
|
-
</UIAccordionButton>
|
|
72
|
-
<UIAccordionPanel
|
|
73
|
-
data-testid={`${testId}-panel`}
|
|
74
|
-
data-fs-accordion-item-panel
|
|
75
|
-
>
|
|
76
|
-
{children}
|
|
77
|
-
</UIAccordionPanel>
|
|
78
|
-
</UIAccordionItem>
|
|
79
|
-
)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
export default AccordionItem
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
@import "src/styles/scaffold";
|
|
2
|
-
|
|
3
|
-
.fs-accordion {
|
|
4
|
-
// --------------------------------------------------------
|
|
5
|
-
// Design Tokens for Accordion
|
|
6
|
-
// --------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
// Item
|
|
9
|
-
--fs-accordion-item-border-bottom-width : var(--fs-border-width);
|
|
10
|
-
--fs-accordion-item-border-bottom-color : var(--fs-border-color-light);
|
|
11
|
-
|
|
12
|
-
// Item Button
|
|
13
|
-
--fs-accordion-item-button-padding : var(--fs-spacing-3) 0;
|
|
14
|
-
--fs-accordion-item-button-color : var(--fs-color-text);
|
|
15
|
-
--fs-accordion-item-button-bkg-color : transparent;
|
|
16
|
-
|
|
17
|
-
// Item Panel
|
|
18
|
-
--fs-accordion-item-panel-padding-bottom : var(--fs-spacing-4);
|
|
19
|
-
|
|
20
|
-
// --------------------------------------------------------
|
|
21
|
-
// Structural Styles
|
|
22
|
-
// --------------------------------------------------------
|
|
23
|
-
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
justify-content: space-around;
|
|
27
|
-
|
|
28
|
-
[data-fs-accordion-item] {
|
|
29
|
-
border-bottom: var(--fs-accordion-item-border-bottom-width) solid var(--fs-accordion-item-border-bottom-color);
|
|
30
|
-
|
|
31
|
-
@include media(">=notebook") {
|
|
32
|
-
&:last-child {
|
|
33
|
-
border-bottom: 0;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[data-fs-accordion-item-button] {
|
|
39
|
-
display: inline-flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
width: 100%;
|
|
43
|
-
padding: var(--fs-accordion-item-button-padding);
|
|
44
|
-
color: var(--fs-accordion-item-button-color);
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
background-color: var(--fs-accordion-item-button-bkg-color);
|
|
47
|
-
border: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
[data-fs-accordion-item-button-icon] {
|
|
51
|
-
display: flex;
|
|
52
|
-
|
|
53
|
-
[data-icon] {
|
|
54
|
-
display: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[data-icon="expanded"], [data-icon="collapsed"] {
|
|
58
|
-
display: initial;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
[data-fs-accordion-item-panel] {
|
|
63
|
-
padding-bottom: var(--fs-accordion-item-panel-padding-bottom);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -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>
|