@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.
Files changed (179) hide show
  1. package/README.md +31 -0
  2. package/dist/app.css +1 -1
  3. package/dist/index-astro.ts +18 -10
  4. package/dist/index-vue.ts +2 -2
  5. package/dist/{vue → src}/utils/language.ts +1 -1
  6. package/dist/src/utils/link.ts +250 -0
  7. package/dist/{vue → src}/utils/path.ts +1 -1
  8. package/dist/src-astro/article/index.ts +1 -1
  9. package/dist/src-astro/assets/iconData.ts +5 -0
  10. package/dist/src-astro/banner/index.ts +1 -1
  11. package/dist/src-astro/code-container/CodeContainer.astro +6 -91
  12. package/dist/src-astro/confirm-dialog/ConfirmDialog.astro +119 -0
  13. package/dist/src-astro/confirm-dialog/index.ts +2 -0
  14. package/dist/src-astro/confirm-dialog/types.ts +47 -0
  15. package/dist/src-astro/cosy.ts +1 -1
  16. package/dist/src-astro/database/index.ts +3 -0
  17. package/dist/src-astro/entities/BlogDoc.ts +1 -1
  18. package/dist/src-astro/entities/CourseDoc.ts +1 -1
  19. package/dist/src-astro/entities/ExperimentDoc.ts +1 -1
  20. package/dist/src-astro/entities/LessonDoc.ts +1 -1
  21. package/dist/src-astro/entities/MetaDoc.ts +1 -1
  22. package/dist/src-astro/entities/Tag.ts +1 -1
  23. package/dist/src-astro/errors/403.astro +1 -1
  24. package/dist/src-astro/errors/404.astro +1 -1
  25. package/dist/src-astro/errors/500.astro +1 -1
  26. package/dist/src-astro/errors/503.astro +1 -1
  27. package/dist/src-astro/flex/index.ts +1 -1
  28. package/dist/src-astro/footer/Footer.astro +1 -1
  29. package/dist/src-astro/grid/index.ts +1 -1
  30. package/dist/src-astro/heading/index.ts +1 -1
  31. package/dist/src-astro/icons/LogOut.astro +28 -0
  32. package/dist/src-astro/icons/index.ts +1 -0
  33. package/dist/src-astro/image/index.ts +1 -1
  34. package/dist/src-astro/language-switcher/index.ts +1 -1
  35. package/dist/src-astro/layout-basic/index.ts +1 -1
  36. package/dist/src-astro/layout-dashboard/DashboardLayout.astro +76 -1
  37. package/dist/src-astro/layout-dashboard/tools.ts +158 -0
  38. package/dist/src-astro/layout-dashboard/types.ts +1 -154
  39. package/dist/src-astro/link/index.ts +1 -1
  40. package/dist/src-astro/login/Login.astro +251 -0
  41. package/dist/src-astro/login/index.ts +2 -0
  42. package/dist/src-astro/logout/Logout.astro +117 -0
  43. package/dist/src-astro/logout/index.ts +2 -0
  44. package/dist/src-astro/module/index.ts +1 -1
  45. package/dist/src-astro/nav-item/NavItems.astro +1 -1
  46. package/dist/src-astro/nav-item/index.ts +1 -1
  47. package/dist/src-astro/nav-section/index.ts +1 -1
  48. package/dist/src-astro/register/Register.astro +289 -0
  49. package/dist/src-astro/register/index.ts +2 -0
  50. package/dist/src-astro/sidebar/Sidebar.astro +1 -1
  51. package/dist/src-astro/sidebar/index.ts +1 -1
  52. package/dist/src-astro/sidebar-nav/SidebarNav.astro +1 -1
  53. package/dist/src-astro/sidebar-nav/index.ts +1 -1
  54. package/dist/src-astro/speak/index.ts +1 -1
  55. package/dist/src-astro/stack/index.ts +1 -1
  56. package/dist/src-astro/team-member/TeamMemberBasic.astro +1 -1
  57. package/dist/src-astro/team-member/TeamMemberCustomStyle.astro +1 -1
  58. package/dist/src-astro/team-member/TeamMemberGroup.astro +1 -1
  59. package/dist/src-astro/team-member/TeamMemberWithSocial.astro +1 -1
  60. package/dist/src-astro/team-member/index.ts +1 -1
  61. package/dist/src-astro/text/index.ts +1 -1
  62. package/dist/src-astro/theme-switcher/ThemeSwitcher.astro +1 -1
  63. package/dist/src-astro/theme-switcher/index.ts +1 -1
  64. package/dist/src-astro/toast/Toast.astro +114 -0
  65. package/dist/src-astro/toast/ToastContainer.astro +249 -0
  66. package/dist/src-astro/toast/index.ts +4 -0
  67. package/dist/src-astro/toast/types.ts +78 -0
  68. package/dist/src-astro/toc/TableOfContents.astro +2 -2
  69. package/dist/src-astro/toc/index.ts +1 -1
  70. package/dist/src-astro/types/nav.ts +26 -1
  71. package/dist/{vue/buttons-vue → src-vue/buttons}/Button.vue +14 -19
  72. package/dist/{vue/icons-vue → src-vue/icons}/VueIcon.vue +3 -13
  73. package/dist/src-vue/utils/link.ts +250 -0
  74. package/package.json +1 -1
  75. package/dist/src-astro/utils/link.ts +0 -250
  76. package/dist/vue/utils/link.ts +0 -250
  77. /package/dist/{vue → src}/utils/component.ts +0 -0
  78. /package/dist/{vue → src}/utils/i18n.ts +0 -0
  79. /package/dist/{vue → src}/utils/image.ts +0 -0
  80. /package/dist/{vue → src}/utils/lang_entry.ts +0 -0
  81. /package/dist/{vue → src}/utils/lang_package.ts +0 -0
  82. /package/dist/{vue → src}/utils/logger.ts +0 -0
  83. /package/dist/{vue → src}/utils/social.ts +0 -0
  84. /package/dist/{vue → src}/utils/theme.ts +0 -0
  85. /package/dist/{vue → src}/utils/url.ts +0 -0
  86. /package/dist/{vue → src-vue}/SmartLink.vue +0 -0
  87. /package/dist/{vue → src-vue}/TagList.vue +0 -0
  88. /package/dist/{vue → src-vue}/alert-dialog-vue/AlertDialog.vue +0 -0
  89. /package/dist/{vue → src-vue}/alert-dialog-vue/Basic.vue +0 -0
  90. /package/dist/{vue → src-vue}/alert-dialog-vue/Multilang.vue +0 -0
  91. /package/dist/{vue → src-vue}/alert-dialog-vue/index.ts +0 -0
  92. /package/dist/{vue → src-vue}/banner-box-vue/BannerBox.vue +0 -0
  93. /package/dist/{vue → src-vue}/banner-box-vue/DownloadButton.vue +0 -0
  94. /package/dist/{vue → src-vue}/banner-box-vue/ExampleBasic.vue +0 -0
  95. /package/dist/{vue → src-vue}/banner-box-vue/ExampleCustomBg.vue +0 -0
  96. /package/dist/{vue → src-vue}/banner-box-vue/ExampleDisplayModeAlways.vue +0 -0
  97. /package/dist/{vue → src-vue}/banner-box-vue/ExampleDisplayModeHover.vue +0 -0
  98. /package/dist/{vue → src-vue}/banner-box-vue/ExampleDisplayModeNever.vue +0 -0
  99. /package/dist/{vue → src-vue}/banner-box-vue/ExampleImageExport.vue +0 -0
  100. /package/dist/{vue → src-vue}/banner-box-vue/ExampleSizePreset.vue +0 -0
  101. /package/dist/{vue → src-vue}/banner-box-vue/FeatureCard.vue +0 -0
  102. /package/dist/{vue → src-vue}/banner-box-vue/SmartBanner.vue +0 -0
  103. /package/dist/{vue → src-vue}/banner-box-vue/bgStyles.ts +0 -0
  104. /package/dist/{vue → src-vue}/banner-box-vue/index.ts +0 -0
  105. /package/dist/{vue → src-vue}/banner-box-vue/sizePresets.ts +0 -0
  106. /package/dist/{vue → src-vue}/blog-vue/Basic.vue +0 -0
  107. /package/dist/{vue → src-vue}/blog-vue/BlogList.vue +0 -0
  108. /package/dist/{vue → src-vue}/blog-vue/Empty.vue +0 -0
  109. /package/dist/{vue → src-vue}/blog-vue/EmptyEnglish.vue +0 -0
  110. /package/dist/{vue → src-vue}/blog-vue/English.vue +0 -0
  111. /package/dist/{vue → src-vue}/blog-vue/index.ts +0 -0
  112. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonBasic.vue +0 -0
  113. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonFeature.vue +0 -0
  114. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonFeatureBasic.vue +0 -0
  115. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonFeatureWithTips.vue +0 -0
  116. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonLink.vue +0 -0
  117. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonSizes.vue +0 -0
  118. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonVariants.vue +0 -0
  119. /package/dist/{vue/buttons-vue → src-vue/buttons}/ButtonWithIcons.vue +0 -0
  120. /package/dist/{vue/buttons-vue → src-vue/buttons}/index.ts +0 -0
  121. /package/dist/{vue → src-vue}/confirm-dialog-vue/Basic.vue +0 -0
  122. /package/dist/{vue → src-vue}/confirm-dialog-vue/ConfirmDialog.vue +0 -0
  123. /package/dist/{vue → src-vue}/confirm-dialog-vue/CustomButtons.vue +0 -0
  124. /package/dist/{vue → src-vue}/confirm-dialog-vue/index.ts +0 -0
  125. /package/dist/{vue → src-vue}/cosy.ts +0 -0
  126. /package/dist/{vue → src-vue}/counter-vue/VueCounter.vue +0 -0
  127. /package/dist/{vue → src-vue}/counter-vue/index.ts +0 -0
  128. /package/dist/{vue → src-vue}/iPhone-vue/Basic.vue +0 -0
  129. /package/dist/{vue → src-vue}/iPhone-vue/CustomBackground.vue +0 -0
  130. /package/dist/{vue → src-vue}/iPhone-vue/NoFrame.vue +0 -0
  131. /package/dist/{vue → src-vue}/iPhone-vue/WeatherApp.vue +0 -0
  132. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
  133. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
  134. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
  135. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
  136. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
  137. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
  138. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
  139. /package/dist/{vue → src-vue}/iPhone-vue/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
  140. /package/dist/{vue → src-vue}/iPhone-vue/iPhoneWindow.vue +0 -0
  141. /package/dist/{vue → src-vue}/iPhone-vue/index.ts +0 -0
  142. /package/dist/{vue/icons-vue → src-vue/icons}/AlertTriangleIcon.vue +0 -0
  143. /package/dist/{vue/icons-vue → src-vue/icons}/CalendarIcon.vue +0 -0
  144. /package/dist/{vue/icons-vue → src-vue/icons}/CheckCircleIcon.vue +0 -0
  145. /package/dist/{vue/icons-vue → src-vue/icons}/CheckIcon.vue +0 -0
  146. /package/dist/{vue/icons-vue → src-vue/icons}/ChevronDownIcon.vue +0 -0
  147. /package/dist/{vue/icons-vue → src-vue/icons}/ClipboardIcon.vue +0 -0
  148. /package/dist/{vue/icons-vue → src-vue/icons}/CloseIcon.vue +0 -0
  149. /package/dist/{vue/icons-vue → src-vue/icons}/InboxArchiveIcon.vue +0 -0
  150. /package/dist/{vue/icons-vue → src-vue/icons}/InfoCircleIcon.vue +0 -0
  151. /package/dist/{vue/icons-vue → src-vue/icons}/InfoIcon.vue +0 -0
  152. /package/dist/{vue/icons-vue → src-vue/icons}/LinkIcon.vue +0 -0
  153. /package/dist/{vue/icons-vue → src-vue/icons}/MenuIcon.vue +0 -0
  154. /package/dist/{vue/icons-vue → src-vue/icons}/SearchIcon.vue +0 -0
  155. /package/dist/{vue/icons-vue → src-vue/icons}/SettingsIcon.vue +0 -0
  156. /package/dist/{vue/icons-vue → src-vue/icons}/UserIcon.vue +0 -0
  157. /package/dist/{vue/icons-vue → src-vue/icons}/XCircleIcon.vue +0 -0
  158. /package/dist/{vue/icons-vue → src-vue/icons}/index.ts +0 -0
  159. /package/dist/{vue → src-vue}/list-vue/ListItem.vue +0 -0
  160. /package/dist/{vue → src-vue}/list-vue/index.ts +0 -0
  161. /package/dist/{vue → src-vue}/mac-window-vue/Basic.vue +0 -0
  162. /package/dist/{vue → src-vue}/mac-window-vue/CustomHeight.vue +0 -0
  163. /package/dist/{vue → src-vue}/mac-window-vue/MacWindow.vue +0 -0
  164. /package/dist/{vue → src-vue}/mac-window-vue/WithEvents.vue +0 -0
  165. /package/dist/{vue → src-vue}/mac-window-vue/WithSidebar.vue +0 -0
  166. /package/dist/{vue → src-vue}/mac-window-vue/WithTabs.vue +0 -0
  167. /package/dist/{vue → src-vue}/mac-window-vue/WithToolbar.vue +0 -0
  168. /package/dist/{vue → src-vue}/mac-window-vue/index.ts +0 -0
  169. /package/dist/{src-astro → src-vue}/utils/component.ts +0 -0
  170. /package/dist/{src-astro → src-vue}/utils/i18n.ts +0 -0
  171. /package/dist/{src-astro → src-vue}/utils/image.ts +0 -0
  172. /package/dist/{src-astro → src-vue}/utils/lang_entry.ts +0 -0
  173. /package/dist/{src-astro → src-vue}/utils/lang_package.ts +0 -0
  174. /package/dist/{src-astro → src-vue}/utils/language.ts +0 -0
  175. /package/dist/{src-astro → src-vue}/utils/logger.ts +0 -0
  176. /package/dist/{src-astro → src-vue}/utils/path.ts +0 -0
  177. /package/dist/{src-astro → src-vue}/utils/social.ts +0 -0
  178. /package/dist/{src-astro → src-vue}/utils/theme.ts +0 -0
  179. /package/dist/{src-astro → src-vue}/utils/url.ts +0 -0
