@faststore/ui 1.4.3 → 1.4.4
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/ui.cjs.development.js +24 -25
- 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 +24 -25
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/atoms/List/List.test.tsx +21 -2
- package/src/atoms/List/List.tsx +1 -2
- package/src/atoms/List/stories/List.mdx +2 -11
- package/src/atoms/Slider/Slider.tsx +3 -3
- package/src/atoms/Slider/stories/Slider.mdx +2 -2
- package/src/molecules/Accordion/Accordion.test.tsx +6 -6
- package/src/molecules/Accordion/AccordionButton.tsx +1 -1
- package/src/molecules/Accordion/AccordionItem.tsx +1 -6
- package/src/molecules/Accordion/AccordionPanel.tsx +1 -1
- package/src/molecules/Accordion/stories/Accordion.mdx +3 -3
- package/src/molecules/Banner/Banner.test.tsx +6 -6
- package/src/molecules/Banner/BannerContent.tsx +1 -6
- package/src/molecules/Banner/BannerImage.tsx +1 -6
- package/src/molecules/Banner/BannerLink.tsx +1 -6
- package/src/molecules/Banner/stories/Banner.mdx +4 -4
- package/src/molecules/Breadcrumb/Breadcrumb.test.tsx +12 -7
- package/src/molecules/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/molecules/Breadcrumb/stories/Breadcrumb.mdx +4 -2
- package/src/molecules/PriceRange/PriceRange.tsx +3 -3
- package/src/molecules/PriceRange/stories/PriceRange.mdx +2 -2
- package/src/molecules/Table/Table.test.tsx +7 -11
- package/src/molecules/Table/TableBody.tsx +1 -6
- package/src/molecules/Table/TableCell.tsx +1 -1
- package/src/molecules/Table/TableFooter.tsx +1 -6
- package/src/molecules/Table/TableHead.tsx +1 -6
- package/src/molecules/Table/TableRow.tsx +1 -1
- package/src/molecules/Table/stories/Table.mdx +5 -7
- package/src/organisms/Card/Card.test.tsx +6 -6
- package/src/organisms/Card/CardActions.tsx +1 -6
- package/src/organisms/Card/CardContent.tsx +1 -6
- package/src/organisms/Card/CardImage.tsx +1 -1
- package/src/organisms/Card/stories/Card.mdx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
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.4.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.4.4",
|
|
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": "2339f4106d82d03eff65576a0830d8a8d1657182"
|
|
93
93
|
}
|
|
@@ -34,7 +34,10 @@ describe('List', () => {
|
|
|
34
34
|
</List>
|
|
35
35
|
)
|
|
36
36
|
|
|
37
|
-
expect(getByTestId('store-list')).toHaveAttribute(
|
|
37
|
+
expect(getByTestId('store-list')).toHaveAttribute(
|
|
38
|
+
'data-store-list',
|
|
39
|
+
'ordered'
|
|
40
|
+
)
|
|
38
41
|
|
|
39
42
|
rerender(
|
|
40
43
|
<List variant="unordered">
|
|
@@ -44,7 +47,23 @@ describe('List', () => {
|
|
|
44
47
|
</List>
|
|
45
48
|
)
|
|
46
49
|
|
|
47
|
-
expect(getByTestId('store-list')).toHaveAttribute(
|
|
50
|
+
expect(getByTestId('store-list')).toHaveAttribute(
|
|
51
|
+
'data-store-list',
|
|
52
|
+
'unordered'
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
rerender(
|
|
56
|
+
<List variant="description">
|
|
57
|
+
{optionsArray.map((value) => {
|
|
58
|
+
return <li key={value}>{value}</li>
|
|
59
|
+
})}
|
|
60
|
+
</List>
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
expect(getByTestId('store-list')).toHaveAttribute(
|
|
64
|
+
'data-store-list',
|
|
65
|
+
'description'
|
|
66
|
+
)
|
|
48
67
|
})
|
|
49
68
|
|
|
50
69
|
it('should render the expected HTML tag for each variant', () => {
|
package/src/atoms/List/List.tsx
CHANGED
|
@@ -27,8 +27,7 @@ const List = forwardRef<HTMLUListElement, ListProps>(function List(
|
|
|
27
27
|
) {
|
|
28
28
|
const dataAttributes = {
|
|
29
29
|
'data-testid': testId,
|
|
30
|
-
'data-store-list':
|
|
31
|
-
[`data-${variant}`]: true,
|
|
30
|
+
'data-store-list': variant,
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
const Component = MaybeComponent ?? variantToElement[variant] ?? 'ul'
|
|
@@ -28,15 +28,6 @@ import List from '../List'
|
|
|
28
28
|
## CSS Selectors
|
|
29
29
|
|
|
30
30
|
```css
|
|
31
|
-
[data-store-list] {
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[data-store-list][data-unordered] {
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[data-store-list][data-ordered] {
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[data-store-list][data-description] {
|
|
41
|
-
}
|
|
31
|
+
[data-store-list] {}
|
|
32
|
+
[data-store-list='(description|ordered|unordered)'] {}
|
|
42
33
|
```
|
|
@@ -80,7 +80,7 @@ const Slider = ({
|
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<div data-store-slider data-testid={testId} className={className}>
|
|
83
|
-
<div ref={range} data-
|
|
83
|
+
<div ref={range} data-slider-range />
|
|
84
84
|
<input
|
|
85
85
|
type="range"
|
|
86
86
|
min={min}
|
|
@@ -92,7 +92,7 @@ const Slider = ({
|
|
|
92
92
|
setMinVal(value)
|
|
93
93
|
minValRef.current = value
|
|
94
94
|
}}
|
|
95
|
-
data-
|
|
95
|
+
data-slider-thumb="left"
|
|
96
96
|
aria-valuemin={min}
|
|
97
97
|
aria-valuemax={max}
|
|
98
98
|
aria-valuenow={minVal}
|
|
@@ -112,7 +112,7 @@ const Slider = ({
|
|
|
112
112
|
setMaxVal(value)
|
|
113
113
|
maxValRef.current = value
|
|
114
114
|
}}
|
|
115
|
-
data-
|
|
115
|
+
data-slider-thumb="right"
|
|
116
116
|
aria-valuemin={min}
|
|
117
117
|
aria-valuemax={max}
|
|
118
118
|
aria-valuenow={maxVal}
|
|
@@ -99,21 +99,21 @@ describe('Accordion', () => {
|
|
|
99
99
|
expect(accordion).toHaveAttribute('data-store-accordion')
|
|
100
100
|
})
|
|
101
101
|
|
|
102
|
-
it('`AccordionItem` component should have `data-
|
|
102
|
+
it('`AccordionItem` component should have `data-accordion-item` attribute', () => {
|
|
103
103
|
for (const item of items) {
|
|
104
|
-
expect(item).toHaveAttribute('data-
|
|
104
|
+
expect(item).toHaveAttribute('data-accordion-item')
|
|
105
105
|
}
|
|
106
106
|
})
|
|
107
107
|
|
|
108
|
-
it('`AccordionButton` component should have `data-
|
|
108
|
+
it('`AccordionButton` component should have `data-accordion-button` attribute', () => {
|
|
109
109
|
for (const button of buttons) {
|
|
110
|
-
expect(button).toHaveAttribute('data-
|
|
110
|
+
expect(button).toHaveAttribute('data-accordion-button')
|
|
111
111
|
}
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
-
it('`AccordionPanel` component should have `data-
|
|
114
|
+
it('`AccordionPanel` component should have `data-accordion-panel` attribute', () => {
|
|
115
115
|
for (const panel of panels) {
|
|
116
|
-
expect(panel).toHaveAttribute('data-
|
|
116
|
+
expect(panel).toHaveAttribute('data-accordion-panel')
|
|
117
117
|
}
|
|
118
118
|
})
|
|
119
119
|
})
|
|
@@ -60,7 +60,7 @@ const AccordionButton = forwardRef<HTMLButtonElement, AccordionButtonProps>(
|
|
|
60
60
|
id={button}
|
|
61
61
|
aria-expanded={indices.has(index)}
|
|
62
62
|
aria-controls={panel}
|
|
63
|
-
data-
|
|
63
|
+
data-accordion-button
|
|
64
64
|
data-testid={testId}
|
|
65
65
|
onKeyDown={onKeyDown}
|
|
66
66
|
onClick={() => {
|
|
@@ -36,12 +36,7 @@ const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(
|
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<AccordionItemContext.Provider value={context}>
|
|
39
|
-
<div
|
|
40
|
-
ref={ref}
|
|
41
|
-
data-store-accordion-item
|
|
42
|
-
data-testid={testId}
|
|
43
|
-
{...otherProps}
|
|
44
|
-
>
|
|
39
|
+
<div ref={ref} data-accordion-item data-testid={testId} {...otherProps}>
|
|
45
40
|
{children}
|
|
46
41
|
</div>
|
|
47
42
|
</AccordionItemContext.Provider>
|
|
@@ -54,9 +54,9 @@ Besides those attributes, the following props are also supported:
|
|
|
54
54
|
|
|
55
55
|
```css
|
|
56
56
|
[data-store-accordion] {}
|
|
57
|
-
[data-
|
|
58
|
-
[data-
|
|
59
|
-
[data-
|
|
57
|
+
[data-accordion-item] {}
|
|
58
|
+
[data-accordion-button] {}
|
|
59
|
+
[data-accordion-panel] {}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
The `AccordionButton` component inherits [Button](?path=/docs/atoms-button--button#css-selectors) css selectors.
|
|
@@ -40,16 +40,16 @@ describe('Banner', () => {
|
|
|
40
40
|
expect(banner).toHaveAttribute('data-store-banner')
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
it('`BannerImage` component should have `data-
|
|
44
|
-
expect(bannerImage).toHaveAttribute('data-
|
|
43
|
+
it('`BannerImage` component should have `data-banner-image` attribute', () => {
|
|
44
|
+
expect(bannerImage).toHaveAttribute('data-banner-image')
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
it('`BannerContent` component should have `data-
|
|
48
|
-
expect(bannerContent).toHaveAttribute('data-
|
|
47
|
+
it('`BannerContent` component should have `data-banner-content` attribute', () => {
|
|
48
|
+
expect(bannerContent).toHaveAttribute('data-banner-content')
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
it('`BannerLink` component should have `data-
|
|
52
|
-
expect(bannerLink).toHaveAttribute('data-
|
|
51
|
+
it('`BannerLink` component should have `data-banner-link` attribute', () => {
|
|
52
|
+
expect(bannerLink).toHaveAttribute('data-banner-link')
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
55
|
|
|
@@ -14,12 +14,7 @@ const BannerContent = forwardRef<HTMLDivElement, BannerContentProps>(
|
|
|
14
14
|
ref
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
<div
|
|
18
|
-
ref={ref}
|
|
19
|
-
data-store-banner-content
|
|
20
|
-
data-testid={testId}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
>
|
|
17
|
+
<div ref={ref} data-banner-content data-testid={testId} {...otherProps}>
|
|
23
18
|
{children}
|
|
24
19
|
</div>
|
|
25
20
|
)
|
|
@@ -14,12 +14,7 @@ const BannerImage = forwardRef<HTMLDivElement, BannerImageProps>(
|
|
|
14
14
|
ref
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
<div
|
|
18
|
-
ref={ref}
|
|
19
|
-
data-store-banner-image
|
|
20
|
-
data-testid={testId}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
>
|
|
17
|
+
<div ref={ref} data-banner-image data-testid={testId} {...otherProps}>
|
|
23
18
|
{children}
|
|
24
19
|
</div>
|
|
25
20
|
)
|
|
@@ -14,12 +14,7 @@ const BannerLink = forwardRef<HTMLDivElement, BannerLinkProps>(
|
|
|
14
14
|
ref
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
<div
|
|
18
|
-
ref={ref}
|
|
19
|
-
data-store-banner-link
|
|
20
|
-
data-testid={testId}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
>
|
|
17
|
+
<div ref={ref} data-banner-link data-testid={testId} {...otherProps}>
|
|
23
18
|
{children}
|
|
24
19
|
</div>
|
|
25
20
|
)
|
|
@@ -52,12 +52,12 @@ Besides those attributes, the following props are also supported:
|
|
|
52
52
|
```css
|
|
53
53
|
[data-store-banner] {
|
|
54
54
|
}
|
|
55
|
-
[data-store-banner=(
|
|
55
|
+
[data-store-banner='(vertical|horizontal)'] {
|
|
56
56
|
}
|
|
57
|
-
[data-
|
|
57
|
+
[data-banner-image] {
|
|
58
58
|
}
|
|
59
|
-
[data-
|
|
59
|
+
[data-banner-content] {
|
|
60
60
|
}
|
|
61
|
-
[data-
|
|
61
|
+
[data-banner-link] {
|
|
62
62
|
}
|
|
63
63
|
```
|
|
@@ -38,19 +38,24 @@ describe('Breadcrumb', () => {
|
|
|
38
38
|
|
|
39
39
|
// Validate that breadcrumb is rendering with the correct size.
|
|
40
40
|
expect(breadcrumbItems).toHaveLength(breadcrumbSize)
|
|
41
|
-
// Validate if the last element has the active attribute.
|
|
41
|
+
// Validate if the last element has the 'data-breadcrumb-item=current' active attribute.
|
|
42
42
|
expect(breadcrumbItems[breadcrumbSize - 1]).toHaveAttribute(
|
|
43
|
-
'data-
|
|
43
|
+
'data-breadcrumb-item',
|
|
44
|
+
'current'
|
|
44
45
|
)
|
|
45
46
|
|
|
46
47
|
// Get all elements except the last one.
|
|
47
48
|
breadcrumbItems.pop()
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
// Validate that no other element has the 'data-breadcrumb-item=current' attribute
|
|
51
|
+
breadcrumbItems.forEach((item) => {
|
|
52
|
+
expect(item).not.toHaveAttribute('data-breadcrumb-item', 'current')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
// Validate that all elements have the 'data-breadcrumb-item' attribute,
|
|
56
|
+
// regardless of value
|
|
49
57
|
breadcrumbItems.forEach((item) => {
|
|
50
|
-
expect(item).
|
|
51
|
-
'data-store-breadcrumb-item',
|
|
52
|
-
'current'
|
|
53
|
-
)
|
|
58
|
+
expect(item).toHaveAttribute('data-breadcrumb-item')
|
|
54
59
|
})
|
|
55
60
|
}
|
|
56
61
|
})
|
|
@@ -16,7 +16,7 @@ export interface BreadcrumbProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
|
|
17
17
|
const Divider: FC<BreadcrumbProps> = ({ divider, testId }) => {
|
|
18
18
|
const props = {
|
|
19
|
-
'data-
|
|
19
|
+
'data-breadcrumb-divider': true,
|
|
20
20
|
'aria-hidden': true,
|
|
21
21
|
'data-testid': `${testId}-divider`,
|
|
22
22
|
}
|
|
@@ -37,7 +37,7 @@ type ListItemProps = {
|
|
|
37
37
|
const ListItem: FC<ListItemProps> = ({ children, isLastItem, testId }) => {
|
|
38
38
|
const props = {
|
|
39
39
|
'data-testid': `${testId}-item`,
|
|
40
|
-
'data-
|
|
40
|
+
'data-breadcrumb-item': isLastItem ? 'current' : true,
|
|
41
41
|
'aria-current': isLastItem ? ('page' as const) : undefined,
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -73,7 +73,7 @@ const Breadcrumb = forwardRef<HTMLDivElement, BreadcrumbProps>(
|
|
|
73
73
|
data-testid={testId}
|
|
74
74
|
{...otherProps}
|
|
75
75
|
>
|
|
76
|
-
<List data-
|
|
76
|
+
<List data-breadcrumb-list variant="ordered">
|
|
77
77
|
{React.Children.map(children, (child, index) => {
|
|
78
78
|
const isLastItem = index === lastIndex - 1
|
|
79
79
|
|
|
@@ -17,7 +17,9 @@ import Breadcrumb from '../Breadcrumb'
|
|
|
17
17
|
```css
|
|
18
18
|
[data-store-breadcrumb] {}
|
|
19
19
|
|
|
20
|
-
[data-breadcrumb-
|
|
20
|
+
[data-breadcrumb-list] {}
|
|
21
21
|
|
|
22
|
-
[data-breadcrumb-item
|
|
22
|
+
[data-breadcrumb-item='(current|true)'] {}
|
|
23
|
+
|
|
24
|
+
[data-breadcrumb-divider] {}
|
|
23
25
|
```
|
|
@@ -58,16 +58,16 @@ const PriceRange = ({
|
|
|
58
58
|
onChange={handleChange}
|
|
59
59
|
aria-label={ariaLabel}
|
|
60
60
|
/>
|
|
61
|
-
<div data-
|
|
61
|
+
<div data-price-range-values>
|
|
62
62
|
<Price
|
|
63
63
|
formatter={formatter}
|
|
64
|
-
data-
|
|
64
|
+
data-price-range-value="min"
|
|
65
65
|
value={minVal}
|
|
66
66
|
variant={variant}
|
|
67
67
|
/>
|
|
68
68
|
<Price
|
|
69
69
|
formatter={formatter}
|
|
70
|
-
data-
|
|
70
|
+
data-price-range-value="max"
|
|
71
71
|
value={maxVal}
|
|
72
72
|
variant={variant}
|
|
73
73
|
/>
|
|
@@ -17,9 +17,9 @@ import PriceRange from '../PriceRange'
|
|
|
17
17
|
```css
|
|
18
18
|
[data-store-price-range] {
|
|
19
19
|
}
|
|
20
|
-
[data-
|
|
20
|
+
[data-price-range-values] {
|
|
21
21
|
}
|
|
22
|
-
[data-
|
|
22
|
+
[data-price-range-value='(min|max)'] {
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -45,21 +45,21 @@ describe('Table', () => {
|
|
|
45
45
|
|
|
46
46
|
const tableHead = getByTestId('store-table-head')
|
|
47
47
|
|
|
48
|
-
expect(tableHead).toHaveAttribute('data-
|
|
48
|
+
expect(tableHead).toHaveAttribute('data-table-head')
|
|
49
49
|
|
|
50
50
|
const tableBody = getByTestId('store-table-body')
|
|
51
51
|
|
|
52
|
-
expect(tableBody).toHaveAttribute('data-
|
|
52
|
+
expect(tableBody).toHaveAttribute('data-table-body')
|
|
53
53
|
|
|
54
54
|
const tableFooter = getByTestId('store-table-footer')
|
|
55
55
|
|
|
56
|
-
expect(tableFooter).toHaveAttribute('data-
|
|
56
|
+
expect(tableFooter).toHaveAttribute('data-table-footer')
|
|
57
57
|
|
|
58
58
|
const tableRows = queryAllByTestId('store-table-row')
|
|
59
59
|
|
|
60
60
|
expect(tableRows).toHaveLength(4)
|
|
61
61
|
tableRows.forEach((row) => {
|
|
62
|
-
expect(row).toHaveAttribute('data-
|
|
62
|
+
expect(row).toHaveAttribute('data-table-row')
|
|
63
63
|
})
|
|
64
64
|
|
|
65
65
|
const tableCells = queryAllByTestId('store-table-cell')
|
|
@@ -68,17 +68,13 @@ describe('Table', () => {
|
|
|
68
68
|
// data-store-table-cell attribute.
|
|
69
69
|
expect(tableCells).toHaveLength(8)
|
|
70
70
|
tableCells.forEach((row) => {
|
|
71
|
-
expect(row).toHaveAttribute('data-
|
|
71
|
+
expect(row).toHaveAttribute('data-table-cell')
|
|
72
72
|
})
|
|
73
73
|
|
|
74
74
|
// Make sure that 2 header cells and 6 data cells were rendered, with their
|
|
75
75
|
// corresponding attributes.
|
|
76
|
-
expect(
|
|
77
|
-
|
|
78
|
-
).toHaveLength(2)
|
|
79
|
-
expect(
|
|
80
|
-
table.querySelectorAll('[data-store-table-cell=data]')
|
|
81
|
-
).toHaveLength(6)
|
|
76
|
+
expect(table.querySelectorAll('[data-table-cell=header]')).toHaveLength(2)
|
|
77
|
+
expect(table.querySelectorAll('[data-table-cell=data]')).toHaveLength(6)
|
|
82
78
|
})
|
|
83
79
|
})
|
|
84
80
|
|
|
@@ -16,12 +16,7 @@ const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(
|
|
|
16
16
|
ref
|
|
17
17
|
) {
|
|
18
18
|
return (
|
|
19
|
-
<tbody
|
|
20
|
-
ref={ref}
|
|
21
|
-
data-testid={testId}
|
|
22
|
-
data-store-table-body
|
|
23
|
-
{...otherProps}
|
|
24
|
-
>
|
|
19
|
+
<tbody ref={ref} data-testid={testId} data-table-body {...otherProps}>
|
|
25
20
|
{children}
|
|
26
21
|
</tbody>
|
|
27
22
|
)
|
|
@@ -16,12 +16,7 @@ const TableFooter = forwardRef<HTMLTableSectionElement, TableFooterProps>(
|
|
|
16
16
|
ref
|
|
17
17
|
) {
|
|
18
18
|
return (
|
|
19
|
-
<tfoot
|
|
20
|
-
ref={ref}
|
|
21
|
-
data-testid={testId}
|
|
22
|
-
data-store-table-footer
|
|
23
|
-
{...otherProps}
|
|
24
|
-
>
|
|
19
|
+
<tfoot ref={ref} data-testid={testId} data-table-footer {...otherProps}>
|
|
25
20
|
{children}
|
|
26
21
|
</tfoot>
|
|
27
22
|
)
|
|
@@ -16,12 +16,7 @@ const TableHead = forwardRef<HTMLTableSectionElement, TableHeadProps>(
|
|
|
16
16
|
ref
|
|
17
17
|
) {
|
|
18
18
|
return (
|
|
19
|
-
<thead
|
|
20
|
-
ref={ref}
|
|
21
|
-
data-testid={testId}
|
|
22
|
-
data-store-table-head
|
|
23
|
-
{...otherProps}
|
|
24
|
-
>
|
|
19
|
+
<thead ref={ref} data-testid={testId} data-table-head {...otherProps}>
|
|
25
20
|
{children}
|
|
26
21
|
</thead>
|
|
27
22
|
)
|
|
@@ -15,7 +15,7 @@ const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
|
15
15
|
ref
|
|
16
16
|
) {
|
|
17
17
|
return (
|
|
18
|
-
<tr ref={ref} data-
|
|
18
|
+
<tr ref={ref} data-table-row data-testid={testId} {...otherProps}>
|
|
19
19
|
{children}
|
|
20
20
|
</tr>
|
|
21
21
|
)
|
|
@@ -59,15 +59,13 @@ Besides those attributes, the following props are also supported:
|
|
|
59
59
|
```css
|
|
60
60
|
[data-store-table] {}
|
|
61
61
|
|
|
62
|
-
[data-
|
|
62
|
+
[data-table-head] {}
|
|
63
63
|
|
|
64
|
-
[data-
|
|
64
|
+
[data-table-row] {}
|
|
65
65
|
|
|
66
|
-
[data-
|
|
66
|
+
[data-table-footer] {}
|
|
67
67
|
|
|
68
|
-
[data-
|
|
68
|
+
[data-table-body] {}
|
|
69
69
|
|
|
70
|
-
[data-
|
|
71
|
-
|
|
72
|
-
[data-store-table-cell='data'] {}
|
|
70
|
+
[data-table-cell='(head|data)'] {}
|
|
73
71
|
```
|
|
@@ -47,16 +47,16 @@ describe('Card', () => {
|
|
|
47
47
|
expect(card).toHaveAttribute('data-store-card')
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
it('`CardContent` component should have `data-
|
|
51
|
-
expect(cardContent).toHaveAttribute('data-
|
|
50
|
+
it('`CardContent` component should have `data-card-content` attribute', () => {
|
|
51
|
+
expect(cardContent).toHaveAttribute('data-card-content')
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
it('`CardImage` component should have `data-
|
|
55
|
-
expect(cardImage).toHaveAttribute('data-
|
|
54
|
+
it('`CardImage` component should have `data-card-image` attribute', () => {
|
|
55
|
+
expect(cardImage).toHaveAttribute('data-card-image')
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
it('`CardActions` component should have `data-
|
|
59
|
-
expect(cardActions).toHaveAttribute('data-
|
|
58
|
+
it('`CardActions` component should have `data-card-actions` attribute', () => {
|
|
59
|
+
expect(cardActions).toHaveAttribute('data-card-actions')
|
|
60
60
|
})
|
|
61
61
|
})
|
|
62
62
|
|
|
@@ -14,12 +14,7 @@ const CardActions = forwardRef<HTMLDivElement, CardActionsProps>(
|
|
|
14
14
|
ref
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
<div
|
|
18
|
-
ref={ref}
|
|
19
|
-
data-store-card-actions
|
|
20
|
-
data-testid={testId}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
>
|
|
17
|
+
<div ref={ref} data-card-actions data-testid={testId} {...otherProps}>
|
|
23
18
|
{children}
|
|
24
19
|
</div>
|
|
25
20
|
)
|
|
@@ -14,12 +14,7 @@ const CardContent = forwardRef<HTMLElement, CardContentProps>(
|
|
|
14
14
|
ref
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
<section
|
|
18
|
-
ref={ref}
|
|
19
|
-
data-store-card-content
|
|
20
|
-
data-testid={testId}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
>
|
|
17
|
+
<section ref={ref} data-card-content data-testid={testId} {...otherProps}>
|
|
23
18
|
{children}
|
|
24
19
|
</section>
|
|
25
20
|
)
|
|
@@ -13,7 +13,7 @@ const CardImage = forwardRef<HTMLDivElement, CardImageProps>(function CardImage(
|
|
|
13
13
|
ref
|
|
14
14
|
) {
|
|
15
15
|
return (
|
|
16
|
-
<div ref={ref} data-
|
|
16
|
+
<div ref={ref} data-card-image data-testid={testId} {...otherProps}>
|
|
17
17
|
{children}
|
|
18
18
|
</div>
|
|
19
19
|
)
|
|
@@ -45,10 +45,10 @@ All Card-related components support all attributes also supported by the `<div>`
|
|
|
45
45
|
```css
|
|
46
46
|
[data-store-card] {
|
|
47
47
|
}
|
|
48
|
-
[data-
|
|
48
|
+
[data-card-image] {
|
|
49
49
|
}
|
|
50
|
-
[data-
|
|
50
|
+
[data-card-content] {
|
|
51
51
|
}
|
|
52
|
-
[data-
|
|
52
|
+
[data-card-actions] {
|
|
53
53
|
}
|
|
54
54
|
```
|