@ew-color-picker/style 2.0.13 → 2.0.15

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.
package/src/index.scss CHANGED
@@ -3,6 +3,59 @@
3
3
  $prefix: "ew-" !default;
4
4
  // 基础样式 - 基于原版 ew-color-picker.min.css
5
5
 
6
+ // ============================================================
7
+ // 语义变量(--ewcp-*):宿主只需覆盖这里的核心变量即可换肤
8
+ // 默认值保持 2.x 现有视觉不变
9
+ // ============================================================
10
+ :root {
11
+ // 品牌色
12
+ --ewcp-color-primary: #4096ef;
13
+ --ewcp-color-primary-hover: #66b1ff;
14
+ --ewcp-color-success: #52c41a;
15
+ --ewcp-color-danger: #f56c6c;
16
+ --ewcp-color-warning: #faad14;
17
+ --ewcp-color-info: #909399;
18
+
19
+ // 文字
20
+ --ewcp-color-text: #303133;
21
+ --ewcp-color-text-secondary: #606266;
22
+ --ewcp-color-text-tertiary: #999;
23
+ --ewcp-color-text-disabled: #c0c4cc;
24
+
25
+ // 边框
26
+ --ewcp-color-border: #dcdfe6;
27
+ --ewcp-color-border-light: #e5e6eb;
28
+ --ewcp-color-border-hover: #c0c4cc;
29
+ --ewcp-color-border-focus: var(--ewcp-color-primary);
30
+
31
+ // 背景
32
+ --ewcp-color-bg: #fff;
33
+ --ewcp-color-bg-disabled: #f5f7fa;
34
+ --ewcp-color-bg-hover: #f0f8ff;
35
+ --ewcp-color-bg-secondary: #fafafa;
36
+
37
+ // 组件专用语义色
38
+ --ewcp-color-checkbox-border: #d9d9d9;
39
+ --ewcp-color-checkbox-disabled-bg: #f7f8fa;
40
+ --ewcp-color-checkbox-disabled-checked: #c8c9cc;
41
+
42
+ // 圆角
43
+ --ewcp-radius-sm: 3px;
44
+ --ewcp-radius-md: 4px;
45
+ --ewcp-radius-lg: 8px;
46
+
47
+ // 阴影与层级
48
+ --ewcp-shadow-popper: 0 4px 16px rgba(0, 0, 0, 0.12);
49
+ --ewcp-z-popper: 1000;
50
+ --ewcp-z-tooltip: 3000;
51
+ }
52
+
53
+ // 局部换肤作用域:把变量挂在选择器上即可只影响子树
54
+ .ewcp-scope,
55
+ .#{$prefix}color-picker {
56
+ // 允许宿主在局部作用域覆盖,这里不需要重复声明默认值
57
+ }
58
+
6
59
  // CSS 变量默认值(对应 panelMode: large),各尺寸档位在文件末尾覆盖
7
60
  :root {
8
61
  // 面板整体
@@ -510,12 +563,16 @@ $prefix: "ew-" !default;
510
563
  box-sizing: border-box;
511
564
  }
512
565
  .#{$prefix}color-picker-input:focus {
513
- border-color: #4096ef;
566
+ border-color: var(--ewcp-color-primary, #4096ef);
514
567
  }
515
568
 
516
569
 
517
570
  // 按钮
518
571
  .#{$prefix}color-picker-drop-btn {
572
+ display: inline-flex;
573
+ align-items: center;
574
+ justify-content: center;
575
+ gap: 4px;
519
576
  padding: var(--btn-padding);
520
577
  font-size: var(--btn-font-size);
521
578
  border-radius: var(--btn-radius);
@@ -530,7 +587,7 @@ $prefix: "ew-" !default;
530
587
 
531
588
  // 清空按钮
532
589
  .#{$prefix}color-picker-clear-btn {
