@semcore/input 3.0.16 → 3.2.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.
- package/CHANGELOG.md +11 -46
- package/LICENSE +21 -0
- package/lib/cjs/Input.js +61 -42
- package/lib/cjs/Input.js.map +1 -1
- package/lib/cjs/style/input.shadow.css +0 -8
- package/lib/es6/Input.js +61 -42
- package/lib/es6/Input.js.map +1 -1
- package/lib/es6/style/input.shadow.css +0 -8
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [3.0
|
|
5
|
+
## [3.2.0] - 2022-10-10
|
|
6
6
|
|
|
7
7
|
### Changed
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Added support for React 18 🔥
|
|
10
10
|
|
|
11
|
-
## [3.0
|
|
11
|
+
## [3.1.0] - 2022-10-07
|
|
12
12
|
|
|
13
13
|
### Changed
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- Updated major dependency `@semcore/neighbor-location` [2.3.15 ~> 3.0.0]
|
|
16
|
+
- Remove useless styles for Addons.
|
|
17
|
+
|
|
18
|
+
## [3.0.16] - 2022-10-04
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [3.37.1 ~> 3.37.2], `@semcore/flex-box` [4.5.11 ~> 4.5.12]).
|
|
16
23
|
|
|
17
24
|
## [3.0.14] - 2022-08-23
|
|
18
25
|
|
|
@@ -26,18 +33,6 @@ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangel
|
|
|
26
33
|
|
|
27
34
|
- Version patch update due to children dependencies update (`@semcore/utils` [3.36.0 ~> 3.37.0], `@semcore/flex-box` [4.5.9 ~> 4.5.10]).
|
|
28
35
|
|
|
29
|
-
## [3.0.12] - 2022-08-11
|
|
30
|
-
|
|
31
|
-
### Changed
|
|
32
|
-
|
|
33
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.35.1 ~> 3.36.0], `@semcore/flex-box` [4.5.8 ~> 4.5.9]).
|
|
34
|
-
|
|
35
|
-
## [3.0.11] - 2022-08-01
|
|
36
|
-
|
|
37
|
-
### Changed
|
|
38
|
-
|
|
39
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.35.0 ~> 3.35.1], `@semcore/flex-box` [4.5.7 ~> 4.5.8]).
|
|
40
|
-
|
|
41
36
|
## [3.0.10] - 2022-07-22
|
|
42
37
|
|
|
43
38
|
### Changed
|
|
@@ -68,36 +63,6 @@ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangel
|
|
|
68
63
|
|
|
69
64
|
- Version patch update due to children dependencies update (`@semcore/utils` [3.33.0 ~> 3.34.0], `@semcore/flex-box` [4.5.5 ~> 4.5.6]).
|
|
70
65
|
|
|
71
|
-
## [3.0.5] - 2022-06-02
|
|
72
|
-
|
|
73
|
-
### Changed
|
|
74
|
-
|
|
75
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.32.2 ~> 3.33.0], `@semcore/flex-box` [4.5.4 ~> 4.5.5], `@semcore/icon` [2.26.1 ~> 2.27.0]).
|
|
76
|
-
|
|
77
|
-
## [3.0.4] - 2022-05-31
|
|
78
|
-
|
|
79
|
-
### Changed
|
|
80
|
-
|
|
81
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.32.1 ~> 3.32.2], `@semcore/flex-box` [4.5.3 ~> 4.5.4], `@semcore/icon` [2.26.0 ~> 2.26.1]).
|
|
82
|
-
|
|
83
|
-
## [3.0.3] - 2022-05-23
|
|
84
|
-
|
|
85
|
-
### Changed
|
|
86
|
-
|
|
87
|
-
- Version patch update due to children dependencies update (`@semcore/icon` [2.25.1 ~> 2.26.0]).
|
|
88
|
-
|
|
89
|
-
## [3.0.2] - 2022-05-19
|
|
90
|
-
|
|
91
|
-
### Changed
|
|
92
|
-
|
|
93
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.32.0 ~> 3.32.1], `@semcore/flex-box` [4.5.1 ~> 4.5.3], `@semcore/icon` [2.25.0 ~> 2.25.1]).
|
|
94
|
-
|
|
95
|
-
## [3.0.1] - 2022-05-18
|
|
96
|
-
|
|
97
|
-
### Changed
|
|
98
|
-
|
|
99
|
-
- Version patch update due to children dependencies update (`@semcore/icon` [2.24.0 ~> 2.25.0]).
|
|
100
|
-
|
|
101
66
|
## [3.0.0] - 2022-05-17
|
|
102
67
|
|
|
103
68
|
### BREAK
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright ©, 2022, Semrush Inc. (written by Roman Lysov, Sergey Kobets, Mikhail Karachev, Julia Mnizhek, Elena Krasnopolskaia, Mikhail Sereniti).
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/cjs/Input.js
CHANGED
|
@@ -29,7 +29,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
29
29
|
|
|
30
30
|
var _flexBox = require("@semcore/flex-box");
|
|
31
31
|
|
|
32
|
-
var _neighborLocation =
|
|
32
|
+
var _neighborLocation = _interopRequireDefault(require("@semcore/neighbor-location"));
|
|
33
33
|
|
|
34
34
|
var _autoFocusEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/autoFocusEnhance"));
|
|
35
35
|
|
|
@@ -52,26 +52,26 @@ var style = (
|
|
|
52
52
|
/*__reshadow_css_start__*/
|
|
53
53
|
_core.sstyled.insert(
|
|
54
54
|
/*__inner_css_start__*/
|
|
55
|
-
".
|
|
55
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___SInput_1r3kj_gg_ {\n display: inline-flex;\n width: 100%;\n align-items: center;\n position: relative;\n z-index: 0;\n vertical-align: middle;\n padding: 1px;\n box-sizing: border-box\n}\n\n.___SInput_1r3kj_gg_ input:-webkit-autofill {\n border-radius: 6px;\n -webkit-box-shadow: 0 0 0 30px rgb(250, 255, 189) inset\n }\n\n.___SInput_1r3kj_gg_ input:-webkit-autofill ~ .___SOutline_1r3kj_gg_ {\n background-color: rgb(250, 255, 189);\n }\n\n.___SValue_1r3kj_gg_ {\n /* hack for firefox */\n min-width: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n box-sizing: border-box;\n color: #191b23;\n font-size: inherit;\n text-overflow: ellipsis;\n font-family: inherit;\n background: transparent\n}\n\n.___SValue_1r3kj_gg_:focus {\n outline: none;\n }\n\n.___SValue_1r3kj_gg_::-moz-placeholder {\n color: #a9abb6;\n }\n\n.___SValue_1r3kj_gg_::placeholder {\n color: #a9abb6;\n }\n\n.___SValue_1r3kj_gg_:-moz-read-only ~ .___SOutline_1r3kj_gg_ {\n background: #f4f5f9;\n }\n\n.___SValue_1r3kj_gg_:read-only ~ .___SOutline_1r3kj_gg_ {\n background: #f4f5f9;\n }\n\n.___SValue_1r3kj_gg_:disabled {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n opacity: 0.3\n }\n\n.___SValue_1r3kj_gg_:disabled ~ .___SOutline_1r3kj_gg_ {\n opacity: 0.3;\n cursor: default;\n pointer-events: none;\n }\n\n.___SOutline_1r3kj_gg_ {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border: 1px solid;\n border-radius: 6px;\n z-index: -1;\n background: #fff;\n}\n\n.___SAddon_1r3kj_gg_ {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex: 0 0 auto;\n padding: 0 8px;\n height: 100%;\n color: #a9abb6;\n}\n\n.___SAddon_1r3kj_gg_.__interactive_1r3kj_gg_ {\n cursor: pointer\n}\n\n.___SAddon_1r3kj_gg_.__interactive_1r3kj_gg_:hover {\n color: #8a8e9b;\n }\n\n.___SAddon_1r3kj_gg_.__disabled_1r3kj_gg_ {\n opacity: 0.3;\n cursor: default;\n pointer-events: none;\n}\n\n.___SInput_1r3kj_gg_._size_m_1r3kj_gg_ {\n font-size: 14px;\n height: 28px;\n}\n\n.___SValue_1r3kj_gg_._size_m_1r3kj_gg_,\n.___SValue_1r3kj_gg_._size_l_1r3kj_gg_ {\n padding: 0 8px;\n}\n\n.___SInput_1r3kj_gg_._size_l_1r3kj_gg_ {\n font-size: 16px;\n height: 40px;\n padding-left: 4px;\n padding-right: 4px;\n}\n\n.___SInput_1r3kj_gg_.__focused_1r3kj_gg_ {\n z-index: 1;\n}\n\n.___SInput_1r3kj_gg_._state_normal_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-color: #c4c7cf;\n }\n\n.___SInput_1r3kj_gg_._state_normal_1r3kj_gg_ .___SValue_1r3kj_gg_:focus ~ .___SOutline_1r3kj_gg_ {\n border-color: #008ff8;\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n }\n\n.___SInput_1r3kj_gg_._state_valid_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-color: #59ddaa;\n }\n\n.___SInput_1r3kj_gg_._state_valid_1r3kj_gg_ .___SValue_1r3kj_gg_:focus ~ .___SOutline_1r3kj_gg_ {\n border-color: #009f81;\n box-shadow: 0px 0px 0px 3px rgba(0, 159, 129, 0.2);\n }\n\n.___SInput_1r3kj_gg_._state_invalid_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-color: #ffaeb5;\n }\n\n.___SInput_1r3kj_gg_._state_invalid_1r3kj_gg_ .___SValue_1r3kj_gg_:focus ~ .___SOutline_1r3kj_gg_ {\n border-color: #ff4953;\n box-shadow: 0px 0px 0px 3px rgba(255, 73, 83, 0.2);\n }\n\n.___SInput_1r3kj_gg_._neighborLocation_right_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n.___SInput_1r3kj_gg_._neighborLocation_both_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-radius: 0;\n border-left: none;\n }\n\n.___SInput_1r3kj_gg_._neighborLocation_left_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-left: none;\n }\n\n.___SValue_1r3kj_gg_._neighborLocation_right_1r3kj_gg_ {\n padding-right: 0;\n}\n\n.___SValue_1r3kj_gg_._neighborLocation_both_1r3kj_gg_ {\n padding-left: 0;\n padding-right: 0;\n}\n\n.___SValue_1r3kj_gg_._neighborLocation_left_1r3kj_gg_ {\n padding-left: 0;\n}\n"
|
|
56
56
|
/*__inner_css_end__*/
|
|
57
|
-
, "
|
|
57
|
+
, "1r3kj_gg_")
|
|
58
58
|
/*__reshadow_css_end__*/
|
|
59
59
|
, {
|
|
60
|
-
"__SInput": "
|
|
61
|
-
"__SOutline": "
|
|
62
|
-
"__SValue": "
|
|
63
|
-
"__SAddon": "
|
|
64
|
-
"_interactive": "
|
|
65
|
-
"_disabled": "
|
|
66
|
-
"_size_m": "
|
|
67
|
-
"_size_l": "
|
|
68
|
-
"_focused": "
|
|
69
|
-
"_state_normal": "
|
|
70
|
-
"_state_valid": "
|
|
71
|
-
"_state_invalid": "
|
|
72
|
-
"_neighborLocation_right": "
|
|
73
|
-
"_neighborLocation_both": "
|
|
74
|
-
"_neighborLocation_left": "
|
|
60
|
+
"__SInput": "___SInput_1r3kj_gg_",
|
|
61
|
+
"__SOutline": "___SOutline_1r3kj_gg_",
|
|
62
|
+
"__SValue": "___SValue_1r3kj_gg_",
|
|
63
|
+
"__SAddon": "___SAddon_1r3kj_gg_",
|
|
64
|
+
"_interactive": "__interactive_1r3kj_gg_",
|
|
65
|
+
"_disabled": "__disabled_1r3kj_gg_",
|
|
66
|
+
"_size_m": "_size_m_1r3kj_gg_",
|
|
67
|
+
"_size_l": "_size_l_1r3kj_gg_",
|
|
68
|
+
"_focused": "__focused_1r3kj_gg_",
|
|
69
|
+
"_state_normal": "_state_normal_1r3kj_gg_",
|
|
70
|
+
"_state_valid": "_state_valid_1r3kj_gg_",
|
|
71
|
+
"_state_invalid": "_state_invalid_1r3kj_gg_",
|
|
72
|
+
"_neighborLocation_right": "_neighborLocation_right_1r3kj_gg_",
|
|
73
|
+
"_neighborLocation_both": "_neighborLocation_both_1r3kj_gg_",
|
|
74
|
+
"_neighborLocation_left": "_neighborLocation_left_1r3kj_gg_"
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
var Input = /*#__PURE__*/function (_Component) {
|
|
@@ -135,21 +135,27 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
135
135
|
}, {
|
|
136
136
|
key: "render",
|
|
137
137
|
value: function render() {
|
|
138
|
-
var _ref = this.asProps
|
|
139
|
-
_ref4;
|
|
140
|
-
|
|
138
|
+
var _ref = this.asProps;
|
|
141
139
|
var SInput = _flexBox.Box;
|
|
142
140
|
var SOutline = 'div';
|
|
143
141
|
var _this$asProps2 = this.asProps,
|
|
144
142
|
Children = _this$asProps2.Children,
|
|
145
143
|
styles = _this$asProps2.styles,
|
|
144
|
+
neighborLocation = _this$asProps2.neighborLocation,
|
|
146
145
|
controlsLength = _this$asProps2.controlsLength;
|
|
147
146
|
var focused = this.state.focused;
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
return /*#__PURE__*/_react["default"].createElement(_neighborLocation["default"].Detect, {
|
|
148
|
+
neighborLocation: neighborLocation
|
|
149
|
+
}, function (neighborLocation) {
|
|
150
|
+
var _ref4;
|
|
151
|
+
|
|
152
|
+
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SInput, _ref4.cn("SInput", _objectSpread({}, (0, _core.assignProps)({
|
|
153
|
+
"focused": focused,
|
|
154
|
+
"neighborLocation": neighborLocation
|
|
155
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(_neighborLocation["default"], _ref4.cn("NeighborLocation", {
|
|
156
|
+
"controlsLength": controlsLength
|
|
157
|
+
}), /*#__PURE__*/_react["default"].createElement(Children, _ref4.cn("Children", {}))), /*#__PURE__*/_react["default"].createElement(SOutline, _ref4.cn("SOutline", {})));
|
|
158
|
+
});
|
|
153
159
|
}
|
|
154
160
|
}]);
|
|
155
161
|
return Input;
|
|
@@ -161,7 +167,6 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
161
167
|
state: 'normal'
|
|
162
168
|
});
|
|
163
169
|
(0, _defineProperty2["default"])(Input, "style", style);
|
|
164
|
-
(0, _defineProperty2["default"])(Input, "enhance", [(0, _neighborLocation.neighborLocationEnhance)()]);
|
|
165
170
|
|
|
166
171
|
var Value = /*#__PURE__*/function (_Component2) {
|
|
167
172
|
(0, _inherits2["default"])(Value, _Component2);
|
|
@@ -185,14 +190,22 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
185
190
|
}, {
|
|
186
191
|
key: "render",
|
|
187
192
|
value: function render() {
|
|
188
|
-
var _ref2 = this.asProps
|
|
189
|
-
_ref5;
|
|
190
|
-
|
|
193
|
+
var _ref2 = this.asProps;
|
|
191
194
|
var SValue = _flexBox.Box;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
var _this$asProps3 = this.asProps,
|
|
196
|
+
styles = _this$asProps3.styles,
|
|
197
|
+
neighborLocation = _this$asProps3.neighborLocation;
|
|
198
|
+
return /*#__PURE__*/_react["default"].createElement(_neighborLocation["default"].Detect, {
|
|
199
|
+
neighborLocation: neighborLocation
|
|
200
|
+
}, function (neighborLocation) {
|
|
201
|
+
var _ref5;
|
|
202
|
+
|
|
203
|
+
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SValue, _ref5.cn("SValue", _objectSpread({}, (0, _core.assignProps)({
|
|
204
|
+
"neighborLocation": neighborLocation,
|
|
205
|
+
"tag": "input",
|
|
206
|
+
"type": "text"
|
|
207
|
+
}, _ref2))));
|
|
208
|
+
});
|
|
196
209
|
}
|
|
197
210
|
}]);
|
|
198
211
|
return Value;
|
|
@@ -201,19 +214,25 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
201
214
|
(0, _defineProperty2["default"])(Value, "defaultProps", {
|
|
202
215
|
defaultValue: ''
|
|
203
216
|
});
|
|
204
|
-
(0, _defineProperty2["default"])(Value, "enhance", [(0, _keyboardFocusEnhance["default"])(), (0, _autoFocusEnhance["default"])()
|
|
217
|
+
(0, _defineProperty2["default"])(Value, "enhance", [(0, _keyboardFocusEnhance["default"])(), (0, _autoFocusEnhance["default"])()]);
|
|
205
218
|
|
|
206
219
|
function Addon(props) {
|
|
207
|
-
var _ref3 = arguments[0]
|
|
208
|
-
_ref6;
|
|
209
|
-
|
|
220
|
+
var _ref3 = arguments[0];
|
|
210
221
|
var SAddon = _flexBox.Box;
|
|
211
|
-
var Children = props.Children
|
|
212
|
-
|
|
222
|
+
var Children = props.Children,
|
|
223
|
+
styles = props.styles,
|
|
224
|
+
neighborLocation = props.neighborLocation;
|
|
225
|
+
return /*#__PURE__*/_react["default"].createElement(_neighborLocation["default"].Detect, {
|
|
226
|
+
neighborLocation: neighborLocation
|
|
227
|
+
}, function (neighborLocation) {
|
|
228
|
+
var _ref6;
|
|
229
|
+
|
|
230
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SAddon, _ref6.cn("SAddon", _objectSpread({}, (0, _core.assignProps)({
|
|
231
|
+
"neighborLocation": neighborLocation
|
|
232
|
+
}, _ref3))), /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {})));
|
|
233
|
+
});
|
|
213
234
|
}
|
|
214
235
|
|
|
215
|
-
Addon.enhance = [(0, _neighborLocation.neighborLocationEnhance)()];
|
|
216
|
-
|
|
217
236
|
var _default = (0, _core["default"])(Input, {
|
|
218
237
|
Addon: Addon,
|
|
219
238
|
Value: Value
|
package/lib/cjs/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["Input","focused","React","createRef","e","preventDefault","inputRef","current","focus","setState","disabled","asProps","onMouseDown","handleMouseDownAddon","size","ref","onFocus","bindHandlerValueFocused","onBlur","SInput","Box","SOutline","Children","styles","controlsLength","state","sstyled","Component","style","
|
|
1
|
+
{"version":3,"file":"Input.js","names":["Input","focused","React","createRef","e","preventDefault","inputRef","current","focus","setState","disabled","asProps","onMouseDown","handleMouseDownAddon","size","ref","onFocus","bindHandlerValueFocused","onBlur","SInput","Box","SOutline","Children","styles","neighborLocation","controlsLength","state","sstyled","Component","style","Value","value","target","SValue","defaultValue","keyboardFocusEnhance","autoFocusEnhance","Addon","props","SAddon","createComponent"],"sources":["../../src/Input.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport autoFocusEnhance from '@semcore/utils/lib/enhances/autoFocusEnhance';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nimport style from './style/input.shadow.css';\n\nclass Input extends Component {\n static displayName = 'Input';\n\n static defaultProps = {\n size: 'm',\n state: 'normal',\n };\n static style = style;\n\n state = {\n focused: false,\n };\n\n inputRef = React.createRef();\n\n handleMouseDownAddon = (e) => {\n e.preventDefault();\n this.inputRef.current?.focus();\n };\n\n bindHandlerValueFocused = (focused) => () => this.setState({ focused });\n\n getAddonProps() {\n const { disabled } = this.asProps;\n return {\n disabled,\n onMouseDown: this.handleMouseDownAddon,\n };\n }\n\n getValueProps() {\n const { size, disabled } = this.asProps;\n return {\n ref: this.inputRef,\n size,\n disabled,\n onFocus: this.bindHandlerValueFocused(true),\n onBlur: this.bindHandlerValueFocused(false),\n };\n }\n\n render() {\n const SInput = Root;\n const SOutline = 'div';\n const { Children, styles, neighborLocation, controlsLength } = this.asProps;\n const { focused } = this.state;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SInput render={Box} focused={focused} neighborLocation={neighborLocation}>\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline />\n </SInput>,\n )\n }\n </NeighborLocation.Detect>\n );\n }\n}\n\nclass Value extends Component {\n static defaultProps = {\n defaultValue: '',\n };\n static enhance = [keyboardFocusEnhance(), autoFocusEnhance()];\n\n uncontrolledProps() {\n return {\n value: (e) => e.target.value,\n };\n }\n\n render() {\n const SValue = Root;\n const { styles, neighborLocation } = this.asProps;\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SValue render={Box} neighborLocation={neighborLocation} tag=\"input\" type=\"text\" />,\n )\n }\n </NeighborLocation.Detect>\n );\n }\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { Children, styles, neighborLocation } = props;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SAddon render={Box} neighborLocation={neighborLocation}>\n <Children />\n </SAddon>,\n )\n }\n </NeighborLocation.Detect>\n );\n}\n\nexport default createComponent(Input, {\n Addon,\n Value,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIMA,K;;;;;;;;;;;;;;;8FASI;MACNC,OAAO,EAAE;IADH,C;8GAIGC,iBAAA,CAAMC,SAAN,E;6GAEY,UAACC,CAAD,EAAO;MAAA;;MAC5BA,CAAC,CAACC,cAAF;MACA,+BAAKC,QAAL,CAAcC,OAAd,gFAAuBC,KAAvB;IACD,C;gHAEyB,UAACP,OAAD;MAAA,OAAa;QAAA,OAAM,MAAKQ,QAAL,CAAc;UAAER,OAAO,EAAPA;QAAF,CAAd,CAAN;MAAA,CAAb;IAAA,C;;;;;;WAE1B,yBAAgB;MACd,IAAQS,QAAR,GAAqB,KAAKC,OAA1B,CAAQD,QAAR;MACA,OAAO;QACLA,QAAQ,EAARA,QADK;QAELE,WAAW,EAAE,KAAKC;MAFb,CAAP;IAID;;;WAED,yBAAgB;MACd,oBAA2B,KAAKF,OAAhC;MAAA,IAAQG,IAAR,iBAAQA,IAAR;MAAA,IAAcJ,QAAd,iBAAcA,QAAd;MACA,OAAO;QACLK,GAAG,EAAE,KAAKT,QADL;QAELQ,IAAI,EAAJA,IAFK;QAGLJ,QAAQ,EAARA,QAHK;QAILM,OAAO,EAAE,KAAKC,uBAAL,CAA6B,IAA7B,CAJJ;QAKLC,MAAM,EAAE,KAAKD,uBAAL,CAA6B,KAA7B;MALH,CAAP;IAOD;;;WAED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,gCAAC,MAAD;UAAA,oBAAuCC,gBAAvC;UAAA,OAA6D,OAA7D;UAAA,QAA0E;QAA1E,YAFH;MAAA,CADH,CADF;IASD;;;EAzBiBI,e;;iCAAdE,K,kBACkB;EACpBI,YAAY,EAAE;AADM,C;iCADlBJ,K,aAIa,CAAC,IAAAK,gCAAA,GAAD,EAAyB,IAAAC,4BAAA,GAAzB,C;;AAwBnB,SAASC,KAAT,CAAeC,KAAf,EAAsB;EAAA;EACpB,IAAMC,MAAM,GAMYnB,YANxB;EACA,IAAQE,QAAR,GAA+CgB,KAA/C,CAAQhB,QAAR;EAAA,IAAkBC,MAAlB,GAA+Ce,KAA/C,CAAkBf,MAAlB;EAAA,IAA0BC,gBAA1B,GAA+Cc,KAA/C,CAA0Bd,gBAA1B;EACA,oBACE,gCAAC,4BAAD,CAAkB,MAAlB;IAAyB,gBAAgB,EAAEA;EAA3C,GACG,UAACA,gBAAD;IAAA;;IAAA,eACC,IAAAG,aAAA,EAAQJ,MAAR,CADD,eAEG,gCAAC,MAAD;MAAA,oBAAuCC;IAAvC,0BACE,gCAAC,QAAD,2BADF,CAFH;EAAA,CADH,CADF;AAWD;;eAEc,IAAAgB,gBAAA,EAAgBxC,KAAhB,EAAuB;EACpCqC,KAAK,EAALA,KADoC;EAEpCP,KAAK,EAALA;AAFoC,CAAvB,C"}
|
|
@@ -166,14 +166,6 @@ SInput[neighborLocation='left'] {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
SAddon[neighborLocation='right'] {
|
|
170
|
-
padding-right: 8px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
SAddon[neighborLocation='left'] {
|
|
174
|
-
padding-left: 8px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
169
|
SValue[neighborLocation='right'] {
|
|
178
170
|
padding-right: 0;
|
|
179
171
|
}
|
package/lib/es6/Input.js
CHANGED
|
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
import React from 'react';
|
|
22
22
|
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
23
23
|
import { Box } from '@semcore/flex-box';
|
|
24
|
-
import NeighborLocation
|
|
24
|
+
import NeighborLocation from '@semcore/neighbor-location';
|
|
25
25
|
import autoFocusEnhance from '@semcore/utils/lib/enhances/autoFocusEnhance';
|
|
26
26
|
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
27
27
|
|
|
@@ -30,26 +30,26 @@ var style = (
|
|
|
30
30
|
/*__reshadow_css_start__*/
|
|
31
31
|
_sstyled.insert(
|
|
32
32
|
/*__inner_css_start__*/
|
|
33
|
-
".
|
|
33
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___SInput_1r3kj_gg_ {\n display: inline-flex;\n width: 100%;\n align-items: center;\n position: relative;\n z-index: 0;\n vertical-align: middle;\n padding: 1px;\n box-sizing: border-box\n}\n\n.___SInput_1r3kj_gg_ input:-webkit-autofill {\n border-radius: 6px;\n -webkit-box-shadow: 0 0 0 30px rgb(250, 255, 189) inset\n }\n\n.___SInput_1r3kj_gg_ input:-webkit-autofill ~ .___SOutline_1r3kj_gg_ {\n background-color: rgb(250, 255, 189);\n }\n\n.___SValue_1r3kj_gg_ {\n /* hack for firefox */\n min-width: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n box-sizing: border-box;\n color: #191b23;\n font-size: inherit;\n text-overflow: ellipsis;\n font-family: inherit;\n background: transparent\n}\n\n.___SValue_1r3kj_gg_:focus {\n outline: none;\n }\n\n.___SValue_1r3kj_gg_::-moz-placeholder {\n color: #a9abb6;\n }\n\n.___SValue_1r3kj_gg_::placeholder {\n color: #a9abb6;\n }\n\n.___SValue_1r3kj_gg_:-moz-read-only ~ .___SOutline_1r3kj_gg_ {\n background: #f4f5f9;\n }\n\n.___SValue_1r3kj_gg_:read-only ~ .___SOutline_1r3kj_gg_ {\n background: #f4f5f9;\n }\n\n.___SValue_1r3kj_gg_:disabled {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n opacity: 0.3\n }\n\n.___SValue_1r3kj_gg_:disabled ~ .___SOutline_1r3kj_gg_ {\n opacity: 0.3;\n cursor: default;\n pointer-events: none;\n }\n\n.___SOutline_1r3kj_gg_ {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border: 1px solid;\n border-radius: 6px;\n z-index: -1;\n background: #fff;\n}\n\n.___SAddon_1r3kj_gg_ {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex: 0 0 auto;\n padding: 0 8px;\n height: 100%;\n color: #a9abb6;\n}\n\n.___SAddon_1r3kj_gg_.__interactive_1r3kj_gg_ {\n cursor: pointer\n}\n\n.___SAddon_1r3kj_gg_.__interactive_1r3kj_gg_:hover {\n color: #8a8e9b;\n }\n\n.___SAddon_1r3kj_gg_.__disabled_1r3kj_gg_ {\n opacity: 0.3;\n cursor: default;\n pointer-events: none;\n}\n\n.___SInput_1r3kj_gg_._size_m_1r3kj_gg_ {\n font-size: 14px;\n height: 28px;\n}\n\n.___SValue_1r3kj_gg_._size_m_1r3kj_gg_,\n.___SValue_1r3kj_gg_._size_l_1r3kj_gg_ {\n padding: 0 8px;\n}\n\n.___SInput_1r3kj_gg_._size_l_1r3kj_gg_ {\n font-size: 16px;\n height: 40px;\n padding-left: 4px;\n padding-right: 4px;\n}\n\n.___SInput_1r3kj_gg_.__focused_1r3kj_gg_ {\n z-index: 1;\n}\n\n.___SInput_1r3kj_gg_._state_normal_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-color: #c4c7cf;\n }\n\n.___SInput_1r3kj_gg_._state_normal_1r3kj_gg_ .___SValue_1r3kj_gg_:focus ~ .___SOutline_1r3kj_gg_ {\n border-color: #008ff8;\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n }\n\n.___SInput_1r3kj_gg_._state_valid_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-color: #59ddaa;\n }\n\n.___SInput_1r3kj_gg_._state_valid_1r3kj_gg_ .___SValue_1r3kj_gg_:focus ~ .___SOutline_1r3kj_gg_ {\n border-color: #009f81;\n box-shadow: 0px 0px 0px 3px rgba(0, 159, 129, 0.2);\n }\n\n.___SInput_1r3kj_gg_._state_invalid_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-color: #ffaeb5;\n }\n\n.___SInput_1r3kj_gg_._state_invalid_1r3kj_gg_ .___SValue_1r3kj_gg_:focus ~ .___SOutline_1r3kj_gg_ {\n border-color: #ff4953;\n box-shadow: 0px 0px 0px 3px rgba(255, 73, 83, 0.2);\n }\n\n.___SInput_1r3kj_gg_._neighborLocation_right_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n.___SInput_1r3kj_gg_._neighborLocation_both_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-radius: 0;\n border-left: none;\n }\n\n.___SInput_1r3kj_gg_._neighborLocation_left_1r3kj_gg_ .___SOutline_1r3kj_gg_ {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-left: none;\n }\n\n.___SValue_1r3kj_gg_._neighborLocation_right_1r3kj_gg_ {\n padding-right: 0;\n}\n\n.___SValue_1r3kj_gg_._neighborLocation_both_1r3kj_gg_ {\n padding-left: 0;\n padding-right: 0;\n}\n\n.___SValue_1r3kj_gg_._neighborLocation_left_1r3kj_gg_ {\n padding-left: 0;\n}\n"
|
|
34
34
|
/*__inner_css_end__*/
|
|
35
|
-
, "
|
|
35
|
+
, "1r3kj_gg_")
|
|
36
36
|
/*__reshadow_css_end__*/
|
|
37
37
|
, {
|
|
38
|
-
"__SInput": "
|
|
39
|
-
"__SOutline": "
|
|
40
|
-
"__SValue": "
|
|
41
|
-
"__SAddon": "
|
|
42
|
-
"_interactive": "
|
|
43
|
-
"_disabled": "
|
|
44
|
-
"_size_m": "
|
|
45
|
-
"_size_l": "
|
|
46
|
-
"_focused": "
|
|
47
|
-
"_state_normal": "
|
|
48
|
-
"_state_valid": "
|
|
49
|
-
"_state_invalid": "
|
|
50
|
-
"_neighborLocation_right": "
|
|
51
|
-
"_neighborLocation_both": "
|
|
52
|
-
"_neighborLocation_left": "
|
|
38
|
+
"__SInput": "___SInput_1r3kj_gg_",
|
|
39
|
+
"__SOutline": "___SOutline_1r3kj_gg_",
|
|
40
|
+
"__SValue": "___SValue_1r3kj_gg_",
|
|
41
|
+
"__SAddon": "___SAddon_1r3kj_gg_",
|
|
42
|
+
"_interactive": "__interactive_1r3kj_gg_",
|
|
43
|
+
"_disabled": "__disabled_1r3kj_gg_",
|
|
44
|
+
"_size_m": "_size_m_1r3kj_gg_",
|
|
45
|
+
"_size_l": "_size_l_1r3kj_gg_",
|
|
46
|
+
"_focused": "__focused_1r3kj_gg_",
|
|
47
|
+
"_state_normal": "_state_normal_1r3kj_gg_",
|
|
48
|
+
"_state_valid": "_state_valid_1r3kj_gg_",
|
|
49
|
+
"_state_invalid": "_state_invalid_1r3kj_gg_",
|
|
50
|
+
"_neighborLocation_right": "_neighborLocation_right_1r3kj_gg_",
|
|
51
|
+
"_neighborLocation_both": "_neighborLocation_both_1r3kj_gg_",
|
|
52
|
+
"_neighborLocation_left": "_neighborLocation_left_1r3kj_gg_"
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
var Input = /*#__PURE__*/function (_Component) {
|
|
@@ -118,21 +118,27 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
118
118
|
}, {
|
|
119
119
|
key: "render",
|
|
120
120
|
value: function render() {
|
|
121
|
-
var _ref = this.asProps
|
|
122
|
-
_ref4;
|
|
123
|
-
|
|
121
|
+
var _ref = this.asProps;
|
|
124
122
|
var SInput = Box;
|
|
125
123
|
var SOutline = 'div';
|
|
126
124
|
var _this$asProps2 = this.asProps,
|
|
127
125
|
Children = _this$asProps2.Children,
|
|
128
126
|
styles = _this$asProps2.styles,
|
|
127
|
+
neighborLocation = _this$asProps2.neighborLocation,
|
|
129
128
|
controlsLength = _this$asProps2.controlsLength;
|
|
130
129
|
var focused = this.state.focused;
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
return /*#__PURE__*/React.createElement(NeighborLocation.Detect, {
|
|
131
|
+
neighborLocation: neighborLocation
|
|
132
|
+
}, function (neighborLocation) {
|
|
133
|
+
var _ref4;
|
|
134
|
+
|
|
135
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SInput, _ref4.cn("SInput", _objectSpread({}, _assignProps({
|
|
136
|
+
"focused": focused,
|
|
137
|
+
"neighborLocation": neighborLocation
|
|
138
|
+
}, _ref))), /*#__PURE__*/React.createElement(NeighborLocation, _ref4.cn("NeighborLocation", {
|
|
139
|
+
"controlsLength": controlsLength
|
|
140
|
+
}), /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {}))), /*#__PURE__*/React.createElement(SOutline, _ref4.cn("SOutline", {})));
|
|
141
|
+
});
|
|
136
142
|
}
|
|
137
143
|
}]);
|
|
138
144
|
|
|
@@ -148,8 +154,6 @@ _defineProperty(Input, "defaultProps", {
|
|
|
148
154
|
|
|
149
155
|
_defineProperty(Input, "style", style);
|
|
150
156
|
|
|
151
|
-
_defineProperty(Input, "enhance", [neighborLocationEnhance()]);
|
|
152
|
-
|
|
153
157
|
var Value = /*#__PURE__*/function (_Component2) {
|
|
154
158
|
_inherits(Value, _Component2);
|
|
155
159
|
|
|
@@ -173,14 +177,22 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
173
177
|
}, {
|
|
174
178
|
key: "render",
|
|
175
179
|
value: function render() {
|
|
176
|
-
var _ref2 = this.asProps
|
|
177
|
-
_ref5;
|
|
178
|
-
|
|
180
|
+
var _ref2 = this.asProps;
|
|
179
181
|
var SValue = Box;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
var _this$asProps3 = this.asProps,
|
|
183
|
+
styles = _this$asProps3.styles,
|
|
184
|
+
neighborLocation = _this$asProps3.neighborLocation;
|
|
185
|
+
return /*#__PURE__*/React.createElement(NeighborLocation.Detect, {
|
|
186
|
+
neighborLocation: neighborLocation
|
|
187
|
+
}, function (neighborLocation) {
|
|
188
|
+
var _ref5;
|
|
189
|
+
|
|
190
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SValue, _ref5.cn("SValue", _objectSpread({}, _assignProps2({
|
|
191
|
+
"neighborLocation": neighborLocation,
|
|
192
|
+
"tag": "input",
|
|
193
|
+
"type": "text"
|
|
194
|
+
}, _ref2))));
|
|
195
|
+
});
|
|
184
196
|
}
|
|
185
197
|
}]);
|
|
186
198
|
|
|
@@ -191,18 +203,25 @@ _defineProperty(Value, "defaultProps", {
|
|
|
191
203
|
defaultValue: ''
|
|
192
204
|
});
|
|
193
205
|
|
|
194
|
-
_defineProperty(Value, "enhance", [keyboardFocusEnhance(), autoFocusEnhance()
|
|
206
|
+
_defineProperty(Value, "enhance", [keyboardFocusEnhance(), autoFocusEnhance()]);
|
|
195
207
|
|
|
196
208
|
function Addon(props) {
|
|
197
|
-
var _ref3 = arguments[0]
|
|
198
|
-
_ref6;
|
|
199
|
-
|
|
209
|
+
var _ref3 = arguments[0];
|
|
200
210
|
var SAddon = Box;
|
|
201
|
-
var Children = props.Children
|
|
202
|
-
|
|
211
|
+
var Children = props.Children,
|
|
212
|
+
styles = props.styles,
|
|
213
|
+
neighborLocation = props.neighborLocation;
|
|
214
|
+
return /*#__PURE__*/React.createElement(NeighborLocation.Detect, {
|
|
215
|
+
neighborLocation: neighborLocation
|
|
216
|
+
}, function (neighborLocation) {
|
|
217
|
+
var _ref6;
|
|
218
|
+
|
|
219
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SAddon, _ref6.cn("SAddon", _objectSpread({}, _assignProps3({
|
|
220
|
+
"neighborLocation": neighborLocation
|
|
221
|
+
}, _ref3))), /*#__PURE__*/React.createElement(Children, _ref6.cn("Children", {})));
|
|
222
|
+
});
|
|
203
223
|
}
|
|
204
224
|
|
|
205
|
-
Addon.enhance = [neighborLocationEnhance()];
|
|
206
225
|
export default createComponent(Input, {
|
|
207
226
|
Addon: Addon,
|
|
208
227
|
Value: Value
|
package/lib/es6/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","
|
|
1
|
+
{"version":3,"file":"Input.js","names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","autoFocusEnhance","keyboardFocusEnhance","Input","focused","createRef","e","preventDefault","inputRef","current","focus","setState","disabled","asProps","onMouseDown","handleMouseDownAddon","size","ref","onFocus","bindHandlerValueFocused","onBlur","SInput","SOutline","Children","styles","neighborLocation","controlsLength","state","style","Value","value","target","SValue","defaultValue","Addon","props","SAddon"],"sources":["../../src/Input.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport autoFocusEnhance from '@semcore/utils/lib/enhances/autoFocusEnhance';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nimport style from './style/input.shadow.css';\n\nclass Input extends Component {\n static displayName = 'Input';\n\n static defaultProps = {\n size: 'm',\n state: 'normal',\n };\n static style = style;\n\n state = {\n focused: false,\n };\n\n inputRef = React.createRef();\n\n handleMouseDownAddon = (e) => {\n e.preventDefault();\n this.inputRef.current?.focus();\n };\n\n bindHandlerValueFocused = (focused) => () => this.setState({ focused });\n\n getAddonProps() {\n const { disabled } = this.asProps;\n return {\n disabled,\n onMouseDown: this.handleMouseDownAddon,\n };\n }\n\n getValueProps() {\n const { size, disabled } = this.asProps;\n return {\n ref: this.inputRef,\n size,\n disabled,\n onFocus: this.bindHandlerValueFocused(true),\n onBlur: this.bindHandlerValueFocused(false),\n };\n }\n\n render() {\n const SInput = Root;\n const SOutline = 'div';\n const { Children, styles, neighborLocation, controlsLength } = this.asProps;\n const { focused } = this.state;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SInput render={Box} focused={focused} neighborLocation={neighborLocation}>\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline />\n </SInput>,\n )\n }\n </NeighborLocation.Detect>\n );\n }\n}\n\nclass Value extends Component {\n static defaultProps = {\n defaultValue: '',\n };\n static enhance = [keyboardFocusEnhance(), autoFocusEnhance()];\n\n uncontrolledProps() {\n return {\n value: (e) => e.target.value,\n };\n }\n\n render() {\n const SValue = Root;\n const { styles, neighborLocation } = this.asProps;\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SValue render={Box} neighborLocation={neighborLocation} tag=\"input\" type=\"text\" />,\n )\n }\n </NeighborLocation.Detect>\n );\n }\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { Children, styles, neighborLocation } = props;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SAddon render={Box} neighborLocation={neighborLocation}>\n <Children />\n </SAddon>,\n )\n }\n </NeighborLocation.Detect>\n );\n}\n\nexport default createComponent(Input, {\n Addon,\n Value,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,gBAAP,MAA6B,8CAA7B;AACA,OAAOC,oBAAP,MAAiC,kDAAjC;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AAlB,GAA+CW,KAA/C,CAAkBX,MAAlB;EAAA,IAA0BC,gBAA1B,GAA+CU,KAA/C,CAA0BV,gBAA1B;EACA,oBACE,oBAAC,gBAAD,CAAkB,MAAlB;IAAyB,gBAAgB,EAAEA;EAA3C,GACG,UAACA,gBAAD;IAAA;;IAAA,eACC5B,OAAO,CAAC2B,MAAD,CADR,eAEG,oBAAC,MAAD;MAAA,oBAAuCC;IAAvC,0BACE,oBAAC,QAAD,2BADF,CAFH;EAAA,CADH,CADF;AAWD;;AAED,eAAe9B,eAAe,CAACQ,KAAD,EAAQ;EACpC+B,KAAK,EAALA,KADoC;EAEpCL,KAAK,EAALA;AAFoC,CAAR,CAA9B"}
|
|
@@ -166,14 +166,6 @@ SInput[neighborLocation='left'] {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
SAddon[neighborLocation='right'] {
|
|
170
|
-
padding-right: 8px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
SAddon[neighborLocation='left'] {
|
|
174
|
-
padding-left: 8px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
169
|
SValue[neighborLocation='right'] {
|
|
178
170
|
padding-right: 0;
|
|
179
171
|
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/input",
|
|
3
3
|
"description": "Semrush Input Component",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "pnpm semcore-builder --source=js",
|
|
13
|
-
"test": "jest"
|
|
14
|
-
},
|
|
15
11
|
"dependencies": {
|
|
16
12
|
"@semcore/utils": "^3.15",
|
|
17
|
-
"@semcore/neighbor-location": "^
|
|
13
|
+
"@semcore/neighbor-location": "^3",
|
|
18
14
|
"@semcore/flex-box": "^4"
|
|
19
15
|
},
|
|
20
16
|
"peerDependencies": {
|
|
21
17
|
"@semcore/core": "^1.11",
|
|
22
|
-
"react": "16.8 -
|
|
18
|
+
"react": "16.8 - 18"
|
|
23
19
|
},
|
|
24
20
|
"jest": {
|
|
25
21
|
"preset": "@semcore/jest-preset-ui"
|
|
@@ -30,8 +26,12 @@
|
|
|
30
26
|
"directory": "semcore/input"
|
|
31
27
|
},
|
|
32
28
|
"devDependencies": {
|
|
33
|
-
"@types/react": "
|
|
29
|
+
"@types/react": "18.0.21",
|
|
34
30
|
"@semcore/jest-preset-ui": "1.0.0",
|
|
35
31
|
"@semcore/icon": "*"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "pnpm semcore-builder --source=js",
|
|
35
|
+
"test": "jest"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|