@alifd/chat 0.3.40-beta.0 → 0.3.40-beta.2

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 (241) hide show
  1. package/es/ai-loading/types.d.ts +1 -0
  2. package/es/button/button.d.ts +1 -2
  3. package/es/button/button.js +13 -19
  4. package/es/button/group.js +5 -42
  5. package/es/button/main.scss +36 -77
  6. package/es/card/main.scss +1 -1
  7. package/es/checkbox-group/main.scss +6 -7
  8. package/es/checkbox-group/types.d.ts +6 -0
  9. package/es/code-view/index.d.ts +11 -0
  10. package/es/code-view/index.js +63 -0
  11. package/es/code-view/main.scss +54 -0
  12. package/es/code-view/style.d.ts +4 -0
  13. package/es/code-view/style.js +4 -0
  14. package/es/code-view/types.d.ts +27 -0
  15. package/es/code-view/types.js +1 -0
  16. package/es/collapse/index.d.ts +157 -0
  17. package/es/collapse/index.js +20 -0
  18. package/es/collapse/main.scss +97 -0
  19. package/es/collapse/style.d.ts +2 -0
  20. package/es/collapse/style.js +2 -0
  21. package/es/collapse/types.d.ts +82 -0
  22. package/es/collapse/types.js +2 -0
  23. package/es/core/variables.scss +27 -12
  24. package/es/date-picker/DatePicker.d.ts +5 -0
  25. package/es/date-picker/DatePicker.js +15 -0
  26. package/es/date-picker/MonthPicker.d.ts +4 -0
  27. package/es/date-picker/MonthPicker.js +15 -0
  28. package/es/date-picker/RangePicker.d.ts +4 -0
  29. package/es/date-picker/RangePicker.js +17 -0
  30. package/es/date-picker/YearPicker.d.ts +4 -0
  31. package/es/date-picker/YearPicker.js +15 -0
  32. package/es/date-picker/index.d.ts +5 -23
  33. package/es/date-picker/index.js +11 -29
  34. package/es/date-picker/main.scss +23 -1
  35. package/es/date-picker/style.d.ts +1 -0
  36. package/es/date-picker/style.js +1 -0
  37. package/es/date-picker/types.d.ts +161 -81
  38. package/es/float-button/hooks/useAutoAlign.d.ts +1 -1
  39. package/es/form/style.d.ts +0 -1
  40. package/es/form/style.js +2 -1
  41. package/es/form/types.d.ts +3 -517
  42. package/es/form/types.js +5 -1
  43. package/es/html-render/index.d.ts +1 -1
  44. package/es/html-render/index.js +118 -106
  45. package/es/html-render/main.scss +27 -8
  46. package/es/html-render/style.d.ts +1 -0
  47. package/es/html-render/style.js +1 -0
  48. package/es/icon/index.d.ts +1 -1
  49. package/es/index.d.ts +3 -0
  50. package/es/index.js +4 -1
  51. package/es/input/index.d.ts +1 -1
  52. package/es/input/index.js +16 -6
  53. package/es/input/main.scss +25 -0
  54. package/es/input/style.d.ts +1 -0
  55. package/es/input/style.js +1 -0
  56. package/es/input/types.d.ts +58 -15
  57. package/es/markdown/index.d.ts +1 -2
  58. package/es/markdown/index.js +26 -15
  59. package/es/markdown/main.scss +4 -3
  60. package/es/markdown/style.d.ts +2 -1
  61. package/es/markdown/style.js +2 -1
  62. package/es/markdown/types.d.ts +20 -9
  63. package/es/message/index.d.ts +4 -4
  64. package/es/person-picker/index.d.ts +3 -190
  65. package/es/person-picker/index.js +23 -21
  66. package/es/person-picker/main.scss +15 -1
  67. package/es/person-picker/types.d.ts +53 -11
  68. package/es/radio-group/index.d.ts +1 -1
  69. package/es/radio-group/index.js +9 -3
  70. package/es/radio-group/main.scss +13 -5
  71. package/es/radio-group/types.d.ts +5 -3
  72. package/es/reference/index.d.ts +1 -1
  73. package/es/reference/index.js +14 -15
  74. package/es/reference/main.scss +1 -1
  75. package/es/reference/types.d.ts +1 -0
  76. package/es/select/button.d.ts +3 -0
  77. package/es/select/button.js +70 -0
  78. package/es/select/index.d.ts +79 -79
  79. package/es/select/index.js +13 -57
  80. package/es/select/main.scss +22 -4
  81. package/es/select/types.d.ts +108 -1
  82. package/es/step/index.js +2 -2
  83. package/es/step/main.scss +115 -66
  84. package/es/step/types.d.ts +13 -2
  85. package/es/table/index.d.ts +12 -0
  86. package/es/table/index.js +23 -0
  87. package/es/table/main.scss +30 -0
  88. package/es/table/style.d.ts +2 -0
  89. package/es/table/style.js +2 -0
  90. package/es/table/types.d.ts +98 -0
  91. package/es/table/types.js +1 -0
  92. package/es/tag/index.d.ts +5 -3
  93. package/es/tag/index.js +18 -2
  94. package/es/tag/main.scss +20 -4
  95. package/es/tag/types.d.ts +55 -0
  96. package/es/text/index.js +1 -1
  97. package/es/text/main.scss +4 -1
  98. package/es/text/types.d.ts +8 -0
  99. package/es/time-picker/index.d.ts +6 -15
  100. package/es/time-picker/index.js +71 -24
  101. package/es/time-picker/main.scss +19 -1
  102. package/es/time-picker/style.d.ts +1 -0
  103. package/es/time-picker/style.js +1 -0
  104. package/es/time-picker/types.d.ts +133 -8
  105. package/es/tool-status/index.d.ts +1 -1
  106. package/es/tool-status/index.js +1 -1
  107. package/es/tool-status/main.scss +2 -1
  108. package/es/tool-status/types.d.ts +7 -2
  109. package/es/utils/func.d.ts +1 -0
  110. package/es/utils/func.js +13 -0
  111. package/es/utils/github-dark.scss +137 -0
  112. package/es/utils/github.scss +137 -0
  113. package/es/utils/hoc/main.scss +166 -0
  114. package/es/utils/hoc/withLabel.d.ts +94 -0
  115. package/es/utils/hoc/withLabel.js +57 -0
  116. package/es/utils/index.d.ts +1 -0
  117. package/es/utils/index.js +1 -0
  118. package/lib/ai-loading/types.d.ts +1 -0
  119. package/lib/button/button.d.ts +1 -2
  120. package/lib/button/button.js +13 -19
  121. package/lib/button/group.js +4 -41
  122. package/lib/button/main.scss +36 -77
  123. package/lib/card/main.scss +1 -1
  124. package/lib/checkbox-group/main.scss +6 -7
  125. package/lib/checkbox-group/types.d.ts +6 -0
  126. package/lib/code-view/index.d.ts +11 -0
  127. package/lib/code-view/index.js +66 -0
  128. package/lib/code-view/main.scss +54 -0
  129. package/lib/code-view/style.d.ts +4 -0
  130. package/lib/code-view/style.js +6 -0
  131. package/lib/code-view/types.d.ts +27 -0
  132. package/lib/code-view/types.js +2 -0
  133. package/lib/collapse/index.d.ts +157 -0
  134. package/lib/collapse/index.js +22 -0
  135. package/lib/collapse/main.scss +97 -0
  136. package/lib/collapse/style.d.ts +2 -0
  137. package/lib/collapse/style.js +4 -0
  138. package/lib/collapse/types.d.ts +82 -0
  139. package/lib/collapse/types.js +3 -0
  140. package/lib/core/variables.scss +27 -12
  141. package/lib/date-picker/DatePicker.d.ts +5 -0
  142. package/lib/date-picker/DatePicker.js +17 -0
  143. package/lib/date-picker/MonthPicker.d.ts +4 -0
  144. package/lib/date-picker/MonthPicker.js +17 -0
  145. package/lib/date-picker/RangePicker.d.ts +4 -0
  146. package/lib/date-picker/RangePicker.js +19 -0
  147. package/lib/date-picker/YearPicker.d.ts +4 -0
  148. package/lib/date-picker/YearPicker.js +17 -0
  149. package/lib/date-picker/index.d.ts +5 -23
  150. package/lib/date-picker/index.js +10 -27
  151. package/lib/date-picker/main.scss +23 -1
  152. package/lib/date-picker/style.d.ts +1 -0
  153. package/lib/date-picker/style.js +1 -0
  154. package/lib/date-picker/types.d.ts +161 -81
  155. package/lib/float-button/hooks/useAutoAlign.d.ts +1 -1
  156. package/lib/form/style.d.ts +0 -1
  157. package/lib/form/style.js +1 -2
  158. package/lib/form/types.d.ts +3 -517
  159. package/lib/form/types.js +4 -1
  160. package/lib/html-render/index.d.ts +1 -1
  161. package/lib/html-render/index.js +118 -106
  162. package/lib/html-render/main.scss +27 -8
  163. package/lib/html-render/style.d.ts +1 -0
  164. package/lib/html-render/style.js +1 -0
  165. package/lib/icon/index.d.ts +1 -1
  166. package/lib/index.d.ts +3 -0
  167. package/lib/index.js +8 -2
  168. package/lib/input/index.d.ts +1 -1
  169. package/lib/input/index.js +16 -6
  170. package/lib/input/main.scss +25 -0
  171. package/lib/input/style.d.ts +1 -0
  172. package/lib/input/style.js +1 -0
  173. package/lib/input/types.d.ts +58 -15
  174. package/lib/markdown/index.d.ts +1 -2
  175. package/lib/markdown/index.js +26 -15
  176. package/lib/markdown/main.scss +4 -3
  177. package/lib/markdown/style.d.ts +2 -1
  178. package/lib/markdown/style.js +2 -1
  179. package/lib/markdown/types.d.ts +20 -9
  180. package/lib/message/index.d.ts +4 -4
  181. package/lib/person-picker/index.d.ts +3 -190
  182. package/lib/person-picker/index.js +22 -20
  183. package/lib/person-picker/main.scss +15 -1
  184. package/lib/person-picker/types.d.ts +53 -11
  185. package/lib/radio-group/index.d.ts +1 -1
  186. package/lib/radio-group/index.js +8 -2
  187. package/lib/radio-group/main.scss +13 -5
  188. package/lib/radio-group/types.d.ts +5 -3
  189. package/lib/reference/index.d.ts +1 -1
  190. package/lib/reference/index.js +17 -18
  191. package/lib/reference/main.scss +1 -1
  192. package/lib/reference/types.d.ts +1 -0
  193. package/lib/select/button.d.ts +3 -0
  194. package/lib/select/button.js +74 -0
  195. package/lib/select/index.d.ts +79 -79
  196. package/lib/select/index.js +11 -55
  197. package/lib/select/main.scss +22 -4
  198. package/lib/select/types.d.ts +108 -1
  199. package/lib/step/index.js +2 -2
  200. package/lib/step/main.scss +115 -66
  201. package/lib/step/types.d.ts +13 -2
  202. package/lib/table/index.d.ts +12 -0
  203. package/lib/table/index.js +25 -0
  204. package/lib/table/main.scss +30 -0
  205. package/lib/table/style.d.ts +2 -0
  206. package/lib/table/style.js +4 -0
  207. package/lib/table/types.d.ts +98 -0
  208. package/lib/table/types.js +2 -0
  209. package/lib/tag/index.d.ts +5 -3
  210. package/lib/tag/index.js +17 -1
  211. package/lib/tag/main.scss +20 -4
  212. package/lib/tag/types.d.ts +55 -0
  213. package/lib/text/index.js +1 -1
  214. package/lib/text/main.scss +4 -1
  215. package/lib/text/types.d.ts +8 -0
  216. package/lib/time-picker/index.d.ts +6 -15
  217. package/lib/time-picker/index.js +71 -23
  218. package/lib/time-picker/main.scss +19 -1
  219. package/lib/time-picker/style.d.ts +1 -0
  220. package/lib/time-picker/style.js +1 -0
  221. package/lib/time-picker/types.d.ts +133 -8
  222. package/lib/tool-status/index.d.ts +1 -1
  223. package/lib/tool-status/index.js +1 -1
  224. package/lib/tool-status/main.scss +2 -1
  225. package/lib/tool-status/types.d.ts +7 -2
  226. package/lib/utils/func.d.ts +1 -0
  227. package/lib/utils/func.js +15 -0
  228. package/lib/utils/github-dark.scss +137 -0
  229. package/lib/utils/github.scss +137 -0
  230. package/lib/utils/hoc/main.scss +166 -0
  231. package/lib/utils/hoc/withLabel.d.ts +94 -0
  232. package/lib/utils/hoc/withLabel.js +60 -0
  233. package/lib/utils/index.d.ts +1 -0
  234. package/lib/utils/index.js +1 -0
  235. package/package.json +49 -4
  236. package/es/form/index.d.ts +0 -23
  237. package/es/form/index.js +0 -33
  238. package/es/form/main.scss +0 -5
  239. package/lib/form/index.d.ts +0 -23
  240. package/lib/form/index.js +0 -35
  241. package/lib/form/main.scss +0 -5
