@coffic/cosy-ui 0.8.12 → 0.8.16
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 +31 -0
- package/dist/app.css +1 -1
- package/dist/index-astro.ts +18 -10
- package/dist/index-vue.ts +2 -2
- package/dist/{vue → src}/utils/language.ts +1 -1
- package/dist/src/utils/link.ts +250 -0
- package/dist/{vue → src}/utils/path.ts +1 -1
- package/dist/src-astro/article/index.ts +1 -1
- package/dist/src-astro/assets/iconData.ts +5 -0
- package/dist/src-astro/banner/index.ts +1 -1
- package/dist/src-astro/code-container/CodeContainer.astro +6 -91
- package/dist/src-astro/confirm-dialog/ConfirmDialog.astro +119 -0
- package/dist/src-astro/confirm-dialog/index.ts +2 -0
- package/dist/src-astro/confirm-dialog/types.ts +47 -0
- package/dist/src-astro/cosy.ts +1 -1
- package/dist/src-astro/database/index.ts +3 -0
- package/dist/src-astro/entities/BlogDoc.ts +1 -1
- package/dist/src-astro/entities/CourseDoc.ts +1 -1
- package/dist/src-astro/entities/ExperimentDoc.ts +1 -1
- package/dist/src-astro/entities/LessonDoc.ts +1 -1
- package/dist/src-astro/entities/MetaDoc.ts +1 -1
- package/dist/src-astro/entities/Tag.ts +1 -1
- package/dist/src-astro/errors/403.astro +1 -1
- package/dist/src-astro/errors/404.astro +1 -1
- package/dist/src-astro/errors/500.astro +1 -1
- package/dist/src-astro/errors/503.astro +1 -1
- package/dist/src-astro/flex/index.ts +1 -1
- package/dist/src-astro/footer/Footer.astro +1 -1
- package/dist/src-astro/grid/index.ts +1 -1
- package/dist/src-astro/heading/index.ts +1 -1
- package/dist/src-astro/icons/LogOut.astro +28 -0
- package/dist/src-astro/icons/index.ts +1 -0
- package/dist/src-astro/image/index.ts +1 -1
- package/dist/src-astro/language-switcher/index.ts +1 -1
- package/dist/src-astro/layout-basic/index.ts +1 -1
- package/dist/src-astro/layout-dashboard/DashboardLayout.astro +76 -1
- package/dist/src-astro/layout-dashboard/tools.ts +158 -0
- package/dist/src-astro/layout-dashboard/types.ts +1 -154
- package/dist/src-astro/link/index.ts +1 -1
- package/dist/src-astro/login/Login.astro +251 -0
- package/dist/src-astro/login/index.ts +2 -0
- package/dist/src-astro/logout/Logout.astro +117 -0
- package/dist/src-astro/logout/index.ts +2 -0
- package/dist/src-astro/module/index.ts +1 -1
- package/dist/src-astro/nav-item/NavItems.astro +1 -1
- package/dist/src-astro/nav-item/index.ts +1 -1
- package/dist/src-astro/nav-section/index.ts +1 -1
- package/dist/src-astro/register/Register.astro +289 -0
- package/dist/src-astro/register/index.ts +2 -0
- package/dist/src-astro/sidebar/Sidebar.astro +1 -1
- package/dist/src-astro/sidebar/index.ts +1 -1
- package/dist/src-astro/sidebar-nav/SidebarNav.astro +1 -1
- package/dist/src-astro/sidebar-nav/index.ts +1 -1
- package/dist/src-astro/speak/index.ts +1 -1
- package/dist/src-astro/stack/index.ts +1 -1
- package/dist/src-astro/team-member/TeamMemberBasic.astro +1 -1
- package/dist/src-astro/team-member/TeamMemberCustomStyle.astro +1 -1
- package/dist/src-astro/team-member/TeamMemberGroup.astro +1 -1
- package/dist/src-astro/team-member/TeamMemberWithSocial.astro +1 -1
- package/dist/src-astro/team-member/index.ts +1 -1
- package/dist/src-astro/text/index.ts +1 -1
- package/dist/src-astro/theme-switcher/ThemeSwitcher.astro +1 -1
- package/dist/src-astro/theme-switcher/index.ts +1 -1
- package/dist/src-astro/toast/Toast.astro +114 -0
- package/dist/src-astro/toast/ToastContainer.astro +249 -0
- package/dist/src-astro/toast/index.ts +4 -0
- package/dist/src-astro/toast/types.ts +78 -0
- package/dist/src-astro/toc/TableOfContents.astro +2 -2
- package/dist/src-astro/toc/index.ts +1 -1
- package/dist/src-astro/types/nav.ts +26 -1
- package/dist/{vue/buttons-vue → src-vue/buttons}/Button.vue +14 -19
- package/dist/{vue/icons-vue → src-vue/icons}/VueIcon.vue +3 -13
- package/dist/src-vue/utils/link.ts +250 -0
- package/package.json +1 -1
- package/dist/src-astro/utils/link.ts +0 -250
- package/dist/vue/utils/link.ts +0 -250
- /package/dist/{vue → src}/utils/component.ts +0 -0
- /package/dist/{vue → src}/utils/i18n.ts +0 -0
- /package/dist/{vue → src}/utils/image.ts +0 -0
- /package/dist/{vue → src}/utils/lang_entry.ts +0 -0
- /package/dist/{vue → src}/utils/lang_package.ts +0 -0
- /package/dist/{vue → src}/utils/logger.ts +0 -0
- /package/dist/{vue → src}/utils/social.ts +0 -0
- /package/dist/{vue → src}/utils/theme.ts +0 -0
- /package/dist/{vue → src}/utils/url.ts +0 -0
- /package/dist/{vue → src-vue}/SmartLink.vue +0 -0
- /package/dist/{vue → src-vue}/TagList.vue +0 -0
- /package/dist/{vue → src-vue}/alert-dialog-vue/AlertDialog.vue +0 -0
- /package/dist/{vue → src-vue}/alert-dialog-vue/Basic.vue +0 -0
- /package/dist/{vue → src-vue}/alert-dialog-vue/Multilang.vue +0 -0
- /package/dist/{vue → src-vue}/alert-dialog-vue/index.ts +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/BannerBox.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/DownloadButton.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleBasic.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleCustomBg.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleDisplayModeAlways.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleDisplayModeHover.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleDisplayModeNever.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleImageExport.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/ExampleSizePreset.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/FeatureCard.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/SmartBanner.vue +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/bgStyles.ts +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/index.ts +0 -0
- /package/dist/{vue → src-vue}/banner-box-vue/sizePresets.ts +0 -0
- /package/dist/{vue → src-vue}/blog-vue/Basic.vue +0 -0
- /package/dist/{vue → src-vue}/blog-vue/BlogList.vue +0 -0
- /package/dist/{vue → src-vue}/blog-vue/Empty.vue +0 -0
- /package/dist/{vue → src-vue}/blog-vue/EmptyEnglish.vue +0 -0
- /package/dist/{vue → src-vue}/blog-vue/English.vue +0 -0
- /package/dist/{vue → src-vue}/blog-vue/index.ts +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonBasic.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonFeature.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonFeatureBasic.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonFeatureWithTips.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonLink.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonSizes.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonVariants.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonWithIcons.vue +0 -0
- /package/dist/{vue/buttons-vue → src-vue/buttons}/index.ts +0 -0
- /package/dist/{vue → src-vue}/confirm-dialog-vue/Basic.vue +0 -0
- /package/dist/{vue → src-vue}/confirm-dialog-vue/ConfirmDialog.vue +0 -0
- /package/dist/{vue → src-vue}/confirm-dialog-vue/CustomButtons.vue +0 -0
- /package/dist/{vue → src-vue}/confirm-dialog-vue/index.ts +0 -0
- /package/dist/{vue → src-vue}/cosy.ts +0 -0
- /package/dist/{vue → src-vue}/counter-vue/VueCounter.vue +0 -0
- /package/dist/{vue → src-vue}/counter-vue/index.ts +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/Basic.vue +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/CustomBackground.vue +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/NoFrame.vue +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/WeatherApp.vue +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/iPhoneWindow.vue +0 -0
- /package/dist/{vue → src-vue}/iPhone-vue/index.ts +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/AlertTriangleIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/CalendarIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/CheckCircleIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/CheckIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/ChevronDownIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/ClipboardIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/CloseIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/InboxArchiveIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/InfoCircleIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/InfoIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/LinkIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/MenuIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/SearchIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/SettingsIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/UserIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/XCircleIcon.vue +0 -0
- /package/dist/{vue/icons-vue → src-vue/icons}/index.ts +0 -0
- /package/dist/{vue → src-vue}/list-vue/ListItem.vue +0 -0
- /package/dist/{vue → src-vue}/list-vue/index.ts +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/Basic.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/CustomHeight.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/MacWindow.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/WithEvents.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/WithSidebar.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/WithTabs.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/WithToolbar.vue +0 -0
- /package/dist/{vue → src-vue}/mac-window-vue/index.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/component.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/i18n.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/image.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/lang_entry.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/lang_package.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/language.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/logger.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/path.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/social.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/theme.ts +0 -0
- /package/dist/{src-astro → src-vue}/utils/url.ts +0 -0
@@ -0,0 +1,289 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Register
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* Register 组件用于创建灵活且功能丰富的注册页面。支持多种注册方式、表单验证和自定义样式。
|
7
|
+
*
|
8
|
+
* @usage
|
9
|
+
* 基本用法:
|
10
|
+
* ```astro
|
11
|
+
* <Register title="创建账号" />
|
12
|
+
* ```
|
13
|
+
*
|
14
|
+
* 自定义注册方式:
|
15
|
+
* ```astro
|
16
|
+
* <Register
|
17
|
+
* title="加入我们"
|
18
|
+
* subtitle="创建你的账号"
|
19
|
+
* socialLogins={['github', 'google']}
|
20
|
+
* showTerms={true}
|
21
|
+
* showPrivacy={true}
|
22
|
+
* />
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* 完全自定义:
|
26
|
+
* ```astro
|
27
|
+
* <Register
|
28
|
+
* title="企业注册"
|
29
|
+
* subtitle="创建企业账号"
|
30
|
+
* logo="/path/to/logo.png"
|
31
|
+
* socialLogins={['github', 'google', 'wechat']}
|
32
|
+
* showTerms={true}
|
33
|
+
* showPrivacy={true}
|
34
|
+
* customClass="my-register-page"
|
35
|
+
* onRegisterSuccess={() => {}}
|
36
|
+
* >
|
37
|
+
* <div slot="footer">
|
38
|
+
* 自定义页脚内容
|
39
|
+
* </div>
|
40
|
+
* </Register>
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* @props
|
44
|
+
* @prop {string} [title="注册"] - 注册页标题
|
45
|
+
* @prop {string} [subtitle] - 注册页副标题
|
46
|
+
* @prop {string} [logo] - 注册页Logo图片路径
|
47
|
+
* @prop {('github'|'google'|'wechat')[]} [socialLogins] - 社交账号注册方式列表
|
48
|
+
* @prop {boolean} [showTerms=true] - 是否显示服务条款选项
|
49
|
+
* @prop {boolean} [showPrivacy=true] - 是否显示隐私政策选项
|
50
|
+
* @prop {string} [customClass] - 自定义CSS类名
|
51
|
+
* @prop {string} [registerButtonText="注册"] - 注册按钮文本
|
52
|
+
* @prop {string} [usernameLabel="用户名"] - 用户名输入框标签
|
53
|
+
* @prop {string} [emailLabel="邮箱"] - 邮箱输入框标签
|
54
|
+
* @prop {string} [passwordLabel="密码"] - 密码输入框标签
|
55
|
+
* @prop {string} [confirmPasswordLabel="确认密码"] - 确认密码输入框标签
|
56
|
+
* @prop {string} [termsText="我已阅读并同意服务条款"] - 服务条款文本
|
57
|
+
* @prop {string} [privacyText="我已阅读并同意隐私政策"] - 隐私政策文本
|
58
|
+
* @prop {string} [dividerText="或"] - 社交注册分隔符文本
|
59
|
+
*
|
60
|
+
* @slots
|
61
|
+
* @slot header - 页头自定义内容
|
62
|
+
* @slot footer - 页脚自定义内容
|
63
|
+
* @slot socialButtons - 自定义社交注册按钮
|
64
|
+
*/
|
65
|
+
|
66
|
+
import '../../style.ts';
|
67
|
+
import GithubIcon from '../icons/GithubIcon.astro';
|
68
|
+
import ChartIcon from '../icons/ChartIcon.astro';
|
69
|
+
|
70
|
+
export interface Props {
|
71
|
+
title?: string;
|
72
|
+
subtitle?: string;
|
73
|
+
logo?: string;
|
74
|
+
socialLogins?: ('github' | 'google' | 'wechat')[];
|
75
|
+
showTerms?: boolean;
|
76
|
+
showPrivacy?: boolean;
|
77
|
+
customClass?: string;
|
78
|
+
registerButtonText?: string;
|
79
|
+
usernameLabel?: string;
|
80
|
+
emailLabel?: string;
|
81
|
+
passwordLabel?: string;
|
82
|
+
confirmPasswordLabel?: string;
|
83
|
+
termsText?: string;
|
84
|
+
privacyText?: string;
|
85
|
+
dividerText?: string;
|
86
|
+
}
|
87
|
+
|
88
|
+
const {
|
89
|
+
title = '注册',
|
90
|
+
subtitle,
|
91
|
+
logo,
|
92
|
+
socialLogins = [],
|
93
|
+
showTerms = true,
|
94
|
+
showPrivacy = true,
|
95
|
+
customClass = '',
|
96
|
+
registerButtonText = '注册',
|
97
|
+
usernameLabel = '用户名',
|
98
|
+
emailLabel = '邮箱',
|
99
|
+
passwordLabel = '密码',
|
100
|
+
confirmPasswordLabel = '确认密码',
|
101
|
+
termsText = '我已阅读并同意服务条款',
|
102
|
+
privacyText = '我已阅读并同意隐私政策',
|
103
|
+
dividerText = '或',
|
104
|
+
} = Astro.props;
|
105
|
+
|
106
|
+
// 社交登录图标映射
|
107
|
+
const socialIcons: Record<'github' | 'google' | 'wechat', any> = {
|
108
|
+
github: GithubIcon,
|
109
|
+
google: ChartIcon,
|
110
|
+
wechat: ChartIcon,
|
111
|
+
};
|
112
|
+
|
113
|
+
// 社交登录按钮样式映射
|
114
|
+
const socialButtonStyles: Record<'github' | 'google' | 'wechat', string> = {
|
115
|
+
github: 'cosy:bg-gray-800 cosy:hover:bg-gray-900',
|
116
|
+
google: 'cosy:bg-red-500 cosy:hover:bg-red-600',
|
117
|
+
wechat: 'cosy:bg-green-500 cosy:hover:bg-green-600',
|
118
|
+
};
|
119
|
+
---
|
120
|
+
|
121
|
+
<div
|
122
|
+
class={`cosy:min-h-screen cosy:flex cosy:items-center cosy:justify-center cosy:bg-base-200 cosy:py-12 cosy:px-4 cosy:sm:px-6 cosy:lg:px-8 ${customClass}`}>
|
123
|
+
<div
|
124
|
+
class="cosy:max-w-md cosy:w-full cosy:space-y-8 cosy:bg-base-100 cosy:p-8 cosy:rounded-lg cosy:shadow-xl">
|
125
|
+
<!-- 头部区域 -->
|
126
|
+
<div class="cosy:text-center">
|
127
|
+
<slot name="header">
|
128
|
+
{
|
129
|
+
logo && (
|
130
|
+
<img
|
131
|
+
class="cosy:mx-auto cosy:h-12 cosy:w-auto"
|
132
|
+
src={logo}
|
133
|
+
alt="Logo"
|
134
|
+
/>
|
135
|
+
)
|
136
|
+
}
|
137
|
+
<h2
|
138
|
+
class="cosy:mt-6 cosy:text-3xl cosy:font-extrabold cosy:text-base-content">
|
139
|
+
{title}
|
140
|
+
</h2>
|
141
|
+
{
|
142
|
+
subtitle && (
|
143
|
+
<p class="cosy:mt-2 cosy:text-sm cosy:text-base-content/60">
|
144
|
+
{subtitle}
|
145
|
+
</p>
|
146
|
+
)
|
147
|
+
}
|
148
|
+
</slot>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<!-- 注册表单 -->
|
152
|
+
<form class="cosy:mt-8 cosy:space-y-6">
|
153
|
+
<div class="cosy:rounded-md cosy:shadow-sm cosy:-space-y-px">
|
154
|
+
<div>
|
155
|
+
<label for="username" class="cosy:sr-only">{usernameLabel}</label>
|
156
|
+
<input
|
157
|
+
id="username"
|
158
|
+
name="username"
|
159
|
+
type="text"
|
160
|
+
required
|
161
|
+
class="cosy:appearance-none cosy:rounded-none cosy:rounded-t-md cosy:relative cosy:block cosy:w-full cosy:px-3 cosy:py-2 cosy:border cosy:border-base-300 cosy:placeholder-base-content/40 cosy:text-base-content focus:cosy:z-10 focus:cosy:border-primary focus:cosy:outline-none focus:cosy:ring-1 focus:cosy:ring-primary"
|
162
|
+
placeholder={usernameLabel}
|
163
|
+
/>
|
164
|
+
</div>
|
165
|
+
<div>
|
166
|
+
<label for="email" class="cosy:sr-only">{emailLabel}</label>
|
167
|
+
<input
|
168
|
+
id="email"
|
169
|
+
name="email"
|
170
|
+
type="email"
|
171
|
+
required
|
172
|
+
class="cosy:appearance-none cosy:rounded-none cosy:relative cosy:block cosy:w-full cosy:px-3 cosy:py-2 cosy:border cosy:border-base-300 cosy:placeholder-base-content/40 cosy:text-base-content focus:cosy:z-10 focus:cosy:border-primary focus:cosy:outline-none focus:cosy:ring-1 focus:cosy:ring-primary"
|
173
|
+
placeholder={emailLabel}
|
174
|
+
/>
|
175
|
+
</div>
|
176
|
+
<div>
|
177
|
+
<label for="password" class="cosy:sr-only">{passwordLabel}</label>
|
178
|
+
<input
|
179
|
+
id="password"
|
180
|
+
name="password"
|
181
|
+
type="password"
|
182
|
+
required
|
183
|
+
class="cosy:appearance-none cosy:rounded-none cosy:relative cosy:block cosy:w-full cosy:px-3 cosy:py-2 cosy:border cosy:border-base-300 cosy:placeholder-base-content/40 cosy:text-base-content focus:cosy:z-10 focus:cosy:border-primary focus:cosy:outline-none focus:cosy:ring-1 focus:cosy:ring-primary"
|
184
|
+
placeholder={passwordLabel}
|
185
|
+
/>
|
186
|
+
</div>
|
187
|
+
<div>
|
188
|
+
<label for="confirm-password" class="cosy:sr-only"
|
189
|
+
>{confirmPasswordLabel}</label
|
190
|
+
>
|
191
|
+
<input
|
192
|
+
id="confirm-password"
|
193
|
+
name="confirm-password"
|
194
|
+
type="password"
|
195
|
+
required
|
196
|
+
class="cosy:appearance-none cosy:rounded-none cosy:rounded-b-md cosy:relative cosy:block cosy:w-full cosy:px-3 cosy:py-2 cosy:border cosy:border-base-300 cosy:placeholder-base-content/40 cosy:text-base-content focus:cosy:z-10 focus:cosy:border-primary focus:cosy:outline-none focus:cosy:ring-1 focus:cosy:ring-primary"
|
197
|
+
placeholder={confirmPasswordLabel}
|
198
|
+
/>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
<div class="cosy:flex cosy:flex-col cosy:gap-3">
|
203
|
+
{
|
204
|
+
showTerms && (
|
205
|
+
<div class="cosy:flex cosy:items-center">
|
206
|
+
<input
|
207
|
+
id="terms"
|
208
|
+
name="terms"
|
209
|
+
type="checkbox"
|
210
|
+
required
|
211
|
+
class="cosy:h-4 cosy:w-4 cosy:text-primary cosy:focus:ring-primary cosy:border-base-300 cosy:rounded"
|
212
|
+
/>
|
213
|
+
<label
|
214
|
+
for="terms"
|
215
|
+
class="cosy:ml-2 cosy:block cosy:text-sm cosy:text-base-content">
|
216
|
+
{termsText}
|
217
|
+
</label>
|
218
|
+
</div>
|
219
|
+
)
|
220
|
+
}
|
221
|
+
|
222
|
+
{
|
223
|
+
showPrivacy && (
|
224
|
+
<div class="cosy:flex cosy:items-center">
|
225
|
+
<input
|
226
|
+
id="privacy"
|
227
|
+
name="privacy"
|
228
|
+
type="checkbox"
|
229
|
+
required
|
230
|
+
class="cosy:h-4 cosy:w-4 cosy:text-primary cosy:focus:ring-primary cosy:border-base-300 cosy:rounded"
|
231
|
+
/>
|
232
|
+
<label
|
233
|
+
for="privacy"
|
234
|
+
class="cosy:ml-2 cosy:block cosy:text-sm cosy:text-base-content">
|
235
|
+
{privacyText}
|
236
|
+
</label>
|
237
|
+
</div>
|
238
|
+
)
|
239
|
+
}
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div>
|
243
|
+
<button
|
244
|
+
type="submit"
|
245
|
+
class="cosy:group cosy:relative cosy:w-full cosy:flex cosy:justify-center cosy:py-2 cosy:px-4 cosy:border cosy:border-transparent cosy:text-sm cosy:font-medium cosy:rounded-md cosy:text-white cosy:bg-primary cosy:hover:bg-primary-focus focus:cosy:outline-none focus:cosy:ring-2 focus:cosy:ring-offset-2 focus:cosy:ring-primary">
|
246
|
+
{registerButtonText}
|
247
|
+
</button>
|
248
|
+
</div>
|
249
|
+
</form>
|
250
|
+
|
251
|
+
<!-- 社交注册 -->
|
252
|
+
{
|
253
|
+
socialLogins.length > 0 && (
|
254
|
+
<div class="cosy:mt-6">
|
255
|
+
<div class="cosy:relative">
|
256
|
+
<div class="cosy:absolute cosy:inset-0 cosy:flex cosy:items-center">
|
257
|
+
<div class="cosy:w-full cosy:border-t cosy:border-base-300" />
|
258
|
+
</div>
|
259
|
+
<div class="cosy:relative cosy:flex cosy:justify-center cosy:text-sm">
|
260
|
+
<span class="cosy:px-2 cosy:bg-base-100 cosy:text-base-content/60">
|
261
|
+
{dividerText}
|
262
|
+
</span>
|
263
|
+
</div>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
<slot name="socialButtons">
|
267
|
+
<div class="cosy:mt-6 cosy:grid cosy:grid-cols-{Math.min(socialLogins.length, 3)} cosy:gap-3">
|
268
|
+
{socialLogins.map((provider) => {
|
269
|
+
const Icon = socialIcons[provider];
|
270
|
+
return (
|
271
|
+
<div>
|
272
|
+
<a
|
273
|
+
href="#"
|
274
|
+
class={`cosy:w-full cosy:inline-flex cosy:justify-center cosy:py-2 cosy:px-4 cosy:rounded-md cosy:shadow-sm cosy:text-sm cosy:font-medium cosy:text-white ${socialButtonStyles[provider]}`}>
|
275
|
+
<Icon class="cosy:w-5 cosy:h-5" />
|
276
|
+
</a>
|
277
|
+
</div>
|
278
|
+
);
|
279
|
+
})}
|
280
|
+
</div>
|
281
|
+
</slot>
|
282
|
+
</div>
|
283
|
+
)
|
284
|
+
}
|
285
|
+
|
286
|
+
<!-- 页脚 -->
|
287
|
+
<slot name="footer" />
|
288
|
+
</div>
|
289
|
+
</div>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
*/
|
23
23
|
|
24
24
|
import '../../style.ts';
|
25
|
-
import { isPathMatch } from '
|
25
|
+
import { isPathMatch } from '../../src/utils/path.ts';
|
26
26
|
import { MenuIcon, SidebarNav, Modal } from '../../index-astro';
|
27
27
|
import type { ISidebarProps } from '../../index-astro';
|
28
28
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import Sidebar from './Sidebar.astro';
|
2
2
|
import SidebarBasic from './SidebarBasic.astro';
|
3
3
|
import BasicSourceCode from './SidebarBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '
|
4
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
5
5
|
|
6
6
|
export { Sidebar, SidebarBasic };
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import SidebarNav from './SidebarNav.astro';
|
2
2
|
import SidebarNavBasic from './SidebarNavBasic.astro';
|
3
3
|
import BasicSourceCode from './SidebarNavBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '
|
4
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
5
5
|
|
6
6
|
export { SidebarNav, SidebarNavBasic };
|
7
7
|
|
@@ -3,7 +3,7 @@ import SpeakBasic from './SpeakBasic.astro';
|
|
3
3
|
import SpeakGrid from './SpeakGrid.astro';
|
4
4
|
import BasicSourceCode from './SpeakBasic.astro?raw';
|
5
5
|
import GridSourceCode from './SpeakGrid.astro?raw';
|
6
|
-
import { extractSimpleExample } from '
|
6
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
7
7
|
|
8
8
|
export { Speak, SpeakBasic, SpeakGrid };
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import Stack from './Stack.astro';
|
2
2
|
import StackBasic from './StackBasic.astro';
|
3
3
|
import BasicSourceCode from './StackBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '
|
4
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
5
5
|
|
6
6
|
export { Stack, StackBasic };
|
7
7
|
|
@@ -10,7 +10,7 @@ import WithSocialSourceCode from './TeamMemberWithSocial.astro?raw';
|
|
10
10
|
import CustomStyleSourceCode from './TeamMemberCustomStyle.astro?raw';
|
11
11
|
import GroupSourceCode from './TeamMemberGroup.astro?raw';
|
12
12
|
|
13
|
-
import { extractSimpleExample } from '
|
13
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
14
14
|
|
15
15
|
export {
|
16
16
|
TeamMember,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import Text from './Text.astro';
|
2
2
|
import TextBasic from './TextBasic.astro';
|
3
3
|
import BasicSourceCode from './TextBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '
|
4
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
5
5
|
|
6
6
|
export { Text, TextBasic };
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import ThemeSwitcher from './ThemeSwitcher.astro';
|
2
2
|
import ThemeSwitcherBasic from './ThemeSwitcherBasic.astro';
|
3
3
|
import BasicSourceCode from './ThemeSwitcherBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '
|
4
|
+
import { extractSimpleExample } from '../../src/utils/component';
|
5
5
|
|
6
6
|
export { ThemeSwitcher, ThemeSwitcherBasic };
|
7
7
|
|
@@ -0,0 +1,114 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Toast
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* Toast 组件用于显示临时的通知消息,支持多种类型和自动消失功能。
|
7
|
+
* 通常不直接使用,而是通过全局的 toast 系统来显示。
|
8
|
+
*
|
9
|
+
* @design
|
10
|
+
* 设计理念:
|
11
|
+
* 1. 非侵入式 - 不阻断用户操作,自动消失
|
12
|
+
* 2. 视觉层次 - 通过颜色和图标清晰表达消息类型
|
13
|
+
* 3. 可关闭性 - 用户可手动关闭消息
|
14
|
+
* 4. 响应式设计 - 适配不同屏幕尺寸
|
15
|
+
* 5. 可访问性 - 支持屏幕阅读器和键盘操作
|
16
|
+
*
|
17
|
+
* @usage
|
18
|
+
* 通过全局函数使用:
|
19
|
+
* ```javascript
|
20
|
+
* // 基本用法
|
21
|
+
* showToast('操作成功完成!');
|
22
|
+
*
|
23
|
+
* // 带类型的用法
|
24
|
+
* showToast({
|
25
|
+
* message: '保存成功!',
|
26
|
+
* type: 'success',
|
27
|
+
* duration: 2000
|
28
|
+
* });
|
29
|
+
*
|
30
|
+
* // 错误提示
|
31
|
+
* showToast({
|
32
|
+
* message: '网络连接失败,请重试',
|
33
|
+
* type: 'error',
|
34
|
+
* duration: 5000
|
35
|
+
* });
|
36
|
+
*
|
37
|
+
* // 关闭特定 toast
|
38
|
+
* const toastId = showToast('正在处理...');
|
39
|
+
* setTimeout(() => closeToast(toastId), 1000);
|
40
|
+
*
|
41
|
+
* // 清除所有 toast
|
42
|
+
* clearAllToasts();
|
43
|
+
* ```
|
44
|
+
*
|
45
|
+
* @props
|
46
|
+
* - message: string - 显示的消息内容
|
47
|
+
* - type: ToastType - 消息类型,影响样式和图标 ('info' | 'success' | 'warning' | 'error')
|
48
|
+
* - id: string - 唯一标识符
|
49
|
+
*/
|
50
|
+
|
51
|
+
import '../../style.ts';
|
52
|
+
import {
|
53
|
+
InfoIcon,
|
54
|
+
SuccessIcon,
|
55
|
+
WarningIcon,
|
56
|
+
ErrorIcon,
|
57
|
+
CloseIcon,
|
58
|
+
} from '../../index-astro';
|
59
|
+
import type { ToastType } from './types';
|
60
|
+
import { getToastStyle } from './types';
|
61
|
+
|
62
|
+
export interface Props {
|
63
|
+
/**
|
64
|
+
* 显示的消息内容
|
65
|
+
*/
|
66
|
+
message: string;
|
67
|
+
|
68
|
+
/**
|
69
|
+
* 消息类型,影响样式和图标
|
70
|
+
*/
|
71
|
+
type: ToastType;
|
72
|
+
|
73
|
+
/**
|
74
|
+
* 唯一标识符
|
75
|
+
*/
|
76
|
+
id: string;
|
77
|
+
}
|
78
|
+
|
79
|
+
const { message, type, id } = Astro.props;
|
80
|
+
|
81
|
+
const style = getToastStyle(type);
|
82
|
+
|
83
|
+
// 根据类型选择图标
|
84
|
+
const IconComponent = {
|
85
|
+
info: InfoIcon,
|
86
|
+
success: SuccessIcon,
|
87
|
+
warning: WarningIcon,
|
88
|
+
error: ErrorIcon,
|
89
|
+
}[type];
|
90
|
+
---
|
91
|
+
|
92
|
+
<div
|
93
|
+
class:list={[
|
94
|
+
'cosy:alert cosy:shadow-lg cosy:flex cosy:items-center cosy:gap-3 cosy:pr-2',
|
95
|
+
'cosy:transform cosy:transition-all cosy:duration-300 cosy:ease-in-out',
|
96
|
+
'cosy:translate-x-full cosy:opacity-0',
|
97
|
+
'toast-enter:cosy:translate-x-0 toast-enter:cosy:opacity-100',
|
98
|
+
'toast-exit:cosy:translate-x-full toast-exit:cosy:opacity-0',
|
99
|
+
style.bg,
|
100
|
+
style.border,
|
101
|
+
]}
|
102
|
+
data-toast-id={id}
|
103
|
+
role="alert"
|
104
|
+
aria-live="polite">
|
105
|
+
<IconComponent size="20px" />
|
106
|
+
<span class="cosy:flex-1 cosy:text-sm cosy:font-medium">{message}</span>
|
107
|
+
<button
|
108
|
+
class="cosy:btn cosy:btn-ghost cosy:btn-xs cosy:btn-circle cosy:opacity-70 hover:cosy:opacity-100"
|
109
|
+
onclick={`window.closeToast?.('${id}')`}
|
110
|
+
aria-label="关闭通知"
|
111
|
+
type="button">
|
112
|
+
<CloseIcon size="16px" />
|
113
|
+
</button>
|
114
|
+
</div>
|