@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,118 @@
1
+ import React, { forwardRef, createContext, useContext, useState } from 'react';
2
+ import { classNames, prefixCls } from '@aura-react-comp/shared';
3
+ import "./index.less";
4
+
5
+ /* ===== Checkbox Context(用于 Checkbox.Group) ===== */
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const CheckboxGroupContext = /*#__PURE__*/createContext(null);
9
+
10
+ /* ===== Checkbox ===== */
11
+
12
+ export const Checkbox = /*#__PURE__*/forwardRef(({
13
+ size,
14
+ indeterminate = false,
15
+ disabled,
16
+ checked: controlledChecked,
17
+ defaultChecked,
18
+ onChange: controlledOnChange,
19
+ className,
20
+ children,
21
+ value,
22
+ ...rest
23
+ }, ref) => {
24
+ // 尝试从 Group context 获取
25
+ const groupCtx = useContext(CheckboxGroupContext);
26
+ const isDisabled = disabled ?? groupCtx?.disabled;
27
+ const resolvedSize = size ?? groupCtx?.size ?? 'md';
28
+
29
+ // 单独 Checkbox 的非受控状态。
30
+ // 此前该分支直接取 `!!controlledChecked`,导致未传 checked 时 input 始终是
31
+ // checked={false} 且 onChange 为 undefined —— 既无法点击切换,defaultChecked 也被忽略。
32
+ const [innerChecked, setInnerChecked] = useState(Boolean(defaultChecked));
33
+
34
+ // 受控:group > 单独 controlled > 非受控
35
+ let isChecked;
36
+ let handleChange;
37
+ if (groupCtx) {
38
+ // Group 模式
39
+ const val = value;
40
+ isChecked = groupCtx.value.includes(val);
41
+ handleChange = () => {
42
+ const next = isChecked ? groupCtx.value.filter(v => v !== val) : [...groupCtx.value, val];
43
+ groupCtx.onChange(next);
44
+ };
45
+ } else {
46
+ // 单独 Checkbox 模式
47
+ const isControlled = controlledChecked !== undefined;
48
+ isChecked = isControlled ? !!controlledChecked : innerChecked;
49
+ handleChange = e => {
50
+ if (!isControlled) setInnerChecked(e.target.checked);
51
+ controlledOnChange?.(e);
52
+ };
53
+ }
54
+ const cls = classNames(prefixCls('checkbox'), prefixCls(`checkbox-${resolvedSize}`), isChecked && prefixCls('checkbox-checked'), indeterminate && prefixCls('checkbox-indeterminate'), isDisabled && prefixCls('checkbox-disabled'), className);
55
+ return /*#__PURE__*/_jsxs("label", {
56
+ className: cls,
57
+ children: [/*#__PURE__*/_jsxs("span", {
58
+ className: prefixCls('checkbox-input-wrapper'),
59
+ children: [/*#__PURE__*/_jsx("input", {
60
+ ref: ref,
61
+ type: "checkbox",
62
+ className: prefixCls('checkbox-input'),
63
+ checked: indeterminate || isChecked,
64
+ disabled: isDisabled,
65
+ onChange: handleChange,
66
+ value: value,
67
+ ...rest
68
+ }), /*#__PURE__*/_jsx("span", {
69
+ className: prefixCls('checkbox-inner')
70
+ })]
71
+ }), children !== undefined && /*#__PURE__*/_jsx("span", {
72
+ className: prefixCls('checkbox-label'),
73
+ children: children
74
+ })]
75
+ });
76
+ });
77
+ Checkbox.displayName = 'Checkbox';
78
+
79
+ /* ===== Checkbox.Group ===== */
80
+
81
+ export const CheckboxGroup = ({
82
+ value: controlledValue,
83
+ defaultValue = [],
84
+ options,
85
+ onChange,
86
+ direction = 'horizontal',
87
+ disabled = false,
88
+ size,
89
+ className
90
+ }) => {
91
+ const [internalValue, setInternalValue] = useState(defaultValue);
92
+ const currentValue = controlledValue ?? internalValue;
93
+ const handleChange = nextValue => {
94
+ if (controlledValue === undefined) {
95
+ setInternalValue(nextValue);
96
+ }
97
+ onChange?.(nextValue);
98
+ };
99
+ const ctx = {
100
+ value: currentValue,
101
+ onChange: handleChange,
102
+ disabled,
103
+ size
104
+ };
105
+ const cls = classNames(prefixCls('checkbox-group'), prefixCls(`checkbox-group-${direction}`), className);
106
+ return /*#__PURE__*/_jsx(CheckboxGroupContext.Provider, {
107
+ value: ctx,
108
+ children: /*#__PURE__*/_jsx("div", {
109
+ className: cls,
110
+ children: options.map(opt => /*#__PURE__*/_jsx(Checkbox, {
111
+ value: opt.value,
112
+ disabled: opt.disabled,
113
+ children: opt.label
114
+ }, opt.value))
115
+ })
116
+ });
117
+ };
118
+ CheckboxGroup.displayName = 'CheckboxGroup';
@@ -0,0 +1,175 @@
1
+ .aura-checkbox {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: var(--aura-spacing-2);
5
+ cursor: pointer;
6
+ user-select: none;
7
+ font-size: var(--aura-font-size-md);
8
+ color: var(--aura-text);
9
+ line-height: 1.5;
10
+
11
+ // 隐藏原生 input
12
+ &-input {
13
+ position: absolute;
14
+ width: 0;
15
+ height: 0;
16
+ opacity: 0;
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ &-input-wrapper {
22
+ position: relative;
23
+ display: inline-flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ }
27
+
28
+ // 自定义复选框外观
29
+ &-inner {
30
+ display: inline-block;
31
+ width: 16px;
32
+ height: 16px;
33
+ border: 1.5px solid var(--aura-border);
34
+ border-radius: var(--aura-radius-sm);
35
+ background: var(--aura-bg);
36
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
37
+ position: relative;
38
+ flex-shrink: 0;
39
+
40
+ // 勾号
41
+ &::after {
42
+ content: '';
43
+ position: absolute;
44
+ display: block;
45
+ left: 4px;
46
+ top: 1px;
47
+ width: 5px;
48
+ height: 9px;
49
+ border: solid var(--aura-text-inverse);
50
+ border-width: 0 2px 2px 0;
51
+ transform: rotate(45deg) scale(0);
52
+ transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
53
+ opacity: 0;
54
+ }
55
+ }
56
+
57
+ // 选中状态
58
+ &&-checked {
59
+ .aura-checkbox-inner {
60
+ background: var(--aura-primary-700);
61
+ border-color: var(--aura-primary-700);
62
+
63
+ &::after {
64
+ transform: rotate(45deg) scale(1);
65
+ opacity: 1;
66
+ }
67
+ }
68
+ }
69
+
70
+ // 半选状态
71
+ &&-indeterminate {
72
+ .aura-checkbox-inner {
73
+ background: var(--aura-primary-700);
74
+ border-color: var(--aura-primary-700);
75
+
76
+ &::after {
77
+ left: 3px;
78
+ top: 5px;
79
+ width: 8px;
80
+ height: 2px;
81
+ border: none;
82
+ background: var(--aura-text-inverse);
83
+ transform: none;
84
+ opacity: 1;
85
+ border-radius: 1px;
86
+ }
87
+ }
88
+ }
89
+
90
+ // hover
91
+ &:hover .aura-checkbox-inner {
92
+ border-color: var(--aura-primary-700);
93
+ box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
94
+ }
95
+
96
+ // focus
97
+ &-input:focus-visible + .aura-checkbox-inner {
98
+ box-shadow: 0 0 0 2px var(--aura-primary-200);
99
+ }
100
+
101
+ // 禁用状态
102
+ &&-disabled {
103
+ opacity: 0.5;
104
+ cursor: not-allowed;
105
+ &:hover .aura-checkbox-inner {
106
+ border-color: var(--aura-border);
107
+ box-shadow: none;
108
+ }
109
+ }
110
+
111
+ // 标签文本
112
+ &-label {
113
+ font-size: inherit;
114
+ line-height: inherit;
115
+ }
116
+
117
+ // 尺寸
118
+ &&-sm {
119
+ font-size: var(--aura-font-size-sm);
120
+ .aura-checkbox-inner {
121
+ width: 14px;
122
+ height: 14px;
123
+ }
124
+ .aura-checkbox-inner::after {
125
+ left: 3px;
126
+ top: 0;
127
+ width: 4px;
128
+ height: 7px;
129
+ }
130
+ }
131
+
132
+ &&-lg {
133
+ font-size: var(--aura-font-size-lg);
134
+ .aura-checkbox-inner {
135
+ width: 18px;
136
+ height: 18px;
137
+ }
138
+ .aura-checkbox-inner::after {
139
+ left: 5px;
140
+ top: 2px;
141
+ width: 6px;
142
+ height: 10px;
143
+ }
144
+ }
145
+ }
146
+
147
+ /* ===== Checkbox.Group ===== */
148
+ .aura-checkbox-group {
149
+ display: flex;
150
+ gap: var(--aura-spacing-3);
151
+
152
+ &&-horizontal {
153
+ flex-direction: row;
154
+ flex-wrap: wrap;
155
+ align-items: center;
156
+ }
157
+ &&-vertical {
158
+ flex-direction: column;
159
+ }
160
+ }
161
+
162
+ // 暗色模式
163
+ [data-theme='dark'] {
164
+ .aura-checkbox {
165
+ &-inner {
166
+ border-color: rgba(139, 92, 246, 0.3);
167
+ }
168
+ &:hover .aura-checkbox-inner {
169
+ border-color: var(--aura-primary-600);
170
+ }
171
+ &-input:focus-visible + .aura-checkbox-inner {
172
+ box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
173
+ }
174
+ }
175
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ export interface CollapseItemProps {
3
+ /** 面板唯一标识(避免与 React key 冲突,使用 itemKey) */
4
+ itemKey: string;
5
+ /** 面板标题 */
6
+ title: React.ReactNode;
7
+ /** 是否禁用 */
8
+ disabled?: boolean;
9
+ /** 自定义类名 */
10
+ className?: string;
11
+ /** 自定义样式 */
12
+ style?: React.CSSProperties;
13
+ /** 面板内容 */
14
+ children?: React.ReactNode;
15
+ }
16
+ declare const CollapseItem: React.ForwardRefExoticComponent<CollapseItemProps & React.RefAttributes<HTMLDivElement>>;
17
+ export interface CollapseProps {
18
+ /** 是否为手风琴模式(同时只展开一个) */
19
+ accordion?: boolean;
20
+ /** 默认展开的面板 key(非受控) */
21
+ defaultActiveKey?: string | string[];
22
+ /** 当前展开的面板 key(受控) */
23
+ activeKey?: string | string[];
24
+ /** 展开变化回调 */
25
+ onChange?: (keys: string[]) => void;
26
+ /** 展开图标位置
27
+ * @default 'end'
28
+ */
29
+ expandIconPosition?: 'start' | 'end';
30
+ /** 是否为极简样式(去边框与背景,适合嵌在卡片 / 弹窗内)
31
+ * @default false
32
+ */
33
+ ghost?: boolean;
34
+ /** 自定义类名 */
35
+ className?: string;
36
+ /** 自定义样式 */
37
+ style?: React.CSSProperties;
38
+ /** 子元素 */
39
+ children?: React.ReactNode;
40
+ }
41
+ interface CollapseComponent extends React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<HTMLDivElement>> {
42
+ Item: typeof CollapseItem;
43
+ }
44
+ declare const Collapse: CollapseComponent;
45
+ export { Collapse };
@@ -0,0 +1,157 @@
1
+ import React, { forwardRef, createContext, useContext, useState, useCallback, useRef, useEffect } from 'react';
2
+ import { classNames, prefixCls } from '@aura-react-comp/shared';
3
+ import { ChevronDown } from '@aura-react-comp/icons';
4
+ import "./index.less";
5
+
6
+ /* ===== Collapse Context ===== */
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ const CollapseContext = /*#__PURE__*/createContext(null);
10
+
11
+ /* ===== CollapseItem ===== */
12
+
13
+ const CollapseItem = /*#__PURE__*/forwardRef(({
14
+ itemKey,
15
+ title,
16
+ disabled = false,
17
+ className,
18
+ style,
19
+ children
20
+ }, ref) => {
21
+ const ctx = useContext(CollapseContext);
22
+ if (!ctx) {
23
+ throw new Error('Collapse.Item must be used within a Collapse component');
24
+ }
25
+ const {
26
+ activeKeys,
27
+ toggle,
28
+ expandIconPosition
29
+ } = ctx;
30
+ const isActive = activeKeys.includes(itemKey);
31
+ const contentRef = useRef(null);
32
+ const [maxHeight, setMaxHeight] = useState(undefined);
33
+
34
+ // 展开时计算 scrollHeight
35
+ useEffect(() => {
36
+ if (isActive && contentRef.current) {
37
+ setMaxHeight(contentRef.current.scrollHeight);
38
+ } else {
39
+ setMaxHeight(undefined);
40
+ }
41
+ }, [isActive]);
42
+ const itemCls = classNames(prefixCls('collapse-item'), isActive && prefixCls('collapse-item-active'), disabled && prefixCls('collapse-item-disabled'), className);
43
+ const handleClick = () => {
44
+ if (disabled) return;
45
+ toggle(itemKey);
46
+ };
47
+ const handleKeyDown = e => {
48
+ if (e.key === 'Enter' || e.key === ' ') {
49
+ e.preventDefault();
50
+ handleClick();
51
+ }
52
+ };
53
+ const contentStyle = isActive ? {
54
+ maxHeight: maxHeight ?? 0,
55
+ overflow: 'hidden'
56
+ } : {
57
+ maxHeight: 0,
58
+ overflow: 'hidden'
59
+ };
60
+ return /*#__PURE__*/_jsxs("div", {
61
+ ref: ref,
62
+ className: itemCls,
63
+ style: style,
64
+ children: [/*#__PURE__*/_jsxs("div", {
65
+ className: prefixCls('collapse-header'),
66
+ onClick: handleClick,
67
+ onKeyDown: handleKeyDown,
68
+ role: "button",
69
+ tabIndex: disabled ? -1 : 0,
70
+ "aria-expanded": isActive,
71
+ "aria-disabled": disabled,
72
+ children: [expandIconPosition === 'start' && /*#__PURE__*/_jsx("span", {
73
+ className: classNames(prefixCls('collapse-arrow'), isActive && prefixCls('collapse-arrow-active')),
74
+ children: /*#__PURE__*/_jsx(ChevronDown, {
75
+ size: 14
76
+ })
77
+ }), /*#__PURE__*/_jsx("span", {
78
+ className: prefixCls('collapse-header-text'),
79
+ children: title
80
+ }), expandIconPosition === 'end' && /*#__PURE__*/_jsx("span", {
81
+ className: classNames(prefixCls('collapse-arrow'), isActive && prefixCls('collapse-arrow-active')),
82
+ children: /*#__PURE__*/_jsx(ChevronDown, {
83
+ size: 14
84
+ })
85
+ })]
86
+ }), /*#__PURE__*/_jsx("div", {
87
+ className: classNames(prefixCls('collapse-content'), isActive && prefixCls('collapse-content-active')),
88
+ style: contentStyle,
89
+ children: /*#__PURE__*/_jsx("div", {
90
+ ref: contentRef,
91
+ className: prefixCls('collapse-content-inner'),
92
+ children: children
93
+ })
94
+ })]
95
+ });
96
+ });
97
+ CollapseItem.displayName = 'Collapse.Item';
98
+
99
+ /* ===== Collapse(主组件) ===== */
100
+
101
+ const CollapseBase = /*#__PURE__*/forwardRef(({
102
+ accordion = false,
103
+ defaultActiveKey = [],
104
+ activeKey: controlledActiveKey,
105
+ onChange,
106
+ expandIconPosition = 'end',
107
+ ghost = false,
108
+ className,
109
+ style,
110
+ children
111
+ }, ref) => {
112
+ const normalizeKeys = keys => {
113
+ return Array.isArray(keys) ? keys : [keys];
114
+ };
115
+ const [internalActiveKeys, setInternalActiveKeys] = useState(normalizeKeys(defaultActiveKey));
116
+ const activeKeys = controlledActiveKey !== undefined ? normalizeKeys(controlledActiveKey) : internalActiveKeys;
117
+ const toggle = useCallback(key => {
118
+ let nextKeys;
119
+ if (activeKeys.includes(key)) {
120
+ // 收起
121
+ nextKeys = activeKeys.filter(k => k !== key);
122
+ } else {
123
+ // 展开
124
+ if (accordion) {
125
+ nextKeys = [key];
126
+ } else {
127
+ nextKeys = [...activeKeys, key];
128
+ }
129
+ }
130
+ if (controlledActiveKey === undefined) {
131
+ setInternalActiveKeys(nextKeys);
132
+ }
133
+ onChange?.(nextKeys);
134
+ }, [activeKeys, accordion, controlledActiveKey, onChange]);
135
+ const ctx = {
136
+ activeKeys,
137
+ toggle,
138
+ expandIconPosition
139
+ };
140
+ const cls = classNames(prefixCls('collapse'), ghost && prefixCls('collapse-ghost'), className);
141
+ return /*#__PURE__*/_jsx(CollapseContext.Provider, {
142
+ value: ctx,
143
+ children: /*#__PURE__*/_jsx("div", {
144
+ ref: ref,
145
+ className: cls,
146
+ style: style,
147
+ children: children
148
+ })
149
+ });
150
+ });
151
+ CollapseBase.displayName = 'Collapse';
152
+
153
+ /* ===== 复合组件导出 ===== */
154
+
155
+ const Collapse = CollapseBase;
156
+ Collapse.Item = CollapseItem;
157
+ export { Collapse };
@@ -0,0 +1,144 @@
1
+ /* ===== Collapse 组件样式 ===== */
2
+
3
+ .aura-collapse {
4
+ border: 1px solid var(--aura-border);
5
+ border-radius: var(--aura-radius-md);
6
+ overflow: hidden;
7
+ background: var(--aura-bg);
8
+ }
9
+
10
+ // ===== Collapse.Item =====
11
+ .aura-collapse-item {
12
+ border-bottom: 1px solid var(--aura-border);
13
+
14
+ &:last-child {
15
+ border-bottom: none;
16
+ }
17
+
18
+ // 展开状态
19
+ &&-active {
20
+ .aura-collapse-header {
21
+ color: var(--aura-primary-600);
22
+ }
23
+ }
24
+
25
+ // 禁用状态
26
+ &&-disabled {
27
+ .aura-collapse-header {
28
+ color: var(--aura-text-tertiary);
29
+ cursor: not-allowed;
30
+ opacity: 0.6;
31
+ }
32
+
33
+ .aura-collapse-arrow {
34
+ opacity: 0.4;
35
+ }
36
+ }
37
+ }
38
+
39
+ // ===== 面板头部 =====
40
+ .aura-collapse-header {
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+ padding: 12px 16px;
45
+ cursor: pointer;
46
+ user-select: none;
47
+ font-size: var(--aura-font-size-md);
48
+ font-weight: 500;
49
+ color: var(--aura-text);
50
+ background: var(--aura-bg);
51
+ transition:
52
+ background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
53
+ color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
54
+
55
+ &:hover {
56
+ background: var(--aura-bg-secondary);
57
+ }
58
+
59
+ &:focus-visible {
60
+ outline: 2px solid var(--aura-primary-500);
61
+ outline-offset: -2px;
62
+ border-radius: 2px;
63
+ }
64
+
65
+ .aura-collapse-item-disabled & {
66
+ &:hover {
67
+ background: var(--aura-bg);
68
+ }
69
+ }
70
+ }
71
+
72
+ .aura-collapse-header-text {
73
+ flex: 1;
74
+ line-height: 1.5;
75
+ }
76
+
77
+ // ===== 箭头图标 =====
78
+ .aura-collapse-arrow {
79
+ display: inline-flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ flex-shrink: 0;
83
+ margin-left: var(--aura-spacing-2);
84
+ color: var(--aura-text-tertiary);
85
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
86
+
87
+ // 展开时旋转 180 度
88
+ &&-active {
89
+ transform: rotate(180deg);
90
+ }
91
+ }
92
+
93
+ // ===== 面板内容区域 =====
94
+ .aura-collapse-content {
95
+ max-height: 0;
96
+ overflow: hidden;
97
+ transition:
98
+ max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
99
+ opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
100
+ opacity: 0;
101
+
102
+ // 展开状态
103
+ &&-active {
104
+ opacity: 1;
105
+ }
106
+ }
107
+
108
+ .aura-collapse-content-inner {
109
+ padding: 12px 16px;
110
+ color: var(--aura-text-secondary);
111
+ font-size: var(--aura-font-size-md);
112
+ line-height: 1.6;
113
+ }
114
+
115
+ // ===== 暗色模式 =====
116
+ [data-theme='dark'] {
117
+ .aura-collapse {
118
+ border-color: var(--aura-border);
119
+ }
120
+
121
+ .aura-collapse-item {
122
+ border-bottom-color: var(--aura-border);
123
+
124
+ &-active .aura-collapse-header {
125
+ color: var(--aura-primary-400);
126
+ }
127
+ }
128
+
129
+ .aura-collapse-header:hover {
130
+ background: var(--aura-bg-tertiary);
131
+ }
132
+ }
133
+
134
+ /* ===== 极简样式(ghost) ===== */
135
+ .aura-collapse-ghost {
136
+ border: none;
137
+ border-radius: 0;
138
+ background: transparent;
139
+ box-shadow: none;
140
+
141
+ .aura-collapse-item {
142
+ border-bottom: 1px solid var(--aura-border);
143
+ }
144
+ }
@@ -0,0 +1,16 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ export interface DividerProps extends HTMLAttributes<HTMLDivElement> {
3
+ /** 分割线方向
4
+ * @default 'horizontal'
5
+ */
6
+ direction?: 'horizontal' | 'vertical';
7
+ /** 样式变体
8
+ * @default 'default'
9
+ */
10
+ variant?: 'default' | 'dashed';
11
+ /** 文字位置(仅水平方向且有 children 时生效)
12
+ * @default 'center'
13
+ */
14
+ orientation?: 'left' | 'center' | 'right';
15
+ }
16
+ export declare const Divider: React.ForwardRefExoticComponent<DividerProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,37 @@
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
+ export const Divider = /*#__PURE__*/forwardRef(({
6
+ direction = 'horizontal',
7
+ variant = 'default',
8
+ orientation = 'center',
9
+ className,
10
+ style,
11
+ children,
12
+ ...rest
13
+ }, ref) => {
14
+ const hasText = direction === 'horizontal' && children !== undefined && children !== null;
15
+ const cls = classNames(prefixCls('divider'), prefixCls(`divider-${direction}`), variant === 'dashed' && prefixCls('divider-dashed'), hasText && prefixCls('divider-with-text'), hasText && prefixCls(`divider-with-text-${orientation}`), className);
16
+ if (hasText) {
17
+ return /*#__PURE__*/_jsx("div", {
18
+ ref: ref,
19
+ className: cls,
20
+ style: style,
21
+ role: "separator",
22
+ ...rest,
23
+ children: /*#__PURE__*/_jsx("span", {
24
+ className: prefixCls('divider-inner-text'),
25
+ children: children
26
+ })
27
+ });
28
+ }
29
+ return /*#__PURE__*/_jsx("div", {
30
+ ref: ref,
31
+ className: cls,
32
+ style: style,
33
+ role: "separator",
34
+ ...rest
35
+ });
36
+ });
37
+ Divider.displayName = 'Divider';