@coffic/cosy-ui 0.9.2 → 0.9.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/dist/app.css +1 -1
- package/dist/index-astro.ts +1 -0
- package/dist/src-astro/code-container/ButtonCodeToggle.astro +1 -1
- package/dist/src-astro/code-container/ButtonCopyCode.astro +1 -1
- package/dist/src-astro/empty-state/EmptyState.astro +100 -0
- package/dist/src-astro/empty-state/index.ts +2 -0
- package/dist/src-astro/empty-state/types.ts +70 -0
- package/dist/src-astro/layout-dashboard/DashboardLayout.astro +5 -29
- package/dist/src-astro/layout-dashboard/DashboardSidebar.astro +5 -24
- package/dist/src-astro/layout-dashboard/DashboardTopNavbar.astro +2 -26
- package/dist/src-astro/layout-dashboard/index.ts +5 -5
- package/dist/src-astro/layout-dashboard/types.ts +0 -120
- package/package.json +1 -1
package/dist/index-astro.ts
CHANGED
@@ -12,6 +12,7 @@ export * from './src-astro/code-panel';
|
|
12
12
|
export * from './src-astro/install-tabs';
|
13
13
|
export * from './src-astro/contact';
|
14
14
|
export * from './src-astro/container';
|
15
|
+
export * from './src-astro/empty-state';
|
15
16
|
export * from './src-astro/errors';
|
16
17
|
export * from './src-astro/flex';
|
17
18
|
export * from './src-astro/footer';
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component EmptyState
|
4
|
+
* @description 一个用于表示空状态的组件,通常在列表、搜索结果或任何需要数据的区域为空时使用。
|
5
|
+
*
|
6
|
+
* @usage
|
7
|
+
* ```astro
|
8
|
+
* <EmptyState
|
9
|
+
* icon="users"
|
10
|
+
* title="没有找到用户"
|
11
|
+
* description="尝试更改筛选条件或创建一个新用户。"
|
12
|
+
* >
|
13
|
+
* <Button>创建用户</Button>
|
14
|
+
* </EmptyState>
|
15
|
+
* ```
|
16
|
+
*
|
17
|
+
* @props
|
18
|
+
* - icon?: string - 在标题上方显示的图标名称。
|
19
|
+
* - title: string - 主标题,用于描述空状态。
|
20
|
+
* - description?: string - 对空状态的详细描述。
|
21
|
+
*
|
22
|
+
* @slots
|
23
|
+
* - default - 用于放置操作按钮,如"创建"或"返回"。
|
24
|
+
*/
|
25
|
+
import '../../style.ts';
|
26
|
+
import * as Icons from '../icons';
|
27
|
+
import type { EmptyStateProps, IconName } from './types';
|
28
|
+
|
29
|
+
const { title, description, icon, ...rest } = Astro.props;
|
30
|
+
|
31
|
+
const iconMap: Record<IconName, any> = {
|
32
|
+
SocialIcon: Icons.SocialIcon,
|
33
|
+
TwitterIcon: Icons.TwitterIcon,
|
34
|
+
UserIcon: Icons.UserIcon,
|
35
|
+
WarningIcon: Icons.WarningIcon,
|
36
|
+
XCircle: Icons.XCircle,
|
37
|
+
InfoIcon: Icons.InfoIcon,
|
38
|
+
LinkIcon: Icons.LinkIcon,
|
39
|
+
LinkedinIcon: Icons.LinkedinIcon,
|
40
|
+
MenuIcon: Icons.MenuIcon,
|
41
|
+
RefreshIcon: Icons.RefreshIcon,
|
42
|
+
SearchIcon: Icons.SearchIcon,
|
43
|
+
SuccessIcon: Icons.SuccessIcon,
|
44
|
+
SunCloudyIcon: Icons.SunCloudyIcon,
|
45
|
+
AlertTriangle: Icons.AlertTriangle,
|
46
|
+
CalendarIcon: Icons.CalendarIcon,
|
47
|
+
CheckCircle: Icons.CheckCircle,
|
48
|
+
CheckIcon: Icons.CheckIcon,
|
49
|
+
ClipboardIcon: Icons.ClipboardIcon,
|
50
|
+
CloseIcon: Icons.CloseIcon,
|
51
|
+
CodeIcon: Icons.CodeIcon,
|
52
|
+
DeleteIcon: Icons.DeleteIcon,
|
53
|
+
ErrorIcon: Icons.ErrorIcon,
|
54
|
+
GithubIcon: Icons.GithubIcon,
|
55
|
+
InfoCircle: Icons.InfoCircle,
|
56
|
+
InboxArchive: Icons.InboxArchive,
|
57
|
+
SettingsIcon: Icons.SettingsIcon,
|
58
|
+
ChevronDownIcon: Icons.ChevronDownIcon,
|
59
|
+
HomeIcon: Icons.HomeIcon,
|
60
|
+
DashboardIcon: Icons.DashboardIcon,
|
61
|
+
ChartIcon: Icons.ChartIcon,
|
62
|
+
DocumentIcon: Icons.DocumentIcon,
|
63
|
+
NotificationIcon: Icons.NotificationIcon,
|
64
|
+
UsersIcon: Icons.UsersIcon,
|
65
|
+
MessageIcon: Icons.MessageIcon,
|
66
|
+
MailIcon: Icons.MailIcon,
|
67
|
+
FolderIcon: Icons.FolderIcon,
|
68
|
+
StarIcon: Icons.StarIcon,
|
69
|
+
HeartIcon: Icons.HeartIcon,
|
70
|
+
SaveIcon: Icons.SaveIcon,
|
71
|
+
EditIcon: Icons.EditIcon,
|
72
|
+
ToolsIcon: Icons.ToolsIcon,
|
73
|
+
WalletIcon: Icons.WalletIcon,
|
74
|
+
ReportIcon: Icons.ReportIcon,
|
75
|
+
SecurityIcon: Icons.SecurityIcon,
|
76
|
+
UploadIcon: Icons.UploadIcon,
|
77
|
+
DownloadIcon: Icons.DownloadIcon,
|
78
|
+
LogOut: Icons.LogOut,
|
79
|
+
AppStoreIcon: Icons.AppStoreIcon,
|
80
|
+
WebsiteIcon: Icons.WebsiteIcon,
|
81
|
+
};
|
82
|
+
|
83
|
+
const IconComponent =
|
84
|
+
icon && iconMap[icon as IconName] ? iconMap[icon as IconName] : null;
|
85
|
+
---
|
86
|
+
|
87
|
+
<div class="cosy:text-center cosy:py-16 cosy:px-6" {...rest}>
|
88
|
+
{IconComponent && <IconComponent class="cosy:mx-auto cosy:h-12 cosy:w-12" />}
|
89
|
+
{title && <h3 class="cosy:mt-2 cosy:text-2xl cosy:font-bold">{title}</h3>}
|
90
|
+
{
|
91
|
+
description && (
|
92
|
+
<p class="cosy:mt-1 cosy:text-sm cosy:text-base-content/80">
|
93
|
+
{description}
|
94
|
+
</p>
|
95
|
+
)
|
96
|
+
}
|
97
|
+
<div class="cosy:mt-6 cosy:flex cosy:justify-center cosy:gap-4">
|
98
|
+
<slot />
|
99
|
+
</div>
|
100
|
+
</div>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import type { HTMLAttributes } from 'astro/types';
|
2
|
+
|
3
|
+
export const iconNames = [
|
4
|
+
'SocialIcon',
|
5
|
+
'TwitterIcon',
|
6
|
+
'UserIcon',
|
7
|
+
'WarningIcon',
|
8
|
+
'XCircle',
|
9
|
+
'InfoIcon',
|
10
|
+
'LinkIcon',
|
11
|
+
'LinkedinIcon',
|
12
|
+
'MenuIcon',
|
13
|
+
'RefreshIcon',
|
14
|
+
'SearchIcon',
|
15
|
+
'SuccessIcon',
|
16
|
+
'SunCloudyIcon',
|
17
|
+
'AlertTriangle',
|
18
|
+
'CalendarIcon',
|
19
|
+
'CheckCircle',
|
20
|
+
'CheckIcon',
|
21
|
+
'ClipboardIcon',
|
22
|
+
'CloseIcon',
|
23
|
+
'CodeIcon',
|
24
|
+
'DeleteIcon',
|
25
|
+
'ErrorIcon',
|
26
|
+
'GithubIcon',
|
27
|
+
'InfoCircle',
|
28
|
+
'InboxArchive',
|
29
|
+
'SettingsIcon',
|
30
|
+
'ChevronDownIcon',
|
31
|
+
'HomeIcon',
|
32
|
+
'DashboardIcon',
|
33
|
+
'ChartIcon',
|
34
|
+
'DocumentIcon',
|
35
|
+
'NotificationIcon',
|
36
|
+
'UsersIcon',
|
37
|
+
'MessageIcon',
|
38
|
+
'MailIcon',
|
39
|
+
'FolderIcon',
|
40
|
+
'StarIcon',
|
41
|
+
'HeartIcon',
|
42
|
+
'SaveIcon',
|
43
|
+
'EditIcon',
|
44
|
+
'ToolsIcon',
|
45
|
+
'WalletIcon',
|
46
|
+
'ReportIcon',
|
47
|
+
'SecurityIcon',
|
48
|
+
'UploadIcon',
|
49
|
+
'DownloadIcon',
|
50
|
+
'LogOut',
|
51
|
+
'AppStoreIcon',
|
52
|
+
'WebsiteIcon',
|
53
|
+
] as const;
|
54
|
+
|
55
|
+
export type IconName = (typeof iconNames)[number];
|
56
|
+
|
57
|
+
export interface EmptyStateProps extends HTMLAttributes<'div'> {
|
58
|
+
/**
|
59
|
+
* The title of the empty state.
|
60
|
+
*/
|
61
|
+
title?: string;
|
62
|
+
/**
|
63
|
+
* The description of the empty state.
|
64
|
+
*/
|
65
|
+
description?: string;
|
66
|
+
/**
|
67
|
+
* The name of the icon to display.
|
68
|
+
*/
|
69
|
+
icon?: IconName;
|
70
|
+
}
|
@@ -141,8 +141,6 @@
|
|
141
141
|
* - userMenuItems?: UserMenuItem[] - 用户菜单项,默认包含个人资料、设置、退出登录,图标会自动匹配
|
142
142
|
* - sidebarCollapsed?: boolean - 是否折叠侧边栏,默认为false
|
143
143
|
* - sidebarSize?: 'sm' | 'md' | 'lg' | 'xl' - 侧边栏尺寸,默认为"md"
|
144
|
-
* - sidebarTheme?: SidebarTheme - 侧边栏主题,默认为"default"
|
145
|
-
* - mainBackgroundTheme?: MainBackgroundTheme - 主内容区域背景主题,默认为"transparent"
|
146
144
|
* - head?: astroHTML.JSX.Element - 自定义头部内容
|
147
145
|
* - class?: string - 页面类名
|
148
146
|
* - class:list?: any - 类名列表
|
@@ -158,14 +156,7 @@ import DashboardSidebar from './DashboardSidebar.astro';
|
|
158
156
|
import DashboardTopNavbar from './DashboardTopNavbar.astro';
|
159
157
|
import { ToastContainer, ConfirmDialog } from '../../index-astro';
|
160
158
|
import '../../style.ts';
|
161
|
-
import {
|
162
|
-
type NavItem,
|
163
|
-
type SidebarSize,
|
164
|
-
type SidebarTheme,
|
165
|
-
type MainBackgroundTheme,
|
166
|
-
type UserMenuItem,
|
167
|
-
getMainBackgroundTheme,
|
168
|
-
} from './types';
|
159
|
+
import { type NavItem, type SidebarSize, type UserMenuItem } from './types';
|
169
160
|
|
170
161
|
export interface Props {
|
171
162
|
/**
|
@@ -216,18 +207,6 @@ export interface Props {
|
|
216
207
|
*/
|
217
208
|
sidebarSize?: SidebarSize;
|
218
209
|
|
219
|
-
/**
|
220
|
-
* 侧边栏主题
|
221
|
-
* @default "default"
|
222
|
-
*/
|
223
|
-
sidebarTheme?: SidebarTheme;
|
224
|
-
|
225
|
-
/**
|
226
|
-
* 主内容区域背景主题
|
227
|
-
* @default "transparent"
|
228
|
-
*/
|
229
|
-
mainBackgroundTheme?: MainBackgroundTheme;
|
230
|
-
|
231
210
|
/**
|
232
211
|
* 自定义头部内容
|
233
212
|
*/
|
@@ -278,8 +257,6 @@ const {
|
|
278
257
|
userMenuItems,
|
279
258
|
sidebarCollapsed = false,
|
280
259
|
sidebarSize = 'md',
|
281
|
-
sidebarTheme = 'default',
|
282
|
-
mainBackgroundTheme = 'base-100',
|
283
260
|
enableToast = true,
|
284
261
|
enableConfirmDialog = true,
|
285
262
|
head,
|
@@ -291,7 +268,6 @@ const {
|
|
291
268
|
} = Astro.props;
|
292
269
|
|
293
270
|
const currentPath = Astro.url.pathname;
|
294
|
-
const mainBackgroundStyles = getMainBackgroundTheme(mainBackgroundTheme);
|
295
271
|
|
296
272
|
const mainPaddingMap = {
|
297
273
|
none: '',
|
@@ -325,14 +301,13 @@ const mainPaddingMap = {
|
|
325
301
|
systemName={systemName}
|
326
302
|
navItems={navItems}
|
327
303
|
currentPath={currentPath}
|
328
|
-
size={sidebarSize}
|
329
|
-
theme={sidebarTheme}>
|
304
|
+
size={sidebarSize}>
|
330
305
|
<slot name="sidebar-footer" slot="footer" />
|
331
306
|
</DashboardSidebar>
|
332
307
|
</div>
|
333
308
|
|
334
309
|
<!-- 主内容区 -->
|
335
|
-
<div class="cosy:drawer-content cosy:flex cosy:flex-col">
|
310
|
+
<div class="cosy:drawer-content cosy:flex cosy:flex-col cosy:h-screen">
|
336
311
|
<!-- 顶部导航栏 -->
|
337
312
|
<DashboardTopNavbar
|
338
313
|
title={title}
|
@@ -345,8 +320,9 @@ const mainPaddingMap = {
|
|
345
320
|
<main
|
346
321
|
class:list={[
|
347
322
|
'cosy:flex-1',
|
323
|
+
'cosy:overflow-y-auto',
|
348
324
|
mainPaddingMap[mainPadding],
|
349
|
-
|
325
|
+
'cosy:bg-base-100',
|
350
326
|
]}>
|
351
327
|
<slot />
|
352
328
|
</main>
|
@@ -28,7 +28,6 @@
|
|
28
28
|
* - navItems: NavItem[] - 导航项目
|
29
29
|
* - currentPath?: string - 当前路径,用于高亮当前页面
|
30
30
|
* - size?: 'sm' | 'md' | 'lg' | 'xl' - 侧边栏尺寸,默认为"md"
|
31
|
-
* - theme?: SidebarTheme - 侧边栏主题,默认为"default"
|
32
31
|
*
|
33
32
|
* @slots
|
34
33
|
* - footer - 侧边栏底部自定义内容,可用于展示用户信息等
|
@@ -38,10 +37,8 @@ import '../../style.ts';
|
|
38
37
|
import {
|
39
38
|
getNavItemIcon,
|
40
39
|
getSidebarWidth,
|
41
|
-
getSidebarTheme,
|
42
40
|
type NavItem,
|
43
41
|
type SidebarSize,
|
44
|
-
type SidebarTheme,
|
45
42
|
} from './types';
|
46
43
|
import AstroIcon from '../icons/AstroIcon.astro';
|
47
44
|
|
@@ -67,12 +64,6 @@ export interface Props {
|
|
67
64
|
* @default "md"
|
68
65
|
*/
|
69
66
|
size?: SidebarSize;
|
70
|
-
|
71
|
-
/**
|
72
|
-
* 侧边栏主题
|
73
|
-
* @default "default"
|
74
|
-
*/
|
75
|
-
theme?: SidebarTheme;
|
76
67
|
}
|
77
68
|
|
78
69
|
const {
|
@@ -80,26 +71,16 @@ const {
|
|
80
71
|
navItems,
|
81
72
|
currentPath = '',
|
82
73
|
size = 'md',
|
83
|
-
theme = 'default',
|
84
74
|
} = Astro.props;
|
85
|
-
|
86
|
-
const themeStyles = getSidebarTheme(theme);
|
87
75
|
---
|
88
76
|
|
89
77
|
<aside
|
90
78
|
class:list={[
|
91
79
|
getSidebarWidth(size),
|
92
|
-
'cosy:min-h-full cosy:flex cosy:flex-col',
|
93
|
-
themeStyles.bg,
|
94
|
-
themeStyles.textColor,
|
80
|
+
'cosy:min-h-full cosy:flex cosy:flex-col cosy:bg-base-200 cosy:text-base-content',
|
95
81
|
]}>
|
96
82
|
<!-- 侧边栏头部 -->
|
97
|
-
<div
|
98
|
-
class:list={[
|
99
|
-
'cosy:navbar cosy:border-b',
|
100
|
-
themeStyles.headerBg,
|
101
|
-
themeStyles.borderColor,
|
102
|
-
]}>
|
83
|
+
<div class:list={['cosy:navbar cosy:border-b cosy:border-base-300']}>
|
103
84
|
<div class="cosy:navbar-start">
|
104
85
|
<a
|
105
86
|
href="/dashboard"
|
@@ -118,7 +99,7 @@ const themeStyles = getSidebarTheme(theme);
|
|
118
99
|
<!-- 导航菜单 -->
|
119
100
|
<div class="cosy:flex-1 cosy:overflow-y-auto">
|
120
101
|
<ul
|
121
|
-
class="cosy:menu cosy:p-4 cosy:space-y-1 cosy:list-none cosy:no-underline">
|
102
|
+
class="cosy:menu cosy:p-4 cosy:space-y-1 cosy:list-none cosy:no-underline cosy:w-full">
|
122
103
|
{
|
123
104
|
navItems.map((item: NavItem) => {
|
124
105
|
const isActive =
|
@@ -129,7 +110,7 @@ const themeStyles = getSidebarTheme(theme);
|
|
129
110
|
));
|
130
111
|
|
131
112
|
return (
|
132
|
-
<li>
|
113
|
+
<li class="cosy:w-full">
|
133
114
|
<a
|
134
115
|
href={item.href}
|
135
116
|
class:list={[
|
@@ -186,7 +167,7 @@ const themeStyles = getSidebarTheme(theme);
|
|
186
167
|
</div>
|
187
168
|
|
188
169
|
<!-- 侧边栏底部自定义内容 -->
|
189
|
-
<div class:list={['cosy:mt-auto cosy:border-t'
|
170
|
+
<div class:list={['cosy:mt-auto cosy:border-t cosy:border-base-300']}>
|
190
171
|
<slot name="footer" />
|
191
172
|
</div>
|
192
173
|
</aside>
|
@@ -73,7 +73,8 @@ const defaultUserMenuItems: UserMenuItem[] = [
|
|
73
73
|
const menuItems = userMenuItems || defaultUserMenuItems;
|
74
74
|
---
|
75
75
|
|
76
|
-
<div
|
76
|
+
<div
|
77
|
+
class="cosy:navbar cosy:bg-base-100 cosy:shadow-2xl cosy:border-b cosy:border-base-300">
|
77
78
|
<div class="cosy:navbar-start">
|
78
79
|
<label
|
79
80
|
for="dashboard-drawer"
|
@@ -88,31 +89,6 @@ const menuItems = userMenuItems || defaultUserMenuItems;
|
|
88
89
|
</div>
|
89
90
|
|
90
91
|
<div class="cosy:navbar-end cosy:gap-2">
|
91
|
-
<!-- 搜索框 -->
|
92
|
-
<div class="cosy:form-control cosy:hidden cosy:lg:flex">
|
93
|
-
<div class="cosy:input-group">
|
94
|
-
<input
|
95
|
-
type="text"
|
96
|
-
placeholder="搜索..."
|
97
|
-
class="cosy:input cosy:input-bordered cosy:input-sm cosy:w-48"
|
98
|
-
/>
|
99
|
-
<button class="cosy:btn cosy:btn-square cosy:btn-sm">
|
100
|
-
<AstroIcon name="search" size="16px" stroke="currentColor" />
|
101
|
-
</button>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
|
105
|
-
<!-- 通知 -->
|
106
|
-
<div class="cosy:indicator">
|
107
|
-
<button class="cosy:btn cosy:btn-ghost cosy:btn-circle">
|
108
|
-
<AstroIcon name="notification" size="18px" stroke="currentColor" />
|
109
|
-
</button>
|
110
|
-
<span
|
111
|
-
class="cosy:badge cosy:badge-xs cosy:badge-primary cosy:indicator-item"
|
112
|
-
>3</span
|
113
|
-
>
|
114
|
-
</div>
|
115
|
-
|
116
92
|
<!-- 用户信息 -->
|
117
93
|
{
|
118
94
|
userName && (
|
@@ -7,11 +7,11 @@ import DashboardSidebar from './DashboardSidebar.astro';
|
|
7
7
|
import DashboardTopNavbar from './DashboardTopNavbar.astro';
|
8
8
|
|
9
9
|
export {
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
DashboardLayout,
|
11
|
+
DashboardSidebar,
|
12
|
+
DashboardTopNavbar
|
13
13
|
};
|
14
14
|
|
15
15
|
// 导出类型和函数
|
16
|
-
export type { NavItem, SidebarSize,
|
17
|
-
export { getIconFromHref, getNavItemIcon, getSidebarWidth
|
16
|
+
export type { NavItem, SidebarSize, UserMenuItem } from './types';
|
17
|
+
export { getIconFromHref, getNavItemIcon, getSidebarWidth } from './types';
|
@@ -43,124 +43,4 @@ export function getSidebarWidth(size: SidebarSize = 'md'): string {
|
|
43
43
|
return sidebarSizeMap[size];
|
44
44
|
}
|
45
45
|
|
46
|
-
/**
|
47
|
-
* 侧边栏背景色主题类型
|
48
|
-
*/
|
49
|
-
export type SidebarTheme = 'default' | 'dark' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
|
50
|
-
|
51
|
-
/**
|
52
|
-
* 侧边栏背景色主题配置映射
|
53
|
-
*/
|
54
|
-
export const sidebarThemeMap: Record<SidebarTheme, { bg: string; headerBg: string; textColor: string; borderColor: string }> = {
|
55
|
-
'default': {
|
56
|
-
bg: 'cosy:bg-base-300',
|
57
|
-
headerBg: 'cosy:bg-base-300',
|
58
|
-
textColor: 'cosy:text-base-content',
|
59
|
-
borderColor: 'cosy:border-base-200'
|
60
|
-
},
|
61
|
-
'dark': {
|
62
|
-
bg: 'cosy:bg-base-100',
|
63
|
-
headerBg: 'cosy:bg-base-100',
|
64
|
-
textColor: 'cosy:text-base-content',
|
65
|
-
borderColor: 'cosy:border-base-200'
|
66
|
-
},
|
67
|
-
'neutral': {
|
68
|
-
bg: 'cosy:bg-neutral',
|
69
|
-
headerBg: 'cosy:bg-neutral',
|
70
|
-
textColor: 'cosy:text-neutral-content',
|
71
|
-
borderColor: 'cosy:border-neutral-focus'
|
72
|
-
},
|
73
|
-
'primary': {
|
74
|
-
bg: 'cosy:bg-primary',
|
75
|
-
headerBg: 'cosy:bg-primary',
|
76
|
-
textColor: 'cosy:text-primary-content',
|
77
|
-
borderColor: 'cosy:border-primary-focus'
|
78
|
-
},
|
79
|
-
'secondary': {
|
80
|
-
bg: 'cosy:bg-secondary',
|
81
|
-
headerBg: 'cosy:bg-secondary',
|
82
|
-
textColor: 'cosy:text-secondary-content',
|
83
|
-
borderColor: 'cosy:border-secondary-focus'
|
84
|
-
},
|
85
|
-
'accent': {
|
86
|
-
bg: 'cosy:bg-accent',
|
87
|
-
headerBg: 'cosy:bg-accent',
|
88
|
-
textColor: 'cosy:text-accent-content',
|
89
|
-
borderColor: 'cosy:border-accent-focus'
|
90
|
-
},
|
91
|
-
'info': {
|
92
|
-
bg: 'cosy:bg-info',
|
93
|
-
headerBg: 'cosy:bg-info',
|
94
|
-
textColor: 'cosy:text-info-content',
|
95
|
-
borderColor: 'cosy:border-info-focus'
|
96
|
-
},
|
97
|
-
'success': {
|
98
|
-
bg: 'cosy:bg-success',
|
99
|
-
headerBg: 'cosy:bg-success',
|
100
|
-
textColor: 'cosy:text-success-content',
|
101
|
-
borderColor: 'cosy:border-success-focus'
|
102
|
-
},
|
103
|
-
'warning': {
|
104
|
-
bg: 'cosy:bg-warning',
|
105
|
-
headerBg: 'cosy:bg-warning',
|
106
|
-
textColor: 'cosy:text-warning-content',
|
107
|
-
borderColor: 'cosy:border-warning-focus'
|
108
|
-
},
|
109
|
-
'error': {
|
110
|
-
bg: 'cosy:bg-error',
|
111
|
-
headerBg: 'cosy:bg-error',
|
112
|
-
textColor: 'cosy:text-error-content',
|
113
|
-
borderColor: 'cosy:border-error-focus'
|
114
|
-
}
|
115
|
-
};
|
116
|
-
|
117
|
-
/**
|
118
|
-
* 获取侧边栏主题样式类
|
119
|
-
* @param theme 侧边栏主题
|
120
|
-
* @returns 对应的样式配置
|
121
|
-
*/
|
122
|
-
export function getSidebarTheme(theme: SidebarTheme = 'default') {
|
123
|
-
return sidebarThemeMap[theme];
|
124
|
-
}
|
125
|
-
|
126
|
-
/**
|
127
|
-
* 主内容区域背景主题类型
|
128
|
-
*/
|
129
|
-
export type MainBackgroundTheme = 'transparent' | 'base-100' | 'base-200' | 'base-300' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'gradient-warm' | 'gradient-cool' | 'gradient-rainbow' | 'gradient-sunset' | 'gradient-ocean' | 'gradient-forest';
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
/**
|
134
|
-
* 主内容区域背景主题配置映射
|
135
|
-
*/
|
136
|
-
export const mainBackgroundThemeMap: Record<MainBackgroundTheme, string> = {
|
137
|
-
'transparent': '',
|
138
|
-
'base-100': 'cosy:bg-base-100',
|
139
|
-
'base-200': 'cosy:bg-base-200',
|
140
|
-
'base-300': 'cosy:bg-base-300',
|
141
|
-
'neutral': 'cosy:bg-neutral',
|
142
|
-
'primary': 'cosy:bg-primary',
|
143
|
-
'secondary': 'cosy:bg-secondary',
|
144
|
-
'accent': 'cosy:bg-accent',
|
145
|
-
'info': 'cosy:bg-info',
|
146
|
-
'success': 'cosy:bg-success',
|
147
|
-
'warning': 'cosy:bg-warning',
|
148
|
-
'error': 'cosy:bg-error',
|
149
|
-
'gradient-warm': 'cosy:bg-gradient-to-br cosy:from-orange-100 cosy:via-red-50 cosy:to-pink-100',
|
150
|
-
'gradient-cool': 'cosy:bg-gradient-to-br cosy:from-blue-100 cosy:via-cyan-50 cosy:to-green-100',
|
151
|
-
'gradient-rainbow': 'cosy:bg-gradient-to-br cosy:from-purple-100 cosy:via-pink-50 cosy:to-blue-100',
|
152
|
-
'gradient-sunset': 'cosy:bg-gradient-to-br cosy:from-yellow-100 cosy:via-orange-50 cosy:to-red-100',
|
153
|
-
'gradient-ocean': 'cosy:bg-gradient-to-br cosy:from-blue-100 cosy:via-teal-50 cosy:to-cyan-100',
|
154
|
-
'gradient-forest': 'cosy:bg-gradient-to-br cosy:from-green-100 cosy:via-emerald-50 cosy:to-teal-100'
|
155
|
-
};
|
156
|
-
|
157
|
-
/**
|
158
|
-
* 获取主内容区域背景主题样式类
|
159
|
-
* @param theme 主内容区域背景主题
|
160
|
-
* @returns 对应的样式类名
|
161
|
-
*/
|
162
|
-
export function getMainBackgroundTheme(theme: MainBackgroundTheme = 'base-100'): string {
|
163
|
-
return mainBackgroundThemeMap[theme];
|
164
|
-
}
|
165
|
-
|
166
46
|
export { getIconFromHref, getNavItemIcon, getUserMenuItemIcon } from './tools';
|