@faststore/ui 1.7.14 → 1.7.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 +24 -0
- package/dist/molecules/Banner/Banner.d.ts +3 -2
- package/dist/ui.cjs.development.js +8 -6
- 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 +8 -6
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/molecules/Banner/Banner.test.tsx +5 -1
- package/src/molecules/Banner/Banner.tsx +14 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.17",
|
|
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.7.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.7.17",
|
|
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": "2222d222cbdd4854ebc56b691ff3e8508b82efe7"
|
|
93
93
|
}
|
|
@@ -9,7 +9,7 @@ import BannerLink from './BannerLink'
|
|
|
9
9
|
|
|
10
10
|
const BannerTest = () => {
|
|
11
11
|
return (
|
|
12
|
-
<Banner>
|
|
12
|
+
<Banner data-custom-attribute>
|
|
13
13
|
<BannerImage>
|
|
14
14
|
<img
|
|
15
15
|
alt="A person with hands on the pocket, carrying a round straw bag"
|
|
@@ -40,6 +40,10 @@ describe('Banner', () => {
|
|
|
40
40
|
expect(banner).toHaveAttribute('data-store-banner')
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
+
it('`Banner` component should have custom data attribute `data-custom-attribute`', () => {
|
|
44
|
+
expect(banner).toHaveAttribute('data-custom-attribute')
|
|
45
|
+
})
|
|
46
|
+
|
|
43
47
|
it('`BannerImage` component should have `data-banner-image` attribute', () => {
|
|
44
48
|
expect(bannerImage).toHaveAttribute('data-banner-image')
|
|
45
49
|
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
2
3
|
|
|
3
4
|
type BannerDirectionVariant = 'vertical' | 'horizontal'
|
|
4
|
-
export interface BannerProps {
|
|
5
|
+
export interface BannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
6
|
/**
|
|
6
7
|
* ID to find this component in testing tools (e.g.: cypress,
|
|
7
8
|
* testing-library, and jest).
|
|
@@ -11,16 +12,20 @@ export interface BannerProps {
|
|
|
11
12
|
variant?: BannerDirectionVariant
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const Banner = (
|
|
15
|
-
testId = 'store-banner',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}: BannerProps) => {
|
|
15
|
+
const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(
|
|
16
|
+
{ testId = 'store-banner', children, variant = 'vertical', ...otherProps },
|
|
17
|
+
ref
|
|
18
|
+
) {
|
|
19
19
|
return (
|
|
20
|
-
<article
|
|
20
|
+
<article
|
|
21
|
+
ref={ref}
|
|
22
|
+
data-store-banner={variant}
|
|
23
|
+
data-testid={testId}
|
|
24
|
+
{...otherProps}
|
|
25
|
+
>
|
|
21
26
|
{children}
|
|
22
27
|
</article>
|
|
23
28
|
)
|
|
24
|
-
}
|
|
29
|
+
})
|
|
25
30
|
|
|
26
31
|
export default Banner
|