@aura-react-comp/ui 0.0.0-stage → 0.1.1

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 (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/esm/alert/index.d.ts +28 -0
  4. package/esm/alert/index.js +76 -0
  5. package/esm/alert/index.less +172 -0
  6. package/esm/avatar/index.d.ts +41 -0
  7. package/esm/avatar/index.js +117 -0
  8. package/esm/avatar/index.less +163 -0
  9. package/esm/badge/index.d.ts +29 -0
  10. package/esm/badge/index.js +84 -0
  11. package/esm/badge/index.less +215 -0
  12. package/esm/breadcrumb/index.d.ts +31 -0
  13. package/esm/breadcrumb/index.js +91 -0
  14. package/esm/breadcrumb/index.less +107 -0
  15. package/esm/button/index.d.ts +28 -0
  16. package/esm/button/index.js +59 -0
  17. package/esm/button/index.less +191 -0
  18. package/esm/card/index.d.ts +67 -0
  19. package/esm/card/index.js +156 -0
  20. package/esm/card/index.less +231 -0
  21. package/esm/checkbox/index.d.ts +35 -0
  22. package/esm/checkbox/index.js +118 -0
  23. package/esm/checkbox/index.less +175 -0
  24. package/esm/collapse/index.d.ts +45 -0
  25. package/esm/collapse/index.js +157 -0
  26. package/esm/collapse/index.less +144 -0
  27. package/esm/divider/index.d.ts +16 -0
  28. package/esm/divider/index.js +37 -0
  29. package/esm/divider/index.less +115 -0
  30. package/esm/dropdown/index.d.ts +38 -0
  31. package/esm/dropdown/index.js +108 -0
  32. package/esm/dropdown/index.less +247 -0
  33. package/esm/empty/index.d.ts +35 -0
  34. package/esm/empty/index.js +87 -0
  35. package/esm/empty/index.less +67 -0
  36. package/esm/flex/index.d.ts +24 -0
  37. package/esm/flex/index.js +64 -0
  38. package/esm/flex/index.less +9 -0
  39. package/esm/form/index.d.ts +121 -0
  40. package/esm/form/index.js +443 -0
  41. package/esm/form/index.less +258 -0
  42. package/esm/global.d.ts +6 -0
  43. package/esm/index.d.ts +78 -0
  44. package/esm/index.js +41 -0
  45. package/esm/input/index.d.ts +51 -0
  46. package/esm/input/index.js +217 -0
  47. package/esm/input/index.less +369 -0
  48. package/esm/layout/index.d.ts +46 -0
  49. package/esm/layout/index.js +135 -0
  50. package/esm/layout/index.less +132 -0
  51. package/esm/menu/index.d.ts +91 -0
  52. package/esm/menu/index.js +294 -0
  53. package/esm/menu/index.less +340 -0
  54. package/esm/message/index.d.ts +33 -0
  55. package/esm/message/index.js +199 -0
  56. package/esm/message/index.less +118 -0
  57. package/esm/notification/index.d.ts +33 -0
  58. package/esm/notification/index.js +229 -0
  59. package/esm/notification/index.less +175 -0
  60. package/esm/pagination/index.d.ts +38 -0
  61. package/esm/pagination/index.js +182 -0
  62. package/esm/pagination/index.less +230 -0
  63. package/esm/popconfirm/index.d.ts +37 -0
  64. package/esm/popconfirm/index.js +115 -0
  65. package/esm/popconfirm/index.less +229 -0
  66. package/esm/radio/index.d.ts +33 -0
  67. package/esm/radio/index.js +122 -0
  68. package/esm/radio/index.less +155 -0
  69. package/esm/rate/index.d.ts +30 -0
  70. package/esm/rate/index.js +143 -0
  71. package/esm/rate/index.less +87 -0
  72. package/esm/result/index.d.ts +19 -0
  73. package/esm/result/index.js +69 -0
  74. package/esm/result/index.less +104 -0
  75. package/esm/scrollbar/index.d.ts +18 -0
  76. package/esm/scrollbar/index.js +35 -0
  77. package/esm/scrollbar/index.less +67 -0
  78. package/esm/select/index.d.ts +63 -0
  79. package/esm/select/index.js +358 -0
  80. package/esm/select/index.less +471 -0
  81. package/esm/slider/index.d.ts +36 -0
  82. package/esm/slider/index.js +255 -0
  83. package/esm/slider/index.less +154 -0
  84. package/esm/space/index.d.ts +16 -0
  85. package/esm/space/index.js +34 -0
  86. package/esm/space/index.less +34 -0
  87. package/esm/spin/index.d.ts +44 -0
  88. package/esm/spin/index.js +152 -0
  89. package/esm/spin/index.less +179 -0
  90. package/esm/steps/index.d.ts +55 -0
  91. package/esm/steps/index.js +165 -0
  92. package/esm/steps/index.less +394 -0
  93. package/esm/switch/index.d.ts +30 -0
  94. package/esm/switch/index.js +56 -0
  95. package/esm/switch/index.less +160 -0
  96. package/esm/tabs/index.d.ts +45 -0
  97. package/esm/tabs/index.js +170 -0
  98. package/esm/tabs/index.less +228 -0
  99. package/esm/tag/index.d.ts +52 -0
  100. package/esm/tag/index.js +120 -0
  101. package/esm/tag/index.less +227 -0
  102. package/esm/textarea/index.d.ts +27 -0
  103. package/esm/textarea/index.js +84 -0
  104. package/esm/textarea/index.less +226 -0
  105. package/esm/theme/ThemeProvider.d.ts +15 -0
  106. package/esm/theme/ThemeProvider.js +32 -0
  107. package/esm/theme/index.d.ts +2 -0
  108. package/esm/theme/index.js +1 -0
  109. package/esm/theme/tokens.css +183 -0
  110. package/esm/theme/useTheme.d.ts +1 -0
  111. package/esm/theme/useTheme.js +1 -0
  112. package/esm/tooltip/index.d.ts +38 -0
  113. package/esm/tooltip/index.js +149 -0
  114. package/esm/tooltip/index.less +244 -0
  115. package/esm/typography/index.d.ts +26 -0
  116. package/esm/typography/index.js +92 -0
  117. package/esm/typography/index.less +107 -0
  118. package/esm/upload/index.d.ts +68 -0
  119. package/esm/upload/index.js +447 -0
  120. package/esm/upload/index.less +376 -0
  121. package/esm/upload/request.d.ts +26 -0
  122. package/esm/upload/request.js +38 -0
  123. package/package.json +56 -3
@@ -0,0 +1,179 @@
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 */
133
+ .aura-spin-sm {
134
+ /* size handled in JS via pixelSize */
135
+ }
136
+ /* md */
137
+ .aura-spin-md {
138
+ /* size handled in JS via pixelSize */
139
+ }
140
+ /* lg */
141
+ .aura-spin-lg {
142
+ /* size handled in JS via pixelSize */
143
+ }
144
+
145
+ /* ========== 暗色模式 ========== */
146
+ [data-theme='dark'] {
147
+ .aura-spin {
148
+ &-indicator {
149
+ color: var(--aura-primary-600);
150
+ }
151
+ &-tip {
152
+ color: var(--aura-primary-600);
153
+ }
154
+ }
155
+ }
156
+
157
+ /* ========== 减弱动画(无障碍) ========== */
158
+ @media (prefers-reduced-motion: reduce) {
159
+ .aura-spin {
160
+ &-svg {
161
+ animation: none;
162
+ /* 静态显示一个固定弧线作为替代 */
163
+ opacity: 0.6;
164
+ }
165
+
166
+ &-dot-item {
167
+ animation: none;
168
+ opacity: 0.5;
169
+ }
170
+
171
+ &-overlay {
172
+ animation: none;
173
+ }
174
+
175
+ &-content {
176
+ transition: none;
177
+ }
178
+ }
179
+ }
@@ -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 };
@@ -0,0 +1,165 @@
1
+ import React, { forwardRef, createContext, useContext, useCallback, useState } from 'react';
2
+ import { classNames, prefixCls } from '@aura-react-comp/shared';
3
+ import { CheckOutline } from '@aura-react-comp/icons';
4
+ import "./index.less";
5
+
6
+ /* ===== Context ===== */
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ const StepsContext = /*#__PURE__*/createContext(null);
10
+ function useStepsContext() {
11
+ const ctx = useContext(StepsContext);
12
+ if (!ctx) throw new Error('Steps.Step 必须在 Steps 内部使用');
13
+ return ctx;
14
+ }
15
+
16
+ /* ===== Steps.Step ===== */
17
+
18
+ const Step = /*#__PURE__*/forwardRef(({
19
+ title,
20
+ subTitle,
21
+ status,
22
+ description,
23
+ icon,
24
+ disabled = false,
25
+ className,
26
+ style
27
+ }, ref) => {
28
+ const {
29
+ current,
30
+ variant,
31
+ onChange
32
+ } = useStepsContext();
33
+ const index = useContext(StepIndexContext);
34
+ const isCompleted = index < current;
35
+ const isCurrent = index === current;
36
+ const isError = status === 'error';
37
+ const handleClick = () => {
38
+ if (disabled) return;
39
+ onChange(index);
40
+ };
41
+ const handleKeyDown = e => {
42
+ if (e.key === 'Enter' || e.key === ' ') {
43
+ e.preventDefault();
44
+ handleClick();
45
+ }
46
+ };
47
+ const stepCls = classNames(prefixCls('steps-step'), isCompleted && prefixCls('steps-step-completed'), isCurrent && prefixCls('steps-step-active'), isError && prefixCls('steps-step-error'), disabled && prefixCls('steps-step-disabled'), className);
48
+
49
+ /* --- 渲染图标区域 --- */
50
+ const renderIcon = () => {
51
+ if (icon) return icon;
52
+ if (variant === 'dot') {
53
+ return /*#__PURE__*/_jsx("span", {
54
+ className: prefixCls('steps-dot-icon')
55
+ });
56
+ }
57
+
58
+ // default / navigation variant
59
+ if (isCompleted) {
60
+ return /*#__PURE__*/_jsx("span", {
61
+ className: prefixCls('steps-check'),
62
+ children: /*#__PURE__*/_jsx(CheckOutline, {
63
+ size: 14
64
+ })
65
+ });
66
+ }
67
+ return /*#__PURE__*/_jsx("span", {
68
+ className: prefixCls('steps-number'),
69
+ children: index + 1
70
+ });
71
+ };
72
+ return /*#__PURE__*/_jsx("div", {
73
+ ref: ref,
74
+ className: stepCls,
75
+ style: style,
76
+ role: "listitem",
77
+ "aria-current": isCurrent ? 'step' : undefined,
78
+ children: /*#__PURE__*/_jsxs("div", {
79
+ className: prefixCls('steps-step-header'),
80
+ onClick: handleClick,
81
+ onKeyDown: handleKeyDown,
82
+ tabIndex: disabled ? -1 : 0,
83
+ "aria-disabled": disabled,
84
+ children: [/*#__PURE__*/_jsx("div", {
85
+ className: classNames(prefixCls('steps-icon'), isCompleted && prefixCls('steps-icon-completed'), isCurrent && prefixCls('steps-icon-active')),
86
+ children: renderIcon()
87
+ }), /*#__PURE__*/_jsxs("div", {
88
+ className: prefixCls('steps-step-content'),
89
+ children: [/*#__PURE__*/_jsxs("div", {
90
+ className: prefixCls('steps-step-title'),
91
+ children: [title, subTitle && /*#__PURE__*/_jsx("span", {
92
+ className: prefixCls('steps-step-subtitle'),
93
+ children: subTitle
94
+ })]
95
+ }), description && /*#__PURE__*/_jsx("div", {
96
+ className: prefixCls('steps-step-description'),
97
+ children: description
98
+ })]
99
+ })]
100
+ })
101
+ });
102
+ });
103
+ Step.displayName = 'Steps.Step';
104
+
105
+ /* ===== StepIndexContext — 用于 Step 获取自己的 index ===== */
106
+ const StepIndexContext = /*#__PURE__*/React.createContext(0);
107
+
108
+ /* ===== Steps(主组件) ===== */
109
+
110
+ const StepsBase = /*#__PURE__*/forwardRef(({
111
+ current: controlledCurrent,
112
+ defaultCurrent = 0,
113
+ variant = 'default',
114
+ size = 'md',
115
+ direction = 'horizontal',
116
+ onChange,
117
+ className,
118
+ style,
119
+ children
120
+ }, ref) => {
121
+ const [internalCurrent, setInternalCurrent] = useState(defaultCurrent);
122
+ const isControlled = controlledCurrent !== undefined;
123
+ const current = isControlled ? controlledCurrent : internalCurrent;
124
+ const handleChange = useCallback(next => {
125
+ if (!isControlled) setInternalCurrent(next);
126
+ onChange?.(next);
127
+ }, [isControlled, onChange]);
128
+ const childArray = React.Children.toArray(children);
129
+ const totalSteps = childArray.length;
130
+ const ctxValue = {
131
+ current,
132
+ variant,
133
+ size,
134
+ direction,
135
+ onChange: handleChange,
136
+ totalSteps
137
+ };
138
+ const wrapperCls = classNames(prefixCls('steps'), prefixCls(`steps-${variant}`), prefixCls(`steps-${size}`), prefixCls(`steps-${direction}`), className);
139
+ return /*#__PURE__*/_jsx(StepsContext.Provider, {
140
+ value: ctxValue,
141
+ children: /*#__PURE__*/_jsx("div", {
142
+ ref: ref,
143
+ className: wrapperCls,
144
+ style: style,
145
+ role: "list",
146
+ "aria-label": "\u6B65\u9AA4\u6761",
147
+ children: childArray.map((child, index) => /*#__PURE__*/_jsx(StepIndexContext.Provider, {
148
+ value: index,
149
+ children: /*#__PURE__*/_jsxs("div", {
150
+ className: prefixCls('steps-step-container'),
151
+ children: [child, index < totalSteps - 1 && /*#__PURE__*/_jsx("div", {
152
+ className: classNames(prefixCls('steps-tail'), index < current ? prefixCls('steps-tail-completed') : prefixCls('steps-tail-pending'))
153
+ })]
154
+ })
155
+ }, index))
156
+ })
157
+ });
158
+ });
159
+ StepsBase.displayName = 'Steps';
160
+
161
+ /* ===== 复合组件导出 ===== */
162
+
163
+ const Steps = StepsBase;
164
+ Steps.Step = Step;
165
+ export { Steps };