@aura-react-comp/ui 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +67 -2
- package/esm/alert/index.d.ts +28 -0
- package/esm/alert/index.js +76 -0
- package/esm/alert/index.less +172 -0
- package/esm/avatar/index.d.ts +41 -0
- package/esm/avatar/index.js +117 -0
- package/esm/avatar/index.less +162 -0
- package/esm/badge/index.d.ts +29 -0
- package/esm/badge/index.js +84 -0
- package/esm/badge/index.less +215 -0
- package/esm/breadcrumb/index.d.ts +31 -0
- package/esm/breadcrumb/index.js +91 -0
- package/esm/breadcrumb/index.less +108 -0
- package/esm/button/index.d.ts +28 -0
- package/esm/button/index.js +59 -0
- package/esm/button/index.less +191 -0
- package/esm/card/index.d.ts +67 -0
- package/esm/card/index.js +156 -0
- package/esm/card/index.less +231 -0
- package/esm/checkbox/index.d.ts +35 -0
- package/esm/checkbox/index.js +118 -0
- package/esm/checkbox/index.less +141 -0
- package/esm/collapse/index.d.ts +45 -0
- package/esm/collapse/index.js +157 -0
- package/esm/collapse/index.less +144 -0
- package/esm/divider/index.d.ts +16 -0
- package/esm/divider/index.js +37 -0
- package/esm/divider/index.less +115 -0
- package/esm/dropdown/index.d.ts +38 -0
- package/esm/dropdown/index.js +108 -0
- package/esm/dropdown/index.less +245 -0
- package/esm/empty/index.d.ts +35 -0
- package/esm/empty/index.js +87 -0
- package/esm/empty/index.less +67 -0
- package/esm/flex/index.d.ts +24 -0
- package/esm/flex/index.js +64 -0
- package/esm/flex/index.less +9 -0
- package/esm/form/index.d.ts +121 -0
- package/esm/form/index.js +443 -0
- package/esm/form/index.less +257 -0
- package/esm/global.d.ts +6 -0
- package/esm/index.d.ts +78 -0
- package/esm/index.js +41 -0
- package/esm/input/index.d.ts +51 -0
- package/esm/input/index.js +217 -0
- package/esm/input/index.less +369 -0
- package/esm/layout/index.d.ts +46 -0
- package/esm/layout/index.js +135 -0
- package/esm/layout/index.less +132 -0
- package/esm/menu/index.d.ts +91 -0
- package/esm/menu/index.js +294 -0
- package/esm/menu/index.less +340 -0
- package/esm/message/index.d.ts +33 -0
- package/esm/message/index.js +199 -0
- package/esm/message/index.less +113 -0
- package/esm/notification/index.d.ts +33 -0
- package/esm/notification/index.js +229 -0
- package/esm/notification/index.less +175 -0
- package/esm/pagination/index.d.ts +38 -0
- package/esm/pagination/index.js +180 -0
- package/esm/pagination/index.less +238 -0
- package/esm/popconfirm/index.d.ts +37 -0
- package/esm/popconfirm/index.js +115 -0
- package/esm/popconfirm/index.less +229 -0
- package/esm/radio/index.d.ts +33 -0
- package/esm/radio/index.js +122 -0
- package/esm/radio/index.less +119 -0
- package/esm/rate/index.d.ts +30 -0
- package/esm/rate/index.js +143 -0
- package/esm/rate/index.less +87 -0
- package/esm/result/index.d.ts +19 -0
- package/esm/result/index.js +69 -0
- package/esm/result/index.less +103 -0
- package/esm/scrollbar/index.d.ts +18 -0
- package/esm/scrollbar/index.js +35 -0
- package/esm/scrollbar/index.less +67 -0
- package/esm/select/index.d.ts +63 -0
- package/esm/select/index.js +358 -0
- package/esm/select/index.less +427 -0
- package/esm/slider/index.d.ts +36 -0
- package/esm/slider/index.js +255 -0
- package/esm/slider/index.less +154 -0
- package/esm/space/index.d.ts +16 -0
- package/esm/space/index.js +34 -0
- package/esm/space/index.less +34 -0
- package/esm/spin/index.d.ts +44 -0
- package/esm/spin/index.js +152 -0
- package/esm/spin/index.less +170 -0
- package/esm/steps/index.d.ts +55 -0
- package/esm/steps/index.js +165 -0
- package/esm/steps/index.less +394 -0
- package/esm/switch/index.d.ts +30 -0
- package/esm/switch/index.js +56 -0
- package/esm/switch/index.less +135 -0
- package/esm/tabs/index.d.ts +45 -0
- package/esm/tabs/index.js +170 -0
- package/esm/tabs/index.less +226 -0
- package/esm/tag/index.d.ts +52 -0
- package/esm/tag/index.js +120 -0
- package/esm/tag/index.less +227 -0
- package/esm/textarea/index.d.ts +27 -0
- package/esm/textarea/index.js +84 -0
- package/esm/textarea/index.less +224 -0
- package/esm/theme/ThemeProvider.d.ts +15 -0
- package/esm/theme/ThemeProvider.js +32 -0
- package/esm/theme/index.d.ts +2 -0
- package/esm/theme/index.js +1 -0
- package/esm/theme/tokens.css +183 -0
- package/esm/theme/useTheme.d.ts +1 -0
- package/esm/theme/useTheme.js +1 -0
- package/esm/tooltip/index.d.ts +38 -0
- package/esm/tooltip/index.js +149 -0
- package/esm/tooltip/index.less +244 -0
- package/esm/typography/index.d.ts +26 -0
- package/esm/typography/index.js +92 -0
- package/esm/typography/index.less +106 -0
- package/esm/upload/index.d.ts +68 -0
- package/esm/upload/index.js +447 -0
- package/esm/upload/index.less +371 -0
- package/esm/upload/request.d.ts +26 -0
- package/esm/upload/request.js +38 -0
- package/package.json +56 -3
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/* ===== Input 组件样式 ===== */
|
|
2
|
+
|
|
3
|
+
.aura-input {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
position: relative;
|
|
7
|
+
width: 100%;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
border: 1px solid var(--aura-border);
|
|
11
|
+
border-radius: var(--aura-radius-md);
|
|
12
|
+
background: var(--aura-bg);
|
|
13
|
+
color: var(--aura-text);
|
|
14
|
+
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
border-color: var(--aura-primary-400);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:focus-within {
|
|
21
|
+
border-color: var(--aura-primary-500);
|
|
22
|
+
box-shadow: 0 0 0 3px var(--aura-primary-100);
|
|
23
|
+
transform: scale(1.005);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// 输入框元素
|
|
27
|
+
.aura-input-element {
|
|
28
|
+
flex: 1;
|
|
29
|
+
width: 100%;
|
|
30
|
+
border: none;
|
|
31
|
+
outline: none;
|
|
32
|
+
background: transparent;
|
|
33
|
+
color: inherit;
|
|
34
|
+
font-family: inherit;
|
|
35
|
+
line-height: 1.5;
|
|
36
|
+
|
|
37
|
+
&::placeholder {
|
|
38
|
+
color: var(--aura-text-tertiary);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ===== 尺寸 =====
|
|
43
|
+
&&-sm {
|
|
44
|
+
padding: 4px 10px;
|
|
45
|
+
font-size: var(--aura-font-size-sm);
|
|
46
|
+
border-radius: var(--aura-radius-sm);
|
|
47
|
+
|
|
48
|
+
.aura-input-element {
|
|
49
|
+
padding: 0;
|
|
50
|
+
height: 28px;
|
|
51
|
+
font-size: var(--aura-font-size-sm);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&&-md {
|
|
56
|
+
padding: 6px 12px;
|
|
57
|
+
font-size: var(--aura-font-size-md);
|
|
58
|
+
|
|
59
|
+
.aura-input-element {
|
|
60
|
+
padding: 0;
|
|
61
|
+
height: 32px;
|
|
62
|
+
font-size: var(--aura-font-size-md);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&&-lg {
|
|
67
|
+
padding: 8px 14px;
|
|
68
|
+
font-size: var(--aura-font-size-lg);
|
|
69
|
+
border-radius: var(--aura-radius-lg);
|
|
70
|
+
|
|
71
|
+
.aura-input-element {
|
|
72
|
+
padding: 0;
|
|
73
|
+
height: 40px;
|
|
74
|
+
font-size: var(--aura-font-size-lg);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ===== 变体 =====
|
|
79
|
+
&&-filled {
|
|
80
|
+
border-color: transparent;
|
|
81
|
+
background: var(--aura-bg-tertiary);
|
|
82
|
+
border-bottom: 1px solid var(--aura-border);
|
|
83
|
+
border-radius: var(--aura-radius-sm) var(--aura-radius-sm) 0 0;
|
|
84
|
+
|
|
85
|
+
&:hover {
|
|
86
|
+
background: var(--aura-bg-secondary);
|
|
87
|
+
border-bottom-color: var(--aura-primary-400);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:focus-within {
|
|
91
|
+
background: var(--aura-bg-secondary);
|
|
92
|
+
border-bottom-color: var(--aura-primary-500);
|
|
93
|
+
box-shadow: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&&-bordered {
|
|
98
|
+
border: 2px solid var(--aura-border);
|
|
99
|
+
|
|
100
|
+
&:hover {
|
|
101
|
+
border-color: var(--aura-primary-400);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:focus-within {
|
|
105
|
+
border-color: var(--aura-primary-500);
|
|
106
|
+
box-shadow: 0 0 0 2px var(--aura-primary-100);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ===== 状态 =====
|
|
111
|
+
&&-error {
|
|
112
|
+
border-color: var(--aura-error);
|
|
113
|
+
|
|
114
|
+
&:hover {
|
|
115
|
+
border-color: var(--aura-error);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:focus-within {
|
|
119
|
+
border-color: var(--aura-error);
|
|
120
|
+
box-shadow: 0 0 0 2px var(--aura-error-light);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.aura-input-filled {
|
|
124
|
+
border-color: transparent;
|
|
125
|
+
border-bottom-color: var(--aura-error);
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
border-bottom-color: var(--aura-error);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:focus-within {
|
|
132
|
+
border-bottom-color: var(--aura-error);
|
|
133
|
+
box-shadow: none;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&&-warning {
|
|
139
|
+
border-color: var(--aura-warning);
|
|
140
|
+
|
|
141
|
+
&:hover {
|
|
142
|
+
border-color: var(--aura-warning);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&:focus-within {
|
|
146
|
+
border-color: var(--aura-warning);
|
|
147
|
+
box-shadow: 0 0 0 2px var(--aura-warning-light);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&.aura-input-filled {
|
|
151
|
+
border-color: transparent;
|
|
152
|
+
border-bottom-color: var(--aura-warning);
|
|
153
|
+
|
|
154
|
+
&:hover {
|
|
155
|
+
border-bottom-color: var(--aura-warning);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:focus-within {
|
|
159
|
+
border-bottom-color: var(--aura-warning);
|
|
160
|
+
box-shadow: none;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ===== 禁用 =====
|
|
166
|
+
&&-disabled {
|
|
167
|
+
opacity: 0.5;
|
|
168
|
+
cursor: not-allowed;
|
|
169
|
+
background: var(--aura-bg-secondary);
|
|
170
|
+
|
|
171
|
+
.aura-input-element {
|
|
172
|
+
cursor: not-allowed;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&:hover {
|
|
176
|
+
border-color: var(--aura-border);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:focus-within {
|
|
180
|
+
border-color: var(--aura-border);
|
|
181
|
+
box-shadow: none;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ===== 前后缀 =====
|
|
186
|
+
&-prefix,
|
|
187
|
+
&-suffix {
|
|
188
|
+
display: inline-flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
color: var(--aura-text-secondary);
|
|
191
|
+
flex-shrink: 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&-prefix {
|
|
195
|
+
margin-right: var(--aura-spacing-1);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&-suffix {
|
|
199
|
+
margin-left: var(--aura-spacing-1);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ===== 清除按钮 =====
|
|
203
|
+
&-clear {
|
|
204
|
+
display: inline-flex;
|
|
205
|
+
align-items: center;
|
|
206
|
+
justify-content: center;
|
|
207
|
+
width: 16px;
|
|
208
|
+
height: 16px;
|
|
209
|
+
margin-left: var(--aura-spacing-1);
|
|
210
|
+
font-size: 14px;
|
|
211
|
+
line-height: 1;
|
|
212
|
+
color: var(--aura-text-tertiary);
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
border-radius: 50%;
|
|
215
|
+
transition: all var(--aura-duration-fast) var(--aura-easing);
|
|
216
|
+
user-select: none;
|
|
217
|
+
|
|
218
|
+
&:hover {
|
|
219
|
+
color: var(--aura-text-secondary);
|
|
220
|
+
background: var(--aura-bg-tertiary);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ===== 密码可见性切换 =====
|
|
225
|
+
&-eye {
|
|
226
|
+
display: inline-flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
color: var(--aura-text-tertiary);
|
|
230
|
+
transition: color var(--aura-duration-fast) var(--aura-easing);
|
|
231
|
+
|
|
232
|
+
&:hover {
|
|
233
|
+
color: var(--aura-text-secondary);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// ===== 搜索按钮 =====
|
|
238
|
+
&-search-btn {
|
|
239
|
+
display: inline-flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
justify-content: center;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
color: var(--aura-text-tertiary);
|
|
244
|
+
transition: color var(--aura-duration-fast) var(--aura-easing);
|
|
245
|
+
|
|
246
|
+
&:hover {
|
|
247
|
+
color: var(--aura-primary-500);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// 传入 searchButtonText 时以文案替代图标
|
|
252
|
+
&-search-btn-text {
|
|
253
|
+
font-size: var(--aura-font-size-sm);
|
|
254
|
+
white-space: nowrap;
|
|
255
|
+
padding: 0 var(--aura-spacing-1);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ===== 输入框组合容器 =====
|
|
259
|
+
&-group {
|
|
260
|
+
display: inline-flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
width: 100%;
|
|
263
|
+
|
|
264
|
+
.aura-input {
|
|
265
|
+
border-radius: 0;
|
|
266
|
+
|
|
267
|
+
&:first-child {
|
|
268
|
+
border-radius: var(--aura-radius-md) 0 0 var(--aura-radius-md);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&:last-child {
|
|
272
|
+
border-radius: 0 var(--aura-radius-md) var(--aura-radius-md) 0;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.aura-input + .aura-input {
|
|
277
|
+
margin-left: -1px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&&-compact {
|
|
281
|
+
.aura-input {
|
|
282
|
+
border-radius: 0;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ===== 暗色模式 =====
|
|
289
|
+
[data-theme='dark'] {
|
|
290
|
+
.aura-input {
|
|
291
|
+
&:focus-within {
|
|
292
|
+
box-shadow:
|
|
293
|
+
0 0 0 2px rgba(124, 58, 237, 0.2),
|
|
294
|
+
0 0 20px rgba(124, 58, 237, 0.15);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
&-filled:focus-within {
|
|
298
|
+
box-shadow: none;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&-error:focus-within {
|
|
302
|
+
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
&-warning:focus-within {
|
|
306
|
+
box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
&-disabled {
|
|
310
|
+
&:focus-within {
|
|
311
|
+
box-shadow: none;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* ===== 前后置 addon 包裹层 ===== */
|
|
318
|
+
.aura-input-group-wrapper {
|
|
319
|
+
display: flex;
|
|
320
|
+
align-items: stretch;
|
|
321
|
+
width: 100%;
|
|
322
|
+
|
|
323
|
+
.aura-input {
|
|
324
|
+
flex: 1;
|
|
325
|
+
width: auto;
|
|
326
|
+
min-width: 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.aura-input-addon {
|
|
330
|
+
display: flex;
|
|
331
|
+
align-items: center;
|
|
332
|
+
flex-shrink: 0;
|
|
333
|
+
padding: 0 var(--aura-spacing-3);
|
|
334
|
+
background: var(--aura-bg-secondary);
|
|
335
|
+
border: 1px solid var(--aura-border);
|
|
336
|
+
border-radius: var(--aura-radius-md);
|
|
337
|
+
color: var(--aura-text-secondary);
|
|
338
|
+
font-size: var(--aura-font-size-md);
|
|
339
|
+
white-space: nowrap;
|
|
340
|
+
|
|
341
|
+
&:first-child {
|
|
342
|
+
border-right: none;
|
|
343
|
+
border-top-right-radius: 0;
|
|
344
|
+
border-bottom-right-radius: 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&:last-child {
|
|
348
|
+
border-left: none;
|
|
349
|
+
border-top-left-radius: 0;
|
|
350
|
+
border-bottom-left-radius: 0;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&-disabled {
|
|
355
|
+
.aura-input-addon {
|
|
356
|
+
opacity: 0.5;
|
|
357
|
+
cursor: not-allowed;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/* ===== 字数统计 ===== */
|
|
363
|
+
.aura-input-count {
|
|
364
|
+
flex-shrink: 0;
|
|
365
|
+
margin-left: var(--aura-spacing-2);
|
|
366
|
+
color: var(--aura-text-tertiary);
|
|
367
|
+
font-size: var(--aura-font-size-xs);
|
|
368
|
+
line-height: 1;
|
|
369
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface LayoutHeaderProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const LayoutHeader: React.ForwardRefExoticComponent<LayoutHeaderProps & React.RefAttributes<HTMLElement>>;
|
|
8
|
+
export interface LayoutBodyProps {
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const LayoutBody: React.ForwardRefExoticComponent<LayoutBodyProps & React.RefAttributes<HTMLElement>>;
|
|
14
|
+
export interface LayoutSiderProps {
|
|
15
|
+
/** 侧边栏宽度
|
|
16
|
+
* @default 200
|
|
17
|
+
*/
|
|
18
|
+
width?: number;
|
|
19
|
+
/** 是否可折叠 */
|
|
20
|
+
collapsible?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const LayoutSider: React.ForwardRefExoticComponent<LayoutSiderProps & React.RefAttributes<HTMLElement>>;
|
|
26
|
+
export interface LayoutFooterProps {
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
declare const LayoutFooter: React.ForwardRefExoticComponent<LayoutFooterProps & React.RefAttributes<HTMLElement>>;
|
|
32
|
+
export interface LayoutProps {
|
|
33
|
+
/** 是否包含侧边栏(影响布局方向) */
|
|
34
|
+
hasSider?: boolean;
|
|
35
|
+
className?: string;
|
|
36
|
+
style?: React.CSSProperties;
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
interface LayoutComponent extends React.ForwardRefExoticComponent<LayoutProps & React.RefAttributes<HTMLDivElement>> {
|
|
40
|
+
Header: typeof LayoutHeader;
|
|
41
|
+
Body: typeof LayoutBody;
|
|
42
|
+
Sider: typeof LayoutSider;
|
|
43
|
+
Footer: typeof LayoutFooter;
|
|
44
|
+
}
|
|
45
|
+
declare const Layout: LayoutComponent;
|
|
46
|
+
export { Layout };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { forwardRef, useState, useCallback } from 'react';
|
|
2
|
+
import { classNames, prefixCls } from '@aura-react-comp/shared';
|
|
3
|
+
import { ChevronLeft } from '@aura-react-comp/icons';
|
|
4
|
+
import "./index.less";
|
|
5
|
+
|
|
6
|
+
/* ===== LayoutHeader ===== */
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const LayoutHeader = /*#__PURE__*/forwardRef(({
|
|
10
|
+
className,
|
|
11
|
+
style,
|
|
12
|
+
children
|
|
13
|
+
}, ref) => {
|
|
14
|
+
const cls = classNames(prefixCls('layout-header'), className);
|
|
15
|
+
return /*#__PURE__*/_jsx("header", {
|
|
16
|
+
ref: ref,
|
|
17
|
+
className: cls,
|
|
18
|
+
style: style,
|
|
19
|
+
role: "banner",
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
LayoutHeader.displayName = 'Layout.Header';
|
|
24
|
+
|
|
25
|
+
/* ===== LayoutBody ===== */
|
|
26
|
+
|
|
27
|
+
const LayoutBody = /*#__PURE__*/forwardRef(({
|
|
28
|
+
className,
|
|
29
|
+
style,
|
|
30
|
+
children
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const cls = classNames(prefixCls('layout-body'), className);
|
|
33
|
+
return /*#__PURE__*/_jsx("main", {
|
|
34
|
+
ref: ref,
|
|
35
|
+
className: cls,
|
|
36
|
+
style: style,
|
|
37
|
+
role: "main",
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
LayoutBody.displayName = 'Layout.Body';
|
|
42
|
+
|
|
43
|
+
/* ===== LayoutSider ===== */
|
|
44
|
+
|
|
45
|
+
const LayoutSider = /*#__PURE__*/forwardRef(({
|
|
46
|
+
width = 200,
|
|
47
|
+
collapsible = false,
|
|
48
|
+
className,
|
|
49
|
+
style,
|
|
50
|
+
children
|
|
51
|
+
}, ref) => {
|
|
52
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
53
|
+
const siderWidth = collapsed ? 64 : width;
|
|
54
|
+
const handleToggle = useCallback(() => {
|
|
55
|
+
setCollapsed(prev => !prev);
|
|
56
|
+
}, []);
|
|
57
|
+
const cls = classNames(prefixCls('layout-sider'), collapsed && prefixCls('layout-sider-collapsed'), className);
|
|
58
|
+
return /*#__PURE__*/_jsxs("aside", {
|
|
59
|
+
ref: ref,
|
|
60
|
+
className: cls,
|
|
61
|
+
style: {
|
|
62
|
+
...style,
|
|
63
|
+
width: siderWidth,
|
|
64
|
+
flexShrink: 0
|
|
65
|
+
},
|
|
66
|
+
role: "complementary",
|
|
67
|
+
"aria-label": "\u4FA7\u8FB9\u680F",
|
|
68
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
69
|
+
className: prefixCls('layout-sider-content'),
|
|
70
|
+
children: children
|
|
71
|
+
}), collapsible && /*#__PURE__*/_jsx("button", {
|
|
72
|
+
className: prefixCls('layout-sider-trigger'),
|
|
73
|
+
onClick: handleToggle,
|
|
74
|
+
"aria-label": collapsed ? '展开侧边栏' : '收起侧边栏',
|
|
75
|
+
"aria-expanded": !collapsed,
|
|
76
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
77
|
+
style: {
|
|
78
|
+
display: 'inline-flex',
|
|
79
|
+
transition: 'transform var(--aura-duration-normal) var(--aura-easing)',
|
|
80
|
+
transform: collapsed ? 'rotate(180deg)' : 'rotate(0deg)'
|
|
81
|
+
},
|
|
82
|
+
children: /*#__PURE__*/_jsx(ChevronLeft, {
|
|
83
|
+
size: 16
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
LayoutSider.displayName = 'Layout.Sider';
|
|
90
|
+
|
|
91
|
+
/* ===== LayoutFooter ===== */
|
|
92
|
+
|
|
93
|
+
const LayoutFooter = /*#__PURE__*/forwardRef(({
|
|
94
|
+
className,
|
|
95
|
+
style,
|
|
96
|
+
children
|
|
97
|
+
}, ref) => {
|
|
98
|
+
const cls = classNames(prefixCls('layout-footer'), className);
|
|
99
|
+
return /*#__PURE__*/_jsx("footer", {
|
|
100
|
+
ref: ref,
|
|
101
|
+
className: cls,
|
|
102
|
+
style: style,
|
|
103
|
+
role: "contentinfo",
|
|
104
|
+
children: children
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
LayoutFooter.displayName = 'Layout.Footer';
|
|
108
|
+
|
|
109
|
+
/* ===== Layout 主组件 ===== */
|
|
110
|
+
|
|
111
|
+
const LayoutBase = /*#__PURE__*/forwardRef(({
|
|
112
|
+
hasSider = false,
|
|
113
|
+
className,
|
|
114
|
+
style,
|
|
115
|
+
children
|
|
116
|
+
}, ref) => {
|
|
117
|
+
const cls = classNames(prefixCls('layout'), hasSider && prefixCls('layout-has-sider'), className);
|
|
118
|
+
return /*#__PURE__*/_jsx("section", {
|
|
119
|
+
ref: ref,
|
|
120
|
+
className: cls,
|
|
121
|
+
style: style,
|
|
122
|
+
role: "region",
|
|
123
|
+
children: children
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
LayoutBase.displayName = 'Layout';
|
|
127
|
+
|
|
128
|
+
/* ===== 复合组件导出 ===== */
|
|
129
|
+
|
|
130
|
+
const Layout = LayoutBase;
|
|
131
|
+
Layout.Header = LayoutHeader;
|
|
132
|
+
Layout.Body = LayoutBody;
|
|
133
|
+
Layout.Sider = LayoutSider;
|
|
134
|
+
Layout.Footer = LayoutFooter;
|
|
135
|
+
export { Layout };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* ===== Layout 组件样式 ===== */
|
|
2
|
+
|
|
3
|
+
.aura-layout {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
min-height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
background: var(--aura-bg-secondary);
|
|
9
|
+
|
|
10
|
+
&&-has-sider {
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// ===== Header =====
|
|
16
|
+
.aura-layout-header {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
height: 56px;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
padding: 0 var(--aura-spacing-6);
|
|
22
|
+
background: var(--aura-bg);
|
|
23
|
+
border-bottom: 1px solid var(--aura-border);
|
|
24
|
+
color: var(--aura-text);
|
|
25
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
|
|
26
|
+
z-index: 10;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ===== Body =====
|
|
30
|
+
.aura-layout-body {
|
|
31
|
+
flex: 1;
|
|
32
|
+
padding: var(--aura-spacing-6);
|
|
33
|
+
background: var(--aura-bg-secondary);
|
|
34
|
+
color: var(--aura-text);
|
|
35
|
+
overflow: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ===== Footer =====
|
|
39
|
+
.aura-layout-footer {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
height: 48px;
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
padding: 0 var(--aura-spacing-6);
|
|
45
|
+
background: var(--aura-bg);
|
|
46
|
+
border-top: 1px solid var(--aura-border);
|
|
47
|
+
color: var(--aura-text-secondary);
|
|
48
|
+
font-size: var(--aura-font-size-sm);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ===== Sider =====
|
|
52
|
+
.aura-layout-sider {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
position: relative;
|
|
56
|
+
background: var(--aura-bg);
|
|
57
|
+
border-right: 1px solid var(--aura-border);
|
|
58
|
+
transition: width var(--aura-duration-slow) cubic-bezier(0.4, 0, 0.2, 1);
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
z-index: 9;
|
|
61
|
+
|
|
62
|
+
&&-collapsed {
|
|
63
|
+
.aura-layout-sider-content {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transform: scale(0.95);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.aura-layout-sider-content {
|
|
71
|
+
flex: 1;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
padding: var(--aura-spacing-4);
|
|
74
|
+
transition:
|
|
75
|
+
opacity var(--aura-duration-normal) var(--aura-easing),
|
|
76
|
+
transform var(--aura-duration-normal) var(--aura-easing);
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.aura-layout-sider-trigger {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 40px;
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
border: none;
|
|
88
|
+
border-top: 1px solid var(--aura-border);
|
|
89
|
+
background: var(--aura-bg);
|
|
90
|
+
color: var(--aura-text-secondary);
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
transition: all var(--aura-duration-normal) var(--aura-easing);
|
|
93
|
+
|
|
94
|
+
&:hover {
|
|
95
|
+
background: var(--aura-primary-50);
|
|
96
|
+
color: var(--aura-primary-700);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ===== 暗色模式 =====
|
|
101
|
+
[data-theme="dark"] {
|
|
102
|
+
.aura-layout-header {
|
|
103
|
+
background: var(--aura-gray-900);
|
|
104
|
+
border-color: var(--aura-gray-700);
|
|
105
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.aura-layout-body {
|
|
109
|
+
background: var(--aura-gray-900);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.aura-layout-footer {
|
|
113
|
+
background: var(--aura-gray-900);
|
|
114
|
+
border-color: var(--aura-gray-700);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.aura-layout-sider {
|
|
118
|
+
background: var(--aura-gray-900);
|
|
119
|
+
border-color: var(--aura-gray-700);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.aura-layout-sider-trigger {
|
|
123
|
+
background: var(--aura-gray-900);
|
|
124
|
+
border-color: var(--aura-gray-700);
|
|
125
|
+
color: var(--aura-gray-400);
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
background: rgba(124, 58, 237, 0.1);
|
|
129
|
+
color: var(--aura-primary-400);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|