@tiny-design/react 1.3.0 → 1.5.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 (190) hide show
  1. package/es/alert/style/_index.scss +2 -2
  2. package/es/alert/style/index.css +2 -2
  3. package/es/auto-complete/style/_index.scss +4 -5
  4. package/es/auto-complete/style/index.css +4 -5
  5. package/es/breadcrumb/style/index.css +1 -1
  6. package/es/breadcrumb/types.d.ts +1 -1
  7. package/es/button/style/_index.scss +16 -11
  8. package/es/button/style/index.css +40 -19
  9. package/es/calendar/style/_index.scss +9 -9
  10. package/es/calendar/style/index.css +9 -9
  11. package/es/card/style/index.css +3 -3
  12. package/es/cascader/style/_index.scss +9 -9
  13. package/es/cascader/style/index.css +9 -9
  14. package/es/checkbox/style/_index.scss +9 -12
  15. package/es/checkbox/style/index.css +9 -12
  16. package/es/collapse/style/index.css +3 -3
  17. package/es/color-picker/style/_index.scss +7 -7
  18. package/es/color-picker/style/index.css +4 -4
  19. package/es/date-picker/style/_index.scss +1 -1
  20. package/es/date-picker/style/index.css +1 -1
  21. package/es/descriptions/style/_index.scss +5 -6
  22. package/es/descriptions/style/index.css +6 -6
  23. package/es/empty/style/_index.scss +1 -1
  24. package/es/empty/style/index.css +1 -1
  25. package/es/form/style/_index.scss +5 -6
  26. package/es/form/style/index.css +4 -4
  27. package/es/index.d.ts +2 -1
  28. package/es/index.js +2 -1
  29. package/es/input/style/_index.scss +5 -4
  30. package/es/input/style/_mixin.scss +1 -1
  31. package/es/input/style/index.css +21 -20
  32. package/es/input-number/input-number.js +11 -5
  33. package/es/input-number/input-number.js.map +1 -1
  34. package/es/input-number/style/_index.scss +5 -3
  35. package/es/input-number/style/index.css +13 -11
  36. package/es/input-otp/style/_index.scss +1 -1
  37. package/es/input-otp/style/index.css +8 -8
  38. package/es/list/style/_index.scss +3 -3
  39. package/es/list/style/index.css +3 -3
  40. package/es/marquee/index.d.ts +1 -0
  41. package/es/marquee/index.js +9 -0
  42. package/es/marquee/index.js.map +1 -0
  43. package/es/marquee/marquee.d.ts +8 -0
  44. package/es/marquee/marquee.js +42 -0
  45. package/es/marquee/marquee.js.map +1 -0
  46. package/es/marquee/style/_index.scss +77 -0
  47. package/es/marquee/style/index.css +64 -0
  48. package/es/marquee/style/index.d.ts +1 -0
  49. package/es/marquee/style/index.js +1 -0
  50. package/es/marquee/types.d.ts +21 -0
  51. package/es/native-select/style/index.css +4 -4
  52. package/es/notification/style/_index.scss +1 -1
  53. package/es/notification/style/index.css +1 -1
  54. package/es/pop-confirm/style/_index.scss +5 -1
  55. package/es/pop-confirm/style/index.css +5 -1
  56. package/es/popup/style/_index.scss +9 -9
  57. package/es/popup/style/index.css +10 -10
  58. package/es/radio/style/_index.scss +5 -8
  59. package/es/radio/style/index.css +5 -8
  60. package/es/segmented/style/_index.scss +10 -10
  61. package/es/segmented/style/index.css +9 -9
  62. package/es/select/style/_index.scss +16 -17
  63. package/es/select/style/index.css +15 -16
  64. package/es/slider/style/_index.scss +1 -9
  65. package/es/slider/style/index.css +1 -6
  66. package/es/speed-dial/style/_index.scss +8 -9
  67. package/es/speed-dial/style/index.css +7 -7
  68. package/es/statistic/style/_index.scss +2 -2
  69. package/es/statistic/style/index.css +2 -2
  70. package/es/style/_component.scss +1 -0
  71. package/es/style/base.css +81 -3
  72. package/es/table/style/_index.scss +6 -6
  73. package/es/table/style/index.css +5 -5
  74. package/es/tag/style/_index.scss +24 -0
  75. package/es/tag/style/index.css +21 -1
  76. package/es/tag/types.d.ts +2 -1
  77. package/es/tag/types.js +7 -2
  78. package/es/tag/types.js.map +1 -1
  79. package/es/textarea/style/index.css +2 -2
  80. package/es/time-picker/style/_index.scss +14 -1
  81. package/es/time-picker/style/index.css +11 -1
  82. package/es/time-picker/time-panel.js +28 -28
  83. package/es/time-picker/time-panel.js.map +1 -1
  84. package/es/time-picker/time-picker.js +50 -29
  85. package/es/time-picker/time-picker.js.map +1 -1
  86. package/es/timeline/style/_index.scss +3 -3
  87. package/es/timeline/style/index.css +3 -3
  88. package/es/tooltip/style/index.css +1 -1
  89. package/es/transfer/style/_index.scss +4 -4
  90. package/es/transfer/style/index.css +4 -4
  91. package/es/tree/style/index.css +1 -1
  92. package/es/typography/style/_index.scss +2 -2
  93. package/es/typography/style/index.css +2 -2
  94. package/es/upload/style/_index.scss +4 -4
  95. package/es/upload/style/index.css +4 -4
  96. package/lib/alert/style/_index.scss +2 -2
  97. package/lib/alert/style/index.css +2 -2
  98. package/lib/auto-complete/style/_index.scss +4 -5
  99. package/lib/auto-complete/style/index.css +4 -5
  100. package/lib/breadcrumb/style/index.css +1 -1
  101. package/lib/breadcrumb/types.d.ts +1 -1
  102. package/lib/button/style/_index.scss +16 -11
  103. package/lib/button/style/index.css +40 -19
  104. package/lib/calendar/style/_index.scss +9 -9
  105. package/lib/calendar/style/index.css +9 -9
  106. package/lib/card/style/index.css +3 -3
  107. package/lib/cascader/style/_index.scss +9 -9
  108. package/lib/cascader/style/index.css +9 -9
  109. package/lib/checkbox/style/_index.scss +9 -12
  110. package/lib/checkbox/style/index.css +9 -12
  111. package/lib/collapse/style/index.css +3 -3
  112. package/lib/color-picker/style/_index.scss +7 -7
  113. package/lib/color-picker/style/index.css +4 -4
  114. package/lib/date-picker/style/_index.scss +1 -1
  115. package/lib/date-picker/style/index.css +1 -1
  116. package/lib/descriptions/style/_index.scss +5 -6
  117. package/lib/descriptions/style/index.css +6 -6
  118. package/lib/empty/style/_index.scss +1 -1
  119. package/lib/empty/style/index.css +1 -1
  120. package/lib/form/style/_index.scss +5 -6
  121. package/lib/form/style/index.css +4 -4
  122. package/lib/index.d.ts +2 -1
  123. package/lib/index.js +76 -74
  124. package/lib/input/style/_index.scss +5 -4
  125. package/lib/input/style/_mixin.scss +1 -1
  126. package/lib/input/style/index.css +21 -20
  127. package/lib/input-number/input-number.js +11 -5
  128. package/lib/input-number/input-number.js.map +1 -1
  129. package/lib/input-number/style/_index.scss +5 -3
  130. package/lib/input-number/style/index.css +13 -11
  131. package/lib/input-otp/style/_index.scss +1 -1
  132. package/lib/input-otp/style/index.css +8 -8
  133. package/lib/list/style/_index.scss +3 -3
  134. package/lib/list/style/index.css +3 -3
  135. package/lib/marquee/index.js +8 -0
  136. package/lib/marquee/index.js.map +1 -0
  137. package/lib/marquee/marquee.d.ts +8 -0
  138. package/lib/marquee/marquee.js +45 -0
  139. package/lib/marquee/marquee.js.map +1 -0
  140. package/lib/marquee/style/_index.scss +77 -0
  141. package/lib/marquee/style/index.css +64 -0
  142. package/lib/marquee/style/index.d.ts +1 -0
  143. package/lib/marquee/style/index.js +1 -0
  144. package/lib/marquee/types.d.ts +21 -0
  145. package/lib/native-select/style/index.css +4 -4
  146. package/lib/notification/style/_index.scss +1 -1
  147. package/lib/notification/style/index.css +1 -1
  148. package/lib/pop-confirm/style/_index.scss +5 -1
  149. package/lib/pop-confirm/style/index.css +5 -1
  150. package/lib/popup/style/_index.scss +9 -9
  151. package/lib/popup/style/index.css +10 -10
  152. package/lib/radio/style/_index.scss +5 -8
  153. package/lib/radio/style/index.css +5 -8
  154. package/lib/segmented/style/_index.scss +10 -10
  155. package/lib/segmented/style/index.css +9 -9
  156. package/lib/select/style/_index.scss +16 -17
  157. package/lib/select/style/index.css +15 -16
  158. package/lib/slider/style/_index.scss +1 -9
  159. package/lib/slider/style/index.css +1 -6
  160. package/lib/speed-dial/style/_index.scss +8 -9
  161. package/lib/speed-dial/style/index.css +7 -7
  162. package/lib/statistic/style/_index.scss +2 -2
  163. package/lib/statistic/style/index.css +2 -2
  164. package/lib/style/_component.scss +1 -0
  165. package/lib/style/base.css +81 -3
  166. package/lib/table/style/_index.scss +6 -6
  167. package/lib/table/style/index.css +5 -5
  168. package/lib/tag/style/_index.scss +24 -0
  169. package/lib/tag/style/index.css +21 -1
  170. package/lib/tag/types.d.ts +2 -1
  171. package/lib/tag/types.js +7 -2
  172. package/lib/tag/types.js.map +1 -1
  173. package/lib/textarea/style/index.css +2 -2
  174. package/lib/time-picker/style/_index.scss +14 -1
  175. package/lib/time-picker/style/index.css +11 -1
  176. package/lib/time-picker/time-panel.js +28 -28
  177. package/lib/time-picker/time-panel.js.map +1 -1
  178. package/lib/time-picker/time-picker.js +50 -29
  179. package/lib/time-picker/time-picker.js.map +1 -1
  180. package/lib/timeline/style/_index.scss +3 -3
  181. package/lib/timeline/style/index.css +3 -3
  182. package/lib/tooltip/style/index.css +1 -1
  183. package/lib/transfer/style/_index.scss +4 -4
  184. package/lib/transfer/style/index.css +4 -4
  185. package/lib/tree/style/index.css +1 -1
  186. package/lib/typography/style/_index.scss +2 -2
  187. package/lib/typography/style/index.css +2 -2
  188. package/lib/upload/style/_index.scss +4 -4
  189. package/lib/upload/style/index.css +4 -4
  190. package/package.json +3 -3