533
- color: #4096ef;
590
+ color: var(--ewcp-color-primary, #4096ef);
534
591
  border-color: transparent;
535
592
  background-color: transparent;
536
593
  padding-left: 0;
@@ -547,8 +604,8 @@ $prefix: "ew-" !default;
547
604
  // 确定按钮悬停
548
605
  .#{$prefix}color-picker-sure-btn:active,
549
606
  .#{$prefix}color-picker-sure-btn:hover {
550
- border-color: #4096ef;
551
- color: #4096ef;
607
+ border-color: var(--ewcp-color-primary, #4096ef);
608
+ color: var(--ewcp-color-primary, #4096ef);
552
609
  }
553
610
 
554
611
  // 预定义颜色容器
@@ -608,7 +665,7 @@ $prefix: "ew-" !default;
608
665
  color: #666666;
609
666
  }
610
667
  .#{$prefix}color-picker-box:hover {
611
- border-color: #4096ef;
668
+ border-color: var(--ewcp-color-primary, #4096ef);
612
669
  box-shadow: 0 0 0 2px rgba(64,150,239,0.12);
613
670
  }
614
671
  .#{$prefix}color-picker-box.is-disabled {
@@ -619,12 +676,12 @@ $prefix: "ew-" !default;
619
676
 
620
677
  // 色块盒子悬停效果
621
678
  .#{$prefix}color-picker-box:hover {
622
- border-color: #4096ef;
679
+ border-color: var(--ewcp-color-primary, #4096ef);
623
680
  }
624
681
 
625
682
  // 色块盒子激活效果
626
683
  .#{$prefix}color-picker-box:active {
627
- border-color: #4096ef;
684
+ border-color: var(--ewcp-color-primary, #4096ef);
628
685
  box-shadow: 0 0 0 2px rgba(64, 150, 239, 0.2);
629
686
  }
630
687
 
@@ -1027,11 +1084,11 @@ $prefix: "ew-" !default;
1027
1084
  white-space: nowrap;
1028
1085
  }
1029
1086
  .#{$prefix}color-picker-eyedropper-btn:hover {
1030
- color: #4096ef;
1087
+ color: var(--ewcp-color-primary, #4096ef);
1031
1088
  border-color: #dcdfe6;
1032
1089
  }
1033
1090
  .#{$prefix}color-picker-eyedropper-btn:focus-visible {
1034
- border-color: #4096ef;
1091
+ border-color: var(--ewcp-color-primary, #4096ef);
1035
1092
  }
1036
1093
  .#{$prefix}color-picker-eyedropper-btn .#{$prefix}color-picker-icon {
1037
1094
  display: block;
@@ -1065,7 +1122,7 @@ $prefix: "ew-" !default;
1065
1122
  }
1066
1123
  .#{$prefix}color-picker-copy-btn:hover,
1067
1124
  .#{$prefix}color-picker-copy-btn:focus-visible {
1068
- border-color: #4096ef;
1125
+ border-color: var(--ewcp-color-primary, #4096ef);
1069
1126
  box-shadow: 0 0 0 2px rgba(64, 150, 239, 0.18);
1070
1127
  }
1071
1128
  .#{$prefix}color-picker-copy-btn:active {
@@ -1083,6 +1140,9 @@ $prefix: "ew-" !default;
1083
1140
  // 复制成功提示气泡
1084
1141
  .#{$prefix}color-picker-copy-tip {
1085
1142
  position: absolute;
1143
+ display: inline-flex;
1144
+ align-items: center;
1145
+ gap: 4px;
1086
1146
  left: calc(100% + 8px);
1087
1147
  top: 50%;
1088
1148
  padding: 3px 8px;
@@ -1183,7 +1243,7 @@ $prefix: "ew-" !default;
1183
1243
  outline: none;
1184
1244
  }
1185
1245
  .#{$prefix}gradient-text:focus {
1186
- border-color: #4096ef;
1246
+ border-color: var(--ewcp-color-primary, #4096ef);
1187
1247
  box-shadow: 0 0 0 2px rgba(64, 150, 239, 0.18);
1188
1248
  }
1189
1249
  .#{$prefix}gradient-btn {
@@ -1200,8 +1260,8 @@ $prefix: "ew-" !default;
1200
1260
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
1201
1261
  }
1202
1262
  .#{$prefix}gradient-btn:hover {
