@semcore/inline-input 3.0.23 → 3.0.24
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/lib/cjs/InlineInput.js +12 -12
- package/lib/cjs/index.d.js +2 -0
- package/lib/cjs/index.d.js.map +1 -0
- package/lib/es6/InlineInput.js +12 -12
- package/lib/es6/index.d.js +2 -0
- package/lib/es6/index.d.js.map +1 -0
- package/package.json +3 -2
- package/lib/cjs/index.d.ts +0 -163
- package/lib/es6/index.d.ts +0 -163
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.0.24] - 2022-10-04
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/flex-box` [4.5.11 ~> 4.5.12], `@semcore/icon` [2.32.1 ~> 2.32.2], `@semcore/utils` [3.37.1 ~> 3.37.2]).
|
|
10
|
+
|
|
5
11
|
## [3.0.23] - 2022-09-29
|
|
6
12
|
|
|
7
13
|
### Changed
|
package/lib/cjs/InlineInput.js
CHANGED
|
@@ -56,21 +56,21 @@ var style = (
|
|
|
56
56
|
/*__reshadow_css_start__*/
|
|
57
57
|
_core.sstyled.insert(
|
|
58
58
|
/*__inner_css_start__*/
|
|
59
|
-
".
|
|
59
|
+
".___SInlineInput_1cx7d_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:#ffffff}.___SInlineInput_1cx7d_gg_.__disabled_1cx7d_gg_{cursor:default;pointer-events:none;opacity:0.3}.___SValue_1cx7d_gg_{min-width:0;width:100%;height:100%;padding:0 4px;border:none;box-sizing:border-box;color:#191b23;font-size:inherit;line-height:1.2;text-overflow:ellipsis;font-family:inherit;background:transparent;min-height:1em}.___SValue_1cx7d_gg_:focus{outline:none}.___SValue_1cx7d_gg_::-moz-placeholder{color:#a9abb6}.___SValue_1cx7d_gg_::placeholder{color:#a9abb6}.___SValue_1cx7d_gg_.__disabled_1cx7d_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SUnderline_1cx7d_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 #c4c7cf}.___SAddon_1cx7d_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;height:100%;color:#a9abb6;padding:0 4px}.___SAddon_1cx7d_gg_.__disabled_1cx7d_gg_{opacity:0.3;cursor:default;pointer-events:none}.___SConfirmIcon_1cx7d_gg_{color:#00c192;cursor:pointer}.___SConfirmIcon_1cx7d_gg_:hover{color:#009f81}.___SCancelIcon_1cx7d_gg_{color:#a9abb6;cursor:pointer}.___SCancelIcon_1cx7d_gg_:hover{color:#8a8e9b}.___SInlineInput_1cx7d_gg_.__focused_1cx7d_gg_{z-index:1}.___SInlineInput_1cx7d_gg_.__focused_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#008ff8;box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}.___SInlineInput_1cx7d_gg_._state_valid_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#59ddaa}.___SInlineInput_1cx7d_gg_._state_valid_1cx7d_gg_.__focused_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#009f81;box-shadow:0px 0px 0px 3px rgba(0, 159, 129, 0.2)}.___SInlineInput_1cx7d_gg_._state_invalid_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#ffaeb5}.___SInlineInput_1cx7d_gg_._state_invalid_1cx7d_gg_.__focused_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#ff4953;box-shadow:0px 0px 0px 3px rgba(255, 73, 83, 0.2)}"
|
|
60
60
|
/*__inner_css_end__*/
|
|
61
|
-
, "
|
|
61
|
+
, "1cx7d_gg_")
|
|
62
62
|
/*__reshadow_css_end__*/
|
|
63
63
|
, {
|
|
64
|
-
"__SInlineInput": "
|
|
65
|
-
"_disabled": "
|
|
66
|
-
"__SValue": "
|
|
67
|
-
"__SUnderline": "
|
|
68
|
-
"__SAddon": "
|
|
69
|
-
"__SConfirmIcon": "
|
|
70
|
-
"__SCancelIcon": "
|
|
71
|
-
"_focused": "
|
|
72
|
-
"_state_valid": "
|
|
73
|
-
"_state_invalid": "
|
|
64
|
+
"__SInlineInput": "___SInlineInput_1cx7d_gg_",
|
|
65
|
+
"_disabled": "__disabled_1cx7d_gg_",
|
|
66
|
+
"__SValue": "___SValue_1cx7d_gg_",
|
|
67
|
+
"__SUnderline": "___SUnderline_1cx7d_gg_",
|
|
68
|
+
"__SAddon": "___SAddon_1cx7d_gg_",
|
|
69
|
+
"__SConfirmIcon": "___SConfirmIcon_1cx7d_gg_",
|
|
70
|
+
"__SCancelIcon": "___SCancelIcon_1cx7d_gg_",
|
|
71
|
+
"_focused": "__focused_1cx7d_gg_",
|
|
72
|
+
"_state_valid": "_state_valid_1cx7d_gg_",
|
|
73
|
+
"_state_invalid": "_state_invalid_1cx7d_gg_"
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
var isFocusOutsideOf = function isFocusOutsideOf(element) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\n/* utils type */\ntype CProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?:\n | ((props: Props & Ctx, handlers: UCProps) => React.ReactNode)\n | React.ReactNode\n | React.ReactNode[];\n};\n/* utils type */\n\nexport interface IInlineInputProps extends IBoxProps {\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 * Fired on every input value change. Should be used with `value` property together\n */\n onChange?: (value: string, event: React.ChangeEvent) => void;\n /**\n * Fired when browser focus leaves component.\n */\n onBlur?: (event: React.FocusEvent) => void;\n /**\n * Fired when browser focus enters component.\n */\n onFocus?: (event: React.FocusEvent) => void;\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';\n}\n\nexport interface IInlineInputAddonProps extends IBoxProps {}\nexport interface IInlineInputValueProps extends IBoxProps {\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}\nexport interface IInlineInputConfirmControlProps extends IBoxProps {\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}\nexport interface IInlineInputCancelControlProps extends IBoxProps {\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\ninterface IInlineInputCtx {\n getAddonProps: PropGetterFn;\n getConfirmControlProps: PropGetterFn;\n getCancelControlProps: PropGetterFn;\n getValueProps: PropGetterFn;\n}\n\ndeclare const InlineInput: (<T>(\n props: CProps<IInlineInputProps & T, IInlineInputCtx>,\n) => React.ReactElement) & {\n Addon: <T>(props: CProps<IInlineInputAddonProps & T, IInlineInputProps>) => React.ReactElement;\n Value: <T>(props: CProps<IInlineInputValueProps & T, IInlineInputProps>) => React.ReactElement;\n ConfirmControl: <T>(\n props: CProps<IInlineInputConfirmControlProps & T, IInlineInputProps>,\n ) => React.ReactElement;\n CancelControl: <T>(\n props: CProps<IInlineInputCancelControlProps & T, IInlineInputProps>,\n ) => React.ReactElement;\n};\nexport default InlineInput;\n"],"mappings":""}
|
package/lib/es6/InlineInput.js
CHANGED
|
@@ -33,21 +33,21 @@ var style = (
|
|
|
33
33
|
/*__reshadow_css_start__*/
|
|
34
34
|
_sstyled.insert(
|
|
35
35
|
/*__inner_css_start__*/
|
|
36
|
-
".
|
|
36
|
+
".___SInlineInput_1cx7d_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:#ffffff}.___SInlineInput_1cx7d_gg_.__disabled_1cx7d_gg_{cursor:default;pointer-events:none;opacity:0.3}.___SValue_1cx7d_gg_{min-width:0;width:100%;height:100%;padding:0 4px;border:none;box-sizing:border-box;color:#191b23;font-size:inherit;line-height:1.2;text-overflow:ellipsis;font-family:inherit;background:transparent;min-height:1em}.___SValue_1cx7d_gg_:focus{outline:none}.___SValue_1cx7d_gg_::-moz-placeholder{color:#a9abb6}.___SValue_1cx7d_gg_::placeholder{color:#a9abb6}.___SValue_1cx7d_gg_.__disabled_1cx7d_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SUnderline_1cx7d_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 #c4c7cf}.___SAddon_1cx7d_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;height:100%;color:#a9abb6;padding:0 4px}.___SAddon_1cx7d_gg_.__disabled_1cx7d_gg_{opacity:0.3;cursor:default;pointer-events:none}.___SConfirmIcon_1cx7d_gg_{color:#00c192;cursor:pointer}.___SConfirmIcon_1cx7d_gg_:hover{color:#009f81}.___SCancelIcon_1cx7d_gg_{color:#a9abb6;cursor:pointer}.___SCancelIcon_1cx7d_gg_:hover{color:#8a8e9b}.___SInlineInput_1cx7d_gg_.__focused_1cx7d_gg_{z-index:1}.___SInlineInput_1cx7d_gg_.__focused_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#008ff8;box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}.___SInlineInput_1cx7d_gg_._state_valid_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#59ddaa}.___SInlineInput_1cx7d_gg_._state_valid_1cx7d_gg_.__focused_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#009f81;box-shadow:0px 0px 0px 3px rgba(0, 159, 129, 0.2)}.___SInlineInput_1cx7d_gg_._state_invalid_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#ffaeb5}.___SInlineInput_1cx7d_gg_._state_invalid_1cx7d_gg_.__focused_1cx7d_gg_ .___SUnderline_1cx7d_gg_{border-bottom-color:#ff4953;box-shadow:0px 0px 0px 3px rgba(255, 73, 83, 0.2)}"
|
|
37
37
|
/*__inner_css_end__*/
|
|
38
|
-
, "
|
|
38
|
+
, "1cx7d_gg_")
|
|
39
39
|
/*__reshadow_css_end__*/
|
|
40
40
|
, {
|
|
41
|
-
"__SInlineInput": "
|
|
42
|
-
"_disabled": "
|
|
43
|
-
"__SValue": "
|
|
44
|
-
"__SUnderline": "
|
|
45
|
-
"__SAddon": "
|
|
46
|
-
"__SConfirmIcon": "
|
|
47
|
-
"__SCancelIcon": "
|
|
48
|
-
"_focused": "
|
|
49
|
-
"_state_valid": "
|
|
50
|
-
"_state_invalid": "
|
|
41
|
+
"__SInlineInput": "___SInlineInput_1cx7d_gg_",
|
|
42
|
+
"_disabled": "__disabled_1cx7d_gg_",
|
|
43
|
+
"__SValue": "___SValue_1cx7d_gg_",
|
|
44
|
+
"__SUnderline": "___SUnderline_1cx7d_gg_",
|
|
45
|
+
"__SAddon": "___SAddon_1cx7d_gg_",
|
|
46
|
+
"__SConfirmIcon": "___SConfirmIcon_1cx7d_gg_",
|
|
47
|
+
"__SCancelIcon": "___SCancelIcon_1cx7d_gg_",
|
|
48
|
+
"_focused": "__focused_1cx7d_gg_",
|
|
49
|
+
"_state_valid": "_state_valid_1cx7d_gg_",
|
|
50
|
+
"_state_invalid": "_state_invalid_1cx7d_gg_"
|
|
51
51
|
});
|
|
52
52
|
import CheckM from '@semcore/icon/Check/m';
|
|
53
53
|
import CloseM from '@semcore/icon/Close/m';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\n/* utils type */\ntype CProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?:\n | ((props: Props & Ctx, handlers: UCProps) => React.ReactNode)\n | React.ReactNode\n | React.ReactNode[];\n};\n/* utils type */\n\nexport interface IInlineInputProps extends IBoxProps {\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 * Fired on every input value change. Should be used with `value` property together\n */\n onChange?: (value: string, event: React.ChangeEvent) => void;\n /**\n * Fired when browser focus leaves component.\n */\n onBlur?: (event: React.FocusEvent) => void;\n /**\n * Fired when browser focus enters component.\n */\n onFocus?: (event: React.FocusEvent) => void;\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';\n}\n\nexport interface IInlineInputAddonProps extends IBoxProps {}\nexport interface IInlineInputValueProps extends IBoxProps {\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}\nexport interface IInlineInputConfirmControlProps extends IBoxProps {\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}\nexport interface IInlineInputCancelControlProps extends IBoxProps {\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\ninterface IInlineInputCtx {\n getAddonProps: PropGetterFn;\n getConfirmControlProps: PropGetterFn;\n getCancelControlProps: PropGetterFn;\n getValueProps: PropGetterFn;\n}\n\ndeclare const InlineInput: (<T>(\n props: CProps<IInlineInputProps & T, IInlineInputCtx>,\n) => React.ReactElement) & {\n Addon: <T>(props: CProps<IInlineInputAddonProps & T, IInlineInputProps>) => React.ReactElement;\n Value: <T>(props: CProps<IInlineInputValueProps & T, IInlineInputProps>) => React.ReactElement;\n ConfirmControl: <T>(\n props: CProps<IInlineInputConfirmControlProps & T, IInlineInputProps>,\n ) => React.ReactElement;\n CancelControl: <T>(\n props: CProps<IInlineInputCancelControlProps & T, IInlineInputProps>,\n ) => React.ReactElement;\n};\nexport default InlineInput;\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/inline-input",
|
|
3
3
|
"description": "Semrush Input Component",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.24",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "
|
|
12
|
+
"build": "pnpm semcore-builder --source=js",
|
|
13
13
|
"test": "jest"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@semcore/utils": "^3.31.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@types/react": "16.8 - 17",
|
|
23
24
|
"@semcore/button": "*",
|
|
24
25
|
"@semcore/jest-preset-ui": "*",
|
|
25
26
|
"@semcore/spin": "*",
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PropGetterFn } from '@semcore/core';
|
|
3
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
4
|
-
|
|
5
|
-
/* utils type */
|
|
6
|
-
type CProps<Props, Ctx = {}, UCProps = {}> = Props & {
|
|
7
|
-
children?:
|
|
8
|
-
| ((props: Props & Ctx, handlers: UCProps) => React.ReactNode)
|
|
9
|
-
| React.ReactNode
|
|
10
|
-
| React.ReactNode[];
|
|
11
|
-
};
|
|
12
|
-
/* utils type */
|
|
13
|
-
|
|
14
|
-
export interface IInlineInputProps extends IBoxProps {
|
|
15
|
-
/**
|
|
16
|
-
* Visual state of inline input
|
|
17
|
-
* @default normal
|
|
18
|
-
*/
|
|
19
|
-
state?: 'normal' | 'valid' | 'invalid';
|
|
20
|
-
/**
|
|
21
|
-
* Disabled input and shows spinner instead of confirm control
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
loading?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Disabled input and controls
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Fired with entered value when user clicks confirm control or hits `Enter` or `Space`
|
|
32
|
-
*/
|
|
33
|
-
onConfirm?: (
|
|
34
|
-
value: string,
|
|
35
|
-
event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,
|
|
36
|
-
) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Fired with value (or defaultValue) that was provided during component mount when user clicks cancel control or hits `Escape`
|
|
39
|
-
*/
|
|
40
|
-
onCancel?: (
|
|
41
|
-
prevValue: string,
|
|
42
|
-
event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,
|
|
43
|
-
) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Text value of input. Should be used with `onChange` property together
|
|
46
|
-
*/
|
|
47
|
-
value?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Initial text value of input
|
|
50
|
-
*/
|
|
51
|
-
defaultValue?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Makes component to catch browser focus on component mount
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
autoFocus?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Gray text displayed in empty input
|
|
59
|
-
*/
|
|
60
|
-
placeholder?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Fired on every input value change. Should be used with `value` property together
|
|
63
|
-
*/
|
|
64
|
-
onChange?: (value: string, event: React.ChangeEvent) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Fired when browser focus leaves component.
|
|
67
|
-
*/
|
|
68
|
-
onBlur?: (event: React.FocusEvent) => void;
|
|
69
|
-
/**
|
|
70
|
-
* Fired when browser focus enters component.
|
|
71
|
-
*/
|
|
72
|
-
onFocus?: (event: React.FocusEvent) => void;
|
|
73
|
-
/**
|
|
74
|
-
* defines callback (`onCancel` or `onConfirm`) triggered when `blur` event out of container fired
|
|
75
|
-
* Triggered after all previous macrotasks completed (internally called inside of `setTimeout`)
|
|
76
|
-
*/
|
|
77
|
-
onBlurBehavior?: 'cancel' | 'confirm';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface IInlineInputAddonProps extends IBoxProps {}
|
|
81
|
-
export interface IInlineInputValueProps extends IBoxProps {
|
|
82
|
-
/**
|
|
83
|
-
* id attribute of input tag
|
|
84
|
-
*/
|
|
85
|
-
id?: string;
|
|
86
|
-
/**
|
|
87
|
-
* when `true`, element is focused immediately after mount
|
|
88
|
-
*/
|
|
89
|
-
autoFocus?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* value of input tag
|
|
92
|
-
*/
|
|
93
|
-
value?: string;
|
|
94
|
-
/**
|
|
95
|
-
* uncontrolled value of input tag
|
|
96
|
-
*/
|
|
97
|
-
defaultValue?: string;
|
|
98
|
-
/**
|
|
99
|
-
* callback invoked on every change of input tag value
|
|
100
|
-
*/
|
|
101
|
-
onChange?: (value: string, event: React.ChangeEvent) => void;
|
|
102
|
-
/**
|
|
103
|
-
* visual state of component
|
|
104
|
-
*/
|
|
105
|
-
state?: 'normal' | 'valid' | 'invalid';
|
|
106
|
-
/**
|
|
107
|
-
* shows spinner in `InlineInput.ConfirmControl` and disables other interactive elements
|
|
108
|
-
*/
|
|
109
|
-
loading?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* disables interactive elements
|
|
112
|
-
*/
|
|
113
|
-
disabled?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* gray text in empty input tag
|
|
116
|
-
*/
|
|
117
|
-
placeholder?: string;
|
|
118
|
-
}
|
|
119
|
-
export interface IInlineInputConfirmControlProps extends IBoxProps {
|
|
120
|
-
/**
|
|
121
|
-
* Text of tooltip
|
|
122
|
-
* @default Confirm
|
|
123
|
-
*/
|
|
124
|
-
title?: string;
|
|
125
|
-
/**
|
|
126
|
-
* Icon component
|
|
127
|
-
* @default CheckM
|
|
128
|
-
*/
|
|
129
|
-
icon?: React.FC;
|
|
130
|
-
}
|
|
131
|
-
export interface IInlineInputCancelControlProps extends IBoxProps {
|
|
132
|
-
/**
|
|
133
|
-
* Text of tooltip
|
|
134
|
-
* @default Cancel
|
|
135
|
-
*/
|
|
136
|
-
title?: string;
|
|
137
|
-
/**
|
|
138
|
-
* Icon component
|
|
139
|
-
* @default CloseM
|
|
140
|
-
*/
|
|
141
|
-
icon?: React.FC;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface IInlineInputCtx {
|
|
145
|
-
getAddonProps: PropGetterFn;
|
|
146
|
-
getConfirmControlProps: PropGetterFn;
|
|
147
|
-
getCancelControlProps: PropGetterFn;
|
|
148
|
-
getValueProps: PropGetterFn;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
declare const InlineInput: (<T>(
|
|
152
|
-
props: CProps<IInlineInputProps & T, IInlineInputCtx>,
|
|
153
|
-
) => React.ReactElement) & {
|
|
154
|
-
Addon: <T>(props: CProps<IInlineInputAddonProps & T, IInlineInputProps>) => React.ReactElement;
|
|
155
|
-
Value: <T>(props: CProps<IInlineInputValueProps & T, IInlineInputProps>) => React.ReactElement;
|
|
156
|
-
ConfirmControl: <T>(
|
|
157
|
-
props: CProps<IInlineInputConfirmControlProps & T, IInlineInputProps>,
|
|
158
|
-
) => React.ReactElement;
|
|
159
|
-
CancelControl: <T>(
|
|
160
|
-
props: CProps<IInlineInputCancelControlProps & T, IInlineInputProps>,
|
|
161
|
-
) => React.ReactElement;
|
|
162
|
-
};
|
|
163
|
-
export default InlineInput;
|
package/lib/es6/index.d.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PropGetterFn } from '@semcore/core';
|
|
3
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
4
|
-
|
|
5
|
-
/* utils type */
|
|
6
|
-
type CProps<Props, Ctx = {}, UCProps = {}> = Props & {
|
|
7
|
-
children?:
|
|
8
|
-
| ((props: Props & Ctx, handlers: UCProps) => React.ReactNode)
|
|
9
|
-
| React.ReactNode
|
|
10
|
-
| React.ReactNode[];
|
|
11
|
-
};
|
|
12
|
-
/* utils type */
|
|
13
|
-
|
|
14
|
-
export interface IInlineInputProps extends IBoxProps {
|
|
15
|
-
/**
|
|
16
|
-
* Visual state of inline input
|
|
17
|
-
* @default normal
|
|
18
|
-
*/
|
|
19
|
-
state?: 'normal' | 'valid' | 'invalid';
|
|
20
|
-
/**
|
|
21
|
-
* Disabled input and shows spinner instead of confirm control
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
loading?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Disabled input and controls
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Fired with entered value when user clicks confirm control or hits `Enter` or `Space`
|
|
32
|
-
*/
|
|
33
|
-
onConfirm?: (
|
|
34
|
-
value: string,
|
|
35
|
-
event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,
|
|
36
|
-
) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Fired with value (or defaultValue) that was provided during component mount when user clicks cancel control or hits `Escape`
|
|
39
|
-
*/
|
|
40
|
-
onCancel?: (
|
|
41
|
-
prevValue: string,
|
|
42
|
-
event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,
|
|
43
|
-
) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Text value of input. Should be used with `onChange` property together
|
|
46
|
-
*/
|
|
47
|
-
value?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Initial text value of input
|
|
50
|
-
*/
|
|
51
|
-
defaultValue?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Makes component to catch browser focus on component mount
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
autoFocus?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Gray text displayed in empty input
|
|
59
|
-
*/
|
|
60
|
-
placeholder?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Fired on every input value change. Should be used with `value` property together
|
|
63
|
-
*/
|
|
64
|
-
onChange?: (value: string, event: React.ChangeEvent) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Fired when browser focus leaves component.
|
|
67
|
-
*/
|
|
68
|
-
onBlur?: (event: React.FocusEvent) => void;
|
|
69
|
-
/**
|
|
70
|
-
* Fired when browser focus enters component.
|
|
71
|
-
*/
|
|
72
|
-
onFocus?: (event: React.FocusEvent) => void;
|
|
73
|
-
/**
|
|
74
|
-
* defines callback (`onCancel` or `onConfirm`) triggered when `blur` event out of container fired
|
|
75
|
-
* Triggered after all previous macrotasks completed (internally called inside of `setTimeout`)
|
|
76
|
-
*/
|
|
77
|
-
onBlurBehavior?: 'cancel' | 'confirm';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface IInlineInputAddonProps extends IBoxProps {}
|
|
81
|
-
export interface IInlineInputValueProps extends IBoxProps {
|
|
82
|
-
/**
|
|
83
|
-
* id attribute of input tag
|
|
84
|
-
*/
|
|
85
|
-
id?: string;
|
|
86
|
-
/**
|
|
87
|
-
* when `true`, element is focused immediately after mount
|
|
88
|
-
*/
|
|
89
|
-
autoFocus?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* value of input tag
|
|
92
|
-
*/
|
|
93
|
-
value?: string;
|
|
94
|
-
/**
|
|
95
|
-
* uncontrolled value of input tag
|
|
96
|
-
*/
|
|
97
|
-
defaultValue?: string;
|
|
98
|
-
/**
|
|
99
|
-
* callback invoked on every change of input tag value
|
|
100
|
-
*/
|
|
101
|
-
onChange?: (value: string, event: React.ChangeEvent) => void;
|
|
102
|
-
/**
|
|
103
|
-
* visual state of component
|
|
104
|
-
*/
|
|
105
|
-
state?: 'normal' | 'valid' | 'invalid';
|
|
106
|
-
/**
|
|
107
|
-
* shows spinner in `InlineInput.ConfirmControl` and disables other interactive elements
|
|
108
|
-
*/
|
|
109
|
-
loading?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* disables interactive elements
|
|
112
|
-
*/
|
|
113
|
-
disabled?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* gray text in empty input tag
|
|
116
|
-
*/
|
|
117
|
-
placeholder?: string;
|
|
118
|
-
}
|
|
119
|
-
export interface IInlineInputConfirmControlProps extends IBoxProps {
|
|
120
|
-
/**
|
|
121
|
-
* Text of tooltip
|
|
122
|
-
* @default Confirm
|
|
123
|
-
*/
|
|
124
|
-
title?: string;
|
|
125
|
-
/**
|
|
126
|
-
* Icon component
|
|
127
|
-
* @default CheckM
|
|
128
|
-
*/
|
|
129
|
-
icon?: React.FC;
|
|
130
|
-
}
|
|
131
|
-
export interface IInlineInputCancelControlProps extends IBoxProps {
|
|
132
|
-
/**
|
|
133
|
-
* Text of tooltip
|
|
134
|
-
* @default Cancel
|
|
135
|
-
*/
|
|
136
|
-
title?: string;
|
|
137
|
-
/**
|
|
138
|
-
* Icon component
|
|
139
|
-
* @default CloseM
|
|
140
|
-
*/
|
|
141
|
-
icon?: React.FC;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface IInlineInputCtx {
|
|
145
|
-
getAddonProps: PropGetterFn;
|
|
146
|
-
getConfirmControlProps: PropGetterFn;
|
|
147
|
-
getCancelControlProps: PropGetterFn;
|
|
148
|
-
getValueProps: PropGetterFn;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
declare const InlineInput: (<T>(
|
|
152
|
-
props: CProps<IInlineInputProps & T, IInlineInputCtx>,
|
|
153
|
-
) => React.ReactElement) & {
|
|
154
|
-
Addon: <T>(props: CProps<IInlineInputAddonProps & T, IInlineInputProps>) => React.ReactElement;
|
|
155
|
-
Value: <T>(props: CProps<IInlineInputValueProps & T, IInlineInputProps>) => React.ReactElement;
|
|
156
|
-
ConfirmControl: <T>(
|
|
157
|
-
props: CProps<IInlineInputConfirmControlProps & T, IInlineInputProps>,
|
|
158
|
-
) => React.ReactElement;
|
|
159
|
-
CancelControl: <T>(
|
|
160
|
-
props: CProps<IInlineInputCancelControlProps & T, IInlineInputProps>,
|
|
161
|
-
) => React.ReactElement;
|
|
162
|
-
};
|
|
163
|
-
export default InlineInput;
|