jean-react-utils 0.2.0 → 0.2.1
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 +157 -19
- package/dist/index.d.mts +182 -10
- package/dist/index.d.ts +182 -10
- package/dist/index.js +3705 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3732 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -1,39 +1,177 @@
|
|
|
1
|
-
# Jean-utils
|
|
1
|
+
# Jean-react-utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一个为 Next.js 项目打造的 React 组件和工具库,集成了常用 UI 组件、Hooks、主题系统和国际化功能。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 特性
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
- 🎨 现代化的 UI 组件,基于 Tailwind CSS
|
|
8
|
+
- 🌗 内置暗黑模式支持
|
|
9
|
+
- 🌐 完整的国际化解决方案(基于 next-intl)
|
|
10
|
+
- 🎯 TypeScript 支持
|
|
11
|
+
- ⚡ 轻量级,tree-shakeable
|
|
12
|
+
- 📦 开箱即用的主题系统
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# npm
|
|
18
|
+
npm install jean-react-utils
|
|
19
|
+
|
|
20
|
+
# yarn
|
|
21
|
+
yarn add jean-react-utils
|
|
22
|
+
|
|
23
|
+
# pnpm
|
|
24
|
+
pnpm add jean-react-utils
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 快速开始
|
|
28
|
+
|
|
29
|
+
1. 配置 Tailwind CSS(如果你还没有配置):
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
// tailwind.config.js
|
|
33
|
+
module.exports = {
|
|
34
|
+
content: [
|
|
35
|
+
// ...
|
|
36
|
+
"./node_modules/jean-react-utils/**/*.{js,ts,jsx,tsx}",
|
|
37
|
+
],
|
|
38
|
+
// ...
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. 导入并使用组件:
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { Button, Heading } from 'jean-react-utils';
|
|
46
|
+
|
|
47
|
+
export default function MyComponent() {
|
|
48
|
+
return (
|
|
49
|
+
<div>
|
|
50
|
+
<Heading.PageTitle>Welcome</Heading.PageTitle>
|
|
51
|
+
<Button variant="primary">Click me</Button>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 组件
|
|
58
|
+
|
|
59
|
+
### Button
|
|
60
|
+
现代化的按钮组件,支持多种变体和尺寸。
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<Button variant="default" size="lg">
|
|
64
|
+
Click me
|
|
65
|
+
</Button>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
变体选项:
|
|
69
|
+
- default: 主要按钮
|
|
70
|
+
- destructive: 危险操作
|
|
71
|
+
- outline: 轮廓按钮
|
|
72
|
+
- secondary: 次要按钮
|
|
73
|
+
- ghost: 幽灵按钮
|
|
74
|
+
- link: 链接样式
|
|
75
|
+
|
|
76
|
+
尺寸选项:
|
|
77
|
+
- default: 默认大小
|
|
78
|
+
- sm: 小型按钮
|
|
79
|
+
- lg: 大型按钮
|
|
80
|
+
- icon: 图标按钮
|
|
81
|
+
|
|
82
|
+
### Heading
|
|
83
|
+
一组标题组件,包含不同级别和样式的标题。
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<Heading.PageTitle>页面标题</Heading.PageTitle>
|
|
87
|
+
<Heading.SectionTitle>区块标题</Heading.SectionTitle>
|
|
88
|
+
<Heading.CardTitle>卡片标题</Heading.CardTitle>
|
|
89
|
+
<Heading.SubTitle>子标题</Heading.SubTitle>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Hooks
|
|
93
|
+
|
|
94
|
+
### useForceRerender
|
|
95
|
+
强制组件重新渲染的 Hook。
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { useForceRerender } from 'jean-react-utils';
|
|
99
|
+
|
|
100
|
+
const Component = () => {
|
|
101
|
+
const rerender = useForceRerender();
|
|
102
|
+
|
|
103
|
+
return <button onClick={rerender}>Force Rerender</button>;
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 主题系统
|
|
108
|
+
|
|
109
|
+
内置支持明暗主题切换,基于 Tailwind CSS。
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { ThemeProvider, ThemeToggle } from 'jean-react-utils';
|
|
113
|
+
|
|
114
|
+
export default function App() {
|
|
115
|
+
return (
|
|
116
|
+
<ThemeProvider>
|
|
117
|
+
<ThemeToggle />
|
|
118
|
+
{/* 你的应用内容 */}
|
|
119
|
+
</ThemeProvider>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 国际化
|
|
125
|
+
|
|
126
|
+
基于 next-intl 的国际化解决方案,支持自定义消息路径和自动集成。
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
// 配置示例
|
|
130
|
+
import { i18nConfig } from 'jean-react-utils';
|
|
131
|
+
|
|
132
|
+
export default i18nConfig({
|
|
133
|
+
messages: {
|
|
134
|
+
zh: { ... },
|
|
135
|
+
en: { ... }
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
```
|
|
14
139
|
|
|
15
140
|
## 项目结构
|
|
16
141
|
```
|
|
17
|
-
jean-utils/
|
|
142
|
+
jean-react-utils/
|
|
18
143
|
├── src/
|
|
19
144
|
│ ├── components/ ← Button / Card 等通用组件
|
|
20
145
|
│ ├── layout/ ← Header / Footer / Nav
|
|
21
146
|
│ ├── hooks/ ← useForceRerender、useMediaQuery 等
|
|
22
|
-
│ ├── theme/ ← tailwind theme、token
|
|
147
|
+
│ ├── theme/ ← tailwind theme、token 主题切换
|
|
23
148
|
│ ├── i18n/ ← next-intl 封装
|
|
24
149
|
│ └── index.ts ← 统一导出
|
|
25
150
|
├── package.json
|
|
26
151
|
├── tsconfig.json
|
|
27
|
-
├── tailwind.config.ts
|
|
28
|
-
├── vitest.config.ts
|
|
29
|
-
├── postcss.config.js
|
|
30
152
|
└── README.md
|
|
31
153
|
```
|
|
32
154
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
|
|
155
|
+
## 开发
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# 安装依赖
|
|
159
|
+
pnpm install
|
|
36
160
|
|
|
161
|
+
# 开发模式
|
|
162
|
+
pnpm dev
|
|
163
|
+
|
|
164
|
+
# 构建
|
|
165
|
+
pnpm build
|
|
166
|
+
|
|
167
|
+
# 运行测试
|
|
168
|
+
pnpm test
|
|
37
169
|
```
|
|
38
170
|
|
|
39
|
-
|
|
171
|
+
## 贡献
|
|
172
|
+
|
|
173
|
+
欢迎提交 Issue 和 Pull Request。
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -1,39 +1,169 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { ReactNode } from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { ThemeProviderProps } from 'next-themes';
|
|
7
|
+
import { ClassValue } from 'clsx';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 按钮变体样式配置
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
declare const buttonVariants: (props?: ({
|
|
14
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "borderNone" | null | undefined;
|
|
15
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
16
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Button 组件的属性类型
|
|
19
|
+
* @extends {React.ButtonHTMLAttributes<HTMLButtonElement>} 继承原生按钮属性
|
|
20
|
+
*/
|
|
21
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
7
22
|
}
|
|
8
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 现代化的按钮组件,支持多种变体和尺寸。
|
|
25
|
+
*
|
|
26
|
+
* @component
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // 默认按钮
|
|
30
|
+
* <Button>Click me</Button>
|
|
31
|
+
*
|
|
32
|
+
* // 带变体的按钮
|
|
33
|
+
* <Button variant="destructive" size="lg">Delete</Button>
|
|
34
|
+
*
|
|
35
|
+
* // 图标按钮
|
|
36
|
+
* <Button variant="ghost" size="icon">
|
|
37
|
+
* <IconComponent />
|
|
38
|
+
* </Button>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param {ButtonProps} props - 组件属性
|
|
42
|
+
* @param {string} [props.variant="default"] - 按钮变体样式
|
|
43
|
+
* - 'default' - 主要按钮
|
|
44
|
+
* - 'destructive' - 危险操作按钮
|
|
45
|
+
* - 'outline' - 轮廓按钮
|
|
46
|
+
* - 'secondary' - 次要按钮
|
|
47
|
+
* - 'ghost' - 幽灵按钮
|
|
48
|
+
* - 'link' - 链接样式按钮
|
|
49
|
+
* @param {string} [props.size="default"] - 按钮尺寸
|
|
50
|
+
* - 'default' - 默认大小
|
|
51
|
+
* - 'sm' - 小型按钮
|
|
52
|
+
* - 'lg' - 大型按钮
|
|
53
|
+
* - 'icon' - 图标按钮
|
|
54
|
+
* @param {string} [props.className] - 自定义类名
|
|
55
|
+
*/
|
|
56
|
+
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
9
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Heading 组件的通用属性类型
|
|
60
|
+
*/
|
|
10
61
|
interface HeadingProps {
|
|
62
|
+
/** 子元素内容 */
|
|
11
63
|
children?: ReactNode;
|
|
64
|
+
/** 自定义类名 */
|
|
12
65
|
className?: string;
|
|
66
|
+
/** 标题文本,可以替代 children */
|
|
13
67
|
title?: string;
|
|
14
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* 页面主标题组件,带有渐变色效果和动画
|
|
71
|
+
*
|
|
72
|
+
* @component
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <PageTitle>Welcome to My Site</PageTitle>
|
|
76
|
+
*
|
|
77
|
+
* // 使用 title 属性
|
|
78
|
+
* <PageTitle title="Welcome" className="my-8" />
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
15
81
|
declare function PageTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* 区块标题组件,用于页面主要区块的标题
|
|
84
|
+
*
|
|
85
|
+
* @component
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <SectionTitle>Featured Products</SectionTitle>
|
|
89
|
+
*
|
|
90
|
+
* // 自定义样式
|
|
91
|
+
* <SectionTitle className="mb-8">Our Services</SectionTitle>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
16
94
|
declare function SectionTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
/**
|
|
96
|
+
* 卡片标题组件,用于卡片或小区块的标题
|
|
97
|
+
*
|
|
98
|
+
* @component
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <CardTitle>Product Features</CardTitle>
|
|
102
|
+
*
|
|
103
|
+
* // 在卡片中使用
|
|
104
|
+
* <Card>
|
|
105
|
+
* <CardTitle>Premium Plan</CardTitle>
|
|
106
|
+
* <CardContent>...</CardContent>
|
|
107
|
+
* </Card>
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
17
110
|
declare function CardTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
111
|
+
/**
|
|
112
|
+
* 子标题组件,用于次级内容的标题
|
|
113
|
+
*
|
|
114
|
+
* @component
|
|
115
|
+
* @example
|
|
116
|
+
* font-semibold: font-weight: 600;
|
|
117
|
+
* text-lg: font-size: 1.125rem;
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <SubTitle>Technical Details</SubTitle>
|
|
120
|
+
*
|
|
121
|
+
* // 在列表中使用
|
|
122
|
+
* <div>
|
|
123
|
+
* <SubTitle>Specifications</SubTitle>
|
|
124
|
+
* <ul>...</ul>
|
|
125
|
+
* </div>
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
18
128
|
declare function SubTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
19
129
|
|
|
130
|
+
/**
|
|
131
|
+
* 导航项接口
|
|
132
|
+
* @interface NavItem
|
|
133
|
+
*/
|
|
20
134
|
interface NavItem {
|
|
135
|
+
/** 导航项唯一标识 */
|
|
21
136
|
key: string;
|
|
137
|
+
/** 导航链接地址 */
|
|
22
138
|
href: string;
|
|
23
139
|
label: string;
|
|
140
|
+
/** 自定义样式类名 */
|
|
24
141
|
className?: {
|
|
142
|
+
/** PC端样式 */
|
|
25
143
|
pc?: string;
|
|
144
|
+
/** 移动端样式 */
|
|
26
145
|
mobile?: string;
|
|
27
146
|
};
|
|
28
147
|
}
|
|
148
|
+
interface HeaderTheme {
|
|
149
|
+
activeClassName?: string;
|
|
150
|
+
mobileMenu?: {
|
|
151
|
+
button?: string;
|
|
152
|
+
nav?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
29
155
|
interface HeaderProps {
|
|
30
|
-
|
|
156
|
+
/** Logo 组件 */
|
|
157
|
+
logo: React__default.ReactNode;
|
|
158
|
+
/** 导航菜单项 */
|
|
31
159
|
menuItems: NavItem[];
|
|
160
|
+
/** 自定义样式类名 */
|
|
32
161
|
className?: string;
|
|
33
|
-
/**
|
|
162
|
+
/** 是否启用动画效果 */
|
|
34
163
|
enableAnimation?: boolean;
|
|
164
|
+
theme?: HeaderTheme;
|
|
35
165
|
}
|
|
36
|
-
declare const Header:
|
|
166
|
+
declare const Header: React__default.FC<HeaderProps>;
|
|
37
167
|
|
|
38
168
|
interface FooterLink {
|
|
39
169
|
href: string;
|
|
@@ -66,8 +196,50 @@ interface FooterProps {
|
|
|
66
196
|
/** 自定義類名 */
|
|
67
197
|
className?: string;
|
|
68
198
|
}
|
|
69
|
-
declare const Footer:
|
|
199
|
+
declare const Footer: React__default.FC<FooterProps>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 基础布局组件,提供页面的基本结构
|
|
203
|
+
*
|
|
204
|
+
* @component
|
|
205
|
+
* @example
|
|
206
|
+
* ```tsx
|
|
207
|
+
* <BasicLayout>
|
|
208
|
+
* <main>
|
|
209
|
+
* <h1>Welcome</h1>
|
|
210
|
+
* <p>Content goes here</p>
|
|
211
|
+
* </main>
|
|
212
|
+
* </BasicLayout>
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```tsx
|
|
217
|
+
* // 带有 metadata 的使用示例
|
|
218
|
+
* <BasicLayout
|
|
219
|
+
* metadata={{
|
|
220
|
+
* title: 'My Page',
|
|
221
|
+
* description: 'Page description'
|
|
222
|
+
* }}
|
|
223
|
+
* >
|
|
224
|
+
* <div>Content</div>
|
|
225
|
+
* </BasicLayout>
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function BasicLayout({ children }: {
|
|
229
|
+
children: React.ReactNode;
|
|
230
|
+
}): JSX.Element;
|
|
70
231
|
|
|
71
232
|
declare const useForceRerender: () => [number, () => void];
|
|
72
233
|
|
|
73
|
-
|
|
234
|
+
interface SmoothScrollProviderProps {
|
|
235
|
+
children: React$1.ReactNode;
|
|
236
|
+
}
|
|
237
|
+
declare function SmoothScrollProvider({ children }: SmoothScrollProviderProps): react_jsx_runtime.JSX.Element;
|
|
238
|
+
|
|
239
|
+
declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
|
|
240
|
+
|
|
241
|
+
declare function ThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
242
|
+
|
|
243
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
244
|
+
|
|
245
|
+
export { BasicLayout, Button, CardTitle, Footer, Header, PageTitle, SectionTitle, SmoothScrollProvider, SubTitle, ThemeProvider, ThemeToggle, cn, useForceRerender };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,169 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { ReactNode } from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { ThemeProviderProps } from 'next-themes';
|
|
7
|
+
import { ClassValue } from 'clsx';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 按钮变体样式配置
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
declare const buttonVariants: (props?: ({
|
|
14
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "borderNone" | null | undefined;
|
|
15
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
16
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Button 组件的属性类型
|
|
19
|
+
* @extends {React.ButtonHTMLAttributes<HTMLButtonElement>} 继承原生按钮属性
|
|
20
|
+
*/
|
|
21
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
7
22
|
}
|
|
8
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 现代化的按钮组件,支持多种变体和尺寸。
|
|
25
|
+
*
|
|
26
|
+
* @component
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // 默认按钮
|
|
30
|
+
* <Button>Click me</Button>
|
|
31
|
+
*
|
|
32
|
+
* // 带变体的按钮
|
|
33
|
+
* <Button variant="destructive" size="lg">Delete</Button>
|
|
34
|
+
*
|
|
35
|
+
* // 图标按钮
|
|
36
|
+
* <Button variant="ghost" size="icon">
|
|
37
|
+
* <IconComponent />
|
|
38
|
+
* </Button>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param {ButtonProps} props - 组件属性
|
|
42
|
+
* @param {string} [props.variant="default"] - 按钮变体样式
|
|
43
|
+
* - 'default' - 主要按钮
|
|
44
|
+
* - 'destructive' - 危险操作按钮
|
|
45
|
+
* - 'outline' - 轮廓按钮
|
|
46
|
+
* - 'secondary' - 次要按钮
|
|
47
|
+
* - 'ghost' - 幽灵按钮
|
|
48
|
+
* - 'link' - 链接样式按钮
|
|
49
|
+
* @param {string} [props.size="default"] - 按钮尺寸
|
|
50
|
+
* - 'default' - 默认大小
|
|
51
|
+
* - 'sm' - 小型按钮
|
|
52
|
+
* - 'lg' - 大型按钮
|
|
53
|
+
* - 'icon' - 图标按钮
|
|
54
|
+
* @param {string} [props.className] - 自定义类名
|
|
55
|
+
*/
|
|
56
|
+
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
9
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Heading 组件的通用属性类型
|
|
60
|
+
*/
|
|
10
61
|
interface HeadingProps {
|
|
62
|
+
/** 子元素内容 */
|
|
11
63
|
children?: ReactNode;
|
|
64
|
+
/** 自定义类名 */
|
|
12
65
|
className?: string;
|
|
66
|
+
/** 标题文本,可以替代 children */
|
|
13
67
|
title?: string;
|
|
14
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* 页面主标题组件,带有渐变色效果和动画
|
|
71
|
+
*
|
|
72
|
+
* @component
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <PageTitle>Welcome to My Site</PageTitle>
|
|
76
|
+
*
|
|
77
|
+
* // 使用 title 属性
|
|
78
|
+
* <PageTitle title="Welcome" className="my-8" />
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
15
81
|
declare function PageTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* 区块标题组件,用于页面主要区块的标题
|
|
84
|
+
*
|
|
85
|
+
* @component
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <SectionTitle>Featured Products</SectionTitle>
|
|
89
|
+
*
|
|
90
|
+
* // 自定义样式
|
|
91
|
+
* <SectionTitle className="mb-8">Our Services</SectionTitle>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
16
94
|
declare function SectionTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
/**
|
|
96
|
+
* 卡片标题组件,用于卡片或小区块的标题
|
|
97
|
+
*
|
|
98
|
+
* @component
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <CardTitle>Product Features</CardTitle>
|
|
102
|
+
*
|
|
103
|
+
* // 在卡片中使用
|
|
104
|
+
* <Card>
|
|
105
|
+
* <CardTitle>Premium Plan</CardTitle>
|
|
106
|
+
* <CardContent>...</CardContent>
|
|
107
|
+
* </Card>
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
17
110
|
declare function CardTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
111
|
+
/**
|
|
112
|
+
* 子标题组件,用于次级内容的标题
|
|
113
|
+
*
|
|
114
|
+
* @component
|
|
115
|
+
* @example
|
|
116
|
+
* font-semibold: font-weight: 600;
|
|
117
|
+
* text-lg: font-size: 1.125rem;
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <SubTitle>Technical Details</SubTitle>
|
|
120
|
+
*
|
|
121
|
+
* // 在列表中使用
|
|
122
|
+
* <div>
|
|
123
|
+
* <SubTitle>Specifications</SubTitle>
|
|
124
|
+
* <ul>...</ul>
|
|
125
|
+
* </div>
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
18
128
|
declare function SubTitle({ children, title, className }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
19
129
|
|
|
130
|
+
/**
|
|
131
|
+
* 导航项接口
|
|
132
|
+
* @interface NavItem
|
|
133
|
+
*/
|
|
20
134
|
interface NavItem {
|
|
135
|
+
/** 导航项唯一标识 */
|
|
21
136
|
key: string;
|
|
137
|
+
/** 导航链接地址 */
|
|
22
138
|
href: string;
|
|
23
139
|
label: string;
|
|
140
|
+
/** 自定义样式类名 */
|
|
24
141
|
className?: {
|
|
142
|
+
/** PC端样式 */
|
|
25
143
|
pc?: string;
|
|
144
|
+
/** 移动端样式 */
|
|
26
145
|
mobile?: string;
|
|
27
146
|
};
|
|
28
147
|
}
|
|
148
|
+
interface HeaderTheme {
|
|
149
|
+
activeClassName?: string;
|
|
150
|
+
mobileMenu?: {
|
|
151
|
+
button?: string;
|
|
152
|
+
nav?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
29
155
|
interface HeaderProps {
|
|
30
|
-
|
|
156
|
+
/** Logo 组件 */
|
|
157
|
+
logo: React__default.ReactNode;
|
|
158
|
+
/** 导航菜单项 */
|
|
31
159
|
menuItems: NavItem[];
|
|
160
|
+
/** 自定义样式类名 */
|
|
32
161
|
className?: string;
|
|
33
|
-
/**
|
|
162
|
+
/** 是否启用动画效果 */
|
|
34
163
|
enableAnimation?: boolean;
|
|
164
|
+
theme?: HeaderTheme;
|
|
35
165
|
}
|
|
36
|
-
declare const Header:
|
|
166
|
+
declare const Header: React__default.FC<HeaderProps>;
|
|
37
167
|
|
|
38
168
|
interface FooterLink {
|
|
39
169
|
href: string;
|
|
@@ -66,8 +196,50 @@ interface FooterProps {
|
|
|
66
196
|
/** 自定義類名 */
|
|
67
197
|
className?: string;
|
|
68
198
|
}
|
|
69
|
-
declare const Footer:
|
|
199
|
+
declare const Footer: React__default.FC<FooterProps>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 基础布局组件,提供页面的基本结构
|
|
203
|
+
*
|
|
204
|
+
* @component
|
|
205
|
+
* @example
|
|
206
|
+
* ```tsx
|
|
207
|
+
* <BasicLayout>
|
|
208
|
+
* <main>
|
|
209
|
+
* <h1>Welcome</h1>
|
|
210
|
+
* <p>Content goes here</p>
|
|
211
|
+
* </main>
|
|
212
|
+
* </BasicLayout>
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```tsx
|
|
217
|
+
* // 带有 metadata 的使用示例
|
|
218
|
+
* <BasicLayout
|
|
219
|
+
* metadata={{
|
|
220
|
+
* title: 'My Page',
|
|
221
|
+
* description: 'Page description'
|
|
222
|
+
* }}
|
|
223
|
+
* >
|
|
224
|
+
* <div>Content</div>
|
|
225
|
+
* </BasicLayout>
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function BasicLayout({ children }: {
|
|
229
|
+
children: React.ReactNode;
|
|
230
|
+
}): JSX.Element;
|
|
70
231
|
|
|
71
232
|
declare const useForceRerender: () => [number, () => void];
|
|
72
233
|
|
|
73
|
-
|
|
234
|
+
interface SmoothScrollProviderProps {
|
|
235
|
+
children: React$1.ReactNode;
|
|
236
|
+
}
|
|
237
|
+
declare function SmoothScrollProvider({ children }: SmoothScrollProviderProps): react_jsx_runtime.JSX.Element;
|
|
238
|
+
|
|
239
|
+
declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
|
|
240
|
+
|
|
241
|
+
declare function ThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
242
|
+
|
|
243
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
244
|
+
|
|
245
|
+
export { BasicLayout, Button, CardTitle, Footer, Header, PageTitle, SectionTitle, SmoothScrollProvider, SubTitle, ThemeProvider, ThemeToggle, cn, useForceRerender };
|