1203
- border-color: #4096ef;
1204
- color: #4096ef;
1263
+ border-color: var(--ewcp-color-primary, #4096ef);
1264
+ color: var(--ewcp-color-primary, #4096ef);
1205
1265
  }
1206
1266
  .#{$prefix}gradient-btn:active {
1207
1267
  transform: scale(0.94);
@@ -1712,4 +1772,83 @@ $prefix: "ew-" !default;
1712
1772
  .#{$prefix}color-picker-panel-mini .#{$prefix}gradient-row-stop > .#{$prefix}input-number > .#{$prefix}input-number__buttons {
1713
1773
  width: 14px;
1714
1774
  min-width: 14px;
1775
+ }
1776
+
1777
+ // ============================================================
1778
+ // 暗色主题:重定义语义变量即可,组件结构不变
1779
+ // 启用方式:<html data-theme="dark"> 或局部 class="ewcp-scope--dark"
1780
+ // ============================================================
1781
+ [data-theme="dark"],
1782
+ .ewcp-scope--dark {
1783
+ --ewcp-color-text: #e5e6eb;
1784
+ --ewcp-color-text-secondary: #c9cdd4;
1785
+ --ewcp-color-text-tertiary: #86909c;
1786
+ --ewcp-color-text-disabled: #6b6b6b;
1787
+ --ewcp-color-border: #3f3f46;
1788
+ --ewcp-color-border-light: #333338;
1789
+ --ewcp-color-border-hover: #52525b;
1790
+ --ewcp-color-bg: #1f1f23;
1791
+ --ewcp-color-bg-disabled: #2a2a30;
1792
+ --ewcp-color-bg-hover: #2f3640;
1793
+ --ewcp-color-bg-secondary: #26262b;
1794
+ --ewcp-color-checkbox-border: #4a4a52;
1795
+ --ewcp-color-checkbox-disabled-bg: #2a2a30;
1796
+ --ewcp-color-checkbox-disabled-checked: #4a4a52;
1797
+ --ewcp-shadow-popper: 0 4px 16px rgba(0, 0, 0, 0.45);
1798
+ }
1799
+
1800
+ // 面板与内部容器的暗色覆盖(历史硬编码背景的兜底)
1801
+ [data-theme="dark"] .#{$prefix}color-picker-panel-container,
1802
+ .ewcp-scope--dark .#{$prefix}color-picker-panel-container {
1803
+ background: var(--ewcp-color-bg);
1804
+ border-color: var(--ewcp-color-border-light);
1805
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
1806
+ }
1807
+ [data-theme="dark"] .#{$prefix}color-picker-input,
1808
+ [data-theme="dark"] .#{$prefix}color-picker-box,
1809
+ [data-theme="dark"] .#{$prefix}color-picker-sure-btn,
1810
+ [data-theme="dark"] .#{$prefix}color-picker-arrow-left,
1811
+ [data-theme="dark"] .#{$prefix}color-picker-arrow-right,
1812
+ .ewcp-scope--dark .#{$prefix}color-picker-input,
1813
+ .ewcp-scope--dark .#{$prefix}color-picker-box,
1814
+ .ewcp-scope--dark .#{$prefix}color-picker-sure-btn,
1815
+ .ewcp-scope--dark .#{$prefix}color-picker-arrow-left,
1816
+ .ewcp-scope--dark .#{$prefix}color-picker-arrow-right {
1817
+ background-color: var(--ewcp-color-bg);
1818
+ border-color: var(--ewcp-color-border);
1819
+ color: var(--ewcp-color-text);
1820
+ }
1821
+ [data-theme="dark"] .#{$prefix}color-picker-mode-container,
1822
+ .ewcp-scope--dark .#{$prefix}color-picker-mode-container {
1823
+ background-color: var(--ewcp-color-bg-secondary);
1824
+ border-color: var(--ewcp-color-border-light);
1825
+ }
1826
+ [data-theme="dark"] .#{$prefix}color-mode-title,
1827
+ [data-theme="dark"] .#{$prefix}color-picker-mode-text,
1828
+ .ewcp-scope--dark .#{$prefix}color-mode-title,
1829
+ .ewcp-scope--dark .#{$prefix}color-picker-mode-text {
1830
+ color: var(--ewcp-color-text);
1831
+ }
1832
+ [data-theme="dark"] .#{$prefix}color-picker-drop-container,
1833
+ .ewcp-scope--dark .#{$prefix}color-picker-drop-container {
1834
+ border-top-color: var(--ewcp-color-border-light);
1835
+ }
1836
+
1837
+ // ============================================================
1838
+ // 减少动态效果:尊重系统偏好,关闭过渡与位移动画
1839
+ // ============================================================
1840
+ @media (prefers-reduced-motion: reduce) {
1841
+ .#{$prefix}color-picker-panel-container,
1842
+ .#{$prefix}fade-in,
1843
+ .#{$prefix}fade-out,
1844
+ .#{$prefix}slide-down,
1845
+ .#{$prefix}slide-up,
1846
+ .#{$prefix}color-picker-copy-tip,
1847
+ .#{$prefix}input,
1848
+ .#{$prefix}select__dropdown,
1849
+ .#{$prefix}checkbox__box,
1850
+ .#{$prefix}button {
1851
+ transition: none !important;
1852
+ animation: none !important;
1853
+ }
1715
1854
  }
