@coffic/cosy-ui 0.9.26 → 0.9.28
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.css +1 -1
- package/dist/src/assets/iconData.ts +10 -0
- package/dist/src-astro/alert/Alert.astro +10 -8
- package/dist/src-astro/alert-dialog/AlertDialog.astro +7 -4
- package/dist/src-astro/badge/Badge.astro +26 -6
- package/dist/src-astro/button/Button.astro +20 -0
- package/dist/src-astro/card/Card.astro +20 -20
- package/dist/src-astro/card-course/CardCourse.astro +11 -12
- package/dist/src-astro/card-course/types.ts +6 -6
- package/dist/src-astro/container/Container.astro +45 -40
- package/dist/src-astro/icons/ChevronLeftIcon.astro +31 -0
- package/dist/src-astro/icons/ChevronRightIcon.astro +31 -0
- package/dist/src-astro/icons/index.ts +2 -0
- package/dist/src-astro/layout-app/AppHeader.astro +1 -1
- package/dist/src-astro/layout-app/AppLayout.astro +24 -24
- package/dist/src-astro/layout-app/SkeletonLoader.astro +1 -1
- package/dist/src-astro/link/Link.astro +63 -53
- package/dist/src-astro/link/index.ts +2 -17
- package/dist/src-astro/link/types.ts +102 -0
- package/dist/src-astro/placeholder/PlaceHolder.astro +15 -15
- package/dist/src-astro/placeholder/types.ts +6 -6
- package/dist/src-astro/toc/TableOfContents.astro +53 -76
- package/dist/src-astro/toc/index.ts +1 -9
- package/package.json +1 -1
- package/dist/src-astro/link/LinkAnimations.astro +0 -29
- package/dist/src-astro/link/LinkBasic.astro +0 -17
- package/dist/src-astro/link/LinkVariants.astro +0 -20
- package/dist/src-astro/toc/TableOfContentsBasic.astro +0 -25
|
@@ -76,6 +76,16 @@ export const iconData: Record<string, IconData> = {
|
|
|
76
76
|
path: 'M19 9l-7 7-7-7',
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
+
// 左箭头图标
|
|
80
|
+
chevronLeft: {
|
|
81
|
+
path: 'M15 18l-6-6 6-6',
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// 右箭头图标
|
|
85
|
+
chevronRight: {
|
|
86
|
+
path: 'M9 18l6-6-6-6',
|
|
87
|
+
},
|
|
88
|
+
|
|
79
89
|
// 日历图标
|
|
80
90
|
calendar: {
|
|
81
91
|
path: 'M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z',
|
|
@@ -49,16 +49,18 @@
|
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
51
|
* @props
|
|
52
|
-
* @prop {
|
|
53
|
-
* @prop {
|
|
54
|
-
* @prop {string} [
|
|
55
|
-
* @prop {
|
|
56
|
-
* @prop {boolean} [showIcon=true] -
|
|
57
|
-
* @prop {
|
|
52
|
+
* @prop {string} [class] - 自定义 CSS 类名,用于覆盖默认样式
|
|
53
|
+
* @prop {boolean} [closable=true] - 是否可关闭,设置为 false 时隐藏关闭按钮
|
|
54
|
+
* @prop {string} [description] - 描述文本,显示在标题下方,字体较小且透明度降低
|
|
55
|
+
* @prop {('xs'|'sm'|'md'|'lg'|'xl')} [marginY] - 垂直方向外边距大小,支持预设的尺寸值
|
|
56
|
+
* @prop {boolean} [showIcon=true] - 是否显示图标,设置为 false 时隐藏类型对应的图标
|
|
57
|
+
* @prop {string} [title] - 提示标题,可选,显示为粗体文本
|
|
58
|
+
* @prop {('info'|'success'|'warning'|'error')} [type='info'] - 提示类型,影响颜色和图标,支持 info、success、warning、error 四种类型
|
|
59
|
+
* @prop {('solid'|'outline'|'dash'|'soft')} [variant='solid'] - 样式变体,支持 solid(实心)、outline(描边)、dash(虚线)、soft(柔和)四种风格
|
|
58
60
|
*
|
|
59
61
|
* @slots
|
|
60
|
-
* @slot default -
|
|
61
|
-
* @slot action - 自定义操作按钮,显示在 alert
|
|
62
|
+
* @slot default - 提示内容,主要文本内容
|
|
63
|
+
* @slot action - 自定义操作按钮,显示在 alert 右侧,适合放置自定义按钮或其他操作
|
|
62
64
|
*/
|
|
63
65
|
|
|
64
66
|
import '../../style.ts';
|
|
@@ -23,12 +23,15 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
25
|
* @props
|
|
26
|
-
* @prop {string}
|
|
27
|
-
* @prop {('zh-cn'|'en')} [lang='zh-cn'] -
|
|
28
|
-
* @prop {string}
|
|
26
|
+
* @prop {string} [id='alert-dialog'] - 对话框的唯一标识符,用于通过 JavaScript 控制对话框的显示和隐藏
|
|
27
|
+
* @prop {('zh-cn'|'en')} [lang='zh-cn'] - 语言设置,影响按钮文本,支持中文和英文两种语言
|
|
28
|
+
* @prop {string} message - 对话框显示的消息内容,支持任意文本内容
|
|
29
|
+
*
|
|
30
|
+
* @slots
|
|
31
|
+
* @slot default - 无插槽内容,所有内容通过 message 属性传递
|
|
29
32
|
*/
|
|
30
33
|
|
|
31
|
-
import '../../style';
|
|
34
|
+
import '../../style.ts';
|
|
32
35
|
|
|
33
36
|
export interface Props {
|
|
34
37
|
message: string;
|
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
---
|
|
2
2
|
/**
|
|
3
3
|
* @component Badge
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Badge 组件用于突出显示少量信息,如标签、状态或计数。
|
|
7
|
+
*
|
|
5
8
|
* @usage
|
|
9
|
+
* 基本用法:
|
|
6
10
|
* ```astro
|
|
7
11
|
* <Badge>默认</Badge>
|
|
8
12
|
* <Badge variant="primary">Primary</Badge>
|
|
9
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* 不同尺寸:
|
|
16
|
+
* ```astro
|
|
17
|
+
* <Badge size="xs">超小</Badge>
|
|
18
|
+
* <Badge size="sm">小</Badge>
|
|
19
|
+
* <Badge size="md">中</Badge>
|
|
20
|
+
* <Badge size="lg">大</Badge>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* 描边样式:
|
|
24
|
+
* ```astro
|
|
25
|
+
* <Badge outline>描边样式</Badge>
|
|
26
|
+
* <Badge variant="primary" outline>主要描边</Badge>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
10
29
|
* @props
|
|
11
|
-
* @prop {
|
|
12
|
-
* @prop {
|
|
13
|
-
* @prop {
|
|
14
|
-
* @prop {
|
|
30
|
+
* @prop {string} [class] - 自定义 CSS 类名,用于覆盖默认样式
|
|
31
|
+
* @prop {boolean} [outline=false] - 徽章是否为描边样式,设置为 true 时显示为描边风格
|
|
32
|
+
* @prop {('xs'|'sm'|'md'|'lg')} [size] - 徽章的尺寸,支持 xs、sm、md、lg 四种尺寸
|
|
33
|
+
* @prop {('primary'|'secondary'|'accent'|'ghost'|'info'|'success'|'warning'|'error')} [variant] - 徽章的颜色变体,支持多种预设颜色主题
|
|
34
|
+
*
|
|
15
35
|
* @slots
|
|
16
|
-
* @slot default -
|
|
36
|
+
* @slot default - 徽章内容,支持任意文本内容
|
|
17
37
|
*/
|
|
18
38
|
import '../../style.ts';
|
|
19
39
|
|
|
@@ -52,6 +52,26 @@
|
|
|
52
52
|
* <Button href="https://example.com">跳转链接</Button>
|
|
53
53
|
* <Button href="https://example.com" target="_blank">新窗口打开</Button>
|
|
54
54
|
* ```
|
|
55
|
+
*
|
|
56
|
+
* @props
|
|
57
|
+
* @prop {boolean} [block=false] - 是否为块级显示,设置为 true 时按钮占满容器宽度
|
|
58
|
+
* @prop {string} [class] - 自定义 CSS 类名,用于覆盖默认样式
|
|
59
|
+
* @prop {boolean} [disabled=false] - 是否禁用按钮,设置为 true 时按钮不可点击
|
|
60
|
+
* @prop {string} [formmethod] - 表单提交方法,支持 dialog 等特殊值
|
|
61
|
+
* @prop {string} [href] - 链接地址,设置后按钮变为链接形式
|
|
62
|
+
* @prop {boolean} [loading=false] - 是否显示加载状态,设置为 true 时显示加载动画
|
|
63
|
+
* @prop {string} [onClick] - 点击事件处理函数,支持内联 JavaScript 代码
|
|
64
|
+
* @prop {('circle'|'square')} [shape] - 按钮形状,支持 circle(圆形)和 square(方形)
|
|
65
|
+
* @prop {('lg'|'md'|'sm'|'xs')} [size='md'] - 按钮尺寸,支持 lg、md、sm、xs 四种尺寸
|
|
66
|
+
* @prop {string} [target] - 链接目标,支持 _self、_blank、_parent、_top
|
|
67
|
+
* @prop {('button'|'submit'|'reset')} [type='button'] - 按钮类型,支持 button、submit、reset
|
|
68
|
+
* @prop {('primary'|'secondary'|'accent'|'info'|'success'|'warning'|'error'|'ghost'|'link'|'outline'|'neutral'|'gradient-sky'|'gradient-watermelon'|'gradient-lemon'|'gradient-grape'|'gradient-mango'|'gradient-forest'|'gradient-ocean'|'gradient-sunset'|'gradient-flower'|'gradient-pitaya'|'gradient-banana'|'gradient-blueberry'|'gradient-kiwi')} [variant='primary'] - 按钮样式变体,支持多种预设样式和渐变效果
|
|
69
|
+
* @prop {boolean} [wide=false] - 是否为宽按钮,设置为 true 时按钮宽度增加
|
|
70
|
+
*
|
|
71
|
+
* @slots
|
|
72
|
+
* @slot default - 按钮内容,支持任意文本内容
|
|
73
|
+
* @slot icon-left - 左侧图标,显示在按钮内容左侧
|
|
74
|
+
* @slot icon-right - 右侧图标,显示在按钮内容右侧
|
|
55
75
|
*/
|
|
56
76
|
|
|
57
77
|
// 导入样式
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
59
|
* @props
|
|
60
|
-
* @prop {string} title - 卡片标题
|
|
61
|
-
* @prop {string} [subtitle] - 卡片副标题或描述
|
|
62
|
-
* @prop {string} [imageUrl] - 卡片顶部图片的URL
|
|
63
|
-
* @prop {string} [href] - 如果提供,卡片将变成可点击的链接
|
|
64
|
-
* @prop {boolean} [compact] - 是否使用紧凑模式
|
|
65
60
|
* @prop {string} [class] - 自定义CSS类,可用于覆盖默认样式
|
|
61
|
+
* @prop {boolean} [compact] - 是否使用紧凑模式
|
|
62
|
+
* @prop {string} [href] - 如果提供,卡片将变成可点击的链接
|
|
63
|
+
* @prop {string} [imageUrl] - 卡片顶部图片的URL
|
|
64
|
+
* @prop {string} [subtitle] - 卡片副标题或描述
|
|
65
|
+
* @prop {string} title - 卡片标题
|
|
66
66
|
*
|
|
67
67
|
* @slots
|
|
68
68
|
* @slot default - 卡片的主要内容区域
|
|
@@ -74,27 +74,27 @@ import '../../style.ts';
|
|
|
74
74
|
* Card 组件的 Props 接口
|
|
75
75
|
*/
|
|
76
76
|
export interface CardProps {
|
|
77
|
-
/** 卡片标题 */
|
|
78
|
-
title: string;
|
|
79
|
-
/** 卡片副标题或描述 */
|
|
80
|
-
subtitle?: string;
|
|
81
|
-
/** 卡片顶部图片的URL */
|
|
82
|
-
imageUrl?: string;
|
|
83
|
-
/** 如果提供,卡片将变成可点击的链接 */
|
|
84
|
-
href?: string;
|
|
85
|
-
/** 是否使用紧凑模式 */
|
|
86
|
-
compact?: boolean;
|
|
87
77
|
/** 自定义CSS类,可用于覆盖默认样式 */
|
|
88
78
|
class?: string;
|
|
79
|
+
/** 是否使用紧凑模式 */
|
|
80
|
+
compact?: boolean;
|
|
81
|
+
/** 如果提供,卡片将变成可点击的链接 */
|
|
82
|
+
href?: string;
|
|
83
|
+
/** 卡片顶部图片的URL */
|
|
84
|
+
imageUrl?: string;
|
|
85
|
+
/** 卡片副标题或描述 */
|
|
86
|
+
subtitle?: string;
|
|
87
|
+
/** 卡片标题 */
|
|
88
|
+
title: string;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const {
|
|
92
|
-
title,
|
|
93
|
-
subtitle,
|
|
94
|
-
imageUrl,
|
|
95
|
-
href,
|
|
96
|
-
compact,
|
|
97
92
|
class: className = '',
|
|
93
|
+
compact,
|
|
94
|
+
href,
|
|
95
|
+
imageUrl,
|
|
96
|
+
subtitle,
|
|
97
|
+
title,
|
|
98
98
|
} = Astro.props;
|
|
99
99
|
|
|
100
100
|
// 构建卡片样式类
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
* @usage
|
|
9
9
|
* ```astro
|
|
10
10
|
* <CardCourse courseName="React 基础教程" lang="zh" href="/courses/react-basics" />
|
|
11
|
-
* <CardCourse courseName="Vue 进阶" lang="zh" href="/courses/vue"
|
|
11
|
+
* <CardCourse courseName="Vue 进阶" lang="zh" href="/courses/vue" contentPadding="md" />
|
|
12
12
|
* <CardCourse courseName="AI 编程" keywords={["人工智能", "机器学习", "Python"]} lang="zh" href="/courses/ai" />
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* @props
|
|
16
|
+
* - contentPadding?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" - 内容区域内边距,默认为 "lg"
|
|
16
17
|
* - courseName: string - 课程标题
|
|
17
18
|
* - description?: string - 课程描述
|
|
18
|
-
* - lang: string - 语言("en" 或 "zh")
|
|
19
19
|
* - href: string - 课程链接
|
|
20
|
-
* - keywords?: string[] - 图标关键词数组,用于图标匹配
|
|
21
20
|
* - iconSize?: "sm" | "md" | "lg" | "xl" - 图标尺寸,默认为 "md"
|
|
22
|
-
* -
|
|
21
|
+
* - keywords?: string[] - 图标关键词数组,用于图标匹配
|
|
22
|
+
* - lang: string - 语言("en" 或 "zh")
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import '../../style.ts';
|
|
@@ -35,24 +35,23 @@ import { SmartBg } from '../smart-bg';
|
|
|
35
35
|
import type { PaddingSize } from './types';
|
|
36
36
|
|
|
37
37
|
interface Props {
|
|
38
|
+
contentPadding?: PaddingSize;
|
|
38
39
|
courseName: string;
|
|
39
40
|
description?: string;
|
|
40
|
-
lang: string;
|
|
41
41
|
href: string;
|
|
42
|
-
keywords?: string[];
|
|
43
42
|
iconSize?: 'sm' | 'md' | 'lg' | 'xl';
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
keywords?: string[];
|
|
44
|
+
lang: string;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
const {
|
|
48
|
+
contentPadding = 'lg',
|
|
49
49
|
courseName,
|
|
50
50
|
description = '',
|
|
51
|
-
lang,
|
|
52
51
|
href,
|
|
53
|
-
keywords = [],
|
|
54
52
|
iconSize = 'md',
|
|
55
|
-
|
|
53
|
+
keywords = [],
|
|
54
|
+
lang,
|
|
56
55
|
} = Astro.props;
|
|
57
56
|
|
|
58
57
|
const displayName = formatDisplayName(courseName);
|
|
@@ -90,7 +89,7 @@ const contentPaddingClasses = getContentPaddingClasses(contentPadding);
|
|
|
90
89
|
/>
|
|
91
90
|
|
|
92
91
|
<div
|
|
93
|
-
class={`cosy:card-body ${contentPaddingClasses} cosy:bg-base-100/30 cosy:relative cosy:z-10`}>
|
|
92
|
+
class={`cosy:card-body ${contentPaddingClasses} cosy:bg-base-100/30 cosy:relative cosy:z-10 cosy:h-full`}>
|
|
94
93
|
<!-- 内容区域 -->
|
|
95
94
|
<CardCourseContent displayName={displayName} description={description} />
|
|
96
95
|
|
|
@@ -7,18 +7,18 @@ export type PaddingSize = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3
|
|
|
7
7
|
* CardCourse 组件的 Props 接口
|
|
8
8
|
*/
|
|
9
9
|
export interface CardCourseProps {
|
|
10
|
+
/** 内容区域内边距,默认为 "lg" */
|
|
11
|
+
contentPadding?: PaddingSize;
|
|
10
12
|
/** 课程标题 */
|
|
11
13
|
courseName: string;
|
|
12
14
|
/** 课程描述 */
|
|
13
15
|
description?: string;
|
|
14
|
-
/** 语言("en" 或 "zh") */
|
|
15
|
-
lang: string;
|
|
16
16
|
/** 课程链接 */
|
|
17
17
|
href: string;
|
|
18
|
-
/** 图标关键词数组,用于图标匹配 */
|
|
19
|
-
keywords?: string[];
|
|
20
18
|
/** 图标尺寸,默认为 "md" */
|
|
21
19
|
iconSize?: "sm" | "md" | "lg" | "xl";
|
|
22
|
-
/**
|
|
23
|
-
|
|
20
|
+
/** 图标关键词数组,用于图标匹配 */
|
|
21
|
+
keywords?: string[];
|
|
22
|
+
/** 语言("en" 或 "zh") */
|
|
23
|
+
lang: string;
|
|
24
24
|
}
|
|
@@ -73,13 +73,18 @@
|
|
|
73
73
|
* ```
|
|
74
74
|
*
|
|
75
75
|
* @props
|
|
76
|
-
* @prop {
|
|
77
|
-
* @prop {
|
|
78
|
-
* @prop {string}
|
|
79
|
-
* @prop {
|
|
80
|
-
* @prop {
|
|
81
|
-
* @prop {string}
|
|
82
|
-
* @prop {string}
|
|
76
|
+
* @prop {boolean} [border=false] - 是否显示边框,启用后会在容器周围添加边框和圆角
|
|
77
|
+
* @prop {boolean} [centered=true] - 是否居中显示,设置为false时容器将靠左对齐
|
|
78
|
+
* @prop {string} [class] - 自定义CSS类名,用于添加额外的样式
|
|
79
|
+
* @prop {any} [class:list] - 类名列表,支持动态类名组合
|
|
80
|
+
* @prop {string} [flex] - flex布局方向,可选值:row、col、row-reverse、col-reverse,不设置则不启用flex布局
|
|
81
|
+
* @prop {string} [gap='none'] - flex项目间距,可选值:none、xs、sm、md、lg、xl,仅在启用flex布局时生效
|
|
82
|
+
* @prop {string} [items] - flex项目水平对齐方式,可选值:start、end、center、baseline、stretch,仅在启用flex布局时生效
|
|
83
|
+
* @prop {string} [justify] - flex项目垂直对齐方式,可选值:start、end、center、between、around、evenly,仅在启用flex布局时生效
|
|
84
|
+
* @prop {string} [margin='none'] - 外边距大小,可选值:none、xs、sm、md、lg、xl、2xl、3xl、4xl、5xl、6xl
|
|
85
|
+
* @prop {string} [padding='md'] - 内边距大小,可选值:none、sm、md、lg、xl
|
|
86
|
+
* @prop {string} [size='md'] - 容器尺寸,可选值:xs、sm、md、lg、xl、full,控制容器的最大宽度
|
|
87
|
+
* @prop {...HTMLAttributes<'div'>} [rest] - 其他HTML div标签属性
|
|
83
88
|
*/
|
|
84
89
|
|
|
85
90
|
import type { HTMLAttributes } from 'astro/types';
|
|
@@ -87,33 +92,10 @@ import '../../style.ts';
|
|
|
87
92
|
|
|
88
93
|
interface Props extends HTMLAttributes<'div'> {
|
|
89
94
|
/**
|
|
90
|
-
*
|
|
91
|
-
* @default
|
|
92
|
-
*/
|
|
93
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 内边距大小
|
|
97
|
-
* @default "md"
|
|
98
|
-
*/
|
|
99
|
-
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* 外边距大小
|
|
103
|
-
* @default "none"
|
|
95
|
+
* 是否显示边框
|
|
96
|
+
* @default false
|
|
104
97
|
*/
|
|
105
|
-
|
|
106
|
-
| 'none'
|
|
107
|
-
| 'xs'
|
|
108
|
-
| 'sm'
|
|
109
|
-
| 'md'
|
|
110
|
-
| 'lg'
|
|
111
|
-
| 'xl'
|
|
112
|
-
| '2xl'
|
|
113
|
-
| '3xl'
|
|
114
|
-
| '4xl'
|
|
115
|
-
| '5xl'
|
|
116
|
-
| '6xl';
|
|
98
|
+
border?: boolean;
|
|
117
99
|
|
|
118
100
|
/**
|
|
119
101
|
* 是否居中显示
|
|
@@ -122,10 +104,14 @@ interface Props extends HTMLAttributes<'div'> {
|
|
|
122
104
|
centered?: boolean;
|
|
123
105
|
|
|
124
106
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @default false
|
|
107
|
+
* 自定义类名
|
|
127
108
|
*/
|
|
128
|
-
|
|
109
|
+
class?: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 类名列表
|
|
113
|
+
*/
|
|
114
|
+
'class:list'?: any;
|
|
129
115
|
|
|
130
116
|
/**
|
|
131
117
|
* flex布局方向,不设置则不启用flex布局
|
|
@@ -149,14 +135,33 @@ interface Props extends HTMLAttributes<'div'> {
|
|
|
149
135
|
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';
|
|
150
136
|
|
|
151
137
|
/**
|
|
152
|
-
*
|
|
138
|
+
* 外边距大小
|
|
139
|
+
* @default "none"
|
|
153
140
|
*/
|
|
154
|
-
|
|
141
|
+
margin?:
|
|
142
|
+
| 'none'
|
|
143
|
+
| 'xs'
|
|
144
|
+
| 'sm'
|
|
145
|
+
| 'md'
|
|
146
|
+
| 'lg'
|
|
147
|
+
| 'xl'
|
|
148
|
+
| '2xl'
|
|
149
|
+
| '3xl'
|
|
150
|
+
| '4xl'
|
|
151
|
+
| '5xl'
|
|
152
|
+
| '6xl';
|
|
155
153
|
|
|
156
154
|
/**
|
|
157
|
-
*
|
|
155
|
+
* 内边距大小
|
|
156
|
+
* @default "md"
|
|
158
157
|
*/
|
|
159
|
-
'
|
|
158
|
+
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 容器尺寸
|
|
162
|
+
* @default "md"
|
|
163
|
+
*/
|
|
164
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
const {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import AstroIcon from './AstroIcon.astro';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 左箭头图标组件
|
|
6
|
+
*/
|
|
7
|
+
interface Props {
|
|
8
|
+
/**
|
|
9
|
+
* 图标的大小
|
|
10
|
+
* @default "24px"
|
|
11
|
+
*/
|
|
12
|
+
size?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 图标的颜色
|
|
15
|
+
* @default "currentColor"
|
|
16
|
+
*/
|
|
17
|
+
color?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 自定义类名
|
|
20
|
+
*/
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
size = '24px',
|
|
26
|
+
color = 'currentColor',
|
|
27
|
+
class: className = '',
|
|
28
|
+
} = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<AstroIcon name="chevronLeft" size={size} stroke={color} class={className} />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import AstroIcon from './AstroIcon.astro';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 右箭头图标组件
|
|
6
|
+
*/
|
|
7
|
+
interface Props {
|
|
8
|
+
/**
|
|
9
|
+
* 图标的大小
|
|
10
|
+
* @default "24px"
|
|
11
|
+
*/
|
|
12
|
+
size?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 图标的颜色
|
|
15
|
+
* @default "currentColor"
|
|
16
|
+
*/
|
|
17
|
+
color?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 自定义类名
|
|
20
|
+
*/
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
size = '24px',
|
|
26
|
+
color = 'currentColor',
|
|
27
|
+
class: className = '',
|
|
28
|
+
} = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<AstroIcon name="chevronRight" size={size} stroke={color} class={className} />
|
|
@@ -26,6 +26,8 @@ export { default as InfoCircle } from './InfoCircle.astro';
|
|
|
26
26
|
export { default as InboxArchive } from './InboxArchive.astro';
|
|
27
27
|
export { default as SettingsIcon } from './SettingsIcon.astro';
|
|
28
28
|
export { default as ChevronDownIcon } from './ChevronDownIcon.astro';
|
|
29
|
+
export { default as ChevronLeftIcon } from './ChevronLeftIcon.astro';
|
|
30
|
+
export { default as ChevronRightIcon } from './ChevronRightIcon.astro';
|
|
29
31
|
export { default as HomeIcon } from './HomeIcon.astro';
|
|
30
32
|
export { default as DashboardIcon } from './DashboardIcon.astro';
|
|
31
33
|
export { default as ChartIcon } from './ChartIcon.astro';
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
/**
|
|
3
|
-
* AppLayout
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* @component AppLayout
|
|
4
|
+
* @description 应用布局组件,适用于页面布局,包含头部导航、侧边栏导航和目录
|
|
5
|
+
* @usage 用于创建包含头部、侧边栏、主内容区和页脚的完整页面布局
|
|
6
|
+
* @props
|
|
7
|
+
* @prop {boolean} [debug=false] - 是否启用调试模式,显示各个部分的边框
|
|
8
|
+
* @prop {Object} [footerConfig] - 页脚配置,包含站点信息、社交媒体链接等
|
|
9
|
+
* @prop {Object} [headerConfig] - 头部配置,传递给AppHeader组件
|
|
10
|
+
* @prop {number} [loadingDelay=100] - 加载中界面延迟显示的时间(毫秒)
|
|
11
|
+
* @prop {Object} [mainContentConfig] - 主内容区域配置
|
|
12
|
+
* @prop {Object} [metaConfig] - 元数据配置,包含页面标题、描述等
|
|
13
|
+
* @prop {boolean} [showFooter=true] - 是否显示页脚
|
|
14
|
+
* @prop {boolean} [showHeader=true] - 是否显示头部
|
|
15
|
+
* @prop {boolean} [showSidebar=true] - 是否显示侧边栏
|
|
16
|
+
* @prop {Object} [sidebarConfig] - 侧边栏配置,包含导航项等
|
|
17
|
+
* @prop {string} [class] - 自定义CSS类名
|
|
18
|
+
* @prop {any} [class:list] - 类名列表
|
|
19
|
+
* @prop {...HTMLAttributes<'div'>} [rest] - 其他HTML div标签属性
|
|
20
|
+
* @slots
|
|
21
|
+
* @slot default - 主内容区域
|
|
22
|
+
* @slot navbar-start - 导航栏开始位置的内容(传递给AppHeader)
|
|
23
|
+
* @slot navbar-center - 导航栏中间位置的内容(传递给AppHeader)
|
|
24
|
+
* @slot navbar-end - 导航栏结束位置的内容(传递给AppHeader)
|
|
25
|
+
* @slot modal-search - 搜索模态框内容,当提供此slot时会显示搜索按钮(传递给AppHeader)
|
|
6
26
|
*
|
|
7
27
|
* 布局效果:
|
|
8
28
|
*
|
|
@@ -36,25 +56,6 @@
|
|
|
36
56
|
* +------------------+
|
|
37
57
|
* ```
|
|
38
58
|
*
|
|
39
|
-
* @param {Object} sidebarConfig - 侧边栏配置
|
|
40
|
-
* @param {boolean} [showHeader=true] - 是否显示头部
|
|
41
|
-
* @param {boolean} [showFooter=true] - 是否显示页脚
|
|
42
|
-
* @param {boolean} [showSidebar=true] - 是否显示侧边栏
|
|
43
|
-
* @param {string} [className] - 自定义类名
|
|
44
|
-
* @param {Array} [classList] - 自定义类名列表
|
|
45
|
-
* @param {boolean} [debug=true] - 是否启用调试模式
|
|
46
|
-
* @param {Object} mainContentConfig - 主内容区域配置
|
|
47
|
-
* @param {Object} footerConfig - 页脚配置
|
|
48
|
-
* @param {Object} headerConfig - 头部配置(传递给AppHeader组件)
|
|
49
|
-
* @param {Object} metaConfig - 元数据配置
|
|
50
|
-
* @param {Object} rest - 其他属性
|
|
51
|
-
*
|
|
52
|
-
* @slot default - 主内容区域
|
|
53
|
-
* @slot navbar-start - 导航栏开始位置的内容(传递给AppHeader)
|
|
54
|
-
* @slot navbar-center - 导航栏中间位置的内容(传递给AppHeader)
|
|
55
|
-
* @slot navbar-end - 导航栏结束位置的内容(传递给AppHeader)
|
|
56
|
-
* @slot modal-search - 搜索模态框内容,当提供此slot时会显示搜索按钮(传递给AppHeader)
|
|
57
|
-
*
|
|
58
59
|
* @example
|
|
59
60
|
* ```astro
|
|
60
61
|
* ---
|
|
@@ -330,11 +331,10 @@ const sidebarHeightClass = getSidebarHeightClass(headerConfig?.height);
|
|
|
330
331
|
headerConfig={headerConfig}
|
|
331
332
|
debug={debug}
|
|
332
333
|
showSidebar={showSidebar}
|
|
333
|
-
showSearch={
|
|
334
|
+
showSearch={Astro.slots.has('modal-search')}>
|
|
334
335
|
<slot name="navbar-start" slot="navbar-start" />
|
|
335
336
|
<slot name="navbar-center" slot="navbar-center" />
|
|
336
337
|
<slot name="navbar-end" slot="navbar-end" />
|
|
337
|
-
<slot name="modal-search" slot="modal-search" />
|
|
338
338
|
</AppHeader>
|
|
339
339
|
)
|
|
340
340
|
}
|
|
@@ -95,7 +95,7 @@ const {
|
|
|
95
95
|
const loaderId = `skeleton-loader-${Math.random().toString(36).substr(2, 9)}`;
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
<div id={loaderId} class="cosy:relative">
|
|
98
|
+
<div id={loaderId} class="cosy:relative cosy:w-full">
|
|
99
99
|
<!-- 骨架屏 -->
|
|
100
100
|
<div
|
|
101
101
|
id={`${loaderId}-skeleton`}
|