@@ -0,0 +1,251 @@
1
+ ---
2
+ /**
3
+ * @component Login
4
+ *
5
+ * @description
6
+ * Login 组件用于创建灵活且功能丰富的登录页面。支持多种登录方式、自定义样式和布局。
7
+ *
8
+ * @usage
9
+ * 基本用法:
10
+ * ```astro
11
+ * <Login title="欢迎回来" />
12
+ * ```
13
+ *
14
+ * 自定义登录方式:
15
+ * ```astro
16
+ * <Login
17
+ * title="登录到系统"
18
+ * subtitle="使用以下方式登录"
19
+ * socialLogins={['github', 'google']}
20
+ * showRememberMe={true}
21
+ * showForgotPassword={true}
22
+ * />
23
+ * ```
24
+ *
25
+ * 完全自定义:
26
+ * ```astro
27
+ * <Login
28
+ * title="企业登录"
29
+ * subtitle="安全登录到企业系统"
30
+ * logo="/path/to/logo.png"
31
+ * socialLogins={['github', 'google', 'wechat']}
32
+ * showRememberMe={true}
33
+ * showForgotPassword={true}
34
+ * customClass="my-login-page"
35
+ * onLoginSuccess={() => {}}
36
+ * >
37
+ * <div slot="footer">
38
+ * 自定义页脚内容
39
+ * </div>
40
+ * </Login>
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} [showRememberMe=false] - 是否显示"记住我"选项
49
+ * @prop {boolean} [showForgotPassword=false] - 是否显示"忘记密码"链接
50
+ * @prop {string} [customClass] - 自定义CSS类名
51
+ * @prop {string} [loginButtonText="登录"] - 登录按钮文本
52
+ * @prop {string} [usernameLabel="用户名"] - 用户名输入框标签
53
+ * @prop {string} [passwordLabel="密码"] - 密码输入框标签
54
+ * @prop {string} [forgotPasswordText="忘记密码?"] - 忘记密码链接文本
55
+ * @prop {string} [rememberMeText="记住我"] - 记住我选项文本
56
+ * @prop {string} [dividerText="或"] - 社交登录分隔符文本
57
+ *
58
+ * @slots
59
+ * @slot header - 页头自定义内容
60
+ * @slot footer - 页脚自定义内容
61
+ * @slot socialButtons - 自定义社交登录按钮
62
+ */
63
+
64
+ import '../../style.ts';
65
+ import GithubIcon from '../icons/GithubIcon.astro';
66
+ import ChartIcon from '../icons/ChartIcon.astro';
67
+
68
+ export interface Props {
69
+ title?: string;
70
+ subtitle?: string;
71
+ logo?: string;
72
+ socialLogins?: ('github' | 'google' | 'wechat')[];
73
+ showRememberMe?: boolean;
74
+ showForgotPassword?: boolean;
75
+ customClass?: string;
76
+ loginButtonText?: string;
77
+ usernameLabel?: string;
78
+ passwordLabel?: string;
79
+ forgotPasswordText?: string;
80
+ rememberMeText?: string;
81
+ dividerText?: string;
82
+ }
83
+
84
+ const {
85
+ title = '登录',
86
+ subtitle,
87
+ logo,
88
+ socialLogins = [],
89
+ showRememberMe = false,
90
+ showForgotPassword = false,
91
+ customClass = '',
92
+ loginButtonText = '登录',
93
+ usernameLabel = '用户名',
94
+ passwordLabel = '密码',
95
+ forgotPasswordText = '忘记密码?',
96
+ rememberMeText = '记住我',
97
+ dividerText = '或',
98
+ } = Astro.props;
99
+
100
+ // 社交登录图标映射
101
+ const socialIcons: Record<'github' | 'google' | 'wechat', any> = {
102
+ github: GithubIcon,
103
+ google: ChartIcon,
104
+ wechat: ChartIcon,
105
+ };
106
+
107
+ // 社交登录按钮样式映射
108
+ const socialButtonStyles: Record<'github' | 'google' | 'wechat', string> = {
109
+ github: 'cosy:bg-gray-800 cosy:hover:bg-gray-900',
110
+ google: 'cosy:bg-red-500 cosy:hover:bg-red-600',
111
+ wechat: 'cosy:bg-green-500 cosy:hover:bg-green-600',
112
+ };
113
+ ---
114
+
115
+ <div
116
+ 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}`}>
117
+ <div
118
+ 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">
119
+ <!-- 头部区域 -->
120
+ <div class="cosy:text-center">
121
+ <slot name="header">
122
+ {
123
+ logo && (
124
+ <img
125
+ class="cosy:mx-auto cosy:h-12 cosy:w-auto"
126
+ src={logo}
127
+ alt="Logo"
128
+ />
129
+ )
130
+ }
131
+ <h2
132
+ class="cosy:mt-6 cosy:text-3xl cosy:font-extrabold cosy:text-base-content">
133
+ {title}
134
+ </h2>
135
+ {
136
+ subtitle && (
137
+ <p class="cosy:mt-2 cosy:text-sm cosy:text-base-content/60">
138
+ {subtitle}
139
+ </p>
140
+ )
141
+ }
142
+ </slot>
143
+ </div>
144
+
145
+ <!-- 登录表单 -->
146
+ <form class="cosy:mt-8 cosy:space-y-6">
147
+ <div class="cosy:rounded-md cosy:shadow-sm cosy:-space-y-px">
148
+ <div>
149
+ <label for="username" class="cosy:sr-only">{usernameLabel}</label>
150
+ <input
151
+ id="username"
152
+ name="username"
153
+ type="text"
154
+ required
155
+ 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"
156
+ placeholder={usernameLabel}
157
+ />
158
+ </div>
159
+ <div>
160
+ <label for="password" class="cosy:sr-only">{passwordLabel}</label>
161
+ <input
162
+ id="password"
163
+ name="password"
164
+ type="password"
165
+ required
166
+ 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"
167
+ placeholder={passwordLabel}
168
+ />
169
+ </div>
170
+ </div>
171
+
172
+ <div class="cosy:flex cosy:items-center cosy:justify-between">
173
+ {
174
+ showRememberMe && (
175
+ <div class="cosy:flex cosy:items-center">
176
+ <input
177
+ id="remember-me"
178
+ name="remember-me"
179
+ type="checkbox"
180
+ class="cosy:h-4 cosy:w-4 cosy:text-primary cosy:focus:ring-primary cosy:border-base-300 cosy:rounded"
181
+ />
182
+ <label
183
+ for="remember-me"
184
+ class="cosy:ml-2 cosy:block cosy:text-sm cosy:text-base-content">
185
+ {rememberMeText}
186
+ </label>
187
+ </div>
188
+ )
189
+ }
190
+
191
+ {
192
+ showForgotPassword && (
193
+ <div class="cosy:text-sm">
194
+ <a
195
+ href="#"
196
+ class="cosy:font-medium cosy:text-primary cosy:hover:text-primary-focus">
197
+ {forgotPasswordText}
198
+ </a>
199
+ </div>
200
+ )
201
+ }
202
+ </div>
203
+
204
+ <div>
205
+ <button
206
+ type="submit"
207
+ 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">
208
+ {loginButtonText}
209
+ </button>
210
+ </div>
211
+ </form>
212
+
213
+ <!-- 社交登录 -->
214
+ {
215
+ socialLogins.length > 0 && (
216
+ <div class="cosy:mt-6">
217
+ <div class="cosy:relative">
218
+ <div class="cosy:absolute cosy:inset-0 cosy:flex cosy:items-center">
219
+ <div class="cosy:w-full cosy:border-t cosy:border-base-300" />
220
+ </div>
221
+ <div class="cosy:relative cosy:flex cosy:justify-center cosy:text-sm">
222
+ <span class="cosy:px-2 cosy:bg-base-100 cosy:text-base-content/60">
223
+ {dividerText}
224
+ </span>
225
+ </div>
226
+ </div>
227
+
228
+ <slot name="socialButtons">
229
+ <div class="cosy:mt-6 cosy:grid cosy:grid-cols-{Math.min(socialLogins.length, 3)} cosy:gap-3">
230
+ {socialLogins.map((provider) => {
231
+ const Icon = socialIcons[provider];
232
+ return (
233
+ <div>
234
+ <a
235
+ href="#"
236
+ 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]}`}>
237
+ <Icon class="cosy:w-5 cosy:h-5" />
238
+ </a>
239
+ </div>
240
+ );
241
+ })}
242
+ </div>
243
+ </slot>
244
+ </div>
245
+ )
246
+ }
247
+
248
+ <!-- 页脚 -->
249
+ <slot name="footer" />
250
+ </div>
251
+ </div>
@@ -0,0 +1,2 @@
1
+ export { default as Login } from './Login.astro';
2
+ export type { Props as LoginProps } from './Login.astro';
@@ -0,0 +1,117 @@
1
+ ---
2
+ /**
3
+ * @component Logout
4
+ *
5
+ * @description
6
+ * Logout 组件用于创建退出登录确认页面。支持自定义提示信息和按钮文本。
7
+ *
8
+ * @usage
9
+ * 基本用法:
10
+ * ```astro
11
+ * <Logout />
12
+ * ```
13
+ *
14
+ * 自定义文本:
15
+ * ```astro
16
+ * <Logout
17
+ * title="确认退出"
18
+ * message="您确定要退出登录吗?"
19
+ * confirmText="确认退出"
20
+ * cancelText="取消"
21
+ * />
22
+ * ```
23
+ *
24
+ * 完全自定义:
25
+ * ```astro
26
+ * <Logout
27
+ * title="退出系统"
28
+ * message="退出后需要重新登录才能访问系统"
29
+ * logo="/path/to/logo.png"
30
+ * confirmText="确认退出"
31
+ * cancelText="取消"
32
+ * customClass="my-logout-page"
33
+ * >
34
+ * <div slot="footer">
35
+ * 遇到问题?<a href="#">联系支持</a>
36
+ * </div>
37
+ * </Logout>
38
+ * ```
39
+ *
40
+ * @props
41
+ * @prop {string} [title="退出登录"] - 页面标题
42
+ * @prop {string} [message="您确定要退出当前账号吗?"] - 确认提示信息
43
+ * @prop {string} [logo] - Logo图片路径
44
+ * @prop {string} [confirmText="退出登录"] - 确认按钮文本
45
+ * @prop {string} [cancelText="取消"] - 取消按钮文本
46
+ * @prop {string} [customClass] - 自定义CSS类名
47
+ *
48
+ * @slots
49
+ * @slot header - 页头自定义内容
50
+ * @slot footer - 页脚自定义内容
51
+ */
52
+
53
+ import '../../style.ts';
54
+
55
+ export interface Props {
56
+ title?: string;
57
+ message?: string;
58
+ logo?: string;
59
+ confirmText?: string;
60
+ cancelText?: string;
61
+ customClass?: string;
62
+ }
63
+
64
+ const {
65
+ title = '退出登录',
66
+ message = '您确定要退出当前账号吗?',
67
+ logo,
68
+ confirmText = '退出登录',
69
+ cancelText = '取消',
70
+ customClass = '',
71
+ } = Astro.props;
72
+ ---
73
+
74
+ <div
75
+ 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}`}>
76
+ <div
77
+ 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">
78
+ <!-- 头部区域 -->
79
+ <div class="cosy:text-center">
80
+ <slot name="header">
81
+ {
82
+ logo && (
83
+ <img
84
+ class="cosy:mx-auto cosy:h-12 cosy:w-auto"
85
+ src={logo}
86
+ alt="Logo"
87
+ />
88
+ )
89
+ }
90
+ <h2
91
+ class="cosy:mt-6 cosy:text-3xl cosy:font-extrabold cosy:text-base-content">
92
+ {title}
93
+ </h2>
94
+ <p class="cosy:mt-2 cosy:text-sm cosy:text-base-content/60">
95
+ {message}
96
+ </p>
97
+ </slot>
98
+ </div>
99
+
100
+ <!-- 按钮区域 -->
101
+ <div class="cosy:mt-8 cosy:space-y-4">
102
+ <button
103
+ type="button"
104
+ class="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-error cosy:hover:bg-error-focus focus:cosy:outline-none focus:cosy:ring-2 focus:cosy:ring-offset-2 focus:cosy:ring-error">
105
+ {confirmText}
106
+ </button>
107
+ <button
108
+ type="button"
109
+ class="cosy:w-full cosy:flex cosy:justify-center cosy:py-2 cosy:px-4 cosy:border cosy:border-base-300 cosy:text-sm cosy:font-medium cosy:rounded-md cosy:text-base-content cosy:bg-base-100 cosy:hover:bg-base-200 focus:cosy:outline-none focus:cosy:ring-2 focus:cosy:ring-offset-2 focus:cosy:ring-base-300">
110
+ {cancelText}
111
+ </button>
112
+ </div>
113
+
114
+ <!-- 页脚 -->
115
+ <slot name="footer" />
116
+ </div>
117
+ </div>
@@ -0,0 +1,2 @@
1
+ export { default as Logout } from './Logout.astro';
2
+ export type { Props as LogoutProps } from './Logout.astro';
@@ -5,7 +5,7 @@ import ModuleCustom from './ModuleCustom.astro';
5
5
  import BasicSourceCode from './ModuleBasic.astro?raw';
6
6
  import GridSourceCode from './ModuleGrid.astro?raw';
7
7
  import CustomSourceCode from './ModuleCustom.astro?raw';
8
- import { extractSimpleExample } from '../utils/component';
8
+ import { extractSimpleExample } from '../../src/utils/component';
9
9
 
10
10
  export { Module, ModuleBasic, ModuleGrid, ModuleCustom };
11
11
 
@@ -36,7 +36,7 @@ const { navItems, activeLink, linkHeightClass } = Astro.props;
36
36
  variant={activeLink === item.href ? 'primary' : 'default'}
37
37
  href={item.href}
38
38
  class:list={[linkHeightClass]}>
39
- {item.label}
39
+ {item.title}
40
40
  </Link>
41
41
  </li>
42
42
  ))
@@ -1,7 +1,7 @@
1
1
  import NavItems from './NavItems.astro';
2
2
  import NavItemsBasic from './NavItemsBasic.astro';
3
3
  import BasicSourceCode from './NavItemsBasic.astro?raw';
4
- import { extractSimpleExample } from '../utils/component';
4
+ import { extractSimpleExample } from '../../src/utils/component';
5
5
 
6
6
  export { NavItems, NavItemsBasic };
7
7
 
@@ -1,7 +1,7 @@
1
1
  import NavSection from './NavSection.astro';
2
2
  import NavSectionBasic from './NavSectionBasic.astro';
3
3
  import BasicSourceCode from './NavSectionBasic.astro?raw';
4
- import { extractSimpleExample } from '../utils/component';
4
+ import { extractSimpleExample } from '../../src/utils/component';
5
5
 
6
6
  export { NavSection, NavSectionBasic };
7
7