@progress/kendo-themes-html 4.41.3-dev.3 → 5.0.0-alpha.0
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/jsx-runtime.js +112 -11
- package/package.json +6 -6
- package/src/autocomplete/README.md +24 -0
- package/src/autocomplete/autocomplete.jsx +160 -0
- package/src/autocomplete/index.js +1 -0
- package/src/button/README.md +22 -0
- package/src/button/button.jsx +3 -1
- package/src/checkbox/README.md +22 -0
- package/src/checkbox/checkbox.jsx +123 -0
- package/src/checkbox/index.js +1 -0
- package/src/colorpicker/README.md +30 -0
- package/src/colorpicker/color-preview.jsx +90 -0
- package/src/colorpicker/colorpicker.jsx +152 -0
- package/src/colorpicker/index.js +2 -0
- package/src/combobox/README.md +30 -0
- package/src/combobox/combobox.jsx +170 -0
- package/src/combobox/index.js +1 -0
- package/src/component.js +3 -3
- package/src/dropdownlist/README.md +30 -0
- package/src/dropdownlist/dropdownlist.jsx +190 -0
- package/src/dropdownlist/index.js +1 -0
- package/src/icon/icon.jsx +29 -7
- package/src/index.js +34 -5
- package/src/input/index.js +5 -0
- package/src/input/input-clear-value.jsx +30 -0
- package/src/input/input-inner-input.jsx +77 -0
- package/src/input/input-inner-span.jsx +91 -0
- package/src/input/input-inner-textarea.jsx +74 -0
- package/src/input/input-inner.jsx +3 -0
- package/src/input/input-loading-icon.jsx +28 -0
- package/src/input/input-prefix.jsx +1 -4
- package/src/input/input-suffix.jsx +1 -4
- package/src/input/input-validation-icon.jsx +37 -0
- package/src/input/input.jsx +90 -32
- package/src/input/picker.jsx +145 -0
- package/src/maskedtextbox/README.md +24 -0
- package/src/maskedtextbox/index.js +1 -0
- package/src/maskedtextbox/maskedtextbox.jsx +155 -0
- package/src/numerictextbox/README.md +42 -0
- package/src/numerictextbox/index.js +1 -0
- package/src/numerictextbox/numerictextbox.jsx +171 -0
- package/src/radio/README.md +21 -0
- package/src/radio/index.js +1 -0
- package/src/radio/radio.jsx +103 -0
- package/src/searchbox/README.md +26 -0
- package/src/searchbox/index.js +1 -0
- package/src/searchbox/searchbox.jsx +171 -0
- package/src/spinbutton/spinbutton.jsx +2 -2
- package/src/switch/README.md +28 -0
- package/src/switch/index.js +1 -0
- package/src/switch/switch.jsx +132 -0
- package/src/textarea/README.md +24 -0
- package/src/textarea/textarea.jsx +44 -65
- package/src/textbox/README.md +24 -0
- package/src/textbox/textbox.jsx +64 -66
- package/utils/styles.js +29 -2
- package/src/masked/README.md +0 -0
- package/src/masked/index.js +0 -1
- package/src/masked/masked.jsx +0 -139
- package/src/numeric/README.md +0 -0
- package/src/numeric/index.js +0 -1
- package/src/numeric/numeric.jsx +0 -149
package/src/icon/icon.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from '../component';
|
|
1
|
+
import { Component, globalDefaultProps } from '../component';
|
|
2
2
|
|
|
3
3
|
class Icon extends Component {
|
|
4
4
|
render() {
|
|
@@ -8,30 +8,52 @@ class Icon extends Component {
|
|
|
8
8
|
|
|
9
9
|
function IconStatic(props) {
|
|
10
10
|
const {
|
|
11
|
+
className: ownClassName,
|
|
12
|
+
|
|
11
13
|
name,
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
aria,
|
|
16
|
+
|
|
17
|
+
...htmlAttributes
|
|
18
|
+
|
|
13
19
|
} = props;
|
|
14
20
|
|
|
15
|
-
let
|
|
21
|
+
let iconClasses = [
|
|
16
22
|
ownClassName,
|
|
17
23
|
'k-icon',
|
|
18
24
|
`k-i-${name}`
|
|
19
25
|
];
|
|
20
26
|
|
|
27
|
+
let ariaAttr = aria
|
|
28
|
+
? {}
|
|
29
|
+
: {};
|
|
30
|
+
|
|
21
31
|
return (
|
|
22
32
|
<>
|
|
23
|
-
{ name &&
|
|
33
|
+
{ name &&
|
|
34
|
+
<span className={iconClasses} {...ariaAttr} {...htmlAttributes}>
|
|
35
|
+
{props.children}
|
|
36
|
+
</span>
|
|
37
|
+
}
|
|
24
38
|
</>
|
|
25
39
|
);
|
|
26
40
|
}
|
|
27
41
|
|
|
28
42
|
IconStatic.defaultProps = {
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
...globalDefaultProps,
|
|
44
|
+
|
|
45
|
+
name: ''
|
|
31
46
|
};
|
|
32
47
|
IconStatic.propTypes = {
|
|
48
|
+
className: typeof '',
|
|
49
|
+
|
|
33
50
|
name: typeof '',
|
|
34
|
-
|
|
51
|
+
|
|
52
|
+
children: typeof [],
|
|
53
|
+
|
|
54
|
+
aria: typeof false,
|
|
55
|
+
|
|
56
|
+
htmlAttributes: typeof [],
|
|
35
57
|
};
|
|
36
58
|
|
|
37
59
|
export { Icon, IconStatic };
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* global kendo */
|
|
3
3
|
import { isFunction } from '../utils/object';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export function init() {
|
|
6
6
|
document.querySelectorAll('[is]').forEach( element => {
|
|
7
7
|
const componentName = element.getAttribute('is');
|
|
8
8
|
const component = kendo.Html[componentName];
|
|
@@ -11,7 +11,9 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
11
11
|
new component( element );
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
window.addEventListener('DOMContentLoaded', init);
|
|
15
17
|
|
|
16
18
|
// Dependencies
|
|
17
19
|
export * from './component';
|
|
@@ -19,9 +21,36 @@ export * from './component';
|
|
|
19
21
|
// Generic content
|
|
20
22
|
export * from './icon/index';
|
|
21
23
|
|
|
22
|
-
//
|
|
24
|
+
// Primitive components
|
|
25
|
+
export * from './input/index';
|
|
26
|
+
// export * from './picker/index';
|
|
27
|
+
// export * from './popup/index';
|
|
28
|
+
// export * from './list/index';
|
|
29
|
+
|
|
30
|
+
// Native forms
|
|
23
31
|
export * from './button/index';
|
|
24
32
|
export * from './textbox/index';
|
|
25
33
|
export * from './textarea/index';
|
|
26
|
-
export * from './
|
|
27
|
-
export * from './
|
|
34
|
+
export * from './checkbox/index';
|
|
35
|
+
export * from './radio/index';
|
|
36
|
+
// export * from './listbox/index';
|
|
37
|
+
// export * from './progressbar/index';
|
|
38
|
+
// export * from './slider/index';
|
|
39
|
+
|
|
40
|
+
// Augmented inputs
|
|
41
|
+
export * from './autocomplete/index';
|
|
42
|
+
// export * from './captcha/index';
|
|
43
|
+
export * from './colorpicker/index';
|
|
44
|
+
export * from './combobox/index';
|
|
45
|
+
// export * from './datetime/index';
|
|
46
|
+
// export * from './dropdowngrid/index';
|
|
47
|
+
export * from './dropdownlist/index';
|
|
48
|
+
// export * from './dropdowntree/index';
|
|
49
|
+
export * from './maskedtextbox/index';
|
|
50
|
+
// export * from './multiselect/index';
|
|
51
|
+
export * from './numerictextbox/index';
|
|
52
|
+
// export * from './rating/index';
|
|
53
|
+
export * from './searchbox/index';
|
|
54
|
+
export * from './switch/index';
|
|
55
|
+
// export * from './upload/index';
|
|
56
|
+
// export * from './dropzone/index';
|
package/src/input/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export * from './input.jsx';
|
|
2
|
+
export * from './picker.jsx';
|
|
3
|
+
export * from './input-inner.jsx';
|
|
2
4
|
export * from './input-prefix.jsx';
|
|
3
5
|
export * from './input-suffix.jsx';
|
|
6
|
+
export * from './input-validation-icon.jsx';
|
|
7
|
+
export * from './input-loading-icon.jsx';
|
|
8
|
+
export * from './input-clear-value.jsx';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IconStatic } from '../icon/index';
|
|
2
|
+
|
|
3
|
+
function InputClearValueStatic(inputProps) {
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
value,
|
|
7
|
+
|
|
8
|
+
showClearButton,
|
|
9
|
+
|
|
10
|
+
loading,
|
|
11
|
+
disabled,
|
|
12
|
+
|
|
13
|
+
aria
|
|
14
|
+
} = inputProps;
|
|
15
|
+
|
|
16
|
+
if (disabled || loading || !showClearButton || value === '' ) {
|
|
17
|
+
return <></>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let ariaAttr = aria
|
|
21
|
+
? {}
|
|
22
|
+
: {};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<span className="k-clear-value" {...ariaAttr}><IconStatic name="x" /></span>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { InputClearValueStatic };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component';
|
|
2
|
+
|
|
3
|
+
class InputInnerInput extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
return <InputInnerInputStatic {...this.props} />;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function InputInnerInputStatic(props) {
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
className: ownClassName,
|
|
13
|
+
|
|
14
|
+
type,
|
|
15
|
+
value,
|
|
16
|
+
placeholder,
|
|
17
|
+
autocomplete,
|
|
18
|
+
|
|
19
|
+
aria,
|
|
20
|
+
legacy,
|
|
21
|
+
|
|
22
|
+
...htmlAttributes
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
let ariaAttr = aria
|
|
26
|
+
? {}
|
|
27
|
+
: {};
|
|
28
|
+
|
|
29
|
+
let inputClasses = [
|
|
30
|
+
ownClassName,
|
|
31
|
+
'k-input-inner'
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
let legacyClasses = [
|
|
35
|
+
ownClassName,
|
|
36
|
+
'k-input'
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
htmlAttributes.value = value;
|
|
40
|
+
htmlAttributes.placeholder = placeholder;
|
|
41
|
+
htmlAttributes.autocomplete = autocomplete;
|
|
42
|
+
|
|
43
|
+
if (legacy) {
|
|
44
|
+
return (
|
|
45
|
+
<input type={type} className={legacyClasses} {...ariaAttr} {...htmlAttributes} />
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<input type={type} className={inputClasses} {...ariaAttr} {...htmlAttributes} />
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
InputInnerInputStatic.defaultProps = {
|
|
55
|
+
...globalDefaultProps,
|
|
56
|
+
|
|
57
|
+
type: 'text',
|
|
58
|
+
value: '',
|
|
59
|
+
placeholder: '',
|
|
60
|
+
autocomplete: 'off'
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
InputInnerInputStatic.propTypes = {
|
|
64
|
+
className: typeof '',
|
|
65
|
+
|
|
66
|
+
type: typeof [],
|
|
67
|
+
value: typeof '',
|
|
68
|
+
placeholder: typeof '',
|
|
69
|
+
autocomplete: typeof [ 'on', 'off' ],
|
|
70
|
+
|
|
71
|
+
aria: typeof false,
|
|
72
|
+
legacy: typeof false,
|
|
73
|
+
|
|
74
|
+
htmlAttributes: typeof []
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { InputInnerInput, InputInnerInputStatic };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { IconStatic } from '../icon/index';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component';
|
|
3
|
+
|
|
4
|
+
class InputInnerSpan extends Component {
|
|
5
|
+
render() {
|
|
6
|
+
return <InputInnerSpanStatic {...this.props} />;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function InputInnerSpanStatic(props) {
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
className: ownClassName,
|
|
14
|
+
|
|
15
|
+
value,
|
|
16
|
+
placeholder,
|
|
17
|
+
|
|
18
|
+
showValue,
|
|
19
|
+
valueIcon,
|
|
20
|
+
valueIconName,
|
|
21
|
+
|
|
22
|
+
aria,
|
|
23
|
+
legacy,
|
|
24
|
+
|
|
25
|
+
...htmlAttributes
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
let ariaAttr = aria
|
|
29
|
+
? {}
|
|
30
|
+
: {};
|
|
31
|
+
|
|
32
|
+
let inputClasses = [
|
|
33
|
+
ownClassName,
|
|
34
|
+
'k-input-inner'
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
if (legacy) {
|
|
38
|
+
|
|
39
|
+
let legacyClasses = [
|
|
40
|
+
ownClassName,
|
|
41
|
+
'k-input'
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<span className={legacyClasses} {...htmlAttributes}>
|
|
46
|
+
{valueIcon}
|
|
47
|
+
{valueIcon === null && <IconStatic className="k-icon k-input-value-icon" name={valueIconName} />}
|
|
48
|
+
{showValue && value === '' && placeholder}
|
|
49
|
+
{showValue && value && <span className="k-input-value-text">{value}</span>}
|
|
50
|
+
</span>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<span className={inputClasses} {...ariaAttr} {...htmlAttributes}>
|
|
56
|
+
{valueIcon}
|
|
57
|
+
{valueIcon === null && <IconStatic className="k-icon k-input-value-icon" name={valueIconName} />}
|
|
58
|
+
{showValue && value === '' && placeholder}
|
|
59
|
+
{showValue && value && <span className="k-value-text">{value}</span>}
|
|
60
|
+
</span>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
InputInnerSpanStatic.defaultProps = {
|
|
65
|
+
...globalDefaultProps,
|
|
66
|
+
|
|
67
|
+
value: '',
|
|
68
|
+
placeholder: '',
|
|
69
|
+
|
|
70
|
+
showValue: true,
|
|
71
|
+
valueIcon: null,
|
|
72
|
+
valueIconName: '',
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
InputInnerSpanStatic.propTypes = {
|
|
76
|
+
className: typeof '',
|
|
77
|
+
|
|
78
|
+
value: typeof '',
|
|
79
|
+
placeholder: typeof '',
|
|
80
|
+
|
|
81
|
+
showValue: typeof true,
|
|
82
|
+
valueIcon: typeof '#fragment',
|
|
83
|
+
valueIconName: typeof '',
|
|
84
|
+
|
|
85
|
+
aria: typeof false,
|
|
86
|
+
legacy: typeof false,
|
|
87
|
+
|
|
88
|
+
htmlAttributes: typeof []
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { InputInnerSpan, InputInnerSpanStatic };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component';
|
|
2
|
+
|
|
3
|
+
class InputInnerTextarea extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
return <InputInnerTextareaStatic {...this.props} />;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function InputInnerTextareaStatic(props) {
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
className: ownClassName,
|
|
13
|
+
|
|
14
|
+
value,
|
|
15
|
+
placeholder,
|
|
16
|
+
|
|
17
|
+
aria,
|
|
18
|
+
legacy,
|
|
19
|
+
|
|
20
|
+
...htmlAttributes
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
let ariaAttr = aria
|
|
24
|
+
? {}
|
|
25
|
+
: {};
|
|
26
|
+
|
|
27
|
+
let inputClasses = [
|
|
28
|
+
ownClassName,
|
|
29
|
+
'k-input-inner'
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
let legacyClasses = [
|
|
33
|
+
ownClassName,
|
|
34
|
+
'k-input'
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
htmlAttributes.value = value;
|
|
38
|
+
htmlAttributes.placeholder = placeholder;
|
|
39
|
+
|
|
40
|
+
if (legacy) {
|
|
41
|
+
return (
|
|
42
|
+
<textarea className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
43
|
+
{value}
|
|
44
|
+
</textarea>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<textarea className={inputClasses} {...ariaAttr} {...htmlAttributes}>
|
|
50
|
+
{value}
|
|
51
|
+
</textarea>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
InputInnerTextareaStatic.defaultProps = {
|
|
56
|
+
...globalDefaultProps,
|
|
57
|
+
|
|
58
|
+
value: '',
|
|
59
|
+
placeholder: ''
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
InputInnerTextareaStatic.propTypes = {
|
|
63
|
+
className: typeof '',
|
|
64
|
+
|
|
65
|
+
value: typeof '',
|
|
66
|
+
placeholder: typeof '',
|
|
67
|
+
|
|
68
|
+
aria: typeof false,
|
|
69
|
+
legacy: typeof false,
|
|
70
|
+
|
|
71
|
+
htmlAttributes: typeof []
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { InputInnerTextarea, InputInnerTextareaStatic };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IconStatic } from '../icon/index';
|
|
2
|
+
|
|
3
|
+
function InputLoadingIconStatic(inputProps) {
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
showLoadingIcon,
|
|
7
|
+
|
|
8
|
+
loading,
|
|
9
|
+
disabled,
|
|
10
|
+
|
|
11
|
+
aria
|
|
12
|
+
} = inputProps;
|
|
13
|
+
|
|
14
|
+
if (disabled || !showLoadingIcon || !loading) {
|
|
15
|
+
return <></>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let ariaAttr = aria
|
|
19
|
+
? {}
|
|
20
|
+
: {};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<IconStatic name="loading" className="k-input-loading-icon" {...ariaAttr} />
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { InputLoadingIconStatic };
|
|
@@ -21,9 +21,7 @@ function InputPrefixStatic(props) {
|
|
|
21
21
|
'k-input-prefix'
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (childCount === 0) {
|
|
24
|
+
if (children.length === 0) {
|
|
27
25
|
return <></>;
|
|
28
26
|
}
|
|
29
27
|
|
|
@@ -42,7 +40,6 @@ InputPrefixStatic.defaultProps = {
|
|
|
42
40
|
|
|
43
41
|
InputPrefixStatic.propTypes = {
|
|
44
42
|
children: typeof [],
|
|
45
|
-
|
|
46
43
|
className: typeof '',
|
|
47
44
|
|
|
48
45
|
htmlAttributes: typeof []
|
|
@@ -21,9 +21,7 @@ function InputSuffixStatic(props) {
|
|
|
21
21
|
'k-input-suffix'
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (childCount === 0) {
|
|
24
|
+
if (children.length === 0) {
|
|
27
25
|
return <></>;
|
|
28
26
|
}
|
|
29
27
|
|
|
@@ -42,7 +40,6 @@ InputSuffixStatic.defaultProps = {
|
|
|
42
40
|
|
|
43
41
|
InputSuffixStatic.propTypes = {
|
|
44
42
|
children: typeof [],
|
|
45
|
-
|
|
46
43
|
className: typeof '',
|
|
47
44
|
|
|
48
45
|
htmlAttributes: typeof []
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IconStatic } from '../icon/index';
|
|
2
|
+
|
|
3
|
+
function InputValidationIconStatic(inputProps) {
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
showValidationIcon,
|
|
7
|
+
|
|
8
|
+
valid,
|
|
9
|
+
invalid,
|
|
10
|
+
loading,
|
|
11
|
+
disabled,
|
|
12
|
+
|
|
13
|
+
aria
|
|
14
|
+
} = inputProps;
|
|
15
|
+
|
|
16
|
+
if (disabled || loading || !showValidationIcon ) {
|
|
17
|
+
return <></>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let iconName = invalid ? 'warning' : 'check';
|
|
21
|
+
let renderValidationIcon = Boolean( valid || invalid );
|
|
22
|
+
|
|
23
|
+
let ariaAttr = aria
|
|
24
|
+
? {}
|
|
25
|
+
: {};
|
|
26
|
+
|
|
27
|
+
if (renderValidationIcon === false) {
|
|
28
|
+
return <></>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<IconStatic name={iconName} className="k-input-validation-icon" {...ariaAttr} />
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { InputValidationIconStatic };
|
package/src/input/input.jsx
CHANGED
|
@@ -1,8 +1,39 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
1
2
|
import { Component, globalDefaultProps } from '../component';
|
|
2
3
|
|
|
3
4
|
class Input extends Component {
|
|
5
|
+
|
|
6
|
+
init() {
|
|
7
|
+
let prefix = <></>;
|
|
8
|
+
let suffix = <></>;
|
|
9
|
+
let children = this._props.children;
|
|
10
|
+
let newChildren = [];
|
|
11
|
+
|
|
12
|
+
children.forEach( child => {
|
|
13
|
+
let component = child._component;
|
|
14
|
+
|
|
15
|
+
if (component === 'InputPrefix') {
|
|
16
|
+
prefix.props.children.push( child );
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (component === 'InputSuffix') {
|
|
21
|
+
suffix.props.children.push( child );
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
newChildren.push( child );
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
this._props.prefix = prefix;
|
|
29
|
+
this._props.suffix = suffix;
|
|
30
|
+
this._props.children = newChildren;
|
|
31
|
+
}
|
|
32
|
+
|
|
4
33
|
render() {
|
|
5
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<InputStatic {...this.props} />
|
|
36
|
+
);
|
|
6
37
|
}
|
|
7
38
|
}
|
|
8
39
|
|
|
@@ -11,78 +42,105 @@ function InputStatic(props) {
|
|
|
11
42
|
const {
|
|
12
43
|
className: ownClassName,
|
|
13
44
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
autocomplete,
|
|
45
|
+
size,
|
|
46
|
+
rounded,
|
|
17
47
|
|
|
18
|
-
|
|
48
|
+
fillMode,
|
|
49
|
+
|
|
50
|
+
hover,
|
|
51
|
+
focus,
|
|
52
|
+
valid,
|
|
53
|
+
invalid,
|
|
54
|
+
required,
|
|
55
|
+
disabled,
|
|
19
56
|
|
|
20
57
|
aria,
|
|
58
|
+
legacy,
|
|
59
|
+
|
|
21
60
|
...htmlAttributes
|
|
22
61
|
} = props;
|
|
23
62
|
|
|
24
63
|
let inputClasses = [
|
|
25
64
|
ownClassName,
|
|
26
|
-
'k-input'
|
|
65
|
+
'k-input',
|
|
66
|
+
styles.sizeClass( size, 'k-input' ),
|
|
67
|
+
styles.roundedClass( rounded ),
|
|
68
|
+
styles.fillModeClass( fillMode, 'k-input' ),
|
|
69
|
+
{
|
|
70
|
+
'k-hover': hover === true,
|
|
71
|
+
'k-focus': focus === true,
|
|
72
|
+
'k-valid': valid === true,
|
|
73
|
+
'k-invalid': invalid === true,
|
|
74
|
+
'k-required': required === true,
|
|
75
|
+
'k-disabled': disabled === true
|
|
76
|
+
}
|
|
27
77
|
];
|
|
28
78
|
|
|
29
79
|
let ariaAttr = aria
|
|
30
80
|
? {}
|
|
31
81
|
: {};
|
|
32
82
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (renderAs === 'span') {
|
|
36
|
-
return (
|
|
37
|
-
<span className={inputClasses} {...ariaAttr} {...htmlAttributes}>
|
|
38
|
-
{value !== '' && placeholder}
|
|
39
|
-
{value}
|
|
40
|
-
</span>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
83
|
+
if ( legacy ) {
|
|
43
84
|
|
|
44
|
-
|
|
45
|
-
|
|
85
|
+
let legacyClasses = [
|
|
86
|
+
ownClassName
|
|
87
|
+
];
|
|
46
88
|
|
|
47
89
|
return (
|
|
48
|
-
<
|
|
49
|
-
{
|
|
50
|
-
</
|
|
90
|
+
<span className={legacyClasses} {...htmlAttributes}>
|
|
91
|
+
{props.children}
|
|
92
|
+
</span>
|
|
51
93
|
);
|
|
52
94
|
}
|
|
53
95
|
|
|
54
|
-
htmlAttributes.value = value;
|
|
55
|
-
htmlAttributes.placeholder = placeholder;
|
|
56
|
-
htmlAttributes.autocomplete = autocomplete;
|
|
57
|
-
|
|
58
96
|
return (
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{...htmlAttributes} />
|
|
97
|
+
<span className={inputClasses} {...ariaAttr} {...htmlAttributes}>
|
|
98
|
+
{props.children}
|
|
99
|
+
</span>
|
|
63
100
|
);
|
|
64
101
|
}
|
|
65
102
|
|
|
66
103
|
InputStatic.defaultProps = {
|
|
67
104
|
...globalDefaultProps,
|
|
68
105
|
|
|
106
|
+
type: 'text',
|
|
69
107
|
value: '',
|
|
70
108
|
placeholder: '',
|
|
71
109
|
autocomplete: 'off',
|
|
72
110
|
|
|
73
|
-
|
|
111
|
+
size: 'medium',
|
|
112
|
+
rounded: 'medium',
|
|
113
|
+
|
|
114
|
+
fillMode: 'solid'
|
|
74
115
|
};
|
|
75
116
|
|
|
76
117
|
InputStatic.propTypes = {
|
|
118
|
+
children: typeof [],
|
|
119
|
+
className: typeof '',
|
|
120
|
+
|
|
121
|
+
type: typeof [],
|
|
77
122
|
value: typeof '',
|
|
78
123
|
placeholder: typeof '',
|
|
79
124
|
autocomplete: typeof [ 'on', 'off' ],
|
|
80
125
|
|
|
81
|
-
|
|
126
|
+
prefix: typeof '#fragment',
|
|
127
|
+
suffix: typeof '#fragment',
|
|
82
128
|
|
|
83
|
-
|
|
129
|
+
size: typeof [ 'none', 'small', 'medium', 'large' ],
|
|
130
|
+
rounded: typeof [ 'none', 'small', 'medium', 'large', 'pill' ],
|
|
131
|
+
|
|
132
|
+
fillMode: typeof [ 'none', 'solid', 'flat', 'outline' ],
|
|
133
|
+
|
|
134
|
+
hover: typeof false,
|
|
135
|
+
focus: typeof false,
|
|
136
|
+
valid: typeof false,
|
|
137
|
+
invalid: typeof false,
|
|
138
|
+
required: typeof false,
|
|
139
|
+
disabled: typeof false,
|
|
84
140
|
|
|
85
141
|
aria: typeof false,
|
|
142
|
+
legacy: typeof false,
|
|
143
|
+
|
|
86
144
|
htmlAttributes: typeof []
|
|
87
145
|
};
|
|
88
146
|
|