@fvc/empty 1.1.1 → 1.1.2-next-ec65dfb844e6183b3d7f417eee613cfe5ecfd997
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/README.md +131 -0
- package/package.json +11 -1
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @fvc/empty
|
|
2
|
+
|
|
3
|
+
`@fvc/empty` provides a FE-VIS empty state primitive on top of Ant Design Empty. It exposes the full Ant Design Empty API with a consistent CSS prefix and `testId` support, and re-exports the preset image constants for use in consuming applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @fvc/empty
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun add react antd
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Import
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Empty } from '@fvc/empty';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Empty } from '@fvc/empty';
|
|
27
|
+
|
|
28
|
+
export function NoResults() {
|
|
29
|
+
return <Empty description="No records found" />;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Common Usage
|
|
34
|
+
|
|
35
|
+
### Default Empty State
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Empty />
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Custom Description
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<Empty description="No data available for the selected period" />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Simple Image
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="Nothing here" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### With Action
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<Empty description="No records found">
|
|
57
|
+
<Button type="primary" onClick={handleCreate}>
|
|
58
|
+
Create record
|
|
59
|
+
</Button>
|
|
60
|
+
</Empty>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### No Description
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
<Empty description={false} />
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Custom Image
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Empty
|
|
73
|
+
image="https://example.com/custom-empty.svg"
|
|
74
|
+
imageStyle={{ height: 80 }}
|
|
75
|
+
description="No results"
|
|
76
|
+
/>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Props
|
|
80
|
+
|
|
81
|
+
| Prop | Type | Description |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `testId` | `string` | Maps to `data-testid`. |
|
|
84
|
+
| *All `EmptyProps`* | — | All Ant Design Empty props (`description`, `image`, `imageStyle`, `children`, etc.). |
|
|
85
|
+
|
|
86
|
+
### Static Properties
|
|
87
|
+
|
|
88
|
+
| Property | Description |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `Empty.PRESENTED_IMAGE_DEFAULT` | Default Ant Design empty illustration. |
|
|
91
|
+
| `Empty.PRESENTED_IMAGE_SIMPLE` | Simplified Ant Design empty illustration. |
|
|
92
|
+
|
|
93
|
+
## Consumer Example
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { Empty } from '@fvc/empty';
|
|
97
|
+
import { Button } from '@fvc/button';
|
|
98
|
+
|
|
99
|
+
export function EmptyTable({ onAdd }: { onAdd: () => void }) {
|
|
100
|
+
return (
|
|
101
|
+
<Empty
|
|
102
|
+
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
|
103
|
+
description="No records found"
|
|
104
|
+
testId="table-empty-state"
|
|
105
|
+
>
|
|
106
|
+
<Button type="primary" onClick={onAdd}>
|
|
107
|
+
Add record
|
|
108
|
+
</Button>
|
|
109
|
+
</Empty>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Testing
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
<Empty description="No data" testId="empty-state" />
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
screen.getByTestId('empty-state');
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
bun run lint
|
|
128
|
+
bun run type-check
|
|
129
|
+
bun run test
|
|
130
|
+
bun run build
|
|
131
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fvc/empty",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2-next-ec65dfb844e6183b3d7f417eee613cfe5ecfd997",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"react",
|
|
6
|
+
"react-component",
|
|
7
|
+
"fvc",
|
|
8
|
+
"fe-vis-core",
|
|
9
|
+
"ui",
|
|
10
|
+
"empty",
|
|
11
|
+
"design-system",
|
|
12
|
+
"antd"
|
|
13
|
+
],
|
|
4
14
|
"main": "./dist/lib/index.js",
|
|
5
15
|
"types": "./dist/lib/empty/src/index.d.ts",
|
|
6
16
|
"files": [
|