@fakeoai/ui 0.0.0
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 +84 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +32 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# My React Component Library
|
|
2
|
+
|
|
3
|
+
一个现代化的 React 组件库,使用 TypeScript 构建。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install my-react-component-library
|
|
9
|
+
# 或
|
|
10
|
+
yarn add my-react-component-library
|
|
11
|
+
# 或
|
|
12
|
+
pnpm add my-react-component-library
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button, Card } from 'my-react-component-library';
|
|
19
|
+
|
|
20
|
+
function App() {
|
|
21
|
+
return (
|
|
22
|
+
<Card title="示例卡片">
|
|
23
|
+
<Button variant="primary" size="md">
|
|
24
|
+
点击我
|
|
25
|
+
</Button>
|
|
26
|
+
</Card>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 组件
|
|
32
|
+
|
|
33
|
+
### Button
|
|
34
|
+
|
|
35
|
+
按钮组件,支持多种样式和尺寸。
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Button
|
|
39
|
+
variant="primary"
|
|
40
|
+
size="md"
|
|
41
|
+
onClick={() => console.log('clicked')}
|
|
42
|
+
>
|
|
43
|
+
按钮文本
|
|
44
|
+
</Button>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Props:**
|
|
48
|
+
- `variant`: 'primary' | 'secondary' | 'outline'
|
|
49
|
+
- `size`: 'sm' | 'md' | 'lg'
|
|
50
|
+
- `onClick`: () => void
|
|
51
|
+
- `disabled`: boolean
|
|
52
|
+
- `className`: string
|
|
53
|
+
|
|
54
|
+
### Card
|
|
55
|
+
|
|
56
|
+
卡片组件,用于展示内容。
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
<Card title="卡片标题" shadow="md">
|
|
60
|
+
卡片内容
|
|
61
|
+
</Card>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Props:**
|
|
65
|
+
- `title`: string (可选)
|
|
66
|
+
- `shadow`: 'sm' | 'md' | 'lg'
|
|
67
|
+
- `className`: string
|
|
68
|
+
|
|
69
|
+
## 开发
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 安装依赖
|
|
73
|
+
npm install
|
|
74
|
+
|
|
75
|
+
# 开发模式
|
|
76
|
+
npm run dev
|
|
77
|
+
|
|
78
|
+
# 构建
|
|
79
|
+
npm run build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 许可证
|
|
83
|
+
|
|
84
|
+
MIT
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.tsx
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Loading: () => Loading
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/loading.tsx
|
|
28
|
+
var import_react = require("@heroui/react");
|
|
29
|
+
|
|
30
|
+
// src/utils/clsx.ts
|
|
31
|
+
var import_clsx = require("clsx");
|
|
32
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
33
|
+
function cn(...inputs) {
|
|
34
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/components/loading.tsx
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
function Loading({ className, ...p }) {
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
+
import_react.Spinner,
|
|
42
|
+
{
|
|
43
|
+
color: "default",
|
|
44
|
+
className: cn("absolute inset-0", className),
|
|
45
|
+
label: "\u52A0\u8F7D\u4E2D...",
|
|
46
|
+
classNames: {
|
|
47
|
+
circle2: "border-b-foreground",
|
|
48
|
+
circle1: "border-b-foreground",
|
|
49
|
+
label: "text-sm mt-2"
|
|
50
|
+
},
|
|
51
|
+
...p
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
Loading
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../index.tsx","../src/components/loading.tsx","../src/utils/clsx.ts"],"sourcesContent":["export * from \"./src/components\";\n","import { Spinner, SpinnerProps } from \"@heroui/react\";\nimport { cn } from \"../utils/clsx\";\n\nexport function Loading({ className, ...p }: SpinnerProps) {\n return (\n <Spinner\n color=\"default\"\n className={cn(\"absolute inset-0\", className)}\n label=\"加载中...\"\n classNames={{\n circle2: \"border-b-foreground\",\n circle1: \"border-b-foreground\",\n label: \"text-sm mt-2\",\n }}\n {...p}\n />\n );\n}\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAsC;;;ACAtC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADAI;AAFG,SAAS,QAAQ,EAAE,WAAW,GAAG,EAAE,GAAiB;AACzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,WAAW,GAAG,oBAAoB,SAAS;AAAA,MAC3C,OAAM;AAAA,MACN,YAAY;AAAA,QACV,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,MACT;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/components/loading.tsx
|
|
2
|
+
import { Spinner } from "@heroui/react";
|
|
3
|
+
|
|
4
|
+
// src/utils/clsx.ts
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/components/loading.tsx
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
function Loading({ className, ...p }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Spinner,
|
|
16
|
+
{
|
|
17
|
+
color: "default",
|
|
18
|
+
className: cn("absolute inset-0", className),
|
|
19
|
+
label: "\u52A0\u8F7D\u4E2D...",
|
|
20
|
+
classNames: {
|
|
21
|
+
circle2: "border-b-foreground",
|
|
22
|
+
circle1: "border-b-foreground",
|
|
23
|
+
label: "text-sm mt-2"
|
|
24
|
+
},
|
|
25
|
+
...p
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
Loading
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/loading.tsx","../src/utils/clsx.ts"],"sourcesContent":["import { Spinner, SpinnerProps } from \"@heroui/react\";\nimport { cn } from \"../utils/clsx\";\n\nexport function Loading({ className, ...p }: SpinnerProps) {\n return (\n <Spinner\n color=\"default\"\n className={cn(\"absolute inset-0\", className)}\n label=\"加载中...\"\n classNames={{\n circle2: \"border-b-foreground\",\n circle1: \"border-b-foreground\",\n label: \"text-sm mt-2\",\n }}\n {...p}\n />\n );\n}\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";AAAA,SAAS,eAA6B;;;ACAtC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADAI;AAFG,SAAS,QAAQ,EAAE,WAAW,GAAG,EAAE,GAAiB;AACzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,WAAW,GAAG,oBAAoB,SAAS;AAAA,MAC3C,OAAM;AAAA,MACN,YAAY;AAAA,QACV,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,MACT;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fakeoai/ui",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup",
|
|
19
|
+
"dev": "tsup --watch",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"react",
|
|
24
|
+
"components",
|
|
25
|
+
"ui",
|
|
26
|
+
"typescript"
|
|
27
|
+
],
|
|
28
|
+
"author": "fakeoai",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": ">=16.8.0",
|
|
32
|
+
"react-dom": ">=16.8.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@heroui/react": "^2.8.4",
|
|
36
|
+
"clsx": "^2.1.1",
|
|
37
|
+
"tailwind-merge": "^3.3.1",
|
|
38
|
+
"tsup": "^8.5.0",
|
|
39
|
+
"tsx": "^4.20.5",
|
|
40
|
+
"typescript": "^5.9.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/react": "^18.0.0",
|
|
44
|
+
"@types/react-dom": "^18.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|