@progress/kendo-themes-html 5.0.0-next.5 → 5.0.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 +54 -3
- package/package.json +8 -8
- package/src/autocomplete/README.md +15 -9
- package/src/autocomplete/autocomplete.jsx +17 -12
- 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 +8 -8
- package/src/button/button.jsx +44 -26
- package/src/checkbox/README.md +8 -8
- package/src/checkbox/checkbox.jsx +5 -5
- 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 +24 -15
- package/src/colorpicker/color-preview.jsx +33 -22
- package/src/colorpicker/colorpicker.jsx +14 -16
- package/src/combobox/README.md +15 -9
- package/src/combobox/combobox.jsx +20 -17
- package/src/{component.js → component/component.jsx} +4 -2
- 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 +23 -14
- package/src/dropdownlist/dropdownlist.jsx +26 -18
- package/src/fab/README.md +19 -0
- package/src/fab/fab.jsx +150 -0
- package/src/fab/index.js +1 -0
- package/src/icon/icon.jsx +1 -1
- package/src/index.js +51 -5
- package/src/input/index.js +3 -0
- package/src/input/input-clear-value.jsx +31 -0
- package/src/input/input-inner-input.jsx +1 -1
- package/src/input/input-inner-span.jsx +11 -10
- package/src/input/input-inner-textarea.jsx +1 -1
- package/src/input/input-loading-icon.jsx +28 -0
- package/src/input/input-prefix.jsx +1 -1
- package/src/input/input-suffix.jsx +1 -1
- package/src/input/input-validation-icon.jsx +37 -0
- package/src/input/input.jsx +6 -4
- package/src/input/picker.jsx +6 -6
- 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 +15 -9
- package/src/maskedtextbox/maskedtextbox.jsx +29 -19
- 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 +15 -9
- package/src/numerictextbox/numerictextbox.jsx +25 -16
- 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 +7 -7
- package/src/radio/radio.jsx +8 -4
- package/src/searchbar/searchbar.jsx +1 -1
- package/src/searchbox/README.md +16 -12
- package/src/searchbox/searchbox.jsx +23 -14
- package/src/spinbutton/spinbutton.jsx +9 -3
- 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 +3 -3
- package/src/switch/switch.jsx +6 -6
- package/src/textarea/README.md +17 -11
- package/src/textarea/textarea.jsx +4 -4
- package/src/textbox/README.md +15 -9
- package/src/textbox/textbox.jsx +21 -4
- 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 +23 -5
package/lib/jsx-runtime.js
CHANGED
|
@@ -31,11 +31,25 @@ const attrMap = {
|
|
|
31
31
|
showclearbutton: 'showClearButton',
|
|
32
32
|
clearbutton: 'clearButton',
|
|
33
33
|
|
|
34
|
+
showcheckbox: 'showCheckbox',
|
|
35
|
+
|
|
34
36
|
// Switch
|
|
35
37
|
onlabel: 'onLabel',
|
|
36
38
|
offlabel: 'offLabel',
|
|
37
39
|
trackrounded: 'trackRounded',
|
|
38
|
-
thumbrounded: 'thumbRounded'
|
|
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'
|
|
39
53
|
};
|
|
40
54
|
|
|
41
55
|
const booleanAttr = new Set([
|
|
@@ -44,6 +58,7 @@ const booleanAttr = new Set([
|
|
|
44
58
|
'hover',
|
|
45
59
|
'focus',
|
|
46
60
|
'active',
|
|
61
|
+
'readonly',
|
|
47
62
|
'disabled',
|
|
48
63
|
|
|
49
64
|
'checked',
|
|
@@ -61,10 +76,35 @@ const booleanAttr = new Set([
|
|
|
61
76
|
'showIcon',
|
|
62
77
|
'showClearButton',
|
|
63
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',
|
|
64
93
|
|
|
65
94
|
'aria'
|
|
66
95
|
]);
|
|
67
96
|
|
|
97
|
+
const nullAttr = new Set([
|
|
98
|
+
'size',
|
|
99
|
+
'shape',
|
|
100
|
+
'rounded',
|
|
101
|
+
'fillMode',
|
|
102
|
+
'themeColor',
|
|
103
|
+
|
|
104
|
+
'trackRounded',
|
|
105
|
+
'thumbRounded'
|
|
106
|
+
]);
|
|
107
|
+
|
|
68
108
|
const skipAttr = new Set([
|
|
69
109
|
'is',
|
|
70
110
|
'aria',
|
|
@@ -143,6 +183,10 @@ function attrToProps( attributes ) {
|
|
|
143
183
|
attrName = attrMap[attrName];
|
|
144
184
|
}
|
|
145
185
|
|
|
186
|
+
// Set props as is
|
|
187
|
+
props[ attrName ] = attrValue;
|
|
188
|
+
|
|
189
|
+
// Ensure boolean value
|
|
146
190
|
if (booleanAttr.has(attrName) && typeof attrValue === 'string') {
|
|
147
191
|
switch (attrValue) {
|
|
148
192
|
case '':
|
|
@@ -153,8 +197,11 @@ function attrToProps( attributes ) {
|
|
|
153
197
|
props[ attrName ] = false;
|
|
154
198
|
break;
|
|
155
199
|
}
|
|
156
|
-
}
|
|
157
|
-
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Ensure null value
|
|
203
|
+
if (nullAttr.has(attrName) && attrValue === 'null') {
|
|
204
|
+
props[ attrName ] = null;
|
|
158
205
|
}
|
|
159
206
|
});
|
|
160
207
|
|
|
@@ -257,6 +304,10 @@ function renderDOM( jsxNode, container = null ) {
|
|
|
257
304
|
element.append( children );
|
|
258
305
|
} else {
|
|
259
306
|
children.forEach( child => {
|
|
307
|
+
if (child === null) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
260
311
|
renderDOM( child, element );
|
|
261
312
|
});
|
|
262
313
|
}
|
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.0.0
|
|
4
|
+
"version": "5.0.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": "^21.0.
|
|
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": "444e224c85edd153e7726d83c682d84e9215acd0"
|
|
46
46
|
}
|
|
@@ -8,17 +8,23 @@
|
|
|
8
8
|
<span class="
|
|
9
9
|
k-autocomplete
|
|
10
10
|
k-input
|
|
11
|
-
k-input
|
|
12
|
-
k-rounded
|
|
13
|
-
k-input
|
|
11
|
+
k-input-{size}
|
|
12
|
+
k-rounded-{rounded}
|
|
13
|
+
k-input-{fillMode}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
{valid && 'k-valid'}
|
|
16
|
+
{invalid && 'k-invalid'}
|
|
17
|
+
{loading && 'k-loading'}
|
|
18
|
+
{required && 'k-required'}
|
|
19
|
+
{disabled && 'k-disabled'}
|
|
19
20
|
">
|
|
21
|
+
{showInputIcon && inputIconName !== '' && <span class="k-input-icon k-i-icon k-i-{inputIconName}"></span>}
|
|
22
|
+
{inputPrefix && <span class="k-input-prefix">...</span>}
|
|
20
23
|
<input type={type} class="k-input-inner" value={value} placeholder={placeholder} disabled={disabled} />
|
|
21
|
-
{
|
|
22
|
-
{
|
|
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>}
|
|
23
29
|
</span>
|
|
24
30
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { globalDefaultProps } from '../component';
|
|
1
|
+
import { globalDefaultProps } from '../component/index';
|
|
2
2
|
import { Input, InputStatic, InputInnerInputStatic } from '../input/index';
|
|
3
|
-
import {
|
|
3
|
+
import { InputValidationIconStatic, InputLoadingIconStatic, InputClearValueStatic } from '../input/index';
|
|
4
4
|
|
|
5
5
|
class Autocomplete extends Input {
|
|
6
6
|
render() {
|
|
@@ -18,8 +18,6 @@ function AutocompleteStatic(props) {
|
|
|
18
18
|
placeholder,
|
|
19
19
|
autocomplete,
|
|
20
20
|
|
|
21
|
-
showClearButton,
|
|
22
|
-
|
|
23
21
|
prefix,
|
|
24
22
|
suffix,
|
|
25
23
|
|
|
@@ -77,7 +75,7 @@ function AutocompleteStatic(props) {
|
|
|
77
75
|
'k-autocomplete',
|
|
78
76
|
{
|
|
79
77
|
'k-state-hover': hover === true,
|
|
80
|
-
'k-state-
|
|
78
|
+
'k-state-focus': focus === true,
|
|
81
79
|
'k-state-invalid': invalid === true,
|
|
82
80
|
'k-state-required': required === true,
|
|
83
81
|
'k-state-disabled': disabled === true
|
|
@@ -86,10 +84,10 @@ function AutocompleteStatic(props) {
|
|
|
86
84
|
|
|
87
85
|
return (
|
|
88
86
|
<InputStatic className={legacyClasses} {...htmlAttributes}>
|
|
89
|
-
{prefix}
|
|
90
87
|
<input type={type} className="k-input" {...inputAttributes} />
|
|
91
|
-
|
|
92
|
-
{
|
|
88
|
+
<InputValidationIconStatic {...props} />
|
|
89
|
+
<InputLoadingIconStatic {...props} />
|
|
90
|
+
<InputClearValueStatic {...props} />
|
|
93
91
|
</InputStatic>
|
|
94
92
|
);
|
|
95
93
|
}
|
|
@@ -98,8 +96,10 @@ function AutocompleteStatic(props) {
|
|
|
98
96
|
<InputStatic className={autocompleteClasses} {...ariaAttr} {...htmlAttributes}>
|
|
99
97
|
{prefix}
|
|
100
98
|
<InputInnerInputStatic {...inputAttributes} />
|
|
101
|
-
{!disabled && showClearButton && value !== '' && <span className="k-clear-value"><IconStatic name="x" /></span>}
|
|
102
99
|
{suffix}
|
|
100
|
+
<InputValidationIconStatic {...props} />
|
|
101
|
+
<InputLoadingIconStatic {...props} />
|
|
102
|
+
<InputClearValueStatic {...props} />
|
|
103
103
|
</InputStatic>
|
|
104
104
|
);
|
|
105
105
|
}
|
|
@@ -112,6 +112,8 @@ AutocompleteStatic.defaultProps = {
|
|
|
112
112
|
placeholder: '',
|
|
113
113
|
autocomplete: 'off',
|
|
114
114
|
|
|
115
|
+
showValidationIcon: true,
|
|
116
|
+
showLoadingIcon: true,
|
|
115
117
|
showClearButton: true,
|
|
116
118
|
|
|
117
119
|
size: 'medium',
|
|
@@ -129,20 +131,23 @@ AutocompleteStatic.propTypes = {
|
|
|
129
131
|
placeholder: typeof '',
|
|
130
132
|
autocomplete: typeof [ 'on', 'off' ],
|
|
131
133
|
|
|
134
|
+
showValidationIcon: typeof true,
|
|
135
|
+
showLoadingIcon: typeof true,
|
|
132
136
|
showClearButton: typeof true,
|
|
133
137
|
|
|
134
138
|
prefix: typeof '#fragment',
|
|
135
139
|
suffix: typeof '#fragment',
|
|
136
140
|
|
|
137
|
-
size: typeof [
|
|
138
|
-
rounded: typeof [
|
|
141
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
142
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
139
143
|
|
|
140
|
-
fillMode: typeof [
|
|
144
|
+
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
141
145
|
|
|
142
146
|
hover: typeof false,
|
|
143
147
|
focus: typeof false,
|
|
144
148
|
valid: typeof false,
|
|
145
149
|
invalid: typeof false,
|
|
150
|
+
loading: typeof false,
|
|
146
151
|
required: typeof false,
|
|
147
152
|
disabled: typeof false,
|
|
148
153
|
|
|
@@ -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';
|
package/src/button/README.md
CHANGED
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
<!-- canonical rendering -->
|
|
8
8
|
<button class="
|
|
9
9
|
k-button
|
|
10
|
-
|
|
11
|
-
k-button
|
|
12
|
-
k-button
|
|
13
|
-
k-rounded
|
|
14
|
-
k-button
|
|
15
|
-
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
16
|
|
|
17
|
-
|
|
17
|
+
{disabled && 'k-disabled'}
|
|
18
18
|
" type={type} disabled={disabled}>
|
|
19
|
-
{
|
|
19
|
+
{iconName !== '' && <span class="k-button-icon k-icon k-i-{iconName}"></span>}
|
|
20
20
|
{text !== '' && <span class="k-button-text">Button</span>}
|
|
21
21
|
</button>
|
|
22
22
|
```
|
package/src/button/button.jsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as styles from '../../utils/styles';
|
|
2
|
-
import { Component, globalDefaultProps } from '../component';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
3
|
import { IconStatic } from '../icon/index';
|
|
4
4
|
|
|
5
5
|
class Button extends Component {
|
|
6
6
|
|
|
7
7
|
init() {
|
|
8
8
|
this._props.text = this.element.innerHTML;
|
|
9
|
+
this._props.children = [];
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
render() {
|
|
@@ -16,6 +17,7 @@ class Button extends Component {
|
|
|
16
17
|
function ButtonStatic(props) {
|
|
17
18
|
const {
|
|
18
19
|
className: ownClassName,
|
|
20
|
+
children,
|
|
19
21
|
|
|
20
22
|
text,
|
|
21
23
|
type,
|
|
@@ -61,22 +63,6 @@ function ButtonStatic(props) {
|
|
|
61
63
|
}
|
|
62
64
|
];
|
|
63
65
|
|
|
64
|
-
let legacyClasses = [
|
|
65
|
-
ownClassName,
|
|
66
|
-
'k-button',
|
|
67
|
-
{
|
|
68
|
-
'k-primary': themeColor === 'primary',
|
|
69
|
-
'k-flat': fillMode === 'flat',
|
|
70
|
-
'k-outline': fillMode === 'outline',
|
|
71
|
-
'k-state-hover': hover === true,
|
|
72
|
-
'k-state-focus': focus === true,
|
|
73
|
-
'k-state-active': active === true,
|
|
74
|
-
'k-state-selected': selected === true,
|
|
75
|
-
'k-state-disabled': disabled === true,
|
|
76
|
-
'k-icon-button': Boolean( icon) === true && Boolean(text) === false
|
|
77
|
-
}
|
|
78
|
-
];
|
|
79
|
-
|
|
80
66
|
// Augment attributes
|
|
81
67
|
htmlAttributes.disabled = disabled;
|
|
82
68
|
|
|
@@ -85,18 +71,47 @@ function ButtonStatic(props) {
|
|
|
85
71
|
: {};
|
|
86
72
|
|
|
87
73
|
if (legacy) {
|
|
74
|
+
|
|
75
|
+
let legacyClasses = [
|
|
76
|
+
ownClassName,
|
|
77
|
+
'k-button',
|
|
78
|
+
styles.fillModeClass( fillMode, 'k-button' ),
|
|
79
|
+
styles.themeColorClass( fillMode, themeColor, 'k-button' ),
|
|
80
|
+
{
|
|
81
|
+
'k-primary': themeColor === 'primary',
|
|
82
|
+
'k-flat': fillMode === 'flat',
|
|
83
|
+
'k-outline': fillMode === 'outline',
|
|
84
|
+
'k-state-hover': hover === true,
|
|
85
|
+
'k-state-focus': focus === true,
|
|
86
|
+
'k-state-active': active === true,
|
|
87
|
+
'k-state-selected': selected === true,
|
|
88
|
+
'k-state-disabled': disabled === true,
|
|
89
|
+
'k-icon-button': Boolean( icon) === true && Boolean(text) === false
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
|
|
88
93
|
return (
|
|
89
94
|
<button type={type} className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
{ children.length === 0
|
|
96
|
+
? <>
|
|
97
|
+
<IconStatic className="k-button-icon" name={icon} />
|
|
98
|
+
{text && <span className="k-button-text">{text}</span>}
|
|
99
|
+
</>
|
|
100
|
+
: children
|
|
101
|
+
}
|
|
92
102
|
</button>
|
|
93
103
|
);
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
return (
|
|
97
107
|
<button type={type} className={buttonClasses} {...ariaAttr} {...htmlAttributes}>
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
{ children.length === 0
|
|
109
|
+
? <>
|
|
110
|
+
<IconStatic className="k-button-icon" name={icon} />
|
|
111
|
+
{text && <span className="k-button-text">{text}</span>}
|
|
112
|
+
</>
|
|
113
|
+
: children
|
|
114
|
+
}
|
|
100
115
|
</button>
|
|
101
116
|
);
|
|
102
117
|
}
|
|
@@ -104,6 +119,8 @@ function ButtonStatic(props) {
|
|
|
104
119
|
ButtonStatic.defaultProps = {
|
|
105
120
|
...globalDefaultProps,
|
|
106
121
|
|
|
122
|
+
children: [],
|
|
123
|
+
|
|
107
124
|
text: '',
|
|
108
125
|
icon: '',
|
|
109
126
|
|
|
@@ -119,17 +136,18 @@ ButtonStatic.defaultProps = {
|
|
|
119
136
|
};
|
|
120
137
|
|
|
121
138
|
ButtonStatic.propTypes = {
|
|
139
|
+
children: typeof [],
|
|
122
140
|
text: typeof '',
|
|
123
141
|
icon: typeof '',
|
|
124
142
|
|
|
125
143
|
type: typeof [ 'button', 'submit', 'reset' ],
|
|
126
144
|
|
|
127
|
-
size: typeof [
|
|
128
|
-
rounded: typeof [
|
|
129
|
-
shape: typeof [
|
|
145
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
146
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
147
|
+
shape: typeof [ null, 'rectangle', 'square' ],
|
|
130
148
|
|
|
131
|
-
fillMode: typeof [
|
|
132
|
-
themeColor: typeof [
|
|
149
|
+
fillMode: typeof [ null, 'solid', 'flat', 'outline', 'link' ],
|
|
150
|
+
themeColor: typeof [ null, 'surface', 'base', 'primary' ],
|
|
133
151
|
|
|
134
152
|
hover: typeof false,
|
|
135
153
|
focus: typeof false,
|
package/src/checkbox/README.md
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
<input type="checkbox"
|
|
7
7
|
class="
|
|
8
8
|
k-checkbox
|
|
9
|
-
k-checkbox
|
|
10
|
-
k-rounded
|
|
9
|
+
k-checkbox-{size}
|
|
10
|
+
k-rounded-{rounded}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
{checked && 'k-checked'}
|
|
13
|
+
{indeterminate && 'k-indeterminate'}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
{valid && 'k-valid'}
|
|
16
|
+
{invalid && 'k-invalid'}
|
|
17
|
+
{required && 'k-required'}
|
|
18
|
+
{disabled && 'k-disabled'}
|
|
19
19
|
"
|
|
20
20
|
disabled={disabled}
|
|
21
21
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as styles from '../../utils/styles';
|
|
2
|
-
import { Component, globalDefaultProps } from '../component';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
3
|
|
|
4
4
|
class Checkbox extends Component {
|
|
5
5
|
render() {
|
|
@@ -74,12 +74,12 @@ function CheckboxStatic(props) {
|
|
|
74
74
|
];
|
|
75
75
|
|
|
76
76
|
return (
|
|
77
|
-
<input type="checkbox" className={legacyClasses} {...ariaAttr} {...htmlAttributes}
|
|
77
|
+
<span className="k-checkbox-wrap"><input type="checkbox" className={legacyClasses} {...ariaAttr} {...htmlAttributes} /></span>
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<input type="checkbox" className={checkboxClasses} {...ariaAttr} {...htmlAttributes}
|
|
82
|
+
<span className="k-checkbox-wrap"><input type="checkbox" className={checkboxClasses} {...ariaAttr} {...htmlAttributes} /></span>
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -103,8 +103,8 @@ CheckboxStatic.propTypes = {
|
|
|
103
103
|
checked: typeof false,
|
|
104
104
|
indeterminate: typeof false,
|
|
105
105
|
|
|
106
|
-
size: typeof [
|
|
107
|
-
rounded: typeof [
|
|
106
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
107
|
+
rounded: typeof [ null, 'small', 'medium', 'large' ],
|
|
108
108
|
|
|
109
109
|
hover: typeof false,
|
|
110
110
|
focus: typeof false,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
## Chip
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<!-- default rendering -->
|
|
5
|
+
<div class="k-chip k-chip-md k-rounded-full k-chip-solid k-chip-solid-base">
|
|
6
|
+
<span class="k-chip-text">Chip Text</span>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<!-- canonical rendering -->
|
|
10
|
+
<div class="
|
|
11
|
+
k-chip
|
|
12
|
+
k-chip-${size}
|
|
13
|
+
k-rounded-${rounded}
|
|
14
|
+
k-chip-${fillMode}
|
|
15
|
+
k-chip-${fillMode}-${themeColor}
|
|
16
|
+
|
|
17
|
+
${disabled && 'k-disabled'}>
|
|
18
|
+
{icon !== '' && <span class="k-chip-icon k-icon k-i-${icon}"></span>}
|
|
19
|
+
{avatar !== '' && <span class="k-chip-avatar k-avatar"></span>}
|
|
20
|
+
<span className="k-chip-content">
|
|
21
|
+
{ children.length
|
|
22
|
+
? children
|
|
23
|
+
: text &&
|
|
24
|
+
<span className="k-chip-label">{text}</span>}
|
|
25
|
+
</span>
|
|
26
|
+
{removable && <span class="k-chip-icon k-icon k-i-${removeIcon}"></span>}
|
|
27
|
+
</div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## ChipList
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<!-- default rendering -->
|
|
34
|
+
<div class="k-chip-list k-chip-list-md">
|
|
35
|
+
<div class="k-chip k-chip-md k-rounded-full k-chip-solid k-chip-solid-base">...</div>
|
|
36
|
+
<div class="k-chip k-chip-md k-rounded-full k-chip-solid k-chip-solid-base">...</div>
|
|
37
|
+
<div class="k-chip k-chip-md k-rounded-full k-chip-solid k-chip-solid-base">...</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- canonical rendering -->
|
|
41
|
+
<div class="
|
|
42
|
+
k-chip-list
|
|
43
|
+
k-chip-${size}">
|
|
44
|
+
<div class="k-chip" {...props}>...</div>
|
|
45
|
+
<div class="k-chip" {...props}>...</div>
|
|
46
|
+
</div>
|
|
47
|
+
```
|