@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,227 @@
1
+ .aura-tag {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ gap: var(--aura-spacing-1);
6
+ padding: 2px 8px;
7
+ font-size: var(--aura-font-size-sm);
8
+ font-family: inherit;
9
+ line-height: 1.5;
10
+ border: 1px solid var(--aura-border);
11
+ border-radius: var(--aura-radius-sm);
12
+ background: var(--aura-bg-secondary);
13
+ color: var(--aura-text);
14
+ white-space: nowrap;
15
+ user-select: none;
16
+ transition:
17
+ all var(--aura-duration-normal) cubic-bezier(0.4, 0, 0.2, 1),
18
+ opacity var(--aura-duration-slow) cubic-bezier(0.4, 0, 0.2, 1),
19
+ transform var(--aura-duration-slow) cubic-bezier(0.4, 0, 0.2, 1);
20
+ animation: aura-tag-enter 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
21
+
22
+ // 内容区
23
+ &-content {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ }
27
+
28
+ // 关闭按钮
29
+ &-close {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ margin-left: 2px;
34
+ cursor: pointer;
35
+ color: var(--aura-text-tertiary);
36
+ border-radius: var(--aura-radius-full);
37
+ transition:
38
+ color var(--aura-duration-fast) var(--aura-easing),
39
+ background var(--aura-duration-fast) var(--aura-easing),
40
+ transform var(--aura-duration-fast) cubic-bezier(0.34, 1.56, 0.64, 1);
41
+
42
+ &:hover {
43
+ color: var(--aura-text);
44
+ background: rgba(0, 0, 0, 0.08);
45
+ transform: scale(1.15);
46
+ }
47
+
48
+ &:active {
49
+ transform: scale(0.9);
50
+ }
51
+ }
52
+
53
+ // 关闭动画
54
+ &&-closing {
55
+ opacity: 0;
56
+ transform: scale(0.7);
57
+ max-width: 0;
58
+ padding-left: 0;
59
+ padding-right: 0;
60
+ margin: 0;
61
+ overflow: hidden;
62
+ border-width: 0;
63
+ transition:
64
+ all var(--aura-duration-normal) cubic-bezier(0.4, 0, 0.2, 1),
65
+ opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
66
+ transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
67
+ }
68
+
69
+ // ===== Variants =====
70
+ &&-primary {
71
+ background: var(--aura-primary-100);
72
+ border-color: var(--aura-primary-200);
73
+ color: var(--aura-primary-700);
74
+
75
+ &:hover {
76
+ background: var(--aura-primary-200);
77
+ border-color: var(--aura-primary-300);
78
+ }
79
+ }
80
+
81
+ &&-success {
82
+ background: var(--aura-success-light);
83
+ border-color: var(--aura-success);
84
+ color: var(--aura-success);
85
+
86
+ &:hover {
87
+ background: var(--aura-success);
88
+ border-color: var(--aura-success);
89
+ color: var(--aura-text-inverse);
90
+ }
91
+ }
92
+
93
+ &&-warning {
94
+ background: var(--aura-warning-light);
95
+ border-color: var(--aura-warning);
96
+ color: var(--aura-warning);
97
+
98
+ &:hover {
99
+ background: var(--aura-warning);
100
+ border-color: var(--aura-warning);
101
+ color: var(--aura-text-inverse);
102
+ }
103
+ }
104
+
105
+ &&-error {
106
+ background: var(--aura-error-light);
107
+ border-color: var(--aura-error);
108
+ color: var(--aura-error);
109
+
110
+ &:hover {
111
+ background: var(--aura-error);
112
+ border-color: var(--aura-error);
113
+ color: var(--aura-text-inverse);
114
+ }
115
+ }
116
+
117
+ &&-info {
118
+ background: var(--aura-info-light);
119
+ border-color: var(--aura-info);
120
+ color: var(--aura-info);
121
+
122
+ &:hover {
123
+ background: var(--aura-info);
124
+ border-color: var(--aura-info);
125
+ color: var(--aura-text-inverse);
126
+ }
127
+ }
128
+
129
+ // ===== Sizes =====
130
+ &&-sm {
131
+ padding: 1px 6px;
132
+ font-size: var(--aura-font-size-xs);
133
+ border-radius: 4px;
134
+ }
135
+
136
+ &&-lg {
137
+ padding: 4px 12px;
138
+ font-size: var(--aura-font-size-md);
139
+ border-radius: var(--aura-radius-md);
140
+ }
141
+
142
+ // ===== Checkable =====
143
+ &&-checkable {
144
+ cursor: pointer;
145
+ background: var(--aura-bg-tertiary);
146
+ border-color: transparent;
147
+ color: var(--aura-text-secondary);
148
+ transition:
149
+ all var(--aura-duration-normal) cubic-bezier(0.4, 0, 0.2, 1),
150
+ transform var(--aura-duration-fast) cubic-bezier(0.34, 1.56, 0.64, 1);
151
+
152
+ &:hover {
153
+ color: var(--aura-primary-700);
154
+ background: var(--aura-primary-50);
155
+ transform: translateY(-1px);
156
+ }
157
+
158
+ &:active {
159
+ transform: translateY(0) scale(0.97);
160
+ }
161
+ }
162
+
163
+ &&-checkable-checked {
164
+ background: var(--aura-primary-700);
165
+ border-color: var(--aura-primary-700);
166
+ color: var(--aura-text-inverse);
167
+
168
+ &:hover {
169
+ background: var(--aura-primary-600);
170
+ border-color: var(--aura-primary-600);
171
+ color: var(--aura-text-inverse);
172
+ }
173
+ }
174
+ }
175
+
176
+ /* ===== Tag.Group ===== */
177
+ .aura-tag-group {
178
+ display: inline-flex;
179
+ flex-wrap: wrap;
180
+ gap: var(--aura-spacing-2);
181
+ align-items: center;
182
+ }
183
+
184
+ // 入场动画
185
+ @keyframes aura-tag-enter {
186
+ from {
187
+ opacity: 0;
188
+ transform: scale(0.6);
189
+ }
190
+ to {
191
+ opacity: 1;
192
+ transform: scale(1);
193
+ }
194
+ }
195
+
196
+ // 暗色模式
197
+ [data-theme='dark'] {
198
+ .aura-tag {
199
+ &-close:hover {
200
+ background: rgba(255, 255, 255, 0.1);
201
+ }
202
+
203
+ &&-primary {
204
+ background: rgba(124, 58, 237, 0.15);
205
+ border-color: rgba(124, 58, 237, 0.3);
206
+ color: var(--aura-primary-400);
207
+
208
+ &:hover {
209
+ background: rgba(124, 58, 237, 0.25);
210
+ border-color: rgba(124, 58, 237, 0.5);
211
+ }
212
+ }
213
+
214
+ &&-checkable {
215
+ background: rgba(139, 92, 246, 0.08);
216
+
217
+ &:hover {
218
+ background: rgba(124, 58, 237, 0.15);
219
+ }
220
+ }
221
+
222
+ &&-checkable-checked {
223
+ background: var(--aura-primary-600);
224
+ border-color: var(--aura-primary-600);
225
+ }
226
+ }
227
+ }
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
+ /** 输入框变体样式
4
+ * @default 'default'
5
+ */
6
+ variant?: 'default' | 'filled' | 'bordered';
7
+ /** 输入框尺寸
8
+ * @default 'md'
9
+ */
10
+ size?: 'sm' | 'md' | 'lg';
11
+ /** 是否自适应高度
12
+ * true 时自动调整,也可指定 { minRows, maxRows }
13
+ */
14
+ autoSize?: boolean | {
15
+ minRows: number;
16
+ maxRows: number;
17
+ };
18
+ /** 是否显示字符计数 */
19
+ showCount?: boolean;
20
+ /** 最大字符长度 */
21
+ maxLength?: number;
22
+ /** 校验状态
23
+ * @default 'default'
24
+ */
25
+ status?: 'default' | 'error' | 'warning';
26
+ }
27
+ export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,84 @@
1
+ import React, { forwardRef, useState, useCallback, useRef, useImperativeHandle, useEffect } 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
+ * 根据行数计算 textarea 高度(像素)
8
+ */
9
+ function calculateHeight(textarea, rows) {
10
+ const computedStyle = window.getComputedStyle(textarea);
11
+ const lineHeight = parseFloat(computedStyle.lineHeight) || 20;
12
+ const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
13
+ const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
14
+ return lineHeight * rows + paddingTop + paddingBottom;
15
+ }
16
+ export const Textarea = /*#__PURE__*/forwardRef(({
17
+ variant = 'default',
18
+ size = 'md',
19
+ autoSize,
20
+ showCount = false,
21
+ maxLength,
22
+ status = 'default',
23
+ disabled = false,
24
+ className,
25
+ value,
26
+ defaultValue,
27
+ onChange,
28
+ rows = 4,
29
+ ...rest
30
+ }, ref) => {
31
+ const textareaRef = useRef(null);
32
+ const [internalValue, setInternalValue] = useState(defaultValue ?? '');
33
+ const isControlled = value !== undefined;
34
+ const currentValue = isControlled ? String(value) : internalValue;
35
+
36
+ // 合并 ref
37
+ useImperativeHandle(ref, () => textareaRef.current);
38
+
39
+ // 自适应高度逻辑
40
+ const resizeTextarea = useCallback(() => {
41
+ const textarea = textareaRef.current;
42
+ if (!textarea || !autoSize) return;
43
+
44
+ // 先重置高度以获取准确的 scrollHeight
45
+ textarea.style.height = 'auto';
46
+ const minRows = typeof autoSize === 'object' ? autoSize.minRows : 1;
47
+ const maxRows = typeof autoSize === 'object' ? autoSize.maxRows : Infinity;
48
+ const minHeight = calculateHeight(textarea, minRows);
49
+ const maxHeight = calculateHeight(textarea, maxRows);
50
+ const scrollHeight = textarea.scrollHeight;
51
+ const newHeight = Math.max(minHeight, Math.min(scrollHeight, maxHeight));
52
+ textarea.style.height = `${newHeight}px`;
53
+ // 隐藏溢出滚动条(当内容在范围内时)
54
+ textarea.style.overflowY = scrollHeight > maxHeight ? 'auto' : 'hidden';
55
+ }, [autoSize]);
56
+ useEffect(() => {
57
+ resizeTextarea();
58
+ }, [currentValue, resizeTextarea]);
59
+ const handleChange = useCallback(e => {
60
+ if (!isControlled) {
61
+ setInternalValue(e.target.value);
62
+ }
63
+ onChange?.(e);
64
+ }, [isControlled, onChange]);
65
+ const cls = classNames(prefixCls('textarea'), variant !== 'default' && prefixCls(`textarea-${variant}`), prefixCls(`textarea-${size}`), status !== 'default' && prefixCls(`textarea-${status}`), disabled && prefixCls('textarea-disabled'), showCount && prefixCls('textarea-show-count'), className);
66
+ const currentLength = String(currentValue).length;
67
+ return /*#__PURE__*/_jsxs("div", {
68
+ className: cls,
69
+ children: [/*#__PURE__*/_jsx("textarea", {
70
+ ref: textareaRef,
71
+ className: prefixCls('textarea-element'),
72
+ value: isControlled ? value : internalValue,
73
+ onChange: handleChange,
74
+ disabled: disabled,
75
+ rows: rows,
76
+ maxLength: maxLength,
77
+ ...rest
78
+ }), showCount && /*#__PURE__*/_jsx("span", {
79
+ className: prefixCls('textarea-count'),
80
+ children: maxLength ? `${currentLength}/${maxLength}` : currentLength
81
+ })]
82
+ });
83
+ });
84
+ Textarea.displayName = 'Textarea';
@@ -0,0 +1,226 @@
1
+ /* ===== Textarea 组件样式 ===== */
2
+
3
+ .aura-textarea {
4
+ display: flex;
5
+ flex-direction: column;
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 var(--aura-duration-normal) var(--aura-easing);
15
+
16
+ &:focus-within {
17
+ border-color: var(--aura-primary-500);
18
+ box-shadow: 0 0 0 2px var(--aura-primary-100);
19
+ }
20
+
21
+ &:hover {
22
+ border-color: var(--aura-primary-400);
23
+ }
24
+
25
+ // 文本区域元素
26
+ .aura-textarea-element {
27
+ width: 100%;
28
+ border: none;
29
+ outline: none;
30
+ background: transparent;
31
+ color: inherit;
32
+ font-family: inherit;
33
+ resize: vertical;
34
+ line-height: 1.5;
35
+
36
+ &::placeholder {
37
+ color: var(--aura-text-tertiary);
38
+ }
39
+ }
40
+
41
+ // ===== 尺寸 =====
42
+ &&-sm {
43
+ padding: 4px 10px;
44
+ font-size: var(--aura-font-size-sm);
45
+ border-radius: var(--aura-radius-sm);
46
+
47
+ .aura-textarea-element {
48
+ padding: 0;
49
+ font-size: var(--aura-font-size-sm);
50
+ }
51
+ }
52
+
53
+ &&-md {
54
+ padding: 6px 12px;
55
+ font-size: var(--aura-font-size-md);
56
+
57
+ .aura-textarea-element {
58
+ padding: 0;
59
+ font-size: var(--aura-font-size-md);
60
+ }
61
+ }
62
+
63
+ &&-lg {
64
+ padding: 8px 14px;
65
+ font-size: var(--aura-font-size-lg);
66
+ border-radius: var(--aura-radius-lg);
67
+
68
+ .aura-textarea-element {
69
+ padding: 0;
70
+ font-size: var(--aura-font-size-lg);
71
+ }
72
+ }
73
+
74
+ // ===== 变体 =====
75
+ &&-filled {
76
+ border-color: transparent;
77
+ background: var(--aura-bg-tertiary);
78
+ border-bottom: 1px solid var(--aura-border);
79
+ border-radius: var(--aura-radius-sm) var(--aura-radius-sm) 0 0;
80
+
81
+ &:hover {
82
+ background: var(--aura-bg-secondary);
83
+ border-bottom-color: var(--aura-primary-400);
84
+ }
85
+
86
+ &:focus-within {
87
+ background: var(--aura-bg-secondary);
88
+ border-bottom-color: var(--aura-primary-500);
89
+ box-shadow: none;
90
+ }
91
+ }
92
+
93
+ &&-bordered {
94
+ border: 2px solid var(--aura-border);
95
+
96
+ &:hover {
97
+ border-color: var(--aura-primary-400);
98
+ }
99
+
100
+ &:focus-within {
101
+ border-color: var(--aura-primary-500);
102
+ box-shadow: 0 0 0 2px var(--aura-primary-100);
103
+ }
104
+ }
105
+
106
+ // ===== 状态 =====
107
+ &&-error {
108
+ border-color: var(--aura-error);
109
+
110
+ &:hover {
111
+ border-color: var(--aura-error);
112
+ }
113
+
114
+ &:focus-within {
115
+ border-color: var(--aura-error);
116
+ box-shadow: 0 0 0 2px var(--aura-error-light);
117
+ }
118
+
119
+ &.aura-textarea-filled {
120
+ border-color: transparent;
121
+ border-bottom-color: var(--aura-error);
122
+
123
+ &:hover {
124
+ border-bottom-color: var(--aura-error);
125
+ }
126
+
127
+ &:focus-within {
128
+ border-bottom-color: var(--aura-error);
129
+ box-shadow: none;
130
+ }
131
+ }
132
+ }
133
+
134
+ &&-warning {
135
+ border-color: var(--aura-warning);
136
+
137
+ &:hover {
138
+ border-color: var(--aura-warning);
139
+ }
140
+
141
+ &:focus-within {
142
+ border-color: var(--aura-warning);
143
+ box-shadow: 0 0 0 2px var(--aura-warning-light);
144
+ }
145
+
146
+ &.aura-textarea-filled {
147
+ border-color: transparent;
148
+ border-bottom-color: var(--aura-warning);
149
+
150
+ &:hover {
151
+ border-bottom-color: var(--aura-warning);
152
+ }
153
+
154
+ &:focus-within {
155
+ border-bottom-color: var(--aura-warning);
156
+ box-shadow: none;
157
+ }
158
+ }
159
+ }
160
+
161
+ // ===== 禁用 =====
162
+ &&-disabled {
163
+ opacity: 0.5;
164
+ cursor: not-allowed;
165
+ background: var(--aura-bg-secondary);
166
+
167
+ .aura-textarea-element {
168
+ cursor: not-allowed;
169
+ }
170
+
171
+ &:hover {
172
+ border-color: var(--aura-border);
173
+ }
174
+
175
+ &:focus-within {
176
+ border-color: var(--aura-border);
177
+ box-shadow: none;
178
+ }
179
+ }
180
+
181
+ // ===== 字符计数 =====
182
+ &-count {
183
+ display: flex;
184
+ justify-content: flex-end;
185
+ padding-top: var(--aura-spacing-1);
186
+ padding-bottom: var(--aura-spacing-1);
187
+ padding-right: var(--aura-spacing-1);
188
+ font-size: var(--aura-font-size-xs);
189
+ color: var(--aura-text-tertiary);
190
+ }
191
+
192
+ &-show-count {
193
+ .aura-textarea-element {
194
+ resize: none;
195
+ }
196
+ }
197
+ }
198
+
199
+ // ===== 暗色模式 =====
200
+ [data-theme='dark'] {
201
+ .aura-textarea {
202
+ &:focus-within {
203
+ box-shadow:
204
+ 0 0 0 2px rgba(124, 58, 237, 0.2),
205
+ 0 0 20px rgba(124, 58, 237, 0.15);
206
+ }
207
+
208
+ &-filled:focus-within {
209
+ box-shadow: none;
210
+ }
211
+
212
+ &-error:focus-within {
213
+ box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
214
+ }
215
+
216
+ &-warning:focus-within {
217
+ box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
218
+ }
219
+
220
+ &-disabled {
221
+ &:focus-within {
222
+ box-shadow: none;
223
+ }
224
+ }
225
+ }
226
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export type Theme = 'light' | 'dark';
3
+ interface ThemeContextValue {
4
+ theme: Theme;
5
+ setTheme: (theme: Theme) => void;
6
+ toggleTheme: () => void;
7
+ }
8
+ interface ThemeProviderProps {
9
+ theme?: Theme;
10
+ defaultTheme?: Theme;
11
+ children: React.ReactNode;
12
+ }
13
+ export declare function ThemeProvider({ theme: controlledTheme, defaultTheme, children, }: ThemeProviderProps): React.JSX.Element;
14
+ export declare function useTheme(): ThemeContextValue;
15
+ export {};
@@ -0,0 +1,32 @@
1
+ import React, { createContext, useContext, useEffect, useState, useCallback } from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const ThemeContext = /*#__PURE__*/createContext({
4
+ theme: 'light',
5
+ setTheme: () => {},
6
+ toggleTheme: () => {}
7
+ });
8
+ export function ThemeProvider({
9
+ theme: controlledTheme,
10
+ defaultTheme = 'light',
11
+ children
12
+ }) {
13
+ const [internalTheme, setInternalTheme] = useState(defaultTheme);
14
+ const theme = controlledTheme ?? internalTheme;
15
+ useEffect(() => {
16
+ document.documentElement.setAttribute('data-theme', theme);
17
+ }, [theme]);
18
+ const toggleTheme = useCallback(() => {
19
+ setInternalTheme(prev => prev === 'light' ? 'dark' : 'light');
20
+ }, []);
21
+ return /*#__PURE__*/_jsx(ThemeContext.Provider, {
22
+ value: {
23
+ theme,
24
+ setTheme: setInternalTheme,
25
+ toggleTheme
26
+ },
27
+ children: children
28
+ });
29
+ }
30
+ export function useTheme() {
31
+ return useContext(ThemeContext);
32
+ }
@@ -0,0 +1,2 @@
1
+ export { ThemeProvider, useTheme } from './ThemeProvider';
2
+ export type { Theme } from './ThemeProvider';
@@ -0,0 +1 @@
1
+ export { ThemeProvider, useTheme } from "./ThemeProvider";