@progress/kendo-themes-html 4.42.1-dev.4 → 4.43.1-dev.2
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 +32 -3
- package/package.json +2 -2
- package/src/autocomplete/autocomplete.jsx +4 -4
- package/src/avatar/README.md +21 -0
- package/src/avatar/avatar.jsx +113 -0
- package/src/avatar/index.js +1 -0
- package/src/button/button.jsx +6 -6
- package/src/checkbox/checkbox.jsx +3 -3
- 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/color-preview.jsx +6 -2
- package/src/colorpicker/colorpicker.jsx +12 -13
- package/src/combobox/combobox.jsx +5 -5
- package/src/{component.js → component/component.jsx} +4 -2
- package/src/component/index.js +1 -0
- package/src/dateinput/dateinput.jsx +9 -11
- package/src/datepicker/datepicker.jsx +9 -11
- package/src/datetimepicker/datetimepicker.jsx +9 -11
- package/src/dropdownlist/dropdownlist.jsx +9 -6
- package/src/icon/icon.jsx +1 -1
- package/src/index.js +43 -3
- package/src/input/input-inner-input.jsx +1 -1
- package/src/input/input-inner-span.jsx +1 -1
- package/src/input/input-inner-textarea.jsx +1 -1
- package/src/input/input-prefix.jsx +1 -1
- package/src/input/input-suffix.jsx +1 -1
- package/src/input/input.jsx +4 -4
- package/src/input/picker.jsx +4 -4
- package/src/list/README.md +93 -0
- package/src/list/index.js +5 -0
- package/src/list/list-content.jsx +94 -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/maskedtextbox.jsx +4 -4
- package/src/nodata/index.js +1 -0
- package/src/nodata/nodata.jsx +64 -0
- package/src/numerictextbox/numerictextbox.jsx +5 -5
- package/src/popup/README.md +15 -0
- package/src/popup/index.js +1 -0
- package/src/popup/popup.jsx +80 -0
- package/src/radio/radio.jsx +2 -2
- package/src/searchbar/searchbar.jsx +1 -1
- package/src/searchbox/searchbox.jsx +4 -4
- package/src/spinbutton/spinbutton.jsx +9 -3
- package/src/switch/switch.jsx +6 -6
- package/src/textarea/textarea.jsx +4 -4
- package/src/textbox/textbox.jsx +4 -4
- package/src/timepicker/timepicker.jsx +9 -11
- package/utils/styles.js +14 -5
package/lib/jsx-runtime.js
CHANGED
|
@@ -31,11 +31,16 @@ 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'
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
const booleanAttr = new Set([
|
|
@@ -63,9 +68,26 @@ const booleanAttr = new Set([
|
|
|
63
68
|
'showClearButton',
|
|
64
69
|
'showSpinButton',
|
|
65
70
|
|
|
71
|
+
'showCheckbox',
|
|
72
|
+
|
|
73
|
+
'virtualization',
|
|
74
|
+
'root',
|
|
75
|
+
|
|
76
|
+
'showAvatar',
|
|
77
|
+
|
|
66
78
|
'aria'
|
|
67
79
|
]);
|
|
68
80
|
|
|
81
|
+
const nullAttr = new Set([
|
|
82
|
+
'size',
|
|
83
|
+
'rounded',
|
|
84
|
+
'fillMode',
|
|
85
|
+
'themeColor',
|
|
86
|
+
|
|
87
|
+
'trackRounded',
|
|
88
|
+
'thumbRounded'
|
|
89
|
+
]);
|
|
90
|
+
|
|
69
91
|
const skipAttr = new Set([
|
|
70
92
|
'is',
|
|
71
93
|
'aria',
|
|
@@ -144,6 +166,10 @@ function attrToProps( attributes ) {
|
|
|
144
166
|
attrName = attrMap[attrName];
|
|
145
167
|
}
|
|
146
168
|
|
|
169
|
+
// Set props as is
|
|
170
|
+
props[ attrName ] = attrValue;
|
|
171
|
+
|
|
172
|
+
// Ensure boolean value
|
|
147
173
|
if (booleanAttr.has(attrName) && typeof attrValue === 'string') {
|
|
148
174
|
switch (attrValue) {
|
|
149
175
|
case '':
|
|
@@ -154,8 +180,11 @@ function attrToProps( attributes ) {
|
|
|
154
180
|
props[ attrName ] = false;
|
|
155
181
|
break;
|
|
156
182
|
}
|
|
157
|
-
}
|
|
158
|
-
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Ensure null value
|
|
186
|
+
if (nullAttr.has(attrName) && attrValue === 'null') {
|
|
187
|
+
props[ attrName ] = null;
|
|
159
188
|
}
|
|
160
189
|
});
|
|
161
190
|
|
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": "4.
|
|
4
|
+
"version": "4.43.1-dev.2",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
43
43
|
"rollup": "^2.59.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "c8f3818a458d171ff85a688531bb94ea3ab9799c"
|
|
46
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { globalDefaultProps } from '../component';
|
|
1
|
+
import { globalDefaultProps } from '../component/index';
|
|
2
2
|
import { Input, InputStatic, InputInnerInputStatic } from '../input/index';
|
|
3
3
|
import { InputValidationIconStatic, InputLoadingIconStatic, InputClearValueStatic } from '../input/index';
|
|
4
4
|
|
|
@@ -138,10 +138,10 @@ AutocompleteStatic.propTypes = {
|
|
|
138
138
|
prefix: typeof '#fragment',
|
|
139
139
|
suffix: typeof '#fragment',
|
|
140
140
|
|
|
141
|
-
size: typeof [
|
|
142
|
-
rounded: typeof [
|
|
141
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
142
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
143
143
|
|
|
144
|
-
fillMode: typeof [
|
|
144
|
+
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
145
145
|
|
|
146
146
|
hover: typeof false,
|
|
147
147
|
focus: typeof false,
|
|
@@ -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" class="">
|
|
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,113 @@
|
|
|
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
|
+
{
|
|
52
|
+
'k-avatar-circle': rounded === 'full',
|
|
53
|
+
'k-avatar-rounded': rounded !== 'full' && rounded !== null
|
|
54
|
+
},
|
|
55
|
+
styles.sizeClass( size, 'k-avatar' ),
|
|
56
|
+
styles.fillModeClass( fillMode, 'k-avatar' ),
|
|
57
|
+
styles.borderedClass( bordered, 'k-avatar' ),
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<span className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
62
|
+
<span className={`k-avatar-${type}`}>
|
|
63
|
+
{children}
|
|
64
|
+
</span>
|
|
65
|
+
</span>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<span className={avatarClasses} {...ariaAttr} {...htmlAttributes}>
|
|
71
|
+
<span className={`k-avatar-${type}`}>
|
|
72
|
+
{children}
|
|
73
|
+
</span>
|
|
74
|
+
</span>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
AvatarStatic.defaultProps = {
|
|
79
|
+
...globalDefaultProps,
|
|
80
|
+
|
|
81
|
+
className: '',
|
|
82
|
+
children: [],
|
|
83
|
+
|
|
84
|
+
type: '',
|
|
85
|
+
|
|
86
|
+
size: 'medium',
|
|
87
|
+
rounded: 'full',
|
|
88
|
+
bordered: false,
|
|
89
|
+
|
|
90
|
+
fillMode: 'solid',
|
|
91
|
+
themeColor: 'primary'
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
AvatarStatic.propTypes = {
|
|
95
|
+
className: typeof '',
|
|
96
|
+
children: typeof [],
|
|
97
|
+
|
|
98
|
+
type: typeof '',
|
|
99
|
+
|
|
100
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
101
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
102
|
+
bordered: typeof false,
|
|
103
|
+
|
|
104
|
+
fillMode: typeof [ null, 'solid', 'outline' ],
|
|
105
|
+
themeColor: typeof [ null, 'primary' ],
|
|
106
|
+
|
|
107
|
+
aria: typeof false,
|
|
108
|
+
legacy: typeof false,
|
|
109
|
+
|
|
110
|
+
htmlAttributes: typeof []
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export { Avatar, AvatarStatic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './avatar.jsx';
|
package/src/button/button.jsx
CHANGED
|
@@ -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
|
import { IconStatic } from '../icon/index';
|
|
4
4
|
|
|
5
5
|
class Button extends Component {
|
|
@@ -124,12 +124,12 @@ ButtonStatic.propTypes = {
|
|
|
124
124
|
|
|
125
125
|
type: typeof [ 'button', 'submit', 'reset' ],
|
|
126
126
|
|
|
127
|
-
size: typeof [
|
|
128
|
-
rounded: typeof [
|
|
129
|
-
shape: typeof [
|
|
127
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
128
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
129
|
+
shape: typeof [ null, 'rectangle', 'square' ],
|
|
130
130
|
|
|
131
|
-
fillMode: typeof [
|
|
132
|
-
themeColor: typeof [
|
|
131
|
+
fillMode: typeof [ null, 'solid', 'flat', 'outline', 'link' ],
|
|
132
|
+
themeColor: typeof [ null, 'surface', 'base', 'primary' ],
|
|
133
133
|
|
|
134
134
|
hover: typeof false,
|
|
135
135
|
focus: typeof false,
|
|
@@ -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() {
|
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
2
|
+
import { IconStatic } from '../icon/index';
|
|
3
|
+
|
|
4
|
+
function transformActions(actions) {
|
|
5
|
+
let newActions = [];
|
|
6
|
+
|
|
7
|
+
actions.forEach(action => {
|
|
8
|
+
if (action === 'more') {
|
|
9
|
+
newActions.push(
|
|
10
|
+
<span className="k-chip-action k-chip-more-action">
|
|
11
|
+
<IconStatic name="more-vertical" />
|
|
12
|
+
</span>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (action === 'remove') {
|
|
19
|
+
newActions.push(
|
|
20
|
+
<span className="k-chip-action k-chip-remove-action">
|
|
21
|
+
<IconStatic name="x-circle" />
|
|
22
|
+
</span>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
newActions.push(
|
|
29
|
+
<span className={`k-chip-action k-chip-${action}-action`}>
|
|
30
|
+
<IconStatic name={action} />
|
|
31
|
+
</span>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return newActions;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class ChipActions extends Component {
|
|
39
|
+
render() {
|
|
40
|
+
return <ChipActionsStatic {...this.props} />;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function ChipActionsStatic(props) {
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
actions
|
|
48
|
+
} = props;
|
|
49
|
+
|
|
50
|
+
if (actions.length === 0) {
|
|
51
|
+
return <></>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<span className="k-chip-actions">
|
|
56
|
+
{transformActions( actions )}
|
|
57
|
+
</span>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ChipActionsStatic.defaultProps = {
|
|
63
|
+
...globalDefaultProps,
|
|
64
|
+
|
|
65
|
+
actions: []
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
ChipActionsStatic.propTypes = {
|
|
69
|
+
className: typeof '',
|
|
70
|
+
children: typeof [],
|
|
71
|
+
|
|
72
|
+
actions: typeof [],
|
|
73
|
+
|
|
74
|
+
aria: typeof false,
|
|
75
|
+
legacy: typeof false,
|
|
76
|
+
|
|
77
|
+
htmlAttributes: typeof []
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { ChipActions, ChipActionsStatic };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AvatarStatic } from '../avatar/index';
|
|
2
|
+
|
|
3
|
+
function ChipAvatarStatic() {
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
<AvatarStatic className="k-chip-avatar" type="image">
|
|
7
|
+
<img src="../../assets/avatar.jpg"/>
|
|
8
|
+
</AvatarStatic>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ChipAvatarStatic };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
import * as styles from '../../utils/styles';
|
|
3
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
4
|
+
|
|
5
|
+
class ChipList extends Component {
|
|
6
|
+
render() {
|
|
7
|
+
return <ChipListStatic {...this.props} />;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function ChipListStatic(props) {
|
|
12
|
+
const {
|
|
13
|
+
className: ownClassName,
|
|
14
|
+
|
|
15
|
+
children,
|
|
16
|
+
|
|
17
|
+
size,
|
|
18
|
+
|
|
19
|
+
selection,
|
|
20
|
+
|
|
21
|
+
aria,
|
|
22
|
+
legacy,
|
|
23
|
+
|
|
24
|
+
...htmlAttributes
|
|
25
|
+
} = props;
|
|
26
|
+
|
|
27
|
+
let listClasses = [
|
|
28
|
+
ownClassName,
|
|
29
|
+
'k-chip-list',
|
|
30
|
+
styles.sizeClass( size, 'k-chip-list' ),
|
|
31
|
+
{
|
|
32
|
+
'k-selection-single': selection === 'single',
|
|
33
|
+
'k-selection-multiple': selection === 'multiple'
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
let legacyListClasses = [
|
|
39
|
+
ownClassName,
|
|
40
|
+
'k-chip-list'
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
let ariaAttr = aria
|
|
44
|
+
? {}
|
|
45
|
+
: {};
|
|
46
|
+
|
|
47
|
+
if (legacy) {
|
|
48
|
+
return (
|
|
49
|
+
<div className={legacyListClasses} {...ariaAttr} {...htmlAttributes}>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className={listClasses} {...ariaAttr} {...htmlAttributes}>
|
|
57
|
+
{children}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ChipListStatic.defaultProps = {
|
|
63
|
+
...globalDefaultProps,
|
|
64
|
+
|
|
65
|
+
size: 'medium',
|
|
66
|
+
|
|
67
|
+
selection: 'none'
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
ChipListStatic.propTypes = {
|
|
71
|
+
className: typeof '',
|
|
72
|
+
children: typeof [],
|
|
73
|
+
|
|
74
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
75
|
+
|
|
76
|
+
selection: typeof [ null, 'single', 'multiple' ],
|
|
77
|
+
|
|
78
|
+
aria: typeof false,
|
|
79
|
+
legacy: typeof false,
|
|
80
|
+
|
|
81
|
+
htmlAttributes: typeof []
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { ChipList, ChipListStatic };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
|
+
import { IconStatic } from '../icon/index';
|
|
4
|
+
import { ChipAvatarStatic } from './chip-avatar.jsx';
|
|
5
|
+
import { ChipActionsStatic } from './chip-actions.jsx';
|
|
6
|
+
|
|
7
|
+
class Chip extends Component {
|
|
8
|
+
|
|
9
|
+
init() {
|
|
10
|
+
let actions = this._props.actions;
|
|
11
|
+
let newActions = [];
|
|
12
|
+
|
|
13
|
+
if (actions === undefined) {
|
|
14
|
+
this._props.actions = [];
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (Array.isArray(actions)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
actions.split(',').forEach(action => {
|
|
23
|
+
newActions.push(action.trim());
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
this._props.actions = newActions;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
render() {
|
|
30
|
+
return <ChipStatic {...this.props} />;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function ChipStatic(props) {
|
|
35
|
+
const {
|
|
36
|
+
className: ownClassName,
|
|
37
|
+
|
|
38
|
+
children,
|
|
39
|
+
|
|
40
|
+
text,
|
|
41
|
+
icon,
|
|
42
|
+
actions,
|
|
43
|
+
|
|
44
|
+
showAvatar,
|
|
45
|
+
|
|
46
|
+
size,
|
|
47
|
+
rounded,
|
|
48
|
+
|
|
49
|
+
fillMode,
|
|
50
|
+
themeColor,
|
|
51
|
+
|
|
52
|
+
hover,
|
|
53
|
+
focus,
|
|
54
|
+
active,
|
|
55
|
+
selected,
|
|
56
|
+
disabled,
|
|
57
|
+
|
|
58
|
+
aria,
|
|
59
|
+
legacy,
|
|
60
|
+
|
|
61
|
+
...htmlAttributes
|
|
62
|
+
} = props;
|
|
63
|
+
|
|
64
|
+
let chipClasses = [
|
|
65
|
+
ownClassName,
|
|
66
|
+
'k-chip',
|
|
67
|
+
styles.sizeClass( size, 'k-chip' ),
|
|
68
|
+
styles.roundedClass( rounded ),
|
|
69
|
+
styles.fillModeClass( fillMode, 'k-chip' ),
|
|
70
|
+
styles.themeColorClass( fillMode, themeColor, 'k-chip' ),
|
|
71
|
+
{
|
|
72
|
+
'k-hover': hover === true,
|
|
73
|
+
'k-focus': focus === true,
|
|
74
|
+
'k-active': active === true,
|
|
75
|
+
'k-selected': selected === true,
|
|
76
|
+
'k-disabled': disabled === true
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// Augment attributes
|
|
81
|
+
htmlAttributes.disabled = disabled;
|
|
82
|
+
|
|
83
|
+
let ariaAttr = aria
|
|
84
|
+
? {}
|
|
85
|
+
: {};
|
|
86
|
+
|
|
87
|
+
if (legacy) {
|
|
88
|
+
|
|
89
|
+
let legacyClasses = [
|
|
90
|
+
ownClassName,
|
|
91
|
+
'k-chip',
|
|
92
|
+
`k-chip-${themeColor}`,
|
|
93
|
+
{
|
|
94
|
+
'k-chip-outline': fillMode === 'outline',
|
|
95
|
+
'k-chip-solid': fillMode === 'solid',
|
|
96
|
+
'k-state-hover': hover === true,
|
|
97
|
+
'k-state-focus': focus === true,
|
|
98
|
+
'k-state-active': active === true,
|
|
99
|
+
'k-state-selected': selected === true,
|
|
100
|
+
'k-state-disabled': disabled === true
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
106
|
+
<IconStatic className="k-chip-icon" name={icon} />
|
|
107
|
+
{showAvatar && <ChipAvatarStatic {...props} />}
|
|
108
|
+
<span className="k-chip-content">
|
|
109
|
+
{ children.length
|
|
110
|
+
? children
|
|
111
|
+
: text && <span className="k-chip-label">{text}</span>
|
|
112
|
+
}
|
|
113
|
+
</span>
|
|
114
|
+
{ actions.length > 0 && <ChipActionsStatic actions={actions} />}
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div className={chipClasses} {...ariaAttr} {...htmlAttributes}>
|
|
121
|
+
<IconStatic className="k-chip-icon" name={icon} />
|
|
122
|
+
{showAvatar && <ChipAvatarStatic {...props} />}
|
|
123
|
+
<span className="k-chip-content">
|
|
124
|
+
{ children.length
|
|
125
|
+
? children
|
|
126
|
+
: text && <span className="k-chip-label k-text-ellipsis">{text}</span>
|
|
127
|
+
}
|
|
128
|
+
</span>
|
|
129
|
+
{ actions.length > 0 && <ChipActionsStatic actions={actions} />}
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
ChipStatic.defaultProps = {
|
|
135
|
+
...globalDefaultProps,
|
|
136
|
+
|
|
137
|
+
children: [],
|
|
138
|
+
|
|
139
|
+
text: '',
|
|
140
|
+
icon: '',
|
|
141
|
+
actions: [],
|
|
142
|
+
showAvatar: false,
|
|
143
|
+
|
|
144
|
+
className: '',
|
|
145
|
+
|
|
146
|
+
size: 'medium',
|
|
147
|
+
rounded: 'medium',
|
|
148
|
+
|
|
149
|
+
fillMode: 'solid',
|
|
150
|
+
themeColor: 'base'
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
ChipStatic.propTypes = {
|
|
154
|
+
className: typeof '',
|
|
155
|
+
children: typeof [],
|
|
156
|
+
|
|
157
|
+
text: typeof '',
|
|
158
|
+
icon: typeof '',
|
|
159
|
+
actions: typeof [],
|
|
160
|
+
showAvatar: typeof false,
|
|
161
|
+
|
|
162
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
163
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
164
|
+
|
|
165
|
+
fillMode: typeof [ null, 'solid', 'outline' ],
|
|
166
|
+
themeColor: typeof [ null, 'base', 'error', 'warning', 'info', 'success' ],
|
|
167
|
+
|
|
168
|
+
hover: typeof false,
|
|
169
|
+
focus: typeof false,
|
|
170
|
+
active: typeof false,
|
|
171
|
+
selected: typeof false,
|
|
172
|
+
disabled: typeof false,
|
|
173
|
+
|
|
174
|
+
aria: typeof false,
|
|
175
|
+
legacy: typeof false,
|
|
176
|
+
|
|
177
|
+
htmlAttributes: typeof []
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export { Chip, ChipStatic };
|