@semcore/input 16.0.1 → 16.0.2-prerelease.1
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 +6 -0
- package/README.md +1 -31
- package/lib/cjs/Input.js +36 -39
- package/lib/cjs/Input.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/Input.js +34 -36
- package/lib/es6/Input.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/Input.mjs +38 -38
- package/lib/types/index.d.ts +5 -5
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [16.0.2] - 2025-06-13
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/flex-box` [16.0.1 ~> 16.0.2], `@semcore/base-components` [16.0.1 ~> 16.0.2]).
|
|
10
|
+
|
|
5
11
|
## [16.0.1] - 2025-05-30
|
|
6
12
|
|
|
7
13
|
### Changed
|
package/README.md
CHANGED
|
@@ -13,40 +13,10 @@
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install
|
|
16
|
+
npm install @semcore/input
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Usage
|
|
20
19
|
|
|
21
|
-
```jsx
|
|
22
|
-
import Input from 'intergalactic/input';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
<details>
|
|
26
|
-
<summary>Alternative installation and use</summary>
|
|
27
|
-
|
|
28
|
-
**We do not recommend this usage path due to possible dependency and update issues.**
|
|
29
|
-
|
|
30
|
-
### Install
|
|
31
|
-
|
|
32
|
-
You can only install one package from the design system
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
npm install @semcore/input @semcore/core
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`@semcore/core` - _is the basic package by which we create our components, and it contains all of the common logic
|
|
39
|
-
of the components that is discussed below. There should only be one version of the package in the project._
|
|
40
|
-
|
|
41
|
-
### Usage
|
|
42
|
-
|
|
43
|
-
You can use the package the same way but without `/ui/` in the import path.
|
|
44
|
-
|
|
45
|
-
```jsx
|
|
46
|
-
import Input from '@semcore/input';
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
</details>
|
|
50
20
|
|
|
51
21
|
## 👤 Author
|
|
52
22
|
|
package/lib/cjs/Input.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,64 +8,65 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
+
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
14
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _core = require("@semcore/core");
|
|
16
|
-
var
|
|
17
|
+
var _autoFocusEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/autoFocusEnhance"));
|
|
17
18
|
var _flexBox = require("@semcore/flex-box");
|
|
18
19
|
var _neighborLocation = _interopRequireDefault(require("@semcore/neighbor-location"));
|
|
19
|
-
var
|
|
20
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
20
22
|
/*!__reshadow-styles__:"./style/input.shadow.css"*/
|
|
21
|
-
var style = (
|
|
23
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SInput_1i6ki_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_1i6ki_gg_ input:-webkit-autofill{border-radius:var(--intergalactic-control-rounded, 6px);-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_1i6ki_gg_ input:-webkit-autofill~.___SOutline_1i6ki_gg_{background-color:#faffbd}.___SValue_1i6ki_gg_{min-width:0;width:100%;height:100%;padding:0;border:0;box-sizing:border-box;color:var(--intergalactic-text-primary, #191b23);font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:0 0}.___SValue_1i6ki_gg_:focus{outline:0}.___SValue_1i6ki_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1i6ki_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1i6ki_gg_:not(:disabled):-moz-read-only~.___SOutline_1i6ki_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1i6ki_gg_:not(:disabled):read-only~.___SOutline_1i6ki_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1i6ki_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SInput_1i6ki_gg_.__disabled_1i6ki_gg_ .___SOutline_1i6ki_gg_,.___SValue_1i6ki_gg_:disabled~.___SOutline_1i6ki_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SOutline_1i6ki_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:var(--intergalactic-control-rounded, 6px);z-index:-1;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SAddon_1i6ki_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 var(--intergalactic-spacing-2x, 8px);height:100%;color:var(--intergalactic-icon-secondary-neutral, #a9abb6)}.___SAddon_1i6ki_gg_.__interactive_1i6ki_gg_{cursor:pointer}@media (hover:hover){.___SAddon_1i6ki_gg_.__interactive_1i6ki_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SAddon_1i6ki_gg_.__disabled_1i6ki_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SAddon_1i6ki_gg_._size_m_1i6ki_gg_:not(.___SButton_1i6ki_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)}.___SAddon_1i6ki_gg_._size_l_1i6ki_gg_:not(.___SButton_1i6ki_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1i6ki_gg_ .___SAddon_1i6ki_gg_:nth-last-child(2){margin-right:-1px}.___SValue_1i6ki_gg_._size_m_1i6ki_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SValue_1i6ki_gg_._size_l_1i6ki_gg_{padding:0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1i6ki_gg_._size_m_1i6ki_gg_{font-size:var(--intergalactic-fs-200, 14px);height:var(--intergalactic-form-control-m, 28px)}.___SInput_1i6ki_gg_._size_l_1i6ki_gg_{font-size:var(--intergalactic-fs-300, 16px);height:var(--intergalactic-form-control-l, 40px)}.___SInput_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible){z-index:1}.___SInput_1i6ki_gg_._state_normal_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SInput_1i6ki_gg_._state_normal_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-info-active, #006dca);box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SInput_1i6ki_gg_._state_valid_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInput_1i6ki_gg_._state_valid_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-success-active, #007c65);box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInput_1i6ki_gg_._state_invalid_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInput_1i6ki_gg_._state_invalid_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f);box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SInput_1i6ki_gg_._neighborLocation_right_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_1i6ki_gg_._neighborLocation_both_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-radius:0;border-left:none}.___SInput_1i6ki_gg_._neighborLocation_left_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SValue_1i6ki_gg_._neighborLocation_right_1i6ki_gg_{padding-right:0}.___SValue_1i6ki_gg_._neighborLocation_both_1i6ki_gg_{padding-left:0;padding-right:0}.___SValue_1i6ki_gg_._neighborLocation_left_1i6ki_gg_{padding-left:0}", /*__inner_css_end__*/"1i6ki_gg_"),
|
|
22
24
|
/*__reshadow_css_end__*/
|
|
23
25
|
{
|
|
24
|
-
"__SInput": "
|
|
25
|
-
"_disabled": "
|
|
26
|
-
"__SOutline": "
|
|
27
|
-
"__SValue": "
|
|
28
|
-
"__SAddon": "
|
|
29
|
-
"_size_m": "
|
|
30
|
-
"__SButton": "
|
|
31
|
-
"_size_l": "
|
|
32
|
-
"_neighborLocation_right": "
|
|
33
|
-
"_neighborLocation_both": "
|
|
34
|
-
"_neighborLocation_left": "
|
|
35
|
-
"_interactive": "
|
|
36
|
-
"_state_normal": "
|
|
37
|
-
"_state_valid": "
|
|
38
|
-
"_state_invalid": "
|
|
26
|
+
"__SInput": "___SInput_1i6ki_gg_",
|
|
27
|
+
"_disabled": "__disabled_1i6ki_gg_",
|
|
28
|
+
"__SOutline": "___SOutline_1i6ki_gg_",
|
|
29
|
+
"__SValue": "___SValue_1i6ki_gg_",
|
|
30
|
+
"__SAddon": "___SAddon_1i6ki_gg_",
|
|
31
|
+
"_size_m": "_size_m_1i6ki_gg_",
|
|
32
|
+
"__SButton": "___SButton_1i6ki_gg_",
|
|
33
|
+
"_size_l": "_size_l_1i6ki_gg_",
|
|
34
|
+
"_neighborLocation_right": "_neighborLocation_right_1i6ki_gg_",
|
|
35
|
+
"_neighborLocation_both": "_neighborLocation_both_1i6ki_gg_",
|
|
36
|
+
"_neighborLocation_left": "_neighborLocation_left_1i6ki_gg_",
|
|
37
|
+
"_interactive": "__interactive_1i6ki_gg_",
|
|
38
|
+
"_state_normal": "_state_normal_1i6ki_gg_",
|
|
39
|
+
"_state_valid": "_state_valid_1i6ki_gg_",
|
|
40
|
+
"_state_invalid": "_state_invalid_1i6ki_gg_"
|
|
39
41
|
});
|
|
40
42
|
var Input = /*#__PURE__*/function (_Component) {
|
|
41
|
-
(0, _inherits2["default"])(Input, _Component);
|
|
42
|
-
var _super = (0, _createSuper2["default"])(Input);
|
|
43
43
|
function Input() {
|
|
44
44
|
var _this;
|
|
45
45
|
(0, _classCallCheck2["default"])(this, Input);
|
|
46
46
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
47
|
args[_key] = arguments[_key];
|
|
48
48
|
}
|
|
49
|
-
_this =
|
|
50
|
-
(0, _defineProperty2["default"])(
|
|
51
|
-
(0, _defineProperty2["default"])(
|
|
49
|
+
_this = _callSuper(this, Input, [].concat(args));
|
|
50
|
+
(0, _defineProperty2["default"])(_this, "inputRef", /*#__PURE__*/_react["default"].createRef());
|
|
51
|
+
(0, _defineProperty2["default"])(_this, "handleMouseDownAddon", function (event) {
|
|
52
52
|
var _this$inputRef$curren;
|
|
53
53
|
event.preventDefault();
|
|
54
|
-
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0
|
|
54
|
+
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 || _this$inputRef$curren.focus();
|
|
55
55
|
});
|
|
56
|
-
(0, _defineProperty2["default"])(
|
|
56
|
+
(0, _defineProperty2["default"])(_this, "handleKeyDown", function (event) {
|
|
57
57
|
if (event.key === 'Enter') {
|
|
58
58
|
setTimeout(function () {
|
|
59
59
|
if (document.activeElement === document.body) {
|
|
60
60
|
var _this$inputRef$curren2;
|
|
61
|
-
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0
|
|
61
|
+
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0 || _this$inputRef$curren2.focus();
|
|
62
62
|
}
|
|
63
63
|
}, 10);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
return _this;
|
|
67
67
|
}
|
|
68
|
-
(0,
|
|
68
|
+
(0, _inherits2["default"])(Input, _Component);
|
|
69
|
+
return (0, _createClass2["default"])(Input, [{
|
|
69
70
|
key: "getAddonProps",
|
|
70
71
|
value: function getAddonProps() {
|
|
71
72
|
var _this$asProps = this.asProps,
|
|
@@ -93,7 +94,7 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
93
94
|
ariaOwns = _this$asProps2['aria-owns'],
|
|
94
95
|
ariaActivedescendant = _this$asProps2['aria-activedescendant'];
|
|
95
96
|
return {
|
|
96
|
-
ref: this.inputRef,
|
|
97
|
+
'ref': this.inputRef,
|
|
97
98
|
size: size,
|
|
98
99
|
disabled: disabled,
|
|
99
100
|
state: state,
|
|
@@ -134,7 +135,6 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
}]);
|
|
137
|
-
return Input;
|
|
138
138
|
}(_core.Component);
|
|
139
139
|
(0, _defineProperty2["default"])(Input, "displayName", 'Input');
|
|
140
140
|
(0, _defineProperty2["default"])(Input, "defaultProps", {
|
|
@@ -143,13 +143,12 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
143
143
|
});
|
|
144
144
|
(0, _defineProperty2["default"])(Input, "style", style);
|
|
145
145
|
var Value = /*#__PURE__*/function (_Component2) {
|
|
146
|
-
(0, _inherits2["default"])(Value, _Component2);
|
|
147
|
-
var _super2 = (0, _createSuper2["default"])(Value);
|
|
148
146
|
function Value() {
|
|
149
147
|
(0, _classCallCheck2["default"])(this, Value);
|
|
150
|
-
return
|
|
148
|
+
return _callSuper(this, Value, arguments);
|
|
151
149
|
}
|
|
152
|
-
(0,
|
|
150
|
+
(0, _inherits2["default"])(Value, _Component2);
|
|
151
|
+
return (0, _createClass2["default"])(Value, [{
|
|
153
152
|
key: "uncontrolledProps",
|
|
154
153
|
value: function uncontrolledProps() {
|
|
155
154
|
return {
|
|
@@ -180,7 +179,6 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
180
179
|
});
|
|
181
180
|
}
|
|
182
181
|
}]);
|
|
183
|
-
return Value;
|
|
184
182
|
}(_core.Component);
|
|
185
183
|
(0, _defineProperty2["default"])(Value, "defaultProps", {
|
|
186
184
|
defaultValue: ''
|
|
@@ -201,9 +199,8 @@ function Addon(props) {
|
|
|
201
199
|
}, _ref3))), /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {})));
|
|
202
200
|
});
|
|
203
201
|
}
|
|
204
|
-
var _default = (0, _core.createComponent)(Input, {
|
|
202
|
+
var _default = exports["default"] = (0, _core.createComponent)(Input, {
|
|
205
203
|
Addon: Addon,
|
|
206
204
|
Value: Value
|
|
207
205
|
});
|
|
208
|
-
exports["default"] = _default;
|
|
209
206
|
//# sourceMappingURL=Input.js.map
|
package/lib/cjs/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["_core","require","_react","_interopRequireDefault","_flexBox","_neighborLocation","_autoFocusEnhance","style","sstyled","insert","Input","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","event","_this$inputRef$curren","preventDefault","inputRef","current","focus","key","setTimeout","document","activeElement","body","_this$inputRef$curren2","_createClass2","value","getAddonProps","_this$asProps","asProps","disabled","size","onMouseDown","handleMouseDownAddon","getValueProps","_this$asProps2","state","role","placeholder","ariaHaspopup","ariaControls","ariaExpanded","ariaAutocomplete","ariaOwns","ariaActivedescendant","ref","render","_ref","_this2","SInput","Box","SOutline","_this$asProps3","Children","styles","neighborLocation","controlsLength","createElement","Detect","_ref4","cn","_objectSpread2","assignProps","handleKeyDown","InvalidStateBox","Component","Value","_Component2","_super2","uncontrolledProps","e","target","_ref2","SValue","_this$asProps4","_ref5","defaultValue","autoFocusEnhance","Addon","props","_ref3","arguments[0]","SAddon","_ref6","_default","createComponent","exports"],"sources":["../../src/Input.jsx"],"sourcesContent":["import React from 'react';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { Box, InvalidStateBox } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport autoFocusEnhance from '@semcore/core/lib/utils/enhances/autoFocusEnhance';\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 inputRef = React.createRef();\n\n handleMouseDownAddon = (event) => {\n event.preventDefault();\n this.inputRef.current?.focus();\n };\n handleKeyDown = (event) => {\n if (event.key === 'Enter') {\n setTimeout(() => {\n if (document.activeElement === document.body) {\n this.inputRef.current?.focus();\n }\n }, 10);\n }\n };\n\n getAddonProps() {\n const { disabled, size } = this.asProps;\n return {\n disabled,\n onMouseDown: this.handleMouseDownAddon,\n size,\n };\n }\n\n getValueProps() {\n const {\n size,\n disabled,\n state,\n role,\n placeholder,\n // these props might be passed from the <Select /> component\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n } = this.asProps;\n\n return {\n ref: this.inputRef,\n size,\n disabled,\n state,\n role,\n placeholder,\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n };\n }\n\n render() {\n const SInput = Root;\n const SOutline = 'div';\n const { Children, styles, neighborLocation, controlsLength, state } = this.asProps;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SInput\n render={Box}\n onKeyDown={this.handleKeyDown}\n neighborLocation={neighborLocation}\n __excludeProps={[\n 'role',\n 'aria-haspopup',\n 'aria-controls',\n 'aria-expanded',\n 'placeholder',\n 'aria-autocomplete',\n 'aria-owns',\n 'aria-activedescendant',\n 'tabIndex',\n ]}\n >\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline>{state === 'invalid' && <InvalidStateBox />}</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 = [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, state } = this.asProps;\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SValue\n render={Box}\n neighborLocation={neighborLocation}\n tag='input'\n type='text'\n aria-invalid={state === 'invalid'}\n />,\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,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAAiF;AAAA,IAAAM,KAAA,+BAAAP,KAAA,CAAAQ,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA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AvB,EAAA,iBAAG,CACL;EAAA,CACV,CAEqB;AAE9B;AAAC,IAAAwB,QAAA,GAEc,IAAAC,qBAAe,EAAC5F,KAAK,EAAE;EACpCqF,KAAK,EAALA,KAAK;EACLZ,KAAK,EAALA;AACF,CAAC,CAAC;AAAAoB,OAAA,cAAAF,QAAA"}
|
|
1
|
+
{"version":3,"file":"Input.js","names":["_core","require","_autoFocusEnhance","_interopRequireDefault","_flexBox","_neighborLocation","_react","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","style","sstyled","insert","Input","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","concat","_defineProperty2","React","createRef","event","_this$inputRef$curren","preventDefault","inputRef","current","focus","key","setTimeout","document","activeElement","body","_this$inputRef$curren2","_inherits2","_createClass2","value","getAddonProps","_this$asProps","asProps","disabled","size","onMouseDown","handleMouseDownAddon","getValueProps","_this$asProps2","state","role","placeholder","ariaHaspopup","ariaControls","ariaExpanded","ariaAutocomplete","ariaOwns","ariaActivedescendant","render","_ref","_this2","SInput","Box","SOutline","_this$asProps3","Children","styles","neighborLocation","controlsLength","createElement","Detect","_ref4","cn","_objectSpread2","assignProps","handleKeyDown","InvalidStateBox","Component","Value","_Component2","uncontrolledProps","target","_ref2","SValue","_this$asProps4","_ref5","defaultValue","autoFocusEnhance","Addon","props","_ref3","arguments[0]","SAddon","_ref6","_default","exports","createComponent"],"sources":["../../src/Input.jsx"],"sourcesContent":["import { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport autoFocusEnhance from '@semcore/core/lib/utils/enhances/autoFocusEnhance';\nimport { Box, InvalidStateBox } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport React from 'react';\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\n static style = style;\n\n inputRef = React.createRef();\n\n handleMouseDownAddon = (event) => {\n event.preventDefault();\n this.inputRef.current?.focus();\n };\n\n handleKeyDown = (event) => {\n if (event.key === 'Enter') {\n setTimeout(() => {\n if (document.activeElement === document.body) {\n this.inputRef.current?.focus();\n }\n }, 10);\n }\n };\n\n getAddonProps() {\n const { disabled, size } = this.asProps;\n return {\n disabled,\n onMouseDown: this.handleMouseDownAddon,\n size,\n };\n }\n\n getValueProps() {\n const {\n size,\n disabled,\n state,\n role,\n placeholder,\n // these props might be passed from the <Select /> component\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n } = this.asProps;\n\n return {\n 'ref': this.inputRef,\n size,\n disabled,\n state,\n role,\n placeholder,\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n };\n }\n\n render() {\n const SInput = Root;\n const SOutline = 'div';\n const { Children, styles, neighborLocation, controlsLength, state } = this.asProps;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SInput\n render={Box}\n onKeyDown={this.handleKeyDown}\n neighborLocation={neighborLocation}\n __excludeProps={[\n 'role',\n 'aria-haspopup',\n 'aria-controls',\n 'aria-expanded',\n 'placeholder',\n 'aria-autocomplete',\n 'aria-owns',\n 'aria-activedescendant',\n 'tabIndex',\n ]}\n >\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline>{state === 'invalid' && <InvalidStateBox />}</SOutline>\n </SInput>,\n )}\n </NeighborLocation.Detect>\n );\n }\n}\n\nclass Value extends Component {\n static defaultProps = {\n defaultValue: '',\n };\n\n static enhance = [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, state } = this.asProps;\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SValue\n render={Box}\n neighborLocation={neighborLocation}\n tag='input'\n type='text'\n aria-invalid={state === 'invalid'}\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 </NeighborLocation.Detect>\n );\n}\n\nexport default createComponent(Input, {\n Addon,\n Value,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AAA0B,SAAAM,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,MAAAK,0BAAA,iBAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA;AAAA,IAAAQ,KAAA,8BAAAlB,KAAA,CAAAmB,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAIpBC,KAAK,0BAAAC,UAAA;EAAA,SAAAD,MAAA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|
package/lib/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Intergalactic, PropGetterFn, UnknownProperties } from '@semcore/core';\nimport type { WithAutoFocusEnhanceProps } from '@semcore/core/lib/utils/enhances/autoFocusEnhance';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';\nimport type React from 'react';\n\nexport type InputSize = 'm' | 'l';\n\n/** @deprecated */\nexport interface IInputProps extends InputProps, UnknownProperties {}\nexport type InputProps = BoxProps &\n NeighborItemProps &\n NeighborLocationProps & {\n /**\n * Sets the input and addons to the disabled state\n * */\n disabled?: boolean;\n /**\n * Input size\n * @default m\n */\n size?: InputSize;\n /**\n * Sets the input state\n * @default normal\n */\n state?: 'normal' | 'invalid' | 'valid';\n };\n\n/** @deprecated */\nexport interface IInputValueProps extends InputValueProps, UnknownProperties {}\nexport type InputValueProps = BoxProps &\n NeighborItemProps &\n WithAutoFocusEnhanceProps & {\n /**\n * Input value\n */\n value?: string;\n /**\n * Default value if `value` property is not provided\n */\n defaultValue?: string;\n /**\n * Handler for changing the value\n */\n onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;\n /**\n * @deprecated Set `disabled` on `Input` instead.\n * */\n disabled?: boolean;\n /**\n * Sets the input to the read-only state\n * */\n readOnly?: boolean;\n /**\n * Input size\n * @default m\n */\n size?: InputSize;\n /**\n * Placeholder for input\n */\n placeholder?: string;\n };\n\n/** @deprecated */\nexport interface IInputAddonProps extends InputAddonProps, UnknownProperties {}\nexport type InputAddonProps = BoxProps &\n NeighborItemProps & {\n /**\n * Adds styles for interactive icons\n */\n interactive?: boolean;\n /**\n * Blocks the addon\n * */\n disabled?: boolean;\n /**\n * Input size\n * @default m\n */\n size?: InputSize;\n };\n\n/** @deprecated */\nexport interface IInputCtx extends InputCtx, UnknownProperties {}\nexport type InputCtx = {\n getValueProps: PropGetterFn;\n getAddonProps: PropGetterFn;\n};\n\ndeclare const Input: Intergalactic.Component<'div', InputProps, InputCtx> & {\n Value: Intergalactic.Component<'input', InputValueProps>;\n Addon: Intergalactic.Component<'div', InputAddonProps>;\n};\nexport default Input;\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Input","_interopRequireDefault","require"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Input';\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Input","_interopRequireDefault","require"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Input';\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
package/lib/es6/Input.js
CHANGED
|
@@ -1,68 +1,69 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/isNativeReflectConstruct";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
10
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
10
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
11
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
12
|
-
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
13
14
|
import { createComponent, Component, sstyled, Root } from '@semcore/core';
|
|
15
|
+
import autoFocusEnhance from '@semcore/core/lib/utils/enhances/autoFocusEnhance';
|
|
14
16
|
import { Box, InvalidStateBox } from '@semcore/flex-box';
|
|
15
17
|
import NeighborLocation from '@semcore/neighbor-location';
|
|
16
|
-
import
|
|
18
|
+
import React from 'react';
|
|
17
19
|
/*!__reshadow-styles__:"./style/input.shadow.css"*/
|
|
18
|
-
var style = (
|
|
20
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SInput_1i6ki_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_1i6ki_gg_ input:-webkit-autofill{border-radius:var(--intergalactic-control-rounded, 6px);-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_1i6ki_gg_ input:-webkit-autofill~.___SOutline_1i6ki_gg_{background-color:#faffbd}.___SValue_1i6ki_gg_{min-width:0;width:100%;height:100%;padding:0;border:0;box-sizing:border-box;color:var(--intergalactic-text-primary, #191b23);font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:0 0}.___SValue_1i6ki_gg_:focus{outline:0}.___SValue_1i6ki_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1i6ki_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1i6ki_gg_:not(:disabled):-moz-read-only~.___SOutline_1i6ki_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1i6ki_gg_:not(:disabled):read-only~.___SOutline_1i6ki_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1i6ki_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SInput_1i6ki_gg_.__disabled_1i6ki_gg_ .___SOutline_1i6ki_gg_,.___SValue_1i6ki_gg_:disabled~.___SOutline_1i6ki_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SOutline_1i6ki_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:var(--intergalactic-control-rounded, 6px);z-index:-1;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SAddon_1i6ki_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 var(--intergalactic-spacing-2x, 8px);height:100%;color:var(--intergalactic-icon-secondary-neutral, #a9abb6)}.___SAddon_1i6ki_gg_.__interactive_1i6ki_gg_{cursor:pointer}@media (hover:hover){.___SAddon_1i6ki_gg_.__interactive_1i6ki_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SAddon_1i6ki_gg_.__disabled_1i6ki_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SAddon_1i6ki_gg_._size_m_1i6ki_gg_:not(.___SButton_1i6ki_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)}.___SAddon_1i6ki_gg_._size_l_1i6ki_gg_:not(.___SButton_1i6ki_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1i6ki_gg_ .___SAddon_1i6ki_gg_:nth-last-child(2){margin-right:-1px}.___SValue_1i6ki_gg_._size_m_1i6ki_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SValue_1i6ki_gg_._size_l_1i6ki_gg_{padding:0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1i6ki_gg_._size_m_1i6ki_gg_{font-size:var(--intergalactic-fs-200, 14px);height:var(--intergalactic-form-control-m, 28px)}.___SInput_1i6ki_gg_._size_l_1i6ki_gg_{font-size:var(--intergalactic-fs-300, 16px);height:var(--intergalactic-form-control-l, 40px)}.___SInput_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible){z-index:1}.___SInput_1i6ki_gg_._state_normal_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SInput_1i6ki_gg_._state_normal_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-info-active, #006dca);box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SInput_1i6ki_gg_._state_valid_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInput_1i6ki_gg_._state_valid_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-success-active, #007c65);box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInput_1i6ki_gg_._state_invalid_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInput_1i6ki_gg_._state_invalid_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f);box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SInput_1i6ki_gg_._neighborLocation_right_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_1i6ki_gg_._neighborLocation_both_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-radius:0;border-left:none}.___SInput_1i6ki_gg_._neighborLocation_left_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SValue_1i6ki_gg_._neighborLocation_right_1i6ki_gg_{padding-right:0}.___SValue_1i6ki_gg_._neighborLocation_both_1i6ki_gg_{padding-left:0;padding-right:0}.___SValue_1i6ki_gg_._neighborLocation_left_1i6ki_gg_{padding-left:0}", /*__inner_css_end__*/"1i6ki_gg_"),
|
|
19
21
|
/*__reshadow_css_end__*/
|
|
20
22
|
{
|
|
21
|
-
"__SInput": "
|
|
22
|
-
"_disabled": "
|
|
23
|
-
"__SOutline": "
|
|
24
|
-
"__SValue": "
|
|
25
|
-
"__SAddon": "
|
|
26
|
-
"_size_m": "
|
|
27
|
-
"__SButton": "
|
|
28
|
-
"_size_l": "
|
|
29
|
-
"_neighborLocation_right": "
|
|
30
|
-
"_neighborLocation_both": "
|
|
31
|
-
"_neighborLocation_left": "
|
|
32
|
-
"_interactive": "
|
|
33
|
-
"_state_normal": "
|
|
34
|
-
"_state_valid": "
|
|
35
|
-
"_state_invalid": "
|
|
23
|
+
"__SInput": "___SInput_1i6ki_gg_",
|
|
24
|
+
"_disabled": "__disabled_1i6ki_gg_",
|
|
25
|
+
"__SOutline": "___SOutline_1i6ki_gg_",
|
|
26
|
+
"__SValue": "___SValue_1i6ki_gg_",
|
|
27
|
+
"__SAddon": "___SAddon_1i6ki_gg_",
|
|
28
|
+
"_size_m": "_size_m_1i6ki_gg_",
|
|
29
|
+
"__SButton": "___SButton_1i6ki_gg_",
|
|
30
|
+
"_size_l": "_size_l_1i6ki_gg_",
|
|
31
|
+
"_neighborLocation_right": "_neighborLocation_right_1i6ki_gg_",
|
|
32
|
+
"_neighborLocation_both": "_neighborLocation_both_1i6ki_gg_",
|
|
33
|
+
"_neighborLocation_left": "_neighborLocation_left_1i6ki_gg_",
|
|
34
|
+
"_interactive": "__interactive_1i6ki_gg_",
|
|
35
|
+
"_state_normal": "_state_normal_1i6ki_gg_",
|
|
36
|
+
"_state_valid": "_state_valid_1i6ki_gg_",
|
|
37
|
+
"_state_invalid": "_state_invalid_1i6ki_gg_"
|
|
36
38
|
});
|
|
37
39
|
var Input = /*#__PURE__*/function (_Component) {
|
|
38
|
-
_inherits(Input, _Component);
|
|
39
|
-
var _super = _createSuper(Input);
|
|
40
40
|
function Input() {
|
|
41
41
|
var _this;
|
|
42
42
|
_classCallCheck(this, Input);
|
|
43
43
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
44
|
args[_key] = arguments[_key];
|
|
45
45
|
}
|
|
46
|
-
_this =
|
|
47
|
-
_defineProperty(
|
|
48
|
-
_defineProperty(
|
|
46
|
+
_this = _callSuper(this, Input, [].concat(args));
|
|
47
|
+
_defineProperty(_this, "inputRef", /*#__PURE__*/React.createRef());
|
|
48
|
+
_defineProperty(_this, "handleMouseDownAddon", function (event) {
|
|
49
49
|
var _this$inputRef$curren;
|
|
50
50
|
event.preventDefault();
|
|
51
|
-
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0
|
|
51
|
+
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 || _this$inputRef$curren.focus();
|
|
52
52
|
});
|
|
53
|
-
_defineProperty(
|
|
53
|
+
_defineProperty(_this, "handleKeyDown", function (event) {
|
|
54
54
|
if (event.key === 'Enter') {
|
|
55
55
|
setTimeout(function () {
|
|
56
56
|
if (document.activeElement === document.body) {
|
|
57
57
|
var _this$inputRef$curren2;
|
|
58
|
-
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0
|
|
58
|
+
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0 || _this$inputRef$curren2.focus();
|
|
59
59
|
}
|
|
60
60
|
}, 10);
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
return _this;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
_inherits(Input, _Component);
|
|
66
|
+
return _createClass(Input, [{
|
|
66
67
|
key: "getAddonProps",
|
|
67
68
|
value: function getAddonProps() {
|
|
68
69
|
var _this$asProps = this.asProps,
|
|
@@ -90,7 +91,7 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
90
91
|
ariaOwns = _this$asProps2['aria-owns'],
|
|
91
92
|
ariaActivedescendant = _this$asProps2['aria-activedescendant'];
|
|
92
93
|
return {
|
|
93
|
-
ref: this.inputRef,
|
|
94
|
+
'ref': this.inputRef,
|
|
94
95
|
size: size,
|
|
95
96
|
disabled: disabled,
|
|
96
97
|
state: state,
|
|
@@ -131,7 +132,6 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
134
|
}]);
|
|
134
|
-
return Input;
|
|
135
135
|
}(Component);
|
|
136
136
|
_defineProperty(Input, "displayName", 'Input');
|
|
137
137
|
_defineProperty(Input, "defaultProps", {
|
|
@@ -140,13 +140,12 @@ _defineProperty(Input, "defaultProps", {
|
|
|
140
140
|
});
|
|
141
141
|
_defineProperty(Input, "style", style);
|
|
142
142
|
var Value = /*#__PURE__*/function (_Component2) {
|
|
143
|
-
_inherits(Value, _Component2);
|
|
144
|
-
var _super2 = _createSuper(Value);
|
|
145
143
|
function Value() {
|
|
146
144
|
_classCallCheck(this, Value);
|
|
147
|
-
return
|
|
145
|
+
return _callSuper(this, Value, arguments);
|
|
148
146
|
}
|
|
149
|
-
|
|
147
|
+
_inherits(Value, _Component2);
|
|
148
|
+
return _createClass(Value, [{
|
|
150
149
|
key: "uncontrolledProps",
|
|
151
150
|
value: function uncontrolledProps() {
|
|
152
151
|
return {
|
|
@@ -177,7 +176,6 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
178
|
}]);
|
|
180
|
-
return Value;
|
|
181
179
|
}(Component);
|
|
182
180
|
_defineProperty(Value, "defaultProps", {
|
|
183
181
|
defaultValue: ''
|
package/lib/es6/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["React","createComponent","Component","sstyled","Root","Box","InvalidStateBox","NeighborLocation","autoFocusEnhance","style","_sstyled","insert","Input","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","event","_this$inputRef$curren","preventDefault","inputRef","current","focus","key","setTimeout","document","activeElement","body","_this$inputRef$curren2","_createClass","value","getAddonProps","_this$asProps","asProps","disabled","size","onMouseDown","handleMouseDownAddon","getValueProps","_this$asProps2","state","role","placeholder","ariaHaspopup","ariaControls","ariaExpanded","ariaAutocomplete","ariaOwns","ariaActivedescendant","ref","render","_ref","_this2","SInput","SOutline","_this$asProps3","Children","styles","neighborLocation","controlsLength","createElement","Detect","_ref4","cn","_objectSpread","_assignProps","handleKeyDown","Value","_Component2","_super2","uncontrolledProps","e","target","_ref2","SValue","_this$asProps4","_ref5","_assignProps2","defaultValue","Addon","props","_ref3","arguments[0]","SAddon","_ref6","_assignProps3"],"sources":["../../src/Input.jsx"],"sourcesContent":["import React from 'react';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { Box, InvalidStateBox } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport autoFocusEnhance from '@semcore/core/lib/utils/enhances/autoFocusEnhance';\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 inputRef = React.createRef();\n\n handleMouseDownAddon = (event) => {\n event.preventDefault();\n this.inputRef.current?.focus();\n };\n handleKeyDown = (event) => {\n if (event.key === 'Enter') {\n setTimeout(() => {\n if (document.activeElement === document.body) {\n this.inputRef.current?.focus();\n }\n }, 10);\n }\n };\n\n getAddonProps() {\n const { disabled, size } = this.asProps;\n return {\n disabled,\n onMouseDown: this.handleMouseDownAddon,\n size,\n };\n }\n\n getValueProps() {\n const {\n size,\n disabled,\n state,\n role,\n placeholder,\n // these props might be passed from the <Select /> component\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n } = this.asProps;\n\n return {\n ref: this.inputRef,\n size,\n disabled,\n state,\n role,\n placeholder,\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n };\n }\n\n render() {\n const SInput = Root;\n const SOutline = 'div';\n const { Children, styles, neighborLocation, controlsLength, state } = this.asProps;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SInput\n render={Box}\n onKeyDown={this.handleKeyDown}\n neighborLocation={neighborLocation}\n __excludeProps={[\n 'role',\n 'aria-haspopup',\n 'aria-controls',\n 'aria-expanded',\n 'placeholder',\n 'aria-autocomplete',\n 'aria-owns',\n 'aria-activedescendant',\n 'tabIndex',\n ]}\n >\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline>{state === 'invalid' && <InvalidStateBox />}</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 = [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, state } = this.asProps;\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SValue\n render={Box}\n neighborLocation={neighborLocation}\n tag='input'\n type='text'\n aria-invalid={state === 'invalid'}\n />,\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,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,EAAEC,eAAe,QAAQ,mBAAmB;AACxD,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAOC,gBAAgB,MAAM,mDAAmD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI3EC,KAAK,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,KAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,KAAA;EAAA,SAAAA,MAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,KAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,C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KAAKA,CAACC,KAAK,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;EACpB,IAAMC,MAAM,GAMY5F,GAAG;EAL3B,IAAQiE,QAAQ,GAA+BwB,KAAK,CAA5CxB,QAAQ;IAAEC,MAAM,GAAuBuB,KAAK,CAAlCvB,MAAM;IAAEC,gBAAgB,GAAKsB,KAAK,CAA1BtB,gBAAgB;EAC1C,oBACExE,KAAA,CAAA0E,aAAA,CAACnE,gBAAgB,CAACoE,MAAM;IAACH,gBAAgB,EAAEA;EAAiB,GACzD,UAACA,gBAAgB;IAAA,IAAA0B,KAAA;IAAA,OAAAA,KAAA,GAChB/F,OAAO,CAACoE,MAAM,CAAC,eACbvE,KAAA,CAAA0E,aAAA,CAACuB,MAAM,EAAAC,KAAA,CAAArB,EAAA,WAAAC,aAAA,KAAAqB,aAAA;MAAA,oBAAgC3B;IAAgB,GAAAuB,KAAA,kBACrD/F,KAAA,CAAA0E,aAAA,CAACJ,QAAQ,EAAA4B,KAAA,CAAArB,EAAA,iBAAG,CACL;EAAA,CACV,CAEqB;AAE9B;AAEA,eAAe5E,eAAe,CAACW,KAAK,EAAE;EACpCiF,KAAK,EAALA,KAAK;EACLZ,KAAK,EAALA;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Input.js","names":["createComponent","Component","sstyled","Root","autoFocusEnhance","Box","InvalidStateBox","NeighborLocation","React","style","_sstyled","insert","Input","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","createRef","event","_this$inputRef$curren","preventDefault","inputRef","current","focus","key","setTimeout","document","activeElement","body","_this$inputRef$curren2","_inherits","_createClass","value","getAddonProps","_this$asProps","asProps","disabled","size","onMouseDown","handleMouseDownAddon","getValueProps","_this$asProps2","state","role","placeholder","ariaHaspopup","ariaControls","ariaExpanded","ariaAutocomplete","ariaOwns","ariaActivedescendant","render","_ref","_this2","SInput","SOutline","_this$asProps3","Children","styles","neighborLocation","controlsLength","createElement","Detect","_ref4","cn","_objectSpread","_assignProps","handleKeyDown","Value","_Component2","uncontrolledProps","e","target","_ref2","SValue","_this$asProps4","_ref5","_assignProps2","defaultValue","Addon","props","_ref3","arguments[0]","SAddon","_ref6","_assignProps3"],"sources":["../../src/Input.jsx"],"sourcesContent":["import { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport autoFocusEnhance from '@semcore/core/lib/utils/enhances/autoFocusEnhance';\nimport { Box, InvalidStateBox } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport React from 'react';\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\n static style = style;\n\n inputRef = React.createRef();\n\n handleMouseDownAddon = (event) => {\n event.preventDefault();\n this.inputRef.current?.focus();\n };\n\n handleKeyDown = (event) => {\n if (event.key === 'Enter') {\n setTimeout(() => {\n if (document.activeElement === document.body) {\n this.inputRef.current?.focus();\n }\n }, 10);\n }\n };\n\n getAddonProps() {\n const { disabled, size } = this.asProps;\n return {\n disabled,\n onMouseDown: this.handleMouseDownAddon,\n size,\n };\n }\n\n getValueProps() {\n const {\n size,\n disabled,\n state,\n role,\n placeholder,\n // these props might be passed from the <Select /> component\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n } = this.asProps;\n\n return {\n 'ref': this.inputRef,\n size,\n disabled,\n state,\n role,\n placeholder,\n 'aria-haspopup': ariaHaspopup,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-autocomplete': ariaAutocomplete,\n 'aria-owns': ariaOwns,\n 'aria-activedescendant': ariaActivedescendant,\n };\n }\n\n render() {\n const SInput = Root;\n const SOutline = 'div';\n const { Children, styles, neighborLocation, controlsLength, state } = this.asProps;\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SInput\n render={Box}\n onKeyDown={this.handleKeyDown}\n neighborLocation={neighborLocation}\n __excludeProps={[\n 'role',\n 'aria-haspopup',\n 'aria-controls',\n 'aria-expanded',\n 'placeholder',\n 'aria-autocomplete',\n 'aria-owns',\n 'aria-activedescendant',\n 'tabIndex',\n ]}\n >\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline>{state === 'invalid' && <InvalidStateBox />}</SOutline>\n </SInput>,\n )}\n </NeighborLocation.Detect>\n );\n }\n}\n\nclass Value extends Component {\n static defaultProps = {\n defaultValue: '',\n };\n\n static enhance = [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, state } = this.asProps;\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) =>\n sstyled(styles)(\n <SValue\n render={Box}\n neighborLocation={neighborLocation}\n tag='input'\n type='text'\n aria-invalid={state === 'invalid'}\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 </NeighborLocation.Detect>\n );\n}\n\nexport default createComponent(Input, {\n Addon,\n Value,\n});\n"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,OAAOC,gBAAgB,MAAM,mDAAmD;AAChF,SAASC,GAAG,EAAEC,eAAe,QAAQ,mBAAmB;AACxD,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BA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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Intergalactic, PropGetterFn, UnknownProperties } from '@semcore/core';\nimport type { WithAutoFocusEnhanceProps } from '@semcore/core/lib/utils/enhances/autoFocusEnhance';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';\nimport type React from 'react';\n\nexport type InputSize = 'm' | 'l';\n\n/** @deprecated */\nexport interface IInputProps extends InputProps, UnknownProperties {}\nexport type InputProps = BoxProps &\n NeighborItemProps &\n NeighborLocationProps & {\n /**\n * Sets the input and addons to the disabled state\n * */\n disabled?: boolean;\n /**\n * Input size\n * @default m\n */\n size?: InputSize;\n /**\n * Sets the input state\n * @default normal\n */\n state?: 'normal' | 'invalid' | 'valid';\n };\n\n/** @deprecated */\nexport interface IInputValueProps extends InputValueProps, UnknownProperties {}\nexport type InputValueProps = BoxProps &\n NeighborItemProps &\n WithAutoFocusEnhanceProps & {\n /**\n * Input value\n */\n value?: string;\n /**\n * Default value if `value` property is not provided\n */\n defaultValue?: string;\n /**\n * Handler for changing the value\n */\n onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;\n /**\n * @deprecated Set `disabled` on `Input` instead.\n * */\n disabled?: boolean;\n /**\n * Sets the input to the read-only state\n * */\n readOnly?: boolean;\n /**\n * Input size\n * @default m\n */\n size?: InputSize;\n /**\n * Placeholder for input\n */\n placeholder?: string;\n };\n\n/** @deprecated */\nexport interface IInputAddonProps extends InputAddonProps, UnknownProperties {}\nexport type InputAddonProps = BoxProps &\n NeighborItemProps & {\n /**\n * Adds styles for interactive icons\n */\n interactive?: boolean;\n /**\n * Blocks the addon\n * */\n disabled?: boolean;\n /**\n * Input size\n * @default m\n */\n size?: InputSize;\n };\n\n/** @deprecated */\nexport interface IInputCtx extends InputCtx, UnknownProperties {}\nexport type InputCtx = {\n getValueProps: PropGetterFn;\n getAddonProps: PropGetterFn;\n};\n\ndeclare const Input: Intergalactic.Component<'div', InputProps, InputCtx> & {\n Value: Intergalactic.Component<'input', InputValueProps>;\n Addon: Intergalactic.Component<'div', InputAddonProps>;\n};\nexport default Input;\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Input';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Input';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,SAAS","ignoreList":[]}
|
package/lib/esm/Input.mjs
CHANGED
|
@@ -1,71 +1,74 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
5
7
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
9
|
import { createComponent, sstyled, assignProps, Component } from "@semcore/core";
|
|
9
|
-
import React from "react";
|
|
10
|
-
import { InvalidStateBox, Box } from "@semcore/flex-box";
|
|
11
|
-
import NeighborLocation from "@semcore/neighbor-location";
|
|
12
10
|
import autoFocusEnhance from "@semcore/core/lib/utils/enhances/autoFocusEnhance";
|
|
11
|
+
import { Box, InvalidStateBox } from "@semcore/flex-box";
|
|
12
|
+
import NeighborLocation from "@semcore/neighbor-location";
|
|
13
|
+
import React from "react";
|
|
14
|
+
function _callSuper(t, o, e) {
|
|
15
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
16
|
+
}
|
|
13
17
|
/*!__reshadow-styles__:"./style/input.shadow.css"*/
|
|
14
18
|
var style = (
|
|
15
19
|
/*__reshadow_css_start__*/
|
|
16
20
|
(sstyled.insert(
|
|
17
21
|
/*__inner_css_start__*/
|
|
18
|
-
".
|
|
22
|
+
".___SInput_1i6ki_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_1i6ki_gg_ input:-webkit-autofill{border-radius:var(--intergalactic-control-rounded, 6px);-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_1i6ki_gg_ input:-webkit-autofill~.___SOutline_1i6ki_gg_{background-color:#faffbd}.___SValue_1i6ki_gg_{min-width:0;width:100%;height:100%;padding:0;border:0;box-sizing:border-box;color:var(--intergalactic-text-primary, #191b23);font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:0 0}.___SValue_1i6ki_gg_:focus{outline:0}.___SValue_1i6ki_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1i6ki_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1i6ki_gg_:not(:disabled):-moz-read-only~.___SOutline_1i6ki_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1i6ki_gg_:not(:disabled):read-only~.___SOutline_1i6ki_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1i6ki_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SInput_1i6ki_gg_.__disabled_1i6ki_gg_ .___SOutline_1i6ki_gg_,.___SValue_1i6ki_gg_:disabled~.___SOutline_1i6ki_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SOutline_1i6ki_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:var(--intergalactic-control-rounded, 6px);z-index:-1;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SAddon_1i6ki_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 var(--intergalactic-spacing-2x, 8px);height:100%;color:var(--intergalactic-icon-secondary-neutral, #a9abb6)}.___SAddon_1i6ki_gg_.__interactive_1i6ki_gg_{cursor:pointer}@media (hover:hover){.___SAddon_1i6ki_gg_.__interactive_1i6ki_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SAddon_1i6ki_gg_.__disabled_1i6ki_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SAddon_1i6ki_gg_._size_m_1i6ki_gg_:not(.___SButton_1i6ki_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)}.___SAddon_1i6ki_gg_._size_l_1i6ki_gg_:not(.___SButton_1i6ki_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1i6ki_gg_ .___SAddon_1i6ki_gg_:nth-last-child(2){margin-right:-1px}.___SValue_1i6ki_gg_._size_m_1i6ki_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SValue_1i6ki_gg_._size_l_1i6ki_gg_{padding:0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1i6ki_gg_._size_m_1i6ki_gg_{font-size:var(--intergalactic-fs-200, 14px);height:var(--intergalactic-form-control-m, 28px)}.___SInput_1i6ki_gg_._size_l_1i6ki_gg_{font-size:var(--intergalactic-fs-300, 16px);height:var(--intergalactic-form-control-l, 40px)}.___SInput_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible){z-index:1}.___SInput_1i6ki_gg_._state_normal_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SInput_1i6ki_gg_._state_normal_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-info-active, #006dca);box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SInput_1i6ki_gg_._state_valid_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInput_1i6ki_gg_._state_valid_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-success-active, #007c65);box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInput_1i6ki_gg_._state_invalid_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInput_1i6ki_gg_._state_invalid_1i6ki_gg_:has(.___SValue_1i6ki_gg_:focus-visible) .___SOutline_1i6ki_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f);box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SInput_1i6ki_gg_._neighborLocation_right_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_1i6ki_gg_._neighborLocation_both_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-radius:0;border-left:none}.___SInput_1i6ki_gg_._neighborLocation_left_1i6ki_gg_ .___SOutline_1i6ki_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SValue_1i6ki_gg_._neighborLocation_right_1i6ki_gg_{padding-right:0}.___SValue_1i6ki_gg_._neighborLocation_both_1i6ki_gg_{padding-left:0;padding-right:0}.___SValue_1i6ki_gg_._neighborLocation_left_1i6ki_gg_{padding-left:0}",
|
|
19
23
|
/*__inner_css_end__*/
|
|
20
|
-
"
|
|
24
|
+
"1i6ki_gg_"
|
|
21
25
|
), /*__reshadow_css_end__*/
|
|
22
26
|
{
|
|
23
|
-
"__SInput": "
|
|
24
|
-
"_disabled": "
|
|
25
|
-
"__SOutline": "
|
|
26
|
-
"__SValue": "
|
|
27
|
-
"__SAddon": "
|
|
28
|
-
"_size_m": "
|
|
29
|
-
"__SButton": "
|
|
30
|
-
"_size_l": "
|
|
31
|
-
"_neighborLocation_right": "
|
|
32
|
-
"_neighborLocation_both": "
|
|
33
|
-
"_neighborLocation_left": "
|
|
34
|
-
"_interactive": "
|
|
35
|
-
"_state_normal": "
|
|
36
|
-
"_state_valid": "
|
|
37
|
-
"_state_invalid": "
|
|
27
|
+
"__SInput": "___SInput_1i6ki_gg_",
|
|
28
|
+
"_disabled": "__disabled_1i6ki_gg_",
|
|
29
|
+
"__SOutline": "___SOutline_1i6ki_gg_",
|
|
30
|
+
"__SValue": "___SValue_1i6ki_gg_",
|
|
31
|
+
"__SAddon": "___SAddon_1i6ki_gg_",
|
|
32
|
+
"_size_m": "_size_m_1i6ki_gg_",
|
|
33
|
+
"__SButton": "___SButton_1i6ki_gg_",
|
|
34
|
+
"_size_l": "_size_l_1i6ki_gg_",
|
|
35
|
+
"_neighborLocation_right": "_neighborLocation_right_1i6ki_gg_",
|
|
36
|
+
"_neighborLocation_both": "_neighborLocation_both_1i6ki_gg_",
|
|
37
|
+
"_neighborLocation_left": "_neighborLocation_left_1i6ki_gg_",
|
|
38
|
+
"_interactive": "__interactive_1i6ki_gg_",
|
|
39
|
+
"_state_normal": "_state_normal_1i6ki_gg_",
|
|
40
|
+
"_state_valid": "_state_valid_1i6ki_gg_",
|
|
41
|
+
"_state_invalid": "_state_invalid_1i6ki_gg_"
|
|
38
42
|
})
|
|
39
43
|
);
|
|
40
44
|
var Input = /* @__PURE__ */ function(_Component) {
|
|
41
|
-
_inherits(Input2, _Component);
|
|
42
|
-
var _super = _createSuper(Input2);
|
|
43
45
|
function Input2() {
|
|
44
46
|
var _this;
|
|
45
47
|
_classCallCheck(this, Input2);
|
|
46
48
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
49
|
args[_key] = arguments[_key];
|
|
48
50
|
}
|
|
49
|
-
_this =
|
|
50
|
-
_defineProperty(
|
|
51
|
-
_defineProperty(
|
|
51
|
+
_this = _callSuper(this, Input2, [].concat(args));
|
|
52
|
+
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
53
|
+
_defineProperty(_this, "handleMouseDownAddon", function(event) {
|
|
52
54
|
var _this$inputRef$curren;
|
|
53
55
|
event.preventDefault();
|
|
54
|
-
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0
|
|
56
|
+
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 || _this$inputRef$curren.focus();
|
|
55
57
|
});
|
|
56
|
-
_defineProperty(
|
|
58
|
+
_defineProperty(_this, "handleKeyDown", function(event) {
|
|
57
59
|
if (event.key === "Enter") {
|
|
58
60
|
setTimeout(function() {
|
|
59
61
|
if (document.activeElement === document.body) {
|
|
60
62
|
var _this$inputRef$curren2;
|
|
61
|
-
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0
|
|
63
|
+
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0 || _this$inputRef$curren2.focus();
|
|
62
64
|
}
|
|
63
65
|
}, 10);
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
return _this;
|
|
67
69
|
}
|
|
68
|
-
|
|
70
|
+
_inherits(Input2, _Component);
|
|
71
|
+
return _createClass(Input2, [{
|
|
69
72
|
key: "getAddonProps",
|
|
70
73
|
value: function getAddonProps() {
|
|
71
74
|
var _this$asProps = this.asProps, disabled = _this$asProps.disabled, size = _this$asProps.size;
|
|
@@ -80,7 +83,7 @@ var Input = /* @__PURE__ */ function(_Component) {
|
|
|
80
83
|
value: function getValueProps() {
|
|
81
84
|
var _this$asProps2 = this.asProps, size = _this$asProps2.size, disabled = _this$asProps2.disabled, state = _this$asProps2.state, role = _this$asProps2.role, placeholder = _this$asProps2.placeholder, ariaHaspopup = _this$asProps2["aria-haspopup"], ariaControls = _this$asProps2["aria-controls"], ariaExpanded = _this$asProps2["aria-expanded"], ariaAutocomplete = _this$asProps2["aria-autocomplete"], ariaOwns = _this$asProps2["aria-owns"], ariaActivedescendant = _this$asProps2["aria-activedescendant"];
|
|
82
85
|
return {
|
|
83
|
-
ref: this.inputRef,
|
|
86
|
+
"ref": this.inputRef,
|
|
84
87
|
size,
|
|
85
88
|
disabled,
|
|
86
89
|
state,
|
|
@@ -115,7 +118,6 @@ var Input = /* @__PURE__ */ function(_Component) {
|
|
|
115
118
|
});
|
|
116
119
|
}
|
|
117
120
|
}]);
|
|
118
|
-
return Input2;
|
|
119
121
|
}(Component);
|
|
120
122
|
_defineProperty(Input, "displayName", "Input");
|
|
121
123
|
_defineProperty(Input, "defaultProps", {
|
|
@@ -124,13 +126,12 @@ _defineProperty(Input, "defaultProps", {
|
|
|
124
126
|
});
|
|
125
127
|
_defineProperty(Input, "style", style);
|
|
126
128
|
var Value = /* @__PURE__ */ function(_Component2) {
|
|
127
|
-
_inherits(Value2, _Component2);
|
|
128
|
-
var _super2 = _createSuper(Value2);
|
|
129
129
|
function Value2() {
|
|
130
130
|
_classCallCheck(this, Value2);
|
|
131
|
-
return
|
|
131
|
+
return _callSuper(this, Value2, arguments);
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
_inherits(Value2, _Component2);
|
|
134
|
+
return _createClass(Value2, [{
|
|
134
135
|
key: "uncontrolledProps",
|
|
135
136
|
value: function uncontrolledProps() {
|
|
136
137
|
return {
|
|
@@ -158,7 +159,6 @@ var Value = /* @__PURE__ */ function(_Component2) {
|
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
}]);
|
|
161
|
-
return Value2;
|
|
162
162
|
}(Component);
|
|
163
163
|
_defineProperty(Value, "defaultProps", {
|
|
164
164
|
defaultValue: ""
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { BoxProps } from '@semcore/flex-box';
|
|
4
|
-
import { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';
|
|
5
|
-
import
|
|
1
|
+
import type { Intergalactic, PropGetterFn, UnknownProperties } from '@semcore/core';
|
|
2
|
+
import type { WithAutoFocusEnhanceProps } from '@semcore/core/lib/utils/enhances/autoFocusEnhance';
|
|
3
|
+
import type { BoxProps } from '@semcore/flex-box';
|
|
4
|
+
import type { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';
|
|
5
|
+
import type React from 'react';
|
|
6
6
|
|
|
7
7
|
export type InputSize = 'm' | 'l';
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/input",
|
|
3
3
|
"description": "Semrush Input Component",
|
|
4
|
-
"version": "16.0.1",
|
|
4
|
+
"version": "16.0.2-prerelease.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/
|
|
18
|
-
"@semcore/
|
|
17
|
+
"@semcore/flex-box": "16.0.2-prerelease.1",
|
|
18
|
+
"@semcore/neighbor-location": "16.0.2-prerelease.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@semcore/base-components": "^16.0.
|
|
21
|
+
"@semcore/base-components": "^16.0.2-prerelease.1"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"directory": "semcore/input"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@
|
|
29
|
+
"@semcore/core": "16.0.0",
|
|
30
30
|
"@semcore/testing-utils": "1.0.0",
|
|
31
|
-
"@semcore/icon": "
|
|
31
|
+
"@semcore/icon": "16.2.1-prerelease.1"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|