@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.
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 +162 -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 +108 -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 +141 -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 +245 -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 +257 -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 +113 -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 +180 -0
  62. package/esm/pagination/index.less +238 -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 +119 -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 +103 -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 +427 -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 +170 -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 +135 -0
  96. package/esm/tabs/index.d.ts +45 -0
  97. package/esm/tabs/index.js +170 -0
  98. package/esm/tabs/index.less +226 -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 +224 -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 +106 -0
  118. package/esm/upload/index.d.ts +68 -0
  119. package/esm/upload/index.js +447 -0
  120. package/esm/upload/index.less +371 -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,29 @@
1
+ import React from 'react';
2
+ export interface BadgeProps {
3
+ /** 状态点模式(不计数):success / processing(带光环)/ error / warning / default,
4
+ * 配合 `text` 展示状态说明;设置后 count / dot 等属性不生效 */
5
+ status?: 'success' | 'processing' | 'error' | 'warning' | 'default';
6
+ /** 状态点模式的说明文本 */
7
+ text?: React.ReactNode;
8
+ /** 徽标数字,0 时默认隐藏 */
9
+ count?: number;
10
+ /** 是否只显示小圆点 */
11
+ dot?: boolean;
12
+ /** 徽标变体颜色
13
+ * @default 'error'
14
+ */
15
+ variant?: 'default' | 'success' | 'warning' | 'error' | 'info';
16
+ /** 溢出计数阈值
17
+ * @default 99
18
+ */
19
+ overflowCount?: number;
20
+ /** 是否在 count 为 0 时显示 */
21
+ showZero?: boolean;
22
+ /** 自定义类名 */
23
+ className?: string;
24
+ /** 自定义样式 */
25
+ style?: React.CSSProperties;
26
+ /** 包裹的子元素,有则徽标定位在右上角 */
27
+ children?: React.ReactNode;
28
+ }
29
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,84 @@
1
+ import React, { forwardRef, useEffect, useState, useRef } 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
+ export const Badge = /*#__PURE__*/forwardRef(({
7
+ status,
8
+ text,
9
+ count = 0,
10
+ dot = false,
11
+ variant = 'error',
12
+ overflowCount = 99,
13
+ showZero = false,
14
+ className,
15
+ style,
16
+ children
17
+ }, ref) => {
18
+ // 用于数字变化时的缩放动画(status 模式不使用,但 hooks 不能条件调用)
19
+ const [animating, setAnimating] = useState(false);
20
+ const prevCountRef = useRef(count);
21
+ useEffect(() => {
22
+ if (prevCountRef.current !== count) {
23
+ setAnimating(true);
24
+ prevCountRef.current = count;
25
+ const timer = setTimeout(() => setAnimating(false), 400);
26
+ return () => clearTimeout(timer);
27
+ }
28
+ }, [count]);
29
+
30
+ // 状态点模式:不计数,仅状态圆点 + 文本
31
+ if (status) {
32
+ return /*#__PURE__*/_jsxs("span", {
33
+ ref: ref,
34
+ className: classNames(prefixCls('badge-status'), className),
35
+ style: style,
36
+ children: [/*#__PURE__*/_jsx("span", {
37
+ className: classNames(prefixCls('badge-status-dot'), prefixCls(`badge-status-${status}`))
38
+ }), text != null && /*#__PURE__*/_jsx("span", {
39
+ className: prefixCls('badge-status-text'),
40
+ children: text
41
+ })]
42
+ });
43
+ }
44
+ const displayCount = count > overflowCount ? `${overflowCount}+` : String(count);
45
+ const showBadge = count !== 0 || showZero;
46
+ const badgeCls = classNames(prefixCls('badge-dot'), variant !== 'default' && prefixCls(`badge-dot-${variant}`), dot && prefixCls('badge-dot-small'), animating && prefixCls('badge-dot-animate'));
47
+
48
+ // 无子元素:独立显示
49
+ if (children === undefined) {
50
+ const wrapperCls = classNames(prefixCls('badge-standalone'), className);
51
+ return /*#__PURE__*/_jsxs("span", {
52
+ ref: ref,
53
+ className: wrapperCls,
54
+ style: style,
55
+ children: [dot && showBadge && /*#__PURE__*/_jsx("span", {
56
+ className: badgeCls
57
+ }), !dot && showBadge && /*#__PURE__*/_jsx("span", {
58
+ className: badgeCls,
59
+ children: /*#__PURE__*/_jsx("span", {
60
+ className: prefixCls('badge-text'),
61
+ children: displayCount
62
+ })
63
+ })]
64
+ });
65
+ }
66
+
67
+ // 有子元素:徽标定位在右上角
68
+ const wrapperCls = classNames(prefixCls('badge'), className);
69
+ return /*#__PURE__*/_jsxs("span", {
70
+ ref: ref,
71
+ className: wrapperCls,
72
+ style: style,
73
+ children: [children, dot && showBadge && /*#__PURE__*/_jsx("sup", {
74
+ className: badgeCls
75
+ }), !dot && showBadge && /*#__PURE__*/_jsx("sup", {
76
+ className: badgeCls,
77
+ children: /*#__PURE__*/_jsx("span", {
78
+ className: prefixCls('badge-text'),
79
+ children: displayCount
80
+ })
81
+ })]
82
+ });
83
+ });
84
+ Badge.displayName = 'Badge';
@@ -0,0 +1,215 @@
1
+ .aura-badge {
2
+ position: relative;
3
+ display: inline-flex;
4
+ vertical-align: middle;
5
+ line-height: 1;
6
+
7
+ sup&-dot {
8
+ position: absolute;
9
+ top: 0;
10
+ right: 0;
11
+ transform: translate(50%, -50%);
12
+ z-index: 1;
13
+ box-sizing: border-box;
14
+ min-width: 20px;
15
+ height: 20px;
16
+ padding: 0 6px;
17
+ display: inline-flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ font-size: var(--aura-font-size-xs);
21
+ font-family: inherit;
22
+ font-weight: 600;
23
+ line-height: 1;
24
+ color: var(--aura-text-inverse);
25
+ background: var(--aura-error);
26
+ border-radius: var(--aura-radius-full);
27
+ white-space: nowrap;
28
+ animation: aura-badge-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
29
+ box-shadow: 0 0 0 2px var(--aura-bg);
30
+ transition:
31
+ transform var(--aura-duration-normal) cubic-bezier(0.34, 1.56, 0.64, 1),
32
+ background var(--aura-duration-normal) var(--aura-easing);
33
+
34
+ // 文字
35
+ .aura-badge-text {
36
+ display: inline-block;
37
+ }
38
+ }
39
+
40
+ // 小圆点模式
41
+ sup&-dot-small {
42
+ min-width: unset;
43
+ width: 6px;
44
+ height: 6px;
45
+ padding: 0;
46
+ border-radius: 50%;
47
+ }
48
+
49
+ // 数字变化动画
50
+ sup&-dot-animate {
51
+ animation: aura-badge-scale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
52
+ }
53
+
54
+ // ===== 变体颜色 =====
55
+ sup&-dot-default {
56
+ background: var(--aura-gray-400);
57
+ }
58
+
59
+ sup&-dot-success {
60
+ background: var(--aura-success);
61
+ }
62
+
63
+ sup&-dot-warning {
64
+ background: var(--aura-warning);
65
+ }
66
+
67
+ sup&-dot-error {
68
+ background: var(--aura-error);
69
+ }
70
+
71
+ sup&-dot-info {
72
+ background: var(--aura-info);
73
+ }
74
+ }
75
+
76
+ /* ===== 独立模式(无子元素) ===== */
77
+ .aura-badge-standalone {
78
+ display: inline-flex;
79
+ align-items: center;
80
+ vertical-align: middle;
81
+
82
+ .aura-badge-dot {
83
+ position: relative;
84
+ top: auto;
85
+ right: auto;
86
+ transform: none;
87
+ animation: aura-badge-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
88
+ transition:
89
+ transform var(--aura-duration-normal) cubic-bezier(0.34, 1.56, 0.64, 1),
90
+ background var(--aura-duration-normal) var(--aura-easing);
91
+ }
92
+
93
+ .aura-badge-dot-small {
94
+ min-width: unset;
95
+ width: 6px;
96
+ height: 6px;
97
+ padding: 0;
98
+ border-radius: 50%;
99
+ }
100
+
101
+ .aura-badge-dot-animate {
102
+ animation: aura-badge-scale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
103
+ }
104
+
105
+ .aura-badge-dot-default {
106
+ background: var(--aura-gray-400);
107
+ }
108
+ .aura-badge-dot-success {
109
+ background: var(--aura-success);
110
+ }
111
+ .aura-badge-dot-warning {
112
+ background: var(--aura-warning);
113
+ }
114
+ .aura-badge-dot-error {
115
+ background: var(--aura-error);
116
+ }
117
+ .aura-badge-dot-info {
118
+ background: var(--aura-info);
119
+ }
120
+ }
121
+
122
+ // 入场动画
123
+ @keyframes aura-badge-enter {
124
+ from {
125
+ opacity: 0;
126
+ transform: translate(50%, -50%) scale(0);
127
+ }
128
+ to {
129
+ opacity: 1;
130
+ transform: translate(50%, -50%) scale(1);
131
+ }
132
+ }
133
+
134
+ // 数字变化缩放动画
135
+ @keyframes aura-badge-scale {
136
+ 0% {
137
+ transform: translate(50%, -50%) scale(0.6);
138
+ }
139
+ 50% {
140
+ transform: translate(50%, -50%) scale(1.15);
141
+ }
142
+ 100% {
143
+ transform: translate(50%, -50%) scale(1);
144
+ }
145
+ }
146
+
147
+ // 暗色模式
148
+ [data-theme='dark'] {
149
+ .aura-badge-dot,
150
+ .aura-badge-standalone .aura-badge-dot {
151
+ box-shadow: 0 0 0 2px var(--aura-bg);
152
+ }
153
+ }
154
+
155
+ /* ===== 状态点模式 ===== */
156
+ .aura-badge-status {
157
+ display: inline-flex;
158
+ align-items: center;
159
+ gap: var(--aura-spacing-2);
160
+
161
+ &-dot {
162
+ position: relative;
163
+ width: 6px;
164
+ height: 6px;
165
+ border-radius: 50%;
166
+ background: var(--aura-gray-400);
167
+ flex-shrink: 0;
168
+ }
169
+
170
+ &-success {
171
+ background: var(--aura-success);
172
+ }
173
+
174
+ // 处理中:光环扩散动画(只动 opacity / transform)
175
+ &-processing {
176
+ background: var(--aura-primary-600);
177
+
178
+ &::after {
179
+ content: '';
180
+ position: absolute;
181
+ inset: 0;
182
+ border-radius: 50%;
183
+ background: var(--aura-primary-600);
184
+ animation: aura-badge-status-pulse 1.6s var(--aura-easing) infinite;
185
+ }
186
+ }
187
+
188
+ &-error {
189
+ background: var(--aura-error);
190
+ }
191
+
192
+ &-warning {
193
+ background: var(--aura-warning);
194
+ }
195
+
196
+ &-text {
197
+ color: var(--aura-text);
198
+ font-size: var(--aura-font-size-sm);
199
+ }
200
+ }
201
+
202
+ @keyframes aura-badge-status-pulse {
203
+ 0% {
204
+ opacity: 0.6;
205
+ transform: scale(1);
206
+ }
207
+ 70% {
208
+ opacity: 0;
209
+ transform: scale(2.4);
210
+ }
211
+ 100% {
212
+ opacity: 0;
213
+ transform: scale(2.4);
214
+ }
215
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ export interface BreadcrumbItemProps {
3
+ /** 链接地址 */
4
+ href?: string;
5
+ /** 点击回调 */
6
+ onClick?: () => void;
7
+ /** 自定义类名 */
8
+ className?: string;
9
+ /** 自定义样式 */
10
+ style?: React.CSSProperties;
11
+ /** 子元素 */
12
+ children?: React.ReactNode;
13
+ }
14
+ declare const BreadcrumbItem: React.ForwardRefExoticComponent<BreadcrumbItemProps & React.RefAttributes<HTMLSpanElement>>;
15
+ export interface BreadcrumbProps {
16
+ /** 分隔符
17
+ * @default '/'
18
+ */
19
+ separator?: React.ReactNode;
20
+ /** 自定义类名 */
21
+ className?: string;
22
+ /** 自定义样式 */
23
+ style?: React.CSSProperties;
24
+ /** 子元素 */
25
+ children?: React.ReactNode;
26
+ }
27
+ interface BreadcrumbComponent extends React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>> {
28
+ Item: typeof BreadcrumbItem;
29
+ }
30
+ declare const Breadcrumb: BreadcrumbComponent;
31
+ export { Breadcrumb };
@@ -0,0 +1,91 @@
1
+ import React, { forwardRef, createContext } from 'react';
2
+ import { classNames, prefixCls } from '@aura-react-comp/shared';
3
+ import "./index.less";
4
+
5
+ /* ===== Context ===== */
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const BreadcrumbContext = /*#__PURE__*/createContext(null);
9
+
10
+ /* ===== Breadcrumb.Item ===== */
11
+
12
+ const BreadcrumbItem = /*#__PURE__*/forwardRef(({
13
+ href,
14
+ onClick,
15
+ className,
16
+ style,
17
+ children
18
+ }, ref) => {
19
+ const itemCls = classNames(prefixCls('breadcrumb-item'), className);
20
+ return /*#__PURE__*/_jsx("li", {
21
+ ref: ref,
22
+ className: prefixCls('breadcrumb-item-wrapper'),
23
+ children: href ? /*#__PURE__*/_jsx("a", {
24
+ href: href,
25
+ className: itemCls,
26
+ style: style,
27
+ onClick: onClick,
28
+ role: "link",
29
+ children: children
30
+ }) : /*#__PURE__*/_jsx("span", {
31
+ className: itemCls,
32
+ style: style,
33
+ onClick: onClick,
34
+ role: onClick ? 'button' : undefined,
35
+ tabIndex: onClick ? 0 : undefined,
36
+ children: children
37
+ })
38
+ });
39
+ });
40
+ BreadcrumbItem.displayName = 'Breadcrumb.Item';
41
+
42
+ /* ===== Breadcrumb(主组件) ===== */
43
+
44
+ const BreadcrumbBase = /*#__PURE__*/forwardRef(({
45
+ separator = '/',
46
+ className,
47
+ style,
48
+ children
49
+ }, ref) => {
50
+ const childArray = React.Children.toArray(children);
51
+ const total = childArray.length;
52
+ const ctxValue = {
53
+ isLast: index => index === total - 1,
54
+ total,
55
+ separator
56
+ };
57
+ const wrapperCls = classNames(prefixCls('breadcrumb'), className);
58
+ return /*#__PURE__*/_jsx(BreadcrumbContext.Provider, {
59
+ value: ctxValue,
60
+ children: /*#__PURE__*/_jsx("nav", {
61
+ ref: ref,
62
+ className: wrapperCls,
63
+ style: style,
64
+ "aria-label": "\u9762\u5305\u5C51\u5BFC\u822A",
65
+ role: "navigation",
66
+ children: /*#__PURE__*/_jsx("ol", {
67
+ className: prefixCls('breadcrumb-list'),
68
+ children: childArray.map((child, index) => {
69
+ const isLast = index === total - 1;
70
+ return /*#__PURE__*/_jsxs(React.Fragment, {
71
+ children: [/*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
72
+ ...child.props,
73
+ className: classNames(child.props.className, isLast && prefixCls('breadcrumb-item-last'))
74
+ }) : child, !isLast && /*#__PURE__*/_jsx("li", {
75
+ className: prefixCls('breadcrumb-separator'),
76
+ "aria-hidden": "true",
77
+ children: separator
78
+ })]
79
+ }, index);
80
+ })
81
+ })
82
+ })
83
+ });
84
+ });
85
+ BreadcrumbBase.displayName = 'Breadcrumb';
86
+
87
+ /* ===== 复合组件导出 ===== */
88
+
89
+ const Breadcrumb = BreadcrumbBase;
90
+ Breadcrumb.Item = BreadcrumbItem;
91
+ export { Breadcrumb };
@@ -0,0 +1,108 @@
1
+ /* ===== Breadcrumb 组件样式 ===== */
2
+
3
+ .aura-breadcrumb {
4
+ font-size: var(--aura-font-size-md);
5
+ color: var(--aura-text-secondary);
6
+
7
+ &-list {
8
+ display: flex;
9
+ align-items: center;
10
+ flex-wrap: wrap;
11
+ list-style: none;
12
+ margin: 0;
13
+ padding: 0;
14
+ gap: 0;
15
+ }
16
+ }
17
+
18
+ .aura-breadcrumb-item-wrapper {
19
+ display: inline-flex;
20
+ align-items: center;
21
+ }
22
+
23
+ .aura-breadcrumb-item {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ color: var(--aura-text-secondary);
27
+ text-decoration: none;
28
+ padding: var(--aura-spacing-1) 0;
29
+ font-size: var(--aura-font-size-md);
30
+ cursor: default;
31
+ transition:
32
+ color var(--aura-duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
33
+
34
+ &:hover {
35
+ color: var(--aura-primary-700);
36
+ }
37
+
38
+ /* 链接样式 */
39
+ a& {
40
+ color: var(--aura-text-secondary);
41
+ text-decoration: none;
42
+ cursor: pointer;
43
+
44
+ &:hover {
45
+ color: var(--aura-primary-700);
46
+ }
47
+
48
+ &:active {
49
+ color: var(--aura-primary-800);
50
+ }
51
+ }
52
+
53
+ /* 可点击的 span */
54
+ span&[role="button"] {
55
+ cursor: pointer;
56
+
57
+ &:hover {
58
+ color: var(--aura-primary-700);
59
+ }
60
+ }
61
+
62
+ /* 最后一项加粗 */
63
+ &-last {
64
+ font-weight: 600;
65
+ color: var(--aura-text);
66
+ cursor: default;
67
+
68
+ &:hover {
69
+ color: var(--aura-text);
70
+ }
71
+ }
72
+ }
73
+
74
+ .aura-breadcrumb-separator {
75
+ display: inline-flex;
76
+ align-items: center;
77
+ margin: 0 var(--aura-spacing-2);
78
+ color: var(--aura-text-tertiary);
79
+ user-select: none;
80
+ font-size: var(--aura-font-size-md);
81
+ }
82
+
83
+ /* ===== 暗色模式 ===== */
84
+ [data-theme="dark"] {
85
+ .aura-breadcrumb-item {
86
+ color: var(--aura-text-secondary);
87
+
88
+ &:hover {
89
+ color: var(--aura-primary-400);
90
+ }
91
+
92
+ a&:hover {
93
+ color: var(--aura-primary-400);
94
+ }
95
+
96
+ &-last {
97
+ color: var(--aura-text);
98
+
99
+ &:hover {
100
+ color: var(--aura-text);
101
+ }
102
+ }
103
+ }
104
+
105
+ .aura-breadcrumb-separator {
106
+ color: var(--aura-text-tertiary);
107
+ }
108
+ }
@@ -0,0 +1,28 @@
1
+ import React, { ButtonHTMLAttributes, AnchorHTMLAttributes } from 'react';
2
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ /** 按钮变体样式
4
+ * @default 'default'
5
+ */
6
+ variant?: 'default' | 'primary' | 'dashed' | 'text' | 'link';
7
+ /** 按钮尺寸
8
+ * @default 'md'
9
+ */
10
+ size?: 'sm' | 'md' | 'lg';
11
+ /** 是否禁用 */
12
+ disabled?: boolean;
13
+ /** 是否加载中,显示旋转图标 */
14
+ loading?: boolean;
15
+ /** 按钮图标,置于内容左侧;loading 时自动替换为旋转图标 */
16
+ icon?: React.ReactNode;
17
+ /** 是否撑满容器宽度
18
+ * @default false
19
+ */
20
+ block?: boolean;
21
+ /** 传入后渲染为 `<a>` 链接按钮(配合 target 使用) */
22
+ href?: string;
23
+ /** 链接按钮的打开方式,仅在设置 href 时生效 */
24
+ target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
25
+ }
26
+ type ButtonElement = HTMLButtonElement | HTMLAnchorElement;
27
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<ButtonElement>>;
28
+ export {};
@@ -0,0 +1,59 @@
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
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export const Button = /*#__PURE__*/forwardRef(({
7
+ variant = 'default',
8
+ size = 'md',
9
+ disabled = false,
10
+ loading = false,
11
+ icon,
12
+ block = false,
13
+ href,
14
+ target,
15
+ className,
16
+ children,
17
+ onClick,
18
+ type,
19
+ ...rest
20
+ }, ref) => {
21
+ const blocked = disabled || loading;
22
+ const cls = classNames(prefixCls('btn'), variant !== 'default' && prefixCls(`btn-${variant}`), prefixCls(`btn-${size}`), loading && prefixCls('btn-loading'), blocked && href !== undefined && prefixCls('btn-disabled'), block && prefixCls('btn-block'), className);
23
+ const handleClick = e => {
24
+ if (blocked) {
25
+ e.preventDefault();
26
+ return;
27
+ }
28
+ onClick?.(e);
29
+ };
30
+
31
+ // 图标区:loading 时旋转图标替换自定义图标(同 antd 行为)
32
+ const iconNode = loading ? /*#__PURE__*/_jsx("span", {
33
+ className: prefixCls('btn-loading-icon')
34
+ }) : icon;
35
+
36
+ // 链接按钮:渲染 <a>,禁用时不输出 href 且阻止点击
37
+ if (href !== undefined) {
38
+ return /*#__PURE__*/_jsxs("a", {
39
+ ref: ref,
40
+ className: cls,
41
+ href: blocked ? undefined : href,
42
+ target: target,
43
+ onClick: handleClick,
44
+ "aria-disabled": blocked || undefined,
45
+ ...rest,
46
+ children: [iconNode, children]
47
+ });
48
+ }
49
+ return /*#__PURE__*/_jsxs("button", {
50
+ ref: ref,
51
+ className: cls,
52
+ type: type ?? 'button',
53
+ disabled: blocked,
54
+ onClick: handleClick,
55
+ ...rest,
56
+ children: [iconNode, children]
57
+ });
58
+ });
59
+ Button.displayName = 'Button';