@semcore/input 2.2.4 → 3.0.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 +19 -0
- package/lib/cjs/Input.js +32 -33
- package/lib/cjs/Input.js.map +1 -1
- package/lib/cjs/index.d.ts +85 -0
- package/lib/cjs/style/input.shadow.css +35 -78
- package/lib/es6/Input.js +32 -33
- package/lib/es6/Input.js.map +1 -1
- package/lib/es6/index.d.ts +85 -0
- package/lib/es6/style/input.shadow.css +35 -78
- package/lib/types/index.d.ts +20 -4
- package/package.json +5 -1
- package/src/{Input.js → Input.jsx} +4 -3
- package/src/index.d.ts +20 -4
- package/src/style/input.shadow.css +35 -78
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.0.1] - 2022-05-18
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.24.0 ~> 2.25.0]).
|
|
10
|
+
|
|
11
|
+
## [3.0.0] - 2022-05-17
|
|
12
|
+
|
|
13
|
+
### BREAK
|
|
14
|
+
|
|
15
|
+
- Updated styles according to the library redesign policy.
|
|
16
|
+
- Remove value "xl"/"s"" for "size".
|
|
17
|
+
|
|
18
|
+
## [2.2.5] - 2022-03-14
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [3.31.2 ~> 3.31.2], `@semcore/flex-box` [4.5.0 ~> 4.5.1]).
|
|
23
|
+
|
|
5
24
|
## [2.2.4] - 2022-02-24
|
|
6
25
|
|
|
7
26
|
### Added
|
package/lib/cjs/Input.js
CHANGED
|
@@ -50,28 +50,26 @@ var style = (
|
|
|
50
50
|
/*__reshadow_css_start__*/
|
|
51
51
|
_core.sstyled.insert(
|
|
52
52
|
/*__inner_css_start__*/
|
|
53
|
-
".
|
|
53
|
+
".___SInput_12tss_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_12tss_gg_ input:-webkit-autofill{border-radius:6px;-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_12tss_gg_ input:-webkit-autofill~.___SOutline_12tss_gg_{background-color:#faffbd}.___SInput_12tss_gg_ .___SOutline_12tss_gg_{border-radius:6px}.___SValue_12tss_gg_{min-width:0;width:100%;height:100%;padding:0;border:none;box-sizing:border-box;color:#191b23;font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:transparent}.___SValue_12tss_gg_:focus{outline:none}.___SValue_12tss_gg_::-moz-placeholder{color:#a9abb6}.___SValue_12tss_gg_:-ms-input-placeholder{color:#a9abb6}.___SValue_12tss_gg_::placeholder{color:#a9abb6}.___SValue_12tss_gg_:-moz-read-only~.___SOutline_12tss_gg_{background:#f4f5f9}.___SValue_12tss_gg_:read-only~.___SOutline_12tss_gg_{background:#f4f5f9}.___SValue_12tss_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:0.3}.___SValue_12tss_gg_:disabled~.___SOutline_12tss_gg_{opacity:0.3;cursor:default;pointer-events:none}.___SOutline_12tss_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;z-index:-1;background:#fff}.___SAddon_12tss_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 8px;height:100%;color:#a9abb6}.___SAddon_12tss_gg_.__interactive_12tss_gg_{cursor:pointer}.___SAddon_12tss_gg_.__interactive_12tss_gg_:hover{color:#8a8e9b}.___SAddon_12tss_gg_.__disabled_12tss_gg_{opacity:0.3;cursor:default;pointer-events:none}.___SInput_12tss_gg_._size_m_12tss_gg_{font-size:14px;height:28px}.___SValue_12tss_gg_._size_l_12tss_gg_,.___SValue_12tss_gg_._size_m_12tss_gg_{padding:0 8px}.___SInput_12tss_gg_._size_l_12tss_gg_{font-size:16px;height:40px;padding-left:4px;padding-right:4px}.___SInput_12tss_gg_.__focused_12tss_gg_{z-index:1}.___SInput_12tss_gg_._state_normal_12tss_gg_ .___SOutline_12tss_gg_{border-color:#c4c7cf}.___SInput_12tss_gg_._state_normal_12tss_gg_ .___SValue_12tss_gg_:focus~.___SOutline_12tss_gg_{border-color:#008ff8;box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}.___SInput_12tss_gg_._state_valid_12tss_gg_ .___SOutline_12tss_gg_{border-color:#59ddaa}.___SInput_12tss_gg_._state_valid_12tss_gg_ .___SValue_12tss_gg_:focus~.___SOutline_12tss_gg_{border-color:#009f81;box-shadow:0px 0px 0px 3px rgba(0, 159, 129, 0.2)}.___SInput_12tss_gg_._state_invalid_12tss_gg_ .___SOutline_12tss_gg_{border-color:#ffaeb5}.___SInput_12tss_gg_._state_invalid_12tss_gg_ .___SValue_12tss_gg_:focus~.___SOutline_12tss_gg_{border-color:#ff4953;box-shadow:0px 0px 0px 3px rgba(255, 73, 83, 0.2)}.___SInput_12tss_gg_._neighborLocation_right_12tss_gg_ .___SOutline_12tss_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_12tss_gg_._neighborLocation_both_12tss_gg_ .___SOutline_12tss_gg_{border-radius:0;border-left:none}.___SInput_12tss_gg_._neighborLocation_left_12tss_gg_ .___SOutline_12tss_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SAddon_12tss_gg_._neighborLocation_right_12tss_gg_{padding-right:8px}.___SAddon_12tss_gg_._neighborLocation_left_12tss_gg_{padding-left:8px}.___SValue_12tss_gg_._neighborLocation_right_12tss_gg_{padding-right:0}.___SValue_12tss_gg_._neighborLocation_both_12tss_gg_{padding-left:0;padding-right:0}.___SValue_12tss_gg_._neighborLocation_left_12tss_gg_{padding-left:0}"
|
|
54
54
|
/*__inner_css_end__*/
|
|
55
|
-
, "
|
|
55
|
+
, "17wylmg_gg_")
|
|
56
56
|
/*__reshadow_css_end__*/
|
|
57
57
|
, {
|
|
58
|
-
"__SInput": "
|
|
59
|
-
"__SOutline": "
|
|
60
|
-
"__SValue": "
|
|
61
|
-
"__SAddon": "
|
|
62
|
-
"_interactive": "
|
|
63
|
-
"_disabled": "
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"_neighborLocation_both": "_neighborLocation_both_1hvq5_gg_",
|
|
74
|
-
"_neighborLocation_left": "_neighborLocation_left_1hvq5_gg_"
|
|
58
|
+
"__SInput": "___SInput_12tss_gg_",
|
|
59
|
+
"__SOutline": "___SOutline_12tss_gg_",
|
|
60
|
+
"__SValue": "___SValue_12tss_gg_",
|
|
61
|
+
"__SAddon": "___SAddon_12tss_gg_",
|
|
62
|
+
"_interactive": "__interactive_12tss_gg_",
|
|
63
|
+
"_disabled": "__disabled_12tss_gg_",
|
|
64
|
+
"_size_m": "_size_m_12tss_gg_",
|
|
65
|
+
"_size_l": "_size_l_12tss_gg_",
|
|
66
|
+
"_focused": "__focused_12tss_gg_",
|
|
67
|
+
"_state_normal": "_state_normal_12tss_gg_",
|
|
68
|
+
"_state_valid": "_state_valid_12tss_gg_",
|
|
69
|
+
"_state_invalid": "_state_invalid_12tss_gg_",
|
|
70
|
+
"_neighborLocation_right": "_neighborLocation_right_12tss_gg_",
|
|
71
|
+
"_neighborLocation_both": "_neighborLocation_both_12tss_gg_",
|
|
72
|
+
"_neighborLocation_left": "_neighborLocation_left_12tss_gg_"
|
|
75
73
|
});
|
|
76
74
|
|
|
77
75
|
var Input = /*#__PURE__*/function (_Component) {
|
|
@@ -92,12 +90,10 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
92
90
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
93
91
|
focused: false
|
|
94
92
|
});
|
|
95
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "inputRef",
|
|
93
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "inputRef", _react["default"].createRef());
|
|
96
94
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMouseDownAddon", function (e) {
|
|
97
|
-
var _this$inputRef$curren;
|
|
98
|
-
|
|
99
95
|
e.preventDefault();
|
|
100
|
-
|
|
96
|
+
_this.inputRef.current?.focus();
|
|
101
97
|
});
|
|
102
98
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindHandlerValueFocused", function (focused) {
|
|
103
99
|
return function () {
|
|
@@ -112,19 +108,22 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
112
108
|
(0, _createClass2["default"])(Input, [{
|
|
113
109
|
key: "getAddonProps",
|
|
114
110
|
value: function getAddonProps() {
|
|
115
|
-
var
|
|
111
|
+
var disabled = this.asProps.disabled;
|
|
116
112
|
return {
|
|
117
|
-
|
|
113
|
+
disabled: disabled,
|
|
118
114
|
onMouseDown: this.handleMouseDownAddon
|
|
119
115
|
};
|
|
120
116
|
}
|
|
121
117
|
}, {
|
|
122
118
|
key: "getValueProps",
|
|
123
119
|
value: function getValueProps() {
|
|
124
|
-
var
|
|
120
|
+
var _this$asProps = this.asProps,
|
|
121
|
+
size = _this$asProps.size,
|
|
122
|
+
disabled = _this$asProps.disabled;
|
|
125
123
|
return {
|
|
126
124
|
ref: this.inputRef,
|
|
127
125
|
size: size,
|
|
126
|
+
disabled: disabled,
|
|
128
127
|
onFocus: this.bindHandlerValueFocused(true),
|
|
129
128
|
onBlur: this.bindHandlerValueFocused(false)
|
|
130
129
|
};
|
|
@@ -132,15 +131,15 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
132
131
|
}, {
|
|
133
132
|
key: "render",
|
|
134
133
|
value: function render() {
|
|
135
|
-
var _ref = this
|
|
134
|
+
var _ref = this.asProps,
|
|
136
135
|
_ref4;
|
|
137
136
|
|
|
138
137
|
var SInput = _flexBox.Box;
|
|
139
138
|
var SOutline = 'div';
|
|
140
|
-
var _this$
|
|
141
|
-
Children = _this$
|
|
142
|
-
styles = _this$
|
|
143
|
-
controlsLength = _this$
|
|
139
|
+
var _this$asProps2 = this.asProps,
|
|
140
|
+
Children = _this$asProps2.Children,
|
|
141
|
+
styles = _this$asProps2.styles,
|
|
142
|
+
controlsLength = _this$asProps2.controlsLength;
|
|
144
143
|
var focused = this.state.focused;
|
|
145
144
|
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SInput, _ref4.cn("SInput", _objectSpread({}, (0, _core.assignProps)({
|
|
146
145
|
"focused": focused
|
|
@@ -182,7 +181,7 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
182
181
|
}, {
|
|
183
182
|
key: "render",
|
|
184
183
|
value: function render() {
|
|
185
|
-
var _ref2 = this
|
|
184
|
+
var _ref2 = this.asProps,
|
|
186
185
|
_ref5;
|
|
187
186
|
|
|
188
187
|
var SValue = _flexBox.Box;
|
|
@@ -201,7 +200,7 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
201
200
|
(0, _defineProperty2["default"])(Value, "enhance", [(0, _autoFocusEnhance["default"])(), (0, _neighborLocation.neighborLocationEnhance)()]);
|
|
202
201
|
|
|
203
202
|
function Addon(props) {
|
|
204
|
-
var _ref3 =
|
|
203
|
+
var _ref3 = arguments[0],
|
|
205
204
|
_ref6;
|
|
206
205
|
|
|
207
206
|
var SAddon = _flexBox.Box;
|
package/lib/cjs/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Input.
|
|
1
|
+
{"version":3,"sources":["../../src/Input.jsx"],"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","Component","style","Value","value","target","SValue","defaultValue","Addon","props","SAddon","enhance"],"mappings":"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","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation, { neighborLocationEnhance } from '@semcore/neighbor-location';\nimport autoFocusEnhance from '@semcore/utils/lib/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 static enhance = [neighborLocationEnhance()];\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, controlsLength } = this.asProps;\n const { focused } = this.state;\n\n return sstyled(styles)(\n <SInput render={Box} focused={focused}>\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline />\n </SInput>,\n );\n }\n}\n\nclass Value extends Component {\n static defaultProps = {\n defaultValue: '',\n };\n static enhance = [autoFocusEnhance(), neighborLocationEnhance()];\n\n uncontrolledProps() {\n return {\n value: (e) => e.target.value,\n };\n }\n\n render() {\n const SValue = Root;\n\n return sstyled(this.asProps.styles)(<SValue render={Box} tag=\"input\" type=\"text\" />);\n }\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} />);\n}\n\nAddon.enhance = [neighborLocationEnhance()];\n\nexport default createComponent(Input, {\n Addon,\n Value,\n});\n"],"file":"Input.js"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropGetterFn } from '@semcore/core';
|
|
3
|
+
import { IBoxProps } from '@semcore/flex-box';
|
|
4
|
+
import { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';
|
|
5
|
+
import { IWithAutoFocusEnhanceProps } from '@semcore/utils/lib/enhances/autoFocusEnhance';
|
|
6
|
+
|
|
7
|
+
/* utils type */
|
|
8
|
+
type CProps<Props, Ctx = {}, UCProps = {}> = Props & {
|
|
9
|
+
children?: ((props: Props & Ctx, handlers: UCProps) => React.ReactNode) | React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type ReturnEl = React.ReactElement | null;
|
|
12
|
+
/* utils type */
|
|
13
|
+
|
|
14
|
+
export type InputSize = 'm' | 'l';
|
|
15
|
+
|
|
16
|
+
export interface IInputProps extends IBoxProps, INeighborItemProps, INeighborLocationProps {
|
|
17
|
+
/**
|
|
18
|
+
* Sets the input and addons to the disabled state
|
|
19
|
+
* */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Input size
|
|
23
|
+
* @default m
|
|
24
|
+
*/
|
|
25
|
+
size?: InputSize;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the input state
|
|
28
|
+
* @default normal
|
|
29
|
+
*/
|
|
30
|
+
state?: 'normal' | 'invalid' | 'valid';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IInputValueProps
|
|
34
|
+
extends IBoxProps,
|
|
35
|
+
INeighborItemProps,
|
|
36
|
+
IWithAutoFocusEnhanceProps {
|
|
37
|
+
/**
|
|
38
|
+
* Input value
|
|
39
|
+
*/
|
|
40
|
+
value?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Handler for changing the value
|
|
43
|
+
*/
|
|
44
|
+
onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the input to the disabled state
|
|
47
|
+
* */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the input to the read-only state
|
|
51
|
+
* */
|
|
52
|
+
readOnly?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Input size
|
|
55
|
+
* @default m
|
|
56
|
+
*/
|
|
57
|
+
size?: InputSize;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface IInputAddonProps extends IBoxProps, INeighborItemProps {
|
|
61
|
+
/**
|
|
62
|
+
* Adds styles for interactive icons
|
|
63
|
+
*/
|
|
64
|
+
interactive?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Blocks the addon
|
|
67
|
+
* */
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Input size
|
|
71
|
+
* @default m
|
|
72
|
+
*/
|
|
73
|
+
size?: InputSize;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface IInputCtx {
|
|
77
|
+
getValueProps: PropGetterFn;
|
|
78
|
+
getAddonProps: PropGetterFn;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare const Input: (<T>(props: CProps<IInputProps & T, IInputCtx>) => ReturnEl) & {
|
|
82
|
+
Value: <T>(props: IInputValueProps & T) => ReturnEl;
|
|
83
|
+
Addon: <T>(props: CProps<IInputAddonProps & T, IInputProps>) => ReturnEl;
|
|
84
|
+
};
|
|
85
|
+
export default Input;
|
|
@@ -11,12 +11,17 @@ SInput {
|
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
|
|
13
13
|
& input:-webkit-autofill {
|
|
14
|
+
border-radius: var(--rounded-m);
|
|
14
15
|
-webkit-box-shadow: 0 0 0 30px rgb(250, 255, 189) inset;
|
|
15
16
|
|
|
16
17
|
& ~ SOutline {
|
|
17
18
|
background-color: rgb(250, 255, 189);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
& SOutline {
|
|
23
|
+
border-radius: var(--rounded-m);
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
SValue {
|
|
@@ -27,9 +32,8 @@ SValue {
|
|
|
27
32
|
padding: 0;
|
|
28
33
|
border: none;
|
|
29
34
|
box-sizing: border-box;
|
|
30
|
-
color: var(--
|
|
35
|
+
color: var(--gray-800);
|
|
31
36
|
font-size: inherit;
|
|
32
|
-
line-height: 1.1;
|
|
33
37
|
text-overflow: ellipsis;
|
|
34
38
|
font-family: inherit;
|
|
35
39
|
background: transparent;
|
|
@@ -39,11 +43,11 @@ SValue {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
&::placeholder {
|
|
42
|
-
color: var(--
|
|
46
|
+
color: var(--gray-300);
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
&:read-only ~ SOutline {
|
|
46
|
-
background: var(--
|
|
50
|
+
background: var(--gray-50);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
&:disabled {
|
|
@@ -74,16 +78,16 @@ SAddon {
|
|
|
74
78
|
justify-content: center;
|
|
75
79
|
align-items: center;
|
|
76
80
|
flex: 0 0 auto;
|
|
81
|
+
padding: 0 8px;
|
|
77
82
|
height: 100%;
|
|
78
|
-
color: var(--
|
|
83
|
+
color: var(--gray-300);
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
SAddon[interactive] {
|
|
82
|
-
color: var(--stone);
|
|
83
87
|
cursor: pointer;
|
|
84
88
|
|
|
85
89
|
&:hover {
|
|
86
|
-
color:
|
|
90
|
+
color: var(--gray-400);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -93,76 +97,21 @@ SAddon[disabled] {
|
|
|
93
97
|
pointer-events: none;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
SInput[size='s'] {
|
|
97
|
-
font-size: 10px;
|
|
98
|
-
height: 18px;
|
|
99
|
-
|
|
100
|
-
& SOutline {
|
|
101
|
-
border-radius: 2px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
& input:-webkit-autofill {
|
|
105
|
-
border-radius: 1px;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
SValue[size='s'],
|
|
110
|
-
SAddon[size='s'] {
|
|
111
|
-
padding: 0 4px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
100
|
SInput[size='m'] {
|
|
115
|
-
font-size:
|
|
116
|
-
height:
|
|
117
|
-
|
|
118
|
-
& SOutline {
|
|
119
|
-
border-radius: 3px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
& input:-webkit-autofill {
|
|
123
|
-
border-radius: 2px;
|
|
124
|
-
}
|
|
101
|
+
font-size: var(--fs-200);
|
|
102
|
+
height: var(--form-control-m);
|
|
125
103
|
}
|
|
126
104
|
|
|
127
105
|
SValue[size='m'],
|
|
128
|
-
|
|
106
|
+
SValue[size='l'] {
|
|
129
107
|
padding: 0 8px;
|
|
130
108
|
}
|
|
131
109
|
|
|
132
110
|
SInput[size='l'] {
|
|
133
|
-
font-size:
|
|
134
|
-
height:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
border-radius: 4px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
& input:-webkit-autofill {
|
|
141
|
-
border-radius: 3px;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
SValue[size='l'],
|
|
146
|
-
SAddon[size='l'] {
|
|
147
|
-
padding: 0 8px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
SInput[size='xl'] {
|
|
151
|
-
font-size: 16px;
|
|
152
|
-
height: 42px;
|
|
153
|
-
|
|
154
|
-
& SOutline {
|
|
155
|
-
border-radius: 5px;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
& input:-webkit-autofill {
|
|
159
|
-
border-radius: 4px;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
SValue[size='xl'],
|
|
164
|
-
SAddon[size='xl'] {
|
|
165
|
-
padding: 0 12px;
|
|
111
|
+
font-size: var(--fs-300);
|
|
112
|
+
height: var(--form-control-l);
|
|
113
|
+
padding-left: 4px;
|
|
114
|
+
padding-right: 4px;
|
|
166
115
|
}
|
|
167
116
|
|
|
168
117
|
SInput[focused] {
|
|
@@ -171,32 +120,32 @@ SInput[focused] {
|
|
|
171
120
|
|
|
172
121
|
SInput[state='normal'] {
|
|
173
122
|
& SOutline {
|
|
174
|
-
border-color: var(--
|
|
123
|
+
border-color: var(--gray-200);
|
|
175
124
|
}
|
|
176
125
|
|
|
177
126
|
& SValue:focus ~ SOutline {
|
|
178
|
-
border-color: var(--
|
|
179
|
-
box-shadow: var(--
|
|
127
|
+
border-color: var(--blue-400);
|
|
128
|
+
box-shadow: var(--keyboard-focus);
|
|
180
129
|
}
|
|
181
130
|
}
|
|
182
131
|
SInput[state='valid'] {
|
|
183
132
|
& SOutline {
|
|
184
|
-
border-color: var(--green);
|
|
133
|
+
border-color: var(--green-200);
|
|
185
134
|
}
|
|
186
135
|
|
|
187
136
|
& SValue:focus ~ SOutline {
|
|
188
|
-
border-color: var(--green);
|
|
189
|
-
box-shadow:
|
|
137
|
+
border-color: var(--green-400);
|
|
138
|
+
box-shadow: var(--keyboard-focus-valid);
|
|
190
139
|
}
|
|
191
140
|
}
|
|
192
141
|
SInput[state='invalid'] {
|
|
193
142
|
& SOutline {
|
|
194
|
-
border-color: var(--
|
|
143
|
+
border-color: var(--red-200);
|
|
195
144
|
}
|
|
196
145
|
|
|
197
146
|
& SValue:focus ~ SOutline {
|
|
198
|
-
border-color: var(--
|
|
199
|
-
box-shadow:
|
|
147
|
+
border-color: var(--red-400);
|
|
148
|
+
box-shadow: var(--keyboard-focus-invalid);
|
|
200
149
|
}
|
|
201
150
|
}
|
|
202
151
|
|
|
@@ -220,6 +169,14 @@ SInput[neighborLocation='left'] {
|
|
|
220
169
|
}
|
|
221
170
|
}
|
|
222
171
|
|
|
172
|
+
SAddon[neighborLocation='right'] {
|
|
173
|
+
padding-right: 8px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
SAddon[neighborLocation='left'] {
|
|
177
|
+
padding-left: 8px;
|
|
178
|
+
}
|
|
179
|
+
|
|
223
180
|
SValue[neighborLocation='right'] {
|
|
224
181
|
padding-right: 0;
|
|
225
182
|
}
|
package/lib/es6/Input.js
CHANGED
|
@@ -29,28 +29,26 @@ var style = (
|
|
|
29
29
|
/*__reshadow_css_start__*/
|
|
30
30
|
_sstyled.insert(
|
|
31
31
|
/*__inner_css_start__*/
|
|
32
|
-
".
|
|
32
|
+
".___SInput_12tss_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_12tss_gg_ input:-webkit-autofill{border-radius:6px;-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_12tss_gg_ input:-webkit-autofill~.___SOutline_12tss_gg_{background-color:#faffbd}.___SInput_12tss_gg_ .___SOutline_12tss_gg_{border-radius:6px}.___SValue_12tss_gg_{min-width:0;width:100%;height:100%;padding:0;border:none;box-sizing:border-box;color:#191b23;font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:transparent}.___SValue_12tss_gg_:focus{outline:none}.___SValue_12tss_gg_::-moz-placeholder{color:#a9abb6}.___SValue_12tss_gg_:-ms-input-placeholder{color:#a9abb6}.___SValue_12tss_gg_::placeholder{color:#a9abb6}.___SValue_12tss_gg_:-moz-read-only~.___SOutline_12tss_gg_{background:#f4f5f9}.___SValue_12tss_gg_:read-only~.___SOutline_12tss_gg_{background:#f4f5f9}.___SValue_12tss_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:0.3}.___SValue_12tss_gg_:disabled~.___SOutline_12tss_gg_{opacity:0.3;cursor:default;pointer-events:none}.___SOutline_12tss_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;z-index:-1;background:#fff}.___SAddon_12tss_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 8px;height:100%;color:#a9abb6}.___SAddon_12tss_gg_.__interactive_12tss_gg_{cursor:pointer}.___SAddon_12tss_gg_.__interactive_12tss_gg_:hover{color:#8a8e9b}.___SAddon_12tss_gg_.__disabled_12tss_gg_{opacity:0.3;cursor:default;pointer-events:none}.___SInput_12tss_gg_._size_m_12tss_gg_{font-size:14px;height:28px}.___SValue_12tss_gg_._size_l_12tss_gg_,.___SValue_12tss_gg_._size_m_12tss_gg_{padding:0 8px}.___SInput_12tss_gg_._size_l_12tss_gg_{font-size:16px;height:40px;padding-left:4px;padding-right:4px}.___SInput_12tss_gg_.__focused_12tss_gg_{z-index:1}.___SInput_12tss_gg_._state_normal_12tss_gg_ .___SOutline_12tss_gg_{border-color:#c4c7cf}.___SInput_12tss_gg_._state_normal_12tss_gg_ .___SValue_12tss_gg_:focus~.___SOutline_12tss_gg_{border-color:#008ff8;box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}.___SInput_12tss_gg_._state_valid_12tss_gg_ .___SOutline_12tss_gg_{border-color:#59ddaa}.___SInput_12tss_gg_._state_valid_12tss_gg_ .___SValue_12tss_gg_:focus~.___SOutline_12tss_gg_{border-color:#009f81;box-shadow:0px 0px 0px 3px rgba(0, 159, 129, 0.2)}.___SInput_12tss_gg_._state_invalid_12tss_gg_ .___SOutline_12tss_gg_{border-color:#ffaeb5}.___SInput_12tss_gg_._state_invalid_12tss_gg_ .___SValue_12tss_gg_:focus~.___SOutline_12tss_gg_{border-color:#ff4953;box-shadow:0px 0px 0px 3px rgba(255, 73, 83, 0.2)}.___SInput_12tss_gg_._neighborLocation_right_12tss_gg_ .___SOutline_12tss_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_12tss_gg_._neighborLocation_both_12tss_gg_ .___SOutline_12tss_gg_{border-radius:0;border-left:none}.___SInput_12tss_gg_._neighborLocation_left_12tss_gg_ .___SOutline_12tss_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SAddon_12tss_gg_._neighborLocation_right_12tss_gg_{padding-right:8px}.___SAddon_12tss_gg_._neighborLocation_left_12tss_gg_{padding-left:8px}.___SValue_12tss_gg_._neighborLocation_right_12tss_gg_{padding-right:0}.___SValue_12tss_gg_._neighborLocation_both_12tss_gg_{padding-left:0;padding-right:0}.___SValue_12tss_gg_._neighborLocation_left_12tss_gg_{padding-left:0}"
|
|
33
33
|
/*__inner_css_end__*/
|
|
34
|
-
, "
|
|
34
|
+
, "17wylmg_gg_")
|
|
35
35
|
/*__reshadow_css_end__*/
|
|
36
36
|
, {
|
|
37
|
-
"__SInput": "
|
|
38
|
-
"__SOutline": "
|
|
39
|
-
"__SValue": "
|
|
40
|
-
"__SAddon": "
|
|
41
|
-
"_interactive": "
|
|
42
|
-
"_disabled": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"_neighborLocation_both": "_neighborLocation_both_1hvq5_gg_",
|
|
53
|
-
"_neighborLocation_left": "_neighborLocation_left_1hvq5_gg_"
|
|
37
|
+
"__SInput": "___SInput_12tss_gg_",
|
|
38
|
+
"__SOutline": "___SOutline_12tss_gg_",
|
|
39
|
+
"__SValue": "___SValue_12tss_gg_",
|
|
40
|
+
"__SAddon": "___SAddon_12tss_gg_",
|
|
41
|
+
"_interactive": "__interactive_12tss_gg_",
|
|
42
|
+
"_disabled": "__disabled_12tss_gg_",
|
|
43
|
+
"_size_m": "_size_m_12tss_gg_",
|
|
44
|
+
"_size_l": "_size_l_12tss_gg_",
|
|
45
|
+
"_focused": "__focused_12tss_gg_",
|
|
46
|
+
"_state_normal": "_state_normal_12tss_gg_",
|
|
47
|
+
"_state_valid": "_state_valid_12tss_gg_",
|
|
48
|
+
"_state_invalid": "_state_invalid_12tss_gg_",
|
|
49
|
+
"_neighborLocation_right": "_neighborLocation_right_12tss_gg_",
|
|
50
|
+
"_neighborLocation_both": "_neighborLocation_both_12tss_gg_",
|
|
51
|
+
"_neighborLocation_left": "_neighborLocation_left_12tss_gg_"
|
|
54
52
|
});
|
|
55
53
|
|
|
56
54
|
var Input = /*#__PURE__*/function (_Component) {
|
|
@@ -73,13 +71,11 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
73
71
|
focused: false
|
|
74
72
|
});
|
|
75
73
|
|
|
76
|
-
_defineProperty(_assertThisInitialized(_this), "inputRef",
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "inputRef", React.createRef());
|
|
77
75
|
|
|
78
76
|
_defineProperty(_assertThisInitialized(_this), "handleMouseDownAddon", function (e) {
|
|
79
|
-
var _this$inputRef$curren;
|
|
80
|
-
|
|
81
77
|
e.preventDefault();
|
|
82
|
-
|
|
78
|
+
_this.inputRef.current?.focus();
|
|
83
79
|
});
|
|
84
80
|
|
|
85
81
|
_defineProperty(_assertThisInitialized(_this), "bindHandlerValueFocused", function (focused) {
|
|
@@ -96,19 +92,22 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
96
92
|
_createClass(Input, [{
|
|
97
93
|
key: "getAddonProps",
|
|
98
94
|
value: function getAddonProps() {
|
|
99
|
-
var
|
|
95
|
+
var disabled = this.asProps.disabled;
|
|
100
96
|
return {
|
|
101
|
-
|
|
97
|
+
disabled: disabled,
|
|
102
98
|
onMouseDown: this.handleMouseDownAddon
|
|
103
99
|
};
|
|
104
100
|
}
|
|
105
101
|
}, {
|
|
106
102
|
key: "getValueProps",
|
|
107
103
|
value: function getValueProps() {
|
|
108
|
-
var
|
|
104
|
+
var _this$asProps = this.asProps,
|
|
105
|
+
size = _this$asProps.size,
|
|
106
|
+
disabled = _this$asProps.disabled;
|
|
109
107
|
return {
|
|
110
108
|
ref: this.inputRef,
|
|
111
109
|
size: size,
|
|
110
|
+
disabled: disabled,
|
|
112
111
|
onFocus: this.bindHandlerValueFocused(true),
|
|
113
112
|
onBlur: this.bindHandlerValueFocused(false)
|
|
114
113
|
};
|
|
@@ -116,15 +115,15 @@ var Input = /*#__PURE__*/function (_Component) {
|
|
|
116
115
|
}, {
|
|
117
116
|
key: "render",
|
|
118
117
|
value: function render() {
|
|
119
|
-
var _ref = this
|
|
118
|
+
var _ref = this.asProps,
|
|
120
119
|
_ref4;
|
|
121
120
|
|
|
122
121
|
var SInput = Box;
|
|
123
122
|
var SOutline = 'div';
|
|
124
|
-
var _this$
|
|
125
|
-
Children = _this$
|
|
126
|
-
styles = _this$
|
|
127
|
-
controlsLength = _this$
|
|
123
|
+
var _this$asProps2 = this.asProps,
|
|
124
|
+
Children = _this$asProps2.Children,
|
|
125
|
+
styles = _this$asProps2.styles,
|
|
126
|
+
controlsLength = _this$asProps2.controlsLength;
|
|
128
127
|
var focused = this.state.focused;
|
|
129
128
|
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SInput, _ref4.cn("SInput", _objectSpread({}, _assignProps({
|
|
130
129
|
"focused": focused
|
|
@@ -171,7 +170,7 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
171
170
|
}, {
|
|
172
171
|
key: "render",
|
|
173
172
|
value: function render() {
|
|
174
|
-
var _ref2 = this
|
|
173
|
+
var _ref2 = this.asProps,
|
|
175
174
|
_ref5;
|
|
176
175
|
|
|
177
176
|
var SValue = Box;
|
|
@@ -192,7 +191,7 @@ _defineProperty(Value, "defaultProps", {
|
|
|
192
191
|
_defineProperty(Value, "enhance", [autoFocusEnhance(), neighborLocationEnhance()]);
|
|
193
192
|
|
|
194
193
|
function Addon(props) {
|
|
195
|
-
var _ref3 =
|
|
194
|
+
var _ref3 = arguments[0],
|
|
196
195
|
_ref6;
|
|
197
196
|
|
|
198
197
|
var SAddon = Box;
|
package/lib/es6/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Input.
|
|
1
|
+
{"version":3,"sources":["../../src/Input.jsx"],"names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","neighborLocationEnhance","autoFocusEnhance","Input","focused","createRef","e","preventDefault","inputRef","current","focus","setState","disabled","asProps","onMouseDown","handleMouseDownAddon","size","ref","onFocus","bindHandlerValueFocused","onBlur","SInput","SOutline","Children","styles","controlsLength","state","style","Value","value","target","SValue","defaultValue","Addon","props","SAddon","enhance"],"mappings":"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","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation, { neighborLocationEnhance } from '@semcore/neighbor-location';\nimport autoFocusEnhance from '@semcore/utils/lib/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 static enhance = [neighborLocationEnhance()];\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, controlsLength } = this.asProps;\n const { focused } = this.state;\n\n return sstyled(styles)(\n <SInput render={Box} focused={focused}>\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n <SOutline />\n </SInput>,\n );\n }\n}\n\nclass Value extends Component {\n static defaultProps = {\n defaultValue: '',\n };\n static enhance = [autoFocusEnhance(), neighborLocationEnhance()];\n\n uncontrolledProps() {\n return {\n value: (e) => e.target.value,\n };\n }\n\n render() {\n const SValue = Root;\n\n return sstyled(this.asProps.styles)(<SValue render={Box} tag=\"input\" type=\"text\" />);\n }\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} />);\n}\n\nAddon.enhance = [neighborLocationEnhance()];\n\nexport default createComponent(Input, {\n Addon,\n Value,\n});\n"],"file":"Input.js"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropGetterFn } from '@semcore/core';
|
|
3
|
+
import { IBoxProps } from '@semcore/flex-box';
|
|
4
|
+
import { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';
|
|
5
|
+
import { IWithAutoFocusEnhanceProps } from '@semcore/utils/lib/enhances/autoFocusEnhance';
|
|
6
|
+
|
|
7
|
+
/* utils type */
|
|
8
|
+
type CProps<Props, Ctx = {}, UCProps = {}> = Props & {
|
|
9
|
+
children?: ((props: Props & Ctx, handlers: UCProps) => React.ReactNode) | React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type ReturnEl = React.ReactElement | null;
|
|
12
|
+
/* utils type */
|
|
13
|
+
|
|
14
|
+
export type InputSize = 'm' | 'l';
|
|
15
|
+
|
|
16
|
+
export interface IInputProps extends IBoxProps, INeighborItemProps, INeighborLocationProps {
|
|
17
|
+
/**
|
|
18
|
+
* Sets the input and addons to the disabled state
|
|
19
|
+
* */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Input size
|
|
23
|
+
* @default m
|
|
24
|
+
*/
|
|
25
|
+
size?: InputSize;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the input state
|
|
28
|
+
* @default normal
|
|
29
|
+
*/
|
|
30
|
+
state?: 'normal' | 'invalid' | 'valid';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IInputValueProps
|
|
34
|
+
extends IBoxProps,
|
|
35
|
+
INeighborItemProps,
|
|
36
|
+
IWithAutoFocusEnhanceProps {
|
|
37
|
+
/**
|
|
38
|
+
* Input value
|
|
39
|
+
*/
|
|
40
|
+
value?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Handler for changing the value
|
|
43
|
+
*/
|
|
44
|
+
onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the input to the disabled state
|
|
47
|
+
* */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the input to the read-only state
|
|
51
|
+
* */
|
|
52
|
+
readOnly?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Input size
|
|
55
|
+
* @default m
|
|
56
|
+
*/
|
|
57
|
+
size?: InputSize;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface IInputAddonProps extends IBoxProps, INeighborItemProps {
|
|
61
|
+
/**
|
|
62
|
+
* Adds styles for interactive icons
|
|
63
|
+
*/
|
|
64
|
+
interactive?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Blocks the addon
|
|
67
|
+
* */
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Input size
|
|
71
|
+
* @default m
|
|
72
|
+
*/
|
|
73
|
+
size?: InputSize;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface IInputCtx {
|
|
77
|
+
getValueProps: PropGetterFn;
|
|
78
|
+
getAddonProps: PropGetterFn;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare const Input: (<T>(props: CProps<IInputProps & T, IInputCtx>) => ReturnEl) & {
|
|
82
|
+
Value: <T>(props: IInputValueProps & T) => ReturnEl;
|
|
83
|
+
Addon: <T>(props: CProps<IInputAddonProps & T, IInputProps>) => ReturnEl;
|
|
84
|
+
};
|
|
85
|
+
export default Input;
|
|
@@ -11,12 +11,17 @@ SInput {
|
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
|
|
13
13
|
& input:-webkit-autofill {
|
|
14
|
+
border-radius: var(--rounded-m);
|
|
14
15
|
-webkit-box-shadow: 0 0 0 30px rgb(250, 255, 189) inset;
|
|
15
16
|
|
|
16
17
|
& ~ SOutline {
|
|
17
18
|
background-color: rgb(250, 255, 189);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
& SOutline {
|
|
23
|
+
border-radius: var(--rounded-m);
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
SValue {
|
|
@@ -27,9 +32,8 @@ SValue {
|
|
|
27
32
|
padding: 0;
|
|
28
33
|
border: none;
|
|
29
34
|
box-sizing: border-box;
|
|
30
|
-
color: var(--
|
|
35
|
+
color: var(--gray-800);
|
|
31
36
|
font-size: inherit;
|
|
32
|
-
line-height: 1.1;
|
|
33
37
|
text-overflow: ellipsis;
|
|
34
38
|
font-family: inherit;
|
|
35
39
|
background: transparent;
|
|
@@ -39,11 +43,11 @@ SValue {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
&::placeholder {
|
|
42
|
-
color: var(--
|
|
46
|
+
color: var(--gray-300);
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
&:read-only ~ SOutline {
|
|
46
|
-
background: var(--
|
|
50
|
+
background: var(--gray-50);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
&:disabled {
|
|
@@ -74,16 +78,16 @@ SAddon {
|
|
|
74
78
|
justify-content: center;
|
|
75
79
|
align-items: center;
|
|
76
80
|
flex: 0 0 auto;
|
|
81
|
+
padding: 0 8px;
|
|
77
82
|
height: 100%;
|
|
78
|
-
color: var(--
|
|
83
|
+
color: var(--gray-300);
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
SAddon[interactive] {
|
|
82
|
-
color: var(--stone);
|
|
83
87
|
cursor: pointer;
|
|
84
88
|
|
|
85
89
|
&:hover {
|
|
86
|
-
color:
|
|
90
|
+
color: var(--gray-400);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -93,76 +97,21 @@ SAddon[disabled] {
|
|
|
93
97
|
pointer-events: none;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
SInput[size='s'] {
|
|
97
|
-
font-size: 10px;
|
|
98
|
-
height: 18px;
|
|
99
|
-
|
|
100
|
-
& SOutline {
|
|
101
|
-
border-radius: 2px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
& input:-webkit-autofill {
|
|
105
|
-
border-radius: 1px;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
SValue[size='s'],
|
|
110
|
-
SAddon[size='s'] {
|
|
111
|
-
padding: 0 4px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
100
|
SInput[size='m'] {
|
|
115
|
-
font-size:
|
|
116
|
-
height:
|
|
117
|
-
|
|
118
|
-
& SOutline {
|
|
119
|
-
border-radius: 3px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
& input:-webkit-autofill {
|
|
123
|
-
border-radius: 2px;
|
|
124
|
-
}
|
|
101
|
+
font-size: var(--fs-200);
|
|
102
|
+
height: var(--form-control-m);
|
|
125
103
|
}
|
|
126
104
|
|
|
127
105
|
SValue[size='m'],
|
|
128
|
-
|
|
106
|
+
SValue[size='l'] {
|
|
129
107
|
padding: 0 8px;
|
|
130
108
|
}
|
|
131
109
|
|
|
132
110
|
SInput[size='l'] {
|
|
133
|
-
font-size:
|
|
134
|
-
height:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
border-radius: 4px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
& input:-webkit-autofill {
|
|
141
|
-
border-radius: 3px;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
SValue[size='l'],
|
|
146
|
-
SAddon[size='l'] {
|
|
147
|
-
padding: 0 8px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
SInput[size='xl'] {
|
|
151
|
-
font-size: 16px;
|
|
152
|
-
height: 42px;
|
|
153
|
-
|
|
154
|
-
& SOutline {
|
|
155
|
-
border-radius: 5px;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
& input:-webkit-autofill {
|
|
159
|
-
border-radius: 4px;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
SValue[size='xl'],
|
|
164
|
-
SAddon[size='xl'] {
|
|
165
|
-
padding: 0 12px;
|
|
111
|
+
font-size: var(--fs-300);
|
|
112
|
+
height: var(--form-control-l);
|
|
113
|
+
padding-left: 4px;
|
|
114
|
+
padding-right: 4px;
|
|
166
115
|
}
|
|
167
116
|
|
|
168
117
|
SInput[focused] {
|
|
@@ -171,32 +120,32 @@ SInput[focused] {
|
|
|
171
120
|
|
|
172
121
|
SInput[state='normal'] {
|
|
173
122
|
& SOutline {
|
|
174
|
-
border-color: var(--
|
|
123
|
+
border-color: var(--gray-200);
|
|
175
124
|
}
|
|
176
125
|
|
|
177
126
|
& SValue:focus ~ SOutline {
|
|
178
|
-
border-color: var(--
|
|
179
|
-
box-shadow: var(--
|
|
127
|
+
border-color: var(--blue-400);
|
|
128
|
+
box-shadow: var(--keyboard-focus);
|
|
180
129
|
}
|
|
181
130
|
}
|
|
182
131
|
SInput[state='valid'] {
|
|
183
132
|
& SOutline {
|
|
184
|
-
border-color: var(--green);
|
|
133
|
+
border-color: var(--green-200);
|
|
185
134
|
}
|
|
186
135
|
|
|
187
136
|
& SValue:focus ~ SOutline {
|
|
188
|
-
border-color: var(--green);
|
|
189
|
-
box-shadow:
|
|
137
|
+
border-color: var(--green-400);
|
|
138
|
+
box-shadow: var(--keyboard-focus-valid);
|
|
190
139
|
}
|
|
191
140
|
}
|
|
192
141
|
SInput[state='invalid'] {
|
|
193
142
|
& SOutline {
|
|
194
|
-
border-color: var(--
|
|
143
|
+
border-color: var(--red-200);
|
|
195
144
|
}
|
|
196
145
|
|
|
197
146
|
& SValue:focus ~ SOutline {
|
|
198
|
-
border-color: var(--
|
|
199
|
-
box-shadow:
|
|
147
|
+
border-color: var(--red-400);
|
|
148
|
+
box-shadow: var(--keyboard-focus-invalid);
|
|
200
149
|
}
|
|
201
150
|
}
|
|
202
151
|
|
|
@@ -220,6 +169,14 @@ SInput[neighborLocation='left'] {
|
|
|
220
169
|
}
|
|
221
170
|
}
|
|
222
171
|
|
|
172
|
+
SAddon[neighborLocation='right'] {
|
|
173
|
+
padding-right: 8px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
SAddon[neighborLocation='left'] {
|
|
177
|
+
padding-left: 8px;
|
|
178
|
+
}
|
|
179
|
+
|
|
223
180
|
SValue[neighborLocation='right'] {
|
|
224
181
|
padding-right: 0;
|
|
225
182
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -11,9 +11,13 @@ type CProps<Props, Ctx = {}, UCProps = {}> = Props & {
|
|
|
11
11
|
type ReturnEl = React.ReactElement | null;
|
|
12
12
|
/* utils type */
|
|
13
13
|
|
|
14
|
-
export type InputSize = '
|
|
14
|
+
export type InputSize = 'm' | 'l';
|
|
15
15
|
|
|
16
16
|
export interface IInputProps extends IBoxProps, INeighborItemProps, INeighborLocationProps {
|
|
17
|
+
/**
|
|
18
|
+
* Sets the input and addons to the disabled state
|
|
19
|
+
* */
|
|
20
|
+
disabled?: boolean;
|
|
17
21
|
/**
|
|
18
22
|
* Input size
|
|
19
23
|
* @default m
|
|
@@ -31,14 +35,26 @@ export interface IInputValueProps
|
|
|
31
35
|
INeighborItemProps,
|
|
32
36
|
IWithAutoFocusEnhanceProps {
|
|
33
37
|
/**
|
|
34
|
-
* Input
|
|
35
|
-
* @default m
|
|
38
|
+
* Input value
|
|
36
39
|
*/
|
|
37
|
-
|
|
40
|
+
value?: string;
|
|
38
41
|
/**
|
|
39
42
|
* Handler for changing the value
|
|
40
43
|
*/
|
|
41
44
|
onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the input to the disabled state
|
|
47
|
+
* */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the input to the read-only state
|
|
51
|
+
* */
|
|
52
|
+
readOnly?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Input size
|
|
55
|
+
* @default m
|
|
56
|
+
*/
|
|
57
|
+
size?: InputSize;
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
export interface IInputAddonProps extends IBoxProps, INeighborItemProps {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/input",
|
|
3
3
|
"description": "SEMRush Input Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -28,5 +28,9 @@
|
|
|
28
28
|
"type": "git",
|
|
29
29
|
"url": "https://github.com/semrush/intergalactic.git",
|
|
30
30
|
"directory": "semcore/input"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@semcore/jest-preset-ui": "1.0.0",
|
|
34
|
+
"@semcore/icon": "*"
|
|
31
35
|
}
|
|
32
36
|
}
|
|
@@ -30,18 +30,19 @@ class Input extends Component {
|
|
|
30
30
|
bindHandlerValueFocused = (focused) => () => this.setState({ focused });
|
|
31
31
|
|
|
32
32
|
getAddonProps() {
|
|
33
|
-
const {
|
|
33
|
+
const { disabled } = this.asProps;
|
|
34
34
|
return {
|
|
35
|
-
|
|
35
|
+
disabled,
|
|
36
36
|
onMouseDown: this.handleMouseDownAddon,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
getValueProps() {
|
|
41
|
-
const { size } = this.asProps;
|
|
41
|
+
const { size, disabled } = this.asProps;
|
|
42
42
|
return {
|
|
43
43
|
ref: this.inputRef,
|
|
44
44
|
size,
|
|
45
|
+
disabled,
|
|
45
46
|
onFocus: this.bindHandlerValueFocused(true),
|
|
46
47
|
onBlur: this.bindHandlerValueFocused(false),
|
|
47
48
|
};
|
package/src/index.d.ts
CHANGED
|
@@ -11,9 +11,13 @@ type CProps<Props, Ctx = {}, UCProps = {}> = Props & {
|
|
|
11
11
|
type ReturnEl = React.ReactElement | null;
|
|
12
12
|
/* utils type */
|
|
13
13
|
|
|
14
|
-
export type InputSize = '
|
|
14
|
+
export type InputSize = 'm' | 'l';
|
|
15
15
|
|
|
16
16
|
export interface IInputProps extends IBoxProps, INeighborItemProps, INeighborLocationProps {
|
|
17
|
+
/**
|
|
18
|
+
* Sets the input and addons to the disabled state
|
|
19
|
+
* */
|
|
20
|
+
disabled?: boolean;
|
|
17
21
|
/**
|
|
18
22
|
* Input size
|
|
19
23
|
* @default m
|
|
@@ -31,14 +35,26 @@ export interface IInputValueProps
|
|
|
31
35
|
INeighborItemProps,
|
|
32
36
|
IWithAutoFocusEnhanceProps {
|
|
33
37
|
/**
|
|
34
|
-
* Input
|
|
35
|
-
* @default m
|
|
38
|
+
* Input value
|
|
36
39
|
*/
|
|
37
|
-
|
|
40
|
+
value?: string;
|
|
38
41
|
/**
|
|
39
42
|
* Handler for changing the value
|
|
40
43
|
*/
|
|
41
44
|
onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the input to the disabled state
|
|
47
|
+
* */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the input to the read-only state
|
|
51
|
+
* */
|
|
52
|
+
readOnly?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Input size
|
|
55
|
+
* @default m
|
|
56
|
+
*/
|
|
57
|
+
size?: InputSize;
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
export interface IInputAddonProps extends IBoxProps, INeighborItemProps {
|
|
@@ -11,12 +11,17 @@ SInput {
|
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
|
|
13
13
|
& input:-webkit-autofill {
|
|
14
|
+
border-radius: var(--rounded-m);
|
|
14
15
|
-webkit-box-shadow: 0 0 0 30px rgb(250, 255, 189) inset;
|
|
15
16
|
|
|
16
17
|
& ~ SOutline {
|
|
17
18
|
background-color: rgb(250, 255, 189);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
& SOutline {
|
|
23
|
+
border-radius: var(--rounded-m);
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
SValue {
|
|
@@ -27,9 +32,8 @@ SValue {
|
|
|
27
32
|
padding: 0;
|
|
28
33
|
border: none;
|
|
29
34
|
box-sizing: border-box;
|
|
30
|
-
color: var(--
|
|
35
|
+
color: var(--gray-800);
|
|
31
36
|
font-size: inherit;
|
|
32
|
-
line-height: 1.1;
|
|
33
37
|
text-overflow: ellipsis;
|
|
34
38
|
font-family: inherit;
|
|
35
39
|
background: transparent;
|
|
@@ -39,11 +43,11 @@ SValue {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
&::placeholder {
|
|
42
|
-
color: var(--
|
|
46
|
+
color: var(--gray-300);
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
&:read-only ~ SOutline {
|
|
46
|
-
background: var(--
|
|
50
|
+
background: var(--gray-50);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
&:disabled {
|
|
@@ -74,16 +78,16 @@ SAddon {
|
|
|
74
78
|
justify-content: center;
|
|
75
79
|
align-items: center;
|
|
76
80
|
flex: 0 0 auto;
|
|
81
|
+
padding: 0 8px;
|
|
77
82
|
height: 100%;
|
|
78
|
-
color: var(--
|
|
83
|
+
color: var(--gray-300);
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
SAddon[interactive] {
|
|
82
|
-
color: var(--stone);
|
|
83
87
|
cursor: pointer;
|
|
84
88
|
|
|
85
89
|
&:hover {
|
|
86
|
-
color:
|
|
90
|
+
color: var(--gray-400);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -93,76 +97,21 @@ SAddon[disabled] {
|
|
|
93
97
|
pointer-events: none;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
SInput[size='s'] {
|
|
97
|
-
font-size: 10px;
|
|
98
|
-
height: 18px;
|
|
99
|
-
|
|
100
|
-
& SOutline {
|
|
101
|
-
border-radius: 2px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
& input:-webkit-autofill {
|
|
105
|
-
border-radius: 1px;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
SValue[size='s'],
|
|
110
|
-
SAddon[size='s'] {
|
|
111
|
-
padding: 0 4px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
100
|
SInput[size='m'] {
|
|
115
|
-
font-size:
|
|
116
|
-
height:
|
|
117
|
-
|
|
118
|
-
& SOutline {
|
|
119
|
-
border-radius: 3px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
& input:-webkit-autofill {
|
|
123
|
-
border-radius: 2px;
|
|
124
|
-
}
|
|
101
|
+
font-size: var(--fs-200);
|
|
102
|
+
height: var(--form-control-m);
|
|
125
103
|
}
|
|
126
104
|
|
|
127
105
|
SValue[size='m'],
|
|
128
|
-
|
|
106
|
+
SValue[size='l'] {
|
|
129
107
|
padding: 0 8px;
|
|
130
108
|
}
|
|
131
109
|
|
|
132
110
|
SInput[size='l'] {
|
|
133
|
-
font-size:
|
|
134
|
-
height:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
border-radius: 4px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
& input:-webkit-autofill {
|
|
141
|
-
border-radius: 3px;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
SValue[size='l'],
|
|
146
|
-
SAddon[size='l'] {
|
|
147
|
-
padding: 0 8px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
SInput[size='xl'] {
|
|
151
|
-
font-size: 16px;
|
|
152
|
-
height: 42px;
|
|
153
|
-
|
|
154
|
-
& SOutline {
|
|
155
|
-
border-radius: 5px;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
& input:-webkit-autofill {
|
|
159
|
-
border-radius: 4px;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
SValue[size='xl'],
|
|
164
|
-
SAddon[size='xl'] {
|
|
165
|
-
padding: 0 12px;
|
|
111
|
+
font-size: var(--fs-300);
|
|
112
|
+
height: var(--form-control-l);
|
|
113
|
+
padding-left: 4px;
|
|
114
|
+
padding-right: 4px;
|
|
166
115
|
}
|
|
167
116
|
|
|
168
117
|
SInput[focused] {
|
|
@@ -171,32 +120,32 @@ SInput[focused] {
|
|
|
171
120
|
|
|
172
121
|
SInput[state='normal'] {
|
|
173
122
|
& SOutline {
|
|
174
|
-
border-color: var(--
|
|
123
|
+
border-color: var(--gray-200);
|
|
175
124
|
}
|
|
176
125
|
|
|
177
126
|
& SValue:focus ~ SOutline {
|
|
178
|
-
border-color: var(--
|
|
179
|
-
box-shadow: var(--
|
|
127
|
+
border-color: var(--blue-400);
|
|
128
|
+
box-shadow: var(--keyboard-focus);
|
|
180
129
|
}
|
|
181
130
|
}
|
|
182
131
|
SInput[state='valid'] {
|
|
183
132
|
& SOutline {
|
|
184
|
-
border-color: var(--green);
|
|
133
|
+
border-color: var(--green-200);
|
|
185
134
|
}
|
|
186
135
|
|
|
187
136
|
& SValue:focus ~ SOutline {
|
|
188
|
-
border-color: var(--green);
|
|
189
|
-
box-shadow:
|
|
137
|
+
border-color: var(--green-400);
|
|
138
|
+
box-shadow: var(--keyboard-focus-valid);
|
|
190
139
|
}
|
|
191
140
|
}
|
|
192
141
|
SInput[state='invalid'] {
|
|
193
142
|
& SOutline {
|
|
194
|
-
border-color: var(--
|
|
143
|
+
border-color: var(--red-200);
|
|
195
144
|
}
|
|
196
145
|
|
|
197
146
|
& SValue:focus ~ SOutline {
|
|
198
|
-
border-color: var(--
|
|
199
|
-
box-shadow:
|
|
147
|
+
border-color: var(--red-400);
|
|
148
|
+
box-shadow: var(--keyboard-focus-invalid);
|
|
200
149
|
}
|
|
201
150
|
}
|
|
202
151
|
|
|
@@ -220,6 +169,14 @@ SInput[neighborLocation='left'] {
|
|
|
220
169
|
}
|
|
221
170
|
}
|
|
222
171
|
|
|
172
|
+
SAddon[neighborLocation='right'] {
|
|
173
|
+
padding-right: 8px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
SAddon[neighborLocation='left'] {
|
|
177
|
+
padding-left: 8px;
|
|
178
|
+
}
|
|
179
|
+
|
|
223
180
|
SValue[neighborLocation='right'] {
|
|
224
181
|
padding-right: 0;
|
|
225
182
|
}
|