@mathwiz/ui-components 0.1.6 → 0.1.7

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.
@@ -0,0 +1,333 @@
1
+ /* MathWizHeader 组件样式 - 参数化样式系统 */
2
+
3
+ /* 基础样式变量 */
4
+ .mathwiz-header {
5
+ --header-height: 64px;
6
+ --header-bg: linear-gradient(to right, #8b5cf6, #ec4899, #ef4444);
7
+ --header-color: white;
8
+ --header-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
9
+
10
+ height: var(--header-height);
11
+ background: var(--header-bg);
12
+ color: var(--header-color);
13
+ box-shadow: var(--header-shadow);
14
+ position: sticky;
15
+ top: 0;
16
+ z-index: 1000;
17
+ width: 100%;
18
+ }
19
+
20
+ /* 变体样式 */
21
+ .mathwiz-header--primary {
22
+ --header-bg: linear-gradient(to right, #006FEE, #005BC4);
23
+ }
24
+
25
+ .mathwiz-header--secondary {
26
+ --header-bg: linear-gradient(to right, #7828C8, #5B21B6);
27
+ }
28
+
29
+ .mathwiz-header--gradient {
30
+ /* 默认渐变,可通过参数自定义 */
31
+ --header-bg: linear-gradient(to right, #8b5cf6, #ec4899, #ef4444);
32
+ }
33
+
34
+ .mathwiz-header--solid {
35
+ --header-bg: var(--custom-bg, #f4f4f5);
36
+ --header-color: var(--custom-color, #18181b);
37
+ }
38
+
39
+ .mathwiz-header--bordered {
40
+ --header-bg: transparent;
41
+ --header-color: #18181b;
42
+ border-bottom: 1px solid #e4e4e7;
43
+ box-shadow: none;
44
+ }
45
+
46
+ /* 颜色变体 */
47
+ .mathwiz-header--color-primary {
48
+ --header-bg: #006FEE;
49
+ --header-color: white;
50
+ }
51
+
52
+ .mathwiz-header--color-success {
53
+ --header-bg: #17C964;
54
+ --header-color: white;
55
+ }
56
+
57
+ .mathwiz-header--color-warning {
58
+ --header-bg: #F5A524;
59
+ --header-color: white;
60
+ }
61
+
62
+ .mathwiz-header--color-danger {
63
+ --header-bg: #F31260;
64
+ --header-color: white;
65
+ }
66
+
67
+ /* 布局样式 */
68
+ .mathwiz-header .header-content {
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: space-between;
72
+ height: 100%;
73
+ padding: 0 1.5rem;
74
+ max-width: 1280px;
75
+ margin: 0 auto;
76
+ width: 100%;
77
+ }
78
+
79
+ .mathwiz-header .header-section {
80
+ flex: 1;
81
+ display: flex;
82
+ align-items: center;
83
+ }
84
+
85
+ .mathwiz-header .header-section.left {
86
+ justify-content: flex-start;
87
+ }
88
+
89
+ .mathwiz-header .header-section.center {
90
+ justify-content: center;
91
+ text-align: center;
92
+ }
93
+
94
+ .mathwiz-header .header-section.right {
95
+ justify-content: flex-end;
96
+ }
97
+
98
+ /* Logo 样式 */
99
+ .mathwiz-header .logo {
100
+ font-size: var(--logo-font-size, 1.5rem);
101
+ font-weight: var(--logo-font-weight, bold);
102
+ text-decoration: none;
103
+ transition: opacity 0.2s ease;
104
+ color: var(--logo-color, var(--header-color)) !important;
105
+ }
106
+
107
+ .mathwiz-header .logo:hover {
108
+ opacity: 0.8;
109
+ }
110
+
111
+ /* Logo 尺寸变体 */
112
+ .mathwiz-header .logo--sm {
113
+ --logo-font-size: 1.25rem;
114
+ }
115
+
116
+ .mathwiz-header .logo--md {
117
+ --logo-font-size: 1.5rem;
118
+ }
119
+
120
+ .mathwiz-header .logo--lg {
121
+ --logo-font-size: 1.75rem;
122
+ }
123
+
124
+ .mathwiz-header .logo--xl {
125
+ --logo-font-size: 2rem;
126
+ }
127
+
128
+ /* 探索菜单样式 */
129
+ .explore-button {
130
+ display: flex;
131
+ align-items: center;
132
+ gap: 0.5rem;
133
+ padding: 0.5rem 0.75rem;
134
+ border-radius: 6px;
135
+ font-size: 0.875rem;
136
+ font-weight: 500;
137
+ transition: all 0.2s ease;
138
+ background: var(--explore-bg, transparent);
139
+ border: var(--explore-border, none);
140
+ color: var(--explore-color, var(--header-color)) !important;
141
+ cursor: pointer;
142
+ }
143
+
144
+ /* 探索按钮变体 */
145
+ .explore-button--solid {
146
+ --explore-bg: var(--explore-color, #006FEE);
147
+ --explore-color: white;
148
+ }
149
+
150
+ .explore-button--bordered {
151
+ --explore-bg: transparent;
152
+ --explore-border: 1px solid var(--explore-color, #006FEE);
153
+ --explore-color: var(--explore-color, #006FEE);
154
+ }
155
+
156
+ .explore-button--light {
157
+ --explore-bg: var(--explore-color-light, rgba(0, 111, 238, 0.1));
158
+ --explore-color: var(--explore-color, #006FEE);
159
+ }
160
+
161
+ .explore-button--flat {
162
+ --explore-bg: transparent;
163
+ --explore-color: var(--explore-color, #006FEE);
164
+ }
165
+
166
+ .explore-button--faded {
167
+ --explore-bg: var(--explore-color-faded, rgba(0, 111, 238, 0.05));
168
+ --explore-color: var(--explore-color, #006FEE);
169
+ }
170
+
171
+ .explore-button--shadow {
172
+ --explore-bg: var(--explore-color, #006FEE);
173
+ --explore-color: white;
174
+ box-shadow: 0 2px 4px rgba(0, 111, 238, 0.3);
175
+ }
176
+
177
+ /* 探索按钮颜色变体 */
178
+ .explore-button--color-primary {
179
+ --explore-color: #006FEE;
180
+ --explore-color-light: rgba(0, 111, 238, 0.1);
181
+ --explore-color-faded: rgba(0, 111, 238, 0.05);
182
+ }
183
+
184
+ .explore-button--color-success {
185
+ --explore-color: #17C964;
186
+ --explore-color-light: rgba(23, 201, 100, 0.1);
187
+ --explore-color-faded: rgba(23, 201, 100, 0.05);
188
+ }
189
+
190
+ .explore-button--color-warning {
191
+ --explore-color: #F5A524;
192
+ --explore-color-light: rgba(245, 165, 36, 0.1);
193
+ --explore-color-faded: rgba(245, 165, 36, 0.05);
194
+ }
195
+
196
+ .explore-button--color-danger {
197
+ --explore-color: #F31260;
198
+ --explore-color-light: rgba(243, 18, 96, 0.1);
199
+ --explore-color-faded: rgba(243, 18, 96, 0.05);
200
+ }
201
+
202
+ .explore-button:hover {
203
+ background-color: var(--explore-bg-hover, rgba(255, 255, 255, 0.1));
204
+ color: var(--explore-color-hover, var(--explore-color));
205
+ }
206
+
207
+ .explore-icon {
208
+ font-size: 1.25rem;
209
+ }
210
+
211
+ .explore-text {
212
+ font-weight: 500;
213
+ }
214
+
215
+ /* 探索菜单项样式 */
216
+ .explore-menu-item {
217
+ display: flex;
218
+ align-items: center;
219
+ justify-content: space-between;
220
+ padding: 0.5rem 1rem;
221
+ cursor: pointer;
222
+ transition: background-color 0.15s ease, color 0.15s ease;
223
+ min-width: 200px;
224
+ }
225
+
226
+ .explore-menu-item:hover {
227
+ background-color: var(--hover-bg, #e9ecef);
228
+ color: var(--accent-color, #4361ee);
229
+ }
230
+
231
+ .explore-item-label {
232
+ font-weight: 500;
233
+ flex: 1;
234
+ }
235
+
236
+ .explore-item-status {
237
+ font-size: 0.75rem;
238
+ font-weight: 500;
239
+ padding: 0.25rem 0.5rem;
240
+ border-radius: 9999px;
241
+ margin-left: 0.5rem;
242
+ }
243
+
244
+ .status-new {
245
+ background-color: var(--success-color, #10b981);
246
+ color: white;
247
+ }
248
+
249
+ .status-progress {
250
+ color: var(--accent-color, #4361ee);
251
+ }
252
+
253
+ .status-进行中 {
254
+ background-color: var(--warning-color, #f59e0b);
255
+ color: white;
256
+ }
257
+
258
+ .status-2 {
259
+ background-color: var(--accent-light, #e6f2ff);
260
+ color: var(--accent-color, #4361ee);
261
+ }
262
+
263
+ /* 响应式设计 */
264
+ @media (max-width: 768px) {
265
+ .mathwiz-header .header-content {
266
+ padding: 0 1rem;
267
+ }
268
+
269
+ .explore-text {
270
+ display: none;
271
+ }
272
+
273
+ .explore-button {
274
+ padding: 0.5rem;
275
+ }
276
+
277
+ .mathwiz-header .logo {
278
+ font-size: 1.25rem;
279
+ }
280
+ }
281
+
282
+ @media (max-width: 480px) {
283
+ .mathwiz-header .header-content {
284
+ padding: 0 0.75rem;
285
+ }
286
+
287
+ .explore-button {
288
+ min-width: auto;
289
+ }
290
+ }
291
+
292
+ /* 无障碍访问支持 */
293
+ .mathwiz-header:focus-within {
294
+ outline: 2px solid var(--accent-color, #4361ee);
295
+ outline-offset: 2px;
296
+ }
297
+
298
+ .explore-button:focus {
299
+ outline: 2px solid var(--accent-color, #4361ee);
300
+ outline-offset: 2px;
301
+ }
302
+
303
+ /* 高对比度模式支持 */
304
+ @media (prefers-contrast: high) {
305
+ .mathwiz-header {
306
+ border-bottom: 2px solid white;
307
+ }
308
+
309
+ .explore-button {
310
+ border: 1px solid currentColor;
311
+ }
312
+ }
313
+
314
+ /* 用户名片在Header中的样式 */
315
+ .mathwiz-header .user-name {
316
+ color: white !important;
317
+ }
318
+
319
+ /* 用户名片在Header中的悬停效果 */
320
+ .mathwiz-header .user-profile-trigger:hover {
321
+ background-color: rgba(255, 255, 255, 0.1) !important;
322
+ opacity: 0.8;
323
+ }
324
+
325
+ /* 减少动画模式支持 */
326
+ @media (prefers-reduced-motion: reduce) {
327
+
328
+ .mathwiz-header .logo,
329
+ .explore-button,
330
+ .explore-menu-item {
331
+ transition: none;
332
+ }
333
+ }
@@ -0,0 +1,207 @@
1
+ /* Sidebar 组件样式 - BEM 命名规范 */
2
+
3
+ .sidebar {
4
+ display: flex;
5
+ flex-direction: column;
6
+ width: 280px;
7
+ height: 100vh;
8
+ background-color: var(--sidebar-bg-color, #ffffff);
9
+ border-right: 1px solid var(--sidebar-border-color, #e0e0e0);
10
+ transition: width var(--transition-normal, 250ms ease-in-out),
11
+ transform var(--transition-normal, 250ms ease-in-out);
12
+ overflow-y: auto;
13
+ position: relative;
14
+ }
15
+
16
+ .sidebar--collapsed {
17
+ width: 64px;
18
+ }
19
+
20
+ .sidebar--loading .sidebar__unit-list,
21
+ .sidebar--loading .sidebar__header {
22
+ opacity: 0.3;
23
+ pointer-events: none;
24
+ }
25
+
26
+ /* 头部区域 */
27
+ .sidebar__header {
28
+ display: flex;
29
+ align-items: center;
30
+ padding: var(--spacing-lg, 24px) var(--spacing-md, 16px) var(--spacing-md, 16px);
31
+ border-bottom: 1px solid var(--sidebar-border-color, #e0e0e0);
32
+ margin-bottom: var(--spacing-md, 16px);
33
+ }
34
+
35
+ .sidebar__toggle-btn {
36
+ width: 32px;
37
+ height: 32px;
38
+ border: none;
39
+ background: none;
40
+ cursor: pointer;
41
+ border-radius: var(--border-radius-sm, 4px);
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ color: var(--sidebar-text-color, #333333);
46
+ margin-right: var(--spacing-sm, 8px);
47
+ }
48
+
49
+ .sidebar__toggle-btn:hover {
50
+ background-color: var(--sidebar-hover-bg, rgba(0, 0, 0, 0.05));
51
+ }
52
+
53
+ .sidebar__course-info {
54
+ flex: 1;
55
+ }
56
+
57
+ .sidebar__course-title {
58
+ font-size: var(--font-size-lg, 16px);
59
+ font-weight: var(--font-weight-bold, 600);
60
+ color: var(--sidebar-text-color, #333333);
61
+ margin: 0 0 var(--spacing-xs, 4px) 0;
62
+ }
63
+
64
+ .sidebar__course-level {
65
+ font-size: var(--font-size-sm, 12px);
66
+ color: var(--sidebar-text-secondary, #666666);
67
+ }
68
+
69
+ /* 内容区域 */
70
+ .sidebar__content {
71
+ flex: 1;
72
+ padding: 0 var(--spacing-md, 16px);
73
+ }
74
+
75
+ .sidebar__unit-list {
76
+ list-style: none;
77
+ padding: 0;
78
+ margin: 0;
79
+ }
80
+
81
+ /* 单元项样式 */
82
+ .sidebar__unit-item {
83
+ margin-bottom: var(--spacing-xs, 4px);
84
+ border-radius: var(--border-radius-sm, 4px);
85
+ cursor: pointer;
86
+ transition: background-color var(--transition-fast, 150ms ease-in-out);
87
+ padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
88
+ }
89
+
90
+ .sidebar__unit-item:hover {
91
+ background-color: var(--sidebar-hover-bg, rgba(0, 0, 0, 0.03));
92
+ }
93
+
94
+ .sidebar__unit-item--active {
95
+ background-color: var(--sidebar-active-bg, #e3f2fd);
96
+ border-left: 3px solid var(--sidebar-active-border, #1865f2);
97
+ font-weight: var(--font-weight-medium, 500);
98
+ }
99
+
100
+ .sidebar__unit-item--completed {
101
+ opacity: 0.8;
102
+ }
103
+
104
+ .sidebar__unit-item--in-progress {
105
+ font-weight: var(--font-weight-medium, 500);
106
+ }
107
+
108
+ .sidebar__unit-item--not-started {
109
+ opacity: 0.6;
110
+ }
111
+
112
+ .sidebar__unit-item__content {
113
+ display: flex;
114
+ align-items: center;
115
+ margin-bottom: var(--spacing-xs, 4px);
116
+ }
117
+
118
+ .sidebar__unit-item__icon {
119
+ width: 20px;
120
+ height: 20px;
121
+ margin-right: var(--spacing-sm, 8px);
122
+ flex-shrink: 0;
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ font-size: var(--font-size-md, 14px);
127
+ }
128
+
129
+ .sidebar__unit-item__title {
130
+ flex: 1;
131
+ font-size: var(--font-size-md, 14px);
132
+ color: var(--sidebar-text-color, #333333);
133
+ white-space: nowrap;
134
+ overflow: hidden;
135
+ text-overflow: ellipsis;
136
+ }
137
+
138
+ /* 进度条区域 */
139
+ .sidebar__unit-item__progress {
140
+ display: flex;
141
+ align-items: center;
142
+ gap: var(--spacing-sm, 8px);
143
+ margin-top: var(--spacing-xs, 4px);
144
+ }
145
+
146
+ .progress-percentage {
147
+ font-size: var(--font-size-sm, 12px);
148
+ color: var(--sidebar-text-secondary, #666666);
149
+ min-width: 30px;
150
+ text-align: right;
151
+ }
152
+
153
+ /* 状态样式 */
154
+ .sidebar__loading,
155
+ .sidebar__error,
156
+ .sidebar__empty {
157
+ padding: var(--spacing-xl, 32px) var(--spacing-md, 16px);
158
+ text-align: center;
159
+ color: var(--sidebar-text-secondary, #666666);
160
+ font-size: var(--font-size-md, 14px);
161
+ }
162
+
163
+ .sidebar__error {
164
+ color: var(--sidebar-error-color, #dc3545);
165
+ }
166
+
167
+ /* 响应式设计 */
168
+ @media (max-width: 600px) {
169
+ .sidebar {
170
+ position: fixed;
171
+ top: 0;
172
+ left: 0;
173
+ height: 100vh;
174
+ z-index: 1000;
175
+ transform: translateX(-100%);
176
+ }
177
+
178
+ .sidebar--expanded {
179
+ transform: translateX(0);
180
+ }
181
+ }
182
+
183
+ /* 折叠状态下的样式 */
184
+ .sidebar--collapsed .sidebar__course-info,
185
+ .sidebar--collapsed .sidebar__unit-item__title,
186
+ .sidebar--collapsed .sidebar__unit-item__progress {
187
+ display: none;
188
+ }
189
+
190
+ .sidebar--collapsed .sidebar__header {
191
+ justify-content: center;
192
+ padding: var(--spacing-md, 16px);
193
+ }
194
+
195
+ .sidebar--collapsed .sidebar__toggle-btn {
196
+ margin-right: 0;
197
+ }
198
+
199
+ .sidebar--collapsed .sidebar__unit-item {
200
+ display: flex;
201
+ justify-content: center;
202
+ padding: var(--spacing-sm, 8px);
203
+ }
204
+
205
+ .sidebar--collapsed .sidebar__unit-item__content {
206
+ margin-bottom: 0;
207
+ }
@@ -0,0 +1,98 @@
1
+ /* Submenu 根容器 */
2
+ .submenu-container {
3
+ position: relative; /* 确保 submenu 面板能够相对定位 */
4
+ display: inline-block; /* 包裹触发器,使其不占据整行 */
5
+ }
6
+
7
+ /* Submenu 触发器 */
8
+ .submenu-trigger {
9
+ /* 触发器的默认样式 */
10
+ cursor: pointer;
11
+ }
12
+
13
+ /* Submenu 面板 (包含所有菜单项的容器) */
14
+ .submenu-panel {
15
+ position: absolute;
16
+ z-index: 1000; /* 确保浮动菜单在其他内容之上 */
17
+ background-color: var(--submenu-background-color, #fff);
18
+ border: var(--submenu-border, 1px solid #ddd);
19
+ border-radius: var(--submenu-border-radius, 4px);
20
+ box-shadow: var(--submenu-shadow, 0 4px 12px rgba(0, 0, 0, 0.1));
21
+ padding: var(--submenu-padding, 8px 0);
22
+ min-width: var(--submenu-min-width, 160px);
23
+
24
+ /* 初始隐藏状态 */
25
+ opacity: 0;
26
+ visibility: hidden;
27
+ transform: translateY(var(--submenu-transform-y, -10px)); /* 初始位移,用于动画 */
28
+ transition:
29
+ opacity var(--submenu-transition-duration, 0.2s) ease-out,
30
+ transform var(--submenu-transition-duration, 0.2s) ease-out,
31
+ visibility var(--submenu-transition-duration, 0.2s) ease-out;
32
+
33
+ /* 菜单项布局 */
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: var(--submenu-item-gap, 4px); /* 菜单项之间的间距 */
37
+ }
38
+
39
+ /* Submenu 面板的打开状态 */
40
+ .submenu-panel.is-open {
41
+ opacity: 1;
42
+ visibility: visible;
43
+ transform: translateY(0); /* 恢复到正常位置 */
44
+ }
45
+
46
+ /* Submenu 面板定位 (根据 position prop 动态添加类名) */
47
+ .submenu-panel.position-bottom {
48
+ top: 100%;
49
+ left: 0;
50
+ /* 调整 transform 初始值以匹配方向 */
51
+ transform: translateY(var(--submenu-transform-y-bottom, 10px));
52
+ }
53
+ .submenu-panel.position-bottom.alignment-end {
54
+ left: auto;
55
+ right: 0;
56
+ }
57
+ /* 其他 position (top, left, right) 和 alignment 类名类似 */
58
+ /* 例如: */
59
+ .submenu-panel.position-top {
60
+ bottom: 100%;
61
+ left: 0;
62
+ transform: translateY(var(--submenu-transform-y-top, -10px));
63
+ }
64
+ /* ... 更多定位样式 ... */
65
+
66
+ /* 单个菜单项 */
67
+ .submenu-item {
68
+ display: flex;
69
+ align-items: center;
70
+ padding: var(--submenu-item-padding, 8px 16px);
71
+ color: var(--submenu-item-color, #333);
72
+ font-size: var(--submenu-item-font-size, 14px);
73
+ cursor: pointer;
74
+ text-decoration: none; /* 如果菜单项是链接 */
75
+ white-space: nowrap; /* 防止文本换行 */
76
+ transition: background-color var(--submenu-item-transition-duration, 0.15s) ease-in-out,
77
+ color var(--submenu-item-transition-duration, 0.15s) ease-in-out;
78
+ }
79
+
80
+ /* 菜单项悬停/激活状态 */
81
+ .submenu-item:hover,
82
+ .submenu-item.is-active { /* is-active 可用于键盘导航的焦点状态 */
83
+ background-color: var(--submenu-item-hover-bg-color, #f0f0f0);
84
+ color: var(--submenu-item-hover-color, #000);
85
+ }
86
+
87
+ /* 菜单项禁用状态 */
88
+ .submenu-item.is-disabled {
89
+ color: var(--submenu-item-disabled-color, #999);
90
+ cursor: not-allowed;
91
+ opacity: 0.6;
92
+ }
93
+
94
+ /* 菜单项图标 (如果存在) */
95
+ .submenu-item-icon {
96
+ margin-right: var(--submenu-item-icon-margin-right, 8px);
97
+ /* 图标大小和颜色 */
98
+ }