@@ -4,9 +4,9 @@ $prefix: "ew-" !default;
4
4
  .#{$prefix}input-number {
5
5
  display: flex;
6
6
  align-items: stretch;
7
- border: var(--input-number-border-width, 1.5px) solid #d9d9d9;
7
+ border: var(--input-number-border-width, 1.5px) solid var(--ewcp-color-border, #d9d9d9);
8
8
  border-radius: var(--input-number-radius, 8px);
9
- background: #fff;
9
+ background: var(--ewcp-color-bg, #fff);
10
10
  overflow: hidden;
11
11
  width: 100%;
12
12
  min-width: 0;
@@ -17,7 +17,7 @@ $prefix: "ew-" !default;
17
17
  height: var(--input-number-height, 32px);
18
18
  }
19
19
  .#{$prefix}input-number:focus-within {
20
- border-color: #4096ef;
20
+ border-color: var(--ewcp-color-primary, #4096ef);
21
21
  }
22
22
  .#{$prefix}input-number__input {
23
23
  flex: 1;
@@ -29,7 +29,7 @@ $prefix: "ew-" !default;
29
29
  min-width: 0;
30
30
  height: 100%;
31
31
  box-sizing: border-box;
32
- color: #222;
32
+ color: var(--ewcp-color-text, #222);
33
33
  font-family: inherit;
34
34
  line-height: 1;
35
35
  }
@@ -38,11 +38,11 @@ $prefix: "ew-" !default;
38
38
  min-width: var(--input-number-buttons-min-width, 24px);
39
39
  display: flex;
40
40
  flex-direction: column;
41
- background: #fff;
41
+ background: var(--ewcp-color-bg, #fff);
42
42
  height: 100%;
43
43
  padding: 0;
44
44
  margin: 0;
45
- border-left: var(--input-number-border-width, 1.5px) solid #e5e6eb;
45
+ border-left: var(--input-number-border-width, 1.5px) solid var(--ewcp-color-border-light, #e5e6eb);
46
46
  flex-shrink: 0;
47
47
  }
48
48
  .#{$prefix}input-number__button {
@@ -59,13 +59,13 @@ $prefix: "ew-" !default;
59
59
  box-sizing: border-box;
60
60
  line-height: 0;
61
61
  transition: background 0.2s;
62
- color: #666;
62
+ color: var(--ewcp-color-text-secondary, #666);
63
63
  }
64
64
  .#{$prefix}input-number__button--up {
65
- border-bottom: 1px solid #e5e6eb;
65
+ border-bottom: 1px solid var(--ewcp-color-border-light, #e5e6eb);
66
66
  }
67
67
  .#{$prefix}input-number__button:active {
68
- background: #f0f8ff;
68
+ background: var(--ewcp-color-bg-hover, #f0f8ff);
69
69
  }
70
70
  .#{$prefix}input-number__icon {
71
71
  width: var(--input-number-icon-size, 10px);
@@ -75,3 +75,220 @@ $prefix: "ew-" !default;
75
75
  margin: 0 auto;
76
76
  pointer-events: none;
77
77
  }
78
+
79
+ /* 横向步进:− 值 + 单行 */
80
+ .#{$prefix}input-number--horizontal {
81
+ border-radius: var(--input-number-radius, 10px);
82
+ }
83
+ .#{$prefix}input-number--horizontal:focus-within {
84
+ border-color: #1677ff;
85
+ box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
86
+ }
87
+ .#{$prefix}input-number--horizontal .#{$prefix}input-number__button {
88
+ width: var(--input-number-buttons-width, 32px);
89
+ height: 100%;
90
+ flex: 0 0 auto;
91
+ }
92
+ .#{$prefix}input-number--horizontal .#{$prefix}input-number__button:hover {
93
+ background: var(--ewcp-color-bg-disabled, #f5f5f5);
94
+ color: #1677ff;
95
+ }
96
+ .#{$prefix}input-number--horizontal .#{$prefix}input-number__button--down {
97
+ border-right: 1px solid var(--ewcp-color-border-light, #e5e6eb);
98
+ border-bottom: none;
99
+ }
100
+ .#{$prefix}input-number--horizontal .#{$prefix}input-number__button--up {
101
+ border-left: 1px solid var(--ewcp-color-border-light, #e5e6eb);
102
+ border-bottom: none;
103
+ }
104
+ .#{$prefix}input-number--horizontal .#{$prefix}input-number__icon {
105
+ width: 12px;
106
+ height: 12px;
107
+ flex-basis: 12px;
108
+ }
109
+ .#{$prefix}input-number--horizontal .#{$prefix}input-number__input {
110
+ text-align: center;
111
+ }
112
+
113
+ /* 尺寸 */
114
+ .#{$prefix}input-number--small {
115
+ height: var(--input-number-height-sm, 28px);
116
+ }
117
+ .#{$prefix}input-number--large {
118
+ height: var(--input-number-height-lg, 38px);
119
+ }
120
+
121
+ /* 内前缀 / 内后缀 */
122
+ .#{$prefix}input-number__prefix,
123
+ .#{$prefix}input-number__suffix {
124
+ display: inline-flex;
125
+ align-items: center;
126
+ gap: 4px;
127
+ flex: 0 0 auto;
128
+ color: var(--ewcp-color-text-tertiary, #999);
129
+ font-size: var(--input-number-input-font-size, 13px);
130
+ white-space: nowrap;
131
+ }
132
+ .#{$prefix}input-number__prefix {
133
+ padding-left: 8px;
134
+ }
135
+ .#{$prefix}input-number__suffix {
136
+ padding-right: 8px;
137
+ }
138
+
139
+ /* 外置前后缀 */
140
+ .#{$prefix}input-number__addon {
141
+ display: inline-flex;
142
+ align-items: center;
143
+ gap: 4px;
144
+ flex: 0 0 auto;
145
+ padding: 0 8px;
146
+ background: var(--ewcp-color-bg-secondary, #fafafa);
147
+ color: var(--ewcp-color-text-secondary, #666);
148
+ font-size: var(--input-number-input-font-size, 13px);
149
+ white-space: nowrap;
150
+ }
151
+ .#{$prefix}input-number__addon--before {
152
+ border-right: 1px solid var(--ewcp-color-border-light, #e5e6eb);
153
+ }
154
+
155
+ /* 清除按钮 */
156
+ .#{$prefix}input-number__clear {
157
+ display: inline-flex;
158
+ align-items: center;
159
+ justify-content: center;
160
+ flex: 0 0 auto;
161
+ /* 根节点为 stretch,固定高度的清除按钮需单独居中,否则会贴顶 */
162
+ align-self: center;
163
+ width: 16px;
164
+ height: 16px;
165
+ margin: 0 6px 0 4px;
166
+ padding: 0;
167
+ border: none;
168
+ border-radius: 50%;
169
+ background: #c9cdd4;
170
+ color: var(--ewcp-color-bg, #fff);
171
+ cursor: pointer;
172
+ transition: background 0.2s, opacity 0.2s;
173
+ }
174
+ .#{$prefix}input-number__clear:hover {
175
+ background: var(--ewcp-color-info, #909399);
176
+ }
177
+ .#{$prefix}input-number__clear--hidden {
178
+ display: none;
179
+ }
180
+
181
+ /* 变体 */
182
+ .#{$prefix}input-number--filled {
183
+ background: var(--ewcp-color-bg-disabled, #f5f5f5);
184
+ border-color: transparent;
185
+ }
186
+ .#{$prefix}input-number--filled:focus-within {
187
+ background: var(--ewcp-color-bg, #fff);
188
+ border-color: var(--ewcp-color-primary, #4096ef);
189
+ }
190
+ .#{$prefix}input-number--borderless {
191
+ background: transparent;
192
+ border-color: transparent;
193
+ }
194
+ .#{$prefix}input-number--borderless:focus-within {
195
+ border-color: transparent;
196
+ }
197
+ .#{$prefix}input-number--underlined {
198
+ background: transparent;
199
+ border-width: 0 0 var(--input-number-border-width, 1.5px) 0;
200
+ border-radius: 0;
201
+ }
202
+
203
+ /* 状态 */
204
+ .#{$prefix}input-number--error,
205
+ .#{$prefix}input-number--error:focus-within {
206
+ border-color: var(--ewcp-color-danger, #ff4d4f);
207
+ }
208
+ .#{$prefix}input-number--warning,
209
+ .#{$prefix}input-number--warning:focus-within {
210
+ border-color: var(--ewcp-color-warning, #faad14);
211
+ }
212
+
213
+ /* 只读 / 禁用 */
214
+ .#{$prefix}input-number--readonly,
215
+ .#{$prefix}input-number--disabled {
216
+ background: var(--ewcp-color-bg-disabled, #f5f5f5);
217
+ cursor: not-allowed;
218
+ }
219
+ .#{$prefix}input-number--disabled .#{$prefix}input-number__input {
220
+ cursor: not-allowed;
221
+ color: #b0b3b8;
222
+ }
223
+ .#{$prefix}input-number__button:disabled {
224
+ cursor: not-allowed;
225
+ color: #c9cdd4;
226
+ background: transparent;
227
+ }
228
+
229
+ /* 拨轮模式 */
230
+ $spinner-height: 84px !default;
231
+ $spinner-item-height: 28px !default;
232
+ .#{$prefix}input-number--spinner {
233
+ height: auto;
234
+ border: none;
235
+ background: transparent;
236
+ overflow: visible;
237
+ }
238
+ .#{$prefix}input-number__input--hidden {
239
+ display: none;
240
+ }
241
+ .#{$prefix}input-number__spinner {
242
+ position: relative;
243
+ width: 100%;
244
+ height: $spinner-height;
245
+ overflow: hidden;
246
+ -webkit-mask-image: linear-gradient(
247
+ to bottom,
248
+ transparent,
249
+ #000 28%,
250
+ #000 72%,
251
+ transparent
252
+ );
253
+ mask-image: linear-gradient(
254
+ to bottom,
255
+ transparent,
256
+ #000 28%,
257
+ #000 72%,
258
+ transparent
259
+ );
260
+ }
261
+ .#{$prefix}input-number__spinner-list {
262
+ height: 100%;
263
+ overflow-y: auto;
264
+ scroll-snap-type: y mandatory;
265
+ scrollbar-width: none;
266
+ }
267
+ /* 上下留白让首尾项也能滚动到正中,与 scrollTop = index * 行高 的算法对齐 */
268
+ .#{$prefix}input-number__spinner-list::before,
269
+ .#{$prefix}input-number__spinner-list::after {
270
+ content: "";
271
+ display: block;
272
+ height: calc((#{$spinner-height} - #{$spinner-item-height}) / 2);
273
+ }
274
+ .#{$prefix}input-number__spinner-list::-webkit-scrollbar {
275
+ display: none;
276
+ }
277
+ .#{$prefix}input-number__spinner-item {
278
+ height: $spinner-item-height;
279
+ line-height: $spinner-item-height;
280
+ text-align: center;
281
+ font-size: var(--input-number-input-font-size, 13px);
282
+ color: var(--ewcp-color-text-tertiary, #999);
283
+ scroll-snap-align: center;
284
+ cursor: pointer;
285
+ user-select: none;
286
+ transition: color 0.2s;
287
+ }
288
+ .#{$prefix}input-number__spinner-item:hover {
289
+ color: var(--ewcp-color-primary, #4096ef);
290
+ }
291
+ .#{$prefix}input-number__spinner-item--active {
292
+ color: var(--ewcp-color-text, #222);
293
+ font-weight: 600;
294
+ }
package/src/input.scss CHANGED
@@ -7,10 +7,10 @@ $prefix: "ew-" !default;
7
7
  height: 32px;
