@semcore/inline-input 4.46.0-prerelease.11 → 4.46.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/InlineInput.mjs +305 -0
- package/lib/esm/index.mjs +4 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/translations/de.json.mjs +9 -0
- package/lib/esm/translations/en.json.mjs +9 -0
- package/lib/esm/translations/es.json.mjs +9 -0
- package/lib/esm/translations/fr.json.mjs +9 -0
- package/lib/esm/translations/it.json.mjs +9 -0
- package/lib/esm/translations/ja.json.mjs +9 -0
- package/lib/esm/translations/ko.json.mjs +9 -0
- package/lib/esm/translations/nl.json.mjs +9 -0
- package/lib/esm/translations/pl.json.mjs +9 -0
- package/lib/esm/translations/pt.json.mjs +9 -0
- package/lib/esm/translations/sv.json.mjs +9 -0
- package/lib/esm/translations/tr.json.mjs +9 -0
- package/lib/esm/translations/vi.json.mjs +9 -0
- package/lib/esm/translations/zh.json.mjs +9 -0
- package/package.json +17 -12
- 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.46.0] - 2025-03-
|
|
5
|
+
## [4.46.0] - 2025-03-14
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Added
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Build for ESM.
|
|
10
10
|
|
|
11
11
|
## [4.45.6] - 2025-02-05
|
|
12
12
|
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import b from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import k from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import E from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import f from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import $ from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import V from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import s from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled as M } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import K, { sstyled as m, assignProps as C, Component as D } from "@semcore/core";
|
|
10
|
+
import _ from "react";
|
|
11
|
+
import { Box as I, InvalidStateBox as N } from "@semcore/flex-box";
|
|
12
|
+
import U from "@semcore/utils/lib/enhances/autoFocusEnhance";
|
|
13
|
+
import z from "@semcore/icon/Check/m";
|
|
14
|
+
import R from "@semcore/icon/Close/m";
|
|
15
|
+
import F from "@semcore/spin";
|
|
16
|
+
import { ButtonLink as B } from "@semcore/button";
|
|
17
|
+
import { localizedMessages as A } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
18
|
+
import T from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
19
|
+
import H from "@semcore/input-number";
|
|
20
|
+
import { hasParent as L } from "@semcore/utils/lib/hasParent";
|
|
21
|
+
var j = (
|
|
22
|
+
/*__reshadow_css_start__*/
|
|
23
|
+
(M.insert(
|
|
24
|
+
/*__inner_css_start__*/
|
|
25
|
+
".___SInlineInput_1u1aw_gg_{display:inline-flex;width:100%;height:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SInlineInput_1u1aw_gg_ .___SConfirmIcon_1u1aw_gg_{color:var(--intergalactic-icon-secondary-success, #00c192);cursor:pointer}@media (hover:hover){.___SInlineInput_1u1aw_gg_ .___SConfirmIcon_1u1aw_gg_:hover{color:var(--intergalactic-icon-secondary-success-hover-active, #049B75)}}.___SInlineInput_1u1aw_gg_ .___SCancelIcon_1u1aw_gg_{color:var(--intergalactic-icon-secondary-neutral, #a9abb6);cursor:pointer}@media (hover:hover){.___SInlineInput_1u1aw_gg_ .___SCancelIcon_1u1aw_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SInlineInput_1u1aw_gg_.__disabled_1u1aw_gg_{cursor:default;pointer-events:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SValue_1u1aw_gg_{min-width:0;width:100%;height:100%;padding:0 var(--intergalactic-spacing-1x, 4px);border:0;box-sizing:border-box;color:var(--intergalactic-text-primary, #191b23);font-size:inherit;line-height:1.2;text-overflow:ellipsis;font-family:inherit;background:0 0;min-height:1em}.___SValue_1u1aw_gg_:focus{outline:0}.___SValue_1u1aw_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1u1aw_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1u1aw_gg_.__disabled_1u1aw_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1u1aw_gg_::-webkit-inner-spin-button,.___SValue_1u1aw_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_1u1aw_gg_._type_number_1u1aw_gg_{-moz-appearance:textfield}.___SUnderline_1u1aw_gg_{display:flex;flex-direction:row;align-items:center;flex-grow:1;width:100%;height:100%;min-height:1em;border:1px solid transparent;border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SAddon_1u1aw_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;height:100%;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);padding:0 var(--intergalactic-spacing-1x, 4px)}.___SAddon_1u1aw_gg_.__disabled_1u1aw_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SInlineInput_1u1aw_gg_.__focused_1u1aw_gg_{z-index:1}.___SInlineInput_1u1aw_gg_.__focused_1u1aw_gg_ .___SUnderline_1u1aw_gg_{border-bottom-color:var(--intergalactic-border-info-active, #006dca);box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SInlineInput_1u1aw_gg_._state_valid_1u1aw_gg_ .___SUnderline_1u1aw_gg_{border-bottom-color:var(--intergalactic-border-success-active, #007c65)}.___SInlineInput_1u1aw_gg_._state_valid_1u1aw_gg_.__focused_1u1aw_gg_ .___SUnderline_1u1aw_gg_{border-bottom-color:var(--intergalactic-border-success-active, #007c65);box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInlineInput_1u1aw_gg_._state_invalid_1u1aw_gg_ .___SUnderline_1u1aw_gg_{border-bottom-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInlineInput_1u1aw_gg_._state_invalid_1u1aw_gg_.__focused_1u1aw_gg_ .___SUnderline_1u1aw_gg_{border-bottom-color:var(--intergalactic-border-critical-active, #d1002f);box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SValue_1u1aw_gg_:focus~.___SControls_1u1aw_gg_{display:flex}.___SInvalidPattern_1u1aw_gg_{margin-left:-1px;margin-top:-1px;border-radius:0;height:calc(100% - 3px)}",
|
|
26
|
+
"1u1aw_gg_"
|
|
27
|
+
), {
|
|
28
|
+
__SInlineInput: "___SInlineInput_1u1aw_gg_",
|
|
29
|
+
_disabled: "__disabled_1u1aw_gg_",
|
|
30
|
+
__SUnderline: "___SUnderline_1u1aw_gg_",
|
|
31
|
+
__SAddon: "___SAddon_1u1aw_gg_",
|
|
32
|
+
_focused: "__focused_1u1aw_gg_",
|
|
33
|
+
_state_valid: "_state_valid_1u1aw_gg_",
|
|
34
|
+
_state_invalid: "_state_invalid_1u1aw_gg_",
|
|
35
|
+
__SValue: "___SValue_1u1aw_gg_",
|
|
36
|
+
__SControls: "___SControls_1u1aw_gg_",
|
|
37
|
+
__SInvalidPattern: "___SInvalidPattern_1u1aw_gg_",
|
|
38
|
+
__SConfirmIcon: "___SConfirmIcon_1u1aw_gg_",
|
|
39
|
+
__SCancelIcon: "___SCancelIcon_1u1aw_gg_",
|
|
40
|
+
_type_number: "_type_number_1u1aw_gg_"
|
|
41
|
+
})
|
|
42
|
+
), O = function(n) {
|
|
43
|
+
var l = n.x, e = n.y, t = n.rect;
|
|
44
|
+
return l >= t.x && l <= t.x + t.width && e >= t.y && e <= t.y + t.height;
|
|
45
|
+
}, x = /* @__PURE__ */ function(p) {
|
|
46
|
+
$(l, p);
|
|
47
|
+
var n = V(l);
|
|
48
|
+
function l() {
|
|
49
|
+
var e;
|
|
50
|
+
k(this, l);
|
|
51
|
+
for (var t = arguments.length, c = new Array(t), g = 0; g < t; g++)
|
|
52
|
+
c[g] = arguments[g];
|
|
53
|
+
return e = n.call.apply(n, [this].concat(c)), s(f(e), "state", {
|
|
54
|
+
focused: !1
|
|
55
|
+
}), s(f(e), "rootRef", /* @__PURE__ */ _.createRef()), s(f(e), "inputRef", /* @__PURE__ */ _.createRef()), s(f(e), "inputHandlersRef", /* @__PURE__ */ _.createRef()), s(f(e), "initValue", ""), s(f(e), "lastMouseDownPosition", null), s(f(e), "lastHandledKeyboardEvent", -1), s(f(e), "handleDocumentMouseDown", function(r) {
|
|
56
|
+
e.lastMouseDownPosition = {
|
|
57
|
+
x: r.clientX,
|
|
58
|
+
y: r.clientY
|
|
59
|
+
}, e.lastHandledKeyboardEvent = -1;
|
|
60
|
+
}), s(f(e), "handleDocumentKeyDown", function() {
|
|
61
|
+
e.lastMouseDownPosition = null;
|
|
62
|
+
}), s(f(e), "increment", function(r) {
|
|
63
|
+
var i, a, o, d, u;
|
|
64
|
+
((i = e.inputRef.current) === null || i === void 0 ? void 0 : i.value) === "" && (e.inputRef.current.value = e.inputRef.current.min || "0"), (a = e.inputRef.current) === null || a === void 0 || (o = a.stepUp) === null || o === void 0 || o.call(a, r), (d = e.inputHandlersRef.current) === null || d === void 0 || d.value((u = e.inputRef.current) === null || u === void 0 ? void 0 : u.value, r);
|
|
65
|
+
}), s(f(e), "decrement", function(r) {
|
|
66
|
+
var i, a, o, d, u;
|
|
67
|
+
((i = e.inputRef.current) === null || i === void 0 ? void 0 : i.value) === "" && (e.inputRef.current.value = e.inputRef.current.max || "0"), (a = e.inputRef.current) === null || a === void 0 || (o = a.stepDown) === null || o === void 0 || o.call(a, r), (d = e.inputHandlersRef.current) === null || d === void 0 || d.value((u = e.inputRef.current) === null || u === void 0 ? void 0 : u.value, r);
|
|
68
|
+
}), s(f(e), "bindHandlerValueFocused", function(r) {
|
|
69
|
+
return function() {
|
|
70
|
+
e.setState({
|
|
71
|
+
focused: r
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}), s(f(e), "handleMouseDownAddon", function(r) {
|
|
75
|
+
var i;
|
|
76
|
+
r.preventDefault(), (i = e.inputRef.current) === null || i === void 0 || i.focus();
|
|
77
|
+
}), s(f(e), "handleConfirm", function(r, i) {
|
|
78
|
+
var a, o;
|
|
79
|
+
(a = (o = e.asProps).onConfirm) === null || a === void 0 || a.call(o, r, i);
|
|
80
|
+
}), s(f(e), "handleCancel", function(r, i) {
|
|
81
|
+
var a, o;
|
|
82
|
+
(a = (o = e.asProps).onCancel) === null || a === void 0 || a.call(o, r, i);
|
|
83
|
+
}), s(f(e), "handleBlur", function(r) {
|
|
84
|
+
var i, a, o = e.asProps, d = o.onConfirm, u = o.onCancel, h = o.onBlurBehavior;
|
|
85
|
+
if (h && !(Date.now() - e.lastHandledKeyboardEvent < 250) && !L(r.relatedTarget, e.rootRef.current)) {
|
|
86
|
+
if (e.lastMouseDownPosition && e.rootRef.current) {
|
|
87
|
+
var S = e.lastMouseDownPosition, v = S.x, w = S.y, y = e.rootRef.current.getBoundingClientRect();
|
|
88
|
+
if (O({
|
|
89
|
+
x: v,
|
|
90
|
+
y: w,
|
|
91
|
+
rect: y
|
|
92
|
+
}))
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
h === "confirm" && (d == null || d((i = (a = e.inputRef.current) === null || a === void 0 ? void 0 : a.value) !== null && i !== void 0 ? i : "", r)), h === "cancel" && (u == null || u(e.initValue, r));
|
|
96
|
+
}
|
|
97
|
+
}), s(f(e), "handleKeyDown", function(r) {
|
|
98
|
+
var i = e.asProps, a = i.onConfirm, o = i.onCancel;
|
|
99
|
+
if (r.key === "Enter") {
|
|
100
|
+
var d, u;
|
|
101
|
+
a == null || a((d = (u = e.inputRef.current) === null || u === void 0 ? void 0 : u.value) !== null && d !== void 0 ? d : "", r), e.lastHandledKeyboardEvent = Date.now();
|
|
102
|
+
}
|
|
103
|
+
r.key === "Escape" && (o == null || o(e.initValue, r), e.lastHandledKeyboardEvent = Date.now());
|
|
104
|
+
}), e;
|
|
105
|
+
}
|
|
106
|
+
return E(l, [{
|
|
107
|
+
key: "componentDidMount",
|
|
108
|
+
value: function() {
|
|
109
|
+
this.asProps.onBlurBehavior && (document.body.addEventListener("mousedown", this.handleDocumentMouseDown), document.body.addEventListener("keydown", this.handleDocumentKeyDown));
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "componentWillUnmount",
|
|
113
|
+
value: function() {
|
|
114
|
+
this.asProps.onBlurBehavior && (document.body.removeEventListener("mousedown", this.handleDocumentMouseDown), document.body.removeEventListener("keydown", this.handleDocumentKeyDown));
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "getAddonProps",
|
|
118
|
+
value: function() {
|
|
119
|
+
return {
|
|
120
|
+
onMouseDown: this.handleMouseDownAddon
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "getConfirmControlProps",
|
|
125
|
+
value: function() {
|
|
126
|
+
var t, c = this.asProps, g = c.loading, r = c.getI18nText;
|
|
127
|
+
return {
|
|
128
|
+
value: (t = this.inputRef.current) === null || t === void 0 ? void 0 : t.value,
|
|
129
|
+
loading: g,
|
|
130
|
+
onConfirm: this.handleConfirm,
|
|
131
|
+
getI18nText: r
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "getCancelControlProps",
|
|
136
|
+
value: function() {
|
|
137
|
+
var t = this.asProps, c = t.loading, g = t.disabled, r = t.getI18nText;
|
|
138
|
+
return {
|
|
139
|
+
value: this.initValue,
|
|
140
|
+
// because double disabled(root disabled and addon disabled)
|
|
141
|
+
disabled: c && !g,
|
|
142
|
+
onCancel: this.handleCancel,
|
|
143
|
+
getI18nText: r
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "getValueProps",
|
|
148
|
+
value: function() {
|
|
149
|
+
var t = this.asProps.state;
|
|
150
|
+
return {
|
|
151
|
+
ref: this.inputRef,
|
|
152
|
+
state: t,
|
|
153
|
+
onKeyDown: this.handleKeyDown,
|
|
154
|
+
onFocus: this.bindHandlerValueFocused(!0),
|
|
155
|
+
onBlur: this.bindHandlerValueFocused(!1)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "getNumberValueProps",
|
|
160
|
+
value: function() {
|
|
161
|
+
var t = new Intl.NumberFormat(this.asProps.locale, {
|
|
162
|
+
style: "decimal"
|
|
163
|
+
});
|
|
164
|
+
return {
|
|
165
|
+
numberFormatter: t,
|
|
166
|
+
inputRef: this.inputRef,
|
|
167
|
+
inputHandlerRefs: this.inputHandlersRef,
|
|
168
|
+
increment: this.increment,
|
|
169
|
+
decrement: this.decrement,
|
|
170
|
+
onFocus: this.bindHandlerValueFocused(!0),
|
|
171
|
+
onBlur: this.bindHandlerValueFocused(!1)
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "getNumberControlsProps",
|
|
176
|
+
value: function() {
|
|
177
|
+
var t = this.asProps.getI18nText;
|
|
178
|
+
return {
|
|
179
|
+
increment: this.increment,
|
|
180
|
+
decrement: this.decrement,
|
|
181
|
+
getI18nText: t
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "render",
|
|
186
|
+
value: function() {
|
|
187
|
+
var t = this.asProps, c, g = I, r = "div", i = N, a = this.asProps, o = a.Children, d = a.styles, u = a.state, h = this.state.focused;
|
|
188
|
+
return c = m(d), /* @__PURE__ */ _.createElement(g, c.cn("SInlineInput", b({}, C({
|
|
189
|
+
ref: this.rootRef,
|
|
190
|
+
focused: h,
|
|
191
|
+
onBlur: this.handleBlur
|
|
192
|
+
}, t))), /* @__PURE__ */ _.createElement(r, c.cn("SUnderline", {}), u === "invalid" && /* @__PURE__ */ _.createElement(i, c.cn("SInvalidPattern", {})), /* @__PURE__ */ _.createElement(o, c.cn("Children", {}))));
|
|
193
|
+
}
|
|
194
|
+
}]), l;
|
|
195
|
+
}(D);
|
|
196
|
+
s(x, "displayName", "InlineInput");
|
|
197
|
+
s(x, "enhance", [T(A)]);
|
|
198
|
+
s(x, "defaultProps", {
|
|
199
|
+
state: "normal",
|
|
200
|
+
onBlurBehavior: "confirm",
|
|
201
|
+
i18n: A,
|
|
202
|
+
locale: "en"
|
|
203
|
+
});
|
|
204
|
+
s(x, "style", j);
|
|
205
|
+
var P = /* @__PURE__ */ function(p) {
|
|
206
|
+
$(l, p);
|
|
207
|
+
var n = V(l);
|
|
208
|
+
function l() {
|
|
209
|
+
return k(this, l), n.apply(this, arguments);
|
|
210
|
+
}
|
|
211
|
+
return E(l, [{
|
|
212
|
+
key: "uncontrolledProps",
|
|
213
|
+
value: function() {
|
|
214
|
+
return {
|
|
215
|
+
value: function(c) {
|
|
216
|
+
return c.target.value;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}, {
|
|
221
|
+
key: "render",
|
|
222
|
+
value: function() {
|
|
223
|
+
var t = this.asProps, c, g = I;
|
|
224
|
+
return c = m(this.asProps.styles), /* @__PURE__ */ _.createElement(g, c.cn("SValue", b({}, C({
|
|
225
|
+
tag: "input",
|
|
226
|
+
type: "text"
|
|
227
|
+
}, t))));
|
|
228
|
+
}
|
|
229
|
+
}]), l;
|
|
230
|
+
}(D);
|
|
231
|
+
s(P, "defaultProps", {
|
|
232
|
+
defaultValue: ""
|
|
233
|
+
});
|
|
234
|
+
s(P, "enhance", [U()]);
|
|
235
|
+
s(P, "hoistProps", ["disabled"]);
|
|
236
|
+
var W = function(n) {
|
|
237
|
+
var l = arguments[0], e, t = I;
|
|
238
|
+
return e = m(n.styles), /* @__PURE__ */ _.createElement(t, e.cn("SAddon", b({}, C({}, l))));
|
|
239
|
+
}, X = function(n) {
|
|
240
|
+
var l = arguments[0], e, t, c, g = I, r = n.Children, i = n.children, a = (t = n.title) !== null && t !== void 0 ? t : n.getI18nText("confirm"), o = _.useCallback(function(v) {
|
|
241
|
+
var w, y;
|
|
242
|
+
(w = n.onConfirm) === null || w === void 0 || w.call(n, (y = n.value) !== null && y !== void 0 ? y : "", v);
|
|
243
|
+
}, [n.onConfirm, n.value]), d = _.useCallback(function(v) {
|
|
244
|
+
(v.key === "Enter" || v.key === " ") && (v.preventDefault(), v.stopPropagation(), o(v));
|
|
245
|
+
}, [o]);
|
|
246
|
+
if (n.loading) {
|
|
247
|
+
var u;
|
|
248
|
+
return u = m(n.styles), /* @__PURE__ */ _.createElement(g, u.cn("SAddon", b({}, C({}, l))), i ? /* @__PURE__ */ _.createElement(r, u.cn("Children", {})) : /* @__PURE__ */ _.createElement(F, u.cn("Spin", {
|
|
249
|
+
size: "xs"
|
|
250
|
+
})));
|
|
251
|
+
}
|
|
252
|
+
var h = m(n.styles), S = h.cn("SConfirmIcon", {});
|
|
253
|
+
return e = m(n.styles), /* @__PURE__ */ _.createElement(g, e.cn("SAddon", b({}, C({
|
|
254
|
+
onKeyDown: d
|
|
255
|
+
}, l))), i ? /* @__PURE__ */ _.createElement(r, e.cn("Children", {})) : /* @__PURE__ */ _.createElement(B, e.cn("ButtonLink", {
|
|
256
|
+
addonLeft: (c = n.icon) !== null && c !== void 0 ? c : z,
|
|
257
|
+
use: "secondary",
|
|
258
|
+
onClick: o,
|
|
259
|
+
className: S.className,
|
|
260
|
+
style: S.style,
|
|
261
|
+
"aria-label": a
|
|
262
|
+
})));
|
|
263
|
+
}, Y = function(n) {
|
|
264
|
+
var l = arguments[0], e, t, c, g = I, r = n.Children, i = n.children, a = (t = n.title) !== null && t !== void 0 ? t : n.getI18nText("discard"), o = _.useCallback(function(v) {
|
|
265
|
+
var w, y;
|
|
266
|
+
(w = n.onCancel) === null || w === void 0 || w.call(n, (y = n.value) !== null && y !== void 0 ? y : "", v);
|
|
267
|
+
}, [n.onCancel, n.value]), d = _.useCallback(function(v) {
|
|
268
|
+
(v.key === "Enter" || v.key === " ") && (v.preventDefault(), v.stopPropagation(), o(v));
|
|
269
|
+
}, [o]);
|
|
270
|
+
if (n.disabled) {
|
|
271
|
+
var u;
|
|
272
|
+
return u = m(n.styles), /* @__PURE__ */ _.createElement(g, u.cn("SAddon", b({}, C({}, l))), i ? /* @__PURE__ */ _.createElement(r, u.cn("Children", {})) : /* @__PURE__ */ _.createElement(R, u.cn("CloseM", {})));
|
|
273
|
+
}
|
|
274
|
+
var h = m(n.styles), S = h.cn("SCancelIcon", {});
|
|
275
|
+
return e = m(n.styles), /* @__PURE__ */ _.createElement(g, e.cn("SAddon", b({}, C({
|
|
276
|
+
onKeyDown: d
|
|
277
|
+
}, l))), i ? /* @__PURE__ */ _.createElement(r, e.cn("Children", {})) : /* @__PURE__ */ _.createElement(B, e.cn("ButtonLink", {
|
|
278
|
+
use: "secondary",
|
|
279
|
+
addonLeft: (c = n.icon) !== null && c !== void 0 ? c : R,
|
|
280
|
+
onClick: o,
|
|
281
|
+
className: S.className,
|
|
282
|
+
style: S.style,
|
|
283
|
+
"aria-label": a
|
|
284
|
+
})));
|
|
285
|
+
}, q = function(n) {
|
|
286
|
+
var l = arguments[0], e, t = H.Value;
|
|
287
|
+
return e = m(n.styles), /* @__PURE__ */ _.createElement(t, e.cn("SValue", b({}, C({}, l))));
|
|
288
|
+
};
|
|
289
|
+
function G(p) {
|
|
290
|
+
var n = arguments[0], l, e = H.Controls;
|
|
291
|
+
return l = m(p.styles), /* @__PURE__ */ _.createElement(e, l.cn("SControls", b({}, C({
|
|
292
|
+
tag: J.Addon
|
|
293
|
+
}, n))));
|
|
294
|
+
}
|
|
295
|
+
var J = K(x, {
|
|
296
|
+
Addon: W,
|
|
297
|
+
Value: P,
|
|
298
|
+
ConfirmControl: X,
|
|
299
|
+
CancelControl: Y,
|
|
300
|
+
NumberValue: q,
|
|
301
|
+
NumberControls: G
|
|
302
|
+
});
|
|
303
|
+
export {
|
|
304
|
+
J as default
|
|
305
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import r from "./de.json.mjs";
|
|
2
|
+
import o from "./en.json.mjs";
|
|
3
|
+
import m from "./es.json.mjs";
|
|
4
|
+
import t from "./fr.json.mjs";
|
|
5
|
+
import i from "./it.json.mjs";
|
|
6
|
+
import p from "./ja.json.mjs";
|
|
7
|
+
import f from "./ko.json.mjs";
|
|
8
|
+
import e from "./nl.json.mjs";
|
|
9
|
+
import s from "./pt.json.mjs";
|
|
10
|
+
import a from "./tr.json.mjs";
|
|
11
|
+
import l from "./vi.json.mjs";
|
|
12
|
+
import v from "./zh.json.mjs";
|
|
13
|
+
import d from "./pl.json.mjs";
|
|
14
|
+
import n from "./sv.json.mjs";
|
|
15
|
+
var B = {
|
|
16
|
+
de: r,
|
|
17
|
+
en: o,
|
|
18
|
+
es: m,
|
|
19
|
+
fr: t,
|
|
20
|
+
it: i,
|
|
21
|
+
ja: p,
|
|
22
|
+
ko: f,
|
|
23
|
+
nl: e,
|
|
24
|
+
pt: s,
|
|
25
|
+
tr: a,
|
|
26
|
+
vi: l,
|
|
27
|
+
zh: v,
|
|
28
|
+
pl: d,
|
|
29
|
+
sv: n
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
B as localizedMessages
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/inline-input",
|
|
3
3
|
"description": "Semrush Input Component",
|
|
4
|
-
"version": "4.46.0-prerelease.
|
|
4
|
+
"version": "4.46.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/flex-box": "5.41.0-prerelease.
|
|
13
|
-
"@semcore/icon": "4.
|
|
14
|
-
"@semcore/spin": "5.41.0-prerelease.
|
|
15
|
-
"@semcore/tooltip": "6.
|
|
16
|
-
"@semcore/utils": "4.
|
|
17
|
-
"@semcore/input-number": "5.41.0-prerelease.
|
|
18
|
-
"@semcore/input": "4.42.0-prerelease.
|
|
19
|
-
"@semcore/core": "2.39.0-prerelease.
|
|
20
|
-
"@semcore/button": "5.42.0-prerelease.
|
|
17
|
+
"@semcore/flex-box": "5.41.0-prerelease.12",
|
|
18
|
+
"@semcore/icon": "4.61.0-prerelease.12",
|
|
19
|
+
"@semcore/spin": "5.41.0-prerelease.12",
|
|
20
|
+
"@semcore/tooltip": "6.49.0-prerelease.12",
|
|
21
|
+
"@semcore/utils": "4.48.0-prerelease.12",
|
|
22
|
+
"@semcore/input-number": "5.41.0-prerelease.12",
|
|
23
|
+
"@semcore/input": "4.42.0-prerelease.12",
|
|
24
|
+
"@semcore/core": "2.39.0-prerelease.12",
|
|
25
|
+
"@semcore/button": "5.42.0-prerelease.12"
|
|
21
26
|
},
|
|
22
27
|
"devDependencies": {
|
|
23
28
|
"@types/react": "18.0.21",
|
|
@@ -26,7 +31,7 @@
|
|
|
26
31
|
"@semcore/tooltip": "*"
|
|
27
32
|
},
|
|
28
33
|
"peerDependencies": {
|
|
29
|
-
"@semcore/core": "^2.39.0-prerelease.
|
|
34
|
+
"@semcore/core": "^2.39.0-prerelease.12",
|
|
30
35
|
"react": "16.8 - 18",
|
|
31
36
|
"react-dom": "16.8 - 18"
|
|
32
37
|
},
|
|
@@ -36,6 +41,6 @@
|
|
|
36
41
|
"directory": "semcore/inline-input"
|
|
37
42
|
},
|
|
38
43
|
"scripts": {
|
|
39
|
-
"build": "pnpm semcore-builder --source=js"
|
|
44
|
+
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|
|
40
45
|
}
|
|
41
46
|
}
|
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.ts',
|
|
11
|
+
},
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: ['react', 'react-dom', 'react/jsx-runtime', /@babel\/runtime\/*/, /@semcore\/*/],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
);
|