@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.
Files changed (62) hide show
  1. package/lib/jsx-runtime.js +112 -11
  2. package/package.json +6 -6
  3. package/src/autocomplete/README.md +24 -0
  4. package/src/autocomplete/autocomplete.jsx +160 -0
  5. package/src/autocomplete/index.js +1 -0
  6. package/src/button/README.md +22 -0
  7. package/src/button/button.jsx +3 -1
  8. package/src/checkbox/README.md +22 -0
  9. package/src/checkbox/checkbox.jsx +123 -0
  10. package/src/checkbox/index.js +1 -0
  11. package/src/colorpicker/README.md +30 -0
  12. package/src/colorpicker/color-preview.jsx +90 -0
  13. package/src/colorpicker/colorpicker.jsx +152 -0
  14. package/src/colorpicker/index.js +2 -0
  15. package/src/combobox/README.md +30 -0
  16. package/src/combobox/combobox.jsx +170 -0
  17. package/src/combobox/index.js +1 -0
  18. package/src/component.js +3 -3
  19. package/src/dropdownlist/README.md +30 -0
  20. package/src/dropdownlist/dropdownlist.jsx +190 -0
  21. package/src/dropdownlist/index.js +1 -0
  22. package/src/icon/icon.jsx +29 -7
  23. package/src/index.js +34 -5
  24. package/src/input/index.js +5 -0
  25. package/src/input/input-clear-value.jsx +30 -0
  26. package/src/input/input-inner-input.jsx +77 -0
  27. package/src/input/input-inner-span.jsx +91 -0
  28. package/src/input/input-inner-textarea.jsx +74 -0
  29. package/src/input/input-inner.jsx +3 -0
  30. package/src/input/input-loading-icon.jsx +28 -0
  31. package/src/input/input-prefix.jsx +1 -4
  32. package/src/input/input-suffix.jsx +1 -4
  33. package/src/input/input-validation-icon.jsx +37 -0
  34. package/src/input/input.jsx +90 -32
  35. package/src/input/picker.jsx +145 -0
  36. package/src/maskedtextbox/README.md +24 -0
  37. package/src/maskedtextbox/index.js +1 -0
  38. package/src/maskedtextbox/maskedtextbox.jsx +155 -0
  39. package/src/numerictextbox/README.md +42 -0
  40. package/src/numerictextbox/index.js +1 -0
  41. package/src/numerictextbox/numerictextbox.jsx +171 -0
  42. package/src/radio/README.md +21 -0
  43. package/src/radio/index.js +1 -0
  44. package/src/radio/radio.jsx +103 -0
  45. package/src/searchbox/README.md +26 -0
  46. package/src/searchbox/index.js +1 -0
  47. package/src/searchbox/searchbox.jsx +171 -0
  48. package/src/spinbutton/spinbutton.jsx +2 -2
  49. package/src/switch/README.md +28 -0
  50. package/src/switch/index.js +1 -0
  51. package/src/switch/switch.jsx +132 -0
  52. package/src/textarea/README.md +24 -0
  53. package/src/textarea/textarea.jsx +44 -65
  54. package/src/textbox/README.md +24 -0
  55. package/src/textbox/textbox.jsx +64 -66
  56. package/utils/styles.js +29 -2
  57. package/src/masked/README.md +0 -0
  58. package/src/masked/index.js +0 -1
  59. package/src/masked/masked.jsx +0 -139
  60. package/src/numeric/README.md +0 -0
  61. package/src/numeric/index.js +0 -1
  62. package/src/numeric/numeric.jsx +0 -149
