@semcore/inline-input 4.49.0-prerelease.4 → 4.49.0-prerelease.5
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/lib/cjs/InlineInput.js +128 -139
- package/lib/cjs/InlineInput.js.map +1 -1
- package/lib/cjs/index.js +2 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/index.type.js +2 -0
- package/lib/cjs/index.type.js.map +1 -0
- package/lib/cjs/style/inline-input.shadow.css +52 -55
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/InlineInput.js +122 -130
- package/lib/es6/InlineInput.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/index.type.js +2 -0
- package/lib/es6/index.type.js.map +1 -0
- package/lib/es6/style/inline-input.shadow.css +52 -55
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/InlineInput.mjs +123 -133
- package/lib/esm/style/inline-input.shadow.css +52 -55
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/InlineInput.d.ts +4 -0
- package/lib/types/index.d.ts +4 -162
- package/lib/types/index.type.d.ts +107 -0
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +58 -0
- package/package.json +11 -11
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
package/lib/esm/InlineInput.mjs
CHANGED
|
@@ -1,115 +1,97 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { sstyled } from "@semcore/
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
7
|
+
import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
|
|
8
|
+
import { Box, InvalidStateBox } from "@semcore/base-components";
|
|
9
|
+
import { ButtonLink } from "@semcore/button";
|
|
10
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
|
+
import { hasParent } from "@semcore/core/lib/utils/hasParent";
|
|
13
12
|
import CheckM from "@semcore/icon/Check/m";
|
|
14
13
|
import CloseM from "@semcore/icon/Close/m";
|
|
14
|
+
import InputNumber from "@semcore/input-number";
|
|
15
15
|
import Spin from "@semcore/spin";
|
|
16
|
-
import
|
|
16
|
+
import React from "react";
|
|
17
17
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
18
|
-
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
19
|
-
import InputNumber from "@semcore/input-number";
|
|
20
|
-
import { hasParent } from "@semcore/utils/lib/hasParent";
|
|
21
18
|
/*!__reshadow-styles__:"./style/inline-input.shadow.css"*/
|
|
22
19
|
var style = (
|
|
23
20
|
/*__reshadow_css_start__*/
|
|
24
21
|
(sstyled.insert(
|
|
25
22
|
/*__inner_css_start__*/
|
|
26
|
-
".
|
|
23
|
+
".___SInlineInput_1lnc2_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_1lnc2_gg_ .___SConfirmIcon_1lnc2_gg_:not(.__color_1lnc2_gg_){color:var(--intergalactic-icon-secondary-success, rgb(0, 190, 142));cursor:pointer}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_1lnc2_gg_ .___SConfirmIcon_1lnc2_gg_:not(.__color_1lnc2_gg_){color:var(--intergalactic-icon-secondary-success, rgb(0, 190, 142))}@media (color-gamut:p3){.___SInlineInput_1lnc2_gg_ .___SConfirmIcon_1lnc2_gg_:not(.__color_1lnc2_gg_){color:var(--intergalactic-icon-secondary-success, color(display-p3 0.33388 0.7337 0.56959))}}}@media (hover:hover){.___SInlineInput_1lnc2_gg_ .___SConfirmIcon_1lnc2_gg_:not(.__color_1lnc2_gg_):hover{color:var(--intergalactic-icon-secondary-success-hover-active, rgb(1, 176, 131))}}.___SInlineInput_1lnc2_gg_ .___SCancelIcon_1lnc2_gg_:not(.__color_1lnc2_gg_){color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385));cursor:pointer}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_1lnc2_gg_ .___SCancelIcon_1lnc2_gg_:not(.__color_1lnc2_gg_){color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385))}@media (color-gamut:p3){.___SInlineInput_1lnc2_gg_ .___SCancelIcon_1lnc2_gg_:not(.__color_1lnc2_gg_){color:var(--intergalactic-icon-secondary-neutral, color(display-p3 0.0036 0.02041 0.00996 / 0.385))}}}@media (hover:hover){.___SInlineInput_1lnc2_gg_ .___SCancelIcon_1lnc2_gg_:not(.__color_1lnc2_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_1lnc2_gg_ .___SCancelIcon_1lnc2_gg_:not(.__color_1lnc2_gg_):hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, rgba(0, 5, 2, 0.433))}@media (color-gamut:p3){.___SInlineInput_1lnc2_gg_ .___SCancelIcon_1lnc2_gg_:not(.__color_1lnc2_gg_):hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, color(display-p3 0.00333 0.01824 0.00791 / 0.433))}}}}.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_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_1lnc2_gg_ .___SValue_1lnc2_gg_:focus,.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_:focus-visible{outline:0}.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457))}.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_::placeholder{color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457))}.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_.__disabled_1lnc2_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_::-webkit-inner-spin-button,.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SInlineInput_1lnc2_gg_ .___SValue_1lnc2_gg_._type_number_1lnc2_gg_{-moz-appearance:textfield}.___SUnderline_1lnc2_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_1lnc2_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SUnderline_1lnc2_gg_{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SAddon_1lnc2_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_1lnc2_gg_{color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385))}@media (color-gamut:p3){.___SAddon_1lnc2_gg_{color:var(--intergalactic-icon-secondary-neutral, color(display-p3 0.0036 0.02041 0.00996 / 0.385))}}}.___SAddon_1lnc2_gg_.__disabled_1lnc2_gg_,.___SInlineInput_1lnc2_gg_.__disabled_1lnc2_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SUnderline_1lnc2_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_1lnc2_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SUnderline_1lnc2_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SInlineInput_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_gg_{border-bottom-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_gg_{border-bottom-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@media (color-gamut:p3){.___SInlineInput_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_gg_{border-bottom-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714))}}}.___SInlineInput_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_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_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_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_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_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_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-valid-outline, rgb(0, 190, 142))}@media (color-gamut:p3){.___SInlineInput_1lnc2_gg_._state_valid_1lnc2_gg_ .___SUnderline_1lnc2_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-valid-outline, oklch(0.711 0.146 166.9))}}}.___SInlineInput_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_gg_{border-bottom-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@supports (color:color(display-p3 0 0 0%)){.___SInlineInput_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_gg_{border-bottom-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@media (color-gamut:p3){.___SInlineInput_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_gg_{border-bottom-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56))}}}.___SInlineInput_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_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_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_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_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_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_1lnc2_gg_._state_invalid_1lnc2_gg_ .___SUnderline_1lnc2_gg_:has(input:focus-visible){outline-color:var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652))}}.___SValue_1lnc2_gg_:focus~.___SControls_1lnc2_gg_{display:flex}.___SInvalidPattern_1lnc2_gg_{margin-left:-1px;margin-top:-1px;border-radius:0;height:calc(100% - 3px)}",
|
|
27
24
|
/*__inner_css_end__*/
|
|
28
|
-
"
|
|
25
|
+
"1lnc2_gg_"
|
|
29
26
|
), /*__reshadow_css_end__*/
|
|
30
27
|
{
|
|
31
|
-
"__SInlineInput": "
|
|
32
|
-
"_disabled": "
|
|
33
|
-
"__SUnderline": "
|
|
34
|
-
"__SAddon": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"__SCancelIcon": "
|
|
43
|
-
"_type_number": "
|
|
28
|
+
"__SInlineInput": "___SInlineInput_1lnc2_gg_",
|
|
29
|
+
"_disabled": "__disabled_1lnc2_gg_",
|
|
30
|
+
"__SUnderline": "___SUnderline_1lnc2_gg_",
|
|
31
|
+
"__SAddon": "___SAddon_1lnc2_gg_",
|
|
32
|
+
"_state_valid": "_state_valid_1lnc2_gg_",
|
|
33
|
+
"_state_invalid": "_state_invalid_1lnc2_gg_",
|
|
34
|
+
"__SValue": "___SValue_1lnc2_gg_",
|
|
35
|
+
"__SControls": "___SControls_1lnc2_gg_",
|
|
36
|
+
"__SInvalidPattern": "___SInvalidPattern_1lnc2_gg_",
|
|
37
|
+
"__SConfirmIcon": "___SConfirmIcon_1lnc2_gg_",
|
|
38
|
+
"_color": "__color_1lnc2_gg_",
|
|
39
|
+
"__SCancelIcon": "___SCancelIcon_1lnc2_gg_",
|
|
40
|
+
"_type_number": "_type_number_1lnc2_gg_"
|
|
44
41
|
})
|
|
45
42
|
);
|
|
46
|
-
var pointInsideOfRect = function pointInsideOfRect2(
|
|
47
|
-
var x =
|
|
43
|
+
var pointInsideOfRect = function pointInsideOfRect2(_ref15) {
|
|
44
|
+
var x = _ref15.x, y = _ref15.y, rect = _ref15.rect;
|
|
48
45
|
return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
|
|
49
46
|
};
|
|
50
|
-
var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
51
|
-
_inherits(InlineInputBase2, _Component);
|
|
52
|
-
var _super = _createSuper(InlineInputBase2);
|
|
47
|
+
var InlineInputBase = /* @__PURE__ */ (function(_Component) {
|
|
53
48
|
function InlineInputBase2() {
|
|
54
49
|
var _this;
|
|
55
50
|
_classCallCheck(this, InlineInputBase2);
|
|
56
51
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
52
|
args[_key] = arguments[_key];
|
|
58
53
|
}
|
|
59
|
-
_this =
|
|
60
|
-
_defineProperty(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_defineProperty(
|
|
64
|
-
_defineProperty(
|
|
65
|
-
_defineProperty(
|
|
66
|
-
_defineProperty(_assertThisInitialized(_this), "initValue", "");
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "lastMouseDownPosition", null);
|
|
68
|
-
_defineProperty(_assertThisInitialized(_this), "lastHandledKeyboardEvent", -1);
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "handleDocumentMouseDown", function(event) {
|
|
54
|
+
_this = _callSuper(this, InlineInputBase2, [].concat(args));
|
|
55
|
+
_defineProperty(_this, "rootRef", /* @__PURE__ */ React.createRef());
|
|
56
|
+
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
57
|
+
_defineProperty(_this, "initValue", "");
|
|
58
|
+
_defineProperty(_this, "lastMouseDownPosition", null);
|
|
59
|
+
_defineProperty(_this, "lastHandledKeyboardEvent", -1);
|
|
60
|
+
_defineProperty(_this, "handleDocumentMouseDown", function(event) {
|
|
70
61
|
_this.lastMouseDownPosition = {
|
|
71
62
|
x: event.clientX,
|
|
72
63
|
y: event.clientY
|
|
73
64
|
};
|
|
74
65
|
_this.lastHandledKeyboardEvent = -1;
|
|
75
66
|
});
|
|
76
|
-
_defineProperty(
|
|
67
|
+
_defineProperty(_this, "handleDocumentKeyDown", function() {
|
|
77
68
|
_this.lastMouseDownPosition = null;
|
|
78
69
|
});
|
|
79
|
-
_defineProperty(
|
|
80
|
-
var _this$inputRef$curren, _this$inputRef$curren2, _this$inputRef$curren3
|
|
70
|
+
_defineProperty(_this, "increment", function(event) {
|
|
71
|
+
var _this$inputRef$curren, _this$inputRef$curren2, _this$inputRef$curren3;
|
|
81
72
|
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";
|
|
82
|
-
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0
|
|
83
|
-
(_this$inputHandlersRe = _this.inputHandlersRef.current) === null || _this$inputHandlersRe === void 0 ? void 0 : _this$inputHandlersRe.value((_this$inputRef$curren4 = _this.inputRef.current) === null || _this$inputRef$curren4 === void 0 ? void 0 : _this$inputRef$curren4.value, event);
|
|
73
|
+
(_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);
|
|
84
74
|
});
|
|
85
|
-
_defineProperty(
|
|
86
|
-
var _this$inputRef$
|
|
87
|
-
if (((_this$inputRef$
|
|
88
|
-
(_this$inputRef$
|
|
89
|
-
(_this$inputHandlersRe2 = _this.inputHandlersRef.current) === null || _this$inputHandlersRe2 === void 0 ? void 0 : _this$inputHandlersRe2.value((_this$inputRef$curren8 = _this.inputRef.current) === null || _this$inputRef$curren8 === void 0 ? void 0 : _this$inputRef$curren8.value, event);
|
|
75
|
+
_defineProperty(_this, "decrement", function(event) {
|
|
76
|
+
var _this$inputRef$curren4, _this$inputRef$curren5, _this$inputRef$curren6;
|
|
77
|
+
if (((_this$inputRef$curren4 = _this.inputRef.current) === null || _this$inputRef$curren4 === void 0 ? void 0 : _this$inputRef$curren4.value) === "") _this.inputRef.current.value = _this.inputRef.current.max || "0";
|
|
78
|
+
(_this$inputRef$curren5 = _this.inputRef.current) === null || _this$inputRef$curren5 === void 0 || (_this$inputRef$curren6 = _this$inputRef$curren5.stepDown) === null || _this$inputRef$curren6 === void 0 || _this$inputRef$curren6.call(_this$inputRef$curren5, event);
|
|
90
79
|
});
|
|
91
|
-
_defineProperty(
|
|
92
|
-
|
|
93
|
-
_this.setState({
|
|
94
|
-
focused
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
_defineProperty(_assertThisInitialized(_this), "handleMouseDownAddon", function(event) {
|
|
99
|
-
var _this$inputRef$curren9;
|
|
80
|
+
_defineProperty(_this, "handleMouseDownAddon", function(event) {
|
|
81
|
+
var _this$inputRef$curren7;
|
|
100
82
|
event.preventDefault();
|
|
101
|
-
(_this$inputRef$
|
|
83
|
+
(_this$inputRef$curren7 = _this.inputRef.current) === null || _this$inputRef$curren7 === void 0 || _this$inputRef$curren7.focus();
|
|
102
84
|
});
|
|
103
|
-
_defineProperty(
|
|
85
|
+
_defineProperty(_this, "handleConfirm", function(text, event) {
|
|
104
86
|
var _this$asProps$onConfi, _this$asProps;
|
|
105
|
-
(_this$asProps$onConfi = (_this$asProps = _this.asProps).onConfirm) === null || _this$asProps$onConfi === void 0
|
|
87
|
+
(_this$asProps$onConfi = (_this$asProps = _this.asProps).onConfirm) === null || _this$asProps$onConfi === void 0 || _this$asProps$onConfi.call(_this$asProps, text, event);
|
|
106
88
|
});
|
|
107
|
-
_defineProperty(
|
|
89
|
+
_defineProperty(_this, "handleCancel", function(prevText, event) {
|
|
108
90
|
var _this$asProps$onCance, _this$asProps2;
|
|
109
|
-
(_this$asProps$onCance = (_this$asProps2 = _this.asProps).onCancel) === null || _this$asProps$onCance === void 0
|
|
91
|
+
(_this$asProps$onCance = (_this$asProps2 = _this.asProps).onCancel) === null || _this$asProps$onCance === void 0 || _this$asProps$onCance.call(_this$asProps2, prevText, event);
|
|
110
92
|
});
|
|
111
|
-
_defineProperty(
|
|
112
|
-
var _this$inputRef$
|
|
93
|
+
_defineProperty(_this, "handleBlur", function(event) {
|
|
94
|
+
var _this$inputRef$curren8, _this$inputRef$curren9;
|
|
113
95
|
var _this$asProps3 = _this.asProps, onConfirm = _this$asProps3.onConfirm, onCancel = _this$asProps3.onCancel, onBlurBehavior = _this$asProps3.onBlurBehavior;
|
|
114
96
|
if (!onBlurBehavior) return;
|
|
115
97
|
if (Date.now() - _this.lastHandledKeyboardEvent < 250) return;
|
|
@@ -125,30 +107,39 @@ var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
|
125
107
|
return;
|
|
126
108
|
}
|
|
127
109
|
}
|
|
128
|
-
if (onBlurBehavior === "confirm") onConfirm === null || onConfirm === void 0
|
|
129
|
-
if (onBlurBehavior === "cancel") onCancel === null || onCancel === void 0
|
|
110
|
+
if (onBlurBehavior === "confirm") onConfirm === null || onConfirm === void 0 || onConfirm((_this$inputRef$curren8 = (_this$inputRef$curren9 = _this.inputRef.current) === null || _this$inputRef$curren9 === void 0 ? void 0 : _this$inputRef$curren9.value) !== null && _this$inputRef$curren8 !== void 0 ? _this$inputRef$curren8 : "", event);
|
|
111
|
+
if (onBlurBehavior === "cancel") onCancel === null || onCancel === void 0 || onCancel(_this.initValue, event);
|
|
130
112
|
});
|
|
131
|
-
_defineProperty(
|
|
113
|
+
_defineProperty(_this, "handleKeyDown", function(event) {
|
|
132
114
|
var _this$asProps4 = _this.asProps, onConfirm = _this$asProps4.onConfirm, onCancel = _this$asProps4.onCancel;
|
|
133
115
|
if (event.key === "Enter") {
|
|
134
|
-
var _this$inputRef$
|
|
135
|
-
onConfirm === null || onConfirm === void 0
|
|
116
|
+
var _this$inputRef$curren0, _this$inputRef$curren1;
|
|
117
|
+
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);
|
|
136
118
|
_this.lastHandledKeyboardEvent = Date.now();
|
|
137
119
|
}
|
|
138
120
|
if (event.key === "Escape") {
|
|
139
|
-
onCancel === null || onCancel === void 0
|
|
121
|
+
onCancel === null || onCancel === void 0 || onCancel(_this.initValue, event);
|
|
140
122
|
_this.lastHandledKeyboardEvent = Date.now();
|
|
141
123
|
}
|
|
142
124
|
});
|
|
143
125
|
return _this;
|
|
144
126
|
}
|
|
145
|
-
|
|
127
|
+
_inherits(InlineInputBase2, _Component);
|
|
128
|
+
return _createClass(InlineInputBase2, [{
|
|
146
129
|
key: "componentDidMount",
|
|
147
130
|
value: function componentDidMount() {
|
|
131
|
+
this.updateInert();
|
|
148
132
|
if (!this.asProps.onBlurBehavior) return;
|
|
149
133
|
document.body.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
150
134
|
document.body.addEventListener("keydown", this.handleDocumentKeyDown);
|
|
151
135
|
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "componentDidUpdate",
|
|
138
|
+
value: function componentDidUpdate(prevProps) {
|
|
139
|
+
if (prevProps.disabled !== this.asProps.disabled) {
|
|
140
|
+
this.updateInert();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
152
143
|
}, {
|
|
153
144
|
key: "componentWillUnmount",
|
|
154
145
|
value: function componentWillUnmount() {
|
|
@@ -166,10 +157,9 @@ var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
|
166
157
|
}, {
|
|
167
158
|
key: "getConfirmControlProps",
|
|
168
159
|
value: function getConfirmControlProps() {
|
|
169
|
-
var _this$inputRef$curren14;
|
|
170
160
|
var _this$asProps5 = this.asProps, loading = _this$asProps5.loading, getI18nText = _this$asProps5.getI18nText;
|
|
171
161
|
return {
|
|
172
|
-
|
|
162
|
+
inputRef: this.inputRef,
|
|
173
163
|
loading,
|
|
174
164
|
onConfirm: this.handleConfirm,
|
|
175
165
|
getI18nText
|
|
@@ -194,9 +184,7 @@ var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
|
194
184
|
return {
|
|
195
185
|
ref: this.inputRef,
|
|
196
186
|
state,
|
|
197
|
-
onKeyDown: this.handleKeyDown
|
|
198
|
-
onFocus: this.bindHandlerValueFocused(true),
|
|
199
|
-
onBlur: this.bindHandlerValueFocused(false)
|
|
187
|
+
onKeyDown: this.handleKeyDown
|
|
200
188
|
};
|
|
201
189
|
}
|
|
202
190
|
}, {
|
|
@@ -208,11 +196,8 @@ var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
|
208
196
|
return {
|
|
209
197
|
numberFormatter,
|
|
210
198
|
inputRef: this.inputRef,
|
|
211
|
-
inputHandlerRefs: this.inputHandlersRef,
|
|
212
199
|
increment: this.increment,
|
|
213
|
-
decrement: this.decrement
|
|
214
|
-
onFocus: this.bindHandlerValueFocused(true),
|
|
215
|
-
onBlur: this.bindHandlerValueFocused(false)
|
|
200
|
+
decrement: this.decrement
|
|
216
201
|
};
|
|
217
202
|
}
|
|
218
203
|
}, {
|
|
@@ -225,6 +210,17 @@ var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
|
225
210
|
getI18nText
|
|
226
211
|
};
|
|
227
212
|
}
|
|
213
|
+
}, {
|
|
214
|
+
key: "updateInert",
|
|
215
|
+
value: function updateInert() {
|
|
216
|
+
var disabled = this.asProps.disabled;
|
|
217
|
+
if (!this.rootRef.current) return;
|
|
218
|
+
if (disabled) {
|
|
219
|
+
this.rootRef.current.setAttribute("inert", "");
|
|
220
|
+
} else {
|
|
221
|
+
this.rootRef.current.removeAttribute("inert");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
228
224
|
}, {
|
|
229
225
|
key: "render",
|
|
230
226
|
value: function render() {
|
|
@@ -233,16 +229,13 @@ var InlineInputBase = /* @__PURE__ */ function(_Component) {
|
|
|
233
229
|
var SUnderline = "div";
|
|
234
230
|
var SInvalidPattern = InvalidStateBox;
|
|
235
231
|
var _this$asProps7 = this.asProps, Children = _this$asProps7.Children, styles = _this$asProps7.styles, state = _this$asProps7.state;
|
|
236
|
-
|
|
237
|
-
return _ref8 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SInlineInput, _ref8.cn("SInlineInput", _objectSpread({}, assignProps({
|
|
232
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SInlineInput, _ref8.cn("SInlineInput", _objectSpread({}, assignProps({
|
|
238
233
|
"ref": this.rootRef,
|
|
239
|
-
"focused": focused,
|
|
240
234
|
"onBlur": this.handleBlur
|
|
241
235
|
}, _ref))), /* @__PURE__ */ React.createElement(SUnderline, _ref8.cn("SUnderline", {}), state === "invalid" && /* @__PURE__ */ React.createElement(SInvalidPattern, _ref8.cn("SInvalidPattern", {})), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {}))));
|
|
242
236
|
}
|
|
243
237
|
}]);
|
|
244
|
-
|
|
245
|
-
}(Component);
|
|
238
|
+
})(Component);
|
|
246
239
|
_defineProperty(InlineInputBase, "displayName", "InlineInput");
|
|
247
240
|
_defineProperty(InlineInputBase, "enhance", [i18nEnhance(localizedMessages)]);
|
|
248
241
|
_defineProperty(InlineInputBase, "defaultProps", {
|
|
@@ -252,14 +245,13 @@ _defineProperty(InlineInputBase, "defaultProps", {
|
|
|
252
245
|
locale: "en"
|
|
253
246
|
});
|
|
254
247
|
_defineProperty(InlineInputBase, "style", style);
|
|
255
|
-
var Value = /* @__PURE__ */ function(_Component2) {
|
|
256
|
-
_inherits(Value2, _Component2);
|
|
257
|
-
var _super2 = _createSuper(Value2);
|
|
248
|
+
var Value = /* @__PURE__ */ (function(_Component2) {
|
|
258
249
|
function Value2() {
|
|
259
250
|
_classCallCheck(this, Value2);
|
|
260
|
-
return
|
|
251
|
+
return _callSuper(this, Value2, arguments);
|
|
261
252
|
}
|
|
262
|
-
|
|
253
|
+
_inherits(Value2, _Component2);
|
|
254
|
+
return _createClass(Value2, [{
|
|
263
255
|
key: "uncontrolledProps",
|
|
264
256
|
value: function uncontrolledProps() {
|
|
265
257
|
return {
|
|
@@ -273,33 +265,30 @@ var Value = /* @__PURE__ */ function(_Component2) {
|
|
|
273
265
|
value: function render() {
|
|
274
266
|
var _ref2 = this.asProps, _ref9;
|
|
275
267
|
var SValue = Box;
|
|
276
|
-
return _ref9 = sstyled
|
|
268
|
+
return _ref9 = sstyled(this.asProps.styles), /* @__PURE__ */ React.createElement(SValue, _ref9.cn("SValue", _objectSpread({}, assignProps({
|
|
277
269
|
"tag": "input",
|
|
278
270
|
"type": "text"
|
|
279
271
|
}, _ref2))));
|
|
280
272
|
}
|
|
281
273
|
}]);
|
|
282
|
-
|
|
283
|
-
}(Component);
|
|
274
|
+
})(Component);
|
|
284
275
|
_defineProperty(Value, "defaultProps", {
|
|
285
276
|
defaultValue: ""
|
|
286
277
|
});
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
var Addon = function Addon2(props) {
|
|
290
|
-
var _ref3 = arguments[0], _ref10;
|
|
278
|
+
function Addon(props) {
|
|
279
|
+
var _ref3 = arguments[0], _ref0;
|
|
291
280
|
var SAddon = Box;
|
|
292
|
-
return
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
var _ref4 = arguments[0],
|
|
281
|
+
return _ref0 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref0.cn("SAddon", _objectSpread({}, assignProps({}, _ref3))));
|
|
282
|
+
}
|
|
283
|
+
function ConfirmControl(props) {
|
|
284
|
+
var _ref4 = arguments[0], _ref10, _props$title, _ref16;
|
|
296
285
|
var SAddon = Box;
|
|
297
|
-
var Children = props.Children, hasChildren = props.children;
|
|
286
|
+
var Children = props.Children, hasChildren = props.children, inputRef = props.inputRef;
|
|
298
287
|
var title = (_props$title = props.title) !== null && _props$title !== void 0 ? _props$title : props.getI18nText("confirm");
|
|
299
288
|
var handleConfirm = React.useCallback(function(event) {
|
|
300
|
-
var _props$onConfirm,
|
|
301
|
-
(_props$onConfirm = props.onConfirm) === null || _props$onConfirm === void 0
|
|
302
|
-
}, [props.onConfirm,
|
|
289
|
+
var _props$onConfirm, _inputRef$current$val, _inputRef$current;
|
|
290
|
+
(_props$onConfirm = props.onConfirm) === null || _props$onConfirm === void 0 || _props$onConfirm.call(props, (_inputRef$current$val = inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) !== null && _inputRef$current$val !== void 0 ? _inputRef$current$val : "", event);
|
|
291
|
+
}, [props.onConfirm, inputRef === null || inputRef === void 0 ? void 0 : inputRef.current]);
|
|
303
292
|
var handleKeydown = React.useCallback(function(event) {
|
|
304
293
|
if (event.key === "Enter" || event.key === " ") {
|
|
305
294
|
event.preventDefault();
|
|
@@ -308,32 +297,32 @@ var ConfirmControl = function ConfirmControl2(props) {
|
|
|
308
297
|
}
|
|
309
298
|
}, [handleConfirm]);
|
|
310
299
|
if (props.loading) {
|
|
311
|
-
var
|
|
312
|
-
return
|
|
300
|
+
var _ref1;
|
|
301
|
+
return _ref1 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref1.cn("SAddon", _objectSpread({}, assignProps({}, _ref4))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {})) : /* @__PURE__ */ React.createElement(Spin, _ref1.cn("Spin", {
|
|
313
302
|
"size": "xs"
|
|
314
303
|
})));
|
|
315
304
|
}
|
|
316
|
-
var sstyles = sstyled
|
|
305
|
+
var sstyles = sstyled(props.styles);
|
|
317
306
|
var sConfirmIconStyles = sstyles.cn("SConfirmIcon", {});
|
|
318
|
-
return
|
|
307
|
+
return _ref10 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref10.cn("SAddon", _objectSpread({}, assignProps({
|
|
319
308
|
"onKeyDown": handleKeydown
|
|
320
|
-
}, _ref4))), hasChildren ? /* @__PURE__ */ React.createElement(Children,
|
|
321
|
-
"addonLeft": (
|
|
309
|
+
}, _ref4))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {})) : /* @__PURE__ */ React.createElement(ButtonLink, _ref10.cn("ButtonLink", {
|
|
310
|
+
"addonLeft": (_ref16 = props.icon) !== null && _ref16 !== void 0 ? _ref16 : CheckM,
|
|
322
311
|
"use": "secondary",
|
|
323
312
|
"onClick": handleConfirm,
|
|
324
313
|
"className": sConfirmIconStyles.className,
|
|
325
314
|
"style": sConfirmIconStyles.style,
|
|
326
315
|
"aria-label": title
|
|
327
316
|
})));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
var _ref5 = arguments[0],
|
|
317
|
+
}
|
|
318
|
+
function CancelControl(props) {
|
|
319
|
+
var _ref5 = arguments[0], _ref12, _props$title2, _ref17;
|
|
331
320
|
var SAddon = Box;
|
|
332
321
|
var Children = props.Children, hasChildren = props.children;
|
|
333
322
|
var title = (_props$title2 = props.title) !== null && _props$title2 !== void 0 ? _props$title2 : props.getI18nText("discard");
|
|
334
323
|
var handleCancel = React.useCallback(function(event) {
|
|
335
|
-
var _props$onCancel, _props$
|
|
336
|
-
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0
|
|
324
|
+
var _props$onCancel, _props$value;
|
|
325
|
+
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 || _props$onCancel.call(props, (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : "", event);
|
|
337
326
|
}, [props.onCancel, props.value]);
|
|
338
327
|
var handleKeydown = React.useCallback(function(event) {
|
|
339
328
|
if (event.key === "Enter" || event.key === " ") {
|
|
@@ -343,31 +332,32 @@ var CancelControl = function CancelControl2(props) {
|
|
|
343
332
|
}
|
|
344
333
|
}, [handleCancel]);
|
|
345
334
|
if (props.disabled) {
|
|
346
|
-
var
|
|
347
|
-
return
|
|
335
|
+
var _ref11;
|
|
336
|
+
return _ref11 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref11.cn("SAddon", _objectSpread({}, assignProps({}, _ref5))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})) : /* @__PURE__ */ React.createElement(CloseM, _ref11.cn("CloseM", {})));
|
|
348
337
|
}
|
|
349
|
-
var sstyles = sstyled
|
|
338
|
+
var sstyles = sstyled(props.styles);
|
|
350
339
|
var sCancelIconStyles = sstyles.cn("SCancelIcon", {});
|
|
351
|
-
return
|
|
340
|
+
return _ref12 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref12.cn("SAddon", _objectSpread({}, assignProps({
|
|
352
341
|
"onKeyDown": handleKeydown
|
|
353
|
-
}, _ref5))), hasChildren ? /* @__PURE__ */ React.createElement(Children,
|
|
342
|
+
}, _ref5))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref12.cn("Children", {})) : /* @__PURE__ */ React.createElement(ButtonLink, _ref12.cn("ButtonLink", {
|
|
354
343
|
"use": "secondary",
|
|
355
|
-
"addonLeft": (
|
|
344
|
+
"addonLeft": (_ref17 = props.icon) !== null && _ref17 !== void 0 ? _ref17 : CloseM,
|
|
356
345
|
"onClick": handleCancel,
|
|
357
346
|
"className": sCancelIconStyles.className,
|
|
358
347
|
"style": sCancelIconStyles.style,
|
|
359
348
|
"aria-label": title
|
|
360
349
|
})));
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
var _ref6 = arguments[0],
|
|
350
|
+
}
|
|
351
|
+
function NumberValue(props) {
|
|
352
|
+
var _ref6 = arguments[0], _ref13;
|
|
364
353
|
var SValue = InputNumber.Value;
|
|
365
|
-
return
|
|
366
|
-
}
|
|
354
|
+
return _ref13 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SValue, _ref13.cn("SValue", _objectSpread({}, assignProps({}, _ref6))));
|
|
355
|
+
}
|
|
356
|
+
;
|
|
367
357
|
function NumberControls(props) {
|
|
368
|
-
var _ref7 = arguments[0],
|
|
358
|
+
var _ref7 = arguments[0], _ref14;
|
|
369
359
|
var SControls = InputNumber.Controls;
|
|
370
|
-
return
|
|
360
|
+
return _ref14 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SControls, _ref14.cn("SControls", _objectSpread({}, assignProps({
|
|
371
361
|
"tag": InlineInput.Addon
|
|
372
362
|
}, _ref7))));
|
|
373
363
|
}
|