@@ -2,7 +2,7 @@
2
2
  position: relative;
3
3
  display: inline-flex;
4
4
  align-items: center;
5
- font-size: 1rem;
5
+ font-size: var(--ty-font-size-base);
6
6
  margin-right: 8px;
7
7
  color: var(--ty-color-text);
8
8
  box-sizing: border-box;
@@ -12,10 +12,7 @@
12
12
  }
13
13
  .ty-checkbox__native {
14
14
  position: absolute;
15
- top: 0;
16
- right: 0;
17
- bottom: 0;
18
- left: 0;
15
+ inset: 0;
19
16
  width: 100%;
20
17
  height: 100%;
21
18
  z-index: 1;
@@ -37,7 +34,7 @@
37
34
  line-height: 1;
38
35
  vertical-align: middle;
39
36
  }
40
- .ty-checkbox__inner:before {
37
+ .ty-checkbox__inner::before {
41
38
  content: "";
42
39
  position: absolute;
43
40
  display: block;
@@ -49,7 +46,7 @@
49
46
  transition: all 200ms;
50
47
  transform: scale(0);
51
48
  }
52
- .ty-checkbox__inner:after {
49
+ .ty-checkbox__inner::after {
53
50
  transform: rotate(45deg) scaleY(1);
54
51
  pointer-events: none;
55
52
  box-sizing: content-box;
@@ -71,21 +68,21 @@
71
68
  background-color: var(--ty-color-primary);
72
69
  border-color: var(--ty-color-primary);
73
70
  }
74
- .ty-checkbox_checked .ty-checkbox__inner:after {
71
+ .ty-checkbox_checked .ty-checkbox__inner::after {
75
72
  content: "";
76
73
  transform: rotate(45deg) scale(1);
77
74
  }
78
- .ty-checkbox_checked .ty-checkbox__inner:before {
75
+ .ty-checkbox_checked .ty-checkbox__inner::before {
79
76
  transform: scale(0);
80
77
  }
81
78
  .ty-checkbox_indeterminate .ty-checkbox__inner {
82
79
  background-color: var(--ty-color-primary);
83
80
  border-color: var(--ty-color-primary);
84
81
  }
85
- .ty-checkbox_indeterminate .ty-checkbox__inner:before {
82
+ .ty-checkbox_indeterminate .ty-checkbox__inner::before {
86
83
  transform: scale(1);
87
84
  }
88
- .ty-checkbox_indeterminate .ty-checkbox__inner:after {
85
+ .ty-checkbox_indeterminate .ty-checkbox__inner::after {
89
86
  transform: rotate(45deg) scale(0);
90
87
  }
91
88
  .ty-checkbox_disabled .ty-checkbox__native {
@@ -95,7 +92,7 @@
95
92
  background-color: var(--ty-checkbox-disabled-bg);
96
93
  border-color: var(--ty-checkbox-border) !important;
97
94
  }
98
- .ty-checkbox_disabled .ty-checkbox__inner:after {
95
+ .ty-checkbox_disabled .ty-checkbox__inner::after {
99
96
  border-color: var(--ty-color-text-quaternary);
100
97
  }
101
98
  .ty-checkbox_disabled .ty-checkbox__inner + span {
@@ -1,6 +1,6 @@
1
1
  .ty-collapse {
2
2
  box-sizing: border-box;
3
- border-radius: 2px;
3
+ border-radius: var(--ty-border-radius);
4
4
  color: var(--ty-color-text);
5
5
  font-size: 14px;
6
6
  border: 1px solid var(--ty-collapse-border);
@@ -13,10 +13,10 @@
13
13
  border-bottom: 1px solid var(--ty-collapse-border);
14
14
  }
15
15
  .ty-collapse-item:last-child {
16
- border-radius: 0 0 2px 2px;
16
+ border-radius: 0 0 var(--ty-border-radius) var(--ty-border-radius);
17
17
  }
18
18
  .ty-collapse-item:last-child .ty-collapse-item__content {
19
- border-radius: 0 0 2px 2px;
19
+ border-radius: 0 0 var(--ty-border-radius) var(--ty-border-radius);
20
20
  }
21
21
  .ty-collapse-item__header {
22
22
  display: flex;
@@ -23,7 +23,7 @@
23
23
  &__swatch {
24
24
  width: 32px;
25
25
  height: 32px;
26
- border-radius: $border-radius;
26
+ border-radius: var(--ty-border-radius);
27
27
  border: 1px solid var(--ty-color-picker-border, #{$gray-300});
28
28
  padding: 3px;
29
29
  cursor: pointer;
@@ -39,7 +39,7 @@
39
39
  padding: 12px;
40
40
  background: var(--ty-color-picker-bg, #fff);
41
41
  border-radius: 8px;
42
- box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
42
+ box-shadow: 0 6px 16px 0 rgb(0 0 0 / 8%), 0 3px 6px -4px rgb(0 0 0 / 12%), 0 9px 28px 8px rgb(0 0 0 / 5%);
43
43
  width: 240px;
44
44
  }
45
45
 
@@ -70,7 +70,7 @@
70
70
  height: 12px;
71
71
  border-radius: 50%;
72
72
  border: 2px solid #fff;
73
- box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
73
+ box-shadow: 0 0 2px rgb(0 0 0 / 30%);
74
74
  transform: translate(-50%, -50%);
75
75
  pointer-events: none;
76
76
  }
@@ -128,7 +128,7 @@
128
128
  height: 14px;
129
129
  border-radius: 50%;
130
130
  border: 2px solid #fff;
131
- box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
131
+ box-shadow: 0 0 2px rgb(0 0 0 / 30%);
132
132
  transform: translate(-50%, -50%);
133
133
  pointer-events: none;
134
134
  background: transparent;
@@ -144,7 +144,7 @@
144
144
  &__format-btn {
145
145
  border: 1px solid var(--ty-color-picker-border, #{$gray-300});
146
146
  background: transparent;
147
- border-radius: $border-radius;
147
+ border-radius: var(--ty-border-radius);
148
148
  padding: 2px 6px;
149
149
  cursor: pointer;
150
150
  font-size: 12px;
@@ -159,7 +159,7 @@
159
159
  &__hex-input {
160
160
  flex: 1;
161
161
  border: 1px solid var(--ty-color-picker-border, #{$gray-300});
162
- border-radius: $border-radius;
162
+ border-radius: var(--ty-border-radius);
163
163
  padding: 2px 6px;
164
164
  font-size: 12px;
165
165
  font-family: $font-family-monospace;
@@ -184,7 +184,7 @@
184
184
  &__preset {
185
185
  width: 20px;
186
186
  height: 20px;
187
- border-radius: $border-radius;
187
+ border-radius: var(--ty-border-radius);
188
188
  cursor: pointer;
189
189
  border: 1px solid var(--ty-color-picker-border, #{$gray-300});
190
190
  transition: transform 0.15s;
@@ -18,7 +18,7 @@
18
18
  .ty-color-picker__swatch {
19
19
  width: 32px;
20
20
  height: 32px;
21
- border-radius: 2px;
21
+ border-radius: var(--ty-border-radius);
22
22
  border: 1px solid var(--ty-color-picker-border, #dee2e6);
23
23
  padding: 3px;
24
24
  cursor: pointer;
@@ -124,7 +124,7 @@
124
124
  .ty-color-picker__format-btn {
125
125
  border: 1px solid var(--ty-color-picker-border, #dee2e6);
126
126
  background: transparent;
127
- border-radius: 2px;
127
+ border-radius: var(--ty-border-radius);
128
128
  padding: 2px 6px;
129
129
  cursor: pointer;
130
130
  font-size: 12px;
@@ -137,7 +137,7 @@
137
137
  .ty-color-picker__hex-input {
138
138
  flex: 1;
139
139
  border: 1px solid var(--ty-color-picker-border, #dee2e6);
140
- border-radius: 2px;
140
+ border-radius: var(--ty-border-radius);
141
141
  padding: 2px 6px;
142
142
  font-size: 12px;
143
143
  font-family: lucida console, consolas, monaco, andale mono, ubuntu mono, monospace;
@@ -159,7 +159,7 @@
159
159
  .ty-color-picker__preset {
160
160
  width: 20px;
161
161
  height: 20px;
162
- border-radius: 2px;
162
+ border-radius: var(--ty-border-radius);
163
163
  cursor: pointer;
164
164
  border: 1px solid var(--ty-color-picker-border, #dee2e6);
165
165
  transition: transform 0.15s;
@@ -5,7 +5,7 @@ $dp: #{$prefix}-date-picker;
5
5
  .#{$dp} {
6
6
  display: inline-flex;
7
7
  position: relative;
8
- font-size: $font-size-base;
8
+ font-size: var(--ty-font-size-base);
9
9
 
10
10
  // ---- Input ----
11
11
  &__input {
@@ -1,7 +1,7 @@
1
1
  .ty-date-picker {
2
2
  display: inline-flex;
3
3
  position: relative;
4
- font-size: 1rem;
4
+ font-size: var(--ty-font-size-base);
5
5
  }
6
6
  .ty-date-picker__input {
7
7
  display: inline-flex;
@@ -1,7 +1,6 @@
1
1
  @use '../../style/variables' as *;
2
2
 
3
3
  .#{$prefix}-descriptions {
4
-
5
4
  &__body {
6
5
  width: 100%;
7
6
  overflow: hidden;
@@ -24,7 +23,7 @@
24
23
  font-size: 16px;
25
24
  }
26
25
 
27
- &__item_colon:after {
26
+ &__item_colon::after {
28
27
  content: ':';
29
28
  margin-left: 2px;
30
29
  margin-right: 5px;
@@ -32,15 +31,15 @@
32
31
 
33
32
  &__item-label {
34
33
  color: var(--ty-color-text-label);
35
- font-size: $font-size-base;
34
+ font-size: var(--ty-font-size-base);
36
35
  font-weight: 400;
37
- line-height: $line-height-base;
36
+ line-height: var(--ty-line-height-base);
38
37
  }
39
38
 
40
39
  &__item-content {
41
40
  color: var(--ty-color-text-secondary);
42
- font-size: $font-size-base;
43
- line-height: $line-height-base;
41
+ font-size: var(--ty-font-size-base);
42
+ line-height: var(--ty-line-height-base);
44
43
  }
45
44
 
46
45
  &_bordered {
@@ -17,25 +17,25 @@
17
17
  font-weight: 600;
18
18
  font-size: 16px;
19
19
  }
20
- .ty-descriptions__item_colon:after {
20
+ .ty-descriptions__item_colon::after {
21
21
  content: ":";
22
22
  margin-left: 2px;
23
23
  margin-right: 5px;
24
24
  }
25
25
  .ty-descriptions__item-label {
26
26
  color: var(--ty-color-text-label);
27
- font-size: 1rem;
27
+ font-size: var(--ty-font-size-base);
28
28
  font-weight: 400;
29
- line-height: 1.5;
29
+ line-height: var(--ty-line-height-base);
30
30
  }
31
31
  .ty-descriptions__item-content {
32
32
  color: var(--ty-color-text-secondary);
33
- font-size: 1rem;
34
- line-height: 1.5;
33
+ font-size: var(--ty-font-size-base);
34
+ line-height: var(--ty-line-height-base);
35
35
  }
36
36
  .ty-descriptions_bordered .ty-descriptions__body {
37
37
  border: 1px solid var(--ty-descriptions-border);
38
- border-radius: 2px;
38
+ border-radius: var(--ty-border-radius);
39
39
  }
40
40
  .ty-descriptions_bordered .ty-descriptions__row {
41
41
  border-bottom: 1px solid var(--ty-descriptions-border);
@@ -16,7 +16,7 @@
16
16
 
17
17
  &__desc {
18
18
  color: var(--ty-empty-desc-color);
19
- font-size: $font-size-base;
19
+ font-size: var(--ty-font-size-base);
20
20
  margin: 0;
21
21
  }
22
22
 
@@ -12,7 +12,7 @@
12
12
  }
13
13
  .ty-empty__desc {
14
14
  color: var(--ty-empty-desc-color);
15
- font-size: 1rem;
15
+ font-size: var(--ty-font-size-base);
16
16
  margin: 0;
17
17
  }
18
18
  .ty-empty__footer {
@@ -1,7 +1,6 @@
1
1
  @use '../../style/variables' as *;
2
2
 
3
3
  .#{$prefix}-form {
4
-
5
4
  &_vertical {
6
5
  .#{$prefix}-form-item__label {
7
6
  text-align: left;
@@ -23,15 +22,15 @@
23
22
  text-align: right;
24
23
  vertical-align: top;
25
24
  color: var(--ty-color-text);
26
- font-size: $font-size-base;
25
+ font-size: var(--ty-font-size-base);
27
26
 
28
- &_required:before {
27
+ &_required::before {
29
28
  content: '*';
30
29
  margin-right: 3px;
31
30
  color: var(--ty-form-error-color);
32
31
  }
33
32
 
34
- &_colon:after {
33
+ &_colon::after {
35
34
  content: ':';
36
35
  margin: 0 8px 0 2px;
37
36
  }
@@ -65,7 +64,7 @@
65
64
 
66
65
  &__notice {
67
66
  font-size: 13px;
68
- border-radius: $border-radius;
67
+ border-radius: var(--ty-border-radius);
69
68
  background: var(--ty-form-notice-bg);
70
69
  color: var(--ty-form-notice-color);
71
70
  padding: 5px;
@@ -86,7 +85,7 @@
86
85
 
87
86
  &:focus{
88
87
  border-color: var(--ty-form-error-hover);
89
- box-shadow: 0 0 0 2px rgba(255,77,79,.2);
88
+ box-shadow: 0 0 0 2px rgb(255 77 79 / 20%);
90
89
  }
91
90
  }
92
91
  }
@@ -15,14 +15,14 @@
15
15
  text-align: right;
16
16
  vertical-align: top;
17
17
  color: var(--ty-color-text);
18
- font-size: 1rem;
18
+ font-size: var(--ty-font-size-base);
19
19
  }
20
- .ty-form-item__label_required:before {
20
+ .ty-form-item__label_required::before {
21
21
  content: "*";
22
22
  margin-right: 3px;
23
23
  color: var(--ty-form-error-color);
24
24
  }
25
- .ty-form-item__label_colon:after {
25
+ .ty-form-item__label_colon::after {
26
26
  content: ":";
27
27
  margin: 0 8px 0 2px;
28
28
  }
@@ -50,7 +50,7 @@
50
50
  }
51
51
  .ty-form-item__notice {
52
52
  font-size: 13px;
53
- border-radius: 2px;
53
+ border-radius: var(--ty-border-radius);
54
54
  background: var(--ty-form-notice-bg);
55
55
  color: var(--ty-form-notice-color);
56
56
  padding: 5px;
package/es/index.d.ts CHANGED
@@ -40,6 +40,7 @@ import { Link } from "./link/link.js";
40
40
  import { DefaultList } from "./list/index.js";
41
41
  import { Loader } from "./loader/loader.js";
42
42
  import { _default } from "./loading-bar/index.js";
43
+ import { Marquee } from "./marquee/marquee.js";
43
44
  import { DefaultMenu } from "./menu/index.js";
44
45
  import { messageContainer } from "./message/message-container.js";
45
46
  import { DefaultSelect } from "./native-select/index.js";
@@ -87,4 +88,4 @@ import { en_US } from "./locale/en_US.js";
87
88
  import { zh_CN } from "./locale/zh_CN.js";
88
89
  import { useLocale } from "./_utils/use-locale.js";
89
90
  import { ThemeMode, useTheme } from "./_utils/use-theme.js";
90
- export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputOTP, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, Waterfall, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
91
+ export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputOTP, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, Marquee, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, Waterfall, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
package/es/index.js CHANGED
@@ -46,6 +46,7 @@ import pagination_default from "./pagination/index.js";
46
46
  import DefaultList from "./list/index.js";
47
47
  import loader_default from "./loader/index.js";
48
48
  import loading_bar_default from "./loading-bar/index.js";
49
+ import marquee_default from "./marquee/index.js";
49
50
  import DefaultMenu from "./menu/index.js";
50
51
  import message_default from "./message/index.js";
51
52
  import DefaultSelect from "./native-select/index.js";
@@ -87,4 +88,4 @@ import { withLocale } from "./intl-provider/with-locale.js";
87
88
  import { withSpin } from "./with-spin/with-spin.js";
88
89
  import zh_CN from "./locale/zh_CN.js";
89
90
  import { useTheme } from "./_utils/use-theme.js";
90
- export { alert_default as Alert, DefaultAnchor as Anchor, aspect_ratio_default as AspectRatio, auto_complete_default as AutoComplete, DefaultAvatar as Avatar, back_top_default as BackTop, badge_default as Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, calendar_default as Calendar, DefaultCard as Card, DefaultCarousel as Carousel, cascader_default as Cascader, DefaultCheckbox as Checkbox, col_default as Col, DefaultCollapse as Collapse, color_picker_default as ColorPicker, config_provider_default as ConfigProvider, copy_to_clipboard_default as CopyToClipboard, countdown_default as Countdown, date_picker_default as DatePicker, DefaultDesc as Descriptions, divider_default as Divider, drawer_default as Drawer, dropdown_default as Dropdown, empty_default as Empty, flex_default as Flex, DefaultFlip as Flip, DefaultForm as Form, image_default as Image, DefaultInput as Input, input_number_default as InputNumber, input_otp_default as InputOTP, input_password_default as InputPassword, intl_provider_default as IntlProvider, keyboard_default as Keyboard, DefaultLayout as Layout, link_default as Link, DefaultList as List, loader_default as Loader, loading_bar_default as LoadingBar, DefaultMenu as Menu, message_default as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notification_default as Notification, overlay_default as Overlay, pagination_default as Pagination, pop_confirm_default as PopConfirm, popover_default as Popover, Progress, DefaultRadio as Radio, rate_default as Rate, result_default as Result, row_default as Row, scroll_indicator_default as ScrollIndicator, segmented_default as Segmented, DefaultSelect$1 as Select, skeleton_default as Skeleton, slider_default as Slider, space_default as Space, DefaultSpeedDial as SpeedDial, split_default as Split, split_button_default as SplitButton, statistic_default as Statistic, DefaultSteps as Steps, sticky_default as Sticky, strength_indicator_default as StrengthIndicator, switch_default as Switch, table_default as Table, DefaultTabs as Tabs, DefaultTag as Tag, textarea_default as Textarea, time_picker_default as TimePicker, DefaultTimeline as Timeline, tooltip_default as Tooltip, transfer_default as Transfer, transition_default as Transition, tree_default as Tree, DefaultTypo as Typography, upload_default as Upload, waterfall_default as Waterfall, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
91
+ export { alert_default as Alert, DefaultAnchor as Anchor, aspect_ratio_default as AspectRatio, auto_complete_default as AutoComplete, DefaultAvatar as Avatar, back_top_default as BackTop, badge_default as Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, calendar_default as Calendar, DefaultCard as Card, DefaultCarousel as Carousel, cascader_default as Cascader, DefaultCheckbox as Checkbox, col_default as Col, DefaultCollapse as Collapse, color_picker_default as ColorPicker, config_provider_default as ConfigProvider, copy_to_clipboard_default as CopyToClipboard, countdown_default as Countdown, date_picker_default as DatePicker, DefaultDesc as Descriptions, divider_default as Divider, drawer_default as Drawer, dropdown_default as Dropdown, empty_default as Empty, flex_default as Flex, DefaultFlip as Flip, DefaultForm as Form, image_default as Image, DefaultInput as Input, input_number_default as InputNumber, input_otp_default as InputOTP, input_password_default as InputPassword, intl_provider_default as IntlProvider, keyboard_default as Keyboard, DefaultLayout as Layout, link_default as Link, DefaultList as List, loader_default as Loader, loading_bar_default as LoadingBar, marquee_default as Marquee, DefaultMenu as Menu, message_default as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notification_default as Notification, overlay_default as Overlay, pagination_default as Pagination, pop_confirm_default as PopConfirm, popover_default as Popover, Progress, DefaultRadio as Radio, rate_default as Rate, result_default as Result, row_default as Row, scroll_indicator_default as ScrollIndicator, segmented_default as Segmented, DefaultSelect$1 as Select, skeleton_default as Skeleton, slider_default as Slider, space_default as Space, DefaultSpeedDial as SpeedDial, split_default as Split, split_button_default as SplitButton, statistic_default as Statistic, DefaultSteps as Steps, sticky_default as Sticky, strength_indicator_default as StrengthIndicator, switch_default as Switch, table_default as Table, DefaultTabs as Tabs, DefaultTag as Tag, textarea_default as Textarea, time_picker_default as TimePicker, DefaultTimeline as Timeline, tooltip_default as Tooltip, transfer_default as Transfer, transition_default as Transition, tree_default as Tree, DefaultTypo as Typography, upload_default as Upload, waterfall_default as Waterfall, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
@@ -4,10 +4,11 @@
4
4
  .#{$prefix}-input {
5
5
  position: relative;
6
6
  box-sizing: border-box;
7
+ width: 100%;
7
8
  color: var(--ty-color-text);
8
9
 
9
10
  &__input {
10
- @include input-default();
11
+ @include input-default;
11
12
  }
12
13
 
13
14
  &__prefix,
@@ -77,7 +78,7 @@
77
78
 
78
79
  &_disabled {
79
80
  .#{$prefix}-input__input {
80
- @include input-default-disabled();
81
+ @include input-default-disabled;
81
82
  }
82
83
  }
83
84
  }
@@ -124,7 +125,7 @@
124
125
  }
125
126
  }
126
127
 
127
- &:not(:first-child):not(:last-child) {
128
+ &:not(:first-child, :last-child) {
128
129
  .#{$prefix}-input__input {
129
130
  border-radius: 0;
130
131
  }
@@ -166,7 +167,7 @@
166
167
  border-top-left-radius: 0;
167
168
  }
168
169
 
169
- &:not(:first-child):not(:last-child) {
170
+ &:not(:first-child, :last-child) {
170
171
  border-radius: 0;
171
172
  border-left: 0;
172
173
  border-right: 0;
@@ -10,7 +10,7 @@
10
10
  transition: all 0.3s;
11
11
  outline: 0;
12
12
  border-radius: $input-border-radius;
13
- font-size: $font-size-base;
13
+ font-size: var(--ty-font-size-base);
14
14
  background-color: var(--ty-input-bg);
15
15
 
16
16
  &:hover {
@@ -1,6 +1,7 @@
1
1
  .ty-input {
2
2
  position: relative;
3
3
  box-sizing: border-box;
4
+ width: 100%;
4
5
  color: var(--ty-color-text);
5
6
  }
6
7
  .ty-input__input {
@@ -11,8 +12,8 @@
11
12
  border: 1px solid var(--ty-input-border);
12
13
  transition: all 0.3s;
13
14
  outline: 0;
14
- border-radius: 2px;
15
- font-size: 1rem;
15
+ border-radius: var(--ty-border-radius);
16
+ font-size: var(--ty-font-size-base);
16
17
  background-color: var(--ty-input-bg);
17
18
  }
18
19
  .ty-input__input:hover {
@@ -51,25 +52,25 @@
51
52
  cursor: pointer;
52
53
  }
53
54
  .ty-input_sm .ty-input__input {
54
- font-size: 0.875rem;
55
- height: 24px;
56
- line-height: 24px;
55
+ font-size: var(--ty-font-size-sm);
56
+ height: var(--ty-height-sm);
57
+ line-height: var(--ty-height-sm);
57
58
  }
58
59
  .ty-input_sm .ty-input__clear-btn {
59
60
  transform: scale(0.7);
60
61
  }
61
62
  .ty-input_md .ty-input__input {
62
- font-size: 1rem;
63
- height: 32px;
64
- line-height: 32px;
63
+ font-size: var(--ty-font-size-base);
64
+ height: var(--ty-height-md);
65
+ line-height: var(--ty-height-md);
65
66
  }
66
67
  .ty-input_md .ty-input__clear-btn {
67
68
  transform: scale(0.8);
68
69
  }
69
70
  .ty-input_lg .ty-input__input {
70
- font-size: 1.25rem;
71
- height: 42px;
72
- line-height: 42px;
71
+ font-size: var(--ty-font-size-lg);
72
+ height: var(--ty-height-lg);
73
+ line-height: var(--ty-height-lg);
73
74
  }
74
75
  .ty-input_disabled .ty-input__input {
75
76
  cursor: not-allowed;
@@ -92,13 +93,13 @@
92
93
  justify-content: center;
93
94
  }
94
95
  .ty-input-group_sm {
95
- height: 24px;
96
+ height: var(--ty-height-sm);
96
97
  }
97
98
  .ty-input-group_md {
98
- height: 32px;
99
+ height: var(--ty-height-md);
99
100
  }
100
101
  .ty-input-group_lg {
101
- height: 42px;
102
+ height: var(--ty-height-lg);
102
103
  }
103
104
  .ty-input-group .ty-input {
104
105
  z-index: 1;
@@ -112,7 +113,7 @@
112
113
  border-top-left-radius: 0;
113
114
  border-bottom-left-radius: 0;
114
115
  }
115
- .ty-input-group .ty-input:not(:first-child):not(:last-child) .ty-input__input {
116
+ .ty-input-group .ty-input:not(:first-child, :last-child) .ty-input__input {
116
117
  border-radius: 0;
117
118
  }
118
119
 
@@ -122,18 +123,18 @@
122
123
  box-sizing: border-box;
123
124
  text-align: center;
124
125
  line-height: 1;
125
- border-radius: 2px;
126
+ border-radius: var(--ty-border-radius);
126
127
  color: var(--ty-color-text);
127
128
  padding: 0 7px;
128
129
  }
129
130
  .ty-input-group-addon_sm {
130
- font-size: 0.875rem;
131
+ font-size: var(--ty-font-size-sm);
131
132
  }
132
133
  .ty-input-group-addon_md {
133
- font-size: 1rem;
134
+ font-size: var(--ty-font-size-base);
134
135
  }
135
136
  .ty-input-group-addon_lg {
136
- font-size: 1.25rem;
137
+ font-size: var(--ty-font-size-lg);
137
138
  }
138
139
  .ty-input-group-addon:first-child {
139
140
  border-right: 0;
@@ -145,7 +146,7 @@
145
146
  border-bottom-left-radius: 0;
146
147
  border-top-left-radius: 0;
147
148
  }
148
- .ty-input-group-addon:not(:first-child):not(:last-child) {
149
+ .ty-input-group-addon:not(:first-child, :last-child) {
149
150
  border-radius: 0;
150
151
  border-left: 0;
151
152
  border-right: 0;
@@ -12,8 +12,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
12
12
  const isValid = (val) => {
13
13
  return !isNaN(+val);
14
14
  };
15
+ const getDecimalPrecision = (num) => {
16
+ const str = String(num);
17
+ const dotIndex = str.indexOf(".");
18
+ return dotIndex === -1 ? 0 : str.length - dotIndex - 1;
19
+ };
15
20
  const toPrecision = (val, precision) => {
16
- if (precision === void 0) return val;
17
21
  return parseFloat(val.toFixed(precision));
18
22
  };
19
23
  const InputNumber = React.forwardRef((props, ref) => {
@@ -24,16 +28,18 @@ const InputNumber = React.forwardRef((props, ref) => {
24
28
  [`${prefixCls}_disabled`]: disabled,
25
29
  [`${prefixCls}_always-controls`]: controls
26
30
  });
31
+ const resolvedPrecision = precision ?? Math.max(getDecimalPrecision(step), getDecimalPrecision(defaultValue));
27
32
  const [value, setValue] = useState("value" in props ? props.value : defaultValue);
28
33
  const inputOnChange = (e) => {
29
- const val = toPrecision(Number(e.target.value.trim()), precision);
34
+ const raw = Number(e.target.value.trim());
35
+ const val = resolvedPrecision > 0 ? toPrecision(raw, resolvedPrecision) : raw;
30
36
  !("value" in props) && setValue(val);
31
37
  onChange && isValid(val) && onChange(val, e);
32
38
  };
33
39
  const plusOnClick = (e) => {
34
40
  e.stopPropagation();
35
41
  if (!disabled && isValid(step)) {
36
- const val = toPrecision(+value + +step, precision);
42
+ const val = toPrecision(+value + +step, resolvedPrecision);
37
43
  if (val <= max) {
38
44
  !("value" in props) && setValue(val);
39
45
  onChange && onChange(val, e);
@@ -43,7 +49,7 @@ const InputNumber = React.forwardRef((props, ref) => {
43
49
  const minusOnClick = (e) => {
44
50
  e.stopPropagation();
45
51
  if (!disabled && isValid(step)) {
46
- const val = toPrecision(+value - +step, precision);
52
+ const val = toPrecision(+value - +step, resolvedPrecision);
47
53
  if (val >= min) {
48
54
  !("value" in props) && setValue(val);
49
55
  onChange && onChange(val, e);
@@ -60,7 +66,7 @@ const InputNumber = React.forwardRef((props, ref) => {
60
66
  children: [/* @__PURE__ */ jsx("input", {
61
67
  autoComplete: "off",
62
68
  disabled,
63
- value: precision !== void 0 ? value.toFixed(precision) : value,
69
+ value: resolvedPrecision > 0 ? value.toFixed(resolvedPrecision) : value,
64
70
  type: "number",
65
71
  className: `${prefixCls}__input`,
66
72
  max,
@@ -1 +1 @@
1
- {"version":3,"file":"input-number.js","names":[],"sources":["../../src/input-number/input-number.tsx"],"sourcesContent":["import React, { useEffect, useState, MouseEvent, useContext } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputNumberProps } from './types';\nimport { ArrowDown } from '../_utils/components';\n\n/**\n * Valid the string is a number\n * @param val\n */\nconst isValid = (val: string | number): boolean => {\n return !isNaN(+val);\n};\n\nconst toPrecision = (val: number, precision?: number): number => {\n if (precision === undefined) return val;\n return parseFloat(val.toFixed(precision));\n};\n\nconst InputNumber = React.forwardRef<HTMLDivElement, InputNumberProps>((props, ref) => {\n const {\n size = 'md',\n disabled = false,\n defaultValue = 0,\n step = 1,\n precision,\n controls = false,\n min = Number.NEGATIVE_INFINITY,\n max = Number.POSITIVE_INFINITY,\n onChange,\n className,\n prefixCls: customisedCls,\n style,\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-number', configContext.prefixCls, customisedCls);\n const inputSize = props.size || configContext.componentSize || size;\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_disabled`]: disabled,\n [`${prefixCls}_always-controls`]: controls,\n });\n const [value, setValue] = useState<number>(\n 'value' in props ? (props.value as number) : defaultValue\n );\n\n const inputOnChange = (e: React.ChangeEvent<HTMLInputElement>): void => {\n const raw = Number(e.target.value.trim());\n const val = toPrecision(raw, precision);\n !('value' in props) && setValue(val);\n onChange && isValid(val) && onChange(val, e);\n };\n\n const plusOnClick = (e: MouseEvent<HTMLSpanElement>): void => {\n e.stopPropagation();\n if (!disabled && isValid(step)) {\n const val = toPrecision(+value + +step, precision);\n if (val <= max) {\n !('value' in props) && setValue(val);\n onChange && onChange(val, e);\n }\n }\n };\n\n const minusOnClick = (e: MouseEvent<HTMLSpanElement>): void => {\n e.stopPropagation();\n if (!disabled && isValid(step)) {\n const val = toPrecision(+value - +step, precision);\n if (val >= min) {\n !('value' in props) && setValue(val);\n onChange && onChange(val, e);\n }\n }\n };\n\n useEffect(() => {\n 'value' in props && setValue(props.value as number);\n }, [props]);\n\n return (\n <div ref={ref} className={cls} style={style}>\n <input\n autoComplete=\"off\"\n disabled={disabled}\n value={precision !== undefined ? value.toFixed(precision) : value}\n type=\"number\"\n className={`${prefixCls}__input`}\n max={max}\n min={min}\n step={step}\n onChange={inputOnChange}\n aria-valuenow={value}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-disabled={disabled}\n />\n <div className={`${prefixCls}__controls`}>\n <span className={`${prefixCls}__up`} onClick={plusOnClick}>\n <ArrowDown size={8} className={`${prefixCls}__icon ${prefixCls}__icon_reverse`} />\n </span>\n <span className={`${prefixCls}__down`} onClick={minusOnClick}>\n <ArrowDown size={8} className={`${prefixCls}__icon`} />\n </span>\n </div>\n </div>\n );\n});\n\nInputNumber.displayName = 'InputNumber';\n\nexport default InputNumber;\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,WAAW,QAAkC;AACjD,QAAO,CAAC,MAAM,CAAC,IAAI;;AAGrB,MAAM,eAAe,KAAa,cAA+B;AAC/D,KAAI,cAAc,KAAA,EAAW,QAAO;AACpC,QAAO,WAAW,IAAI,QAAQ,UAAU,CAAC;;AAG3C,MAAM,cAAc,MAAM,YAA8C,OAAO,QAAQ;CACrF,MAAM,EACJ,OAAO,MACP,WAAW,OACX,eAAe,GACf,OAAO,GACP,WACA,WAAW,OACX,MAAM,OAAO,mBACb,MAAM,OAAO,mBACb,UACA,WACA,WAAW,eACX,UACE;CACJ,MAAM,gBAAgB,WAAW,cAAc;CAC/C,MAAM,YAAY,aAAa,gBAAgB,cAAc,WAAW,cAAc;CAEtF,MAAM,MAAM,WAAW,WAAW,WAAW,GAAG,UAAU,GADxC,MAAM,QAAQ,cAAc,iBAAiB,QACW;GACvE,GAAG,UAAU,aAAa;GAC1B,GAAG,UAAU,oBAAoB;EACnC,CAAC;CACF,MAAM,CAAC,OAAO,YAAY,SACxB,WAAW,QAAS,MAAM,QAAmB,aAC9C;CAED,MAAM,iBAAiB,MAAiD;EAEtE,MAAM,MAAM,YADA,OAAO,EAAE,OAAO,MAAM,MAAM,CAAC,EACZ,UAAU;AACvC,IAAE,WAAW,UAAU,SAAS,IAAI;AACpC,cAAY,QAAQ,IAAI,IAAI,SAAS,KAAK,EAAE;;CAG9C,MAAM,eAAe,MAAyC;AAC5D,IAAE,iBAAiB;AACnB,MAAI,CAAC,YAAY,QAAQ,KAAK,EAAE;GAC9B,MAAM,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,UAAU;AAClD,OAAI,OAAO,KAAK;AACd,MAAE,WAAW,UAAU,SAAS,IAAI;AACpC,gBAAY,SAAS,KAAK,EAAE;;;;CAKlC,MAAM,gBAAgB,MAAyC;AAC7D,IAAE,iBAAiB;AACnB,MAAI,CAAC,YAAY,QAAQ,KAAK,EAAE;GAC9B,MAAM,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,UAAU;AAClD,OAAI,OAAO,KAAK;AACd,MAAE,WAAW,UAAU,SAAS,IAAI;AACpC,gBAAY,SAAS,KAAK,EAAE;;;;AAKlC,iBAAgB;AACd,aAAW,SAAS,SAAS,MAAM,MAAgB;IAClD,CAAC,MAAM,CAAC;AAEX,QACE,qBAAC,OAAD;EAAU;EAAK,WAAW;EAAY;YAAtC,CACE,oBAAC,SAAD;GACE,cAAa;GACH;GACV,OAAO,cAAc,KAAA,IAAY,MAAM,QAAQ,UAAU,GAAG;GAC5D,MAAK;GACL,WAAW,GAAG,UAAU;GACnB;GACA;GACC;GACN,UAAU;GACV,iBAAe;GACf,iBAAe;GACf,iBAAe;GACf,iBAAe;GACf,CAAA,EACF,qBAAC,OAAD;GAAK,WAAW,GAAG,UAAU;aAA7B,CACE,oBAAC,QAAD;IAAM,WAAW,GAAG,UAAU;IAAO,SAAS;cAC5C,oBAAC,WAAD;KAAW,MAAM;KAAG,WAAW,GAAG,UAAU,SAAS,UAAU;KAAmB,CAAA;IAC7E,CAAA,EACP,oBAAC,QAAD;IAAM,WAAW,GAAG,UAAU;IAAS,SAAS;cAC9C,oBAAC,WAAD;KAAW,MAAM;KAAG,WAAW,GAAG,UAAU;KAAW,CAAA;IAClD,CAAA,CACH;KACF;;EAER;AAEF,YAAY,cAAc"}
1
+ {"version":3,"file":"input-number.js","names":[],"sources":["../../src/input-number/input-number.tsx"],"sourcesContent":["import React, { useEffect, useState, MouseEvent, useContext } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputNumberProps } from './types';\nimport { ArrowDown } from '../_utils/components';\n\n/**\n * Valid the string is a number\n * @param val\n */\nconst isValid = (val: string | number): boolean => {\n return !isNaN(+val);\n};\n\nconst getDecimalPrecision = (num: number): number => {\n const str = String(num);\n const dotIndex = str.indexOf('.');\n return dotIndex === -1 ? 0 : str.length - dotIndex - 1;\n};\n\nconst toPrecision = (val: number, precision: number): number => {\n return parseFloat(val.toFixed(precision));\n};\n\nconst InputNumber = React.forwardRef<HTMLDivElement, InputNumberProps>((props, ref) => {\n const {\n size = 'md',\n disabled = false,\n defaultValue = 0,\n step = 1,\n precision,\n controls = false,\n min = Number.NEGATIVE_INFINITY,\n max = Number.POSITIVE_INFINITY,\n onChange,\n className,\n prefixCls: customisedCls,\n style,\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-number', configContext.prefixCls, customisedCls);\n const inputSize = props.size || configContext.componentSize || size;\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_disabled`]: disabled,\n [`${prefixCls}_always-controls`]: controls,\n });\n const resolvedPrecision = precision ?? Math.max(getDecimalPrecision(step), getDecimalPrecision(defaultValue));\n const [value, setValue] = useState<number>(\n 'value' in props ? (props.value as number) : defaultValue\n );\n\n const inputOnChange = (e: React.ChangeEvent<HTMLInputElement>): void => {\n const raw = Number(e.target.value.trim());\n const val = resolvedPrecision > 0 ? toPrecision(raw, resolvedPrecision) : raw;\n !('value' in props) && setValue(val);\n onChange && isValid(val) && onChange(val, e);\n };\n\n const plusOnClick = (e: MouseEvent<HTMLSpanElement>): void => {\n e.stopPropagation();\n if (!disabled && isValid(step)) {\n const val = toPrecision(+value + +step, resolvedPrecision);\n if (val <= max) {\n !('value' in props) && setValue(val);\n onChange && onChange(val, e);\n }\n }\n };\n\n const minusOnClick = (e: MouseEvent<HTMLSpanElement>): void => {\n e.stopPropagation();\n if (!disabled && isValid(step)) {\n const val = toPrecision(+value - +step, resolvedPrecision);\n if (val >= min) {\n !('value' in props) && setValue(val);\n onChange && onChange(val, e);\n }\n }\n };\n\n useEffect(() => {\n 'value' in props && setValue(props.value as number);\n }, [props]);\n\n return (\n <div ref={ref} className={cls} style={style}>\n <input\n autoComplete=\"off\"\n disabled={disabled}\n value={resolvedPrecision > 0 ? value.toFixed(resolvedPrecision) : value}\n type=\"number\"\n className={`${prefixCls}__input`}\n max={max}\n min={min}\n step={step}\n onChange={inputOnChange}\n aria-valuenow={value}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-disabled={disabled}\n />\n <div className={`${prefixCls}__controls`}>\n <span className={`${prefixCls}__up`} onClick={plusOnClick}>\n <ArrowDown size={8} className={`${prefixCls}__icon ${prefixCls}__icon_reverse`} />\n </span>\n <span className={`${prefixCls}__down`} onClick={minusOnClick}>\n <ArrowDown size={8} className={`${prefixCls}__icon`} />\n </span>\n </div>\n </div>\n );\n});\n\nInputNumber.displayName = 'InputNumber';\n\nexport default InputNumber;\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,WAAW,QAAkC;AACjD,QAAO,CAAC,MAAM,CAAC,IAAI;;AAGrB,MAAM,uBAAuB,QAAwB;CACnD,MAAM,MAAM,OAAO,IAAI;CACvB,MAAM,WAAW,IAAI,QAAQ,IAAI;AACjC,QAAO,aAAa,KAAK,IAAI,IAAI,SAAS,WAAW;;AAGvD,MAAM,eAAe,KAAa,cAA8B;AAC9D,QAAO,WAAW,IAAI,QAAQ,UAAU,CAAC;;AAG3C,MAAM,cAAc,MAAM,YAA8C,OAAO,QAAQ;CACrF,MAAM,EACJ,OAAO,MACP,WAAW,OACX,eAAe,GACf,OAAO,GACP,WACA,WAAW,OACX,MAAM,OAAO,mBACb,MAAM,OAAO,mBACb,UACA,WACA,WAAW,eACX,UACE;CACJ,MAAM,gBAAgB,WAAW,cAAc;CAC/C,MAAM,YAAY,aAAa,gBAAgB,cAAc,WAAW,cAAc;CAEtF,MAAM,MAAM,WAAW,WAAW,WAAW,GAAG,UAAU,GADxC,MAAM,QAAQ,cAAc,iBAAiB,QACW;GACvE,GAAG,UAAU,aAAa;GAC1B,GAAG,UAAU,oBAAoB;EACnC,CAAC;CACF,MAAM,oBAAoB,aAAa,KAAK,IAAI,oBAAoB,KAAK,EAAE,oBAAoB,aAAa,CAAC;CAC7G,MAAM,CAAC,OAAO,YAAY,SACxB,WAAW,QAAS,MAAM,QAAmB,aAC9C;CAED,MAAM,iBAAiB,MAAiD;EACtE,MAAM,MAAM,OAAO,EAAE,OAAO,MAAM,MAAM,CAAC;EACzC,MAAM,MAAM,oBAAoB,IAAI,YAAY,KAAK,kBAAkB,GAAG;AAC1E,IAAE,WAAW,UAAU,SAAS,IAAI;AACpC,cAAY,QAAQ,IAAI,IAAI,SAAS,KAAK,EAAE;;CAG9C,MAAM,eAAe,MAAyC;AAC5D,IAAE,iBAAiB;AACnB,MAAI,CAAC,YAAY,QAAQ,KAAK,EAAE;GAC9B,MAAM,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,kBAAkB;AAC1D,OAAI,OAAO,KAAK;AACd,MAAE,WAAW,UAAU,SAAS,IAAI;AACpC,gBAAY,SAAS,KAAK,EAAE;;;;CAKlC,MAAM,gBAAgB,MAAyC;AAC7D,IAAE,iBAAiB;AACnB,MAAI,CAAC,YAAY,QAAQ,KAAK,EAAE;GAC9B,MAAM,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,kBAAkB;AAC1D,OAAI,OAAO,KAAK;AACd,MAAE,WAAW,UAAU,SAAS,IAAI;AACpC,gBAAY,SAAS,KAAK,EAAE;;;;AAKlC,iBAAgB;AACd,aAAW,SAAS,SAAS,MAAM,MAAgB;IAClD,CAAC,MAAM,CAAC;AAEX,QACE,qBAAC,OAAD;EAAU;EAAK,WAAW;EAAY;YAAtC,CACE,oBAAC,SAAD;GACE,cAAa;GACH;GACV,OAAO,oBAAoB,IAAI,MAAM,QAAQ,kBAAkB,GAAG;GAClE,MAAK;GACL,WAAW,GAAG,UAAU;GACnB;GACA;GACC;GACN,UAAU;GACV,iBAAe;GACf,iBAAe;GACf,iBAAe;GACf,iBAAe;GACf,CAAA,EACF,qBAAC,OAAD;GAAK,WAAW,GAAG,UAAU;aAA7B,CACE,oBAAC,QAAD;IAAM,WAAW,GAAG,UAAU;IAAO,SAAS;cAC5C,oBAAC,WAAD;KAAW,MAAM;KAAG,WAAW,GAAG,UAAU,SAAS,UAAU;KAAmB,CAAA;IAC7E,CAAA,EACP,oBAAC,QAAD;IAAM,WAAW,GAAG,UAAU;IAAS,SAAS;cAC9C,oBAAC,WAAD;KAAW,MAAM;KAAG,WAAW,GAAG,UAAU;KAAW,CAAA;IAClD,CAAA,CACH;KACF;;EAER;AAEF,YAAY,cAAc"}