@@ -1,30 +1,8 @@
1
- import * as styles from '../../utils/styles';
2
- import { Component, globalDefaultProps } from '../component';
3
- import { InputStatic, InputPrefixStatic, InputSuffixStatic } from '../input/index';
4
-
5
- class Textbox extends Component {
6
-
7
- init() {
8
- let children = Array.from(this.element.children);
9
- let prefix = document.createDocumentFragment();
10
- let suffix = document.createDocumentFragment();
11
-
12
- children.forEach( child => {
13
- const isName = child.getAttribute('is');
14
-
15
- if (isName === 'InputPrefix') {
16
- prefix.append( ...child.childNodes );
17
- }
18
-
19
- if (isName === 'InputSuffix') {
20
- suffix.append( ...child.childNodes );
21
- }
22
- });
23
-
24
- this._props.prefix = prefix;
25
- this._props.suffix = suffix;
26
- }
1
+ import { globalDefaultProps } from '../component';
2
+ import { Input, InputStatic, InputInnerInputStatic } from '../input/index';
3
+ import { InputValidationIconStatic, InputLoadingIconStatic, InputClearValueStatic } from '../input/index';
27
4
 
5
+ class Textbox extends Input {
28
6
  render() {
29
7
  return <TextboxStatic {...this.props} />;
30
8
  }
@@ -38,6 +16,7 @@ function TextboxStatic(props) {
38
16
  type,
39
17
  value,
40
18
  placeholder,
19
+ autocomplete,
41
20
 
42
21
  prefix,
43
22
  suffix,
@@ -49,6 +28,7 @@ function TextboxStatic(props) {
49
28
 
50
29
  hover,
51
30
  focus,
31
+ valid,
52
32
  invalid,
53
33
  required,
54
34
  disabled,
@@ -59,64 +39,69 @@ function TextboxStatic(props) {
59
39
  ...htmlAttributes
60
40
  } = props;
61
41
 
42
+ htmlAttributes.size = size;
43
+ htmlAttributes.rounded = rounded;
44
+ htmlAttributes.fillMode = fillMode;
45
+ htmlAttributes.hover = hover;
46
+ htmlAttributes.focus = focus;
47
+ htmlAttributes.valid = valid;
48
+ htmlAttributes.invalid = invalid;
49
+ htmlAttributes.required = required;
50
+ htmlAttributes.disabled = disabled;
51
+
62
52
  const inputAttributes = {
63
53
  type,
64
54
  value,
65
55
  placeholder,
56
+ autocomplete,
66
57
 
67
58
  disabled
68
59
  };
69
60
 
70
- let ariaAttr = aria
71
- ? {}
72
- : {};
73
-
74
61
  let textboxClasses = [
75
62
  ownClassName,
76
- 'k-textbox',
77
- styles.sizeClass( size, 'k-textbox' ),
78
- styles.roundedClass( rounded ),
79
- styles.fillModeClass( fillMode, 'k-textbox' ),
80
- {
81
- 'k-hover': hover === true,
82
- 'k-focus': focus === true,
83
- 'k-invalid': invalid === true,
84
- 'k-required': required === true,
85
- 'k-disabled': disabled === true
86
- }
63
+ 'k-textbox'
87
64
  ];
88
65
 
89
- let legacyClasses = [
90
- ownClassName,
91
- 'k-textbox',
92
- {
93
- 'k-state-hover': hover === true,
94
- 'k-state-focus': focus === true,
95
- 'k-state-invalid': invalid === true,
96
- 'k-state-required': required === true,
97
- 'k-state-disabled': disabled === true
98
- }
99
- ];
100
-
101
- // Augment attributes
102
- inputAttributes.type = type !== 'password' ? 'text' : type;
66
+ let ariaAttr = aria
67
+ ? {}
68
+ : {};
103
69
 
104
70
  if (legacy) {
71
+
72
+ let legacyClasses = [
73
+ ownClassName,
74
+ 'k-textbox',
75
+ {
76
+ 'k-state-hover': hover === true,
77
+ 'k-state-focus': focus === true,
78
+ 'k-state-invalid': invalid === true,
79
+ 'k-state-required': required === true,
80
+ 'k-state-disabled': disabled === true
81
+ }
82
+ ];
83
+
105
84
  return (
106
- <span className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
107
- <InputPrefixStatic>{prefix}</InputPrefixStatic>
108
- <InputStatic {...inputAttributes} />
109
- <InputSuffixStatic>{suffix}</InputSuffixStatic>
110
- </span>
85
+ <InputStatic className={legacyClasses} {...htmlAttributes}>
86
+ {prefix}
87
+ <input type={type} className="k-input" {...inputAttributes} />
88
+ {suffix}
89
+ <InputValidationIconStatic {...props} />
90
+ <InputLoadingIconStatic {...props} />
91
+ <InputClearValueStatic {...props} />
92
+ </InputStatic>
111
93
  );
112
94
  }
113
95
 
114
96
  return (
115
- <span className={textboxClasses} {...ariaAttr} {...htmlAttributes}>
97
+ <InputStatic className={textboxClasses} {...ariaAttr} {...htmlAttributes}>
116
98
  {prefix}
117
- <InputStatic {...inputAttributes} />
99
+ <InputInnerInputStatic {...inputAttributes} />
118
100
  {suffix}
119
- </span>
101
+ <InputValidationIconStatic {...props} />
102
+ <InputLoadingIconStatic {...props} />
103
+ <InputClearValueStatic {...props} />
104
+ </InputStatic>
120
105
  );
121
106
  }
122
107
 
@@ -126,6 +111,11 @@ TextboxStatic.defaultProps = {
126
111
  type: 'text',
127
112
  value: '',
128
113
  placeholder: '',
114
+ autocomplete: 'off',
115
+
116
+ showValidationIcon: true,
117
+ showLoadingIcon: true,
118
+ showClearButton: true,
129
119
 
130
120
  size: 'medium',
131
121
  rounded: 'medium',
@@ -134,12 +124,20 @@ TextboxStatic.defaultProps = {
134
124
  };
135
125
 
136
126
  TextboxStatic.propTypes = {
127
+ children: typeof [],
128
+ className: typeof '',
129
+
137
130
  type: typeof [ 'text', 'password' ],
138
131
  value: typeof '',
139
132
  placeholder: typeof '',
133
+ autocomplete: typeof [ 'on', 'off' ],
134
+
135
+ showValidationIcon: typeof true,
136
+ showLoadingIcon: typeof true,
137
+ showClearButton: typeof true,
140
138
 
141
- prefix: typeof document.createDocumentFragment(),
142
- suffix: typeof document.createDocumentFragment(),
139
+ prefix: typeof '#fragment',
140
+ suffix: typeof '#fragment',
143
141
 
144
142
  size: typeof [ 'none', 'small', 'medium', 'large' ],
145
143
  rounded: typeof [ 'none', 'small', 'medium', 'large', 'pill' ],
@@ -150,13 +148,13 @@ TextboxStatic.propTypes = {
150
148
  focus: typeof false,
151
149
  valid: typeof false,
152
150
  invalid: typeof false,
151
+ loading: typeof false,
153
152
  required: typeof false,
154
153
  disabled: typeof false,
155
154
 
156
155
  aria: typeof false,
157
156
  legacy: typeof false,
158
157
 
159
- className: typeof '',
160
158
  htmlAttributes: typeof []
161
159
  };
162
160
 
package/utils/styles.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isString, isObject } from './object';
1
+ import { isString, isArray, isObject } from './object';
2
2
 
3
3
  const SPACE = ' ';
4
4
 
@@ -71,6 +71,12 @@ function classNames( ...args ) {
71
71
  let temp = args.flat().filter( arg => arg !== true && Boolean( arg ) );
72
72
 
73
73
  temp.forEach( className => {
74
+
75
+ if ( isArray( className ) ) {
76
+ classNames( className ).split( SPACE ).forEach( part => result.add( part ) );
77
+ return;
78
+ }
79
+
74
80
  if ( isString( className ) ) {
75
81
  className.split( SPACE ).forEach( part => result.add( part ) );
76
82
  return;
@@ -89,6 +95,26 @@ function classNames( ...args ) {
89
95
  /* eslint-enable */
90
96
  }
91
97
 
98
+ function cssStyle( styleObj ) {
99
+ let result = new Set();
100
+
101
+ if ( styleObj === null || styleObj === undefined ) {
102
+ return '';
103
+ }
104
+
105
+ if ( typeof styleObj === 'string' ) {
106
+ return styleObj;
107
+ }
108
+
109
+ for (const [ key, value ] of Object.entries(styleObj)) {
110
+ if ( typeof value === 'string' && value !== '' ) {
111
+ result.add( `${key}: ${value};` );
112
+ }
113
+ }
114
+
115
+ return [ ...result ].join( SPACE );
116
+ }
117
+
92
118
 
93
119
  export {
94
120
  sizeClass,
@@ -97,5 +123,6 @@ export {
97
123
  fillModeClass,
98
124
  themeColorClass,
99
125
 
100
- classNames
126
+ classNames,
127
+ cssStyle,
101
128
  };
File without changes
@@ -1 +0,0 @@
1
- export * from './masked.jsx';
@@ -1,139 +0,0 @@
1
- import * as styles from '../../utils/styles';
2
- import { Component, globalDefaultProps } from '../component';
3
- import { IconStatic } from '../icon/index';
4
- import { InputStatic } from '../input/index';
5
-
6
- class MaskedTextbox extends Component {
7
-
8
- render() {
9
- return <MaskedTextboxStatic {...this.props} />;
10
- }
11
- }
12
-
13
- function MaskedTextboxStatic(props) {
14
-
15
- const {
16
- className: ownClassName,
17
-
18
- value,
19
- placeholder,
20
-
21
- size,
22
- rounded,
23
-
24
- fillMode,
25
-
26
- hover,
27
- focus,
28
- invalid,
29
- required,
30
- disabled,
31
-
32
- aria,
33
- legacy,
34
-
35
- ...htmlAttributes
36
-
37
- } = props;
38
-
39
- const inputAttributes = {
40
- type: 'text',
41
- value,
42
- placeholder,
43
-
44
- disabled
45
- };
46
-
47
- let ariaAttr = aria
48
- ? {}
49
- : {};
50
-
51
- let maskedClasses = [
52
- ownClassName,
53
- 'k-maskedtextbox',
54
- styles.sizeClass( size, 'k-maskedtextbox' ),
55
- styles.roundedClass( rounded ),
56
- styles.fillModeClass( fillMode, 'k-maskedtextbox' ),
57
- {
58
- 'k-hover': hover === true,
59
- 'k-focus': focus === true,
60
- 'k-invalid': invalid === true,
61
- 'k-required': required === true,
62
- 'k-disabled': disabled === true
63
- }
64
- ];
65
-
66
- let legacyClasses = [
67
- ownClassName,
68
- 'k-widget',
69
- 'k-maskedtextbox',
70
- {
71
- 'k-state-disabled': disabled === true
72
- }
73
- ];
74
-
75
- let legacyWrapClasses = [
76
- ownClassName,
77
- 'k-textbox',
78
- {
79
- 'k-state-hover': hover === true,
80
- 'k-state-focused': focus === true,
81
- 'k-state-invalid': invalid === true
82
- }
83
- ];
84
-
85
- if (legacy) {
86
- return (
87
- <span className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
88
- <input className={legacyWrapClasses} {...inputAttributes} />
89
- {invalid && <IconStatic name="warning" />}
90
- </span>
91
- );
92
- }
93
-
94
- return (
95
- <span className={maskedClasses} {...ariaAttr} {...htmlAttributes}>
96
- <InputStatic {...inputAttributes} />
97
- {invalid && <IconStatic className="k-input-icon" name="warning" />}
98
- </span>
99
- );
100
- }
101
-
102
- MaskedTextboxStatic.defaultProps = {
103
- ...globalDefaultProps,
104
-
105
- value: '',
106
- placeholder: '',
107
-
108
- size: 'medium',
109
- rounded: 'medium',
110
-
111
- fillMode: 'solid'
112
- };
113
-
114
- MaskedTextboxStatic.propTypes = {
115
- type: typeof [ 'text' ],
116
- value: typeof '',
117
- placeholder: typeof '',
118
-
119
- size: typeof [ 'none', 'small', 'medium', 'large' ],
120
- rounded: typeof [ 'none', 'small', 'medium', 'large', 'pill' ],
121
-
122
- fillMode: typeof [ 'none', 'solid', 'flat', 'outline' ],
123
-
124
- hover: typeof false,
125
- focus: typeof false,
126
- valid: typeof false,
127
- invalid: typeof false,
128
- required: typeof false,
129
- disabled: typeof false,
130
-
131
- aria: typeof false,
132
- legacy: typeof false,
133
-
134
- className: typeof '',
135
- htmlAttributes: typeof []
136
- };
137
-
138
- export { MaskedTextbox, MaskedTextboxStatic };
139
-
File without changes
@@ -1 +0,0 @@
1
- export * from './numeric.jsx';
@@ -1,149 +0,0 @@
1
- import * as styles from '../../utils/styles';
2
- import { Component, globalDefaultProps } from '../component';
3
- import { InputStatic } from '../input/index';
4
- import { SpinButtonStatic } from '../spinbutton/index';
5
-
6
- class NumericTextbox extends Component {
7
-
8
- render() {
9
- return <NumericTextboxStatic {...this.props} />;
10
- }
11
- }
12
-
13
- function NumericTextboxStatic(props) {
14
-
15
- const {
16
- className: ownClassName,
17
-
18
- value,
19
- placeholder,
20
-
21
- showSpinButtons,
22
-
23
- size,
24
- rounded,
25
-
26
- fillMode,
27
-
28
- hover,
29
- focus,
30
- invalid,
31
- required,
32
- disabled,
33
-
34
- aria,
35
- legacy,
36
-
37
- ...htmlAttributes
38
-
39
- } = props;
40
-
41
- const inputAttributes = {
42
- type: 'text',
43
- value,
44
- placeholder,
45
-
46
- className: "k-formatted-value",
47
-
48
- disabled
49
- };
50
-
51
- let ariaAttr = aria
52
- ? {}
53
- : {};
54
-
55
- let numericClasses = [
56
- ownClassName,
57
- 'k-numerictextbox',
58
- styles.sizeClass( size, 'k-numerictextbox' ),
59
- styles.roundedClass( rounded ),
60
- styles.fillModeClass( fillMode, 'k-numerictextbox' ),
61
- {
62
- 'k-hover': hover === true,
63
- 'k-focus': focus === true,
64
- 'k-invalid': invalid === true,
65
- 'k-required': required === true,
66
- 'k-disabled': disabled === true
67
- }
68
- ];
69
-
70
- let legacyClasses = [
71
- ownClassName,
72
- 'k-widget',
73
- 'k-numerictextbox',
74
- {
75
- 'k-state-disabled': disabled === true
76
- }
77
- ];
78
-
79
- let legacyWrapClasses = [
80
- ownClassName,
81
- 'k-numeric-wrap',
82
- {
83
- 'k-state-hover': hover === true,
84
- 'k-state-focused': focus === true,
85
- 'k-state-invalid': invalid === true
86
- }
87
- ];
88
-
89
- if (legacy) {
90
- return (
91
- <span className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
92
- <span className={legacyWrapClasses}>
93
- <InputStatic {...inputAttributes} />
94
- {showSpinButtons === true && <SpinButtonStatic />}
95
- </span>
96
- </span>
97
- );
98
- }
99
-
100
- return (
101
- <span className={numericClasses} {...ariaAttr} {...htmlAttributes}>
102
- <InputStatic {...inputAttributes} />
103
- {showSpinButtons === true && <SpinButtonStatic className="k-input-spinner k-numeric-spinner" />}
104
- </span>
105
- );
106
- }
107
-
108
- NumericTextboxStatic.defaultProps = {
109
- ...globalDefaultProps,
110
-
111
- value: '',
112
- placeholder: '',
113
-
114
- showSpinButtons: true,
115
-
116
- size: 'medium',
117
- rounded: 'medium',
118
-
119
- fillMode: 'solid'
120
- };
121
-
122
- NumericTextboxStatic.propTypes = {
123
- type: typeof [ 'text' ],
124
- value: typeof '',
125
- placeholder: typeof '',
126
-
127
- showSpinButtons: typeof true,
128
-
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,
140
-
141
- aria: typeof false,
142
- legacy: typeof false,
143
-
144
- className: typeof '',
145
- htmlAttributes: typeof []
146
- };
147
-
148
- export { NumericTextbox, NumericTextboxStatic };
149
-