@faststore/ui 2.0.33-alpha.0 → 2.0.34-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/CHANGELOG.md +9 -0
- package/dist/components/molecules/Accordion/AccordionItem.d.ts +1 -7
- package/dist/components/molecules/Accordion/AccordionItem.js +1 -7
- package/dist/components/molecules/Accordion/AccordionItem.js.map +1 -1
- package/package.json +6 -19
- package/src/components/molecules/Accordion/AccordionItem.tsx +42 -42
- package/dist/components/atoms/Incentive/stories/assets/Icons.d.ts +0 -2
- package/dist/components/atoms/Incentive/stories/assets/Icons.js +0 -6
- package/dist/components/atoms/Incentive/stories/assets/Icons.js.map +0 -1
- package/dist/components/molecules/Dropdown/stories/assets/Caret.d.ts +0 -2
- package/dist/components/molecules/Dropdown/stories/assets/Caret.js +0 -4
- package/dist/components/molecules/Dropdown/stories/assets/Caret.js.map +0 -1
- package/dist/components/molecules/PaymentMethods/stories/assets/Icons.d.ts +0 -9
- package/dist/components/molecules/PaymentMethods/stories/assets/Icons.js +0 -26
- package/dist/components/molecules/PaymentMethods/stories/assets/Icons.js.map +0 -1
- package/dist/components/molecules/QuantitySelector/stories/assets/Icons.d.ts +0 -7
- package/dist/components/molecules/QuantitySelector/stories/assets/Icons.js +0 -11
- package/dist/components/molecules/QuantitySelector/stories/assets/Icons.js.map +0 -1
- package/dist/components/molecules/SearchInput/stories/assets/CustomIcon.d.ts +0 -3
- package/dist/components/molecules/SearchInput/stories/assets/CustomIcon.js +0 -7
- package/dist/components/molecules/SearchInput/stories/assets/CustomIcon.js.map +0 -1
- package/src/components/atoms/Badge/Badge.stories.mdx +0 -156
- package/src/components/atoms/Incentive/stories/Incentive.mdx +0 -24
- package/src/components/atoms/Incentive/stories/Incentive.stories.tsx +0 -26
- package/src/components/atoms/Incentive/stories/assets/Icons.tsx +0 -14
- package/src/components/atoms/Input/Input.stories.mdx +0 -34
- package/src/components/atoms/Label/Label.stories.mdx +0 -65
- package/src/components/atoms/Link/Link.stories.mdx +0 -134
- package/src/components/atoms/Popover/stories/Popover.mdx +0 -18
- package/src/components/atoms/Popover/stories/Popover.stories.tsx +0 -50
- package/src/components/atoms/Radio/Radio.stories.mdx +0 -101
- package/src/components/atoms/Skeleton/stories/Skeleton.mdx +0 -18
- package/src/components/atoms/Skeleton/stories/Skeleton.stories.tsx +0 -21
- package/src/components/atoms/Slider/stories/Slider.mdx +0 -29
- package/src/components/atoms/Slider/stories/Slider.stories.tsx +0 -32
- package/src/components/atoms/Spinner/stories/Spinner.mdx +0 -18
- package/src/components/atoms/Spinner/stories/Spinner.stories.tsx +0 -21
- package/src/components/atoms/TextArea/stories/TextArea.mdx +0 -22
- package/src/components/atoms/TextArea/stories/TextArea.stories.tsx +0 -49
- package/src/components/molecules/Accordion/stories/Accordion.mdx +0 -62
- package/src/components/molecules/Accordion/stories/Accordion.stories.tsx +0 -160
- package/src/components/molecules/AggregateRating/stories/AggregateRating.mdx +0 -33
- package/src/components/molecules/AggregateRating/stories/AggregateRating.stories.tsx +0 -111
- package/src/components/molecules/Alert/stories/Alert.mdx +0 -26
- package/src/components/molecules/Alert/stories/Alert.stories.tsx +0 -36
- package/src/components/molecules/Banner/stories/Banner.mdx +0 -63
- package/src/components/molecules/Banner/stories/Banner.stories.tsx +0 -66
- package/src/components/molecules/Breadcrumb/stories/Breadcrumb.mdx +0 -27
- package/src/components/molecules/Breadcrumb/stories/Breadcrumb.stories.tsx +0 -55
- package/src/components/molecules/Bullets/stories/Bullets.mdx +0 -25
- package/src/components/molecules/Bullets/stories/Bullets.stories.tsx +0 -64
- package/src/components/molecules/Card/stories/Card.mdx +0 -54
- package/src/components/molecules/Card/stories/Card.stories.tsx +0 -63
- package/src/components/molecules/Carousel/stories/Carousel.mdx +0 -35
- package/src/components/molecules/Carousel/stories/Carousel.stories.tsx +0 -56
- package/src/components/molecules/CartItem/stories/CartItem.mdx +0 -79
- package/src/components/molecules/CartItem/stories/CartItem.stories.tsx +0 -70
- package/src/components/molecules/CheckboxField/CheckboxField.stories.mdx +0 -38
- package/src/components/molecules/DiscountBadge/DiscountBadge.stories.mdx +0 -38
- package/src/components/molecules/Dropdown/stories/Dropdown.mdx +0 -63
- package/src/components/molecules/Dropdown/stories/Dropdown.stories.tsx +0 -94
- package/src/components/molecules/Dropdown/stories/assets/Caret.tsx +0 -19
- package/src/components/molecules/Form/stories/Form.mdx +0 -23
- package/src/components/molecules/Form/stories/Form.stories.tsx +0 -65
- package/src/components/molecules/Gift/stories/Gift.mdx +0 -40
- package/src/components/molecules/Gift/stories/Gift.stories.tsx +0 -66
- package/src/components/molecules/IconButton/IconButton.stories.mdx +0 -46
- package/src/components/molecules/InputField/InputField.stories.mdx +0 -116
- package/src/components/molecules/LoadingButton/stories/LoadingButton.mdx +0 -20
- package/src/components/molecules/LoadingButton/stories/LoadingButton.stories.tsx +0 -36
- package/src/components/molecules/Modal/stories/Modal.mdx +0 -18
- package/src/components/molecules/Modal/stories/Modal.stories.tsx +0 -45
- package/src/components/molecules/OrderSummary/stories/OrderSummary.mdx +0 -29
- package/src/components/molecules/OrderSummary/stories/OrderSummary.stories.tsx +0 -29
- package/src/components/molecules/PaymentMethods/stories/PaymentMethods.mdx +0 -19
- package/src/components/molecules/PaymentMethods/stories/PaymentMethods.stories.tsx +0 -41
- package/src/components/molecules/PaymentMethods/stories/assets/Icons.tsx +0 -89
- package/src/components/molecules/PriceRange/stories/PriceRange.mdx +0 -28
- package/src/components/molecules/PriceRange/stories/PriceRange.stories.tsx +0 -45
- package/src/components/molecules/ProductCard/stories/ProductCard.mdx +0 -55
- package/src/components/molecules/ProductCard/stories/ProductCard.stories.tsx +0 -60
- package/src/components/molecules/ProductTitle/stories/ProductTitle.mdx +0 -26
- package/src/components/molecules/ProductTitle/stories/ProductTitle.stories.tsx +0 -27
- package/src/components/molecules/QuantitySelector/stories/QuantitySelector.mdx +0 -26
- package/src/components/molecules/QuantitySelector/stories/QuantitySelector.stories.tsx +0 -77
- package/src/components/molecules/QuantitySelector/stories/assets/Icons.tsx +0 -52
- package/src/components/molecules/RadioField/RadioField.stories.mdx +0 -38
- package/src/components/molecules/RadioGroup/stories/RadioGroup.mdx +0 -39
- package/src/components/molecules/RadioGroup/stories/RadioGroup.stories.tsx +0 -108
- package/src/components/molecules/SearchInput/stories/SearchInput.mdx +0 -28
- package/src/components/molecules/SearchInput/stories/SearchInput.stories.tsx +0 -45
- package/src/components/molecules/SearchInput/stories/assets/CustomIcon.tsx +0 -22
- package/src/components/molecules/SkuSelector/stories/SkuSelector.mdx +0 -24
- package/src/components/molecules/SkuSelector/stories/SkuSelector.stories.tsx +0 -52
- package/src/components/molecules/Tag/Tag.stories.mdx +0 -31
- package/src/components/organisms/OutOfStock/stories/OutOfStock.mdx +0 -37
- package/src/components/organisms/OutOfStock/stories/OutOfStock.stories.tsx +0 -71
- package/src/components/organisms/Tiles/stories/Tiles.mdx +0 -39
- package/src/components/organisms/Tiles/stories/Tiles.stories.tsx +0 -38
- package/src/typings/utils.d.ts +0 -5
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@storybook/react'
|
|
2
|
-
import React, { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import Accordion from '../Accordion'
|
|
5
|
-
import AccordionItem from '../AccordionItem'
|
|
6
|
-
import AccordionButton from '../AccordionButton'
|
|
7
|
-
import AccordionPanel from '../AccordionPanel'
|
|
8
|
-
import type { AccordionProps } from '..'
|
|
9
|
-
import mdx from './Accordion.mdx'
|
|
10
|
-
import { Icon } from '../../../../'
|
|
11
|
-
|
|
12
|
-
const Caret = () => (
|
|
13
|
-
<svg
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
width="24"
|
|
16
|
-
height="24"
|
|
17
|
-
viewBox="0 0 24 24"
|
|
18
|
-
fill="none"
|
|
19
|
-
stroke="currentColor"
|
|
20
|
-
strokeWidth="2"
|
|
21
|
-
strokeLinecap="round"
|
|
22
|
-
strokeLinejoin="round"
|
|
23
|
-
className="feather feather-chevron-down"
|
|
24
|
-
>
|
|
25
|
-
<polyline points="6 9 12 15 18 9" />
|
|
26
|
-
</svg>
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
const AccordionTemplate: Story<AccordionProps> = ({ testId }) => {
|
|
30
|
-
const [indices, setIndices] = useState<Set<number>>(new Set([]))
|
|
31
|
-
const onChange = (index: number) => {
|
|
32
|
-
if (indices.has(index)) {
|
|
33
|
-
indices.delete(index)
|
|
34
|
-
setIndices(new Set(indices))
|
|
35
|
-
} else {
|
|
36
|
-
setIndices(new Set(indices.add(index)))
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Accordion testId={testId} indices={indices} onChange={onChange}>
|
|
42
|
-
<AccordionItem>
|
|
43
|
-
<AccordionButton>Clothing</AccordionButton>
|
|
44
|
-
<AccordionPanel>
|
|
45
|
-
<ul>
|
|
46
|
-
<li>
|
|
47
|
-
<a href="/">Shorts</a>
|
|
48
|
-
</li>
|
|
49
|
-
<li>
|
|
50
|
-
<a href="/">Sweatshirt</a>
|
|
51
|
-
</li>
|
|
52
|
-
<li>
|
|
53
|
-
<a href="/">Tank tops</a>
|
|
54
|
-
</li>
|
|
55
|
-
</ul>
|
|
56
|
-
</AccordionPanel>
|
|
57
|
-
</AccordionItem>
|
|
58
|
-
<AccordionItem>
|
|
59
|
-
<AccordionButton>Bags</AccordionButton>
|
|
60
|
-
<AccordionPanel>
|
|
61
|
-
<ul>
|
|
62
|
-
<li>
|
|
63
|
-
<a href="/">Backpacks</a>
|
|
64
|
-
</li>
|
|
65
|
-
<li>
|
|
66
|
-
<a href="/">Necessaire</a>
|
|
67
|
-
</li>
|
|
68
|
-
</ul>
|
|
69
|
-
</AccordionPanel>
|
|
70
|
-
</AccordionItem>
|
|
71
|
-
<AccordionItem>
|
|
72
|
-
<AccordionButton>Sale</AccordionButton>
|
|
73
|
-
<AccordionPanel>
|
|
74
|
-
<ul>
|
|
75
|
-
<li>
|
|
76
|
-
<a href="/">Smartphones</a>
|
|
77
|
-
</li>
|
|
78
|
-
<li>
|
|
79
|
-
<a href="/">TVs</a>
|
|
80
|
-
</li>
|
|
81
|
-
</ul>
|
|
82
|
-
</AccordionPanel>
|
|
83
|
-
</AccordionItem>
|
|
84
|
-
</Accordion>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export const MultipleAndCollapsible = AccordionTemplate.bind({})
|
|
89
|
-
|
|
90
|
-
const ToggleWithIconTemplate: Story<AccordionProps> = ({ testId }) => {
|
|
91
|
-
const [indices, setIndices] = useState<number[]>([0])
|
|
92
|
-
const onChange = (index: number) => {
|
|
93
|
-
setIndices([index])
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<Accordion testId={testId} indices={indices} onChange={onChange}>
|
|
98
|
-
<AccordionItem>
|
|
99
|
-
<AccordionButton>
|
|
100
|
-
Clothing <Icon component={<Caret />} />
|
|
101
|
-
</AccordionButton>
|
|
102
|
-
<AccordionPanel>
|
|
103
|
-
<ul>
|
|
104
|
-
<li>
|
|
105
|
-
<a href="/">Shorts</a>
|
|
106
|
-
</li>
|
|
107
|
-
<li>
|
|
108
|
-
<a href="/">Sweatshirt</a>
|
|
109
|
-
</li>
|
|
110
|
-
<li>
|
|
111
|
-
<a href="/">Tank tops</a>
|
|
112
|
-
</li>
|
|
113
|
-
</ul>
|
|
114
|
-
</AccordionPanel>
|
|
115
|
-
</AccordionItem>
|
|
116
|
-
<AccordionItem>
|
|
117
|
-
<AccordionButton>
|
|
118
|
-
Bags <Icon component={<Caret />} />
|
|
119
|
-
</AccordionButton>
|
|
120
|
-
<AccordionPanel>
|
|
121
|
-
<ul>
|
|
122
|
-
<li>
|
|
123
|
-
<a href="/">Backpacks</a>
|
|
124
|
-
</li>
|
|
125
|
-
<li>
|
|
126
|
-
<a href="/">Necessaire</a>
|
|
127
|
-
</li>
|
|
128
|
-
</ul>
|
|
129
|
-
</AccordionPanel>
|
|
130
|
-
</AccordionItem>
|
|
131
|
-
<AccordionItem>
|
|
132
|
-
<AccordionButton>
|
|
133
|
-
Sale <Icon component={<Caret />} />
|
|
134
|
-
</AccordionButton>
|
|
135
|
-
<AccordionPanel>
|
|
136
|
-
<ul>
|
|
137
|
-
<li>
|
|
138
|
-
<a href="/">Smartphones</a>
|
|
139
|
-
</li>
|
|
140
|
-
<li>
|
|
141
|
-
<a href="/">TVs</a>
|
|
142
|
-
</li>
|
|
143
|
-
</ul>
|
|
144
|
-
</AccordionPanel>
|
|
145
|
-
</AccordionItem>
|
|
146
|
-
</Accordion>
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export const ToggleWithIcon = ToggleWithIconTemplate.bind({})
|
|
151
|
-
|
|
152
|
-
export default {
|
|
153
|
-
title: 'Molecules/Accordion',
|
|
154
|
-
component: MultipleAndCollapsible,
|
|
155
|
-
parameters: {
|
|
156
|
-
docs: {
|
|
157
|
-
page: mdx,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import AggregateRating from '../AggregateRating'
|
|
4
|
-
|
|
5
|
-
# Default Aggregate Rating
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-aggregaterating--aggregate-rating" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
# Aggregate Rating Without Icon
|
|
12
|
-
|
|
13
|
-
<Canvas>
|
|
14
|
-
<Story id="molecules-aggregaterating--aggregate-rating-without-icon" />
|
|
15
|
-
</Canvas>
|
|
16
|
-
|
|
17
|
-
# Aggregate Rating With CSS
|
|
18
|
-
|
|
19
|
-
<Canvas>
|
|
20
|
-
<Story id="molecules-aggregaterating--aggregate-rating-with-css" />
|
|
21
|
-
</Canvas>
|
|
22
|
-
|
|
23
|
-
## Props
|
|
24
|
-
|
|
25
|
-
<ArgsTable of={AggregateRating} />
|
|
26
|
-
|
|
27
|
-
## CSS Selectors
|
|
28
|
-
|
|
29
|
-
```css
|
|
30
|
-
[data-fs-aggregate-rating] {}
|
|
31
|
-
|
|
32
|
-
[data-aggregate-rating-item=(full|partial|empty)] {}
|
|
33
|
-
```
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@storybook/react'
|
|
2
|
-
import type { FC } from 'react'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import type { ComponentArgTypes } from '../../../../typings/utils'
|
|
6
|
-
import type { AggregateRatingProps, RatingItemProps } from '../AggregateRating'
|
|
7
|
-
import Component from '../AggregateRating'
|
|
8
|
-
import mdx from './AggregateRating.mdx'
|
|
9
|
-
|
|
10
|
-
const RatingIcon: FC<RatingItemProps> = (props) => {
|
|
11
|
-
const fillColor = {
|
|
12
|
-
empty: 'transparent',
|
|
13
|
-
partial: 'url(#partial)',
|
|
14
|
-
full: '#ffb100',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<svg
|
|
19
|
-
version="1.1"
|
|
20
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
-
viewBox="0 0 32 32"
|
|
22
|
-
{...props}
|
|
23
|
-
>
|
|
24
|
-
<defs>
|
|
25
|
-
<linearGradient id="partial">
|
|
26
|
-
<stop offset="50%" stopColor="#ffb100" />
|
|
27
|
-
<stop offset="50%" stopColor="transparent" stopOpacity="1" />
|
|
28
|
-
</linearGradient>
|
|
29
|
-
</defs>
|
|
30
|
-
<path
|
|
31
|
-
d="M20.388,10.918L32,12.118l-8.735,7.749L25.914,
|
|
32
|
-
31.4l-9.893-6.088L6.127,31.4l2.695-11.533L0,
|
|
33
|
-
12.118l11.547-1.2L16.026,0.6L20.388,10.918z"
|
|
34
|
-
fill={fillColor[props['data-fs-aggregate-rating-item']!]}
|
|
35
|
-
strokeWidth="2"
|
|
36
|
-
stroke="#ffb100"
|
|
37
|
-
/>
|
|
38
|
-
</svg>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const AggregateRatingTemplate: Story<AggregateRatingProps> = ({
|
|
43
|
-
value,
|
|
44
|
-
testId,
|
|
45
|
-
}) => {
|
|
46
|
-
return (
|
|
47
|
-
<Component value={value} testId={testId}>
|
|
48
|
-
<RatingIcon />
|
|
49
|
-
<RatingIcon />
|
|
50
|
-
<RatingIcon />
|
|
51
|
-
<RatingIcon />
|
|
52
|
-
<RatingIcon />
|
|
53
|
-
</Component>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const AggregateRating = AggregateRatingTemplate.bind({})
|
|
58
|
-
AggregateRating.args = { value: 3 }
|
|
59
|
-
|
|
60
|
-
const AggregateRatingWithoutIconTemplate: Story<AggregateRatingProps> = ({
|
|
61
|
-
value,
|
|
62
|
-
testId,
|
|
63
|
-
}) => {
|
|
64
|
-
return (
|
|
65
|
-
<Component value={value} testId={testId}>
|
|
66
|
-
{Array.from({ length: 5 }).map((_, index) => {
|
|
67
|
-
const isFullRating = value - index >= 1
|
|
68
|
-
|
|
69
|
-
return isFullRating ? '★' : '☆'
|
|
70
|
-
})}
|
|
71
|
-
</Component>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export const AggregateRatingWithoutIcon =
|
|
76
|
-
AggregateRatingWithoutIconTemplate.bind({})
|
|
77
|
-
AggregateRatingWithoutIcon.args = { value: 3 }
|
|
78
|
-
|
|
79
|
-
const AggregateRatingWithCSSTemplate: Story<AggregateRatingProps> = ({
|
|
80
|
-
value,
|
|
81
|
-
testId,
|
|
82
|
-
}) => {
|
|
83
|
-
return (
|
|
84
|
-
<Component data-with-css value={value} testId={testId}>
|
|
85
|
-
<span />
|
|
86
|
-
<span />
|
|
87
|
-
<span />
|
|
88
|
-
<span />
|
|
89
|
-
<span />
|
|
90
|
-
</Component>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const AggregateRatingWithCSS = AggregateRatingWithCSSTemplate.bind({})
|
|
95
|
-
AggregateRatingWithCSS.args = { value: 2 }
|
|
96
|
-
|
|
97
|
-
const argTypes: ComponentArgTypes<AggregateRatingProps> = {
|
|
98
|
-
value: {
|
|
99
|
-
control: { type: 'number' },
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export default {
|
|
104
|
-
title: 'Molecules/AggregateRating',
|
|
105
|
-
argTypes,
|
|
106
|
-
parameters: {
|
|
107
|
-
docs: {
|
|
108
|
-
page: mdx,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import Alert from '../Alert'
|
|
4
|
-
|
|
5
|
-
# Alert
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-alert--alert" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
# Alert With Icon
|
|
12
|
-
|
|
13
|
-
<Canvas>
|
|
14
|
-
<Story id="molecules-alert--alert-with-icon" />
|
|
15
|
-
</Canvas>
|
|
16
|
-
|
|
17
|
-
## Props
|
|
18
|
-
|
|
19
|
-
<ArgsTable of={Alert} />
|
|
20
|
-
|
|
21
|
-
## CSS Selectors
|
|
22
|
-
|
|
23
|
-
```css
|
|
24
|
-
[data-fs-alert] {
|
|
25
|
-
}
|
|
26
|
-
```
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Meta, Story } from '@storybook/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { AlertProps } from '../Alert'
|
|
5
|
-
import Component from '../Alert'
|
|
6
|
-
import { ShoppingCart } from '@faststore/components'
|
|
7
|
-
import mdx from './Alert.mdx'
|
|
8
|
-
import { Icon } from '../../../../'
|
|
9
|
-
|
|
10
|
-
const AlertTemplate: Story<AlertProps> = ({ children }) => (
|
|
11
|
-
<Component>{children}</Component>
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
export const Alert = AlertTemplate.bind({})
|
|
15
|
-
Alert.args = {
|
|
16
|
-
children: 'Alert',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const AlertWithIcon = AlertTemplate.bind({})
|
|
20
|
-
AlertWithIcon.args = {
|
|
21
|
-
children: (
|
|
22
|
-
<>
|
|
23
|
-
<Icon component={<ShoppingCart />} />
|
|
24
|
-
<span>Alert</span>
|
|
25
|
-
</>
|
|
26
|
-
),
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
title: 'Molecules/Alert',
|
|
31
|
-
parameters: {
|
|
32
|
-
docs: {
|
|
33
|
-
page: mdx,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
} as Meta
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import Banner from '../Banner'
|
|
4
|
-
import BannerImage from '../BannerImage'
|
|
5
|
-
import BannerContent from '../BannerContent'
|
|
6
|
-
import BannerLink from '../BannerLink'
|
|
7
|
-
|
|
8
|
-
# Banner
|
|
9
|
-
|
|
10
|
-
<Canvas>
|
|
11
|
-
<Story id="molecules-banner--banner" />
|
|
12
|
-
</Canvas>
|
|
13
|
-
|
|
14
|
-
## Components
|
|
15
|
-
|
|
16
|
-
The `Banner` uses the [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) pattern, its components are:
|
|
17
|
-
|
|
18
|
-
- `Banner`: the wrapper component, it can receive a `variant` prop to set its direction, supports `"vertical"` and `"horizontal"` values.
|
|
19
|
-
- `BannerImage`: the component that wraps the image displayed in the component.
|
|
20
|
-
- `BannerContent`: the component that can receive a title, description, and a `BannerLink`.
|
|
21
|
-
- `BannerLink`: the banner's call-to-action link.
|
|
22
|
-
|
|
23
|
-
## Props
|
|
24
|
-
|
|
25
|
-
All banner-related components support all attributes also supported by the `<div>` tag.
|
|
26
|
-
|
|
27
|
-
Besides those attributes, the following props are also supported:
|
|
28
|
-
|
|
29
|
-
### `Banner`
|
|
30
|
-
|
|
31
|
-
<ArgsTable of={Banner} />
|
|
32
|
-
|
|
33
|
-
### `BannerImage`
|
|
34
|
-
|
|
35
|
-
<ArgsTable of={BannerImage} />
|
|
36
|
-
|
|
37
|
-
### `BannerContent`
|
|
38
|
-
|
|
39
|
-
<ArgsTable of={BannerContent} />
|
|
40
|
-
|
|
41
|
-
### `BannerLink`
|
|
42
|
-
|
|
43
|
-
<ArgsTable of={BannerLink} />
|
|
44
|
-
|
|
45
|
-
## Guidelines
|
|
46
|
-
|
|
47
|
-
- Don’t hide important information in an image. If there is some important information, add it as text instead. For more information, see [Images Concepts • Images • WAI Web Accessibility Tutorials](https://www.w3.org/WAI/tutorials/images/)
|
|
48
|
-
- Use understandable links (avoid generic meaning, i.e., click here). For more information, see [Link Purpose](https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-in-context.html)
|
|
49
|
-
|
|
50
|
-
## CSS Selectors
|
|
51
|
-
|
|
52
|
-
```css
|
|
53
|
-
[data-fs-banner] {
|
|
54
|
-
}
|
|
55
|
-
[data-fs-banner='(vertical|horizontal)'] {
|
|
56
|
-
}
|
|
57
|
-
[data-banner-image] {
|
|
58
|
-
}
|
|
59
|
-
[data-banner-content] {
|
|
60
|
-
}
|
|
61
|
-
[data-banner-link] {
|
|
62
|
-
}
|
|
63
|
-
```
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Story, Meta } from '@storybook/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import BannerComponent from '../Banner'
|
|
5
|
-
import BannerImage from '../BannerImage'
|
|
6
|
-
import BannerContent from '../BannerContent'
|
|
7
|
-
import BannerLink from '../BannerLink'
|
|
8
|
-
import type { BannerProps } from '../Banner'
|
|
9
|
-
import { Icon } from '../../../../'
|
|
10
|
-
import mdx from './Banner.mdx'
|
|
11
|
-
|
|
12
|
-
const RightArrow = () => (
|
|
13
|
-
<svg
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
width="18"
|
|
16
|
-
height="18"
|
|
17
|
-
viewBox="0 0 18 18"
|
|
18
|
-
>
|
|
19
|
-
<path
|
|
20
|
-
d="M10.6553 3.40717C10.3624 3.11428 9.88756 3.11428 9.59467 3.40717C9.30178 3.70006 9.30178 4.17494 9.59467 4.46783L13.3768 8.25H2.8125C2.39829 8.25 2.0625 8.58579 2.0625 9C2.0625 9.41421 2.39829 9.75 2.8125 9.75H13.3768L9.59467 13.5322C9.30178 13.8251 9.30178 14.2999 9.59467 14.5928C9.88756 14.8857 10.3624 14.8857 10.6553 14.5928L15.7178 9.53033C15.8643 9.38388 15.9375 9.19194 15.9375 9C15.9375 8.89831 15.9173 8.80134 15.8806 8.71291C15.844 8.62445 15.7897 8.54158 15.7178 8.46967L10.6553 3.40717Z"
|
|
21
|
-
fill="currentColor"
|
|
22
|
-
/>
|
|
23
|
-
</svg>
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
const BannerTemplate: Story<BannerProps> = ({ testId, variant }) => (
|
|
27
|
-
<BannerComponent testId={testId} variant={variant}>
|
|
28
|
-
<BannerImage>
|
|
29
|
-
<img
|
|
30
|
-
alt="A person with hands on the pocket, carrying a round straw bag"
|
|
31
|
-
src="https://storecomponents.vtex.app/assets/fit-in/1280x613/center/middle/https%3A%2F%2Fstorecomponents.vtexassets.com%2Fassets%2Fvtex.file-manager-graphql%2Fimages%2Fedce348c-068c-4fb9-91f2-7d235d596e0f___b2822f893b14f87337d08f07f0e520ab.jpg"
|
|
32
|
-
/>
|
|
33
|
-
</BannerImage>
|
|
34
|
-
<BannerContent>
|
|
35
|
-
<div>
|
|
36
|
-
<h3>Get to know our new release</h3>
|
|
37
|
-
<p>Your one-stop shop for making this summer season the best of all.</p>
|
|
38
|
-
</div>
|
|
39
|
-
<BannerLink>
|
|
40
|
-
<a href="/">
|
|
41
|
-
Shop now <Icon component={<RightArrow />} />
|
|
42
|
-
</a>
|
|
43
|
-
</BannerLink>
|
|
44
|
-
</BannerContent>
|
|
45
|
-
</BannerComponent>
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
export const Banner = BannerTemplate.bind({})
|
|
49
|
-
Banner.storyName = 'Banner'
|
|
50
|
-
|
|
51
|
-
const argTypes = {
|
|
52
|
-
variant: {
|
|
53
|
-
options: ['vertical', 'horizontal'],
|
|
54
|
-
control: { type: 'select' },
|
|
55
|
-
},
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default {
|
|
59
|
-
title: 'Molecules/Banner',
|
|
60
|
-
argTypes,
|
|
61
|
-
parameters: {
|
|
62
|
-
docs: {
|
|
63
|
-
page: mdx,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
} as Meta
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import Breadcrumb from '../Breadcrumb'
|
|
4
|
-
|
|
5
|
-
# Bullets
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-breadcrumb--breadcrumb" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
## Props
|
|
12
|
-
|
|
13
|
-
<ArgsTable of={Breadcrumb} />
|
|
14
|
-
|
|
15
|
-
## CSS Selectors
|
|
16
|
-
|
|
17
|
-
```css
|
|
18
|
-
[data-fs-breadcrumb] {}
|
|
19
|
-
|
|
20
|
-
[data-breadcrumb-list] {}
|
|
21
|
-
|
|
22
|
-
[data-breadcrumb-list-item] {}
|
|
23
|
-
|
|
24
|
-
[data-breadcrumb-item='(current|true)'] {}
|
|
25
|
-
|
|
26
|
-
[data-breadcrumb-divider] {}
|
|
27
|
-
```
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@storybook/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { ComponentArgTypes } from '../../../../typings/utils'
|
|
5
|
-
import type { BreadcrumbProps } from '../Breadcrumb'
|
|
6
|
-
import Component from '../Breadcrumb'
|
|
7
|
-
import mdx from './Breadcrumb.mdx'
|
|
8
|
-
|
|
9
|
-
const DefaultDividerIcon = (props: any) => (
|
|
10
|
-
<svg width="24" height="24" viewBox="0 0 180 180" {...props}>
|
|
11
|
-
<path d="M51.707,185.343c-2.741,0-5.493-1.044-7.593-3.149c-4.194-4.194-4.194-10.981,0-15.175 l74.352-74.347L44.114,18.32c-4.194-4.194-4.194-10.987,0-15.175c4.194-4.194,10.987-4.194,15.18,0l81.934,81.934 c4.194,4.194,4.194,10.987,0,15.175l-81.934,81.939C57.201,184.293,54.454,185.343,51.707,185.343z" />
|
|
12
|
-
</svg>
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
const BreadcrumbTemplate: Story<BreadcrumbProps> = ({ divider, testId }) => {
|
|
16
|
-
return (
|
|
17
|
-
<Component divider={divider} testId={testId}>
|
|
18
|
-
<a href="/?path=/story/molecules-breadcrumb--breadcrumb-with-icon">
|
|
19
|
-
Home
|
|
20
|
-
</a>
|
|
21
|
-
<a href="/?path=/story/molecules-breadcrumb--breadcrumb-with-icon">
|
|
22
|
-
Level 1
|
|
23
|
-
</a>
|
|
24
|
-
<a href="/?path=/story/molecules-breadcrumb--breadcrumb-with-icon">
|
|
25
|
-
Level 2
|
|
26
|
-
</a>
|
|
27
|
-
<a href="/?path=/story/molecules-breadcrumb--breadcrumb-with-icon">
|
|
28
|
-
Level 3
|
|
29
|
-
</a>
|
|
30
|
-
</Component>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const Breadcrumb = BreadcrumbTemplate.bind({})
|
|
35
|
-
Breadcrumb.args = { divider: '/' }
|
|
36
|
-
export const BreadcrumbWithIcon = BreadcrumbTemplate.bind({})
|
|
37
|
-
BreadcrumbWithIcon.args = {
|
|
38
|
-
divider: <DefaultDividerIcon />,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const argTypes: ComponentArgTypes<BreadcrumbProps> = {
|
|
42
|
-
divider: {
|
|
43
|
-
control: { type: 'text' },
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default {
|
|
48
|
-
title: 'Molecules/Breadcrumb',
|
|
49
|
-
argTypes,
|
|
50
|
-
parameters: {
|
|
51
|
-
docs: {
|
|
52
|
-
page: mdx,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import Bullets from '../Bullets'
|
|
4
|
-
|
|
5
|
-
# Bullets
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-bullets--bullets" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
## Props
|
|
12
|
-
|
|
13
|
-
<ArgsTable of={Bullets} />
|
|
14
|
-
|
|
15
|
-
## CSS Selectors
|
|
16
|
-
|
|
17
|
-
```css
|
|
18
|
-
[data-fs-bullets] {}
|
|
19
|
-
|
|
20
|
-
[data-fs-bullet] {}
|
|
21
|
-
|
|
22
|
-
[data-fs-bullet][aria-selected="true"] {}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
This component inherits [Button](?path=/docs/atoms-button--button#css-selectors) css selectors.
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@storybook/react'
|
|
2
|
-
import React, { useEffect, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import type { ComponentArgTypes } from '../../../../typings/utils'
|
|
5
|
-
import type { BulletsProps } from '../Bullets'
|
|
6
|
-
import Component from '../Bullets'
|
|
7
|
-
import mdx from './Bullets.mdx'
|
|
8
|
-
|
|
9
|
-
const BulletsTemplate: Story<BulletsProps> = ({
|
|
10
|
-
onClick,
|
|
11
|
-
activeBullet,
|
|
12
|
-
totalQuantity,
|
|
13
|
-
ariaLabelGenerator,
|
|
14
|
-
testId,
|
|
15
|
-
}) => {
|
|
16
|
-
const [localActiveBullet, setLocalActiveBullet] = useState(activeBullet)
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setLocalActiveBullet(activeBullet)
|
|
20
|
-
}, [activeBullet, setLocalActiveBullet])
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Component
|
|
24
|
-
onClick={(e, idx) => {
|
|
25
|
-
onClick?.(e, idx)
|
|
26
|
-
setLocalActiveBullet(idx)
|
|
27
|
-
}}
|
|
28
|
-
activeBullet={localActiveBullet}
|
|
29
|
-
totalQuantity={totalQuantity}
|
|
30
|
-
ariaLabelGenerator={ariaLabelGenerator}
|
|
31
|
-
testId={testId}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const Bullets = BulletsTemplate.bind({})
|
|
37
|
-
|
|
38
|
-
const argTypes: ComponentArgTypes<BulletsProps> = {
|
|
39
|
-
totalQuantity: {
|
|
40
|
-
control: { type: 'number', min: 1 },
|
|
41
|
-
defaultValue: 5,
|
|
42
|
-
min: 1,
|
|
43
|
-
},
|
|
44
|
-
activeBullet: {
|
|
45
|
-
control: { type: 'number', min: 0 },
|
|
46
|
-
defaultValue: 3,
|
|
47
|
-
min: 0,
|
|
48
|
-
},
|
|
49
|
-
onClick: {
|
|
50
|
-
action: 'Bullet clicked',
|
|
51
|
-
table: { disable: true },
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
title: 'Molecules/Bullets',
|
|
57
|
-
component: Bullets,
|
|
58
|
-
argTypes,
|
|
59
|
-
parameters: {
|
|
60
|
-
docs: {
|
|
61
|
-
page: mdx,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
}
|