@tendaui/components 1.0.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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +176 -0
  3. package/alert/Alert.tsx +147 -0
  4. package/alert/defaultProps.ts +3 -0
  5. package/alert/index.ts +9 -0
  6. package/alert/style/css.js +1 -0
  7. package/alert/style/index.js +1 -0
  8. package/alert/type.ts +44 -0
  9. package/badge/Badge.tsx +85 -0
  10. package/badge/defaultProps.ts +10 -0
  11. package/badge/index.ts +9 -0
  12. package/badge/style/css.js +1 -0
  13. package/badge/style/index.js +1 -0
  14. package/badge/type.ts +51 -0
  15. package/button/Button.tsx +95 -0
  16. package/button/defaultProps.ts +13 -0
  17. package/button/index.ts +7 -0
  18. package/button/style/css.js +1 -0
  19. package/button/style/index.js +1 -0
  20. package/button/type.ts +82 -0
  21. package/checkbox/Checkbox.tsx +19 -0
  22. package/checkbox/CheckboxGroup.tsx +207 -0
  23. package/checkbox/defaultProps.ts +14 -0
  24. package/checkbox/index.ts +10 -0
  25. package/checkbox/style/css.js +1 -0
  26. package/checkbox/style/index.js +1 -0
  27. package/checkbox/type.ts +117 -0
  28. package/common/Check.tsx +131 -0
  29. package/common/FakeArrow.tsx +36 -0
  30. package/common/PluginContainer.tsx +21 -0
  31. package/common/Portal.tsx +67 -0
  32. package/common.ts +76 -0
  33. package/config-provider/ConfigContext.tsx +21 -0
  34. package/config-provider/ConfigProvider.tsx +53 -0
  35. package/config-provider/index.ts +9 -0
  36. package/config-provider/type.ts +1062 -0
  37. package/dialog/Dialog.tsx +254 -0
  38. package/dialog/DialogCard.tsx +152 -0
  39. package/dialog/defaultProps.ts +25 -0
  40. package/dialog/hooks/useDialogDrag.ts +50 -0
  41. package/dialog/hooks/useDialogEsc.ts +31 -0
  42. package/dialog/hooks/useDialogPosition.ts +36 -0
  43. package/dialog/hooks/useLockStyle.ts +54 -0
  44. package/dialog/index.ts +13 -0
  45. package/dialog/plugin.tsx +78 -0
  46. package/dialog/style/css.js +1 -0
  47. package/dialog/style/index.js +1 -0
  48. package/dialog/type.ts +241 -0
  49. package/dialog/utils.ts +4 -0
  50. package/form/Form.tsx +136 -0
  51. package/form/FormContext.tsx +64 -0
  52. package/form/FormItem.tsx +554 -0
  53. package/form/FormList.tsx +303 -0
  54. package/form/const.ts +6 -0
  55. package/form/defaultProps.ts +26 -0
  56. package/form/formModel.ts +117 -0
  57. package/form/hooks/interface.ts +20 -0
  58. package/form/hooks/useForm.ts +122 -0
  59. package/form/hooks/useFormItemInitialData.ts +95 -0
  60. package/form/hooks/useFormItemStyle.tsx +122 -0
  61. package/form/hooks/useInstance.tsx +275 -0
  62. package/form/hooks/useWatch.ts +42 -0
  63. package/form/index.ts +11 -0
  64. package/form/style/css.js +1 -0
  65. package/form/style/index.js +1 -0
  66. package/form/type.ts +519 -0
  67. package/form/utils/index.ts +69 -0
  68. package/hooks/useAttach.ts +24 -0
  69. package/hooks/useCommonClassName.ts +45 -0
  70. package/hooks/useConfig.ts +3 -0
  71. package/hooks/useControlled.ts +39 -0
  72. package/hooks/useDefaultProps.ts +16 -0
  73. package/hooks/useDomCallback.ts +13 -0
  74. package/hooks/useDomRefCallback.ts +12 -0
  75. package/hooks/useDragSorter.tsx +151 -0
  76. package/hooks/useEventCallback.ts +47 -0
  77. package/hooks/useGlobalConfig.ts +14 -0
  78. package/hooks/useGlobalIcon.ts +14 -0
  79. package/hooks/useLastest.ts +13 -0
  80. package/hooks/useLayoutEffect.ts +7 -0
  81. package/hooks/useMouseEvent.ts +142 -0
  82. package/hooks/useMutationObserver.ts +56 -0
  83. package/hooks/usePopper.ts +189 -0
  84. package/hooks/useRipple.ts +0 -0
  85. package/hooks/useSetState.ts +25 -0
  86. package/hooks/useVirtualScroll.ts +246 -0
  87. package/hooks/useWindowSize.ts +31 -0
  88. package/index.ts +70 -0
  89. package/input/Input.tsx +383 -0
  90. package/input/InputGroup.tsx +29 -0
  91. package/input/defaultProps.ts +22 -0
  92. package/input/index.ts +11 -0
  93. package/input/style/css.js +1 -0
  94. package/input/style/index.js +1 -0
  95. package/input/type.ts +219 -0
  96. package/loading/Gradient.tsx +36 -0
  97. package/loading/Loading.tsx +169 -0
  98. package/loading/circleAdapter.ts +44 -0
  99. package/loading/defaultProps.ts +12 -0
  100. package/loading/index.ts +13 -0
  101. package/loading/style/css.js +1 -0
  102. package/loading/style/index.js +1 -0
  103. package/loading/type.ts +71 -0
  104. package/loading/utils/setStyle.ts +13 -0
  105. package/myform/index.ts +0 -0
  106. package/notification/Notify.ts +24 -0
  107. package/notification/NotifyContainer.tsx +90 -0
  108. package/notification/NotifyContext.tsx +173 -0
  109. package/notification/NotifyItem.tsx +121 -0
  110. package/notification/index.ts +3 -0
  111. package/notification/style/css.js +1 -0
  112. package/notification/style/index.js +1 -0
  113. package/notification/type.ts +23 -0
  114. package/package.json +52 -0
  115. package/popup/Popup.tsx +264 -0
  116. package/popup/defaultProps.ts +13 -0
  117. package/popup/hooks/useTrigger.ts +276 -0
  118. package/popup/index.ts +6 -0
  119. package/popup/style/css.js +1 -0
  120. package/popup/style/index.js +1 -0
  121. package/popup/type.ts +130 -0
  122. package/portal/Portal.tsx +63 -0
  123. package/portal/index.ts +1 -0
  124. package/select/Option.tsx +162 -0
  125. package/select/OptionGroup.tsx +30 -0
  126. package/select/PopupContent.tsx +271 -0
  127. package/select/Select.tsx +586 -0
  128. package/select/defaultProps.ts +27 -0
  129. package/select/hooks/useOptions.ts +120 -0
  130. package/select/hooks/usePanelVirtualScroll.ts +111 -0
  131. package/select/index.ts +9 -0
  132. package/select/style/css.js +1 -0
  133. package/select/style/index.js +2 -0
  134. package/select/type.ts +382 -0
  135. package/select/utils/helper.ts +256 -0
  136. package/select-input/SelectInput.tsx +98 -0
  137. package/select-input/defaultProps.ts +15 -0
  138. package/select-input/hook/useMultiple.tsx +100 -0
  139. package/select-input/hook/useOverlayInnerStyle.ts +84 -0
  140. package/select-input/hook/useSingle.tsx +112 -0
  141. package/select-input/index.ts +6 -0
  142. package/select-input/interface.ts +18 -0
  143. package/select-input/style/css.js +1 -0
  144. package/select-input/style/index.js +1 -0
  145. package/select-input/type.ts +280 -0
  146. package/space/defaultProps.ts +0 -0
  147. package/space/index.ts +0 -0
  148. package/space/type.ts +0 -0
  149. package/style/index.js +2 -0
  150. package/styles/_global.scss +39 -0
  151. package/styles/_vars.scss +386 -0
  152. package/styles/components/alert/_index.scss +175 -0
  153. package/styles/components/alert/_vars.scss +39 -0
  154. package/styles/components/badge/_index.scss +70 -0
  155. package/styles/components/badge/_vars.scss +25 -0
  156. package/styles/components/button/_index.scss +511 -0
  157. package/styles/components/button/_mixins.scss +39 -0
  158. package/styles/components/button/_vars.scss +122 -0
  159. package/styles/components/checkbox/_index.scss +158 -0
  160. package/styles/components/checkbox/_mixin.scss +0 -0
  161. package/styles/components/checkbox/_var.scss +60 -0
  162. package/styles/components/dialog/_animate.scss +135 -0
  163. package/styles/components/dialog/_index.scss +311 -0
  164. package/styles/components/dialog/_mixins.scss +0 -0
  165. package/styles/components/dialog/_vars.scss +59 -0
  166. package/styles/components/form/_index.scss +174 -0
  167. package/styles/components/form/_mixins.scss +76 -0
  168. package/styles/components/form/_vars.scss +100 -0
  169. package/styles/components/input/_index.scss +349 -0
  170. package/styles/components/input/_map.scss +0 -0
  171. package/styles/components/input/_mixins.scss +116 -0
  172. package/styles/components/input/_vars.scss +134 -0
  173. package/styles/components/loading/_index.scss +112 -0
  174. package/styles/components/loading/_vars.scss +39 -0
  175. package/styles/components/notification/_index.scss +160 -0
  176. package/styles/components/notification/_mixins.scss +12 -0
  177. package/styles/components/notification/_vars.scss +59 -0
  178. package/styles/components/popup/_index.scss +82 -0
  179. package/styles/components/popup/_mixin.scss +149 -0
  180. package/styles/components/popup/_var.scss +31 -0
  181. package/styles/components/select/_index.scss +290 -0
  182. package/styles/components/select/_var.scss +65 -0
  183. package/styles/components/select-input/_index.scss +5 -0
  184. package/styles/components/select-input/_var.scss +3 -0
  185. package/styles/components/switch/_index.scss +279 -0
  186. package/styles/components/switch/_mixins.scss +0 -0
  187. package/styles/components/switch/_vars.scss +61 -0
  188. package/styles/components/tag/_index.scss +316 -0
  189. package/styles/components/tag/_var.scss +85 -0
  190. package/styles/components/tag-input/_index.scss +163 -0
  191. package/styles/components/tag-input/_vars.scss +16 -0
  192. package/styles/globals.css +250 -0
  193. package/styles/mixins/_focus.scss +7 -0
  194. package/styles/mixins/_layout.scss +32 -0
  195. package/styles/mixins/_reset.scss +10 -0
  196. package/styles/mixins/_scrollbar.scss +31 -0
  197. package/styles/mixins/_text.scss +48 -0
  198. package/styles/rillple.css +16 -0
  199. package/styles/scrollbar.css +42 -0
  200. package/styles/themes/_dark.scss +191 -0
  201. package/styles/themes/_font.scss +79 -0
  202. package/styles/themes/_index.scss +5 -0
  203. package/styles/themes/_light.scss +190 -0
  204. package/styles/themes/_radius.scss +9 -0
  205. package/styles/themes/_size.scss +68 -0
  206. package/styles/themes.css +66 -0
  207. package/styles/utilities/_animation.scss +57 -0
  208. package/styles/utilities/_tips.scss +9 -0
  209. package/switch/Switch.tsx +120 -0
  210. package/switch/defaultProps.ts +3 -0
  211. package/switch/index.ts +7 -0
  212. package/switch/style/css.js +1 -0
  213. package/switch/style/index.js +1 -0
  214. package/switch/type.ts +46 -0
  215. package/tag/Tag.tsx +149 -0
  216. package/tag/defaultProps.ts +19 -0
  217. package/tag/index.ts +8 -0
  218. package/tag/style/css.js +1 -0
  219. package/tag/style/index.js +1 -0
  220. package/tag/type.ts +170 -0
  221. package/tag-input/TagInput.tsx +215 -0
  222. package/tag-input/defaultProps.ts +15 -0
  223. package/tag-input/hooks/useHover.ts +28 -0
  224. package/tag-input/hooks/useTagList.tsx +131 -0
  225. package/tag-input/hooks/useTagScroll.ts +105 -0
  226. package/tag-input/index.ts +9 -0
  227. package/tag-input/style/css.js +1 -0
  228. package/tag-input/style/index.js +1 -0
  229. package/tag-input/type.ts +224 -0
  230. package/tag-input/useTagList.tsx +131 -0
  231. package/utils/composeRefs.ts +14 -0
  232. package/utils/dom.ts +29 -0
  233. package/utils/forwardRefWithStatics.ts +12 -0
  234. package/utils/getScrollbarWidth.ts +11 -0
  235. package/utils/helper.ts +161 -0
  236. package/utils/isFragment.ts +22 -0
  237. package/utils/listener.ts +37 -0
  238. package/utils/noop.ts +3 -0
  239. package/utils/parentTNode.ts +38 -0
  240. package/utils/parseTNode.ts +38 -0
  241. package/utils/react-render.ts +108 -0
  242. package/utils/ref.ts +6 -0
  243. package/utils/refs.ts +81 -0
  244. package/utils/style.ts +60 -0
  245. package/utils/transition.ts +28 -0
