@semcore/inline-input 16.3.0 → 16.3.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 +1 -1
- package/lib/cjs/InlineInput.js +37 -31
- package/lib/cjs/InlineInput.js.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/index.type.js.map +1 -1
- package/lib/cjs/style/inline-input.shadow.css +9 -9
- package/lib/es6/InlineInput.js +31 -25
- package/lib/es6/InlineInput.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/index.type.js.map +1 -1
- package/lib/es6/style/inline-input.shadow.css +9 -9
- package/lib/esm/InlineInput.mjs +33 -28
- package/lib/esm/style/inline-input.shadow.css +9 -9
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.type.d.ts +48 -2
- package/package.json +10 -10
package/lib/esm/InlineInput.mjs
CHANGED
|
@@ -4,11 +4,12 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
4
4
|
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import { sstyled, assignProps, Component
|
|
8
|
-
import { Box, InvalidStateBox } from "@semcore/base-components";
|
|
7
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
8
|
import { ButtonLink } from "@semcore/button";
|
|
9
|
+
import autoFocusEnhance from "@semcore/core/lib/utils/enhances/autoFocusEnhance";
|
|
10
10
|
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
11
|
import { hasParent } from "@semcore/core/lib/utils/hasParent";
|
|
12
|
+
import { Box, InvalidStateBox } from "@semcore/flex-box";
|
|
12
13
|
import CheckM from "@semcore/icon/Check/m";
|
|
13
14
|
import CloseM from "@semcore/icon/Close/m";
|
|
14
15
|
import InputNumber from "@semcore/input-number";
|
|
@@ -20,24 +21,23 @@ var style = (
|
|
|
20
21
|
/*__reshadow_css_start__*/
|
|
21
22
|
(sstyled.insert(
|
|
22
23
|
/*__inner_css_start__*/
|
|
23
|
-
".
|
|
24
|
+
".___SInlineInput_ssvcx_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, rgb(255, 255, 255))}.___SInlineInput_ssvcx_gg_ .___SConfirmIcon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-success, rgb(0, 190, 142));cursor:pointer}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_ .___SConfirmIcon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-success, rgb(0, 190, 142))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_ .___SConfirmIcon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-success, color(display-p3 0.33388 0.7337 0.56959))}}}@media (hover:hover){.___SInlineInput_ssvcx_gg_ .___SConfirmIcon_ssvcx_gg_:hover{color:var(--intergalactic-icon-secondary-success-hover-active, rgb(1, 176, 131))}}.___SInlineInput_ssvcx_gg_ .___SCancelIcon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385));cursor:pointer}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_ .___SCancelIcon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_ .___SCancelIcon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-neutral, color(display-p3 0.0036 0.02041 0.00996 / 0.385))}}}@media (hover:hover){.___SInlineInput_ssvcx_gg_ .___SCancelIcon_ssvcx_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, rgba(0, 5, 2, 0.433))}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_ .___SCancelIcon_ssvcx_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, rgba(0, 5, 2, 0.433))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_ .___SCancelIcon_ssvcx_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, color(display-p3 0.00333 0.01824 0.00791 / 0.433))}}}}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_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, rgba(1, 5, 0, 0.899));font-size:inherit;line-height:1.2;text-overflow:ellipsis;font-family:inherit;background:0 0;min-height:1em}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_:focus,.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_:focus-visible{outline:0}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457))}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_::placeholder{color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457))}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_.__disabled_ssvcx_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_::-webkit-inner-spin-button,.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SInlineInput_ssvcx_gg_ .___SValue_ssvcx_gg_._type_number_ssvcx_gg_{-moz-appearance:textfield}.___SUnderline_ssvcx_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, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___SUnderline_ssvcx_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SUnderline_ssvcx_gg_{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SAddon_ssvcx_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;height:100%;color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385));padding:0 var(--intergalactic-spacing-1x, 4px)}@supports (color:color(display-p3 0 0 0%)){.___SAddon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385))}@media (color-gamut:p3){.___SAddon_ssvcx_gg_{color:var(--intergalactic-icon-secondary-neutral, color(display-p3 0.0036 0.02041 0.00996 / 0.385))}}}.___SAddon_ssvcx_gg_.__disabled_ssvcx_gg_,.___SInlineInput_ssvcx_gg_.__disabled_ssvcx_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-info-active, rgba(0, 40, 230, 0.419));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469));outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SUnderline_ssvcx_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SUnderline_ssvcx_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_{border-bottom-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_{border-bottom-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_{border-bottom-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714))}}}.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-success-active, rgb(0, 204, 154));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469));outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-success-active, rgb(0, 204, 154));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714));outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}@supports (color:oklab(0%0 0%)){.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-valid-outline, rgb(0, 190, 142))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_._state_valid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-valid-outline, oklch(0.711 0.146 166.9))}}}.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_{border-bottom-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_{border-bottom-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_{border-bottom-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56))}}}.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469));outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){border-bottom-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56));outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}@supports (color:oklab(0%0 0%)){.___SInlineInput_ssvcx_gg_._state_invalid_ssvcx_gg_ .___SUnderline_ssvcx_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652))}}.___SValue_ssvcx_gg_:focus~.___SControls_ssvcx_gg_{display:flex}.___SInvalidPattern_ssvcx_gg_{margin-left:-1px;margin-top:-1px;border-radius:0;height:calc(100% - 3px)}",
|
|
24
25
|
/*__inner_css_end__*/
|
|
25
|
-
"
|
|
26
|
+
"ssvcx_gg_"
|
|
26
27
|
), /*__reshadow_css_end__*/
|
|
27
28
|
{
|
|
28
|
-
"__SInlineInput": "
|
|
29
|
-
"_disabled": "
|
|
30
|
-
"__SUnderline": "
|
|
31
|
-
"__SAddon": "
|
|
32
|
-
"_state_valid": "
|
|
33
|
-
"_state_invalid": "
|
|
34
|
-
"__SValue": "
|
|
35
|
-
"__SControls": "
|
|
36
|
-
"__SInvalidPattern": "
|
|
37
|
-
"__SConfirmIcon": "
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"_type_number": "_type_number_eqf7o_gg_"
|
|
29
|
+
"__SInlineInput": "___SInlineInput_ssvcx_gg_",
|
|
30
|
+
"_disabled": "__disabled_ssvcx_gg_",
|
|
31
|
+
"__SUnderline": "___SUnderline_ssvcx_gg_",
|
|
32
|
+
"__SAddon": "___SAddon_ssvcx_gg_",
|
|
33
|
+
"_state_valid": "_state_valid_ssvcx_gg_",
|
|
34
|
+
"_state_invalid": "_state_invalid_ssvcx_gg_",
|
|
35
|
+
"__SValue": "___SValue_ssvcx_gg_",
|
|
36
|
+
"__SControls": "___SControls_ssvcx_gg_",
|
|
37
|
+
"__SInvalidPattern": "___SInvalidPattern_ssvcx_gg_",
|
|
38
|
+
"__SConfirmIcon": "___SConfirmIcon_ssvcx_gg_",
|
|
39
|
+
"__SCancelIcon": "___SCancelIcon_ssvcx_gg_",
|
|
40
|
+
"_type_number": "_type_number_ssvcx_gg_"
|
|
41
41
|
})
|
|
42
42
|
);
|
|
43
43
|
var pointInsideOfRect = function pointInsideOfRect2(_ref15) {
|
|
@@ -54,6 +54,7 @@ var InlineInputBase = /* @__PURE__ */ (function(_Component) {
|
|
|
54
54
|
_this = _callSuper(this, InlineInputBase2, [].concat(args));
|
|
55
55
|
_defineProperty(_this, "rootRef", /* @__PURE__ */ React.createRef());
|
|
56
56
|
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
57
|
+
_defineProperty(_this, "inputHandlersRef", /* @__PURE__ */ React.createRef());
|
|
57
58
|
_defineProperty(_this, "initValue", "");
|
|
58
59
|
_defineProperty(_this, "lastMouseDownPosition", null);
|
|
59
60
|
_defineProperty(_this, "lastHandledKeyboardEvent", -1);
|
|
@@ -68,19 +69,21 @@ var InlineInputBase = /* @__PURE__ */ (function(_Component) {
|
|
|
68
69
|
_this.lastMouseDownPosition = null;
|
|
69
70
|
});
|
|
70
71
|
_defineProperty(_this, "increment", function(event) {
|
|
71
|
-
var _this$inputRef$curren, _this$inputRef$curren2, _this$inputRef$curren3;
|
|
72
|
+
var _this$inputRef$curren, _this$inputRef$curren2, _this$inputRef$curren3, _this$inputHandlersRe, _this$inputRef$curren4;
|
|
72
73
|
if (((_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 ? void 0 : _this$inputRef$curren.value) === "") _this.inputRef.current.value = _this.inputRef.current.min || "0";
|
|
73
74
|
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0 || (_this$inputRef$curren3 = _this$inputRef$curren2.stepUp) === null || _this$inputRef$curren3 === void 0 || _this$inputRef$curren3.call(_this$inputRef$curren2, event);
|
|
75
|
+
(_this$inputHandlersRe = _this.inputHandlersRef.current) === null || _this$inputHandlersRe === void 0 || _this$inputHandlersRe.value((_this$inputRef$curren4 = _this.inputRef.current) === null || _this$inputRef$curren4 === void 0 ? void 0 : _this$inputRef$curren4.value, event);
|
|
74
76
|
});
|
|
75
77
|
_defineProperty(_this, "decrement", function(event) {
|
|
76
|
-
var _this$inputRef$
|
|
77
|
-
if (((_this$inputRef$
|
|
78
|
-
(_this$inputRef$
|
|
78
|
+
var _this$inputRef$curren5, _this$inputRef$curren6, _this$inputRef$curren7, _this$inputHandlersRe2, _this$inputRef$curren8;
|
|
79
|
+
if (((_this$inputRef$curren5 = _this.inputRef.current) === null || _this$inputRef$curren5 === void 0 ? void 0 : _this$inputRef$curren5.value) === "") _this.inputRef.current.value = _this.inputRef.current.max || "0";
|
|
80
|
+
(_this$inputRef$curren6 = _this.inputRef.current) === null || _this$inputRef$curren6 === void 0 || (_this$inputRef$curren7 = _this$inputRef$curren6.stepDown) === null || _this$inputRef$curren7 === void 0 || _this$inputRef$curren7.call(_this$inputRef$curren6, event);
|
|
81
|
+
(_this$inputHandlersRe2 = _this.inputHandlersRef.current) === null || _this$inputHandlersRe2 === void 0 || _this$inputHandlersRe2.value((_this$inputRef$curren8 = _this.inputRef.current) === null || _this$inputRef$curren8 === void 0 ? void 0 : _this$inputRef$curren8.value, event);
|
|
79
82
|
});
|
|
80
83
|
_defineProperty(_this, "handleMouseDownAddon", function(event) {
|
|
81
|
-
var _this$inputRef$
|
|
84
|
+
var _this$inputRef$curren9;
|
|
82
85
|
event.preventDefault();
|
|
83
|
-
(_this$inputRef$
|
|
86
|
+
(_this$inputRef$curren9 = _this.inputRef.current) === null || _this$inputRef$curren9 === void 0 || _this$inputRef$curren9.focus();
|
|
84
87
|
});
|
|
85
88
|
_defineProperty(_this, "handleConfirm", function(text, event) {
|
|
86
89
|
var _this$asProps$onConfi, _this$asProps;
|
|
@@ -91,7 +94,7 @@ var InlineInputBase = /* @__PURE__ */ (function(_Component) {
|
|
|
91
94
|
(_this$asProps$onCance = (_this$asProps2 = _this.asProps).onCancel) === null || _this$asProps$onCance === void 0 || _this$asProps$onCance.call(_this$asProps2, prevText, event);
|
|
92
95
|
});
|
|
93
96
|
_defineProperty(_this, "handleBlur", function(event) {
|
|
94
|
-
var _this$inputRef$
|
|
97
|
+
var _this$inputRef$curren0, _this$inputRef$curren1;
|
|
95
98
|
var _this$asProps3 = _this.asProps, onConfirm = _this$asProps3.onConfirm, onCancel = _this$asProps3.onCancel, onBlurBehavior = _this$asProps3.onBlurBehavior;
|
|
96
99
|
if (!onBlurBehavior) return;
|
|
97
100
|
if (Date.now() - _this.lastHandledKeyboardEvent < 250) return;
|
|
@@ -107,14 +110,14 @@ var InlineInputBase = /* @__PURE__ */ (function(_Component) {
|
|
|
107
110
|
return;
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
|
-
if (onBlurBehavior === "confirm") onConfirm === null || onConfirm === void 0 || onConfirm((_this$inputRef$
|
|
113
|
+
if (onBlurBehavior === "confirm") onConfirm === null || onConfirm === void 0 || onConfirm((_this$inputRef$curren0 = (_this$inputRef$curren1 = _this.inputRef.current) === null || _this$inputRef$curren1 === void 0 ? void 0 : _this$inputRef$curren1.value) !== null && _this$inputRef$curren0 !== void 0 ? _this$inputRef$curren0 : "", event);
|
|
111
114
|
if (onBlurBehavior === "cancel") onCancel === null || onCancel === void 0 || onCancel(_this.initValue, event);
|
|
112
115
|
});
|
|
113
116
|
_defineProperty(_this, "handleKeyDown", function(event) {
|
|
114
117
|
var _this$asProps4 = _this.asProps, onConfirm = _this$asProps4.onConfirm, onCancel = _this$asProps4.onCancel;
|
|
115
118
|
if (event.key === "Enter") {
|
|
116
|
-
var _this$inputRef$
|
|
117
|
-
onConfirm === null || onConfirm === void 0 || onConfirm((_this$inputRef$
|
|
119
|
+
var _this$inputRef$curren10, _this$inputRef$curren11;
|
|
120
|
+
onConfirm === null || onConfirm === void 0 || onConfirm((_this$inputRef$curren10 = (_this$inputRef$curren11 = _this.inputRef.current) === null || _this$inputRef$curren11 === void 0 ? void 0 : _this$inputRef$curren11.value) !== null && _this$inputRef$curren10 !== void 0 ? _this$inputRef$curren10 : "", event);
|
|
118
121
|
_this.lastHandledKeyboardEvent = Date.now();
|
|
119
122
|
}
|
|
120
123
|
if (event.key === "Escape") {
|
|
@@ -196,6 +199,7 @@ var InlineInputBase = /* @__PURE__ */ (function(_Component) {
|
|
|
196
199
|
return {
|
|
197
200
|
numberFormatter,
|
|
198
201
|
inputRef: this.inputRef,
|
|
202
|
+
inputHandlerRefs: this.inputHandlersRef,
|
|
199
203
|
increment: this.increment,
|
|
200
204
|
decrement: this.decrement
|
|
201
205
|
};
|
|
@@ -275,6 +279,8 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
275
279
|
_defineProperty(Value, "defaultProps", {
|
|
276
280
|
defaultValue: ""
|
|
277
281
|
});
|
|
282
|
+
_defineProperty(Value, "enhance", [autoFocusEnhance()]);
|
|
283
|
+
_defineProperty(Value, "hoistProps", ["disabled"]);
|
|
278
284
|
function Addon(props) {
|
|
279
285
|
var _ref3 = arguments[0], _ref0;
|
|
280
286
|
var SAddon = Box;
|
|
@@ -353,7 +359,6 @@ function NumberValue(props) {
|
|
|
353
359
|
var SValue = InputNumber.Value;
|
|
354
360
|
return _ref13 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SValue, _ref13.cn("SValue", _objectSpread({}, assignProps({}, _ref6))));
|
|
355
361
|
}
|
|
356
|
-
;
|
|
357
362
|
function NumberControls(props) {
|
|
358
363
|
var _ref7 = arguments[0], _ref14;
|
|
359
364
|
var SControls = InputNumber.Controls;
|
|
@@ -12,21 +12,21 @@ SInlineInput {
|
|
|
12
12
|
|
|
13
13
|
background-color: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
|
|
14
14
|
|
|
15
|
-
SConfirmIcon
|
|
15
|
+
SConfirmIcon {
|
|
16
16
|
color: var(--intergalactic-icon-secondary-success, oklch(0.711 0.146 166.9));
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
SConfirmIcon:
|
|
20
|
+
SConfirmIcon:hover {
|
|
21
21
|
color: var(--intergalactic-icon-secondary-success-hover-active, oklch(0.673 0.139 166.3));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
SCancelIcon
|
|
24
|
+
SCancelIcon {
|
|
25
25
|
color: var(--intergalactic-icon-secondary-neutral, oklch(0.104 0.023 162.3 / 0.385));
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
SCancelIcon:
|
|
29
|
+
SCancelIcon:hover {
|
|
30
30
|
color: var(--intergalactic-icon-secondary-neutral-hover-active, oklch(0.1 0.023 159.1 / 0.433));
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -106,26 +106,26 @@ SAddon[disabled] {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
SUnderline:has(input:focus-visible) {
|
|
109
|
-
border-bottom-color: var(--intergalactic-border-info-active, oklch(0.
|
|
109
|
+
border-bottom-color: var(--intergalactic-border-info-active, oklch(0.443 0.273 264.2 / 0.419));
|
|
110
110
|
@mixin focus-outline-mixin;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
SInlineInput[state='valid'] SUnderline {
|
|
114
|
-
border-bottom-color: var(--intergalactic-border-success-active, oklch(0.
|
|
114
|
+
border-bottom-color: var(--intergalactic-border-success-active, oklch(0.75 0.153 167.5));
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
SInlineInput[state='valid'] SUnderline:has(input:focus-visible) {
|
|
118
|
-
border-bottom-color: var(--intergalactic-border-success-active, oklch(0.
|
|
118
|
+
border-bottom-color: var(--intergalactic-border-success-active, oklch(0.75 0.153 167.5));
|
|
119
119
|
@mixin focus-outline-mixin;
|
|
120
120
|
outline-color: var(--intergalactic-keyboard-focus-valid-outline, oklch(0.711 0.146 166.9));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
SInlineInput[state='invalid'] SUnderline {
|
|
124
|
-
border-bottom-color: var(--intergalactic-border-critical-active, oklch(0.
|
|
124
|
+
border-bottom-color: var(--intergalactic-border-critical-active, oklch(0.628 0.258 29 / 0.56));
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
SInlineInput[state='invalid'] SUnderline:has(input:focus-visible) {
|
|
128
|
-
border-bottom-color: var(--intergalactic-border-critical-active, oklch(0.
|
|
128
|
+
border-bottom-color: var(--intergalactic-border-critical-active, oklch(0.628 0.258 29 / 0.56));
|
|
129
129
|
@mixin focus-outline-mixin;
|
|
130
130
|
outline-color: var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652));
|
|
131
131
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InlineInputProps
|
|
1
|
+
import type { InlineInputProps } from './index.type';
|
|
2
2
|
import InlineInputBase from './InlineInput';
|
|
3
3
|
export default InlineInputBase;
|
|
4
|
-
export type { InlineInputProps
|
|
4
|
+
export type { InlineInputProps };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { BoxProps } from '@semcore/base-components';
|
|
2
1
|
import type { ButtonLinkComponent } from '@semcore/button';
|
|
3
|
-
import type { PropGetterFn, Intergalactic } from '@semcore/core';
|
|
2
|
+
import type { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
3
|
+
import type { BoxProps } from '@semcore/flex-box';
|
|
4
4
|
import type { InputNumberControlsProps } from '@semcore/input-number';
|
|
5
5
|
import type React from 'react';
|
|
6
|
+
/** @deprecated */
|
|
7
|
+
export interface IInlineInputProps extends InlineInputProps, UnknownProperties {
|
|
8
|
+
}
|
|
6
9
|
export type InlineInputProps = BoxProps & {
|
|
7
10
|
/**
|
|
8
11
|
* Visual state of inline input
|
|
@@ -27,6 +30,27 @@ export type InlineInputProps = BoxProps & {
|
|
|
27
30
|
* Fired with value (or defaultValue) that was provided during component mount when user clicks cancel control or hits `Escape`
|
|
28
31
|
*/
|
|
29
32
|
onCancel?: (prevValue: string, event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Text value of input. Should be used with `onChange` property together
|
|
35
|
+
* @deprecated
|
|
36
|
+
*/
|
|
37
|
+
value?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Initial text value of input
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Makes component to catch browser focus on component mount
|
|
45
|
+
* @default false
|
|
46
|
+
* @deprecated
|
|
47
|
+
*/
|
|
48
|
+
autoFocus?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Gray text displayed in empty input
|
|
51
|
+
* @deprecated
|
|
52
|
+
*/
|
|
53
|
+
placeholder?: string;
|
|
30
54
|
/**
|
|
31
55
|
* defines callback (`onCancel` or `onConfirm`) triggered when `blur` event out of container fired
|
|
32
56
|
* Triggered after all previous macrotasks completed (internally called inside of `setTimeout`)
|
|
@@ -35,7 +59,13 @@ export type InlineInputProps = BoxProps & {
|
|
|
35
59
|
/** Specifies the locale for i18n support */
|
|
36
60
|
locale?: string;
|
|
37
61
|
};
|
|
62
|
+
/** @deprecated */
|
|
63
|
+
export interface IInlineInputAddonProps extends InlineInputAddonProps, UnknownProperties {
|
|
64
|
+
}
|
|
38
65
|
export type InlineInputAddonProps = BoxProps & {};
|
|
66
|
+
/** @deprecated */
|
|
67
|
+
export interface IInlineInputValueProps extends InlineInputValueProps, UnknownProperties {
|
|
68
|
+
}
|
|
39
69
|
export type InlineInputValueProps = BoxProps & {
|
|
40
70
|
/**
|
|
41
71
|
* id attribute of input tag
|
|
@@ -57,6 +87,16 @@ export type InlineInputValueProps = BoxProps & {
|
|
|
57
87
|
* callback invoked on every change of input tag value
|
|
58
88
|
*/
|
|
59
89
|
onChange?: (value: string, event: React.ChangeEvent) => void;
|
|
90
|
+
/**
|
|
91
|
+
* visual state of component
|
|
92
|
+
* @deprecated
|
|
93
|
+
*/
|
|
94
|
+
state?: 'normal' | 'valid' | 'invalid';
|
|
95
|
+
/**
|
|
96
|
+
* shows spinner in `InlineInput.ConfirmControl` and disables other interactive elements
|
|
97
|
+
* @deprecated
|
|
98
|
+
*/
|
|
99
|
+
loading?: boolean;
|
|
60
100
|
/**
|
|
61
101
|
* disables interactive elements
|
|
62
102
|
*/
|
|
@@ -66,6 +106,9 @@ export type InlineInputValueProps = BoxProps & {
|
|
|
66
106
|
*/
|
|
67
107
|
placeholder?: string;
|
|
68
108
|
};
|
|
109
|
+
/** @deprecated */
|
|
110
|
+
export interface IInlineInputConfirmControlProps extends InlineInputConfirmControlProps, UnknownProperties {
|
|
111
|
+
}
|
|
69
112
|
export type InlineInputConfirmControlProps = BoxProps & {
|
|
70
113
|
/**
|
|
71
114
|
* Text of tooltip
|
|
@@ -78,6 +121,9 @@ export type InlineInputConfirmControlProps = BoxProps & {
|
|
|
78
121
|
*/
|
|
79
122
|
icon?: React.FC;
|
|
80
123
|
};
|
|
124
|
+
/** @deprecated */
|
|
125
|
+
export interface IInlineInputCancelControlProps extends InlineInputCancelControlProps, UnknownProperties {
|
|
126
|
+
}
|
|
81
127
|
export type InlineInputCancelControlProps = BoxProps & {
|
|
82
128
|
/**
|
|
83
129
|
* Text of tooltip
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/inline-input",
|
|
3
3
|
"description": "Semrush Input Component",
|
|
4
|
-
"version": "16.3.
|
|
4
|
+
"version": "16.3.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "16.1.
|
|
18
|
-
"@semcore/icon": "16.8.
|
|
19
|
-
"@semcore/spin": "16.1.
|
|
20
|
-
"@semcore/tooltip": "16.1.
|
|
21
|
-
"@semcore/input-number": "16.1.
|
|
22
|
-
"@semcore/input": "16.2.
|
|
23
|
-
"@semcore/button": "16.1.
|
|
17
|
+
"@semcore/flex-box": "16.1.1",
|
|
18
|
+
"@semcore/icon": "16.8.1",
|
|
19
|
+
"@semcore/spin": "16.1.1",
|
|
20
|
+
"@semcore/tooltip": "16.1.1",
|
|
21
|
+
"@semcore/input-number": "16.1.1",
|
|
22
|
+
"@semcore/input": "16.2.1",
|
|
23
|
+
"@semcore/button": "16.1.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@semcore/core": "16.6.0",
|
|
27
27
|
"@semcore/testing-utils": "1.0.0",
|
|
28
|
-
"@semcore/spin": "16.1.
|
|
29
|
-
"@semcore/tooltip": "16.1.
|
|
28
|
+
"@semcore/spin": "16.1.1",
|
|
29
|
+
"@semcore/tooltip": "16.1.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@semcore/base-components": "^16.6.0"
|