@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.
Files changed (101) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/molecules/Accordion/AccordionItem.d.ts +1 -7
  3. package/dist/components/molecules/Accordion/AccordionItem.js +1 -7
  4. package/dist/components/molecules/Accordion/AccordionItem.js.map +1 -1
  5. package/package.json +6 -19
  6. package/src/components/atoms/Button/styles.scss +1 -0
  7. package/src/components/molecules/Accordion/AccordionItem.tsx +42 -42
  8. package/dist/components/atoms/Incentive/stories/assets/Icons.d.ts +0 -2
  9. package/dist/components/atoms/Incentive/stories/assets/Icons.js +0 -6
  10. package/dist/components/atoms/Incentive/stories/assets/Icons.js.map +0 -1
  11. package/dist/components/molecules/Dropdown/stories/assets/Caret.d.ts +0 -2
  12. package/dist/components/molecules/Dropdown/stories/assets/Caret.js +0 -4
  13. package/dist/components/molecules/Dropdown/stories/assets/Caret.js.map +0 -1
  14. package/dist/components/molecules/PaymentMethods/stories/assets/Icons.d.ts +0 -9
  15. package/dist/components/molecules/PaymentMethods/stories/assets/Icons.js +0 -26
  16. package/dist/components/molecules/PaymentMethods/stories/assets/Icons.js.map +0 -1
  17. package/dist/components/molecules/QuantitySelector/stories/assets/Icons.d.ts +0 -7
  18. package/dist/components/molecules/QuantitySelector/stories/assets/Icons.js +0 -11
  19. package/dist/components/molecules/QuantitySelector/stories/assets/Icons.js.map +0 -1
  20. package/dist/components/molecules/SearchInput/stories/assets/CustomIcon.d.ts +0 -3
  21. package/dist/components/molecules/SearchInput/stories/assets/CustomIcon.js +0 -7
  22. package/dist/components/molecules/SearchInput/stories/assets/CustomIcon.js.map +0 -1
  23. package/src/components/atoms/Badge/Badge.stories.mdx +0 -156
  24. package/src/components/atoms/Incentive/stories/Incentive.mdx +0 -24
  25. package/src/components/atoms/Incentive/stories/Incentive.stories.tsx +0 -26
  26. package/src/components/atoms/Incentive/stories/assets/Icons.tsx +0 -14
  27. package/src/components/atoms/Input/Input.stories.mdx +0 -34
  28. package/src/components/atoms/Label/Label.stories.mdx +0 -65
  29. package/src/components/atoms/Link/Link.stories.mdx +0 -134
  30. package/src/components/atoms/Popover/stories/Popover.mdx +0 -18
  31. package/src/components/atoms/Popover/stories/Popover.stories.tsx +0 -50
  32. package/src/components/atoms/Radio/Radio.stories.mdx +0 -101
  33. package/src/components/atoms/Skeleton/stories/Skeleton.mdx +0 -18
  34. package/src/components/atoms/Skeleton/stories/Skeleton.stories.tsx +0 -21
  35. package/src/components/atoms/Slider/stories/Slider.mdx +0 -29
  36. package/src/components/atoms/Slider/stories/Slider.stories.tsx +0 -32
  37. package/src/components/atoms/Spinner/stories/Spinner.mdx +0 -18
  38. package/src/components/atoms/Spinner/stories/Spinner.stories.tsx +0 -21
  39. package/src/components/atoms/TextArea/stories/TextArea.mdx +0 -22
  40. package/src/components/atoms/TextArea/stories/TextArea.stories.tsx +0 -49
  41. package/src/components/molecules/Accordion/stories/Accordion.mdx +0 -62
  42. package/src/components/molecules/Accordion/stories/Accordion.stories.tsx +0 -160
  43. package/src/components/molecules/AggregateRating/stories/AggregateRating.mdx +0 -33
  44. package/src/components/molecules/AggregateRating/stories/AggregateRating.stories.tsx +0 -111
  45. package/src/components/molecules/Alert/stories/Alert.mdx +0 -26
  46. package/src/components/molecules/Alert/stories/Alert.stories.tsx +0 -36
  47. package/src/components/molecules/Banner/stories/Banner.mdx +0 -63
  48. package/src/components/molecules/Banner/stories/Banner.stories.tsx +0 -66
  49. package/src/components/molecules/Breadcrumb/stories/Breadcrumb.mdx +0 -27
  50. package/src/components/molecules/Breadcrumb/stories/Breadcrumb.stories.tsx +0 -55
  51. package/src/components/molecules/Bullets/stories/Bullets.mdx +0 -25
  52. package/src/components/molecules/Bullets/stories/Bullets.stories.tsx +0 -64
  53. package/src/components/molecules/Card/stories/Card.mdx +0 -54
  54. package/src/components/molecules/Card/stories/Card.stories.tsx +0 -63
  55. package/src/components/molecules/Carousel/stories/Carousel.mdx +0 -35
  56. package/src/components/molecules/Carousel/stories/Carousel.stories.tsx +0 -56
  57. package/src/components/molecules/CartItem/stories/CartItem.mdx +0 -79
  58. package/src/components/molecules/CartItem/stories/CartItem.stories.tsx +0 -70
  59. package/src/components/molecules/CheckboxField/CheckboxField.stories.mdx +0 -38
  60. package/src/components/molecules/DiscountBadge/DiscountBadge.stories.mdx +0 -38
  61. package/src/components/molecules/Dropdown/stories/Dropdown.mdx +0 -63
  62. package/src/components/molecules/Dropdown/stories/Dropdown.stories.tsx +0 -94
  63. package/src/components/molecules/Dropdown/stories/assets/Caret.tsx +0 -19
  64. package/src/components/molecules/Form/stories/Form.mdx +0 -23
  65. package/src/components/molecules/Form/stories/Form.stories.tsx +0 -65
  66. package/src/components/molecules/Gift/stories/Gift.mdx +0 -40
  67. package/src/components/molecules/Gift/stories/Gift.stories.tsx +0 -66
  68. package/src/components/molecules/IconButton/IconButton.stories.mdx +0 -46
  69. package/src/components/molecules/InputField/InputField.stories.mdx +0 -116
  70. package/src/components/molecules/LoadingButton/stories/LoadingButton.mdx +0 -20
  71. package/src/components/molecules/LoadingButton/stories/LoadingButton.stories.tsx +0 -36
  72. package/src/components/molecules/Modal/stories/Modal.mdx +0 -18
  73. package/src/components/molecules/Modal/stories/Modal.stories.tsx +0 -45
  74. package/src/components/molecules/OrderSummary/stories/OrderSummary.mdx +0 -29
  75. package/src/components/molecules/OrderSummary/stories/OrderSummary.stories.tsx +0 -29
  76. package/src/components/molecules/PaymentMethods/stories/PaymentMethods.mdx +0 -19
  77. package/src/components/molecules/PaymentMethods/stories/PaymentMethods.stories.tsx +0 -41
  78. package/src/components/molecules/PaymentMethods/stories/assets/Icons.tsx +0 -89
  79. package/src/components/molecules/PriceRange/stories/PriceRange.mdx +0 -28
  80. package/src/components/molecules/PriceRange/stories/PriceRange.stories.tsx +0 -45
  81. package/src/components/molecules/ProductCard/stories/ProductCard.mdx +0 -55
  82. package/src/components/molecules/ProductCard/stories/ProductCard.stories.tsx +0 -60
  83. package/src/components/molecules/ProductTitle/stories/ProductTitle.mdx +0 -26
  84. package/src/components/molecules/ProductTitle/stories/ProductTitle.stories.tsx +0 -27
  85. package/src/components/molecules/QuantitySelector/stories/QuantitySelector.mdx +0 -26
  86. package/src/components/molecules/QuantitySelector/stories/QuantitySelector.stories.tsx +0 -77
  87. package/src/components/molecules/QuantitySelector/stories/assets/Icons.tsx +0 -52
  88. package/src/components/molecules/RadioField/RadioField.stories.mdx +0 -38
  89. package/src/components/molecules/RadioGroup/stories/RadioGroup.mdx +0 -39
  90. package/src/components/molecules/RadioGroup/stories/RadioGroup.stories.tsx +0 -108
  91. package/src/components/molecules/SearchInput/stories/SearchInput.mdx +0 -28
  92. package/src/components/molecules/SearchInput/stories/SearchInput.stories.tsx +0 -45
  93. package/src/components/molecules/SearchInput/stories/assets/CustomIcon.tsx +0 -22
  94. package/src/components/molecules/SkuSelector/stories/SkuSelector.mdx +0 -24
  95. package/src/components/molecules/SkuSelector/stories/SkuSelector.stories.tsx +0 -52
  96. package/src/components/molecules/Tag/Tag.stories.mdx +0 -31
  97. package/src/components/organisms/OutOfStock/stories/OutOfStock.mdx +0 -37
  98. package/src/components/organisms/OutOfStock/stories/OutOfStock.stories.tsx +0 -71
  99. package/src/components/organisms/Tiles/stories/Tiles.mdx +0 -39
  100. package/src/components/organisms/Tiles/stories/Tiles.stories.tsx +0 -38
  101. package/src/typings/utils.d.ts +0 -5