@@ -0,0 +1,349 @@
1
+ @import './_vars.scss';
2
+ @import './_mixins.scss';
3
+ @import '../../mixins/_text.scss';
4
+ @import './_map.scss';
5
+
6
+ @import '../../mixins/_reset.scss';
7
+ @import '../../utilities/_tips.scss';
8
+
9
+ .#{$prefix}-input {
10
+ @include reset;
11
+ @include input-status(success);
12
+ @include input-status(warning);
13
+ @include input-status(error);
14
+ width: 100%;
15
+ position: relative;
16
+ box-sizing: border-box;
17
+ height: $input-height-default;
18
+ @include input-base;
19
+
20
+ // borderless mode
21
+ &--borderless:not(&--focused) {
22
+ border-color: transparent;
23
+ transition: $input-inner-transition;
24
+
25
+ &:hover {
26
+ border-color: $component-border;
27
+ background-color: $bg-color-container-hover;
28
+ cursor: pointer;
29
+ }
30
+
31
+ &.#{$prefix}-is-disabled {
32
+ border: none;
33
+ background-color: $input-bg-color-disabled;
34
+ }
35
+ }
36
+
37
+ &--focused {
38
+ border-color: $input-border-color-default-focus;
39
+ box-shadow: $input-box-shadow-focus;
40
+ z-index: 1;
41
+ }
42
+
43
+ :focus-visible {
44
+ outline: none;
45
+ }
46
+
47
+ // 真正的输入框
48
+ &__inner {
49
+ flex: 1;
50
+ border: none;
51
+ outline: none;
52
+ padding: 0;
53
+ max-width: 100%;
54
+ min-width: 0;
55
+ color: $input-text-color-default;
56
+ font: inherit;
57
+ background-color: transparent;
58
+ box-sizing: border-box;
59
+ @include text-ellipsis;
60
+
61
+ &::placeholder {
62
+ color: $input-placeholder-color;
63
+ }
64
+
65
+ &:placeholder-shown {
66
+ text-overflow: ellipsis;
67
+ width: 100%;
68
+ }
69
+
70
+ // 隐藏Edge浏览器默认的密码框样式
71
+ &[type='password']::-ms-reveal {
72
+ display: none;
73
+ }
74
+
75
+ &[type='search']::-webkit-search-decoration,
76
+ &[type='search']::-webkit-search-cancel-button,
77
+ &[type='search']::-webkit-search-results-button,
78
+ &[type='search']::-webkit-search-results-decoration {
79
+ appearance: none;
80
+ }
81
+
82
+ &.#{$prefix}-input--soft-hidden {
83
+ width: 0;
84
+ }
85
+ }
86
+
87
+ // 底部的额外消息
88
+ &__extra {
89
+ font: $input-extra-font;
90
+ color: $input-extra-color-default;
91
+ }
92
+
93
+ // 输入框后面的状态图标
94
+ &__status {
95
+ position: absolute;
96
+ right: $input-status-position-right;
97
+ top: 0;
98
+ }
99
+
100
+ &.#{$prefix}-input--suffix > span.#{$prefix}-input__clear {
101
+ opacity: 0;
102
+ visibility: hidden;
103
+ transition: $input-inner-transition;
104
+ }
105
+
106
+ &.#{$prefix}-input--suffix:hover > span.#{$prefix}-input__clear {
107
+ opacity: 1;
108
+ visibility: visible;
109
+ }
110
+
111
+ // 输入框状态
112
+
113
+ @include input-readonly;
114
+ @include input-disabled;
115
+
116
+ // 输入框的前置、后置图标
117
+ @include input-fix-position(prefix);
118
+ @include input-fix-position(suffix);
119
+
120
+ .#{$prefix}-input__suffix-clear {
121
+ cursor: pointer;
122
+ width: 1em;
123
+ height: 1em;
124
+ }
125
+
126
+ // 输入框大小
127
+ &.#{$prefix}-size-l {
128
+ height: $input-height-l;
129
+ font: $input-font-l;
130
+ padding: $input-padding-l;
131
+ }
132
+
133
+ &.#{$prefix}-size-s {
134
+ height: $input-height-s;
135
+ font: $input-font-s;
136
+ }
137
+
138
+ .#{$prefix}-input__prefix,
139
+ .#{$prefix}-input__suffix {
140
+ > .t-icon {
141
+ font-size: $input-inner-icon-font-size;
142
+ }
143
+ }
144
+
145
+ .#{$prefix}-input__prefix {
146
+ > .t-icon {
147
+ color: $input-inner-prefix-icon-color;
148
+ }
149
+
150
+ &:not(:empty) {
151
+ margin-right: $comp-margin-s;
152
+ }
153
+ }
154
+
155
+ .#{$prefix}-input__suffix {
156
+ > .t-icon {
157
+ color: $input-inner-suffix-icon-color;
158
+ transition: all $anim-duration-base linear;
159
+
160
+ &:hover {
161
+ color: $input-inner-suffix-icon-color-hover;
162
+ transition: all $anim-duration-base linear;
163
+ }
164
+ }
165
+
166
+ &:not(:empty) {
167
+ margin-left: $comp-margin-s;
168
+ }
169
+ }
170
+
171
+ // 输入框被聚焦
172
+ &.#{$prefix}-is-focused {
173
+ .#{$prefix}-input__prefix {
174
+ > .t-icon {
175
+ color: $input-border-color-default-focus;
176
+ }
177
+ }
178
+ .#{$prefix}-input__suffix {
179
+ // 特殊使用的 suffix icon
180
+ > .t-icon-time,
181
+ .t-icon-calendar {
182
+ color: $input-border-color-default-focus;
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ // 输入框组
189
+ .#{$prefix}-input-group {
190
+ position: relative;
191
+ display: inline-flex;
192
+ align-items: stretch;
193
+
194
+ .#{$prefix}-input__wrap {
195
+ border-radius: 0;
196
+
197
+ &:first-child {
198
+ border-radius: $input-border-radius 0 0 $input-border-radius;
199
+ }
200
+
201
+ &:last-child {
202
+ border-radius: 0 $border-radius-default $border-radius-default 0;
203
+ }
204
+ }
205
+
206
+ .#{$prefix}-button,
207
+ .#{$prefix}-select {
208
+ border-radius: 0;
209
+
210
+ &:not(:first-child) {
211
+ margin-left: $input-group-first-child-margin-left;
212
+ }
213
+ }
214
+
215
+ .#{$prefix}-input__wrap {
216
+ &:not(:first-child) {
217
+ .#{$prefix}-input {
218
+ margin-left: $input-group-first-child-margin-left;
219
+ }
220
+ }
221
+
222
+ &:first-child {
223
+ .#{$prefix}-input {
224
+ border-radius: $input-border-radius 0 0 $input-border-radius;
225
+ }
226
+ }
227
+
228
+ &:last-child {
229
+ .#{$prefix}-input {
230
+ border-radius: 0 $input-border-radius $input-border-radius 0;
231
+ }
232
+ }
233
+ }
234
+
235
+ .#{$prefix}-button,
236
+ .#{$prefix}-select {
237
+ &:first-child {
238
+ border-radius: $input-border-radius 0 0 $input-border-radius;
239
+ }
240
+
241
+ &:last-child {
242
+ border-radius: 0 $input-border-radius $input-border-radius 0;
243
+ }
244
+ }
245
+
246
+ &--separate {
247
+ .#{$prefix}-input__wrap + .#{$prefix}-input__wrap {
248
+ margin-left: $input-margin-distance-default;
249
+ }
250
+
251
+ .#{$prefix}-button,
252
+ .#{$prefix}-select {
253
+ border-radius: $input-border-radius;
254
+
255
+ &:first-child {
256
+ border-radius: $input-border-radius 0 0 $input-border-radius;
257
+ }
258
+
259
+ &:last-child {
260
+ border-radius: 0 $input-border-radius $input-border-radius 0;
261
+ }
262
+ }
263
+
264
+ .#{$prefix}-input__wrap {
265
+ .#{$prefix}-input {
266
+ border-radius: $input-border-radius;
267
+
268
+ &:first-child {
269
+ border-radius: $input-border-radius;
270
+ }
271
+
272
+ &:last-child {
273
+ border-radius: $input-border-radius;
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ .#{$prefix}-input__inner,
280
+ .#{$prefix}-button,
281
+ .#{$prefix}-select {
282
+ position: relative;
283
+ z-index: 0;
284
+
285
+ &:hover,
286
+ &:focus,
287
+ &:active {
288
+ z-index: 1;
289
+ }
290
+ }
291
+ }
292
+
293
+ .#{$prefix}-input__wrap {
294
+ width: 100%;
295
+ }
296
+
297
+ .#{$prefix}-input__tips {
298
+ height: auto;
299
+ min-height: $input-tips-min-height;
300
+ font: $input-tips-font;
301
+ position: absolute;
302
+ }
303
+
304
+ .#{$prefix}-input__tips--default {
305
+ color: $input-text-color-tips;
306
+ }
307
+
308
+ .#{$prefix}-input__tips--success {
309
+ color: $input-text-color-success;
310
+ }
311
+
312
+ .#{$prefix}-input__tips--warning {
313
+ color: $input-text-color-warning;
314
+ }
315
+
316
+ .#{$prefix}-input__tips--error {
317
+ color: $input-text-color-error;
318
+ }
319
+
320
+ .#{$prefix}-align-center > .#{$prefix}-input__inner {
321
+ text-align: center;
322
+ }
323
+
324
+ .#{$prefix}-align-right > .#{$prefix}-input__inner {
325
+ text-align: right;
326
+ }
327
+
328
+ .#{$prefix}-input__input-pre {
329
+ position: absolute;
330
+ visibility: hidden;
331
+ white-space: pre;
332
+ display: block;
333
+ }
334
+
335
+ .#{$prefix}-input--auto-width {
336
+ width: fit-content;
337
+ min-width: 60px;
338
+ }
339
+
340
+ // 字数限制数字
341
+ .#{$prefix}-input__limit-number {
342
+ font: $input-font;
343
+ color: $input-limit-color;
344
+ background: $input-bg-color-default;
345
+
346
+ &.#{$prefix}-is-disabled {
347
+ background: $input-bg-color-disabled;
348
+ }
349
+ }
File without changes
@@ -0,0 +1,116 @@
1
+ @import './_map.scss';
2
+
3
+ @mixin input-base() {
4
+ border-width: 1px;
5
+ border-style: solid;
6
+ border-radius: $input-border-radius;
7
+ border-color: $input-border-color-default;
8
+ padding: $input-padding-default;
9
+ background-color: $input-bg-color-default;
10
+ outline: none;
11
+ color: $input-text-color-default;
12
+ font: $input-font;
13
+ width: 100%;
14
+ box-sizing: border-box;
15
+ transition: $input-inner-transition;
16
+ display: flex;
17
+ align-items: center;
18
+ overflow: hidden;
19
+
20
+ &:hover {
21
+ border-color: $input-border-color-default-hover;
22
+ }
23
+
24
+ &:focus {
25
+ z-index: 1;
26
+ border-color: $input-border-color-default-focus;
27
+ box-shadow: $input-box-shadow-focus;
28
+ }
29
+ }
30
+
31
+ @mixin input-readonly {
32
+ &.#{$prefix}-is-readonly {
33
+ color: $input-text-color-readonly;
34
+ background-color: $input-bg-color-readonly;
35
+
36
+ .#{$prefix}-input__inner {
37
+ cursor: $input-cursor-readonly;
38
+ }
39
+ }
40
+ }
41
+
42
+ @mixin input-disabled {
43
+ &.#{$prefix}-is-disabled {
44
+ color: $input-text-color-disabled;
45
+ background-color: $input-bg-color-disabled;
46
+
47
+ &:hover {
48
+ border-color: $input-border-color-default;
49
+ }
50
+
51
+ .#{$prefix}-input__inner {
52
+ cursor: not-allowed;
53
+ color: $input-text-color-disabled;
54
+ text-overflow: initial;
55
+
56
+ &::placeholder {
57
+ color: $input-text-color-disabled;
58
+ }
59
+ }
60
+
61
+ & > .#{$prefix}-input__prefix,
62
+ & > .#{$prefix}-input__suffix {
63
+ .t-icon {
64
+ color: $input-text-color-disabled;
65
+
66
+ &:hover {
67
+ color: $input-text-color-disabled;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ // 状态样式:需要 map-get 或 #{} 来拼接变量名
75
+ @mixin input-status($status) {
76
+ &.#{$prefix}-is-#{$status} {
77
+ border-color: #000;
78
+
79
+ &:focus,
80
+ &.#{$prefix}-input--focused {
81
+ box-shadow: 0 0 0 2px #000;
82
+ }
83
+
84
+ & > .#{$prefix}-input__extra {
85
+ color: #000;
86
+ }
87
+ }
88
+ }
89
+
90
+ @mixin input-fix-position($position) {
91
+ &.#{$prefix}-input--#{$position} {
92
+ & > .#{$prefix}-input__#{$position} {
93
+ z-index: 2;
94
+ height: 100%;
95
+ text-align: center;
96
+ display: flex;
97
+ align-items: center;
98
+ }
99
+
100
+ & > .#{$prefix}-input__#{$position}-icon {
101
+ font-size: $font-size-l;
102
+ }
103
+
104
+ &.#{$prefix}-size-s {
105
+ .#{$prefix}-input__#{$position}-icon {
106
+ font-size: $font-size-base;
107
+ }
108
+ }
109
+
110
+ &.#{$prefix}-size-l {
111
+ .#{$prefix}-input__#{$position}-icon {
112
+ font-size: $font-size-xl;
113
+ }
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,134 @@
1
+ // 组件变量
2
+ // 名称可按如下规则定义:
3
+ // <component>-[type]-[attrtype]-<attr>-[status]
4
+
5
+ // component:组件名,如button,
6
+ // type: 组件类型,如 button 的次要按钮(line)
7
+ // attrtype: 属性的具体应用场景。如颜色,用于背景(bg)、文本(text)、边框(border)等
8
+ // attr: 属性名称,如color、height、radius等
9
+ // status: 表示组件状态或尺寸,如 hover、disabled、s、l 等
10
+
11
+ // 如:$button-line-bg-color-hover
12
+ // 如:$button-line-height-s
13
+
14
+ @import '../../_vars.scss';
15
+
16
+ // 颜色
17
+ $input-border-color-default: $border-level-2-color;
18
+ $input-border-color-default-hover: $brand-color;
19
+ $input-border-color-default-focus: $brand-color;
20
+ $input-border-color-success: $success-color;
21
+ $input-border-color-warning: $warning-color;
22
+ $input-border-color-error: $error-color;
23
+
24
+ $input-color: (
25
+ border: (
26
+ default: (
27
+ hover: $brand-color,
28
+ focus: $brand-color,
29
+ ),
30
+ success: $success-color,
31
+ warning: $warning-color,
32
+ error: $error-color,
33
+ ),
34
+ text: (
35
+ default: $text-color-primary,
36
+ success: $success-color,
37
+ warning: $warning-color,
38
+ error: $error-color,
39
+ readonly: $text-color-primary,
40
+ tips: $text-color-placeholder,
41
+ disabled: $text-color-disabled,
42
+ ),
43
+ bg-color: (
44
+ default: $text-color-placeholder,
45
+ readonly: $bg-color-specialcomponent,
46
+ disabled: $bg-color-component-disabled,
47
+ ),
48
+ extra: (
49
+ default: $text-color-placeholder,
50
+ success: $success-color,
51
+ warning: $warning-color,
52
+ error: $error-color,
53
+ ),
54
+ append: $bg-color-secondarycontainer-hover,
55
+ limit: $text-color-placeholder,
56
+ box-shadow: (
57
+ default: $brand-color-focus,
58
+ success: $success-color-focus,
59
+ warning: $warning-color-focus,
60
+ error: $error-color-focus,
61
+ ),
62
+ );
63
+
64
+ $input-text-color-success: $success-color;
65
+ $input-text-color-warning: $warning-color;
66
+ $input-text-color-error: $error-color;
67
+
68
+ $input-text-color-default: $text-color-primary;
69
+ $input-text-color-readonly: $text-color-primary;
70
+ $input-text-color-disabled: $text-color-disabled;
71
+ $input-text-color-tips: $text-color-placeholder;
72
+ $input-placeholder-color: $text-color-placeholder;
73
+
74
+ // input 输入框需要在浅色主题下有默认白色背景,而在暗色等其他主题下 transparent 适配背景色,因此不使用通用背景 token
75
+ $input-bg-color-default: $bg-color-specialcomponent;
76
+ $input-bg-color-readonly: $bg-color-specialcomponent;
77
+ $input-bg-color-disabled: $bg-color-component-disabled;
78
+
79
+ $input-extra-color-default: $text-color-placeholder;
80
+ $input-extra-color-success: $success-color;
81
+ $input-extra-color-warning: $warning-color;
82
+ $input-extra-color-error: $error-color;
83
+
84
+ $input-append-color: $bg-color-secondarycontainer-hover;
85
+
86
+ $input-limit-color: $text-color-placeholder;
87
+
88
+ // 位置
89
+ $input-fix-position: $spacer;
90
+
91
+ // 间距
92
+ $input-padding-l: $comp-paddingTB-m $comp-paddingLR-m;
93
+ $input-padding-default: 0 $comp-paddingLR-s;
94
+ $input-margin-distance-default: $comp-margin-xxxl;
95
+ $input-status-position-right: -24px;
96
+ $input-group-first-child-margin-left: -1px;
97
+
98
+ // 尺寸
99
+ $input-height-s: $comp-size-xs;
100
+ $input-height-default: $comp-size-m;
101
+ $input-height-l: $comp-size-xl;
102
+ $input-inner-icon-font-size: inherit;
103
+ $input-tips-min-height: $text-line-height-s;
104
+
105
+ // 图标
106
+ $input-inner-prefix-icon-color: $text-color-placeholder;
107
+ $input-inner-suffix-icon-color: $text-color-placeholder;
108
+ $input-inner-suffix-icon-color-hover: $text-color-secondary;
109
+
110
+ // 字号
111
+ $input-font-l: $font-body-large;
112
+ $input-font: $font-body-medium;
113
+ $input-font-s: $font-body-small;
114
+ $input-extra-font: $font-body-small;
115
+ $input-tips-font: $font-body-small;
116
+
117
+ // 边框
118
+ $input-border-radius: $border-radius-default;
119
+
120
+ // box
121
+ $input-box-shadow-color-default-focus: $brand-color-focus;
122
+ $input-box-shadow-color-success-focus: $success-color-focus;
123
+ $input-box-shadow-color-warning-focus: $warning-color-focus;
124
+ $input-box-shadow-color-error-focus: $error-color-focus;
125
+ $input-box-shadow-focus: 0 0 0 2px $input-box-shadow-color-default-focus;
126
+
127
+ // 动画
128
+ $input-inner-transition:
129
+ border $anim-time-fn-easing $anim-duration-base,
130
+ box-shadow $anim-time-fn-easing $anim-duration-base,
131
+ background-color $anim-time-fn-easing $anim-duration-base;
132
+
133
+ // 交互
134
+ $input-cursor-readonly: pointer;
@@ -0,0 +1,112 @@
1
+ @import '../../_vars.scss';
2
+
3
+ @import './_vars.scss';
4
+
5
+ @import '../../utilities/_animation.scss';
6
+
7
+ @import '../../mixins/_reset.scss';
8
+
9
+ .#{$prefix}-loading {
10
+ @include reset;
11
+
12
+ position: relative;
13
+ color: $loading-color;
14
+ font-size: $loading-icon-size;
15
+
16
+ &--lock {
17
+ overflow: hidden;
18
+ }
19
+
20
+ &.#{$prefix}-size-s {
21
+ font-size: $loading-icon-size-small;
22
+ }
23
+
24
+ &.#{$prefix}-size-l {
25
+ font-size: $loading-icon-size-large;
26
+ }
27
+
28
+ &__parent--relative {
29
+ position: relative !important;
30
+ }
31
+ }
32
+
33
+ .#{$prefix}-loading__fullscreen {
34
+ position: fixed;
35
+ top: 0;
36
+ left: 0;
37
+ width: 100%;
38
+ height: 100%;
39
+ z-index: $z-index-loading;
40
+ }
41
+
42
+ .#{$prefix}-loading--center {
43
+ display: inline-flex;
44
+ align-items: center;
45
+ vertical-align: middle;
46
+ justify-content: center;
47
+ }
48
+
49
+ .#{$prefix}-loading__content {
50
+ position: absolute;
51
+ left: 48%;
52
+ top: 20%;
53
+ }
54
+
55
+ .#{$prefix}-loading--inherit-color {
56
+ color: inherit;
57
+ }
58
+
59
+ .#{$prefix}-loading__parent {
60
+ position: relative;
61
+ }
62
+
63
+ .#{$prefix}-loading__overlay {
64
+ background-color: $loading-mask-color;
65
+ }
66
+
67
+ /** 仅用于作为包裹元素时 */
68
+ .#{$prefix}-loading--full {
69
+ position: absolute;
70
+ top: 0;
71
+ left: 0;
72
+ width: 100%;
73
+ height: 100%;
74
+ z-index: $z-index-loading;
75
+ }
76
+
77
+ .#{$prefix}-loading--hidden {
78
+ visibility: hidden;
79
+ }
80
+
81
+ .#{$prefix}-loading--visible {
82
+ visibility: visible;
83
+ }
84
+
85
+ .#{$prefix}-loading__text {
86
+ width: auto;
87
+ display: inline-block;
88
+ vertical-align: middle;
89
+ font: $loading-text-size;
90
+ margin-left: $loading-text-margin-left;
91
+ }
92
+
93
+ .#{$prefix}-loading__gradient {
94
+ display: inline-flex;
95
+ justify-content: center;
96
+ align-items: center;
97
+ vertical-align: middle;
98
+
99
+ &-conic {
100
+ width: 100%;
101
+ height: 100%;
102
+ border-radius: $border-radius-circle;
103
+ /* stylelint-disable-next-line color-no-hex */
104
+ background: conic-gradient(
105
+ from 90deg at 50% 50%,
106
+ #fff 0deg,
107
+ currentcolor 360deg
108
+ );
109
+ -webkit-mask: radial-gradient(transparent calc(50% - 0.5px), #fff 50%);
110
+ mask: radial-gradient(transparent calc(50% - 0.5px), #fff 50%);
111
+ }
112
+ }