8
8
  padding: 0 11px;
9
9
  box-sizing: border-box;
10
- border: 1px solid #dcdfe6;
10
+ border: 1px solid var(--ewcp-color-border, #dcdfe6);
11
11
  border-radius: var(--input-radius, 4px);
12
- background: #fff;
13
- color: #303133;
12
+ background: var(--ewcp-color-bg, #fff);
13
+ color: var(--ewcp-color-text, #303133);
14
14
  font-family: inherit;
15
15
  font-size: 14px;
16
16
  line-height: 1.5;
@@ -19,16 +19,16 @@ $prefix: "ew-" !default;
19
19
  }
20
20
 
21
21
  .#{$prefix}input:hover {
22
- border-color: #c0c4cc;
22
+ border-color: var(--ewcp-color-border-hover, #c0c4cc);
23
23
  }
24
24
 
25
25
  .#{$prefix}input:focus {
26
- border-color: #4096ef;
26
+ border-color: var(--ewcp-color-primary, #4096ef);
27
27
  box-shadow: 0 0 0 2px rgba(64, 150, 239, 0.12);
28
28
  }
29
29
 
30
30
  .#{$prefix}input::placeholder {
31
- color: #a8abb2;
31
+ color: var(--ewcp-color-text-tertiary, #a8abb2);
32
32
  }
33
33
 
34
34
  .#{$prefix}input--small {
@@ -45,13 +45,55 @@ $prefix: "ew-" !default;
45
45
 
46
46
  .#{$prefix}input:disabled,
47
47
  .#{$prefix}input--disabled {
48
- border-color: #e4e7ed;
49
- background: #f5f7fa;
50
- color: #c0c4cc;
48
+ border-color: var(--ewcp-color-border-light, #e4e7ed);
49
+ background: var(--ewcp-color-bg-disabled, #f5f7fa);
50
+ color: var(--ewcp-color-border-hover, #c0c4cc);
51
51
  cursor: not-allowed;
52
52
  }
53
53
 
54
54
  .#{$prefix}input--readonly {
55
- background: #fafafa;
55
+ background: var(--ewcp-color-bg-secondary, #fafafa);
56
56
  cursor: default;
57
57
  }
58
+
59
+ // clearable:容器承载输入框与清除按钮
60
+ .#{$prefix}input-wrapper {
61
+ position: relative;
62
+ display: inline-flex;
63
+ align-items: center;
64
+ width: 100%;
65
+ }
66
+
67
+ .#{$prefix}input-wrapper > .#{$prefix}input {
68
+ padding-right: 30px;
69
+ }
70
+
71
+ .#{$prefix}input__clear {
72
+ position: absolute;
73
+ right: 8px;
74
+ display: inline-flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ width: 16px;
78
+ height: 16px;
79
+ padding: 0;
80
+ border: 0;
81
+ border-radius: 50%;
82
+ background: var(--ewcp-color-border-hover, #c0c4cc);
83
+ color: var(--ewcp-color-bg, #fff);
84
+ cursor: pointer;
85
+ }
86
+
87
+ .#{$prefix}input__clear:hover {
88
+ background: var(--ewcp-color-info, #909399);
89
+ }
90
+
91
+ .#{$prefix}input__clear--hidden {
92
+ display: none;
93
+ }
94
+
95
+ .#{$prefix}input__clear-icon {
96
+ display: block;
97
+ width: 10px;
98
+ height: 10px;
99
+ }