@semcore/inline-input 16.1.1-prerelease.4 → 16.1.2-prerelease.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 +6 -0
- package/README.md +1 -31
- package/lib/cjs/InlineInput.js +87 -90
- package/lib/cjs/InlineInput.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +2 -3
- package/lib/cjs/index.js.map +1 -1
- 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 +88 -90
- package/lib/es6/InlineInput.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- 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 +85 -85
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +6 -6
- package/package.json +12 -12
package/lib/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { ButtonLinkComponent } from '@semcore/button';\nimport type { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type React from 'react';\n\n/** @deprecated */\nexport interface IInlineInputProps extends InlineInputProps, UnknownProperties {}\nexport type InlineInputProps = BoxProps & {\n /**\n * Visual state of inline input\n * @default normal\n */\n state?: 'normal' | 'valid' | 'invalid';\n /**\n * Disabled input and shows spinner instead of confirm control\n * @default false\n */\n loading?: boolean;\n /**\n * Disabled input and controls\n * @default false\n */\n disabled?: boolean;\n /**\n * Fired with entered value when user clicks confirm control or hits `Enter` or `Space`\n */\n onConfirm?: (\n value: string,\n event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,\n ) => void;\n /**\n * Fired with value (or defaultValue) that was provided during component mount when user clicks cancel control or hits `Escape`\n */\n onCancel?: (\n prevValue: string,\n event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,\n ) => void;\n /**\n * Text value of input. Should be used with `onChange` property together\n */\n value?: string;\n /**\n * Initial text value of input\n */\n defaultValue?: string;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n /**\n * Gray text displayed in empty input\n */\n placeholder?: string;\n /**\n * defines callback (`onCancel` or `onConfirm`) triggered when `blur` event out of container fired\n * Triggered after all previous macrotasks completed (internally called inside of `setTimeout`)\n */\n onBlurBehavior?: 'cancel' | 'confirm' | 'none';\n locale?: string;\n};\n\n/** @deprecated */\nexport interface IInlineInputAddonProps extends InlineInputAddonProps, UnknownProperties {}\nexport type InlineInputAddonProps = BoxProps & {};\n/** @deprecated */\nexport interface IInlineInputValueProps extends InlineInputValueProps, UnknownProperties {}\nexport type InlineInputValueProps = BoxProps & {\n /**\n * id attribute of input tag\n */\n id?: string;\n /**\n * when `true`, element is focused immediately after mount\n */\n autoFocus?: boolean;\n /**\n * value of input tag\n */\n value?: string;\n /**\n * uncontrolled value of input tag\n */\n defaultValue?: string;\n /**\n * callback invoked on every change of input tag value\n */\n onChange?: (value: string, event: React.ChangeEvent) => void;\n /**\n * visual state of component\n */\n state?: 'normal' | 'valid' | 'invalid';\n /**\n * shows spinner in `InlineInput.ConfirmControl` and disables other interactive elements\n */\n loading?: boolean;\n /**\n * disables interactive elements\n */\n disabled?: boolean;\n /**\n * gray text in empty input tag\n */\n placeholder?: string;\n};\n/** @deprecated */\nexport interface IInlineInputConfirmControlProps\n extends InlineInputConfirmControlProps,\n UnknownProperties {}\nexport type InlineInputConfirmControlProps = BoxProps & {\n /**\n * Text of tooltip\n * @default Confirm\n */\n title?: string;\n /**\n * Icon component\n * @default CheckM\n */\n icon?: React.FC;\n};\n/** @deprecated */\nexport interface IInlineInputCancelControlProps\n extends InlineInputCancelControlProps,\n UnknownProperties {}\nexport type InlineInputCancelControlProps = BoxProps & {\n /**\n * Text of tooltip\n * @default Cancel\n */\n title?: string;\n /**\n * Icon component\n * @default CloseM\n */\n icon?: React.FC;\n};\n\ntype InlineInputCtx = {\n getAddonProps: PropGetterFn;\n getConfirmControlProps: PropGetterFn;\n getCancelControlProps: PropGetterFn;\n getValueProps: PropGetterFn;\n};\n\ndeclare const InlineInput: Intergalactic.Component<'div', InlineInputProps, InlineInputCtx> & {\n Addon: Intergalactic.Component<'div', InlineInputAddonProps, InlineInputProps>;\n Value: Intergalactic.Component<'input', InlineInputValueProps, InlineInputProps>;\n ConfirmControl: Intergalactic.Component<\n ButtonLinkComponent,\n InlineInputConfirmControlProps,\n InlineInputProps\n >;\n CancelControl: Intergalactic.Component<\n ButtonLinkComponent,\n InlineInputCancelControlProps,\n InlineInputProps\n >;\n NumberValue: Intergalactic.Component<'div', {}, InlineInputProps>;\n NumberControls: Intergalactic.Component<'div', {}, InlineInputProps>;\n};\nexport default InlineInput;\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _InlineInput = _interopRequireDefault(require("./InlineInput"));
|
|
9
|
-
var _default = _InlineInput["default"];
|
|
10
|
-
exports["default"] = _default;
|
|
9
|
+
var _default = exports["default"] = _InlineInput["default"];
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_InlineInput","_interopRequireDefault","require","_default","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_InlineInput","_interopRequireDefault","require","_default","exports","InlineInputBase"],"sources":["../../src/index.ts"],"sourcesContent":["import InlineInputBase from './InlineInput';\nexport default InlineInputBase;\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4C,IAAAC,QAAA,GAAAC,OAAA,cAC7BC,uBAAe","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -13,13 +13,13 @@ var _it = _interopRequireDefault(require("./it.json"));
|
|
|
13
13
|
var _ja = _interopRequireDefault(require("./ja.json"));
|
|
14
14
|
var _ko = _interopRequireDefault(require("./ko.json"));
|
|
15
15
|
var _nl = _interopRequireDefault(require("./nl.json"));
|
|
16
|
+
var _pl = _interopRequireDefault(require("./pl.json"));
|
|
16
17
|
var _pt = _interopRequireDefault(require("./pt.json"));
|
|
18
|
+
var _sv = _interopRequireDefault(require("./sv.json"));
|
|
17
19
|
var _tr = _interopRequireDefault(require("./tr.json"));
|
|
18
20
|
var _vi = _interopRequireDefault(require("./vi.json"));
|
|
19
21
|
var _zh = _interopRequireDefault(require("./zh.json"));
|
|
20
|
-
var
|
|
21
|
-
var _sv = _interopRequireDefault(require("./sv.json"));
|
|
22
|
-
var localizedMessages = {
|
|
22
|
+
var localizedMessages = exports.localizedMessages = {
|
|
23
23
|
de: _de["default"],
|
|
24
24
|
en: _en["default"],
|
|
25
25
|
es: _es["default"],
|
|
@@ -35,5 +35,4 @@ var localizedMessages = {
|
|
|
35
35
|
pl: _pl["default"],
|
|
36
36
|
sv: _sv["default"]
|
|
37
37
|
};
|
|
38
|
-
exports.localizedMessages = localizedMessages;
|
|
39
38
|
//# sourceMappingURL=__intergalactic-dynamic-locales.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["_de","_interopRequireDefault","require","_en","_es","_fr","_it","_ja","_ko","_nl","_pt","_tr","_vi","_zh","
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["_de","_interopRequireDefault","require","_en","_es","_fr","_it","_ja","_ko","_nl","_pl","_pt","_sv","_tr","_vi","_zh","localizedMessages","exports","de","en","es","fr","it","ja","ko","nl","pt","tr","vi","zh","pl","sv"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,GAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,GAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,GAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,GAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,GAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,GAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,GAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,GAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,GAAA,GAAAd,sBAAA,CAAAC,OAAA;AAEO,IAAMc,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA,cAAE;EACFC,EAAE,EAAFA;AACF,CAAC","ignoreList":[]}
|
package/lib/es6/InlineInput.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/isNativeReflectConstruct";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
10
|
import { assignProps as _assignProps9 } from "@semcore/core";
|
|
@@ -15,95 +16,94 @@ import { assignProps as _assignProps4 } from "@semcore/core";
|
|
|
15
16
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
16
17
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
17
18
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
18
|
-
|
|
19
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
import { ButtonLink } from '@semcore/button';
|
|
19
21
|
import { createComponent, Component, sstyled, Root } from '@semcore/core';
|
|
20
|
-
import { Box, InvalidStateBox } from '@semcore/flex-box';
|
|
21
22
|
import autoFocusEnhance from '@semcore/core/lib/utils/enhances/autoFocusEnhance';
|
|
23
|
+
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
24
|
+
import { hasParent } from '@semcore/core/lib/utils/hasParent';
|
|
25
|
+
import { Box, InvalidStateBox } from '@semcore/flex-box';
|
|
26
|
+
import CheckM from '@semcore/icon/Check/m';
|
|
27
|
+
import CloseM from '@semcore/icon/Close/m';
|
|
28
|
+
import InputNumber from '@semcore/input-number';
|
|
29
|
+
import Spin from '@semcore/spin';
|
|
30
|
+
import React from 'react';
|
|
22
31
|
/*!__reshadow-styles__:"./style/inline-input.shadow.css"*/
|
|
23
|
-
var style = (
|
|
32
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SInlineInput_cxe8f_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_cxe8f_gg_ .___SConfirmIcon_cxe8f_gg_{color:var(--intergalactic-icon-secondary-success, #00c192);cursor:pointer}@media (hover:hover){.___SInlineInput_cxe8f_gg_ .___SConfirmIcon_cxe8f_gg_:hover{color:var(--intergalactic-icon-secondary-success-hover-active, #049B75)}}.___SInlineInput_cxe8f_gg_ .___SCancelIcon_cxe8f_gg_{color:var(--intergalactic-icon-secondary-neutral, #a9abb6);cursor:pointer}@media (hover:hover){.___SInlineInput_cxe8f_gg_ .___SCancelIcon_cxe8f_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SInlineInput_cxe8f_gg_.__disabled_cxe8f_gg_{cursor:default;pointer-events:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SValue_cxe8f_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_cxe8f_gg_:focus{outline:0}.___SValue_cxe8f_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_cxe8f_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_cxe8f_gg_.__disabled_cxe8f_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_cxe8f_gg_::-webkit-inner-spin-button,.___SValue_cxe8f_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_cxe8f_gg_._type_number_cxe8f_gg_{-moz-appearance:textfield}.___SUnderline_cxe8f_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_cxe8f_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_cxe8f_gg_.__disabled_cxe8f_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SUnderline_cxe8f_gg_:has(input:focus-visible){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_cxe8f_gg_._state_valid_cxe8f_gg_ .___SUnderline_cxe8f_gg_{border-bottom-color:var(--intergalactic-border-success-active, #007c65)}.___SInlineInput_cxe8f_gg_._state_valid_cxe8f_gg_ .___SUnderline_cxe8f_gg_:has(input:focus-visible){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_cxe8f_gg_._state_invalid_cxe8f_gg_ .___SUnderline_cxe8f_gg_{border-bottom-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInlineInput_cxe8f_gg_._state_invalid_cxe8f_gg_ .___SUnderline_cxe8f_gg_:has(input:focus-visible){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_cxe8f_gg_:focus~.___SControls_cxe8f_gg_{display:flex}.___SInvalidPattern_cxe8f_gg_{margin-left:-1px;margin-top:-1px;border-radius:0;height:calc(100% - 3px)}", /*__inner_css_end__*/"cxe8f_gg_"),
|
|
24
33
|
/*__reshadow_css_end__*/
|
|
25
34
|
{
|
|
26
|
-
"__SInlineInput": "
|
|
27
|
-
"_disabled": "
|
|
28
|
-
"__SUnderline": "
|
|
29
|
-
"__SAddon": "
|
|
30
|
-
"_state_valid": "
|
|
31
|
-
"_state_invalid": "
|
|
32
|
-
"__SValue": "
|
|
33
|
-
"__SControls": "
|
|
34
|
-
"__SInvalidPattern": "
|
|
35
|
-
"__SConfirmIcon": "
|
|
36
|
-
"__SCancelIcon": "
|
|
37
|
-
"_type_number": "
|
|
35
|
+
"__SInlineInput": "___SInlineInput_cxe8f_gg_",
|
|
36
|
+
"_disabled": "__disabled_cxe8f_gg_",
|
|
37
|
+
"__SUnderline": "___SUnderline_cxe8f_gg_",
|
|
38
|
+
"__SAddon": "___SAddon_cxe8f_gg_",
|
|
39
|
+
"_state_valid": "_state_valid_cxe8f_gg_",
|
|
40
|
+
"_state_invalid": "_state_invalid_cxe8f_gg_",
|
|
41
|
+
"__SValue": "___SValue_cxe8f_gg_",
|
|
42
|
+
"__SControls": "___SControls_cxe8f_gg_",
|
|
43
|
+
"__SInvalidPattern": "___SInvalidPattern_cxe8f_gg_",
|
|
44
|
+
"__SConfirmIcon": "___SConfirmIcon_cxe8f_gg_",
|
|
45
|
+
"__SCancelIcon": "___SCancelIcon_cxe8f_gg_",
|
|
46
|
+
"_type_number": "_type_number_cxe8f_gg_"
|
|
38
47
|
});
|
|
39
|
-
import CheckM from '@semcore/icon/Check/m';
|
|
40
|
-
import CloseM from '@semcore/icon/Close/m';
|
|
41
|
-
import Spin from '@semcore/spin';
|
|
42
|
-
import { ButtonLink } from '@semcore/button';
|
|
43
48
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var x = _ref17.x,
|
|
49
|
-
y = _ref17.y,
|
|
50
|
-
rect = _ref17.rect;
|
|
49
|
+
var pointInsideOfRect = function pointInsideOfRect(_ref15) {
|
|
50
|
+
var x = _ref15.x,
|
|
51
|
+
y = _ref15.y,
|
|
52
|
+
rect = _ref15.rect;
|
|
51
53
|
return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
|
|
52
54
|
};
|
|
53
55
|
var InlineInputBase = /*#__PURE__*/function (_Component) {
|
|
54
|
-
_inherits(InlineInputBase, _Component);
|
|
55
|
-
var _super = _createSuper(InlineInputBase);
|
|
56
56
|
function InlineInputBase() {
|
|
57
57
|
var _this;
|
|
58
58
|
_classCallCheck(this, InlineInputBase);
|
|
59
59
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
60
|
args[_key] = arguments[_key];
|
|
61
61
|
}
|
|
62
|
-
_this =
|
|
63
|
-
_defineProperty(
|
|
64
|
-
_defineProperty(
|
|
65
|
-
_defineProperty(
|
|
66
|
-
_defineProperty(
|
|
67
|
-
_defineProperty(
|
|
68
|
-
_defineProperty(
|
|
69
|
-
_defineProperty(
|
|
62
|
+
_this = _callSuper(this, InlineInputBase, [].concat(args));
|
|
63
|
+
_defineProperty(_this, "rootRef", /*#__PURE__*/React.createRef());
|
|
64
|
+
_defineProperty(_this, "inputRef", /*#__PURE__*/React.createRef());
|
|
65
|
+
_defineProperty(_this, "inputHandlersRef", /*#__PURE__*/React.createRef());
|
|
66
|
+
_defineProperty(_this, "initValue", '');
|
|
67
|
+
_defineProperty(_this, "lastMouseDownPosition", null);
|
|
68
|
+
_defineProperty(_this, "lastHandledKeyboardEvent", -1);
|
|
69
|
+
_defineProperty(_this, "handleDocumentMouseDown", function (event) {
|
|
70
70
|
_this.lastMouseDownPosition = {
|
|
71
71
|
x: event.clientX,
|
|
72
72
|
y: event.clientY
|
|
73
73
|
};
|
|
74
74
|
_this.lastHandledKeyboardEvent = -1;
|
|
75
75
|
});
|
|
76
|
-
_defineProperty(
|
|
76
|
+
_defineProperty(_this, "handleDocumentKeyDown", function () {
|
|
77
77
|
_this.lastMouseDownPosition = null;
|
|
78
78
|
});
|
|
79
|
-
_defineProperty(
|
|
79
|
+
_defineProperty(_this, "increment", function (event) {
|
|
80
80
|
var _this$inputRef$curren, _this$inputRef$curren2, _this$inputRef$curren3, _this$inputHandlersRe, _this$inputRef$curren4;
|
|
81
81
|
// https://stackoverflow.com/questions/68010124/safari-number-input-stepup-stepdown-not-functioning-with-empty-value
|
|
82
82
|
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';
|
|
83
|
-
(_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0
|
|
84
|
-
(_this$inputHandlersRe = _this.inputHandlersRef.current) === null || _this$inputHandlersRe === void 0
|
|
83
|
+
(_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
|
+
(_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);
|
|
85
85
|
});
|
|
86
|
-
_defineProperty(
|
|
86
|
+
_defineProperty(_this, "decrement", function (event) {
|
|
87
87
|
var _this$inputRef$curren5, _this$inputRef$curren6, _this$inputRef$curren7, _this$inputHandlersRe2, _this$inputRef$curren8;
|
|
88
88
|
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';
|
|
89
|
-
(_this$inputRef$curren6 = _this.inputRef.current) === null || _this$inputRef$curren6 === void 0
|
|
90
|
-
(_this$inputHandlersRe2 = _this.inputHandlersRef.current) === null || _this$inputHandlersRe2 === void 0
|
|
89
|
+
(_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);
|
|
90
|
+
(_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);
|
|
91
91
|
});
|
|
92
|
-
_defineProperty(
|
|
92
|
+
_defineProperty(_this, "handleMouseDownAddon", function (event) {
|
|
93
93
|
var _this$inputRef$curren9;
|
|
94
94
|
event.preventDefault();
|
|
95
|
-
(_this$inputRef$curren9 = _this.inputRef.current) === null || _this$inputRef$curren9 === void 0
|
|
95
|
+
(_this$inputRef$curren9 = _this.inputRef.current) === null || _this$inputRef$curren9 === void 0 || _this$inputRef$curren9.focus();
|
|
96
96
|
});
|
|
97
|
-
_defineProperty(
|
|
97
|
+
_defineProperty(_this, "handleConfirm", function (text, event) {
|
|
98
98
|
var _this$asProps$onConfi, _this$asProps;
|
|
99
|
-
(_this$asProps$onConfi = (_this$asProps = _this.asProps).onConfirm) === null || _this$asProps$onConfi === void 0
|
|
99
|
+
(_this$asProps$onConfi = (_this$asProps = _this.asProps).onConfirm) === null || _this$asProps$onConfi === void 0 || _this$asProps$onConfi.call(_this$asProps, text, event);
|
|
100
100
|
});
|
|
101
|
-
_defineProperty(
|
|
101
|
+
_defineProperty(_this, "handleCancel", function (prevText, event) {
|
|
102
102
|
var _this$asProps$onCance, _this$asProps2;
|
|
103
|
-
(_this$asProps$onCance = (_this$asProps2 = _this.asProps).onCancel) === null || _this$asProps$onCance === void 0
|
|
103
|
+
(_this$asProps$onCance = (_this$asProps2 = _this.asProps).onCancel) === null || _this$asProps$onCance === void 0 || _this$asProps$onCance.call(_this$asProps2, prevText, event);
|
|
104
104
|
});
|
|
105
|
-
_defineProperty(
|
|
106
|
-
var _this$inputRef$
|
|
105
|
+
_defineProperty(_this, "handleBlur", function (event) {
|
|
106
|
+
var _this$inputRef$curren0, _this$inputRef$curren1;
|
|
107
107
|
var _this$asProps3 = _this.asProps,
|
|
108
108
|
onConfirm = _this$asProps3.onConfirm,
|
|
109
109
|
onCancel = _this$asProps3.onCancel,
|
|
@@ -124,26 +124,27 @@ var InlineInputBase = /*#__PURE__*/function (_Component) {
|
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
if (onBlurBehavior === 'confirm') onConfirm === null || onConfirm === void 0
|
|
128
|
-
if (onBlurBehavior === 'cancel') onCancel === null || onCancel === void 0
|
|
127
|
+
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);
|
|
128
|
+
if (onBlurBehavior === 'cancel') onCancel === null || onCancel === void 0 || onCancel(_this.initValue, event);
|
|
129
129
|
});
|
|
130
|
-
_defineProperty(
|
|
130
|
+
_defineProperty(_this, "handleKeyDown", function (event) {
|
|
131
131
|
var _this$asProps4 = _this.asProps,
|
|
132
132
|
onConfirm = _this$asProps4.onConfirm,
|
|
133
133
|
onCancel = _this$asProps4.onCancel;
|
|
134
134
|
if (event.key === 'Enter') {
|
|
135
|
-
var _this$inputRef$
|
|
136
|
-
onConfirm === null || onConfirm === void 0
|
|
135
|
+
var _this$inputRef$curren10, _this$inputRef$curren11;
|
|
136
|
+
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);
|
|
137
137
|
_this.lastHandledKeyboardEvent = Date.now();
|
|
138
138
|
}
|
|
139
139
|
if (event.key === 'Escape') {
|
|
140
|
-
onCancel === null || onCancel === void 0
|
|
140
|
+
onCancel === null || onCancel === void 0 || onCancel(_this.initValue, event);
|
|
141
141
|
_this.lastHandledKeyboardEvent = Date.now();
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
return _this;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
_inherits(InlineInputBase, _Component);
|
|
147
|
+
return _createClass(InlineInputBase, [{
|
|
147
148
|
key: "componentDidMount",
|
|
148
149
|
value: function componentDidMount() {
|
|
149
150
|
if (!this.asProps.onBlurBehavior) return;
|
|
@@ -167,12 +168,12 @@ var InlineInputBase = /*#__PURE__*/function (_Component) {
|
|
|
167
168
|
}, {
|
|
168
169
|
key: "getConfirmControlProps",
|
|
169
170
|
value: function getConfirmControlProps() {
|
|
170
|
-
var _this$inputRef$
|
|
171
|
+
var _this$inputRef$curren12;
|
|
171
172
|
var _this$asProps5 = this.asProps,
|
|
172
173
|
loading = _this$asProps5.loading,
|
|
173
174
|
getI18nText = _this$asProps5.getI18nText;
|
|
174
175
|
return {
|
|
175
|
-
value: (_this$inputRef$
|
|
176
|
+
value: (_this$inputRef$curren12 = this.inputRef.current) === null || _this$inputRef$curren12 === void 0 ? void 0 : _this$inputRef$curren12.value,
|
|
176
177
|
loading: loading,
|
|
177
178
|
onConfirm: this.handleConfirm,
|
|
178
179
|
getI18nText: getI18nText
|
|
@@ -245,7 +246,6 @@ var InlineInputBase = /*#__PURE__*/function (_Component) {
|
|
|
245
246
|
}, _ref))), /*#__PURE__*/React.createElement(SUnderline, _ref8.cn("SUnderline", {}), state === 'invalid' && /*#__PURE__*/React.createElement(SInvalidPattern, _ref8.cn("SInvalidPattern", {})), /*#__PURE__*/React.createElement(Children, _ref8.cn("Children", {}))));
|
|
246
247
|
}
|
|
247
248
|
}]);
|
|
248
|
-
return InlineInputBase;
|
|
249
249
|
}(Component);
|
|
250
250
|
_defineProperty(InlineInputBase, "displayName", 'InlineInput');
|
|
251
251
|
_defineProperty(InlineInputBase, "enhance", [i18nEnhance(localizedMessages)]);
|
|
@@ -257,13 +257,12 @@ _defineProperty(InlineInputBase, "defaultProps", {
|
|
|
257
257
|
});
|
|
258
258
|
_defineProperty(InlineInputBase, "style", style);
|
|
259
259
|
var Value = /*#__PURE__*/function (_Component2) {
|
|
260
|
-
_inherits(Value, _Component2);
|
|
261
|
-
var _super2 = _createSuper(Value);
|
|
262
260
|
function Value() {
|
|
263
261
|
_classCallCheck(this, Value);
|
|
264
|
-
return
|
|
262
|
+
return _callSuper(this, Value, arguments);
|
|
265
263
|
}
|
|
266
|
-
|
|
264
|
+
_inherits(Value, _Component2);
|
|
265
|
+
return _createClass(Value, [{
|
|
267
266
|
key: "uncontrolledProps",
|
|
268
267
|
value: function uncontrolledProps() {
|
|
269
268
|
return {
|
|
@@ -284,7 +283,6 @@ var Value = /*#__PURE__*/function (_Component2) {
|
|
|
284
283
|
}, _ref2))));
|
|
285
284
|
}
|
|
286
285
|
}]);
|
|
287
|
-
return Value;
|
|
288
286
|
}(Component);
|
|
289
287
|
_defineProperty(Value, "defaultProps", {
|
|
290
288
|
defaultValue: ''
|
|
@@ -293,22 +291,22 @@ _defineProperty(Value, "enhance", [autoFocusEnhance()]);
|
|
|
293
291
|
_defineProperty(Value, "hoistProps", ['disabled']);
|
|
294
292
|
var Addon = function Addon(props) {
|
|
295
293
|
var _ref3 = arguments[0],
|
|
296
|
-
|
|
294
|
+
_ref0;
|
|
297
295
|
var SAddon = Box;
|
|
298
|
-
return
|
|
296
|
+
return _ref0 = sstyled(props.styles), /*#__PURE__*/React.createElement(SAddon, _ref0.cn("SAddon", _objectSpread({}, _assignProps3({}, _ref3))));
|
|
299
297
|
};
|
|
300
298
|
var ConfirmControl = function ConfirmControl(props) {
|
|
301
299
|
var _ref4 = arguments[0],
|
|
302
|
-
|
|
300
|
+
_ref10,
|
|
303
301
|
_props$title,
|
|
304
|
-
|
|
302
|
+
_ref16;
|
|
305
303
|
var SAddon = Box;
|
|
306
304
|
var Children = props.Children,
|
|
307
305
|
hasChildren = props.children;
|
|
308
306
|
var title = (_props$title = props.title) !== null && _props$title !== void 0 ? _props$title : props.getI18nText('confirm');
|
|
309
307
|
var handleConfirm = React.useCallback(function (event) {
|
|
310
308
|
var _props$onConfirm, _props$value;
|
|
311
|
-
(_props$onConfirm = props.onConfirm) === null || _props$onConfirm === void 0
|
|
309
|
+
(_props$onConfirm = props.onConfirm) === null || _props$onConfirm === void 0 || _props$onConfirm.call(props, (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '', event);
|
|
312
310
|
}, [props.onConfirm, props.value]);
|
|
313
311
|
var handleKeydown = React.useCallback(function (event) {
|
|
314
312
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -318,17 +316,17 @@ var ConfirmControl = function ConfirmControl(props) {
|
|
|
318
316
|
}
|
|
319
317
|
}, [handleConfirm]);
|
|
320
318
|
if (props.loading) {
|
|
321
|
-
var
|
|
322
|
-
return
|
|
319
|
+
var _ref1;
|
|
320
|
+
return _ref1 = sstyled(props.styles), /*#__PURE__*/React.createElement(SAddon, _ref1.cn("SAddon", _objectSpread({}, _assignProps4({}, _ref4))), hasChildren ? /*#__PURE__*/React.createElement(Children, _ref1.cn("Children", {})) : /*#__PURE__*/React.createElement(Spin, _ref1.cn("Spin", {
|
|
323
321
|
"size": 'xs'
|
|
324
322
|
})));
|
|
325
323
|
}
|
|
326
324
|
var sstyles = sstyled(props.styles);
|
|
327
325
|
var sConfirmIconStyles = sstyles.cn('SConfirmIcon', {});
|
|
328
|
-
return
|
|
326
|
+
return _ref10 = sstyled(props.styles), /*#__PURE__*/React.createElement(SAddon, _ref10.cn("SAddon", _objectSpread({}, _assignProps5({
|
|
329
327
|
"onKeyDown": handleKeydown
|
|
330
|
-
}, _ref4))), hasChildren ? /*#__PURE__*/React.createElement(Children,
|
|
331
|
-
"addonLeft": (
|
|
328
|
+
}, _ref4))), hasChildren ? /*#__PURE__*/React.createElement(Children, _ref10.cn("Children", {})) : /*#__PURE__*/React.createElement(ButtonLink, _ref10.cn("ButtonLink", {
|
|
329
|
+
"addonLeft": (_ref16 = props.icon) !== null && _ref16 !== void 0 ? _ref16 : CheckM,
|
|
332
330
|
"use": 'secondary',
|
|
333
331
|
"onClick": handleConfirm,
|
|
334
332
|
"className": sConfirmIconStyles.className,
|
|
@@ -338,16 +336,16 @@ var ConfirmControl = function ConfirmControl(props) {
|
|
|
338
336
|
};
|
|
339
337
|
var CancelControl = function CancelControl(props) {
|
|
340
338
|
var _ref5 = arguments[0],
|
|
341
|
-
|
|
339
|
+
_ref12,
|
|
342
340
|
_props$title2,
|
|
343
|
-
|
|
341
|
+
_ref17;
|
|
344
342
|
var SAddon = Box;
|
|
345
343
|
var Children = props.Children,
|
|
346
344
|
hasChildren = props.children;
|
|
347
345
|
var title = (_props$title2 = props.title) !== null && _props$title2 !== void 0 ? _props$title2 : props.getI18nText('discard');
|
|
348
346
|
var handleCancel = React.useCallback(function (event) {
|
|
349
347
|
var _props$onCancel, _props$value2;
|
|
350
|
-
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0
|
|
348
|
+
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 || _props$onCancel.call(props, (_props$value2 = props.value) !== null && _props$value2 !== void 0 ? _props$value2 : '', event);
|
|
351
349
|
}, [props.onCancel, props.value]);
|
|
352
350
|
var handleKeydown = React.useCallback(function (event) {
|
|
353
351
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -357,16 +355,16 @@ var CancelControl = function CancelControl(props) {
|
|
|
357
355
|
}
|
|
358
356
|
}, [handleCancel]);
|
|
359
357
|
if (props.disabled) {
|
|
360
|
-
var
|
|
361
|
-
return
|
|
358
|
+
var _ref11;
|
|
359
|
+
return _ref11 = sstyled(props.styles), /*#__PURE__*/React.createElement(SAddon, _ref11.cn("SAddon", _objectSpread({}, _assignProps6({}, _ref5))), hasChildren ? /*#__PURE__*/React.createElement(Children, _ref11.cn("Children", {})) : /*#__PURE__*/React.createElement(CloseM, _ref11.cn("CloseM", {})));
|
|
362
360
|
}
|
|
363
361
|
var sstyles = sstyled(props.styles);
|
|
364
362
|
var sCancelIconStyles = sstyles.cn('SCancelIcon', {});
|
|
365
|
-
return
|
|
363
|
+
return _ref12 = sstyled(props.styles), /*#__PURE__*/React.createElement(SAddon, _ref12.cn("SAddon", _objectSpread({}, _assignProps7({
|
|
366
364
|
"onKeyDown": handleKeydown
|
|
367
|
-
}, _ref5))), hasChildren ? /*#__PURE__*/React.createElement(Children,
|
|
365
|
+
}, _ref5))), hasChildren ? /*#__PURE__*/React.createElement(Children, _ref12.cn("Children", {})) : /*#__PURE__*/React.createElement(ButtonLink, _ref12.cn("ButtonLink", {
|
|
368
366
|
"use": 'secondary',
|
|
369
|
-
"addonLeft": (
|
|
367
|
+
"addonLeft": (_ref17 = props.icon) !== null && _ref17 !== void 0 ? _ref17 : CloseM,
|
|
370
368
|
"onClick": handleCancel,
|
|
371
369
|
"className": sCancelIconStyles.className,
|
|
372
370
|
"style": sCancelIconStyles.style,
|
|
@@ -375,15 +373,15 @@ var CancelControl = function CancelControl(props) {
|
|
|
375
373
|
};
|
|
376
374
|
var NumberValue = function NumberValue(props) {
|
|
377
375
|
var _ref6 = arguments[0],
|
|
378
|
-
|
|
376
|
+
_ref13;
|
|
379
377
|
var SValue = InputNumber.Value;
|
|
380
|
-
return
|
|
378
|
+
return _ref13 = sstyled(props.styles), /*#__PURE__*/React.createElement(SValue, _ref13.cn("SValue", _objectSpread({}, _assignProps8({}, _ref6))));
|
|
381
379
|
};
|
|
382
380
|
function NumberControls(props) {
|
|
383
381
|
var _ref7 = arguments[0],
|
|
384
|
-
|
|
382
|
+
_ref14;
|
|
385
383
|
var SControls = InputNumber.Controls;
|
|
386
|
-
return
|
|
384
|
+
return _ref14 = sstyled(props.styles), /*#__PURE__*/React.createElement(SControls, _ref14.cn("SControls", _objectSpread({}, _assignProps9({
|
|
387
385
|
"tag": InlineInput.Addon
|
|
388
386
|
}, _ref7))));
|
|
389
387
|
}
|