@dktunited-techoff/techoff-suite-ui 1.11.2 → 1.11.3
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/esm/components/TsInput/TsInput/TsInput.css +6 -0
- package/esm/components/TsInput/TsInput/TsInput.d.ts +1 -1
- package/esm/components/TsInput/TsInput/TsInput.js +4 -4
- package/esm/components/TsInput/TsInput/TsInput.js.map +1 -1
- package/esm/components/TsInput/TsInput/TsInput.tsx +7 -5
- package/esm/components/TsInput/TsInput/TsInput.types.d.ts +1 -0
- package/esm/components/TsInput/TsInput/TsInput.types.ts +1 -0
- package/esm/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +5 -0
- package/lib/components/TsInput/TsInput/TsInput.css +6 -0
- package/lib/components/TsInput/TsInput/TsInput.d.ts +1 -1
- package/lib/components/TsInput/TsInput/TsInput.js +4 -4
- package/lib/components/TsInput/TsInput/TsInput.js.map +1 -1
- package/lib/components/TsInput/TsInput/TsInput.tsx +7 -5
- package/lib/components/TsInput/TsInput/TsInput.types.d.ts +1 -0
- package/lib/components/TsInput/TsInput/TsInput.types.ts +1 -0
- package/lib/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +5 -0
- package/package.json +1 -1
- package/src/components/TsInput/TsInput/TsInput.css +6 -0
- package/src/components/TsInput/TsInput/TsInput.tsx +7 -5
- package/src/components/TsInput/TsInput/TsInput.types.ts +1 -0
- package/src/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +5 -0
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
.ts-input-container--error input {
|
|
15
15
|
border: 1px solid #e3262f;
|
|
16
16
|
}
|
|
17
|
+
.ts-input-container--warning input {
|
|
18
|
+
border: 1px solid #fa9c69;
|
|
19
|
+
}
|
|
17
20
|
.ts-input-error {
|
|
18
21
|
display: flex;
|
|
19
22
|
margin-top: 4px;
|
|
20
23
|
color: #e3262f;
|
|
21
24
|
}
|
|
25
|
+
.ts-input-error--warning {
|
|
26
|
+
color: #fa9c69;
|
|
27
|
+
}
|
|
22
28
|
.ts-input-error--icon {
|
|
23
29
|
margin-right: 4px;
|
|
24
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TsInputProps } from './TsInput.types';
|
|
3
3
|
import './TsInput.css';
|
|
4
|
-
export declare const TsInput: ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
|
|
4
|
+
export declare const TsInput: ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => React.JSX.Element;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TsIcon } from '../../TsIcon/TsIcon';
|
|
3
3
|
import './TsInput.css';
|
|
4
|
-
export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }) => {
|
|
4
|
+
export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }) => {
|
|
5
5
|
// #########
|
|
6
6
|
// Rendering
|
|
7
7
|
return (React.createElement("div", { className: `ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}` },
|
|
8
8
|
label && React.createElement("div", { className: "ts-input-label" }, label),
|
|
9
|
-
React.createElement("div", { className: `ts-input-container ${error
|
|
9
|
+
React.createElement("div", { className: `ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}` },
|
|
10
10
|
React.createElement("input", { type: "text", value: value, onChange: e => onChange(e.target.value), ...props }),
|
|
11
11
|
byDefault && React.createElement("div", { className: "ts-input-tag" },
|
|
12
12
|
byDefault,
|
|
13
13
|
" by default"),
|
|
14
14
|
icon && (React.createElement("div", { className: "ts-input-icon" },
|
|
15
15
|
React.createElement(TsIcon, { name: icon, size: "16" })))),
|
|
16
|
-
error
|
|
16
|
+
(error || warning) && (React.createElement("div", { className: `ts-input-error ${warning ? 'ts-input-error--warning' : ''}` },
|
|
17
17
|
React.createElement("div", { className: "ts-input-error--icon" },
|
|
18
18
|
React.createElement(TsIcon, { name: "alert-circle", size: "16" })),
|
|
19
|
-
React.createElement("div", { className: "ts-input-error--label" }, error)))));
|
|
19
|
+
React.createElement("div", { className: "ts-input-error--label" }, error || warning)))));
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=TsInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IAC7G,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BACE,SAAS,EAAE,YAAY,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,EAAE;QAEhH,KAAK,IAAI,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;QACvD,6BACE,SAAS,EAAE,sBAAsB,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,uBAAuB,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;YAE/G,+BAAO,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAM,KAAK,GAAI;YACtF,SAAS,IAAI,6BAAK,SAAS,EAAC,cAAc;gBAAE,SAAS;8BAAkB;YACvE,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;gBAC5B,oBAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG;QAEL,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CACrB,6BAAK,SAAS,EAAE,kBAAkB,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1E,6BAAK,SAAS,EAAC,sBAAsB;gBACnC,oBAAC,MAAM,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAC,IAAI,GAAG,CACpC;YACN,6BAAK,SAAS,EAAC,uBAAuB,IAAE,KAAK,IAAI,OAAO,CAAO,CAC3D,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { TsIcon } from '../../TsIcon/TsIcon';
|
|
|
3
3
|
import { TsInputProps } from './TsInput.types';
|
|
4
4
|
import './TsInput.css';
|
|
5
5
|
|
|
6
|
-
export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => {
|
|
6
|
+
export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => {
|
|
7
7
|
// #########
|
|
8
8
|
// Rendering
|
|
9
9
|
return (
|
|
@@ -11,7 +11,9 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
|
|
|
11
11
|
className={`ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}`}
|
|
12
12
|
>
|
|
13
13
|
{label && <div className="ts-input-label">{label}</div>}
|
|
14
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
className={`ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}`}
|
|
16
|
+
>
|
|
15
17
|
<input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
|
|
16
18
|
{byDefault && <div className="ts-input-tag">{byDefault} by default</div>}
|
|
17
19
|
{icon && (
|
|
@@ -21,12 +23,12 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
|
|
|
21
23
|
)}
|
|
22
24
|
</div>
|
|
23
25
|
|
|
24
|
-
{error
|
|
25
|
-
<div className=
|
|
26
|
+
{(error || warning) && (
|
|
27
|
+
<div className={`ts-input-error ${warning ? 'ts-input-error--warning' : ''}`}>
|
|
26
28
|
<div className="ts-input-error--icon">
|
|
27
29
|
<TsIcon name="alert-circle" size="16" />
|
|
28
30
|
</div>
|
|
29
|
-
<div className="ts-input-error--label">{error}</div>
|
|
31
|
+
<div className="ts-input-error--label">{error || warning}</div>
|
|
30
32
|
</div>
|
|
31
33
|
)}
|
|
32
34
|
</div>
|
|
@@ -31,6 +31,10 @@ export const inputArgTypes = {
|
|
|
31
31
|
control: 'text',
|
|
32
32
|
description: 'Value of the input.',
|
|
33
33
|
},
|
|
34
|
+
warning: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Warning of the input.',
|
|
37
|
+
},
|
|
34
38
|
disabled: {
|
|
35
39
|
control: 'boolean',
|
|
36
40
|
description: 'Enable state of the input.',
|
|
@@ -62,6 +66,7 @@ Input allows the user to enter content and data when the expected user input is
|
|
|
62
66
|
label: 'Label',
|
|
63
67
|
placeholder: 'Enter some text',
|
|
64
68
|
value: '',
|
|
69
|
+
warning: '',
|
|
65
70
|
disabled: false,
|
|
66
71
|
onChange: () => {},
|
|
67
72
|
onValidate: () => {},
|
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
.ts-input-container--error input {
|
|
15
15
|
border: 1px solid #e3262f;
|
|
16
16
|
}
|
|
17
|
+
.ts-input-container--warning input {
|
|
18
|
+
border: 1px solid #fa9c69;
|
|
19
|
+
}
|
|
17
20
|
.ts-input-error {
|
|
18
21
|
display: flex;
|
|
19
22
|
margin-top: 4px;
|
|
20
23
|
color: #e3262f;
|
|
21
24
|
}
|
|
25
|
+
.ts-input-error--warning {
|
|
26
|
+
color: #fa9c69;
|
|
27
|
+
}
|
|
22
28
|
.ts-input-error--icon {
|
|
23
29
|
margin-right: 4px;
|
|
24
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TsInputProps } from './TsInput.types';
|
|
3
3
|
import './TsInput.css';
|
|
4
|
-
export declare const TsInput: ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
|
|
4
|
+
export declare const TsInput: ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => React.JSX.Element;
|
|
@@ -4,22 +4,22 @@ exports.TsInput = void 0;
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const TsIcon_1 = require("../../TsIcon/TsIcon");
|
|
6
6
|
require("./TsInput.css");
|
|
7
|
-
const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }) => {
|
|
7
|
+
const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }) => {
|
|
8
8
|
// #########
|
|
9
9
|
// Rendering
|
|
10
10
|
return (React.createElement("div", { className: `ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}` },
|
|
11
11
|
label && React.createElement("div", { className: "ts-input-label" }, label),
|
|
12
|
-
React.createElement("div", { className: `ts-input-container ${error
|
|
12
|
+
React.createElement("div", { className: `ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}` },
|
|
13
13
|
React.createElement("input", { type: "text", value: value, onChange: e => onChange(e.target.value), ...props }),
|
|
14
14
|
byDefault && React.createElement("div", { className: "ts-input-tag" },
|
|
15
15
|
byDefault,
|
|
16
16
|
" by default"),
|
|
17
17
|
icon && (React.createElement("div", { className: "ts-input-icon" },
|
|
18
18
|
React.createElement(TsIcon_1.TsIcon, { name: icon, size: "16" })))),
|
|
19
|
-
error
|
|
19
|
+
(error || warning) && (React.createElement("div", { className: `ts-input-error ${warning ? 'ts-input-error--warning' : ''}` },
|
|
20
20
|
React.createElement("div", { className: "ts-input-error--icon" },
|
|
21
21
|
React.createElement(TsIcon_1.TsIcon, { name: "alert-circle", size: "16" })),
|
|
22
|
-
React.createElement("div", { className: "ts-input-error--label" }, error)))));
|
|
22
|
+
React.createElement("div", { className: "ts-input-error--label" }, error || warning)))));
|
|
23
23
|
};
|
|
24
24
|
exports.TsInput = TsInput;
|
|
25
25
|
//# sourceMappingURL=TsInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,gDAA6C;AAE7C,yBAAuB;AAEhB,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,gDAA6C;AAE7C,yBAAuB;AAEhB,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IAC7G,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BACE,SAAS,EAAE,YAAY,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,EAAE;QAEhH,KAAK,IAAI,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;QACvD,6BACE,SAAS,EAAE,sBAAsB,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,uBAAuB,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;YAE/G,+BAAO,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAM,KAAK,GAAI;YACtF,SAAS,IAAI,6BAAK,SAAS,EAAC,cAAc;gBAAE,SAAS;8BAAkB;YACvE,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;gBAC5B,oBAAC,eAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG;QAEL,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CACrB,6BAAK,SAAS,EAAE,kBAAkB,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1E,6BAAK,SAAS,EAAC,sBAAsB;gBACnC,oBAAC,eAAM,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAC,IAAI,GAAG,CACpC;YACN,6BAAK,SAAS,EAAC,uBAAuB,IAAE,KAAK,IAAI,OAAO,CAAO,CAC3D,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,OAAO,WA8BlB"}
|
|
@@ -3,7 +3,7 @@ import { TsIcon } from '../../TsIcon/TsIcon';
|
|
|
3
3
|
import { TsInputProps } from './TsInput.types';
|
|
4
4
|
import './TsInput.css';
|
|
5
5
|
|
|
6
|
-
export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => {
|
|
6
|
+
export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => {
|
|
7
7
|
// #########
|
|
8
8
|
// Rendering
|
|
9
9
|
return (
|
|
@@ -11,7 +11,9 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
|
|
|
11
11
|
className={`ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}`}
|
|
12
12
|
>
|
|
13
13
|
{label && <div className="ts-input-label">{label}</div>}
|
|
14
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
className={`ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}`}
|
|
16
|
+
>
|
|
15
17
|
<input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
|
|
16
18
|
{byDefault && <div className="ts-input-tag">{byDefault} by default</div>}
|
|
17
19
|
{icon && (
|
|
@@ -21,12 +23,12 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
|
|
|
21
23
|
)}
|
|
22
24
|
</div>
|
|
23
25
|
|
|
24
|
-
{error
|
|
25
|
-
<div className=
|
|
26
|
+
{(error || warning) && (
|
|
27
|
+
<div className={`ts-input-error ${warning ? 'ts-input-error--warning' : ''}`}>
|
|
26
28
|
<div className="ts-input-error--icon">
|
|
27
29
|
<TsIcon name="alert-circle" size="16" />
|
|
28
30
|
</div>
|
|
29
|
-
<div className="ts-input-error--label">{error}</div>
|
|
31
|
+
<div className="ts-input-error--label">{error || warning}</div>
|
|
30
32
|
</div>
|
|
31
33
|
)}
|
|
32
34
|
</div>
|
|
@@ -31,6 +31,10 @@ export const inputArgTypes = {
|
|
|
31
31
|
control: 'text',
|
|
32
32
|
description: 'Value of the input.',
|
|
33
33
|
},
|
|
34
|
+
warning: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Warning of the input.',
|
|
37
|
+
},
|
|
34
38
|
disabled: {
|
|
35
39
|
control: 'boolean',
|
|
36
40
|
description: 'Enable state of the input.',
|
|
@@ -62,6 +66,7 @@ Input allows the user to enter content and data when the expected user input is
|
|
|
62
66
|
label: 'Label',
|
|
63
67
|
placeholder: 'Enter some text',
|
|
64
68
|
value: '',
|
|
69
|
+
warning: '',
|
|
65
70
|
disabled: false,
|
|
66
71
|
onChange: () => {},
|
|
67
72
|
onValidate: () => {},
|
package/package.json
CHANGED
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
.ts-input-container--error input {
|
|
15
15
|
border: 1px solid #e3262f;
|
|
16
16
|
}
|
|
17
|
+
.ts-input-container--warning input {
|
|
18
|
+
border: 1px solid #fa9c69;
|
|
19
|
+
}
|
|
17
20
|
.ts-input-error {
|
|
18
21
|
display: flex;
|
|
19
22
|
margin-top: 4px;
|
|
20
23
|
color: #e3262f;
|
|
21
24
|
}
|
|
25
|
+
.ts-input-error--warning {
|
|
26
|
+
color: #fa9c69;
|
|
27
|
+
}
|
|
22
28
|
.ts-input-error--icon {
|
|
23
29
|
margin-right: 4px;
|
|
24
30
|
}
|
|
@@ -3,7 +3,7 @@ import { TsIcon } from '../../TsIcon/TsIcon';
|
|
|
3
3
|
import { TsInputProps } from './TsInput.types';
|
|
4
4
|
import './TsInput.css';
|
|
5
5
|
|
|
6
|
-
export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => {
|
|
6
|
+
export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => {
|
|
7
7
|
// #########
|
|
8
8
|
// Rendering
|
|
9
9
|
return (
|
|
@@ -11,7 +11,9 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
|
|
|
11
11
|
className={`ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}`}
|
|
12
12
|
>
|
|
13
13
|
{label && <div className="ts-input-label">{label}</div>}
|
|
14
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
className={`ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}`}
|
|
16
|
+
>
|
|
15
17
|
<input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
|
|
16
18
|
{byDefault && <div className="ts-input-tag">{byDefault} by default</div>}
|
|
17
19
|
{icon && (
|
|
@@ -21,12 +23,12 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
|
|
|
21
23
|
)}
|
|
22
24
|
</div>
|
|
23
25
|
|
|
24
|
-
{error
|
|
25
|
-
<div className=
|
|
26
|
+
{(error || warning) && (
|
|
27
|
+
<div className={`ts-input-error ${warning ? 'ts-input-error--warning' : ''}`}>
|
|
26
28
|
<div className="ts-input-error--icon">
|
|
27
29
|
<TsIcon name="alert-circle" size="16" />
|
|
28
30
|
</div>
|
|
29
|
-
<div className="ts-input-error--label">{error}</div>
|
|
31
|
+
<div className="ts-input-error--label">{error || warning}</div>
|
|
30
32
|
</div>
|
|
31
33
|
)}
|
|
32
34
|
</div>
|
|
@@ -31,6 +31,10 @@ export const inputArgTypes = {
|
|
|
31
31
|
control: 'text',
|
|
32
32
|
description: 'Value of the input.',
|
|
33
33
|
},
|
|
34
|
+
warning: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Warning of the input.',
|
|
37
|
+
},
|
|
34
38
|
disabled: {
|
|
35
39
|
control: 'boolean',
|
|
36
40
|
description: 'Enable state of the input.',
|
|
@@ -62,6 +66,7 @@ Input allows the user to enter content and data when the expected user input is
|
|
|
62
66
|
label: 'Label',
|
|
63
67
|
placeholder: 'Enter some text',
|
|
64
68
|
value: '',
|
|
69
|
+
warning: '',
|
|
65
70
|
disabled: false,
|
|
66
71
|
onChange: () => {},
|
|
67
72
|
onValidate: () => {},
|