@@ -0,0 +1,137 @@
1
+ .ct-hljs-dark {
2
+ pre code.hljs {
3
+ display: block;
4
+ overflow-x: auto;
5
+ padding: 1em
6
+ }
7
+
8
+ code.hljs {
9
+ padding: 3px 5px
10
+ }
11
+
12
+ /*!
13
+ Theme: GitHub Dark
14
+ Description: Dark theme as seen on github.com
15
+ Author: github.com
16
+ Maintainer: @Hirse
17
+ Updated: 2021-05-15
18
+
19
+ Outdated base version: https://github.com/primer/github-syntax-dark
20
+ Current colors taken from GitHub's CSS
21
+ */
22
+ .hljs {
23
+ color: #c9d1d9;
24
+ background: #0d1117
25
+ }
26
+
27
+ .hljs-doctag,
28
+ .hljs-keyword,
29
+ .hljs-meta .hljs-keyword,
30
+ .hljs-template-tag,
31
+ .hljs-template-variable,
32
+ .hljs-type,
33
+ .hljs-variable.language_ {
34
+ /* prettylights-syntax-keyword */
35
+ color: #ff7b72
36
+ }
37
+
38
+ .hljs-title,
39
+ .hljs-title.class_,
40
+ .hljs-title.class_.inherited__,
41
+ .hljs-title.function_ {
42
+ /* prettylights-syntax-entity */
43
+ color: #d2a8ff
44
+ }
45
+
46
+ .hljs-attr,
47
+ .hljs-attribute,
48
+ .hljs-literal,
49
+ .hljs-meta,
50
+ .hljs-number,
51
+ .hljs-operator,
52
+ .hljs-variable,
53
+ .hljs-selector-attr,
54
+ .hljs-selector-class,
55
+ .hljs-selector-id {
56
+ /* prettylights-syntax-constant */
57
+ color: #79c0ff
58
+ }
59
+
60
+ .hljs-regexp,
61
+ .hljs-string,
62
+ .hljs-meta .hljs-string {
63
+ /* prettylights-syntax-string */
64
+ color: #a5d6ff
65
+ }
66
+
67
+ .hljs-built_in,
68
+ .hljs-symbol {
69
+ /* prettylights-syntax-variable */
70
+ color: #ffa657
71
+ }
72
+
73
+ .hljs-comment,
74
+ .hljs-code,
75
+ .hljs-formula {
76
+ /* prettylights-syntax-comment */
77
+ color: #8b949e
78
+ }
79
+
80
+ .hljs-name,
81
+ .hljs-quote,
82
+ .hljs-selector-tag,
83
+ .hljs-selector-pseudo {
84
+ /* prettylights-syntax-entity-tag */
85
+ color: #7ee787
86
+ }
87
+
88
+ .hljs-subst {
89
+ /* prettylights-syntax-storage-modifier-import */
90
+ color: #c9d1d9
91
+ }
92
+
93
+ .hljs-section {
94
+ /* prettylights-syntax-markup-heading */
95
+ color: #1f6feb;
96
+ font-weight: bold
97
+ }
98
+
99
+ .hljs-bullet {
100
+ /* prettylights-syntax-markup-list */
101
+ color: #f2cc60
102
+ }
103
+
104
+ .hljs-emphasis {
105
+ /* prettylights-syntax-markup-italic */
106
+ color: #c9d1d9;
107
+ font-style: italic
108
+ }
109
+
110
+ .hljs-strong {
111
+ /* prettylights-syntax-markup-bold */
112
+ color: #c9d1d9;
113
+ font-weight: bold
114
+ }
115
+
116
+ .hljs-addition {
117
+ /* prettylights-syntax-markup-inserted */
118
+ color: #aff5b4;
119
+ background-color: #033a16
120
+ }
121
+
122
+ .hljs-deletion {
123
+ /* prettylights-syntax-markup-deleted */
124
+ color: #ffdcd7;
125
+ background-color: #67060c
126
+ }
127
+
128
+ .hljs-char.escape_,
129
+ .hljs-link,
130
+ .hljs-params,
131
+ .hljs-property,
132
+ .hljs-punctuation,
133
+ .hljs-tag {
134
+ /* purposely ignored */
135
+
136
+ }
137
+ }
@@ -0,0 +1,137 @@
1
+ .ct-hljs-light {
2
+ pre code.hljs {
3
+ display: block;
4
+ overflow-x: auto;
5
+ padding: 1em
6
+ }
7
+
8
+ code.hljs {
9
+ padding: 3px 5px
10
+ }
11
+
12
+ /*!
13
+ Theme: GitHub
14
+ Description: Light theme as seen on github.com
15
+ Author: github.com
16
+ Maintainer: @Hirse
17
+ Updated: 2021-05-15
18
+
19
+ Outdated base version: https://github.com/primer/github-syntax-light
20
+ Current colors taken from GitHub's CSS
21
+ */
22
+ .hljs {
23
+ color: #24292e;
24
+ background: #ffffff
25
+ }
26
+
27
+ .hljs-doctag,
28
+ .hljs-keyword,
29
+ .hljs-meta .hljs-keyword,
30
+ .hljs-template-tag,
31
+ .hljs-template-variable,
32
+ .hljs-type,
33
+ .hljs-variable.language_ {
34
+ /* prettylights-syntax-keyword */
35
+ color: #d73a49
36
+ }
37
+
38
+ .hljs-title,
39
+ .hljs-title.class_,
40
+ .hljs-title.class_.inherited__,
41
+ .hljs-title.function_ {
42
+ /* prettylights-syntax-entity */
43
+ color: #6f42c1
44
+ }
45
+
46
+ .hljs-attr,
47
+ .hljs-attribute,
48
+ .hljs-literal,
49
+ .hljs-meta,
50
+ .hljs-number,
51
+ .hljs-operator,
52
+ .hljs-variable,
53
+ .hljs-selector-attr,
54
+ .hljs-selector-class,
55
+ .hljs-selector-id {
56
+ /* prettylights-syntax-constant */
57
+ color: #005cc5
58
+ }
59
+
60
+ .hljs-regexp,
61
+ .hljs-string,
62
+ .hljs-meta .hljs-string {
63
+ /* prettylights-syntax-string */
64
+ color: #032f62
65
+ }
66
+
67
+ .hljs-built_in,
68
+ .hljs-symbol {
69
+ /* prettylights-syntax-variable */
70
+ color: #e36209
71
+ }
72
+
73
+ .hljs-comment,
74
+ .hljs-code,
75
+ .hljs-formula {
76
+ /* prettylights-syntax-comment */
77
+ color: #6a737d
78
+ }
79
+
80
+ .hljs-name,
81
+ .hljs-quote,
82
+ .hljs-selector-tag,
83
+ .hljs-selector-pseudo {
84
+ /* prettylights-syntax-entity-tag */
85
+ color: #22863a
86
+ }
87
+
88
+ .hljs-subst {
89
+ /* prettylights-syntax-storage-modifier-import */
90
+ color: #24292e
91
+ }
92
+
93
+ .hljs-section {
94
+ /* prettylights-syntax-markup-heading */
95
+ color: #005cc5;
96
+ font-weight: bold
97
+ }
98
+
99
+ .hljs-bullet {
100
+ /* prettylights-syntax-markup-list */
101
+ color: #735c0f
102
+ }
103
+
104
+ .hljs-emphasis {
105
+ /* prettylights-syntax-markup-italic */
106
+ color: #24292e;
107
+ font-style: italic
108
+ }
109
+
110
+ .hljs-strong {
111
+ /* prettylights-syntax-markup-bold */
112
+ color: #24292e;
113
+ font-weight: bold
114
+ }
115
+
116
+ .hljs-addition {
117
+ /* prettylights-syntax-markup-inserted */
118
+ color: #22863a;
119
+ background-color: #f0fff4
120
+ }
121
+
122
+ .hljs-deletion {
123
+ /* prettylights-syntax-markup-deleted */
124
+ color: #b31d28;
125
+ background-color: #ffeef0
126
+ }
127
+
128
+ .hljs-char.escape_,
129
+ .hljs-link,
130
+ .hljs-params,
131
+ .hljs-property,
132
+ .hljs-punctuation,
133
+ .hljs-tag {
134
+ /* purposely ignored */
135
+
136
+ }
137
+ }
@@ -0,0 +1,166 @@
1
+ @import "../../core/variables.scss";
2
+
3
+ .#{$prefix}field-wrapper {
4
+ &-hover-enabled {
5
+ &:not(.#{$prefix}field-wrapper-disabled, .#{$prefix}field-wrapper-readonly) {
6
+
7
+ &.#{$prefix}field-wrapper-focused,
8
+ &:hover {
9
+ border-color: var(--input-focus-border-color, #5584FF);
10
+ background-color: var(--input-focus-bg-color, #FFFFFF);
11
+ box-shadow: 0 0 0 var(--input-focus-shadow-spread, 2px) var(--color-calculate-input-focus-shadow, rgba(85, 132, 255, 0.2));
12
+ }
13
+ }
14
+ }
15
+
16
+ &-style {
17
+ background: var(--color-fill1-1, #f6f8fc);
18
+ border-radius: var(--form-element-medium-corner, 3px);
19
+ border: var(--input-border-width, 1px) solid var(--color-fill1-1, #f6f8fc);
20
+ }
21
+
22
+ &-medium {
23
+ width: 100%;
24
+ }
25
+
26
+ /**
27
+ * 组件的整体布局
28
+ * horizontal: 水平布局
29
+ * vertical: 垂直布局
30
+ */
31
+ &-horizontal {
32
+ flex-direction: row;
33
+ align-items: center;
34
+ display: inline-flex;
35
+ width: 100%;
36
+ align-items: flex-start;
37
+
38
+ .#{$prefix}field-wrapper-content {
39
+ width: 100%;
40
+ position: relative;
41
+ }
42
+
43
+ .#{$prefix}label-required::before {
44
+ position: absolute;
45
+ left: 4px;
46
+ }
47
+
48
+ .#{$prefix}label {
49
+ max-width: 9em;
50
+ padding: var(--input-m-label-padding-left, 8px) 0;
51
+ padding-left: 12px;
52
+ }
53
+ }
54
+
55
+ &-vertical {
56
+ flex-direction: column;
57
+ align-items: flex-start;
58
+ display: inline-flex;
59
+ width: 100%;
60
+
61
+ .#{$prefix}label {
62
+ padding-left: 0;
63
+ margin-left: 0;
64
+ color: var(--color-text1-3, #6A6C70);
65
+ margin-bottom: var(--s-2, 8px);
66
+ line-height: 20px;
67
+ }
68
+
69
+ .#{$prefix}field-wrapper-content {
70
+ width: 100%;
71
+ }
72
+
73
+ .#{$prefix}label-required::before {
74
+ display: none;
75
+ }
76
+ .#{$prefix}label-required::after {
77
+ content: "*";
78
+ color: var(--color-error-3, #F34810);
79
+ margin-left: 2px;
80
+ font-size: calc(var(--form-element-medium-font-size, 12px) - 2px);
81
+ display: inline;
82
+ }
83
+ }
84
+
85
+ .#{$prefix}label {
86
+ position: relative;
87
+ color: var(--input-label-color, #666);
88
+ display: inline-block;
89
+ flex-shrink: 0;
90
+ flex-grow: 0;
91
+ overflow: hidden;
92
+ text-overflow: ellipsis;
93
+ font-size: var(--form-element-medium-font-size, 12px);
94
+ line-height: 17px;
95
+
96
+ &-text {
97
+ display: block;
98
+ }
99
+
100
+ &-required::before {
101
+ content: "*";
102
+ color: var(--color-error-3, #F34810);
103
+ margin-right: 2px;
104
+ }
105
+
106
+ &.#{$prefix}label-required::before {
107
+ font-size: calc(var(--form-element-medium-font-size, 12px) - 2px);
108
+ }
109
+ }
110
+
111
+ &-content {
112
+ min-width: 120px;
113
+ flex-grow: 1;
114
+ flex-shrink: 1;
115
+ align-items: stretch;
116
+ display: inline-flex;
117
+ }
118
+
119
+ &-error {
120
+ border-color: var(--input-feedback-error-border-color, #FF3000);
121
+ background-color: var(--input-feedback-error-bg-color, #FFFFFF);
122
+ }
123
+
124
+ &-disabled {
125
+ cursor: not-allowed;
126
+ background-color: var(--input-disabled-bg-color, #F6F8FC);
127
+
128
+ .#{$prefix}label {
129
+ cursor: not-allowed;
130
+ }
131
+
132
+ .#{$prefix}content {
133
+ cursor: not-allowed;
134
+ }
135
+
136
+ ;
137
+ }
138
+
139
+ .next-input {
140
+ box-shadow: none !important;
141
+ background-color: transparent;
142
+ border: transparent !important;
143
+ width: 100%;
144
+ }
145
+
146
+ .next-date-picker2-input,
147
+ .next-time-picker2-input {
148
+ border: none !important;
149
+ background-color: transparent !important;
150
+ box-shadow: none !important;
151
+ }
152
+
153
+ .ct-date-picker2,
154
+ .ct-time-picker2 {
155
+ width: 100%;
156
+
157
+ .next-input {
158
+ display: inline-flex;
159
+ align-items: center;
160
+ }
161
+
162
+ .next-input-control {
163
+ width: 20px;
164
+ }
165
+ }
166
+ }
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import './main.scss';
3
+ export interface WithLabelProps {
4
+ /**
5
+ * 标签文本
6
+ * @en Label text
7
+ */
8
+ label?: React.ReactNode;
9
+ /**
10
+ * 标签布局方式
11
+ * @en Label layout mode
12
+ */
13
+ labelLayout?: 'horizontal' | 'vertical';
14
+ /**
15
+ * 组件尺寸
16
+ * @en Component size
17
+ */
18
+ size?: 'small' | 'medium' | 'large';
19
+ /**
20
+ * 状态
21
+ * @en Component state
22
+ */
23
+ state?: 'error' | 'warning' | 'loading' | 'normal';
24
+ /**
25
+ * 是否禁用
26
+ * @en Whether the component is disabled
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * 包装器的类名
31
+ * @en Wrapper className
32
+ */
33
+ className?: string;
34
+ /**
35
+ * 包装器的样式
36
+ * @en Wrapper style
37
+ */
38
+ style?: React.CSSProperties;
39
+ /**
40
+ * 是否必填
41
+ * @en Whether the field is required
42
+ */
43
+ required?: boolean;
44
+ /**
45
+ * 是否只读
46
+ * @en Whether the field is readonly
47
+ */
48
+ readOnly?: boolean;
49
+ /**
50
+ * 获取焦点时的回调
51
+ * @en Callback when component gets focus
52
+ */
53
+ onFocus?: (e: React.FocusEvent<any>) => void;
54
+ /**
55
+ * 失去焦点时的回调
56
+ * @en Callback when component loses focus
57
+ */
58
+ onBlur?: (e: React.FocusEvent<any>) => void;
59
+ /**
60
+ * label 宽度
61
+ */
62
+ labelWidth?: string;
63
+ }
64
+ type ComponentWithLabelProps<P> = P & WithLabelProps;
65
+ interface WithLabelConfig {
66
+ /**
67
+ * 标签布局方式
68
+ * - horizontal: 水平布局
69
+ * - vertical: 垂直布局
70
+ * @defaultValue 'horizontal'
71
+ */
72
+ labelLayout?: 'horizontal' | 'vertical';
73
+ /**
74
+ * 使用默认样式
75
+ */
76
+ coverStyle?: boolean;
77
+ /**
78
+ * 是否启用悬停状态样式
79
+ * @defaultValue true
80
+ */
81
+ enableHoverState?: boolean;
82
+ /**
83
+ * 是否启用焦点状态样式
84
+ * @defaultValue true
85
+ */
86
+ enableFocusState?: boolean;
87
+ /**
88
+ * 是否启用禁用状态样式
89
+ * @defaultValue true
90
+ */
91
+ enableDisabledState?: boolean;
92
+ }
93
+ export declare function withLabel<P>(WrappedComponent: React.ComponentType<P>, defaultConfig?: WithLabelConfig): React.ForwardRefExoticComponent<React.PropsWithoutRef<ComponentWithLabelProps<P>> & React.RefAttributes<any>>;
94
+ export {};
@@ -0,0 +1,57 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import cs from 'classnames';
4
+ import { PREFIX_DEFAULT } from '../index';
5
+ import './main.scss';
6
+ export function withLabel(WrappedComponent, defaultConfig = {}) {
7
+ const WithLabel = React.forwardRef((props, ref) => {
8
+ var _a;
9
+ const { label, size = 'medium', state, disabled, className, style, required, readOnly: readonly, onFocus, onBlur, labelLayout: propsLabelLayout, labelWidth } = props, rest = __rest(props, ["label", "size", "state", "disabled", "className", "style", "required", "readOnly", "onFocus", "onBlur", "labelLayout", "labelWidth"]);
10
+ const { labelLayout: defaultLabelLayout, coverStyle = true, enableHoverState = true, enableFocusState = true, enableDisabledState = true } = defaultConfig;
11
+ // Use defaultConfig labelLayout as higher priority
12
+ const labelLayout = (_a = defaultLabelLayout !== null && defaultLabelLayout !== void 0 ? defaultLabelLayout : propsLabelLayout) !== null && _a !== void 0 ? _a : 'horizontal';
13
+ const [focused, setFocused] = React.useState(false);
14
+ const handleFocus = React.useCallback((e) => {
15
+ if (enableFocusState) {
16
+ setFocused(true);
17
+ }
18
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
19
+ }, [onFocus, enableFocusState]);
20
+ const handleBlur = React.useCallback((e) => {
21
+ if (enableFocusState) {
22
+ setFocused(false);
23
+ }
24
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
25
+ }, [onBlur, enableFocusState]);
26
+ const wrapperClassName = cs({
27
+ [`${PREFIX_DEFAULT}field-wrapper-style`]: coverStyle,
28
+ [`${PREFIX_DEFAULT}field-wrapper-${size}`]: size,
29
+ [`${PREFIX_DEFAULT}field-wrapper-${state}`]: coverStyle && state && state !== 'normal',
30
+ [`${PREFIX_DEFAULT}field-wrapper-disabled`]: enableDisabledState && disabled,
31
+ [`${PREFIX_DEFAULT}field-wrapper-readonly`]: enableDisabledState && readonly,
32
+ [`${PREFIX_DEFAULT}field-wrapper-focused`]: enableFocusState && focused && state !== 'error' && state !== 'warning',
33
+ [`${PREFIX_DEFAULT}field-wrapper-hover-enabled`]: enableHoverState && state !== 'error' && state !== 'warning',
34
+ [`${PREFIX_DEFAULT}field-wrapper-${labelLayout}`]: label,
35
+ }, className);
36
+ const labelElement = label ? (React.createElement("label", { className: cs({
37
+ [`${PREFIX_DEFAULT}label`]: true,
38
+ [`${PREFIX_DEFAULT}label-required`]: required
39
+ }) },
40
+ React.createElement("span", { className: `${PREFIX_DEFAULT}label-text`, style: {
41
+ width: labelLayout === 'horizontal' && labelWidth ? labelWidth : 'auto',
42
+ } }, label))) : null;
43
+ if (labelLayout === 'vertical') {
44
+ return (React.createElement("div", { className: cs(`${PREFIX_DEFAULT}field-wrapper-vertical`, `${PREFIX_DEFAULT}field-wrapper`) },
45
+ labelElement,
46
+ React.createElement("div", { className: wrapperClassName, style: style },
47
+ React.createElement("span", { className: `${PREFIX_DEFAULT}field-wrapper-content` },
48
+ React.createElement(WrappedComponent, Object.assign({}, rest, { ref: ref, size: size, state: state, disabled: disabled, readonly: readonly, onFocus: handleFocus, onBlur: handleBlur }))))));
49
+ }
50
+ return (React.createElement("div", { className: cs(wrapperClassName, `${PREFIX_DEFAULT}field-wrapper`, `${PREFIX_DEFAULT}field-wrapper-horizontal`), style: style },
51
+ labelElement,
52
+ React.createElement("span", { className: `${PREFIX_DEFAULT}field-wrapper-content` },
53
+ React.createElement(WrappedComponent, Object.assign({}, rest, { ref: ref, size: size, state: state, disabled: disabled, readonly: readonly, onFocus: handleFocus, onBlur: handleBlur })))));
54
+ });
55
+ WithLabel.displayName = `WithLabel(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
56
+ return WithLabel;
57
+ }
@@ -2,6 +2,7 @@ export * from './consts';
2
2
  export * from './types';
3
3
  export * from './common';
4
4
  export * from './func';
5
+ export * from './hoc/withLabel';
5
6
  export { useControlable } from './hooks/useControlable';
6
7
  export { useDebounce } from './hooks/useDebounce';
7
8
  export { useThrottle } from './hooks/useThrottle';
package/es/utils/index.js CHANGED
@@ -2,6 +2,7 @@ export * from './consts';
2
2
  export * from './types';
3
3
  export * from './common';
4
4
  export * from './func';
5
+ export * from './hoc/withLabel';
5
6
  export { useControlable } from './hooks/useControlable';
6
7
  export { useDebounce } from './hooks/useDebounce';
7
8
  export { useThrottle } from './hooks/useThrottle';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { type CommonProps } from '@alifd/next';
3
3
  /**
4
4
  * AI Loading 属性
5
+ * @api
5
6
  */
6
7
  export interface AILoadingProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
7
8
  className?: string;
@@ -2,8 +2,7 @@
2
2
  * @component 按钮
3
3
  * @en Button
4
4
  * @type 通用 - General
5
- * @remarks Next Button,按钮用于开始一个即时操作。- Same as Next.Button, Button used to trigger an action.
6
- * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
5
+ * @remarks [按钮组件] 是一个 [操作类] UI 组件,用于 [触发用户交互动作],包括点击、悬停等行为,使用户能够 [执行命令、提交表单、切换状态等]。它在卡片中扮演 [核心操作入口] 的角色,通常用于 [表单提交、功能切换、数据操作等场景]。
7
6
  * @others
8
7
  * ## 无障碍键盘操作指南
9
8
  * | 按键 | 说明 |
@@ -3,8 +3,7 @@
3
3
  * @component 按钮
4
4
  * @en Button
5
5
  * @type 通用 - General
6
- * @remarks Next Button,按钮用于开始一个即时操作。- Same as Next.Button, Button used to trigger an action.
7
- * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
6
+ * @remarks [按钮组件] 是一个 [操作类] UI 组件,用于 [触发用户交互动作],包括点击、悬停等行为,使用户能够 [执行命令、提交表单、切换状态等]。它在卡片中扮演 [核心操作入口] 的角色,通常用于 [表单提交、功能切换、数据操作等场景]。
8
7
  * @others
9
8
  * ## 无障碍键盘操作指南
10
9
  * | 按键 | 说明 |
@@ -26,25 +25,20 @@ const classnames_1 = tslib_1.__importDefault(require("classnames"));
26
25
  const utils_1 = require("../utils");
27
26
  const icon_1 = require("../icon");
28
27
  const Button = (0, react_1.forwardRef)((props, ref) => {
29
- const { className, size = 'small', icon, type, children } = props, rest = tslib_1.__rest(props, ["className", "size", "icon", "type", "children"]);
30
- const iconNode = (0, icon_1.renderCommonIcon)(icon, 'xs');
31
- const getChatButtonType = (type) => {
32
- if (type === 'secondary') {
33
- return 'normal';
34
- }
35
- if (type === 'normal') {
36
- return 'secondary';
37
- }
38
- return type;
28
+ const { className, size = 'small', icon, type = 'primary', children, text } = props, rest = tslib_1.__rest(props, ["className", "size", "icon", "type", "children", "text"]);
29
+ // 根据按钮大小设置对应的图标尺寸
30
+ const iconSizeMap = {
31
+ small: 'xs',
32
+ medium: 'xs',
33
+ large: 'small'
39
34
  };
40
- // 目前会把secondary和text都设置为normal, 后续如果需要区分,需要后端配合
41
- const validType = getChatButtonType(type);
42
- return (react_1.default.createElement(next_1.Button, Object.assign({}, rest, { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}button ${size} ${type}`, className), size: size, type: validType, ref: ref }),
35
+ const iconNode = (0, icon_1.renderCommonIcon)(icon, iconSizeMap[size]);
36
+ // 文字按钮,只有 Primary 类型
37
+ const buttonType = text ? 'primary' : type;
38
+ return (react_1.default.createElement(next_1.Button, Object.assign({}, rest, { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}button`, size, buttonType, {
39
+ [`${utils_1.PREFIX_DEFAULT}button-with-icon`]: !!icon || rest.loading
40
+ }, className), size: size, type: buttonType, ref: ref, text: text }),
43
41
  iconNode,
44
42
  children));
45
43
  });
46
- // const ButtonWithSub = assignSubComponent(Button, {
47
- // displayName: 'Button',
48
- // });
49
- // export * from './types';
50
44
  exports.default = next_1.ConfigProvider.config(Button);