@faststore/ui 2.0.33-alpha.0 → 2.0.35-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 +18 -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/atoms/Button/styles.scss +1 -0
- 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,65 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@storybook/react'
|
|
2
|
-
import React, { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Button, Input } from '../../../../'
|
|
5
|
-
import type { FormProps } from '../Form'
|
|
6
|
-
import Component from '../Form'
|
|
7
|
-
import mdx from './Form.mdx'
|
|
8
|
-
import { Checkbox, Label } from '@faststore/components'
|
|
9
|
-
|
|
10
|
-
const FormTemplate: Story<FormProps> = ({ testId }) => {
|
|
11
|
-
const [name, setName] = useState<string>()
|
|
12
|
-
const [email, setEmail] = useState<string>()
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Component
|
|
16
|
-
testId={testId}
|
|
17
|
-
onSubmit={(e) => {
|
|
18
|
-
e.preventDefault()
|
|
19
|
-
alert(`Thank you for subscribing ${name}! Email: ${email}`)
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
<h1>Sign up & save 15% off your first order</h1>
|
|
23
|
-
<h2>
|
|
24
|
-
Be the first to hear about special offers, new product launches, gift
|
|
25
|
-
ideas and more.
|
|
26
|
-
</h2>
|
|
27
|
-
<div>
|
|
28
|
-
<Label htmlFor="name">Name:</Label>
|
|
29
|
-
<Input
|
|
30
|
-
id="name"
|
|
31
|
-
placeholder="Enter your name"
|
|
32
|
-
required
|
|
33
|
-
onChange={(e) => setName(e.currentTarget.value)}
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
36
|
-
<div>
|
|
37
|
-
<Label htmlFor="email">Email:</Label>
|
|
38
|
-
<Input
|
|
39
|
-
id="email"
|
|
40
|
-
placeholder="Enter your email"
|
|
41
|
-
required
|
|
42
|
-
onChange={(e) => setEmail(e.currentTarget.value)}
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
<div>
|
|
46
|
-
<Label>
|
|
47
|
-
<Checkbox required />I agree to receive emails from Brand. View our{' '}
|
|
48
|
-
<a href="/">Privacy Policy</a>.
|
|
49
|
-
</Label>
|
|
50
|
-
</div>
|
|
51
|
-
<Button type="submit">Subscribe</Button>
|
|
52
|
-
</Component>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const Form = FormTemplate.bind({})
|
|
57
|
-
|
|
58
|
-
export default {
|
|
59
|
-
title: 'Molecules/Form',
|
|
60
|
-
parameters: {
|
|
61
|
-
docs: {
|
|
62
|
-
page: mdx,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import Gift from '../Gift'
|
|
4
|
-
|
|
5
|
-
# Gift
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-gift--gift" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
## Components
|
|
12
|
-
|
|
13
|
-
The `Gift` uses the [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) pattern, its components are:
|
|
14
|
-
|
|
15
|
-
- `Gift`: the wrapper component, it can receive a `Icon` prop.
|
|
16
|
-
- `GiftImage`: the component's that display the product image.
|
|
17
|
-
- `GiftContent`: the component that can display the product's title, price, and a badge.
|
|
18
|
-
|
|
19
|
-
## Props
|
|
20
|
-
|
|
21
|
-
<ArgsTable of={Gift} />
|
|
22
|
-
|
|
23
|
-
## CSS Selectors
|
|
24
|
-
|
|
25
|
-
```css
|
|
26
|
-
[data-fs-gift] {
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
[data-fs-gift-wrapper] {
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[data-fs-gift-icon] {
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[data-fs-gift-content] {
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[data-fs-gift-image] {
|
|
39
|
-
}
|
|
40
|
-
```
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Story, Meta } from '@storybook/react'
|
|
2
|
-
import React, { useMemo } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Badge, Price } from '@faststore/components'
|
|
5
|
-
// Gift components
|
|
6
|
-
import GiftComponent from '../Gift'
|
|
7
|
-
import GiftContent from '../GiftContent'
|
|
8
|
-
import GiftImage from '../GiftImage'
|
|
9
|
-
import type { GiftProps } from '../Gift'
|
|
10
|
-
import mdx from './Gift.mdx'
|
|
11
|
-
|
|
12
|
-
const Tag = () => (
|
|
13
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
|
14
|
-
<path fill="none" d="M0 0h256v256H0z" />
|
|
15
|
-
<path
|
|
16
|
-
d="M122.7 25.9 42 42l-16.1 80.7a8 8 0 0 0 2.2 7.2l104.4 104.4a7.9 7.9 0 0 0 11.3 0l90.5-90.5a7.9 7.9 0 0 0 0-11.3L129.9 28.1a8 8 0 0 0-7.2-2.2Z"
|
|
17
|
-
fill="none"
|
|
18
|
-
stroke="#000"
|
|
19
|
-
strokeLinecap="round"
|
|
20
|
-
strokeLinejoin="round"
|
|
21
|
-
strokeWidth="16"
|
|
22
|
-
/>
|
|
23
|
-
<circle cx="84" cy="84" r="12" />
|
|
24
|
-
</svg>
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
function useIntlFormatter(price: number) {
|
|
28
|
-
return useMemo(() => {
|
|
29
|
-
const formattedPrice = new Intl.NumberFormat('en-GB', {
|
|
30
|
-
style: 'currency',
|
|
31
|
-
currency: 'USD',
|
|
32
|
-
}).format(price)
|
|
33
|
-
|
|
34
|
-
return formattedPrice
|
|
35
|
-
}, [price])
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const GiftTemplate: Story<GiftProps> = ({ testId }) => (
|
|
39
|
-
<GiftComponent testId={testId} icon={<Tag />}>
|
|
40
|
-
<GiftImage>
|
|
41
|
-
<img
|
|
42
|
-
alt="Aedle VK-1 L Headphone"
|
|
43
|
-
src="https://assets.vtex.app/unsafe/1608x1206/center/middle/https%3A%2F%2Fstoreframework.vtexassets.com%2Farquivos%2Fids%2F190901%2Funsplash-headphone.jpg%3Fv%3D637800115948430000"
|
|
44
|
-
/>
|
|
45
|
-
</GiftImage>
|
|
46
|
-
<GiftContent>
|
|
47
|
-
<h3>Get a pair of Aedle VK-1 L Headphone</h3>
|
|
48
|
-
<div>
|
|
49
|
-
<Price value={145} formatter={useIntlFormatter} />
|
|
50
|
-
<Badge>Free</Badge>
|
|
51
|
-
</div>
|
|
52
|
-
</GiftContent>
|
|
53
|
-
</GiftComponent>
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
export const Gift = GiftTemplate.bind({})
|
|
57
|
-
Gift.storyName = 'Gift'
|
|
58
|
-
|
|
59
|
-
export default {
|
|
60
|
-
title: 'Molecules/Gift',
|
|
61
|
-
parameters: {
|
|
62
|
-
docs: {
|
|
63
|
-
page: mdx,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
} as Meta
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { IconButton, ShoppingCart } from '@faststore/components'
|
|
4
|
-
|
|
5
|
-
<Meta
|
|
6
|
-
title="Molecules/IconButton"
|
|
7
|
-
component={IconButton}
|
|
8
|
-
argTypes={{
|
|
9
|
-
variant: {
|
|
10
|
-
options: ['primary', 'secondary', 'tertiary'],
|
|
11
|
-
control: { type: 'select' },
|
|
12
|
-
description: 'Specifies the component color variant.',
|
|
13
|
-
},
|
|
14
|
-
}}
|
|
15
|
-
/>
|
|
16
|
-
|
|
17
|
-
export const Template = ({ args }) => (
|
|
18
|
-
<IconButton icon={<ShoppingCart />} aria-label="Buy" />
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
<header>
|
|
22
|
-
|
|
23
|
-
# IconButton
|
|
24
|
-
|
|
25
|
-
</header>
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```jsx
|
|
30
|
-
import { IconButton } from '@faststore/ui'
|
|
31
|
-
// Styles
|
|
32
|
-
import '@faststore/ui/src/components/atoms/Button/styles.scss'
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
<Canvas>
|
|
36
|
-
<Story
|
|
37
|
-
name="default"
|
|
38
|
-
args={{ id: 'icon-button-default', variant: 'secondary' }}
|
|
39
|
-
>
|
|
40
|
-
{Template.bind({})}
|
|
41
|
-
</Story>
|
|
42
|
-
</Canvas>
|
|
43
|
-
|
|
44
|
-
<ArgsTable story="default" />
|
|
45
|
-
|
|
46
|
-
This component inherits [Button](?path=/docs/atoms-button--button#css-selectors) css selectors & styles.
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { InputField } from '@faststore/components'
|
|
4
|
-
|
|
5
|
-
<Meta
|
|
6
|
-
title="Molecules/InputField"
|
|
7
|
-
component={InputField}
|
|
8
|
-
argTypes={{
|
|
9
|
-
actionable: {
|
|
10
|
-
type: { name: 'boolean' },
|
|
11
|
-
},
|
|
12
|
-
disabled: {
|
|
13
|
-
type: { name: 'boolean' },
|
|
14
|
-
},
|
|
15
|
-
id: {
|
|
16
|
-
type: { name: 'string', required: true },
|
|
17
|
-
},
|
|
18
|
-
inputRef: {
|
|
19
|
-
control: { disable: true },
|
|
20
|
-
},
|
|
21
|
-
}}
|
|
22
|
-
/>
|
|
23
|
-
|
|
24
|
-
export const Template = (args) => {
|
|
25
|
-
return <InputField {...args} />
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
<header>
|
|
29
|
-
|
|
30
|
-
# Input Field
|
|
31
|
-
|
|
32
|
-
Input Field are text fields used to get user inputs.
|
|
33
|
-
|
|
34
|
-
</header>
|
|
35
|
-
|
|
36
|
-
## Overview
|
|
37
|
-
|
|
38
|
-
The `InputField` component uses [FastStore UI Input](https://www.faststore.dev/reference/ui/atoms/Input) as base.
|
|
39
|
-
|
|
40
|
-
<Canvas>
|
|
41
|
-
<Story
|
|
42
|
-
name="overview-default"
|
|
43
|
-
args={{
|
|
44
|
-
id: 'overview-default',
|
|
45
|
-
label: 'Label',
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
{Template.bind({})}
|
|
49
|
-
</Story>
|
|
50
|
-
<Story
|
|
51
|
-
name="overview-error"
|
|
52
|
-
args={{
|
|
53
|
-
id: 'overview-error',
|
|
54
|
-
label: 'Input w/ Error Message',
|
|
55
|
-
error: 'Error Message',
|
|
56
|
-
disabled: false,
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
59
|
-
{Template.bind({})}
|
|
60
|
-
</Story>
|
|
61
|
-
<Story
|
|
62
|
-
name="overview-actionable"
|
|
63
|
-
args={{
|
|
64
|
-
id: 'overview-actionable',
|
|
65
|
-
label: 'Input w/ Action',
|
|
66
|
-
actionable: true,
|
|
67
|
-
disabled: false,
|
|
68
|
-
}}
|
|
69
|
-
>
|
|
70
|
-
{Template.bind({})}
|
|
71
|
-
</Story>
|
|
72
|
-
<Story
|
|
73
|
-
name="overview-actionable-error"
|
|
74
|
-
args={{
|
|
75
|
-
id: 'overview-actionable-error',
|
|
76
|
-
label: 'Input w/ Action and Error',
|
|
77
|
-
actionable: true,
|
|
78
|
-
error: 'Error Message',
|
|
79
|
-
disabled: false,
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{Template.bind({})}
|
|
83
|
-
</Story>
|
|
84
|
-
<Story
|
|
85
|
-
name="overview-disabled"
|
|
86
|
-
args={{
|
|
87
|
-
id: 'overview-disabled',
|
|
88
|
-
label: 'Input Disabled',
|
|
89
|
-
actionable: false,
|
|
90
|
-
disabled: true,
|
|
91
|
-
value: 'Input Text',
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
{Template.bind({})}
|
|
95
|
-
</Story>
|
|
96
|
-
</Canvas>
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Usage
|
|
101
|
-
|
|
102
|
-
`import InputField from '../components/ui/InputField'`
|
|
103
|
-
|
|
104
|
-
<Canvas>
|
|
105
|
-
<Story
|
|
106
|
-
name="input-default"
|
|
107
|
-
args={{
|
|
108
|
-
id: 'input-default',
|
|
109
|
-
label: 'Label',
|
|
110
|
-
}}
|
|
111
|
-
>
|
|
112
|
-
{Template.bind({})}
|
|
113
|
-
</Story>
|
|
114
|
-
</Canvas>
|
|
115
|
-
|
|
116
|
-
<ArgsTable story="input-default" />
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
import LoadingButton from '../LoadingButton'
|
|
3
|
-
|
|
4
|
-
# Loading Button
|
|
5
|
-
|
|
6
|
-
<Canvas>
|
|
7
|
-
<Story id="molecules-loadingbutton--loadingbutton" />
|
|
8
|
-
</Canvas>
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
<ArgsTable of={LoadingButton} />
|
|
13
|
-
|
|
14
|
-
## CSS Selectors
|
|
15
|
-
|
|
16
|
-
```css
|
|
17
|
-
[data-fs-loading-button] {}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
This component inherits [Button](?path=/docs/atoms-button--button#css-selectors) css selectors.
|
|
@@ -1,36 +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 { LoadingButtonProps } from '../LoadingButton'
|
|
6
|
-
import Component from '../LoadingButton'
|
|
7
|
-
import mdx from './LoadingButton.mdx'
|
|
8
|
-
|
|
9
|
-
const LoadingButtonTemplate: Story<LoadingButtonProps> = ({
|
|
10
|
-
loading,
|
|
11
|
-
testId,
|
|
12
|
-
}) => (
|
|
13
|
-
<Component loading={loading} testId={testId}>
|
|
14
|
-
Loading Button
|
|
15
|
-
</Component>
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
export const LoadingButton = LoadingButtonTemplate.bind({})
|
|
19
|
-
LoadingButton.storyName = 'LoadingButton'
|
|
20
|
-
|
|
21
|
-
const argTypes: ComponentArgTypes<LoadingButtonProps> = {
|
|
22
|
-
loading: {
|
|
23
|
-
type: 'boolean',
|
|
24
|
-
defaultValue: false,
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default {
|
|
29
|
-
title: 'Molecules/LoadingButton',
|
|
30
|
-
argTypes,
|
|
31
|
-
parameters: {
|
|
32
|
-
docs: {
|
|
33
|
-
page: mdx,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
import Modal from '../Modal'
|
|
3
|
-
|
|
4
|
-
# Modal
|
|
5
|
-
|
|
6
|
-
<Canvas>
|
|
7
|
-
<Story id="molecules-modal--modal" />
|
|
8
|
-
</Canvas>
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
<ArgsTable of={Modal} />
|
|
13
|
-
|
|
14
|
-
## CSS Selectors
|
|
15
|
-
|
|
16
|
-
```css
|
|
17
|
-
[data-fs-modal-content] {}
|
|
18
|
-
```
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import type { PropsWithChildren } from 'react'
|
|
3
|
-
import type { Meta, Story } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import type { ModalProps } from '..'
|
|
6
|
-
import { Button } from '@faststore/components'
|
|
7
|
-
import Component from '../Modal'
|
|
8
|
-
import mdx from './Modal.mdx'
|
|
9
|
-
|
|
10
|
-
const ModalTemplate: Story<PropsWithChildren<ModalProps>> = ({
|
|
11
|
-
children,
|
|
12
|
-
...otherProps
|
|
13
|
-
}) => {
|
|
14
|
-
const [isOpen, setIsOpen] = useState(false)
|
|
15
|
-
const handleClose = () => setIsOpen(false)
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
<Button onClick={() => setIsOpen(!isOpen)}>Open Modal</Button>
|
|
20
|
-
<Component
|
|
21
|
-
{...otherProps}
|
|
22
|
-
isOpen={isOpen}
|
|
23
|
-
aria-label="Storybook Modal"
|
|
24
|
-
onDismiss={handleClose}
|
|
25
|
-
>
|
|
26
|
-
My Modal Content
|
|
27
|
-
<br />
|
|
28
|
-
<div data-action-container>
|
|
29
|
-
<Button onClick={handleClose}>close</Button>
|
|
30
|
-
</div>
|
|
31
|
-
</Component>
|
|
32
|
-
</>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const Modal = ModalTemplate.bind({})
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
title: 'Molecules/Modal',
|
|
40
|
-
parameters: {
|
|
41
|
-
docs: {
|
|
42
|
-
page: mdx,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
} as Meta
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import OrderSummary from '../OrderSummary'
|
|
4
|
-
|
|
5
|
-
# OrderSummary
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-ordersummary--order-summary" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
## Props
|
|
12
|
-
|
|
13
|
-
<ArgsTable of={ OrderSummary } />
|
|
14
|
-
|
|
15
|
-
## CSS Selectors
|
|
16
|
-
|
|
17
|
-
```css
|
|
18
|
-
[data-fs-order-summary] {}
|
|
19
|
-
[data-fs-order-summary-subtotal] {}
|
|
20
|
-
[data-fs-order-summary-subtotal-label] {}
|
|
21
|
-
[data-fs-order-summary-subtotal-value] {}
|
|
22
|
-
[data-fs-order-summary-discount] {}
|
|
23
|
-
[data-fs-order-summary-discount-label] {}
|
|
24
|
-
[data-fs-order-summary-discount-value] {}
|
|
25
|
-
[data-fs-order-summary-total] {}
|
|
26
|
-
[data-fs-order-summary-total-label] {}
|
|
27
|
-
[data-fs-order-summary-total-value] {}
|
|
28
|
-
|
|
29
|
-
```
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Story, Meta } from '@storybook/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { OrderSummaryProps } from '../OrderSummary'
|
|
5
|
-
import Component from '../OrderSummary'
|
|
6
|
-
import mdx from './OrderSummary.mdx'
|
|
7
|
-
|
|
8
|
-
const OrderSummaryTemplate: Story<OrderSummaryProps> = () => (
|
|
9
|
-
<Component
|
|
10
|
-
subtotalLabel='Subtotal (3 products)'
|
|
11
|
-
subtotalValue='$300'
|
|
12
|
-
discountLabel='Discount'
|
|
13
|
-
discountValue='-$50'
|
|
14
|
-
totalLabel='Total'
|
|
15
|
-
totalValue='250$'
|
|
16
|
-
/>
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
export const OrderSummary = OrderSummaryTemplate.bind({})
|
|
20
|
-
OrderSummary.storyName = 'OrderSummary'
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
title: 'Molecules/OrderSummary',
|
|
24
|
-
parameters: {
|
|
25
|
-
docs: {
|
|
26
|
-
page: mdx,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
} as Meta
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
import PaymentMethods from '../PaymentMethods'
|
|
3
|
-
|
|
4
|
-
# PaymentMethods
|
|
5
|
-
|
|
6
|
-
<Canvas>
|
|
7
|
-
<Story id="molecules-paymentmethods--payment-methods" />
|
|
8
|
-
</Canvas>
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
<ArgsTable of={PaymentMethods} />
|
|
13
|
-
|
|
14
|
-
## CSS Selectors
|
|
15
|
-
|
|
16
|
-
```css
|
|
17
|
-
[data-fs-payment-methods] {}
|
|
18
|
-
[data-payment-methods-flags] {}
|
|
19
|
-
```
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Story, Meta } from '@storybook/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { PaymentMethodsProps } from '../PaymentMethods'
|
|
5
|
-
import Component from '../PaymentMethods'
|
|
6
|
-
import mdx from './PaymentMethods.mdx'
|
|
7
|
-
import {
|
|
8
|
-
VisaCard,
|
|
9
|
-
MasterCard,
|
|
10
|
-
MaestroCard,
|
|
11
|
-
AmericanExpressCard,
|
|
12
|
-
HiperCard,
|
|
13
|
-
EloCard,
|
|
14
|
-
DinersClub,
|
|
15
|
-
PayPal,
|
|
16
|
-
} from './assets/Icons'
|
|
17
|
-
|
|
18
|
-
const PaymentMethodsTemplate: Story<PaymentMethodsProps> = ({ testId }) => (
|
|
19
|
-
<Component testId={testId} title="Payment Methods">
|
|
20
|
-
<VisaCard key="visa" />
|
|
21
|
-
<MasterCard key="mastercard" />
|
|
22
|
-
<MaestroCard key="maestro" />
|
|
23
|
-
<AmericanExpressCard key="american express" />
|
|
24
|
-
<HiperCard key="hipercard" />
|
|
25
|
-
<EloCard key="elo" />
|
|
26
|
-
<DinersClub key="diners club" />
|
|
27
|
-
<PayPal key="paypal" />
|
|
28
|
-
</Component>
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
export const PaymentMethods = PaymentMethodsTemplate.bind({})
|
|
32
|
-
PaymentMethods.storyName = 'PaymentMethods'
|
|
33
|
-
|
|
34
|
-
export default {
|
|
35
|
-
title: 'Molecules/PaymentMethods',
|
|
36
|
-
parameters: {
|
|
37
|
-
docs: {
|
|
38
|
-
page: mdx,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
} as Meta
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export function VisaCard() {
|
|
4
|
-
return (
|
|
5
|
-
<img
|
|
6
|
-
alt="Visa logo"
|
|
7
|
-
width={50}
|
|
8
|
-
height={50}
|
|
9
|
-
src="https://seeklogo.com/images/V/visa-logo-BDDD51C62D-seeklogo.com.png"
|
|
10
|
-
/>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function MasterCard() {
|
|
15
|
-
return (
|
|
16
|
-
<img
|
|
17
|
-
alt="Mastercard logo"
|
|
18
|
-
width={50}
|
|
19
|
-
height={50}
|
|
20
|
-
src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Mastercard-logo.svg/1544px-Mastercard-logo.svg.png"
|
|
21
|
-
/>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function AmericanExpressCard() {
|
|
26
|
-
return (
|
|
27
|
-
<img
|
|
28
|
-
alt="American express logo"
|
|
29
|
-
width={50}
|
|
30
|
-
height={50}
|
|
31
|
-
src="https://seeklogo.com/images/A/american-express-logo-EDF87C04A0-seeklogo.com.png"
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function MaestroCard() {
|
|
37
|
-
return (
|
|
38
|
-
<img
|
|
39
|
-
alt="American express logo"
|
|
40
|
-
width={50}
|
|
41
|
-
height={50}
|
|
42
|
-
src="https://seeklogo.com/images/M/Maestro-logo-BF4E5E7686-seeklogo.com.png"
|
|
43
|
-
/>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function EloCard() {
|
|
48
|
-
return (
|
|
49
|
-
<img
|
|
50
|
-
alt="Elo logo"
|
|
51
|
-
width={50}
|
|
52
|
-
height={50}
|
|
53
|
-
src="https://seeklogo.com/images/E/elo-logo-9F0CF48D54-seeklogo.com.png"
|
|
54
|
-
/>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function HiperCard() {
|
|
59
|
-
return (
|
|
60
|
-
<img
|
|
61
|
-
alt="Hipercard logo"
|
|
62
|
-
width={50}
|
|
63
|
-
height={50}
|
|
64
|
-
src="https://seeklogo.com/images/H/Hipercard-logo-139D91D263-seeklogo.com.png"
|
|
65
|
-
/>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function PayPal() {
|
|
70
|
-
return (
|
|
71
|
-
<img
|
|
72
|
-
alt="PayPal brand"
|
|
73
|
-
width={50}
|
|
74
|
-
height={50}
|
|
75
|
-
src="https://seeklogo.com/images/P/paypal-logo-484B6FE744-seeklogo.com.png"
|
|
76
|
-
/>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function DinersClub() {
|
|
81
|
-
return (
|
|
82
|
-
<img
|
|
83
|
-
alt="Diners club logo"
|
|
84
|
-
width={50}
|
|
85
|
-
height={50}
|
|
86
|
-
src="https://seeklogo.com/images/D/Diners_Club_International-logo-EF50D35BE8-seeklogo.com.png"
|
|
87
|
-
/>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import PriceRange from '../PriceRange'
|
|
4
|
-
|
|
5
|
-
# PriceRange
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story id="molecules-pricerange--price-range" />
|
|
9
|
-
</Canvas>
|
|
10
|
-
|
|
11
|
-
# Props
|
|
12
|
-
|
|
13
|
-
<ArgsTable of={PriceRange} />
|
|
14
|
-
|
|
15
|
-
# CSS Selectors
|
|
16
|
-
|
|
17
|
-
```css
|
|
18
|
-
[data-fs-price-range] {
|
|
19
|
-
}
|
|
20
|
-
[data-price-range-values] {
|
|
21
|
-
}
|
|
22
|
-
[data-price-range-value='(min|max)'] {
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
# TODO
|
|
27
|
-
|
|
28
|
-
- [ ] More test cases
|