@progress/kendo-themes-html 5.0.0-next.4 → 5.1.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 +231 -14
- package/package.json +8 -8
- package/src/autocomplete/README.md +30 -0
- package/src/autocomplete/autocomplete.jsx +160 -0
- package/src/autocomplete/index.js +1 -0
- package/src/avatar/README.md +21 -0
- package/src/avatar/avatar.jsx +110 -0
- package/src/avatar/index.js +1 -0
- package/src/button/README.md +22 -0
- package/src/button/button.jsx +165 -0
- package/src/button/index.js +1 -0
- package/src/checkbox/README.md +22 -0
- package/src/checkbox/checkbox.jsx +123 -0
- package/src/checkbox/index.js +1 -0
- package/src/chip/README.md +47 -0
- package/src/chip/chip-actions.jsx +80 -0
- package/src/chip/chip-avatar.jsx +13 -0
- package/src/chip/chip-list.jsx +84 -0
- package/src/chip/chip.jsx +180 -0
- package/src/chip/index.js +4 -0
- package/src/colorpicker/README.md +39 -0
- package/src/colorpicker/color-preview.jsx +101 -0
- package/src/colorpicker/colorpicker.jsx +151 -0
- package/src/colorpicker/index.js +2 -0
- package/src/combobox/README.md +36 -0
- package/src/combobox/combobox.jsx +168 -0
- package/src/combobox/index.js +1 -0
- package/src/{component.js → component/component.jsx} +10 -7
- package/src/component/index.js +1 -0
- package/src/dateinput/README.md +48 -0
- package/src/dateinput/dateinput.jsx +168 -0
- package/src/dateinput/index.js +1 -0
- package/src/datepicker/README.md +36 -0
- package/src/datepicker/datepicker.jsx +168 -0
- package/src/datepicker/index.js +1 -0
- package/src/datetimepicker/README.md +36 -0
- package/src/datetimepicker/datetimepicker.jsx +168 -0
- package/src/datetimepicker/index.js +1 -0
- package/src/dropdownlist/README.md +39 -0
- package/src/dropdownlist/dropdownlist.jsx +191 -0
- package/src/dropdownlist/index.js +1 -0
- package/src/fab/README.md +19 -0
- package/src/fab/fab.jsx +150 -0
- package/src/fab/index.js +1 -0
- package/src/icon/README.md +0 -0
- package/src/icon/icon.jsx +59 -0
- package/src/icon/index.js +1 -0
- package/src/index.js +90 -8
- package/src/input/README.md +0 -0
- package/src/input/index.js +8 -0
- package/src/input/input-clear-value.jsx +31 -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 +48 -0
- package/src/input/input-suffix.jsx +48 -0
- package/src/input/input-validation-icon.jsx +37 -0
- package/src/input/input.jsx +147 -0
- package/src/input/picker.jsx +145 -0
- package/src/list/README.md +107 -0
- package/src/list/index.js +5 -0
- package/src/list/list-content.jsx +95 -0
- package/src/list/list-group-item.jsx +66 -0
- package/src/list/list-header.jsx +67 -0
- package/src/list/list-item.jsx +117 -0
- package/src/list/list.jsx +182 -0
- package/src/maskedtextbox/README.md +30 -0
- package/src/maskedtextbox/index.js +1 -0
- package/src/maskedtextbox/maskedtextbox.jsx +152 -0
- package/src/menu/README.md +40 -0
- package/src/menu/index.js +3 -0
- package/src/menu/menu-item-content.jsx +48 -0
- package/src/menu/menu-item.jsx +174 -0
- package/src/menu/menu-list.jsx +74 -0
- package/src/menubutton/README.md +60 -0
- package/src/menubutton/index.js +1 -0
- package/src/menubutton/menubutton.jsx +161 -0
- package/src/multiselect/README.md +37 -0
- package/src/multiselect/index.js +2 -0
- package/src/multiselect/multiselect-chip-list.jsx +55 -0
- package/src/multiselect/multiselect.jsx +189 -0
- package/src/nodata/index.js +1 -0
- package/src/nodata/nodata.jsx +64 -0
- package/src/numerictextbox/README.md +48 -0
- package/src/numerictextbox/index.js +1 -0
- package/src/numerictextbox/numerictextbox.jsx +169 -0
- package/src/popup/README.md +15 -0
- package/src/popup/index.js +1 -0
- package/src/popup/popup.jsx +80 -0
- package/src/radio/README.md +21 -0
- package/src/radio/index.js +1 -0
- package/src/radio/radio.jsx +107 -0
- package/src/searchbar/README.md +0 -0
- package/src/searchbar/index.js +1 -0
- package/src/searchbar/searchbar.jsx +55 -0
- package/src/searchbox/README.md +30 -0
- package/src/searchbox/index.js +1 -0
- package/src/searchbox/searchbox.jsx +171 -0
- package/src/spinbutton/README.md +0 -0
- package/src/spinbutton/index.js +1 -0
- package/src/spinbutton/spinbutton.jsx +71 -0
- package/src/splitbutton/README.md +76 -0
- package/src/splitbutton/index.js +1 -0
- package/src/splitbutton/splitbutton.jsx +176 -0
- 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 +30 -0
- package/src/textarea/index.js +1 -0
- package/src/textarea/textarea.jsx +137 -0
- package/src/textbox/README.md +30 -0
- package/src/textbox/index.js +1 -0
- package/src/textbox/textbox.jsx +162 -0
- package/src/timepicker/README.md +36 -0
- package/src/timepicker/index.js +1 -0
- package/src/timepicker/timepicker.jsx +168 -0
- package/src/treeview/README.md +0 -0
- package/src/treeview/index.js +4 -0
- package/src/treeview/treeview-group.jsx +70 -0
- package/src/treeview/treeview-item.jsx +142 -0
- package/src/treeview/treeview-leaf.jsx +99 -0
- package/src/treeview/treeview.jsx +125 -0
- package/utils/styles.js +52 -7
- package/src/button.jsx +0 -114
- package/src/icon.jsx +0 -37
package/lib/jsx-runtime.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/* eslint-disable no-new */
|
|
2
|
+
/* global kendo */
|
|
1
3
|
import { isFunction, isArray, isObject } from '../utils/object';
|
|
2
|
-
import { classNames } from '../utils/styles';
|
|
4
|
+
import { classNames, cssStyle } from '../utils/styles';
|
|
3
5
|
|
|
4
6
|
const JSX_FRAGMENT = '#fragment';
|
|
5
7
|
const JSX_TEXT = '#text';
|
|
@@ -7,21 +9,200 @@ const JSX_TEXT = '#text';
|
|
|
7
9
|
const attrMap = {
|
|
8
10
|
'class': 'className',
|
|
9
11
|
themecolor: 'themeColor',
|
|
10
|
-
fillmode: 'fillMode'
|
|
12
|
+
fillmode: 'fillMode',
|
|
13
|
+
|
|
14
|
+
// Inputs
|
|
15
|
+
showtext: 'showText',
|
|
16
|
+
showvalue: 'showValue',
|
|
17
|
+
valueicon: 'valueIcon',
|
|
18
|
+
valueiconname: 'valueIconName',
|
|
19
|
+
showicon: 'showIcon',
|
|
20
|
+
iconposition: 'iconPosition',
|
|
21
|
+
iconname: 'iconName',
|
|
22
|
+
showarrow: 'showArrow',
|
|
23
|
+
arrowicon: 'arrowIcon',
|
|
24
|
+
arrowiconname: 'arrowIconName',
|
|
25
|
+
showarrowbutton: 'showArrowButton',
|
|
26
|
+
arrowbutton: 'arrowButton',
|
|
27
|
+
showdropdownbutton: 'showDropdownButton',
|
|
28
|
+
dropdownbutton: 'dropdownButton',
|
|
29
|
+
showspinbutton: 'showSpinButton',
|
|
30
|
+
spinbutton: 'spinButton',
|
|
31
|
+
showclearbutton: 'showClearButton',
|
|
32
|
+
clearbutton: 'clearButton',
|
|
33
|
+
|
|
34
|
+
showcheckbox: 'showCheckbox',
|
|
35
|
+
|
|
36
|
+
// Switch
|
|
37
|
+
onlabel: 'onLabel',
|
|
38
|
+
offlabel: 'offLabel',
|
|
39
|
+
trackrounded: 'trackRounded',
|
|
40
|
+
thumbrounded: 'thumbRounded',
|
|
41
|
+
|
|
42
|
+
// Chip
|
|
43
|
+
showavatar: 'showAvatar',
|
|
44
|
+
|
|
45
|
+
// Hierarchy
|
|
46
|
+
haschildren: 'hasChildren',
|
|
47
|
+
|
|
48
|
+
// Treeview
|
|
49
|
+
leafclassname: 'leafClassName',
|
|
50
|
+
|
|
51
|
+
// Template
|
|
52
|
+
contenttemplate: 'contentTemplate'
|
|
11
53
|
};
|
|
12
54
|
|
|
13
|
-
|
|
14
|
-
|
|
55
|
+
const booleanAttr = new Set([
|
|
56
|
+
'hidden',
|
|
57
|
+
|
|
58
|
+
'hover',
|
|
59
|
+
'focus',
|
|
60
|
+
'active',
|
|
61
|
+
'readonly',
|
|
62
|
+
'disabled',
|
|
63
|
+
|
|
64
|
+
'checked',
|
|
65
|
+
'indeterminate',
|
|
66
|
+
|
|
67
|
+
'valid',
|
|
68
|
+
'invalid',
|
|
69
|
+
'required',
|
|
70
|
+
|
|
71
|
+
'selected',
|
|
72
|
+
'loading',
|
|
73
|
+
|
|
74
|
+
'showText',
|
|
75
|
+
'showValue',
|
|
76
|
+
'showIcon',
|
|
77
|
+
'showClearButton',
|
|
78
|
+
'showSpinButton',
|
|
79
|
+
'showArrow',
|
|
80
|
+
|
|
81
|
+
'showCheckbox',
|
|
82
|
+
|
|
83
|
+
'virtualization',
|
|
84
|
+
'root',
|
|
85
|
+
|
|
86
|
+
'open',
|
|
87
|
+
'expanded',
|
|
88
|
+
'hasChildren',
|
|
89
|
+
|
|
90
|
+
'showArrow',
|
|
91
|
+
|
|
92
|
+
'showAvatar',
|
|
93
|
+
|
|
94
|
+
'aria'
|
|
95
|
+
]);
|
|
96
|
+
|
|
97
|
+
const nullAttr = new Set([
|
|
98
|
+
'size',
|
|
99
|
+
'shape',
|
|
100
|
+
'rounded',
|
|
101
|
+
'fillMode',
|
|
102
|
+
'themeColor',
|
|
103
|
+
|
|
104
|
+
'trackRounded',
|
|
105
|
+
'thumbRounded'
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
const skipAttr = new Set([
|
|
109
|
+
'is',
|
|
110
|
+
'aria',
|
|
111
|
+
'legacy'
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
const setAttr = new Set([
|
|
115
|
+
// Global
|
|
116
|
+
'id',
|
|
117
|
+
'style',
|
|
118
|
+
|
|
119
|
+
// Related to forms
|
|
120
|
+
'type',
|
|
121
|
+
'value',
|
|
122
|
+
'placeholder',
|
|
123
|
+
'autocomplete'
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
function htmlToProps( element ) {
|
|
127
|
+
let props = attrToProps( element.attributes );
|
|
128
|
+
let children = Array.from( element.childNodes );
|
|
129
|
+
|
|
130
|
+
props.children = [];
|
|
131
|
+
|
|
132
|
+
children.forEach( child => {
|
|
133
|
+
let childProps;
|
|
134
|
+
let nodeType = child.nodeType;
|
|
135
|
+
|
|
136
|
+
if ( nodeType === Node.TEXT_NODE ) {
|
|
137
|
+
let textContent = child.textContent.trim();
|
|
138
|
+
|
|
139
|
+
if ( textContent !== '' ) {
|
|
140
|
+
childProps = {
|
|
141
|
+
type: JSX_TEXT,
|
|
142
|
+
props: {
|
|
143
|
+
text: textContent
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
props.children.push( childProps );
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if ( nodeType === Node.ELEMENT_NODE ) {
|
|
152
|
+
let componentName = child.getAttribute('is');
|
|
153
|
+
let component = kendo.Html[componentName];
|
|
154
|
+
|
|
155
|
+
if (isFunction( component )) {
|
|
156
|
+
component = new component( child );
|
|
157
|
+
childProps = component.render();
|
|
158
|
+
childProps._component = componentName;
|
|
159
|
+
} else {
|
|
160
|
+
childProps = {
|
|
161
|
+
type: child.nodeName,
|
|
162
|
+
props: htmlToProps( child )
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
props.children.push( childProps );
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return props;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function attrToProps( attributes ) {
|
|
15
176
|
let props = {};
|
|
16
177
|
|
|
17
178
|
Array.from(attributes).forEach((attrObj) => {
|
|
18
179
|
let attrName = attrObj.name;
|
|
180
|
+
let attrValue = attrObj.value;
|
|
19
181
|
|
|
20
182
|
if (attrMap[attrName]) {
|
|
21
183
|
attrName = attrMap[attrName];
|
|
22
184
|
}
|
|
23
185
|
|
|
24
|
-
|
|
186
|
+
// Set props as is
|
|
187
|
+
props[ attrName ] = attrValue;
|
|
188
|
+
|
|
189
|
+
// Ensure boolean value
|
|
190
|
+
if (booleanAttr.has(attrName) && typeof attrValue === 'string') {
|
|
191
|
+
switch (attrValue) {
|
|
192
|
+
case '':
|
|
193
|
+
case 'true':
|
|
194
|
+
props[ attrName ] = true;
|
|
195
|
+
break;
|
|
196
|
+
default:
|
|
197
|
+
props[ attrName ] = false;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Ensure null value
|
|
203
|
+
if (nullAttr.has(attrName) && attrValue === 'null') {
|
|
204
|
+
props[ attrName ] = null;
|
|
205
|
+
}
|
|
25
206
|
});
|
|
26
207
|
|
|
27
208
|
return props;
|
|
@@ -65,12 +246,28 @@ function jsxs( type, config ) {
|
|
|
65
246
|
|
|
66
247
|
function renderDOM( jsxNode, container = null ) {
|
|
67
248
|
|
|
68
|
-
|
|
249
|
+
// Handle native nodes
|
|
250
|
+
switch (jsxNode.nodeType) {
|
|
251
|
+
case Node.TEXT_NODE:
|
|
252
|
+
case Node.ELEMENT_NODE:
|
|
253
|
+
case Node.DOCUMENT_FRAGMENT_NODE: {
|
|
254
|
+
|
|
255
|
+
if ( container !== null ) {
|
|
256
|
+
container.appendChild( jsxNode );
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return jsxNode;
|
|
260
|
+
}
|
|
261
|
+
default:
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const jsxNodeType = jsxNode.type;
|
|
69
266
|
const { children = [], ...props } = jsxNode.props;
|
|
70
267
|
let element;
|
|
71
268
|
let textNode;
|
|
72
269
|
|
|
73
|
-
if (
|
|
270
|
+
if ( jsxNodeType === JSX_TEXT ) {
|
|
74
271
|
textNode = document.createTextNode( props.text || '' );
|
|
75
272
|
|
|
76
273
|
if ( container !== null ) {
|
|
@@ -80,21 +277,40 @@ function renderDOM( jsxNode, container = null ) {
|
|
|
80
277
|
return textNode;
|
|
81
278
|
}
|
|
82
279
|
|
|
83
|
-
if (
|
|
280
|
+
if ( jsxNodeType === JSX_FRAGMENT ) {
|
|
84
281
|
element = document.createDocumentFragment();
|
|
85
282
|
} else {
|
|
86
|
-
element = document.createElement(
|
|
283
|
+
element = document.createElement(jsxNodeType);
|
|
87
284
|
}
|
|
88
285
|
|
|
89
286
|
props.className = classNames( props.className );
|
|
287
|
+
props.style = cssStyle( props.style );
|
|
90
288
|
|
|
91
289
|
for (let [ attr, val ] of Object.entries(props)) {
|
|
92
|
-
|
|
290
|
+
if (skipAttr.has(attr)) {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (setAttr.has(attr)) {
|
|
295
|
+
if (val !== '') {
|
|
296
|
+
element.setAttribute( attr, val );
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
element[attr] = val;
|
|
300
|
+
}
|
|
93
301
|
}
|
|
94
302
|
|
|
95
|
-
children.
|
|
96
|
-
|
|
97
|
-
}
|
|
303
|
+
if (children.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
304
|
+
element.append( children );
|
|
305
|
+
} else {
|
|
306
|
+
children.forEach( child => {
|
|
307
|
+
if (child === null) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
renderDOM( child, element );
|
|
312
|
+
});
|
|
313
|
+
}
|
|
98
314
|
|
|
99
315
|
if ( container !== null ) {
|
|
100
316
|
container.appendChild( element );
|
|
@@ -108,5 +324,6 @@ export {
|
|
|
108
324
|
jsxs,
|
|
109
325
|
JSX_FRAGMENT as Fragment,
|
|
110
326
|
renderDOM,
|
|
111
|
-
attrToProps
|
|
327
|
+
attrToProps,
|
|
328
|
+
htmlToProps
|
|
112
329
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-themes-html",
|
|
3
3
|
"description": "A collection of HTML helpers used for developing Kendo UI themes",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.1.0",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dev": "rollup -cw"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@babel/core": "^7.
|
|
38
|
-
"@babel/preset-env": "^7.
|
|
39
|
-
"@babel/preset-react": "^7.
|
|
37
|
+
"@babel/core": "^7.16.7",
|
|
38
|
+
"@babel/preset-env": "^7.16.7",
|
|
39
|
+
"@babel/preset-react": "^7.16.7",
|
|
40
40
|
"@rollup/plugin-babel": "^5.3.0",
|
|
41
|
-
"@rollup/plugin-commonjs": "^
|
|
42
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
43
|
-
"rollup": "^2.
|
|
41
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^13.1.2",
|
|
43
|
+
"rollup": "^2.62.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "279941cb925d750fc123f66c3e15ce1e2b666191"
|
|
46
46
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
```html
|
|
2
|
+
<!-- default rendering -->
|
|
3
|
+
<span class="k-autocomplete k-input k-input-md k-rounded-md k-input-solid">
|
|
4
|
+
<input type="text" class="k-input-inner" value="..." placeholder="..." />
|
|
5
|
+
</span>
|
|
6
|
+
|
|
7
|
+
<!-- canonical rendering -->
|
|
8
|
+
<span class="
|
|
9
|
+
k-autocomplete
|
|
10
|
+
k-input
|
|
11
|
+
k-input-{size}
|
|
12
|
+
k-rounded-{rounded}
|
|
13
|
+
k-input-{fillMode}
|
|
14
|
+
|
|
15
|
+
{valid && 'k-valid'}
|
|
16
|
+
{invalid && 'k-invalid'}
|
|
17
|
+
{loading && 'k-loading'}
|
|
18
|
+
{required && 'k-required'}
|
|
19
|
+
{disabled && 'k-disabled'}
|
|
20
|
+
">
|
|
21
|
+
{showInputIcon && inputIconName !== '' && <span class="k-input-icon k-i-icon k-i-{inputIconName}"></span>}
|
|
22
|
+
{inputPrefix && <span class="k-input-prefix">...</span>}
|
|
23
|
+
<input type={type} class="k-input-inner" value={value} placeholder={placeholder} disabled={disabled} />
|
|
24
|
+
{inputPrefix && <span class="k-input-suffix">...</span>}
|
|
25
|
+
{showValidationIcon && valid && <span class="k-validation-icon k-icon k-i-check"></span>}
|
|
26
|
+
{showValidationIcon && invalid && <span class="k-validation-icon k-icon k-i-warning"></span>}
|
|
27
|
+
{showLoadingIcon && loading && <span class="k-icon k-i-loading"></span>}
|
|
28
|
+
{showClearValue && text !== '' && <span class="k-clear-value"><span class="k-icon k-i-x"></span></span>}
|
|
29
|
+
</span>
|
|
30
|
+
```
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { globalDefaultProps } from '../component/index';
|
|
2
|
+
import { Input, InputStatic, InputInnerInputStatic } from '../input/index';
|
|
3
|
+
import { InputValidationIconStatic, InputLoadingIconStatic, InputClearValueStatic } from '../input/index';
|
|
4
|
+
|
|
5
|
+
class Autocomplete extends Input {
|
|
6
|
+
render() {
|
|
7
|
+
return <AutocompleteStatic {...this.props} />;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function AutocompleteStatic(props) {
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
className: ownClassName,
|
|
15
|
+
|
|
16
|
+
type,
|
|
17
|
+
value,
|
|
18
|
+
placeholder,
|
|
19
|
+
autocomplete,
|
|
20
|
+
|
|
21
|
+
prefix,
|
|
22
|
+
suffix,
|
|
23
|
+
|
|
24
|
+
size,
|
|
25
|
+
rounded,
|
|
26
|
+
|
|
27
|
+
fillMode,
|
|
28
|
+
|
|
29
|
+
hover,
|
|
30
|
+
focus,
|
|
31
|
+
valid,
|
|
32
|
+
invalid,
|
|
33
|
+
required,
|
|
34
|
+
disabled,
|
|
35
|
+
|
|
36
|
+
aria,
|
|
37
|
+
legacy,
|
|
38
|
+
|
|
39
|
+
...htmlAttributes
|
|
40
|
+
} = props;
|
|
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
|
+
|
|
52
|
+
const inputAttributes = {
|
|
53
|
+
type,
|
|
54
|
+
value,
|
|
55
|
+
placeholder,
|
|
56
|
+
autocomplete,
|
|
57
|
+
|
|
58
|
+
disabled
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
let autocompleteClasses = [
|
|
62
|
+
ownClassName,
|
|
63
|
+
'k-autocomplete'
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
let ariaAttr = aria
|
|
67
|
+
? {}
|
|
68
|
+
: {};
|
|
69
|
+
|
|
70
|
+
if (legacy) {
|
|
71
|
+
|
|
72
|
+
let legacyClasses = [
|
|
73
|
+
ownClassName,
|
|
74
|
+
'k-widget',
|
|
75
|
+
'k-autocomplete',
|
|
76
|
+
{
|
|
77
|
+
'k-state-hover': hover === true,
|
|
78
|
+
'k-state-focus': focus === true,
|
|
79
|
+
'k-state-invalid': invalid === true,
|
|
80
|
+
'k-state-required': required === true,
|
|
81
|
+
'k-state-disabled': disabled === true
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<InputStatic className={legacyClasses} {...htmlAttributes}>
|
|
87
|
+
<input type={type} className="k-input" {...inputAttributes} />
|
|
88
|
+
<InputValidationIconStatic {...props} />
|
|
89
|
+
<InputLoadingIconStatic {...props} />
|
|
90
|
+
<InputClearValueStatic {...props} />
|
|
91
|
+
</InputStatic>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<InputStatic className={autocompleteClasses} {...ariaAttr} {...htmlAttributes}>
|
|
97
|
+
{prefix}
|
|
98
|
+
<InputInnerInputStatic {...inputAttributes} />
|
|
99
|
+
{suffix}
|
|
100
|
+
<InputValidationIconStatic {...props} />
|
|
101
|
+
<InputLoadingIconStatic {...props} />
|
|
102
|
+
<InputClearValueStatic {...props} />
|
|
103
|
+
</InputStatic>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
AutocompleteStatic.defaultProps = {
|
|
108
|
+
...globalDefaultProps,
|
|
109
|
+
|
|
110
|
+
type: 'text',
|
|
111
|
+
value: '',
|
|
112
|
+
placeholder: '',
|
|
113
|
+
autocomplete: 'off',
|
|
114
|
+
|
|
115
|
+
showValidationIcon: true,
|
|
116
|
+
showLoadingIcon: true,
|
|
117
|
+
showClearButton: true,
|
|
118
|
+
|
|
119
|
+
size: 'medium',
|
|
120
|
+
rounded: 'medium',
|
|
121
|
+
|
|
122
|
+
fillMode: 'solid'
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
AutocompleteStatic.propTypes = {
|
|
126
|
+
children: typeof [],
|
|
127
|
+
className: typeof '',
|
|
128
|
+
|
|
129
|
+
type: typeof [ 'text', 'password' ],
|
|
130
|
+
value: typeof '',
|
|
131
|
+
placeholder: typeof '',
|
|
132
|
+
autocomplete: typeof [ 'on', 'off' ],
|
|
133
|
+
|
|
134
|
+
showValidationIcon: typeof true,
|
|
135
|
+
showLoadingIcon: typeof true,
|
|
136
|
+
showClearButton: typeof true,
|
|
137
|
+
|
|
138
|
+
prefix: typeof '#fragment',
|
|
139
|
+
suffix: typeof '#fragment',
|
|
140
|
+
|
|
141
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
142
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
143
|
+
|
|
144
|
+
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
145
|
+
|
|
146
|
+
hover: typeof false,
|
|
147
|
+
focus: typeof false,
|
|
148
|
+
valid: typeof false,
|
|
149
|
+
invalid: typeof false,
|
|
150
|
+
loading: typeof false,
|
|
151
|
+
required: typeof false,
|
|
152
|
+
disabled: typeof false,
|
|
153
|
+
|
|
154
|
+
aria: typeof false,
|
|
155
|
+
legacy: typeof false,
|
|
156
|
+
|
|
157
|
+
htmlAttributes: typeof []
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { Autocomplete, AutocompleteStatic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './autocomplete.jsx';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
```html
|
|
2
|
+
<!-- default rendering -->
|
|
3
|
+
<div class="k-avatar k-avatar-md k-rounded-circle k-avatar-solid k-avatar-solid-primary">
|
|
4
|
+
<span class="k-avatar-image">
|
|
5
|
+
<img src="../../assets/avatar.jpg" />
|
|
6
|
+
</span>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<!-- canonical rendering -->
|
|
10
|
+
<div class="
|
|
11
|
+
k-avatar
|
|
12
|
+
k-avatar-{size}
|
|
13
|
+
k-rounded-{rounded}
|
|
14
|
+
k-avatar-{fillMode}
|
|
15
|
+
k-avatar-{fillMode}-{themeColor}
|
|
16
|
+
">
|
|
17
|
+
<span class="k-avatar-{type}">
|
|
18
|
+
{content}
|
|
19
|
+
</span>
|
|
20
|
+
</div>
|
|
21
|
+
```
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
|
+
|
|
4
|
+
class Avatar extends Component {
|
|
5
|
+
render() {
|
|
6
|
+
return <AvatarStatic {...this.props} />;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function AvatarStatic(props) {
|
|
11
|
+
const {
|
|
12
|
+
className: ownClassName,
|
|
13
|
+
|
|
14
|
+
children,
|
|
15
|
+
|
|
16
|
+
type,
|
|
17
|
+
|
|
18
|
+
size,
|
|
19
|
+
rounded,
|
|
20
|
+
bordered,
|
|
21
|
+
|
|
22
|
+
fillMode,
|
|
23
|
+
themeColor,
|
|
24
|
+
|
|
25
|
+
aria,
|
|
26
|
+
legacy,
|
|
27
|
+
|
|
28
|
+
...htmlAttributes
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
let avatarClasses = [
|
|
32
|
+
ownClassName,
|
|
33
|
+
'k-avatar',
|
|
34
|
+
styles.sizeClass( size, 'k-avatar' ),
|
|
35
|
+
styles.roundedClass( rounded ),
|
|
36
|
+
styles.fillModeClass( fillMode, 'k-avatar' ),
|
|
37
|
+
styles.themeColorClass( fillMode, themeColor, 'k-avatar' ),
|
|
38
|
+
styles.borderedClass( bordered, 'k-avatar' ),
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
let ariaAttr = aria
|
|
42
|
+
? {}
|
|
43
|
+
: {};
|
|
44
|
+
|
|
45
|
+
if (legacy) {
|
|
46
|
+
|
|
47
|
+
let legacyClasses = [
|
|
48
|
+
ownClassName,
|
|
49
|
+
'k-avatar',
|
|
50
|
+
`k-avatar-${themeColor}`,
|
|
51
|
+
styles.roundedClass( rounded ),
|
|
52
|
+
styles.sizeClass( size, 'k-avatar' ),
|
|
53
|
+
styles.fillModeClass( fillMode, 'k-avatar' ),
|
|
54
|
+
styles.borderedClass( bordered, 'k-avatar' ),
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<span className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
59
|
+
<span className={`k-avatar-${type}`}>
|
|
60
|
+
{children}
|
|
61
|
+
</span>
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<span className={avatarClasses} {...ariaAttr} {...htmlAttributes}>
|
|
68
|
+
<span className={`k-avatar-${type}`}>
|
|
69
|
+
{children}
|
|
70
|
+
</span>
|
|
71
|
+
</span>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
AvatarStatic.defaultProps = {
|
|
76
|
+
...globalDefaultProps,
|
|
77
|
+
|
|
78
|
+
className: '',
|
|
79
|
+
children: [],
|
|
80
|
+
|
|
81
|
+
type: '',
|
|
82
|
+
|
|
83
|
+
size: 'medium',
|
|
84
|
+
rounded: 'full',
|
|
85
|
+
bordered: false,
|
|
86
|
+
|
|
87
|
+
fillMode: 'solid',
|
|
88
|
+
themeColor: 'primary'
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
AvatarStatic.propTypes = {
|
|
92
|
+
className: typeof '',
|
|
93
|
+
children: typeof [],
|
|
94
|
+
|
|
95
|
+
type: typeof '',
|
|
96
|
+
|
|
97
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
98
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
99
|
+
bordered: typeof false,
|
|
100
|
+
|
|
101
|
+
fillMode: typeof [ null, 'solid', 'outline' ],
|
|
102
|
+
themeColor: typeof [ null, 'primary' ],
|
|
103
|
+
|
|
104
|
+
aria: typeof false,
|
|
105
|
+
legacy: typeof false,
|
|
106
|
+
|
|
107
|
+
htmlAttributes: typeof []
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { Avatar, AvatarStatic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './avatar.jsx';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
```html
|
|
2
|
+
<!-- default rendering -->
|
|
3
|
+
<button type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base">
|
|
4
|
+
<span class="k-button-text">Text</span>
|
|
5
|
+
</button>
|
|
6
|
+
|
|
7
|
+
<!-- canonical rendering -->
|
|
8
|
+
<button class="
|
|
9
|
+
k-button
|
|
10
|
+
{text === '' && iconName !== '' && 'k-icon-button'}
|
|
11
|
+
k-button-{size}
|
|
12
|
+
k-button-{shape}
|
|
13
|
+
k-rounded-{rounded}
|
|
14
|
+
k-button-{fillMode}
|
|
15
|
+
k-button-{fillMode}-{themeColor}
|
|
16
|
+
|
|
17
|
+
{disabled && 'k-disabled'}
|
|
18
|
+
" type={type} disabled={disabled}>
|
|
19
|
+
{iconName !== '' && <span class="k-button-icon k-icon k-i-{iconName}"></span>}
|
|
20
|
+
{text !== '' && <span class="k-button-text">Button</span>}
|
|
21
|
+
</button>
|
|
22
|
+
```
|