@aozi6666/bee-design 0.2.3 → 0.2.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/README.md +147 -0
- package/package.json +22 -1
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# @aozi6666/bee-design
|
|
2
|
+
|
|
3
|
+
A **React** UI component library written in **TypeScript**. It ships **ESM**, **CommonJS**, and **UMD** builds plus a single compiled **CSS** entry for quick integration.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@aozi6666/bee-design)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **React 18 / 19** as peer dependencies
|
|
11
|
+
- **Tree-friendly** named exports
|
|
12
|
+
- **Font Awesome**-based `Icon` with a one-time `setupIcons()` registration
|
|
13
|
+
- **Compound `Menu`** API (`Menu.Item`, `Menu.SubMenu`)
|
|
14
|
+
- **Styles** distributed as `@aozi6666/bee-design/style.css`
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @aozi6666/bee-design
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add @aozi6666/bee-design
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @aozi6666/bee-design
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Peer dependencies
|
|
31
|
+
|
|
32
|
+
Install React in your app (versions **18** or **19**):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install react react-dom
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The package also depends on runtime libraries such as **axios**, **classnames**, **lodash**, and **react-transition-group**; they are installed automatically with the package. Icons use **Font Awesome** packages listed in `dependencies`.
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
### 1. Import styles once
|
|
43
|
+
|
|
44
|
+
In your app entry (e.g. `main.tsx` or `App.tsx`):
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import "@aozi6666/bee-design/style.css";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Register Font Awesome icons (recommended)
|
|
51
|
+
|
|
52
|
+
Call `setupIcons()` once at startup so `Icon` can resolve solid icons from `@fortawesome/free-solid-svg-icons`:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { setupIcons } from "@aozi6666/bee-design";
|
|
56
|
+
|
|
57
|
+
setupIcons();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 3. Use components
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import {
|
|
64
|
+
Button,
|
|
65
|
+
Input,
|
|
66
|
+
Menu,
|
|
67
|
+
AutoComplete,
|
|
68
|
+
Icon,
|
|
69
|
+
Progress,
|
|
70
|
+
Transition,
|
|
71
|
+
Upload,
|
|
72
|
+
} from "@aozi6666/bee-design";
|
|
73
|
+
|
|
74
|
+
function App() {
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<Button btnType="primary" size="lg">
|
|
78
|
+
Primary
|
|
79
|
+
</Button>
|
|
80
|
+
|
|
81
|
+
<Menu defaultIndex="0" mode="horizontal" onSelect={(index) => console.log(index)}>
|
|
82
|
+
<Menu.Item index="0">Home</Menu.Item>
|
|
83
|
+
<Menu.SubMenu title="Products">
|
|
84
|
+
<Menu.Item index="2-1">Item A</Menu.Item>
|
|
85
|
+
<Menu.Item index="2-2">Item B</Menu.Item>
|
|
86
|
+
</Menu.SubMenu>
|
|
87
|
+
</Menu>
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Exports
|
|
94
|
+
|
|
95
|
+
| Export | Description |
|
|
96
|
+
| -------------- | ---------------------------------------------------------------------------------- |
|
|
97
|
+
| `Button` | Button with sizes (`lg` / `sm`) and types (`primary`, `default`, `danger`, `link`) |
|
|
98
|
+
| `Menu` | Navigation menu; use `Menu.Item` and `Menu.SubMenu` |
|
|
99
|
+
| `AutoComplete` | Input with suggestions (sync or async) |
|
|
100
|
+
| `Icon` | Font Awesome icon wrapper with optional `theme` |
|
|
101
|
+
| `Input` | Text input building block |
|
|
102
|
+
| `Progress` | Progress indicator |
|
|
103
|
+
| `Transition` | Transition wrapper (uses `react-transition-group`) |
|
|
104
|
+
| `Upload` | File upload with drag-and-drop and HTTP `action` URL |
|
|
105
|
+
| `setupIcons` | Registers solid icon set for `Icon` |
|
|
106
|
+
|
|
107
|
+
TypeScript types are published alongside the build (`dist/index.d.ts`).
|
|
108
|
+
|
|
109
|
+
## Bundles
|
|
110
|
+
|
|
111
|
+
| Entry | Path / condition | Use case |
|
|
112
|
+
| ------- | -------------------------------- | ------------------------- |
|
|
113
|
+
| **ESM** | `import` | Vite, modern bundlers |
|
|
114
|
+
| **CJS** | `require` | Node / older tooling |
|
|
115
|
+
| **UMD** | `unpkg` / script tag | Browser without a bundler |
|
|
116
|
+
| **CSS** | `@aozi6666/bee-design/style.css` | Global component styles |
|
|
117
|
+
|
|
118
|
+
## Upload example
|
|
119
|
+
|
|
120
|
+
`Upload` expects an `action` URL and supports drag mode via `drag`:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<Upload
|
|
124
|
+
action="https://your-api.example.com/upload"
|
|
125
|
+
name="file"
|
|
126
|
+
drag
|
|
127
|
+
onSuccess={(data, file) => console.log("ok", data, file)}
|
|
128
|
+
>
|
|
129
|
+
<p>Drop files here or click to upload</p>
|
|
130
|
+
</Upload>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## TypeScript
|
|
134
|
+
|
|
135
|
+
The library is authored in TypeScript. Ensure `"moduleResolution": "bundler"` or `"node16"` / `"nodenext"` in your `tsconfig.json` for best compatibility with package `exports`.
|
|
136
|
+
|
|
137
|
+
## Browser support
|
|
138
|
+
|
|
139
|
+
Targets modern evergreen browsers supported by **React 18+**. Include the provided **CSS** file for correct layout and theme classes.
|
|
140
|
+
|
|
141
|
+
## Contributing & source
|
|
142
|
+
|
|
143
|
+
Source and issues live in the monorepo that contains this package. See the repository linked from [the npm package page](https://www.npmjs.com/package/@aozi6666/bee-design).
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
License information is defined in the repository / `package.json`. If none is set, clarify terms with the package author before use in production.
|
package/package.json
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aozi6666/bee-design",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
|
+
"description": "React UI component library (TypeScript): Button, Menu, Input, Upload, AutoComplete, Icon, Progress, Transition — ESM/CJS/UMD + CSS.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react",
|
|
8
|
+
"react-components",
|
|
9
|
+
"ui",
|
|
10
|
+
"design-system",
|
|
11
|
+
"typescript",
|
|
12
|
+
"components",
|
|
13
|
+
"menu",
|
|
14
|
+
"upload",
|
|
15
|
+
"autocomplete",
|
|
16
|
+
"fontawesome"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/aozi6666/Bee-Design.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/aozi6666/Bee-Design/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/aozi6666/Bee-Design/tree/main/packages/components#readme",
|
|
5
26
|
"type": "module",
|
|
6
27
|
"files": [
|
|
7
28
|
"dist",
|