@@ -1,45 +0,0 @@
1
- import type { Meta, Story } from '@storybook/react'
2
- import React from 'react'
3
-
4
- import type { ComponentArgTypes } from '../../../../typings/utils'
5
- import type { PriceRangeProps } from '../PriceRange'
6
- import Component from '../PriceRange'
7
- import mdx from './PriceRange.mdx'
8
-
9
- const PriceRangeTemplate: Story<PriceRangeProps> = (props) => (
10
- <Component {...props} />
11
- )
12
-
13
- export const PriceRange = PriceRangeTemplate.bind({})
14
- PriceRange.storyName = 'PriceRange'
15
-
16
- function formatter(price: number) {
17
- return new Intl.NumberFormat('en-US', {
18
- style: 'currency',
19
- currency: 'USD',
20
- }).format(price)
21
- }
22
-
23
- const argTypes: ComponentArgTypes<PriceRangeProps> = {
24
- min: {
25
- control: { type: 'object' },
26
- defaultValue: { selected: 10, absolute: 0 },
27
- },
28
- max: {
29
- control: { type: 'object' },
30
- defaultValue: { selected: 90, absolute: 100 },
31
- },
32
- formatter: {
33
- defaultValue: formatter,
34
- },
35
- }
36
-
37
- export default {
38
- title: 'Molecules/PriceRange',
39
- argTypes,
40
- parameters: {
41
- docs: {
42
- page: mdx,
43
- },
44
- },
45
- } as Meta
@@ -1,55 +0,0 @@
1
- import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import ProductCard from '../ProductCard'
4
- import ProductCardImage from '../ProductCardImage'
5
- import ProductCardContent from '../ProductCardContent'
6
- import ProductCardActions from '../ProductCardActions'
7
-
8
- # ProductCard
9
-
10
- <Canvas>
11
- <Story id="molecules-productcard--product-card" />
12
- </Canvas>
13
-
14
- The `ProductCard` uses the [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) pattern, its components are:
15
-
16
- - `ProductCard`: the wrapper of the product card component;
17
- - `ProductCardImage`: the wrapper component for the content's image;
18
- - `ProductCardContent`: the wrapper component for the content's details;
19
- - `ProductCardActions`: the wrapper component for the content's CTAs (call-to-action);
20
-
21
- ## Props
22
-
23
- All Product Card related components support all attributes also supported by the `<div>` tag.
24
-
25
- ### `ProductCard`
26
-
27
- <ArgsTable of={ProductCard} />
28
-
29
- ### `ProductCardImage`
30
-
31
- <ArgsTable of={ProductCardImage} />
32
-
33
- ### `ProductCardContent`
34
-
35
- <ArgsTable of={ProductCardContent} />
36
-
37
- ### `ProductCardActions`
38
-
39
- <ArgsTable of={ProductCardActions} />
40
-
41
- ## CSS Selectors
42
-
43
- ```css
44
- [data-fs-product-card] {
45
- }
46
-
47
- [data-product-card-image] {
48
- }
49
-
50
- [data-product-card-content] {
51
- }
52
-
53
- [data-product-card-actions] {
54
- }
55
- ```
@@ -1,60 +0,0 @@
1
- import type { Story, Meta } from '@storybook/react'
2
- import React from 'react'
3
-
4
- // Atoms
5
- import { Badge, Button, Price } from '@faststore/components'
6
- // Card components
7
- import ProductCardComponent from '../ProductCard'
8
- import ProductCardImage from '../ProductCardImage'
9
- import ProductCardContent from '../ProductCardContent'
10
- import ProductCardActions from '../ProductCardActions'
11
- import type { ProductCardProps } from '../ProductCard'
12
- import mdx from './ProductCard.mdx'
13
-
14
- const ProductCardTemplate: Story<ProductCardProps> = ({ testId }) => {
15
- return (
16
- <ProductCardComponent testId={testId}>
17
- <ProductCardImage>
18
- <img
19
- alt="A vintage camera"
20
- src="https://storecomponents.vtex.app/assets/fit-in/480x480/center/middle/https%3A%2F%2Fstorecomponents.vtexassets.com%2Farquivos%2Fids%2F155481%2FFrame-3.jpg%3Fv%3D636793814536230000"
21
- />
22
- </ProductCardImage>
23
- <ProductCardContent>
24
- <h3>Vintage Top Camera</h3>
25
- <div>
26
- <Price
27
- value={89.9}
28
- variant="selling"
29
- formatter={formatter}
30
- style={{ textDecoration: 'line-through' }}
31
- />
32
- <Price value={68.9} variant="selling" formatter={formatter} />
33
- </div>
34
- <Badge>15% OFF</Badge>
35
- </ProductCardContent>
36
- <ProductCardActions>
37
- <Button onClick={() => null}>Add to Cart</Button>
38
- </ProductCardActions>
39
- </ProductCardComponent>
40
- )
41
- }
42
-
43
- function formatter(price: number) {
44
- return new Intl.NumberFormat('en-US', {
45
- style: 'currency',
46
- currency: 'USD',
47
- }).format(price)
48
- }
49
-
50
- export const ProductCard = ProductCardTemplate.bind({})
51
- ProductCard.storyName = 'ProductCard'
52
-
53
- export default {
54
- title: 'Molecules/ProductCard',
55
- parameters: {
56
- docs: {
57
- page: mdx,
58
- },
59
- },
60
- } as Meta
@@ -1,26 +0,0 @@
1
- import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import ProductTitle from '../ProductTitle'
4
-
5
- # ProductTitle
6
-
7
- <Canvas>
8
- <Story id="molecules-producttitle--product-title" />
9
- </Canvas>
10
-
11
- ## Props
12
-
13
- <ArgsTable of={ ProductTitle } />
14
-
15
- ## CSS Selectors
16
-
17
- ```css
18
- [data-fs-product-title] {
19
- }
20
-
21
- [data-fs-product-title-header] {
22
- }
23
-
24
- [data-fs-product-title-addendum] {
25
- }
26
- ```
@@ -1,27 +0,0 @@
1
- import type { Story, Meta } from '@storybook/react'
2
- import React from 'react'
3
-
4
- import type { ProductTitleProps } from '../ProductTitle'
5
- import Component from '../ProductTitle'
6
- import mdx from './ProductTitle.mdx'
7
- import Badge from '@faststore/components'
8
-
9
- const ProductTitleTemplate: Story<ProductTitleProps> = () => (
10
- <Component
11
- title={<h1>Apple Magic Mouse</h1>}
12
- refNumber="99995945"
13
- label={<Badge>90%</Badge>}
14
- />
15
- )
16
-
17
- export const ProductTitle = ProductTitleTemplate.bind({})
18
- ProductTitle.storyName = 'ProductTitle'
19
-
20
- export default {
21
- title: 'Molecules/ProductTitle',
22
- parameters: {
23
- docs: {
24
- page: mdx,
25
- },
26
- },
27
- } as Meta
@@ -1,26 +0,0 @@
1
- import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import QuantitySelector from '../QuantitySelector'
4
-
5
- # QuantitySelector
6
-
7
- ## Default Style
8
-
9
- <Canvas>
10
- <Story id="molecules-quantityselector--quantity-selector" />
11
- </Canvas>
12
-
13
- # Props
14
-
15
- <ArgsTable of={QuantitySelector} />
16
-
17
- # CSS Selectors
18
-
19
- ```css
20
- [data-fs-quantity-selector] {
21
- }
22
- [data-quantity-selector-input] {
23
- }
24
- [data-quantity-selector-button='(left|right)'] {
25
- }
26
- ```
@@ -1,77 +0,0 @@
1
- import type { Meta, Story } from '@storybook/react'
2
- import React, { useState } from 'react'
3
-
4
- import type { QuantitySelectorProps } from '../QuantitySelector'
5
- import Component from '../QuantitySelector'
6
- import { PlusIcon, MinusIcon } from './assets/Icons'
7
- import mdx from './QuantitySelector.mdx'
8
-
9
- const MAX_QUANTITY = 10
10
- const MIN_QUANTITY = 1
11
-
12
- export const QuantitySelector: Story<QuantitySelectorProps> = () => {
13
- const [quantity, setQuantity] = useState(MIN_QUANTITY)
14
-
15
- function increase() {
16
- setQuantity((currentQuantity) =>
17
- validateQuantityBounds(currentQuantity + 1)
18
- )
19
- }
20
-
21
- function decrease() {
22
- setQuantity((currentQuantity) =>
23
- validateQuantityBounds(currentQuantity - 1)
24
- )
25
- }
26
-
27
- function isLeftDisabled(): boolean {
28
- return quantity === MIN_QUANTITY
29
- }
30
-
31
- function isRightDisabled(): boolean {
32
- return quantity === MAX_QUANTITY
33
- }
34
-
35
- function validateQuantityBounds(n: number): number {
36
- return Math.min(Math.max(n, MIN_QUANTITY), MAX_QUANTITY)
37
- }
38
-
39
- function validateInput(e: React.FormEvent<HTMLInputElement>) {
40
- const val = e.currentTarget.value
41
-
42
- if (!Number.isNaN(Number(val))) {
43
- setQuantity(validateQuantityBounds(Number(val)))
44
- }
45
- }
46
-
47
- return (
48
- <Component
49
- quantity={quantity}
50
- leftButtonProps={{
51
- onClick: decrease,
52
- disabled: isLeftDisabled(),
53
- icon: <MinusIcon color={isLeftDisabled() ? '#898F9E' : '#2953B2'} />,
54
- }}
55
- rightButtonProps={{
56
- onClick: increase,
57
- disabled: isRightDisabled(),
58
- icon: <PlusIcon color={isRightDisabled() ? '#898F9E' : '#2953B2'} />,
59
- }}
60
- inputProps={{
61
- onChange: validateInput,
62
- readOnly: false,
63
- }}
64
- />
65
- )
66
- }
67
-
68
- QuantitySelector.storyName = 'QuantitySelector'
69
-
70
- export default {
71
- title: 'Molecules/QuantitySelector',
72
- parameters: {
73
- docs: {
74
- page: mdx,
75
- },
76
- },
77
- } as Meta
@@ -1,52 +0,0 @@
1
- import React from 'react'
2
-
3
- type QuantitySelectorIconProps = {
4
- color: string
5
- }
6
-
7
- export function PlusIcon(props: QuantitySelectorIconProps) {
8
- return (
9
- <svg
10
- width="32"
11
- height="32"
12
- viewBox="0 0 32 32"
13
- fill="none"
14
- xmlns="http://www.w3.org/2000/svg"
15
- >
16
- <path
17
- d="M11 16H21"
18
- stroke={props.color}
19
- strokeWidth="1.5"
20
- strokeLinecap="round"
21
- strokeLinejoin="round"
22
- />
23
- <path
24
- d="M16 11V21"
25
- stroke={props.color}
26
- strokeWidth="1.5"
27
- strokeLinecap="round"
28
- strokeLinejoin="round"
29
- />
30
- </svg>
31
- )
32
- }
33
-
34
- export function MinusIcon(props: QuantitySelectorIconProps) {
35
- return (
36
- <svg
37
- width="32"
38
- height="32"
39
- viewBox="0 0 32 32"
40
- fill="none"
41
- xmlns="http://www.w3.org/2000/svg"
42
- >
43
- <path
44
- d="M11 16H21"
45
- stroke={props.color}
46
- strokeWidth="1.5"
47
- strokeLinecap="round"
48
- strokeLinejoin="round"
49
- />
50
- </svg>
51
- )
52
- }
@@ -1,38 +0,0 @@
1
- import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import { RadioField } from '@faststore/components'
4
-
5
- <Meta title="Molecules/RadioField" component={RadioField} argTypes={{}} />
6
-
7
- export const Template = (args) => (
8
- <RadioField id="radio-field" label="RadioField" />
9
- )
10
-
11
- <header>
12
-
13
- # RadioField
14
-
15
- RadioField is composed of a Checkbox input and its corresponding Label. It allows users to select one option from a set.
16
-
17
- </header>
18
-
19
- ## Usage
20
-
21
- ```jsx
22
- import RadioField from '@faststore/ui'
23
- // Styles
24
- import '@faststore/ui/src/components/molecules/RadioField/styles.scss'
25
- ```
26
-
27
- <Canvas>
28
- <Story
29
- name="default"
30
- args={{
31
- id: 'radio-default',
32
- }}
33
- >
34
- {Template.bind({})}
35
- </Story>
36
- </Canvas>
37
-
38
- <ArgsTable story="default" />
@@ -1,39 +0,0 @@
1
- import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import RadioGroup from '../RadioGroup.tsx'
4
- import RadioOption from '../RadioOption.tsx'
5
-
6
- # Simple RadioGroup
7
-
8
- <Canvas>
9
- <Story id="molecules-radiogroup--radio-group-simple" />
10
- </Canvas>
11
-
12
- # RadioOption With Children
13
-
14
- <Canvas>
15
- <Story id="molecules-radiogroup--radio-option-with-children" />
16
- </Canvas>
17
-
18
- # Controlled RadioGroup
19
-
20
- <Canvas>
21
- <Story id="molecules-radiogroup--radio-group-controlled" />
22
- </Canvas>
23
-
24
- ## Props
25
-
26
- #### RadioGroup Props
27
-
28
- <ArgsTable of={RadioGroup} />
29
-
30
- #### RadioOption Props
31
-
32
- <ArgsTable of={RadioOption} />
33
-
34
- ## CSS Selectors
35
-
36
- ```css
37
- [data-fs-radio-option] {}
38
- [data-fs-radio-option-item] {}
39
- ```
@@ -1,108 +0,0 @@
1
- import React, { useState } from 'react'
2
- import type { Story } from '@storybook/react'
3
-
4
- import type { RadioGroupProps, RadioOptionProps } from '..'
5
- import RadioGroup from '../RadioGroup'
6
- import RadioOption from '../RadioOption'
7
- import mdx from './RadioGroup.mdx'
8
-
9
- export const RadioGroupSimple: Story<RadioGroupProps & RadioOptionProps> = (
10
- args
11
- ) => {
12
- const [option, setOption] = useState<string | number>('')
13
-
14
- return (
15
- <>
16
- <RadioGroup
17
- {...args}
18
- name="radio-group"
19
- onChange={(v) => {
20
- setOption(v.currentTarget.value)
21
- }}
22
- selectedValue={option}
23
- >
24
- <RadioOption value="radio-1" label="Radio 1">
25
- <span>Radio 1</span>
26
- </RadioOption>
27
- <RadioOption value="radio-2" label="Radio 2">
28
- <span>Radio 2</span>
29
- </RadioOption>
30
- </RadioGroup>
31
- </>
32
- )
33
- }
34
-
35
- export const RadioOptionWithChildren: Story<
36
- RadioGroupProps & RadioOptionProps
37
- > = (args) => {
38
- const [option, setOption] = useState<string | number>('')
39
-
40
- return (
41
- <>
42
- <RadioGroup
43
- {...args}
44
- name="radio-group-with-children"
45
- onChange={(v) => {
46
- setOption(v.currentTarget.value)
47
- }}
48
- selectedValue={option}
49
- >
50
- <RadioOption value="radio-1" label="Radio 1">
51
- <div>Radio 1</div>
52
- </RadioOption>
53
- <RadioOption value="radio-2" label="Radio 2">
54
- <div>Radio 2</div>
55
- </RadioOption>
56
- <RadioOption value="radio-3" label="Radio 3">
57
- <div>Radio 3</div>
58
- </RadioOption>
59
- </RadioGroup>
60
- </>
61
- )
62
- }
63
-
64
- export const RadioGroupControlled: Story<RadioGroupProps & RadioOptionProps> = (
65
- args
66
- ) => {
67
- const [option, setOption] = useState<string | number>('')
68
-
69
- return (
70
- <>
71
- <RadioGroup
72
- {...args}
73
- name="radio-group-controlled"
74
- onChange={(v) => {
75
- setOption(v.currentTarget.value)
76
- }}
77
- selectedValue={option}
78
- >
79
- <RadioOption value="radio-1" label="Radio 1">
80
- <span>Radio 1</span>
81
- </RadioOption>
82
- <RadioOption value="radio-2" label="Radio 2">
83
- <span>Radio 2</span>
84
- </RadioOption>
85
- <RadioOption value="radio-3" label="Radio 3">
86
- <span>Radio 3</span>
87
- </RadioOption>
88
- </RadioGroup>
89
- <br />
90
- <button
91
- onClick={() => {
92
- setOption('radio-3')
93
- }}
94
- >
95
- Check Radio 3
96
- </button>
97
- </>
98
- )
99
- }
100
-
101
- export default {
102
- title: 'Molecules/RadioGroup',
103
- parameters: {
104
- docs: {
105
- page: mdx,
106
- },
107
- },
108
- }
@@ -1,28 +0,0 @@
1
- import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
2
- import SearchInput from '../SearchInput'
3
- import CustomIcon from './assets/CustomIcon'
4
-
5
- # Search Input
6
-
7
- ## Default
8
-
9
- <Canvas>
10
- <Story id="molecules-searchinput--default" />
11
- </Canvas>
12
-
13
- ## With custom icon
14
-
15
- <Canvas>
16
- <Story id="molecules-searchinput--custom-icon" />
17
- </Canvas>
18
-
19
- ## Props
20
-
21
- <ArgsTable of={SearchInput} />
22
-
23
- ## CSS Selectors
24
- ```css
25
- [data-fs-search-input-form] {}
26
- ```
27
-
28
- This component inherits [Input](?path=/docs/atoms-input--input#css-selectors), [Button](?path=/docs/atoms-button--button#css-selectors), [Icon](?path=/docs/atoms-icon--icon#css-selectors) css selectors.
@@ -1,45 +0,0 @@
1
- import type { Story } from '@storybook/react'
2
- import React from 'react'
3
-
4
- import type { SearchInputProps } from '../SearchInput'
5
- import Component from '../SearchInput'
6
- import mdx from './SearchInput.mdx'
7
- import Icon from './assets/CustomIcon'
8
- import type { ComponentArgTypes } from '../../../../typings/utils'
9
-
10
- const DefaultTemplate: Story<SearchInputProps> = ({
11
- onSubmit,
12
- placeholder,
13
- }) => <Component onSubmit={onSubmit} placeholder={placeholder} />
14
-
15
- export const Default = DefaultTemplate.bind({})
16
-
17
- const CustomIconTemplate: Story<SearchInputProps> = ({
18
- onSubmit,
19
- placeholder,
20
- }) => (
21
- <Component icon={<Icon />} onSubmit={onSubmit} placeholder={placeholder} />
22
- )
23
-
24
- export const CustomIcon = CustomIconTemplate.bind({})
25
-
26
- const argTypes: ComponentArgTypes<SearchInputProps> = {
27
- placeholder: {
28
- control: { type: 'text' },
29
- defaultValue: 'Search',
30
- },
31
- onSubmit: {
32
- action: 'SearchInput submitted!',
33
- table: { disable: true },
34
- },
35
- }
36
-
37
- export default {
38
- title: 'Molecules/SearchInput',
39
- argTypes,
40
- parameters: {
41
- docs: {
42
- page: mdx,
43
- },
44
- },
45
- }
@@ -1,22 +0,0 @@
1
- import React from 'react'
2
- import type { FC } from 'react'
3
-
4
- const CustomIcon: FC = () => (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="1em"
8
- height="1em"
9
- viewBox="0 0 24 24"
10
- fill="none"
11
- stroke="currentColor"
12
- strokeWidth="2"
13
- strokeLinecap="round"
14
- strokeLinejoin="round"
15
- >
16
- <circle cx="12" cy="12" r="10" />
17
- <line x1="15" y1="9" x2="9" y2="15" />
18
- <line x1="9" y1="9" x2="15" y2="15" />
19
- </svg>
20
- )
21
-
22
- export default CustomIcon
@@ -1,24 +0,0 @@
1
- import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import SkuSelector from '../SkuSelector'
4
-
5
- # SkuSelector
6
-
7
- <Canvas>
8
- <Story id="molecules-skuselector--sku-selector" />
9
- </Canvas>
10
-
11
- ## Props
12
-
13
- <ArgsTable of={ SkuSelector } />
14
-
15
- ## CSS Selectors
16
-
17
- ```css
18
- [data-fs-sku-selector] {
19
- }
20
- [data-fs-sku-selector-variant='(label|image)'] {
21
- }
22
- [data-fs-sku-selector-title] {
23
- }
24
- ```