@aozi6666/bee-design 0.1.2 → 0.2.2
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/dist/App.d.ts +4 -0
- package/{build → dist}/components/AutoComplete/autoCompleteDropdown.d.ts +2 -2
- package/dist/components/AutoComplete/index.d.ts +4 -0
- package/{build → dist}/components/Button/button.d.ts +2 -2
- package/{build → dist}/components/Button/button.types.d.ts +1 -1
- package/dist/components/Button/index.d.ts +2 -0
- package/{build → dist}/components/Icon/icon.d.ts +2 -2
- package/dist/components/Icon/icon.types.d.ts +6 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Input/index.d.ts +4 -0
- package/dist/components/Input/input.d.ts +5 -0
- package/{build → dist}/components/Input/input.types.d.ts +4 -4
- package/{build → dist}/components/Menu/index.d.ts +4 -4
- package/{build → dist}/components/Menu/menu.d.ts +2 -2
- package/{build → dist}/components/Menu/menuContext.d.ts +1 -1
- package/{build → dist}/components/Menu/menuItem.d.ts +2 -2
- package/{build → dist}/components/Menu/subMenu.d.ts +1 -1
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/progress.d.ts +4 -0
- package/{build → dist}/components/Progress/progress.types.d.ts +2 -2
- package/dist/components/Transition/index.d.ts +3 -0
- package/dist/components/Transition/transition.d.ts +4 -0
- package/dist/components/Transition/transition.types.d.ts +9 -0
- package/{build → dist}/components/Upload/dragger.d.ts +1 -1
- package/dist/components/Upload/index.d.ts +2 -0
- package/{build → dist}/components/Upload/upload.d.ts +2 -2
- package/{build → dist}/components/Upload/upload.types.d.ts +1 -1
- package/{build → dist}/components/Upload/uploadList.d.ts +2 -2
- package/dist/index.cjs +16272 -0
- package/dist/index.cjs.map +1 -0
- package/{build → dist}/index.css +24 -24
- package/dist/index.d.ts +9 -0
- package/dist/index.esm.js +709 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +14381 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/setupIcons.d.ts +1 -0
- package/dist/setupTests.d.ts +1 -0
- package/package.json +52 -82
- package/README.md +0 -182
- package/build/App.d.ts +0 -4
- package/build/App.js +0 -137
- package/build/components/AutoComplete/autoComplete.js +0 -150
- package/build/components/AutoComplete/autoComplete.types.js +0 -1
- package/build/components/AutoComplete/autoCompleteDropdown.js +0 -17
- package/build/components/AutoComplete/index.d.ts +0 -4
- package/build/components/AutoComplete/index.js +0 -3
- package/build/components/Button/button.js +0 -43
- package/build/components/Button/button.types.js +0 -19
- package/build/components/Button/index.d.ts +0 -2
- package/build/components/Button/index.js +0 -2
- package/build/components/Icon/icon.js +0 -24
- package/build/components/Icon/icon.types.d.ts +0 -6
- package/build/components/Icon/icon.types.js +0 -2
- package/build/components/Icon/index.d.ts +0 -2
- package/build/components/Icon/index.js +0 -2
- package/build/components/Input/index.d.ts +0 -4
- package/build/components/Input/index.js +0 -3
- package/build/components/Input/input.d.ts +0 -5
- package/build/components/Input/input.js +0 -32
- package/build/components/Input/input.types.js +0 -1
- package/build/components/Menu/index.js +0 -9
- package/build/components/Menu/menu.js +0 -48
- package/build/components/Menu/menuContext.js +0 -2
- package/build/components/Menu/menuItem.js +0 -20
- package/build/components/Menu/subMenu.js +0 -57
- package/build/components/Progress/index.d.ts +0 -2
- package/build/components/Progress/index.js +0 -2
- package/build/components/Progress/progress.d.ts +0 -4
- package/build/components/Progress/progress.js +0 -6
- package/build/components/Progress/progress.types.js +0 -2
- package/build/components/Transition/index.d.ts +0 -3
- package/build/components/Transition/index.js +0 -2
- package/build/components/Transition/transition.d.ts +0 -4
- package/build/components/Transition/transition.js +0 -10
- package/build/components/Transition/transition.types.d.ts +0 -9
- package/build/components/Transition/transition.types.js +0 -1
- package/build/components/Upload/dragger.js +0 -42
- package/build/components/Upload/index.d.ts +0 -2
- package/build/components/Upload/index.js +0 -2
- package/build/components/Upload/native/axios-react.js +0 -99
- package/build/components/Upload/native/from-html.js +0 -5
- package/build/components/Upload/upload.js +0 -192
- package/build/components/Upload/upload.types.js +0 -3
- package/build/components/Upload/uploadList.js +0 -13
- package/build/hooks/useClickOutside.js +0 -38
- package/build/hooks/useDebounce.js +0 -28
- package/build/index.css.map +0 -1
- package/build/index.d.ts +0 -9
- package/build/index.js +0 -12
- package/build/main.d.ts +0 -1
- package/build/main.js +0 -7
- package/build/setupTests.d.ts +0 -1
- package/build/setupTests.js +0 -1
- /package/{build → dist}/components/AutoComplete/autoComplete.d.ts +0 -0
- /package/{build → dist}/components/AutoComplete/autoComplete.types.d.ts +0 -0
- /package/{build → dist}/components/Upload/native/axios-react.d.ts +0 -0
- /package/{build → dist}/components/Upload/native/from-html.d.ts +0 -0
- /package/{build → dist}/hooks/useClickOutside.d.ts +0 -0
- /package/{build → dist}/hooks/useDebounce.d.ts +0 -0
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./styles/index.scss";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupIcons(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
package/package.json
CHANGED
|
@@ -1,59 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aozi6666/bee-design",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/aozi6666/Bee-Design.git"
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/aozi6666/Bee-Design",
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/aozi6666/Bee-Design/issues"
|
|
12
|
-
},
|
|
4
|
+
"version": "0.2.2",
|
|
13
5
|
"type": "module",
|
|
14
6
|
"files": [
|
|
15
|
-
"
|
|
7
|
+
"dist",
|
|
16
8
|
"README.md"
|
|
17
9
|
],
|
|
18
|
-
"main": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"lint:staged": "lint-staged",
|
|
31
|
-
"build": "npm run clean && npm run build-ts && npm run build-css",
|
|
32
|
-
"build-ts": "tsc -p tsconfig.build.json",
|
|
33
|
-
"build-css": "sass ./src/styles/index.scss ./build/index.css",
|
|
34
|
-
"webpack:dev": "webpack",
|
|
35
|
-
"webpack:build": "NODE_ENV=production webpack",
|
|
36
|
-
"storybook": "storybook dev -p 6006",
|
|
37
|
-
"build-storybook": "storybook build",
|
|
38
|
-
"build:site": "vite build",
|
|
39
|
-
"preview": "vite preview",
|
|
40
|
-
"test": "jest",
|
|
41
|
-
"test:ci": "cross-env CI=true jest",
|
|
42
|
-
"prepublishOnly": "npm run test:ci && npm run lint && npm run build",
|
|
43
|
-
"prepare": "husky"
|
|
44
|
-
},
|
|
45
|
-
"lint-staged": {
|
|
46
|
-
"*.{js,jsx,ts,tsx}": [
|
|
47
|
-
"eslint --fix",
|
|
48
|
-
"prettier --write"
|
|
49
|
-
],
|
|
50
|
-
"*.{css,scss}": [
|
|
51
|
-
"stylelint --fix",
|
|
52
|
-
"prettier --write"
|
|
53
|
-
],
|
|
54
|
-
"*.{json,md,mdx,yml,yaml}": [
|
|
55
|
-
"prettier --write"
|
|
56
|
-
]
|
|
10
|
+
"main": "dist/index.cjs",
|
|
11
|
+
"unpkg": "dist/index.umd.js",
|
|
12
|
+
"module": "dist/index.esm.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.esm.js",
|
|
18
|
+
"require": "./dist/index.cjs",
|
|
19
|
+
"default": "./dist/index.esm.js"
|
|
20
|
+
},
|
|
21
|
+
"./style.css": "./dist/index.css"
|
|
57
22
|
},
|
|
58
23
|
"peerDependencies": {
|
|
59
24
|
"react": "^18 || ^19",
|
|
@@ -65,17 +30,17 @@
|
|
|
65
30
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
66
31
|
"axios": "^1.13.6",
|
|
67
32
|
"classnames": "^2.5.1",
|
|
68
|
-
"cross-env": "^10.1.0",
|
|
69
33
|
"lodash": "^4.17.23",
|
|
70
|
-
"react-transition-group": "^4.4.5"
|
|
34
|
+
"react-transition-group": "^4.4.5",
|
|
35
|
+
"@aozi6666/bee-utils": "0.1.0"
|
|
71
36
|
},
|
|
72
37
|
"devDependencies": {
|
|
73
|
-
"@chromatic-com/storybook": "^5.0.1",
|
|
74
38
|
"@eslint/js": "^9.39.1",
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
39
|
+
"@rollup/plugin-commonjs": "^26.0.0",
|
|
40
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
42
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
43
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
79
44
|
"@storybook/react-vite": "^10.2.17",
|
|
80
45
|
"@testing-library/dom": "^10.4.1",
|
|
81
46
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -87,44 +52,28 @@
|
|
|
87
52
|
"@types/react": "^19.2.7",
|
|
88
53
|
"@types/react-dom": "^19.2.3",
|
|
89
54
|
"@types/react-transition-group": "^4.4.12",
|
|
90
|
-
"
|
|
91
|
-
"@vitest/browser-playwright": "^4.0.18",
|
|
92
|
-
"@vitest/coverage-v8": "^4.0.18",
|
|
93
|
-
"css-loader": "^7.1.4",
|
|
55
|
+
"cross-env": "^10.1.0",
|
|
94
56
|
"eslint": "^9.39.1",
|
|
95
57
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
96
58
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
97
|
-
"eslint-plugin-storybook": "^10.2.17",
|
|
98
59
|
"globals": "^16.5.0",
|
|
99
|
-
"html-webpack-plugin": "^5.6.6",
|
|
100
|
-
"husky": "^9.1.7",
|
|
101
60
|
"jest": "^30.3.0",
|
|
102
61
|
"jest-environment-jsdom": "^30.3.0",
|
|
103
|
-
"playwright": "^1.58.2",
|
|
104
|
-
"react": "^19.2.0",
|
|
105
|
-
"react-dom": "^19.2.0",
|
|
106
62
|
"rimraf": "^6.1.3",
|
|
63
|
+
"rollup": "^4.30.0",
|
|
64
|
+
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.24",
|
|
65
|
+
"rollup-plugin-sass": "^1.12.24",
|
|
66
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
107
67
|
"sass": "^1.97.3",
|
|
108
68
|
"sass-embedded": "^1.97.3",
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"stylelint": "^17.4.0",
|
|
112
|
-
"stylelint-config-standard": "^40.0.0",
|
|
69
|
+
"stylelint": "^16.23.1",
|
|
70
|
+
"stylelint-config-standard": "^35.0.0",
|
|
113
71
|
"stylelint-config-standard-scss": "^16.0.0",
|
|
114
72
|
"stylelint-scss": "^7.0.0",
|
|
115
|
-
"terser-webpack-plugin": "^5.4.0",
|
|
116
|
-
"postcss-scss": "^4.0.9",
|
|
117
|
-
"prettier": "3.8.1",
|
|
118
|
-
"lint-staged": "^16.4.0",
|
|
119
73
|
"ts-jest": "^29.4.6",
|
|
120
|
-
"
|
|
74
|
+
"tslib": "^2.8.1",
|
|
121
75
|
"typescript": "~5.9.3",
|
|
122
|
-
"typescript-eslint": "^8.48.0"
|
|
123
|
-
"vite": "^7.3.1",
|
|
124
|
-
"vitest": "^4.0.18",
|
|
125
|
-
"webpack": "^5.105.4",
|
|
126
|
-
"webpack-cli": "^7.0.0",
|
|
127
|
-
"webpack-dev-server": "^5.2.3"
|
|
76
|
+
"typescript-eslint": "^8.48.0"
|
|
128
77
|
},
|
|
129
78
|
"jest": {
|
|
130
79
|
"preset": "ts-jest/presets/default-esm",
|
|
@@ -147,6 +96,27 @@
|
|
|
147
96
|
"useESM": true
|
|
148
97
|
}
|
|
149
98
|
]
|
|
99
|
+
},
|
|
100
|
+
"moduleNameMapper": {
|
|
101
|
+
"^@aozi6666/bee-utils$": "<rootDir>/../utils/dist/cjs/index.js"
|
|
150
102
|
}
|
|
103
|
+
},
|
|
104
|
+
"scripts": {
|
|
105
|
+
"clean": "rimraf ./build ./dist",
|
|
106
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
107
|
+
"lint": "eslint --ext js,ts,tsx src --max-warnings 5",
|
|
108
|
+
"lint:fix": "pnpm lint -- --fix",
|
|
109
|
+
"stylelint": "stylelint \"src/**/*.{css,scss}\"",
|
|
110
|
+
"stylelint:fix": "pnpm stylelint -- --fix",
|
|
111
|
+
"build": "pnpm clean && pnpm build:types && pnpm build:bundle",
|
|
112
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
113
|
+
"build:bundle": "pnpm build:bundle:esm && pnpm build:bundle:cjs && pnpm build:bundle:umd && pnpm build:css",
|
|
114
|
+
"build:bundle:esm": "rollup -c rollup/rollup.esm.config.js",
|
|
115
|
+
"build:bundle:cjs": "rollup -c rollup/rollup.cjs.config.js",
|
|
116
|
+
"build:bundle:umd": "rollup -c rollup/rollup.umd.config.js",
|
|
117
|
+
"build:css": "sass src/styles/index.scss dist/index.css --no-source-map",
|
|
118
|
+
"test": "jest",
|
|
119
|
+
"test:ci": "cross-env CI=true jest",
|
|
120
|
+
"release": "pnpm typecheck && pnpm test:ci && pnpm lint && pnpm build"
|
|
151
121
|
}
|
|
152
|
-
}
|
|
122
|
+
}
|
package/README.md
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
## Bee Design
|
|
2
|
-
|
|
3
|
-
React UI Component Library inspired by Honeycomb 🐝
|
|
4
|
-
一个基于 React + TypeScript 的轻量级组件库,用来练习和演示现代前端工程化(组件开发、单元测试、Storybook、CI 等)实践。
|
|
5
|
-
|
|
6
|
-
### GitHub
|
|
7
|
-
|
|
8
|
-
`https://github.com/aozi6666/Bee-Design`
|
|
9
|
-
|
|
10
|
-
### Install
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install @aozi6666/bee-design
|
|
14
|
-
# or
|
|
15
|
-
yarn add @aozi6666/bee-design
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Quick Start
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import React from "react";
|
|
22
|
-
import { createRoot } from "react-dom/client";
|
|
23
|
-
import BeeButton from "@aozi6666/bee-design/build/components/Button";
|
|
24
|
-
import "@aozi6666/bee-design/build/index.css";
|
|
25
|
-
|
|
26
|
-
const App = () => (
|
|
27
|
-
<div style={{ padding: 24 }}>
|
|
28
|
-
<BeeButton>Bee Design Button</BeeButton>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
createRoot(document.getElementById("root")!).render(<App />);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
> **提示**:发布到 npm 后,推荐在业务项目中通过别名导入,如 `import { Button } from '@aozi6666/bee-design'`。当前版本的打包入口为 `build/index.js`,已经在 `package.json` 中配置好。
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Features
|
|
40
|
-
|
|
41
|
-
- **基于 React + TypeScript**:完整的类型定义,开发体验友好。
|
|
42
|
-
- **现代工程化**:使用 Vite 开发体验、本地 Storybook 文档、Jest + Testing Library 单元测试、ESLint 规范代码。
|
|
43
|
-
- **常用基础组件**:涵盖表单、导航、反馈等常见场景。
|
|
44
|
-
- **渐进式学习**:代码中包含一定注释,适合学习组件封装、hooks 抽离以及 TS 类型设计。
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Components
|
|
49
|
-
|
|
50
|
-
Bee Design 当前提供以下组件(持续扩展中):
|
|
51
|
-
|
|
52
|
-
- **Button 按钮**
|
|
53
|
-
- 类型:`primary` / `default` / `danger` / `link`
|
|
54
|
-
- 支持 `href` / `target`、禁用状态等
|
|
55
|
-
- **Input 输入框**
|
|
56
|
-
- 支持前后缀图标、禁用状态、清空等能力
|
|
57
|
-
- **AutoComplete 自动完成**
|
|
58
|
-
- 根据输入关键字异步 / 同步返回候选项
|
|
59
|
-
- 支持自定义下拉项渲染(`renderOption`)
|
|
60
|
-
- **Upload 上传**
|
|
61
|
-
- 支持点击上传、拖拽上传(`drag`)、上传进度展示、文件列表
|
|
62
|
-
- 提供原生表单上传示例和 `axios` 上传方式
|
|
63
|
-
- **Menu 菜单**
|
|
64
|
-
- 水平 / 垂直导航菜单
|
|
65
|
-
- 支持子菜单展开、选中高亮
|
|
66
|
-
- **Icon 图标**
|
|
67
|
-
- 基于 Font Awesome 封装
|
|
68
|
-
- 支持主题颜色、尺寸、旋转动画等
|
|
69
|
-
- **Progress 进度条**
|
|
70
|
-
- 支持不同主题颜色和高度
|
|
71
|
-
- **Transition 动画**
|
|
72
|
-
- 对 `react-transition-group` 的简单封装,用于出入场动画
|
|
73
|
-
- **Hooks**
|
|
74
|
-
- `useClickOutside`:点击组件外区域的处理
|
|
75
|
-
- `useDebounce`:防抖输入处理
|
|
76
|
-
|
|
77
|
-
具体用法可以查看 `src/components` 下各个组件的 `*.stories.tsx` 示例和测试用例。
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Usage Example
|
|
82
|
-
|
|
83
|
-
以 `AutoComplete` 为例:
|
|
84
|
-
|
|
85
|
-
```tsx
|
|
86
|
-
import React, { useCallback } from "react";
|
|
87
|
-
import AutoComplete, {
|
|
88
|
-
type DataSourceType,
|
|
89
|
-
} from "@aozi6666/bee-design/build/components/AutoComplete";
|
|
90
|
-
import "@aozi6666/bee-design/build/index.css";
|
|
91
|
-
|
|
92
|
-
interface LakerPlayer {
|
|
93
|
-
value: string;
|
|
94
|
-
number: number;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const players: Array<DataSourceType<LakerPlayer>> = [
|
|
98
|
-
{ value: "bradley", number: 11 },
|
|
99
|
-
{ value: "james", number: 23 },
|
|
100
|
-
// ...
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
const Demo = () => {
|
|
104
|
-
const fetchSuggestions = useCallback(
|
|
105
|
-
(query: string) => players.filter((p) => p.value.toLowerCase().includes(query.toLowerCase())),
|
|
106
|
-
[],
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<AutoComplete fetchSuggestions={fetchSuggestions} placeholder="输入湖人队球员英文名试试" />
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
> **建议**:`fetchSuggestions` 推荐使用 `useCallback` 包裹,避免在父组件重复渲染时创建新函数,从而触发不必要的副作用或额外请求。
|
|
116
|
-
|
|
117
|
-
更多示例请参考仓库中的 `src/App.tsx` 和 Storybook 故事文件。
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Local Development
|
|
122
|
-
|
|
123
|
-
克隆仓库:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
git clone https://github.com/aozi6666/Bee-Design.git
|
|
127
|
-
cd Bee-Design
|
|
128
|
-
npm install
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
本地开发预览:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
npm run dev
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
运行 Storybook:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
npm run storybook
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
运行单元测试:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
npm run test
|
|
147
|
-
# CI 模式(用于 prepublish)
|
|
148
|
-
npm run test:ci
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
构建组件库(打包到 `build/` 目录):
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
npm run build
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
发布前检查脚本(测试 + lint + build):
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
npm run prepublishOnly
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## Scripts
|
|
166
|
-
|
|
167
|
-
- **`npm run dev`**: 使用 Vite 启动开发服务器
|
|
168
|
-
- **`npm run build`**: 构建 TypeScript 和样式到 `build/`
|
|
169
|
-
- **`npm run lint`**: 使用 ESLint 检查 `src` 下的代码
|
|
170
|
-
- **`npm run test` / `npm run test:ci`**: 使用 Jest + Testing Library 运行单元测试
|
|
171
|
-
- **`npm run storybook` / `npm run build-storybook`**: 启动或构建 Storybook 文档站点
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Roadmap
|
|
176
|
-
|
|
177
|
-
- [ ] 完善文档站点与在线 Demo
|
|
178
|
-
- [ ] 增加更多表单组件(`Select` / `Checkbox` / `Radio` 等)
|
|
179
|
-
- [ ] 增加 Layout、Modal 等业务常用组件
|
|
180
|
-
- [ ] 打包为更符合行业习惯的 API 形式(`import { Button } from '@aozi6666/bee-design'`)
|
|
181
|
-
|
|
182
|
-
欢迎在 GitHub 上提 issue 或 PR,一起完善 Bee Design 🐝。
|
package/build/App.d.ts
DELETED
package/build/App.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './styles/index.scss';
|
|
3
|
-
import Button from './components/Button/button';
|
|
4
|
-
import { ButtonType } from './components/Button/button.types';
|
|
5
|
-
import Upload from './components/Upload';
|
|
6
|
-
import Icon from './components/Icon';
|
|
7
|
-
import Progress from './components/Progress';
|
|
8
|
-
import AutoComplete from './components/AutoComplete';
|
|
9
|
-
const App = () => {
|
|
10
|
-
const defaultUploadList = [
|
|
11
|
-
{
|
|
12
|
-
uid: '1',
|
|
13
|
-
size: 1024,
|
|
14
|
-
name: '已上传文件.png',
|
|
15
|
-
status: 'success',
|
|
16
|
-
percent: 100,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
uid: '2',
|
|
20
|
-
size: 2048,
|
|
21
|
-
name: '上传中文件.jpg',
|
|
22
|
-
status: 'uploading',
|
|
23
|
-
percent: 40,
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
const lakersWithNumber = [
|
|
27
|
-
{ value: 'bradley', number: 11 },
|
|
28
|
-
{ value: 'pope', number: 1 },
|
|
29
|
-
{ value: 'caruso', number: 4 },
|
|
30
|
-
{ value: 'cook', number: 2 },
|
|
31
|
-
{ value: 'cousins', number: 15 },
|
|
32
|
-
{ value: 'james', number: 23 },
|
|
33
|
-
{ value: 'AD', number: 3 },
|
|
34
|
-
{ value: 'green', number: 14 },
|
|
35
|
-
{ value: 'howard', number: 39 },
|
|
36
|
-
{ value: 'kuzma', number: 0 },
|
|
37
|
-
];
|
|
38
|
-
const handleAutoCompleteFetch = (query) => {
|
|
39
|
-
return lakersWithNumber.filter((player) => player.value.toLowerCase().includes(query.toLowerCase()));
|
|
40
|
-
};
|
|
41
|
-
return (_jsx("div", { style: {
|
|
42
|
-
minHeight: '100vh',
|
|
43
|
-
padding: '40px 24px 80px',
|
|
44
|
-
background: 'radial-gradient(circle at top left, #f0f5ff 0, transparent 50%), radial-gradient(circle at bottom right, #fff1f0 0, transparent 55%)',
|
|
45
|
-
fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif',
|
|
46
|
-
}, children: _jsxs("div", { style: {
|
|
47
|
-
maxWidth: 960,
|
|
48
|
-
margin: '0 auto',
|
|
49
|
-
}, children: [_jsxs("header", { style: {
|
|
50
|
-
marginBottom: 32,
|
|
51
|
-
display: 'flex',
|
|
52
|
-
alignItems: 'center',
|
|
53
|
-
justifyContent: 'space-between',
|
|
54
|
-
gap: 16,
|
|
55
|
-
}, children: [_jsxs("div", { children: [_jsx("h1", { style: { margin: 0, fontSize: 28 }, children: "Cream Design \u7EC4\u4EF6\u5E93" }), _jsx("p", { style: { margin: '8px 0 0', color: '#595959', fontSize: 14 }, children: "\u4E00\u5957\u7528\u6765\u7EC3\u4E60 React + TypeScript \u7684\u8F7B\u91CF\u7EC4\u4EF6\u793A\u4F8B\u3002" })] }), _jsxs("div", { style: { display: 'flex', gap: 12 }, children: [_jsx(Button, { btnType: ButtonType.Primary, children: "\u67E5\u770B\u6587\u6863" }), _jsx(Button, { btnType: ButtonType.Default, children: "Git \u4ED3\u5E93" })] })] }), _jsxs("main", { style: {
|
|
56
|
-
display: 'grid',
|
|
57
|
-
gridTemplateColumns: 'minmax(0, 1.2fr) minmax(0, 1fr)',
|
|
58
|
-
gap: 24,
|
|
59
|
-
alignItems: 'flex-start',
|
|
60
|
-
}, children: [_jsxs("section", { style: {
|
|
61
|
-
display: 'flex',
|
|
62
|
-
flexDirection: 'column',
|
|
63
|
-
gap: 24,
|
|
64
|
-
}, children: [_jsxs("div", { style: {
|
|
65
|
-
padding: 24,
|
|
66
|
-
borderRadius: 12,
|
|
67
|
-
background: '#ffffff',
|
|
68
|
-
boxShadow: '0 8px 24px rgba(15, 23, 42, 0.06)',
|
|
69
|
-
}, children: [_jsx("h2", { style: { margin: 0, marginBottom: 16, fontSize: 18 }, children: "Button \u7EC4\u4EF6\u6F14\u793A" }), _jsx("p", { style: { margin: '0 0 16px', color: '#8c8c8c', fontSize: 13 }, children: "\u4E0D\u540C\u7C7B\u578B\u6309\u94AE\u548C\u94FE\u63A5\u6309\u94AE\uFF0C\u9002\u5408\u4F5C\u4E3A\u9875\u9762\u4E3B\u64CD\u4F5C\u3001\u6B21\u8981\u64CD\u4F5C\u548C\u6587\u672C\u94FE\u63A5\u3002" }), _jsxs("div", { style: {
|
|
70
|
-
display: 'flex',
|
|
71
|
-
flexWrap: 'wrap',
|
|
72
|
-
gap: 12,
|
|
73
|
-
}, children: [_jsx(Button, { btnType: ButtonType.Primary, children: "Primary Button" }), _jsx(Button, { btnType: ButtonType.Default, children: "Default Button" }), _jsx(Button, { btnType: ButtonType.Danger, children: "Danger Button" }), _jsx(Button, { btnType: ButtonType.Link, href: "https://www.baidu.com/", children: "Link \u767E\u5EA6" }), _jsx(Button, { btnType: ButtonType.Link, href: "https://www.baidu.com/", target: "_blank", children: "Link \u767E\u5EA6(\"\u65B0\u7A97\u53E3\u6253\u5F00\")" })] })] }), _jsxs("div", { style: {
|
|
74
|
-
padding: 24,
|
|
75
|
-
borderRadius: 12,
|
|
76
|
-
background: '#ffffff',
|
|
77
|
-
boxShadow: '0 8px 24px rgba(15, 23, 42, 0.06)',
|
|
78
|
-
}, children: [_jsx("h2", { style: { margin: 0, marginBottom: 16, fontSize: 18 }, children: "Upload \u7EC4\u4EF6\u6F14\u793A" }), _jsx("p", { style: { margin: '0 0 16px', color: '#8c8c8c', fontSize: 13 }, children: "\u652F\u6301\u70B9\u51FB\u9009\u62E9\u3001\u62D6\u62FD\u4E0A\u4F20\u3001\u4E0A\u4F20\u8FDB\u5EA6\u663E\u793A\u548C\u6587\u4EF6\u5217\u8868\u7BA1\u7406\u3002" }), _jsxs("div", { style: {
|
|
79
|
-
display: 'flex',
|
|
80
|
-
flexDirection: 'column',
|
|
81
|
-
gap: 16,
|
|
82
|
-
alignItems: 'stretch',
|
|
83
|
-
}, children: [_jsx(Upload, { action: "https://jsonplaceholder.typicode.com/posts", defaultFileList: defaultUploadList, children: _jsx(Button, { btnType: ButtonType.Primary, children: "\u70B9\u51FB\u4E0A\u4F20" }) }), _jsx(Upload, { action: "https://jsonplaceholder.typicode.com/posts", drag: true, children: _jsx("div", { style: {
|
|
84
|
-
padding: '20px 40px',
|
|
85
|
-
border: '1px dashed #d9d9d9',
|
|
86
|
-
borderRadius: 4,
|
|
87
|
-
textAlign: 'center',
|
|
88
|
-
color: '#595959',
|
|
89
|
-
background: '#fafafa',
|
|
90
|
-
}, children: "\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216\u70B9\u51FB\u4E0A\u4F20" }) })] })] })] }), _jsxs("section", { style: {
|
|
91
|
-
display: 'flex',
|
|
92
|
-
flexDirection: 'column',
|
|
93
|
-
gap: 24,
|
|
94
|
-
}, children: [_jsxs("div", { style: {
|
|
95
|
-
padding: 24,
|
|
96
|
-
borderRadius: 12,
|
|
97
|
-
background: '#ffffff',
|
|
98
|
-
boxShadow: '0 8px 24px rgba(15, 23, 42, 0.06)',
|
|
99
|
-
}, children: [_jsx("h2", { style: { margin: 0, marginBottom: 16, fontSize: 18 }, children: "Icon \u7EC4\u4EF6\u6F14\u793A" }), _jsx("p", { style: { margin: '0 0 16px', color: '#8c8c8c', fontSize: 13 }, children: "\u57FA\u4E8E Font Awesome \u7684\u56FE\u6807\u7EC4\u4EF6\uFF0C\u652F\u6301\u4E3B\u9898\u8272\u548C\u6240\u6709\u539F\u751F\u5C5E\u6027\u3002" }), _jsxs("div", { style: {
|
|
100
|
-
display: 'flex',
|
|
101
|
-
flexWrap: 'wrap',
|
|
102
|
-
gap: 20,
|
|
103
|
-
alignItems: 'center',
|
|
104
|
-
}, children: [_jsx(Icon, { icon: "coffee", size: "2x" }), _jsx(Icon, { icon: "check-circle", size: "2x", theme: "success" }), _jsx(Icon, { icon: "times", size: "2x", theme: "danger" }), _jsx(Icon, { icon: "spinner", size: "2x", spin: true, theme: "primary" })] })] }), _jsxs("div", { style: {
|
|
105
|
-
padding: 24,
|
|
106
|
-
borderRadius: 12,
|
|
107
|
-
background: '#ffffff',
|
|
108
|
-
boxShadow: '0 8px 24px rgba(15, 23, 42, 0.06)',
|
|
109
|
-
}, children: [_jsx("h2", { style: { margin: 0, marginBottom: 16, fontSize: 18 }, children: "Progress \u7EC4\u4EF6\u6F14\u793A" }), _jsx("p", { style: { margin: '0 0 16px', color: '#8c8c8c', fontSize: 13 }, children: "\u5C55\u793A\u4EFB\u52A1\u5B8C\u6210\u8FDB\u5EA6\uFF0C\u652F\u6301\u4E0D\u540C\u4E3B\u9898\u989C\u8272\u548C\u9AD8\u5EA6\u3002" }), _jsxs("div", { style: {
|
|
110
|
-
display: 'flex',
|
|
111
|
-
flexDirection: 'column',
|
|
112
|
-
gap: 12,
|
|
113
|
-
}, children: [_jsx(Progress, { percent: 30 }), _jsx(Progress, { percent: 65, theme: "success" }), _jsx(Progress, { percent: 90, theme: "danger", strokeHeight: 10 })] })] }), _jsxs("div", { style: {
|
|
114
|
-
padding: 24,
|
|
115
|
-
borderRadius: 12,
|
|
116
|
-
background: '#ffffff',
|
|
117
|
-
boxShadow: '0 8px 24px rgba(15, 23, 42, 0.06)',
|
|
118
|
-
}, children: [_jsx("h2", { style: { margin: 0, marginBottom: 16, fontSize: 18 }, children: "AutoComplete \u7EC4\u4EF6\u6F14\u793A" }), _jsx("p", { style: { margin: '0 0 16px', color: '#8c8c8c', fontSize: 13 }, children: "\u8F93\u5165\u5185\u5BB9\u81EA\u52A8\u7ED9\u51FA\u5019\u9009\u9879\uFF0C\u652F\u6301\u952E\u76D8\u9009\u62E9\u4E0E\u81EA\u5B9A\u4E49\u4E0B\u62C9\u6E32\u67D3\u3002" }), _jsx(AutoComplete, { fetchSuggestions: handleAutoCompleteFetch, placeholder: "\u8F93\u5165\u6E56\u4EBA\u961F\u7403\u5458\u82F1\u6587\u540D\u8BD5\u8BD5\uFF08\u5982\uFF1Aja / co\uFF09", renderOption: (item) => {
|
|
119
|
-
const player = item;
|
|
120
|
-
return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', gap: 12 }, children: [_jsx("b", { children: player.value }), _jsxs("span", { style: { color: '#8c8c8c' }, children: ["#", player.number] })] }));
|
|
121
|
-
} })] })] })] }), _jsxs("div", { style: {
|
|
122
|
-
marginTop: 40,
|
|
123
|
-
padding: 24,
|
|
124
|
-
borderRadius: 12,
|
|
125
|
-
background: '#ffffff',
|
|
126
|
-
boxShadow: '0 8px 24px rgba(15, 23, 42, 0.06)',
|
|
127
|
-
}, children: [_jsx("h2", { style: { margin: 0, marginBottom: 16, fontSize: 18 }, children: "\u539F\u751F\u8868\u5355\u4E0A\u4F20\u793A\u4F8B" }), _jsxs("p", { style: { margin: '0 0 16px', color: '#8c8c8c', fontSize: 13 }, children: ["\u4F7F\u7528\u539F\u751F ", _jsx("code", { children: "<form>" }), " \u63D0\u4EA4\u5230\u540E\u7AEF\u63A5\u53E3\u7684\u6587\u4EF6\u4E0A\u4F20\u65B9\u5F0F\u3002"] }), _jsxs("form", { method: "post", encType: "multipart/form-data", action: "https://jsonplaceholder.typicode.com/posts", style: { marginTop: 8 }, children: [_jsx("input", { type: "file", name: "myFile" }), _jsx("button", { type: "submit", style: {
|
|
128
|
-
marginLeft: 12,
|
|
129
|
-
padding: '4px 12px',
|
|
130
|
-
borderRadius: 4,
|
|
131
|
-
border: '1px solid #1677ff',
|
|
132
|
-
background: '#1677ff',
|
|
133
|
-
color: '#fff',
|
|
134
|
-
cursor: 'pointer',
|
|
135
|
-
}, children: "Submit" })] })] })] }) }));
|
|
136
|
-
};
|
|
137
|
-
export default App;
|