@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,316 @@
1
+ @import './_var.scss';
2
+
3
+ @import '../../mixins/reset.scss';
4
+
5
+ .#{$prefix}-tag {
6
+ @include reset;
7
+
8
+ display: inline-flex;
9
+ align-items: center;
10
+ flex-direction: row;
11
+ padding: $tag-medium-padding;
12
+ height: $tag-height-medium;
13
+ font: $tag-medium-font;
14
+ color: $tag-text-color;
15
+ border-radius: $tag-border-radius-square;
16
+ border: $tag-default-border-width solid $tag-default-border-color;
17
+ white-space: nowrap;
18
+
19
+ .t-icon {
20
+ margin-right: $tag-icon-margin-right;
21
+ width: $tag-icon-size;
22
+ height: $tag-icon-size;
23
+ flex-shrink: 0;
24
+ }
25
+
26
+ .#{$prefix}-tag__icon-close {
27
+ margin-right: 0;
28
+ margin-left: $tag-close-icon-margin-right;
29
+ font: $tag-large-font;
30
+ cursor: pointer;
31
+ transition: color $anim-duration-base $anim-time-fn-easing;
32
+ }
33
+
34
+ &--default {
35
+ color: $tag-default-text-color;
36
+ background-color: $tag-default-background-color;
37
+
38
+ .#{$prefix}-tag__icon-close {
39
+ color: $tag-close-icon-color;
40
+
41
+ &:hover {
42
+ color: $tag-close-icon-hover-color;
43
+ }
44
+ }
45
+
46
+ &:active {
47
+ cursor: default;
48
+ }
49
+
50
+ // 失效标签
51
+ &.#{$prefix}-tag--disabled {
52
+ color: $tag-disabled-color;
53
+ background-color: $tag-disabled-bg;
54
+ border-color: $component-border;
55
+ cursor: not-allowed;
56
+
57
+ &:hover {
58
+ cursor: not-allowed;
59
+ }
60
+
61
+ .t-icon {
62
+ &:hover {
63
+ cursor: pointer;
64
+ }
65
+ }
66
+ }
67
+
68
+ &.#{$prefix}-tag--outline {
69
+ border-color: $tag-outline-default-border-color;
70
+ }
71
+
72
+ &.#{$prefix}-tag--light {
73
+ background-color: $tag-default-color-light;
74
+ }
75
+
76
+ &.#{$prefix}-tag--light-outline {
77
+ border-color: $tag-outline-default-border-color;
78
+ background-color: $tag-default-color-light;
79
+ }
80
+ }
81
+
82
+ &--primary {
83
+ background-color: $tag-primary-color;
84
+
85
+ &.#{$prefix}-tag--outline {
86
+ border-color: $tag-outline-primary-border-color;
87
+ }
88
+
89
+ &.#{$prefix}-tag--light {
90
+ background-color: $tag-primary-color-light;
91
+ }
92
+
93
+ &.#{$prefix}-tag--light-outline {
94
+ border-color: $tag-outline-primary-border-color;
95
+ background-color: $tag-primary-color-light;
96
+ }
97
+
98
+ &.#{$prefix}-tag--light,
99
+ &.#{$prefix}-tag--outline,
100
+ &.#{$prefix}-tag--light-outline {
101
+ color: $tag-primary-color;
102
+
103
+ .#{$prefix}-tag__icon-close {
104
+ &:hover {
105
+ color: $brand-color-hover;
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ &--success {
112
+ background-color: $tag-success-color;
113
+
114
+ &.#{$prefix}-tag--outline {
115
+ border-color: $tag-outline-success-border-color;
116
+ }
117
+
118
+ &.#{$prefix}-tag--light {
119
+ background-color: $tag-success-color-light;
120
+ }
121
+
122
+ &.#{$prefix}-tag--light-outline {
123
+ border-color: $tag-outline-success-border-color;
124
+ background-color: $tag-success-color-light;
125
+ }
126
+
127
+ &.#{$prefix}-tag--light,
128
+ &.#{$prefix}-tag--outline,
129
+ &.#{$prefix}-tag--light-outline {
130
+ color: $tag-success-color;
131
+
132
+ .#{$prefix}-tag__icon-close {
133
+ &:hover {
134
+ color: $success-color-hover;
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ &--warning {
141
+ background-color: $tag-warning-color;
142
+
143
+ &.#{$prefix}-tag--outline {
144
+ border-color: $tag-outline-warning-border-color;
145
+ }
146
+
147
+ &.#{$prefix}-tag--light {
148
+ background-color: $tag-warning-color-light;
149
+ }
150
+
151
+ &.#{$prefix}-tag--light-outline {
152
+ border-color: $tag-outline-warning-border-color;
153
+ background-color: $tag-warning-color-light;
154
+ }
155
+
156
+ &.#{$prefix}-tag--light,
157
+ &.#{$prefix}-tag--outline,
158
+ &.#{$prefix}-tag--light-outline {
159
+ color: $tag-warning-color;
160
+
161
+ .#{$prefix}-tag__icon-close {
162
+ &:hover {
163
+ color: $warning-color-hover;
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ &--danger {
170
+ background-color: $tag-danger-color;
171
+
172
+ &.#{$prefix}-tag--outline {
173
+ border-color: $tag-outline-danger-border-color;
174
+ }
175
+
176
+ &.#{$prefix}-tag--light {
177
+ background-color: $tag-error-color-light;
178
+ }
179
+
180
+ &.#{$prefix}-tag--light-outline {
181
+ border-color: $tag-outline-danger-border-color;
182
+ background-color: $tag-error-color-light;
183
+ }
184
+
185
+ .#{$prefix}-tag__icon-close {
186
+ fill: $error-color;
187
+
188
+ &:hover {
189
+ fill: $error-color-hover;
190
+ }
191
+ }
192
+
193
+ &.#{$prefix}-tag--light,
194
+ &.#{$prefix}-tag--outline,
195
+ &.#{$prefix}-tag--light-outline {
196
+ color: $tag-danger-color;
197
+
198
+ .#{$prefix}-tag__icon-close {
199
+ &:hover {
200
+ color: $error-color-hover;
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ &--dark:not(.#{$prefix}-tag--default) {
207
+ .#{$prefix}-tag__icon-close {
208
+ color: $tag-close-icon-color--dark;
209
+
210
+ &:hover {
211
+ color: $tag-close-icon-hover-color--dark;
212
+ }
213
+ }
214
+ }
215
+
216
+ &.#{$prefix}-tag--outline {
217
+ background: transparent;
218
+ }
219
+
220
+ &.#{$prefix}-size-s {
221
+ padding: $tag-small-padding;
222
+ height: $tag-height-small;
223
+ font: $tag-small-font;
224
+
225
+ .t-icon {
226
+ font-size: $tag-small-font;
227
+ }
228
+ }
229
+
230
+ &.#{$prefix}-size-l {
231
+ padding: $tag-large-padding;
232
+ height: $tag-height-large;
233
+ font: $tag-large-font;
234
+
235
+ .t-icon {
236
+ font: $tag-large-font;
237
+ }
238
+ }
239
+
240
+ &.#{$prefix}-tag--round {
241
+ border-radius: $tag-border-radius-round;
242
+ }
243
+
244
+ &.#{$prefix}-tag--mark {
245
+ border-radius: 0 $tag-border-radius-round $tag-border-radius-round 0;
246
+ }
247
+
248
+ &.#{$prefix}-tag--ellipsis {
249
+ .#{$prefix}-tag--text {
250
+ display: inline-block;
251
+ // @include text-ellipsis();
252
+ }
253
+ }
254
+ }
255
+
256
+ .#{$prefix}-tag.#{$prefix}-tag--check:not(.#{$prefix}-tag--disabled) {
257
+ transition: background-color $anim-duration-base $anim-time-fn-easing;
258
+ cursor: pointer;
259
+
260
+ &.#{$prefix}-tag--default.#{$prefix}-tag--dark:not(.#{$prefix}-tag--checked) {
261
+ &:hover {
262
+ background-color: $tag-grey-hover-color;
263
+ }
264
+ }
265
+
266
+ &.#{$prefix}-tag--primary.#{$prefix}-tag--dark.#{$prefix}-tag--checked {
267
+ &:hover {
268
+ background-color: $tag-default-hover-color;
269
+ }
270
+ }
271
+
272
+ &.#{$prefix}-tag--default.#{$prefix}-tag--outline:not(
273
+ .#{$prefix}-tag--checked
274
+ ) {
275
+ &:hover {
276
+ color: $tag-grey-outline-hover-color;
277
+ }
278
+ }
279
+ }
280
+
281
+ .#{$prefix}-tag--check.#{$prefix}-tag--disabled.#{$prefix}-tag--primary {
282
+ &.#{$prefix}-tag--dark {
283
+ background-color: $tag-default-disabled-color;
284
+ cursor: not-allowed;
285
+ }
286
+
287
+ &.#{$prefix}-tag--outline {
288
+ color: $tag-disabled-color;
289
+ background-color: $tag-grey-outline-disabled-color;
290
+ border-color: $tag-disabled-color;
291
+ cursor: not-allowed;
292
+ }
293
+ }
294
+
295
+ .#{$prefix}-check-tag-group {
296
+ .#{$prefix}-tag:not(:last-child) {
297
+ margin-right: $check-tag-margin-left;
298
+ }
299
+ }
300
+
301
+ a {
302
+ .#{$prefix}-tag {
303
+ cursor: pointer;
304
+ transition: all $anim-duration-base linear;
305
+
306
+ &:hover {
307
+ color: $link-tag-hover-color;
308
+ background-color: $link-tag-hover-bg;
309
+ }
310
+
311
+ &:active {
312
+ color: $link-tag-active-color;
313
+ background-color: $link-tag-active-bg;
314
+ }
315
+ }
316
+ }
@@ -0,0 +1,85 @@
1
+ // <component>-[type]-[attrtype]-<attr>-[status]
2
+ @import '../../vars.scss';
3
+ // checked [false - default; true - primary]
4
+ $tag-default-background-color: $bg-color-component;
5
+ $tag-default-border-color: transparent;
6
+ $tag-default-hover-color: $brand-color-hover;
7
+ $tag-default-click-color: $brand-color-active;
8
+ $tag-default-disabled-color: $brand-color-disabled;
9
+ $tag-checked-color: $text-color-anti;
10
+ $tag-checked-background-color: $brand-color;
11
+ $tag-check-hover-bg: $bg-color-component-hover;
12
+ $tag-checked-hover-bg: $brand-color-hover;
13
+ $tag-default-click-bg: $bg-color-component-active;
14
+
15
+ $tag-grey-hover-color: $bg-color-component-hover;
16
+ $tag-grey-outline-disabled-color: $bg-color-component-disabled;
17
+ $tag-grey-outline-hover-color: $brand-color-hover;
18
+
19
+ // disabled
20
+ $tag-disabled-color: $text-color-disabled;
21
+ $tag-disabled-bg: $bg-color-component-disabled;
22
+
23
+ // dark color
24
+ $tag-primary-color: $brand-color;
25
+ $tag-success-color: $success-color;
26
+ $tag-warning-color: $warning-color;
27
+ $tag-danger-color: $error-color;
28
+
29
+ // light color
30
+ $tag-default-color-light: $bg-color-secondarycontainer;
31
+ $tag-primary-color-light: $brand-color-light;
32
+ $tag-success-color-light: $success-color-light;
33
+ $tag-warning-color-light: $warning-color-light;
34
+ $tag-error-color-light: $error-color-light;
35
+
36
+ // border
37
+ $tag-outline-default-border-color: $component-border;
38
+ $tag-outline-primary-border-color: $tag-primary-color;
39
+ $tag-outline-success-border-color: $tag-success-color;
40
+ $tag-outline-warning-border-color: $tag-warning-color;
41
+ $tag-outline-danger-border-color: $tag-danger-color;
42
+
43
+ // font size
44
+ $tag-small-font: $font-body-small;
45
+ $tag-medium-font: $font-body-small;
46
+ $tag-large-font: $font-body-medium;
47
+
48
+ // padding
49
+ $tag-small-padding: 0px $comp-paddingLR-xs;
50
+ $tag-medium-padding: 0px $comp-paddingLR-s;
51
+ $tag-large-padding: 0px $comp-paddingLR-m;
52
+
53
+ // text color
54
+ $tag-text-color: $text-color-anti;
55
+ $tag-default-text-color: $text-color-primary;
56
+
57
+ // shape
58
+ $tag-border-radius-square: $border-radius-default;
59
+ $tag-border-radius-round: $border-radius-extraLarge;
60
+
61
+ // width
62
+ $tag-default-border-width: 1px;
63
+
64
+ // height
65
+ $tag-height-small: $comp-size-xxs;
66
+ $tag-height-medium: $comp-size-xs;
67
+ $tag-height-large: $comp-size-m;
68
+
69
+ // icon
70
+ $tag-icon-size: calc($font-size-base + 2px);
71
+ $tag-close-icon-color: $text-color-placeholder;
72
+ $tag-close-icon-hover-color: $text-color-primary;
73
+ $tag-close-icon-color--dark: $font-white-2;
74
+ $tag-close-icon-hover-color--dark: $font-white-1;
75
+
76
+ // link
77
+ $link-tag-hover-bg: $bg-color-component-hover;
78
+ $link-tag-hover-color: $brand-color;
79
+ $link-tag-active-bg: $bg-color-component-active;
80
+ $link-tag-active-color: $brand-color-active;
81
+
82
+ // margin
83
+ $tag-icon-margin-right: $comp-margin-xs;
84
+ $tag-close-icon-margin-right: $comp-margin-s;
85
+ $check-tag-margin-left: $comp-margin-s;
@@ -0,0 +1,163 @@
1
+ @import '../../_vars.scss';
2
+ @import './_vars.scss';
3
+ @import '../../utilities/_animation.scss';
4
+
5
+ @import '../../mixins/_reset.scss';
6
+ @import '../../mixins/_scrollbar.scss';
7
+
8
+ .#{$prefix}-tag-input {
9
+ @include reset;
10
+
11
+ .#{$prefix}-tag {
12
+ vertical-align: middle;
13
+ animation: t-fade-in $anim-duration-base ease-in-out;
14
+ margin: 3px $comp-margin-xs 3px 0;
15
+ }
16
+
17
+ .#{$prefix}-tag-input__drag_wrapper + .#{$prefix}-tag-input__drag_wrapper {
18
+ margin-left: $comp-margin-xs;
19
+ }
20
+
21
+ .#{$prefix}-input {
22
+ overflow: hidden;
23
+ min-height: $tag-input-height-default;
24
+ height: fit-content;
25
+ padding: 0 $comp-paddingLR-s 0 $comp-margin-xs;
26
+ @include t-input-suffix-icon($comp-margin-s);
27
+
28
+ &.#{$prefix}-size-s {
29
+ padding: 0 $comp-paddingLR-s 0 $comp-margin-xs;
30
+ min-height: $tag-input-height-s;
31
+ .#{$prefix}-tag {
32
+ margin: 1px $comp-margin-xs 1px 0;
33
+ }
34
+ }
35
+
36
+ &.#{$prefix}-size-l {
37
+ min-height: $tag-input-height-l;
38
+ padding: 0 $comp-paddingLR-m 0 $comp-margin-s;
39
+ @include t-input-suffix-icon($comp-margin-m);
40
+ }
41
+ }
42
+
43
+ /** 设计稿:未填充标签场景,边距和已填充不同 */
44
+ &.#{$prefix}-is-empty {
45
+ .#{$prefix}-input__inner {
46
+ margin-left: $comp-margin-xs;
47
+ }
48
+ }
49
+
50
+ &:hover,
51
+ .#{$prefix}-input--focused {
52
+ .#{$prefix}-input__inner:not(.#{$prefix}-input--soft-hidden) {
53
+ min-width: 20px;
54
+ }
55
+ }
56
+
57
+ .#{$prefix}-tag-input__prefix {
58
+ margin-left: $comp-margin-xs;
59
+ line-height: 1;
60
+
61
+ > .t-icon {
62
+ color: $text-color-placeholder;
63
+ }
64
+ }
65
+
66
+ .#{$prefix}-input .#{$prefix}-input__prefix:not(:empty) {
67
+ margin-right: 0;
68
+ }
69
+
70
+ &.#{$prefix}-input--auto-width {
71
+ .#{$prefix}-input.#{$prefix}-input--focused {
72
+ padding-right: $tag-input-clear-icon-padding-m;
73
+ }
74
+
75
+ .#{$prefix}-input__prefix {
76
+ white-space: nowrap;
77
+ }
78
+ }
79
+ .#{$prefix}-input__prefix--scrollable {
80
+ @include scrollbar();
81
+
82
+ overflow-y: hidden;
83
+ overflow-x: auto;
84
+ }
85
+ }
86
+
87
+ .#{$prefix}-tag-input__suffix-clear {
88
+ cursor: pointer;
89
+ }
90
+
91
+ .#{$prefix}-tag-input--drag-sort {
92
+ .#{$prefix}-input__prefix {
93
+ .#{$prefix}-tag {
94
+ cursor: move;
95
+ }
96
+ }
97
+ }
98
+
99
+ // 标签数量超出时,换行显示
100
+ .#{$prefix}-tag-input--break-line:not(.#{$prefix}-is-empty) {
101
+ .#{$prefix}-input {
102
+ display: block;
103
+
104
+ &.#{$prefix}-input--prefix > .#{$prefix}-input__prefix {
105
+ display: inline;
106
+ text-align: left;
107
+ }
108
+
109
+ .#{$prefix}-input__suffix-icon {
110
+ position: absolute;
111
+ bottom: 0;
112
+ }
113
+ }
114
+
115
+ .#{$prefix}-tag-input__prefix {
116
+ vertical-align: middle;
117
+ }
118
+ }
119
+
120
+ .#{$prefix}-tag-input__prefix {
121
+ width: max-content;
122
+ display: inline-block;
123
+ margin-right: $comp-margin-s;
124
+ }
125
+
126
+ /** 换行模式避免标签和右侧图标重合,需保留图标宽度 22px 和左侧距离标签间距 8px */
127
+ .#{$prefix}-tag-input--break-line.#{$prefix}-tag-input--with-tag:not(
128
+ .#{$prefix}-input--auto-width
129
+ ),
130
+ .#{$prefix}-tag-input.#{$prefix}-input--auto-width:hover {
131
+ .#{$prefix}-input {
132
+ padding-right: $tag-input-clear-icon-padding-m;
133
+ }
134
+
135
+ .#{$prefix}-size-l {
136
+ .#{$prefix}-input {
137
+ padding-right: $tag-input-clear-icon-padding-l;
138
+ }
139
+ }
140
+ }
141
+
142
+ /** auto-width 模式,左右边距相同 */
143
+ .#{$prefix}-tag-input.#{$prefix}-input--auto-width {
144
+ .#{$prefix}-input {
145
+ padding-right: 0;
146
+ }
147
+ }
148
+
149
+ /** max-rows模式,限制最大高度 */
150
+ .#{$prefix}-tag-input--max-rows {
151
+ .#{$prefix}-input {
152
+ &.#{$prefix}-size-s {
153
+ max-height: calc(var(--max-rows, 1) * $tag-input-height-s);
154
+ }
155
+
156
+ &.#{$prefix}-size-l {
157
+ max-height: calc(var(--max-rows, 1) * ($tag-input-height-l - 2px));
158
+ }
159
+
160
+ max-height: calc(var(--max-rows, 1) * ($tag-input-height-default - 2px));
161
+ overflow-y: scroll;
162
+ }
163
+ }
@@ -0,0 +1,16 @@
1
+ $tag-input-height-s: $comp-size-xs;
2
+ $tag-input-height-default: $comp-size-m;
3
+ $tag-input-height-l: $comp-size-xl;
4
+
5
+ $tag-input-padding-default: calc($comp-margin-xs - 1px);
6
+
7
+ $tag-input-clear-icon-padding-m: calc(
8
+ $comp-paddingLR-xxl + $comp-paddingLR-xxs
9
+ );
10
+ $tag-input-clear-icon-padding-l: calc($comp-paddingLR-xxl + $comp-paddingLR-xs);
11
+
12
+ @mixin t-input-suffix-icon($distance) {
13
+ .#{$prefix}-input__suffix-icon {
14
+ right: $distance;
15
+ }
16
+ }