@faststore/ui 1.3.40 → 1.3.41
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 +11 -0
- package/dist/atoms/Incentive/Incentive.d.ts +11 -0
- package/dist/atoms/Incentive/index.d.ts +2 -0
- package/dist/atoms/Incentive/stories/Incentive.stories.d.ts +4 -0
- package/dist/atoms/Incentive/stories/assets/Icons.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/ui.cjs.development.js +13 -0
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +13 -1
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/atoms/Incentive/Incentive.test.tsx +36 -0
- package/src/atoms/Incentive/Incentive.tsx +23 -0
- package/src/atoms/Incentive/index.tsx +2 -0
- package/src/atoms/Incentive/stories/Incentive.mdx +24 -0
- package/src/atoms/Incentive/stories/Incentive.stories.tsx +26 -0
- package/src/atoms/Incentive/stories/assets/Icons.tsx +14 -0
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.41",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/jest-axe": "^3.5.3",
|
|
77
77
|
"@types/tabbable": "^3.1.1",
|
|
78
78
|
"@types/testing-library__jest-dom": "^5.9.5",
|
|
79
|
-
"@vtex/theme-b2c-tailwind": "^1.3.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.3.41",
|
|
80
80
|
"@vtex/tsconfig": "^0.5.0",
|
|
81
81
|
"chalk": "^5.0.0",
|
|
82
82
|
"jest-axe": "^5.0.1",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"tsdx": "^0.14.1",
|
|
90
90
|
"typescript": "^4.2.4"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "bb41f6f6a342bab2c79b17562f8007fd245860d6"
|
|
93
93
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { render } from '@testing-library/react'
|
|
2
|
+
import { axe } from 'jest-axe'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import Incentive from './Incentive'
|
|
6
|
+
|
|
7
|
+
const TestIncentive = () => {
|
|
8
|
+
return (
|
|
9
|
+
<Incentive>
|
|
10
|
+
<span>Item title</span>
|
|
11
|
+
<span>Item description</span>
|
|
12
|
+
</Incentive>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
describe('Incentive', () => {
|
|
17
|
+
let incentive: HTMLElement
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
const { getByTestId } = render(<TestIncentive />)
|
|
21
|
+
|
|
22
|
+
incentive = getByTestId('store-incentive')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('Data attributes', () => {
|
|
26
|
+
it('should have `data-store-incentive` attribute', () => {
|
|
27
|
+
expect(incentive).toHaveAttribute('data-store-incentive')
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
describe('Accessibility', () => {
|
|
32
|
+
it('should have no violations', async () => {
|
|
33
|
+
expect(await axe(incentive)).toHaveNoViolations()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface IncentiveProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
7
|
+
* testing-library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Incentive = forwardRef<HTMLDivElement, IncentiveProps>(function Incentive(
|
|
13
|
+
{ testId = 'store-incentive', children, ...otherProps },
|
|
14
|
+
ref
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
<div ref={ref} data-store-incentive data-testid={testId} {...otherProps}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export default Incentive
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
+
|
|
3
|
+
import Incentive from '../Incentive'
|
|
4
|
+
|
|
5
|
+
# Incentive
|
|
6
|
+
|
|
7
|
+
<Canvas>
|
|
8
|
+
<Story id="atoms-incentive--incentive" />
|
|
9
|
+
</Canvas>
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
`Incentive` component support all attributes also supported by the `<div>` tag.
|
|
14
|
+
|
|
15
|
+
Besides those attributes, the following props are also supported:
|
|
16
|
+
|
|
17
|
+
<ArgsTable of={Incentive} />
|
|
18
|
+
|
|
19
|
+
## CSS Selectors
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
[data-store-incentive] {
|
|
23
|
+
}
|
|
24
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Story, Meta } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { SafetyIcon } from './assets/Icons'
|
|
5
|
+
import type { IncentiveProps } from '../Incentive'
|
|
6
|
+
import Component from '../Incentive'
|
|
7
|
+
import mdx from './Incentive.mdx'
|
|
8
|
+
|
|
9
|
+
const IncentiveTemplate: Story<IncentiveProps> = ({ testId }) => (
|
|
10
|
+
<Component testId={testId}>
|
|
11
|
+
<SafetyIcon />
|
|
12
|
+
<span>Trusted by SafeCompany</span>
|
|
13
|
+
</Component>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
export const Incentive = IncentiveTemplate.bind({})
|
|
17
|
+
Incentive.storyName = 'Incentive'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Atoms/Incentive',
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
page: mdx,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} as Meta
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export function SafetyIcon() {
|
|
4
|
+
return (
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="35" height="35" fill="none">
|
|
6
|
+
<path
|
|
7
|
+
fillRule="evenodd"
|
|
8
|
+
clipRule="evenodd"
|
|
9
|
+
d="M6 7h20v7c0 10-8 14-10 14S6 24 6 14V7Zm0-2a2 2 0 0 0-2 2v7c0 11 10 15 11 16h2c1-1 11-5 11-16V7a2 2 0 0 0-2-2H6Zm16 9a1 1 0 0 0-1-2l-7 7-3-3a1 1 0 0 0-1 1l4 4h1l7-7Z"
|
|
10
|
+
fill="#323845"
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
13
|
+
)
|
|
14
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -50,6 +50,9 @@ export type { SpinnerProps } from './atoms/Spinner'
|
|
|
50
50
|
export { default as Label } from './atoms/Label'
|
|
51
51
|
export type { LabelProps } from './atoms/Label'
|
|
52
52
|
|
|
53
|
+
export { default as Incentive } from './atoms/Incentive'
|
|
54
|
+
export type { IncentiveProps } from './atoms/Incentive'
|
|
55
|
+
|
|
53
56
|
// Molecules
|
|
54
57
|
export { default as Bullets } from './molecules/Bullets'
|
|
55
58
|
export type { BulletsProps } from './molecules/Bullets'
|