@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,154 @@
|
|
|
1
|
+
/* ===== Slider 组件样式 ===== */
|
|
2
|
+
|
|
3
|
+
.aura-slider {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: var(--aura-spacing-3) 0;
|
|
7
|
+
user-select: none;
|
|
8
|
+
touch-action: none;
|
|
9
|
+
|
|
10
|
+
// 禁用状态
|
|
11
|
+
&&-disabled {
|
|
12
|
+
opacity: 0.5;
|
|
13
|
+
cursor: not-allowed;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ===== 轨道 =====
|
|
19
|
+
.aura-slider-track {
|
|
20
|
+
position: relative;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 6px;
|
|
23
|
+
border-radius: var(--aura-radius-full);
|
|
24
|
+
background: var(--aura-gray-200);
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
transition: height var(--aura-duration-fast) var(--aura-easing);
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
height: 8px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ===== 已选区域 =====
|
|
34
|
+
.aura-slider-track-selected {
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 0;
|
|
37
|
+
height: 100%;
|
|
38
|
+
border-radius: var(--aura-radius-full);
|
|
39
|
+
background: var(--aura-primary-700);
|
|
40
|
+
transition:
|
|
41
|
+
left var(--aura-duration-fast) var(--aura-easing),
|
|
42
|
+
width var(--aura-duration-fast) var(--aura-easing);
|
|
43
|
+
|
|
44
|
+
.aura-slider-disabled & {
|
|
45
|
+
background: var(--aura-gray-400);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ===== 滑块手柄 =====
|
|
50
|
+
.aura-slider-handle {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 50%;
|
|
53
|
+
width: 16px;
|
|
54
|
+
height: 16px;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
background: var(--aura-bg);
|
|
57
|
+
border: 2px solid var(--aura-primary-700);
|
|
58
|
+
transform: translate(-50%, -50%);
|
|
59
|
+
cursor: grab;
|
|
60
|
+
z-index: 1;
|
|
61
|
+
// 触屏拖拽时阻止浏览器把手势识别为页面滚动
|
|
62
|
+
touch-action: none;
|
|
63
|
+
transition:
|
|
64
|
+
box-shadow var(--aura-duration-normal) var(--aura-easing),
|
|
65
|
+
transform var(--aura-duration-normal) cubic-bezier(0.34, 1.56, 0.64, 1),
|
|
66
|
+
border-color var(--aura-duration-normal) var(--aura-easing);
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:focus-visible {
|
|
73
|
+
outline: none;
|
|
74
|
+
box-shadow:
|
|
75
|
+
0 0 0 2px var(--aura-primary-200),
|
|
76
|
+
0 0 0 4px rgba(124, 58, 237, 0.15);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 拖拽激活状态
|
|
80
|
+
&&-active {
|
|
81
|
+
width: 20px;
|
|
82
|
+
height: 20px;
|
|
83
|
+
cursor: grabbing;
|
|
84
|
+
box-shadow:
|
|
85
|
+
var(--aura-shadow-md),
|
|
86
|
+
0 0 0 4px rgba(124, 58, 237, 0.2);
|
|
87
|
+
transform: translate(-50%, -50%) scale(1.1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.aura-slider-disabled & {
|
|
91
|
+
border-color: var(--aura-gray-400);
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
|
|
94
|
+
&:hover {
|
|
95
|
+
box-shadow: none;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ===== 标记 =====
|
|
101
|
+
.aura-slider-marks {
|
|
102
|
+
position: relative;
|
|
103
|
+
width: 100%;
|
|
104
|
+
margin-top: var(--aura-spacing-2);
|
|
105
|
+
height: 20px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.aura-slider-mark {
|
|
109
|
+
position: absolute;
|
|
110
|
+
transform: translateX(-50%);
|
|
111
|
+
font-size: var(--aura-font-size-xs);
|
|
112
|
+
color: var(--aura-text-tertiary);
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
transition: color var(--aura-duration-fast) var(--aura-easing);
|
|
115
|
+
|
|
116
|
+
// 激活状态的标记
|
|
117
|
+
&&-active {
|
|
118
|
+
color: var(--aura-primary-700);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ===== 暗色模式 =====
|
|
123
|
+
[data-theme='dark'] {
|
|
124
|
+
.aura-slider-track {
|
|
125
|
+
background: var(--aura-gray-700);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.aura-slider-track-selected {
|
|
129
|
+
background: var(--aura-primary-600);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.aura-slider-handle {
|
|
133
|
+
background: var(--aura-gray-800);
|
|
134
|
+
border-color: var(--aura-primary-600);
|
|
135
|
+
|
|
136
|
+
&:hover {
|
|
137
|
+
box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&&-active {
|
|
141
|
+
box-shadow:
|
|
142
|
+
var(--aura-shadow-lg),
|
|
143
|
+
0 0 0 4px rgba(124, 58, 237, 0.3);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.aura-slider-mark {
|
|
148
|
+
color: var(--aura-gray-400);
|
|
149
|
+
|
|
150
|
+
&&-active {
|
|
151
|
+
color: var(--aura-primary-400);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export interface SpaceProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** 排列方向
|
|
4
|
+
* @default 'horizontal'
|
|
5
|
+
*/
|
|
6
|
+
direction?: 'horizontal' | 'vertical';
|
|
7
|
+
/** 间距大小,支持预设尺寸或自定义像素值
|
|
8
|
+
* @default 'md'
|
|
9
|
+
*/
|
|
10
|
+
size?: 'sm' | 'md' | 'lg' | number;
|
|
11
|
+
/** 是否自动换行(仅水平方向有效) */
|
|
12
|
+
wrap?: boolean;
|
|
13
|
+
/** 对齐方式 */
|
|
14
|
+
align?: 'start' | 'center' | 'end' | 'baseline';
|
|
15
|
+
}
|
|
16
|
+
export declare const Space: React.ForwardRefExoticComponent<SpaceProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { classNames, prefixCls } from '@aura-react-comp/shared';
|
|
3
|
+
import "./index.less";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const sizeMap = {
|
|
6
|
+
sm: 8,
|
|
7
|
+
md: 16,
|
|
8
|
+
lg: 24
|
|
9
|
+
};
|
|
10
|
+
export const Space = /*#__PURE__*/forwardRef(({
|
|
11
|
+
direction = 'horizontal',
|
|
12
|
+
size = 'md',
|
|
13
|
+
wrap = false,
|
|
14
|
+
align,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
children,
|
|
18
|
+
...rest
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const gap = typeof size === 'number' ? size : sizeMap[size];
|
|
21
|
+
const cls = classNames(prefixCls('space'), direction === 'vertical' && prefixCls('space-vertical'), wrap && prefixCls('space-wrap'), align && prefixCls(`space-align-${align}`), className);
|
|
22
|
+
const mergedStyle = {
|
|
23
|
+
...style,
|
|
24
|
+
gap: `${gap}px`
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/_jsx("div", {
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: cls,
|
|
29
|
+
style: mergedStyle,
|
|
30
|
+
...rest,
|
|
31
|
+
children: children
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
Space.displayName = 'Space';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* ===== Space 布局 ===== */
|
|
2
|
+
.aura-space {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
align-items: center;
|
|
6
|
+
flex-wrap: nowrap;
|
|
7
|
+
|
|
8
|
+
/* 垂直方向 */
|
|
9
|
+
&&-vertical {
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* 自动换行 */
|
|
14
|
+
&&-wrap {
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* 对齐方式 */
|
|
19
|
+
&&-align-start {
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&&-align-center {
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&&-align-end {
|
|
28
|
+
align-items: flex-end;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&&-align-baseline {
|
|
32
|
+
align-items: baseline;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SpinProps {
|
|
3
|
+
/**
|
|
4
|
+
* 加载指示器尺寸
|
|
5
|
+
* @default 'md'
|
|
6
|
+
*/
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
/**
|
|
9
|
+
* 是否加载中
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
spinning?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 延迟显示加载指示器(ms),避免快速加载时闪烁
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
delay?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 加载动画样式
|
|
20
|
+
* @default 'default'
|
|
21
|
+
*/
|
|
22
|
+
variant?: 'default' | 'dot';
|
|
23
|
+
/**
|
|
24
|
+
* 加载提示文字
|
|
25
|
+
*/
|
|
26
|
+
tip?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 自定义加载图标
|
|
29
|
+
*/
|
|
30
|
+
indicator?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* 包裹的内容(加载时半透明)
|
|
33
|
+
*/
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* 自定义类名
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 自定义样式
|
|
41
|
+
*/
|
|
42
|
+
style?: React.CSSProperties;
|
|
43
|
+
}
|
|
44
|
+
export declare const Spin: React.ForwardRefExoticComponent<SpinProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { forwardRef, useEffect, useState, useMemo } from 'react';
|
|
2
|
+
import { classNames, prefixCls } from '@aura-react-comp/shared';
|
|
3
|
+
import "./index.less";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
/** 尺寸 → 像素映射 */
|
|
7
|
+
const SIZE_MAP = {
|
|
8
|
+
sm: 16,
|
|
9
|
+
md: 24,
|
|
10
|
+
lg: 36
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 内联 Spinner SVG:底层半透明轨道圆 + 顶层追逐弧线
|
|
15
|
+
* 使用纯 CSS 旋转动画,避免 JS 动画开销
|
|
16
|
+
*/
|
|
17
|
+
const SpinnerSvg = ({
|
|
18
|
+
pixelSize,
|
|
19
|
+
className
|
|
20
|
+
}) => {
|
|
21
|
+
// 根据尺寸动态计算 stroke 宽度,小尺寸相对更粗以保持可见性
|
|
22
|
+
const strokeWidth = pixelSize <= 16 ? 2.5 : pixelSize <= 24 ? 2.5 : 3;
|
|
23
|
+
const center = pixelSize / 2;
|
|
24
|
+
const radius = center - strokeWidth / 2;
|
|
25
|
+
const circumference = 2 * Math.PI * radius;
|
|
26
|
+
// 弧线占圆周的 75%,剩余 25% 为缺口
|
|
27
|
+
const arcLength = circumference * 0.75;
|
|
28
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
29
|
+
className: className,
|
|
30
|
+
viewBox: `0 0 ${pixelSize} ${pixelSize}`,
|
|
31
|
+
width: pixelSize,
|
|
32
|
+
height: pixelSize,
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
fill: "none",
|
|
35
|
+
children: [/*#__PURE__*/_jsx("circle", {
|
|
36
|
+
cx: center,
|
|
37
|
+
cy: center,
|
|
38
|
+
r: radius,
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: strokeWidth,
|
|
41
|
+
opacity: 0.18
|
|
42
|
+
}), /*#__PURE__*/_jsx("circle", {
|
|
43
|
+
cx: center,
|
|
44
|
+
cy: center,
|
|
45
|
+
r: radius,
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: strokeWidth,
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
strokeDasharray: `${arcLength} ${circumference}`
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 点状加载动画 — 三个弹跳圆点
|
|
56
|
+
*/
|
|
57
|
+
const DotIndicator = ({
|
|
58
|
+
className
|
|
59
|
+
}) => /*#__PURE__*/_jsxs("span", {
|
|
60
|
+
className: className,
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
63
|
+
className: prefixCls('spin-dot-item')
|
|
64
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
65
|
+
className: prefixCls('spin-dot-item')
|
|
66
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
67
|
+
className: prefixCls('spin-dot-item')
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
export const Spin = /*#__PURE__*/forwardRef(({
|
|
71
|
+
size = 'md',
|
|
72
|
+
spinning: spinningProp = true,
|
|
73
|
+
delay = 0,
|
|
74
|
+
variant = 'default',
|
|
75
|
+
tip,
|
|
76
|
+
indicator,
|
|
77
|
+
children,
|
|
78
|
+
className,
|
|
79
|
+
style
|
|
80
|
+
}, ref) => {
|
|
81
|
+
const pixelSize = SIZE_MAP[size] ?? 24;
|
|
82
|
+
|
|
83
|
+
// delay 逻辑:避免快速加载闪烁
|
|
84
|
+
const [showSpinner, setShowSpinner] = useState(delay === 0);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (delay <= 0) {
|
|
87
|
+
setShowSpinner(true);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setShowSpinner(false);
|
|
91
|
+
const timer = setTimeout(() => setShowSpinner(true), delay);
|
|
92
|
+
return () => clearTimeout(timer);
|
|
93
|
+
}, [delay]);
|
|
94
|
+
|
|
95
|
+
// 合并 spinning 状态:外部 spinning + 内部 delay
|
|
96
|
+
const effectiveSpinning = spinningProp && (delay === 0 || showSpinner);
|
|
97
|
+
|
|
98
|
+
// 构建默认指示器
|
|
99
|
+
const defaultIndicator = useMemo(() => {
|
|
100
|
+
if (indicator) return indicator;
|
|
101
|
+
if (variant === 'dot') {
|
|
102
|
+
return /*#__PURE__*/_jsx(DotIndicator, {
|
|
103
|
+
className: prefixCls('spin-dot')
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return /*#__PURE__*/_jsx(SpinnerSvg, {
|
|
107
|
+
pixelSize: pixelSize,
|
|
108
|
+
className: prefixCls('spin-svg')
|
|
109
|
+
});
|
|
110
|
+
}, [indicator, variant, pixelSize]);
|
|
111
|
+
|
|
112
|
+
// 核心 spin 元素
|
|
113
|
+
const spinElement = /*#__PURE__*/_jsxs("div", {
|
|
114
|
+
className: prefixCls('spin-indicator'),
|
|
115
|
+
children: [defaultIndicator, tip && /*#__PURE__*/_jsx("span", {
|
|
116
|
+
className: prefixCls('spin-tip'),
|
|
117
|
+
children: tip
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// 无 children:独立显示
|
|
122
|
+
if (!children) {
|
|
123
|
+
const cls = classNames(prefixCls('spin'), prefixCls(`spin-${size}`), !effectiveSpinning && prefixCls('spin-hidden'), className);
|
|
124
|
+
return /*#__PURE__*/_jsx("div", {
|
|
125
|
+
ref: ref,
|
|
126
|
+
className: cls,
|
|
127
|
+
style: style,
|
|
128
|
+
role: "status",
|
|
129
|
+
"aria-label": typeof tip === 'string' ? tip : '加载中',
|
|
130
|
+
children: effectiveSpinning && spinElement
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 有 children:包裹模式
|
|
135
|
+
const containerCls = classNames(prefixCls('spin-container'), effectiveSpinning && prefixCls('spin-spinning'), className);
|
|
136
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
137
|
+
ref: ref,
|
|
138
|
+
className: containerCls,
|
|
139
|
+
style: style,
|
|
140
|
+
children: [effectiveSpinning && /*#__PURE__*/_jsx("div", {
|
|
141
|
+
className: prefixCls('spin-overlay'),
|
|
142
|
+
role: "status",
|
|
143
|
+
"aria-label": typeof tip === 'string' ? tip : '加载中',
|
|
144
|
+
children: spinElement
|
|
145
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
146
|
+
className: classNames(prefixCls('spin-content'), effectiveSpinning && prefixCls('spin-content-blur')),
|
|
147
|
+
"aria-busy": effectiveSpinning,
|
|
148
|
+
children: children
|
|
149
|
+
})]
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
Spin.displayName = 'Spin';
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* ===== Spin 加载中 — 样式表 ===== */
|
|
2
|
+
|
|
3
|
+
.aura-spin {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
|
|
8
|
+
/* 隐藏状态:无动画内容时折叠 */
|
|
9
|
+
&-hidden {
|
|
10
|
+
visibility: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* ========== 旋转指示器 ========== */
|
|
14
|
+
&-indicator {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: var(--aura-spacing-2);
|
|
19
|
+
color: var(--aura-primary-700);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* ========== SVG 旋转动画 ========== */
|
|
23
|
+
&-svg {
|
|
24
|
+
will-change: transform;
|
|
25
|
+
animation: aura-spin-rotate 1s linear infinite;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ========== 提示文字 ========== */
|
|
29
|
+
&-tip {
|
|
30
|
+
color: var(--aura-primary-700);
|
|
31
|
+
font-size: var(--aura-font-size-sm);
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
user-select: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* ========== 容器模式(包裹 children) ========== */
|
|
37
|
+
&-container {
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 覆盖层 */
|
|
42
|
+
&-overlay {
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
z-index: 1;
|
|
49
|
+
/* 入场动画:ease-out 响应迅速,适合用户等待场景 */
|
|
50
|
+
animation: aura-spin-overlay-in var(--aura-duration-normal) ease-out both;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* 覆盖层入场 */
|
|
54
|
+
@keyframes aura-spin-overlay-in {
|
|
55
|
+
from {
|
|
56
|
+
opacity: 0;
|
|
57
|
+
}
|
|
58
|
+
to {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* 内容区域 */
|
|
64
|
+
&-content {
|
|
65
|
+
/* 使用 ease-out 退出更快,让内容快速恢复可交互 */
|
|
66
|
+
transition:
|
|
67
|
+
opacity var(--aura-duration-normal) ease-out,
|
|
68
|
+
filter var(--aura-duration-normal) ease-out;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* 加载中:半透明 + 轻微模糊 */
|
|
72
|
+
&-content-blur {
|
|
73
|
+
opacity: 0.4;
|
|
74
|
+
filter: blur(1px);
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
user-select: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* ========== 点状加载动画 ========== */
|
|
80
|
+
&-dot {
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: 4px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-dot-item {
|
|
87
|
+
display: block;
|
|
88
|
+
width: 8px;
|
|
89
|
+
height: 8px;
|
|
90
|
+
border-radius: var(--aura-radius-full);
|
|
91
|
+
background: currentColor;
|
|
92
|
+
opacity: 0.3;
|
|
93
|
+
will-change: transform, opacity;
|
|
94
|
+
animation: aura-spin-dot-bounce 1.2s ease-in-out infinite both;
|
|
95
|
+
|
|
96
|
+
&:nth-child(1) {
|
|
97
|
+
animation-delay: 0s;
|
|
98
|
+
}
|
|
99
|
+
&:nth-child(2) {
|
|
100
|
+
animation-delay: 0.2s;
|
|
101
|
+
}
|
|
102
|
+
&:nth-child(3) {
|
|
103
|
+
animation-delay: 0.4s;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@keyframes aura-spin-dot-bounce {
|
|
108
|
+
0%,
|
|
109
|
+
80%,
|
|
110
|
+
100% {
|
|
111
|
+
transform: scale(0.6);
|
|
112
|
+
opacity: 0.3;
|
|
113
|
+
}
|
|
114
|
+
40% {
|
|
115
|
+
transform: scale(1);
|
|
116
|
+
opacity: 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* ========== 旋转关键帧 ========== */
|
|
122
|
+
@keyframes aura-spin-rotate {
|
|
123
|
+
from {
|
|
124
|
+
transform: rotate(0deg);
|
|
125
|
+
}
|
|
126
|
+
to {
|
|
127
|
+
transform: rotate(360deg);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* ========== 尺寸变体 ========== */
|
|
132
|
+
/* sm */ .aura-spin-sm { /* size handled in JS via pixelSize */ }
|
|
133
|
+
/* md */ .aura-spin-md { /* size handled in JS via pixelSize */ }
|
|
134
|
+
/* lg */ .aura-spin-lg { /* size handled in JS via pixelSize */ }
|
|
135
|
+
|
|
136
|
+
/* ========== 暗色模式 ========== */
|
|
137
|
+
[data-theme="dark"] {
|
|
138
|
+
.aura-spin {
|
|
139
|
+
&-indicator {
|
|
140
|
+
color: var(--aura-primary-600);
|
|
141
|
+
}
|
|
142
|
+
&-tip {
|
|
143
|
+
color: var(--aura-primary-600);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* ========== 减弱动画(无障碍) ========== */
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
.aura-spin {
|
|
151
|
+
&-svg {
|
|
152
|
+
animation: none;
|
|
153
|
+
/* 静态显示一个固定弧线作为替代 */
|
|
154
|
+
opacity: 0.6;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&-dot-item {
|
|
158
|
+
animation: none;
|
|
159
|
+
opacity: 0.5;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&-overlay {
|
|
163
|
+
animation: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&-content {
|
|
167
|
+
transition: none;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface StepProps {
|
|
3
|
+
/** 步骤标题 */
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
/** 步骤副标题(显示在标题旁) */
|
|
6
|
+
subTitle?: React.ReactNode;
|
|
7
|
+
/** 覆盖步骤状态;目前支持 `error`(出错态,图标与标题转红) */
|
|
8
|
+
status?: 'error';
|
|
9
|
+
/** 步骤描述 */
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
/** 自定义图标 */
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
/** 是否禁用 */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** 自定义类名 */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** 自定义样式 */
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
declare const Step: React.ForwardRefExoticComponent<StepProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export interface StepsProps {
|
|
22
|
+
/** 当前步骤索引(受控,从 0 开始;传入后点击步骤只触发 onChange,不自更新)
|
|
23
|
+
* @default 0
|
|
24
|
+
*/
|
|
25
|
+
current?: number;
|
|
26
|
+
/** 默认当前步骤索引(非受控)
|
|
27
|
+
* @default 0
|
|
28
|
+
*/
|
|
29
|
+
defaultCurrent?: number;
|
|
30
|
+
/** 变体
|
|
31
|
+
* @default 'default'
|
|
32
|
+
*/
|
|
33
|
+
variant?: 'default' | 'dot' | 'navigation';
|
|
34
|
+
/** 尺寸
|
|
35
|
+
* @default 'md'
|
|
36
|
+
*/
|
|
37
|
+
size?: 'sm' | 'md';
|
|
38
|
+
/** 方向
|
|
39
|
+
* @default 'horizontal'
|
|
40
|
+
*/
|
|
41
|
+
direction?: 'horizontal' | 'vertical';
|
|
42
|
+
/** 步骤切换回调 */
|
|
43
|
+
onChange?: (current: number) => void;
|
|
44
|
+
/** 自定义类名 */
|
|
45
|
+
className?: string;
|
|
46
|
+
/** 自定义样式 */
|
|
47
|
+
style?: React.CSSProperties;
|
|
48
|
+
/** 子元素 */
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
interface StepsComponent extends React.ForwardRefExoticComponent<StepsProps & React.RefAttributes<HTMLDivElement>> {
|
|
52
|
+
Step: typeof Step;
|
|
53
|
+
}
|
|
54
|
+
declare const Steps: StepsComponent;
|
|
55
|
+
export { Steps };
|