@semcore/input 4.42.0-prerelease.1 → 4.42.0-prerelease.12
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 +3 -3
- package/lib/esm/Input.mjs +185 -0
- package/lib/esm/index.mjs +4 -0
- package/package.json +11 -6
- package/vite.config.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [4.42.0] - 2025-
|
|
5
|
+
## [4.42.0] - 2025-03-14
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Added
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Build for ESM.
|
|
10
10
|
|
|
11
11
|
## [4.41.1] - 2025-02-05
|
|
12
12
|
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import m from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import L from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import V from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import x from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import w from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import P from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import g from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled as A } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import E, { sstyled as S, assignProps as y, Component as O } from "@semcore/core";
|
|
10
|
+
import o from "react";
|
|
11
|
+
import { InvalidStateBox as C, Box as I } from "@semcore/flex-box";
|
|
12
|
+
import f from "@semcore/neighbor-location";
|
|
13
|
+
import D from "@semcore/utils/lib/enhances/autoFocusEnhance";
|
|
14
|
+
import B from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
15
|
+
var F = (
|
|
16
|
+
/*__reshadow_css_start__*/
|
|
17
|
+
(A.insert(
|
|
18
|
+
/*__inner_css_start__*/
|
|
19
|
+
".___SInput_1kj4x_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_1kj4x_gg_ input:-webkit-autofill{border-radius:var(--intergalactic-control-rounded, 6px);-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_1kj4x_gg_ input:-webkit-autofill~.___SOutline_1kj4x_gg_{background-color:#faffbd}.___SValue_1kj4x_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_1kj4x_gg_:focus{outline:0}.___SValue_1kj4x_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1kj4x_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1kj4x_gg_:not(:disabled):-moz-read-only~.___SOutline_1kj4x_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1kj4x_gg_:not(:disabled):read-only~.___SOutline_1kj4x_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1kj4x_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SInput_1kj4x_gg_.__disabled_1kj4x_gg_ .___SOutline_1kj4x_gg_,.___SValue_1kj4x_gg_:disabled~.___SOutline_1kj4x_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SOutline_1kj4x_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_1kj4x_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_1kj4x_gg_.__interactive_1kj4x_gg_{cursor:pointer}@media (hover:hover){.___SAddon_1kj4x_gg_.__interactive_1kj4x_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SAddon_1kj4x_gg_.__disabled_1kj4x_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SAddon_1kj4x_gg_._size_m_1kj4x_gg_:not(.___SButton_1kj4x_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)}.___SAddon_1kj4x_gg_._size_l_1kj4x_gg_:not(.___SButton_1kj4x_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1kj4x_gg_ .___SAddon_1kj4x_gg_:nth-last-child(2){margin-right:-1px}.___SValue_1kj4x_gg_._size_m_1kj4x_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SValue_1kj4x_gg_._size_l_1kj4x_gg_{padding:0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1kj4x_gg_._size_m_1kj4x_gg_{font-size:var(--intergalactic-fs-200, 14px);height:var(--intergalactic-form-control-m, 28px)}.___SInput_1kj4x_gg_._size_l_1kj4x_gg_{font-size:var(--intergalactic-fs-300, 16px);height:var(--intergalactic-form-control-l, 40px)}.___SInput_1kj4x_gg_.__focused_1kj4x_gg_{z-index:1}.___SInput_1kj4x_gg_._state_normal_1kj4x_gg_ .___SOutline_1kj4x_gg_{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SInput_1kj4x_gg_._state_normal_1kj4x_gg_.__focused_1kj4x_gg_ .___SOutline_1kj4x_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_1kj4x_gg_._state_valid_1kj4x_gg_ .___SOutline_1kj4x_gg_{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInput_1kj4x_gg_._state_valid_1kj4x_gg_.__focused_1kj4x_gg_ .___SOutline_1kj4x_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_1kj4x_gg_._state_invalid_1kj4x_gg_ .___SOutline_1kj4x_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInput_1kj4x_gg_._state_invalid_1kj4x_gg_.__focused_1kj4x_gg_ .___SOutline_1kj4x_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_1kj4x_gg_._neighborLocation_right_1kj4x_gg_ .___SOutline_1kj4x_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_1kj4x_gg_._neighborLocation_both_1kj4x_gg_ .___SOutline_1kj4x_gg_{border-radius:0;border-left:none}.___SInput_1kj4x_gg_._neighborLocation_left_1kj4x_gg_ .___SOutline_1kj4x_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SValue_1kj4x_gg_._neighborLocation_right_1kj4x_gg_{padding-right:0}.___SValue_1kj4x_gg_._neighborLocation_both_1kj4x_gg_{padding-left:0;padding-right:0}.___SValue_1kj4x_gg_._neighborLocation_left_1kj4x_gg_{padding-left:0}",
|
|
20
|
+
"1kj4x_gg_"
|
|
21
|
+
), {
|
|
22
|
+
__SInput: "___SInput_1kj4x_gg_",
|
|
23
|
+
_disabled: "__disabled_1kj4x_gg_",
|
|
24
|
+
__SOutline: "___SOutline_1kj4x_gg_",
|
|
25
|
+
__SValue: "___SValue_1kj4x_gg_",
|
|
26
|
+
__SAddon: "___SAddon_1kj4x_gg_",
|
|
27
|
+
_size_m: "_size_m_1kj4x_gg_",
|
|
28
|
+
__SButton: "___SButton_1kj4x_gg_",
|
|
29
|
+
_size_l: "_size_l_1kj4x_gg_",
|
|
30
|
+
_focused: "__focused_1kj4x_gg_",
|
|
31
|
+
_neighborLocation_right: "_neighborLocation_right_1kj4x_gg_",
|
|
32
|
+
_neighborLocation_both: "_neighborLocation_both_1kj4x_gg_",
|
|
33
|
+
_neighborLocation_left: "_neighborLocation_left_1kj4x_gg_",
|
|
34
|
+
_interactive: "__interactive_1kj4x_gg_",
|
|
35
|
+
_state_normal: "_state_normal_1kj4x_gg_",
|
|
36
|
+
_state_valid: "_state_valid_1kj4x_gg_",
|
|
37
|
+
_state_invalid: "_state_invalid_1kj4x_gg_"
|
|
38
|
+
})
|
|
39
|
+
), k = /* @__PURE__ */ function(l) {
|
|
40
|
+
w(n, l);
|
|
41
|
+
var c = P(n);
|
|
42
|
+
function n() {
|
|
43
|
+
var e;
|
|
44
|
+
L(this, n);
|
|
45
|
+
for (var _ = arguments.length, i = new Array(_), a = 0; a < _; a++)
|
|
46
|
+
i[a] = arguments[a];
|
|
47
|
+
return e = c.call.apply(c, [this].concat(i)), g(x(e), "state", {
|
|
48
|
+
focused: !1
|
|
49
|
+
}), g(x(e), "inputRef", /* @__PURE__ */ o.createRef()), g(x(e), "handleMouseDownAddon", function(r) {
|
|
50
|
+
var t;
|
|
51
|
+
r.preventDefault(), (t = e.inputRef.current) === null || t === void 0 || t.focus();
|
|
52
|
+
}), g(x(e), "handleKeyDown", function(r) {
|
|
53
|
+
r.key === "Enter" && setTimeout(function() {
|
|
54
|
+
if (document.activeElement === document.body) {
|
|
55
|
+
var t;
|
|
56
|
+
(t = e.inputRef.current) === null || t === void 0 || t.focus();
|
|
57
|
+
}
|
|
58
|
+
}, 10);
|
|
59
|
+
}), g(x(e), "bindHandleValueFocused", function(r) {
|
|
60
|
+
return function() {
|
|
61
|
+
return e.setState({
|
|
62
|
+
focused: r
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}), e;
|
|
66
|
+
}
|
|
67
|
+
return V(n, [{
|
|
68
|
+
key: "getAddonProps",
|
|
69
|
+
value: function() {
|
|
70
|
+
var _ = this.asProps, i = _.disabled, a = _.size;
|
|
71
|
+
return {
|
|
72
|
+
disabled: i,
|
|
73
|
+
onMouseDown: this.handleMouseDownAddon,
|
|
74
|
+
size: a
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "getValueProps",
|
|
79
|
+
value: function() {
|
|
80
|
+
var _ = this.asProps, i = _.size, a = _.disabled, r = _.state, t = _.role, u = _.placeholder, p = _["aria-haspopup"], d = _["aria-controls"], b = _["aria-expanded"], h = _["aria-autocomplete"], v = _["aria-owns"], j = _["aria-activedescendant"];
|
|
81
|
+
return {
|
|
82
|
+
ref: this.inputRef,
|
|
83
|
+
size: i,
|
|
84
|
+
disabled: a,
|
|
85
|
+
state: r,
|
|
86
|
+
onFocus: this.bindHandleValueFocused(!0),
|
|
87
|
+
onBlur: this.bindHandleValueFocused(!1),
|
|
88
|
+
role: t,
|
|
89
|
+
placeholder: u,
|
|
90
|
+
"aria-haspopup": p,
|
|
91
|
+
"aria-controls": d,
|
|
92
|
+
"aria-expanded": b,
|
|
93
|
+
"aria-autocomplete": h,
|
|
94
|
+
"aria-owns": v,
|
|
95
|
+
"aria-activedescendant": j
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "componentDidUpdate",
|
|
100
|
+
value: function(_) {
|
|
101
|
+
_.disabled !== this.asProps.disabled && this.asProps.disabled && this.setState({
|
|
102
|
+
focused: !1
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "render",
|
|
107
|
+
value: function() {
|
|
108
|
+
var _ = this.asProps, i = this, a = I, r = "div", t = this.asProps, u = t.Children, p = t.styles, d = t.neighborLocation, b = t.controlsLength, h = t.state, v = this.state.focused;
|
|
109
|
+
return /* @__PURE__ */ o.createElement(f.Detect, {
|
|
110
|
+
neighborLocation: d
|
|
111
|
+
}, function(j) {
|
|
112
|
+
var s;
|
|
113
|
+
return s = S(p), /* @__PURE__ */ o.createElement(a, s.cn("SInput", m({}, y({
|
|
114
|
+
focused: v,
|
|
115
|
+
onKeyDown: i.handleKeyDown,
|
|
116
|
+
neighborLocation: j,
|
|
117
|
+
__excludeProps: ["role", "aria-haspopup", "aria-controls", "aria-expanded", "placeholder", "aria-autocomplete", "aria-owns", "aria-activedescendant", "tabIndex"]
|
|
118
|
+
}, _))), /* @__PURE__ */ o.createElement(f, s.cn("NeighborLocation", {
|
|
119
|
+
controlsLength: b
|
|
120
|
+
}), /* @__PURE__ */ o.createElement(u, s.cn("Children", {}))), /* @__PURE__ */ o.createElement(r, s.cn("SOutline", {}), h === "invalid" && /* @__PURE__ */ o.createElement(C, s.cn("InvalidStateBox", {}))));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}]), n;
|
|
124
|
+
}(O);
|
|
125
|
+
g(k, "displayName", "Input");
|
|
126
|
+
g(k, "defaultProps", {
|
|
127
|
+
size: "m",
|
|
128
|
+
state: "normal"
|
|
129
|
+
});
|
|
130
|
+
g(k, "style", F);
|
|
131
|
+
var z = /* @__PURE__ */ function(l) {
|
|
132
|
+
w(n, l);
|
|
133
|
+
var c = P(n);
|
|
134
|
+
function n() {
|
|
135
|
+
return L(this, n), c.apply(this, arguments);
|
|
136
|
+
}
|
|
137
|
+
return V(n, [{
|
|
138
|
+
key: "uncontrolledProps",
|
|
139
|
+
value: function() {
|
|
140
|
+
return {
|
|
141
|
+
value: function(i) {
|
|
142
|
+
return i.target.value;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "render",
|
|
148
|
+
value: function() {
|
|
149
|
+
var _ = this.asProps, i = I, a = this.asProps, r = a.styles, t = a.neighborLocation, u = a.state;
|
|
150
|
+
return /* @__PURE__ */ o.createElement(f.Detect, {
|
|
151
|
+
neighborLocation: t
|
|
152
|
+
}, function(p) {
|
|
153
|
+
var d;
|
|
154
|
+
return d = S(r), /* @__PURE__ */ o.createElement(i, d.cn("SValue", m({}, y({
|
|
155
|
+
neighborLocation: p,
|
|
156
|
+
tag: "input",
|
|
157
|
+
type: "text",
|
|
158
|
+
"aria-invalid": u === "invalid"
|
|
159
|
+
}, _))));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}]), n;
|
|
163
|
+
}(O);
|
|
164
|
+
g(z, "defaultProps", {
|
|
165
|
+
defaultValue: ""
|
|
166
|
+
});
|
|
167
|
+
g(z, "enhance", [B(), D()]);
|
|
168
|
+
function R(l) {
|
|
169
|
+
var c = arguments[0], n = I, e = l.Children, _ = l.styles, i = l.neighborLocation;
|
|
170
|
+
return /* @__PURE__ */ o.createElement(f.Detect, {
|
|
171
|
+
neighborLocation: i
|
|
172
|
+
}, function(a) {
|
|
173
|
+
var r;
|
|
174
|
+
return r = S(_), /* @__PURE__ */ o.createElement(n, r.cn("SAddon", m({}, y({
|
|
175
|
+
neighborLocation: a
|
|
176
|
+
}, c))), /* @__PURE__ */ o.createElement(e, r.cn("Children", {})));
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const Z = E(k, {
|
|
180
|
+
Addon: R,
|
|
181
|
+
Value: z
|
|
182
|
+
});
|
|
183
|
+
export {
|
|
184
|
+
Z as default
|
|
185
|
+
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/input",
|
|
3
3
|
"description": "Semrush Input Component",
|
|
4
|
-
"version": "4.42.0-prerelease.
|
|
4
|
+
"version": "4.42.0-prerelease.12",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"exports": {
|
|
12
|
+
"require": "./lib/cjs/index.js",
|
|
13
|
+
"import": "./lib/esm/index.mjs",
|
|
14
|
+
"types": "./lib/types/index.d.ts"
|
|
15
|
+
},
|
|
11
16
|
"dependencies": {
|
|
12
|
-
"@semcore/utils": "4.
|
|
13
|
-
"@semcore/neighbor-location": "4.
|
|
14
|
-
"@semcore/flex-box": "5.41.0-prerelease.
|
|
17
|
+
"@semcore/utils": "4.48.0-prerelease.12",
|
|
18
|
+
"@semcore/neighbor-location": "4.40.0-prerelease.12",
|
|
19
|
+
"@semcore/flex-box": "5.41.0-prerelease.12"
|
|
15
20
|
},
|
|
16
21
|
"peerDependencies": {
|
|
17
|
-
"@semcore/core": "^2.39.0-prerelease.
|
|
22
|
+
"@semcore/core": "^2.39.0-prerelease.12",
|
|
18
23
|
"react": "16.8 - 18",
|
|
19
24
|
"react-dom": "16.8 - 18"
|
|
20
25
|
},
|
|
@@ -29,6 +34,6 @@
|
|
|
29
34
|
"@semcore/icon": "*"
|
|
30
35
|
},
|
|
31
36
|
"scripts": {
|
|
32
|
-
"build": "pnpm semcore-builder --source=js"
|
|
37
|
+
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|
|
33
38
|
}
|
|
34
39
|
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig, mergeConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
import viteConfig from '../../commonVite.config';
|
|
4
|
+
|
|
5
|
+
export default mergeConfig(
|
|
6
|
+
viteConfig,
|
|
7
|
+
defineConfig({
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: './src/index.js',
|
|
11
|
+
},
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: ['react', 'react-dom', 'react/jsx-runtime', /@babel\/runtime\/*/, /@semcore\/*/],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
);
|