@progress/kendo-themes-html 5.0.0-beta.1 → 5.0.0-beta.5
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 +16 -8
- package/package.json +7 -7
- package/src/autocomplete/autocomplete.jsx +2 -2
- package/src/avatar/README.md +1 -1
- package/src/avatar/avatar.jsx +14 -20
- package/src/button/button.jsx +39 -21
- package/src/checkbox/checkbox.jsx +2 -2
- package/src/chip/README.md +5 -5
- package/src/chip/chip-actions.jsx +80 -0
- package/src/chip/chip-avatar.jsx +2 -10
- package/src/chip/chip-list.jsx +8 -5
- package/src/chip/chip.jsx +55 -38
- package/src/chip/index.js +2 -3
- package/src/colorpicker/README.md +24 -15
- package/src/colorpicker/color-preview.jsx +27 -20
- package/src/colorpicker/colorpicker.jsx +5 -7
- package/src/combobox/combobox.jsx +5 -7
- package/src/dateinput/dateinput.jsx +5 -7
- package/src/datepicker/datepicker.jsx +5 -7
- package/src/datetimepicker/datetimepicker.jsx +5 -7
- package/src/dropdownlist/dropdownlist.jsx +5 -7
- package/src/fab/README.md +19 -0
- package/src/fab/fab.jsx +154 -0
- package/src/fab/index.js +1 -0
- package/src/index.js +5 -7
- package/src/input/input-inner-span.jsx +1 -1
- package/src/input/input.jsx +1 -1
- package/src/input/picker.jsx +3 -3
- package/src/list/README.md +14 -0
- package/src/list/list-content.jsx +18 -17
- package/src/list/list-header.jsx +2 -1
- package/src/maskedtextbox/maskedtextbox.jsx +8 -11
- package/src/menu/README.md +40 -0
- package/src/{menuitem → menu}/index.js +1 -0
- package/src/{menuitem → menu}/menu-item-content.jsx +0 -0
- package/src/{menuitem → menu}/menu-item.jsx +27 -22
- package/src/{menulist/menulist.jsx → menu/menu-list.jsx} +11 -10
- package/src/{dropdownbutton → menubutton}/README.md +20 -20
- package/src/menubutton/index.js +1 -0
- package/src/menubutton/menubutton.jsx +161 -0
- package/src/multiselect/README.md +37 -0
- package/src/multiselect/multiselect.jsx +3 -3
- package/src/numerictextbox/numerictextbox.jsx +5 -7
- package/src/popup/popup.jsx +1 -1
- package/src/radio/radio.jsx +6 -2
- package/src/searchbox/searchbox.jsx +1 -1
- package/src/splitbutton/README.md +2 -2
- package/src/splitbutton/splitbutton.jsx +57 -33
- package/src/switch/README.md +3 -3
- package/src/switch/switch.jsx +4 -4
- package/src/textarea/textarea.jsx +1 -1
- package/src/textbox/textbox.jsx +1 -1
- package/src/timepicker/timepicker.jsx +5 -7
- 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 +9 -0
- package/src/chip/chip-remove-icon.jsx +0 -45
- package/src/chip/chip-selected-icon.jsx +0 -47
- package/src/dropdownbutton/dropdownbutton.jsx +0 -149
- package/src/dropdownbutton/index.js +0 -1
- package/src/menuitem/README.md +0 -26
- package/src/menulist/README.md +0 -11
- package/src/menulist/index.js +0 -1
package/lib/jsx-runtime.js
CHANGED
|
@@ -39,13 +39,17 @@ const attrMap = {
|
|
|
39
39
|
trackrounded: 'trackRounded',
|
|
40
40
|
thumbrounded: 'thumbRounded',
|
|
41
41
|
|
|
42
|
-
// Menu list
|
|
43
|
-
contenttemplate: 'contentTemplate',
|
|
44
|
-
|
|
45
42
|
// Chip
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
showavatar: 'showAvatar',
|
|
44
|
+
|
|
45
|
+
// Hierarchy
|
|
46
|
+
haschildren: 'hasChildren',
|
|
47
|
+
|
|
48
|
+
// Treeview
|
|
49
|
+
leafclassname: 'leafClassName',
|
|
50
|
+
|
|
51
|
+
// Template
|
|
52
|
+
contenttemplate: 'contentTemplate'
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
const booleanAttr = new Set([
|
|
@@ -79,8 +83,12 @@ const booleanAttr = new Set([
|
|
|
79
83
|
'virtualization',
|
|
80
84
|
'root',
|
|
81
85
|
|
|
82
|
-
'
|
|
83
|
-
'
|
|
86
|
+
'open',
|
|
87
|
+
'expanded',
|
|
88
|
+
'hasChildren',
|
|
89
|
+
|
|
90
|
+
'showArrow',
|
|
91
|
+
|
|
84
92
|
'showAvatar',
|
|
85
93
|
|
|
86
94
|
'aria'
|
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-beta.
|
|
4
|
+
"version": "5.0.0-beta.5",
|
|
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.16.
|
|
38
|
-
"@babel/preset-env": "^7.16.
|
|
39
|
-
"@babel/preset-react": "^7.16.
|
|
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
41
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
42
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
43
|
-
"rollup": "^2.
|
|
42
|
+
"@rollup/plugin-node-resolve": "^13.1.2",
|
|
43
|
+
"rollup": "^2.62.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "f9a49055787d0553b82bdf0782b3a78e0fb58139"
|
|
46
46
|
}
|
|
@@ -75,7 +75,7 @@ function AutocompleteStatic(props) {
|
|
|
75
75
|
'k-autocomplete',
|
|
76
76
|
{
|
|
77
77
|
'k-state-hover': hover === true,
|
|
78
|
-
'k-state-
|
|
78
|
+
'k-state-focus': focus === true,
|
|
79
79
|
'k-state-invalid': invalid === true,
|
|
80
80
|
'k-state-required': required === true,
|
|
81
81
|
'k-state-disabled': disabled === true
|
|
@@ -139,7 +139,7 @@ AutocompleteStatic.propTypes = {
|
|
|
139
139
|
suffix: typeof '#fragment',
|
|
140
140
|
|
|
141
141
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
142
|
-
rounded: typeof [ null, 'small', 'medium', 'large', '
|
|
142
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
143
143
|
|
|
144
144
|
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
145
145
|
|
package/src/avatar/README.md
CHANGED
package/src/avatar/avatar.jsx
CHANGED
|
@@ -16,7 +16,6 @@ function AvatarStatic(props) {
|
|
|
16
16
|
type,
|
|
17
17
|
|
|
18
18
|
size,
|
|
19
|
-
shape,
|
|
20
19
|
rounded,
|
|
21
20
|
bordered,
|
|
22
21
|
|
|
@@ -35,29 +34,26 @@ function AvatarStatic(props) {
|
|
|
35
34
|
styles.sizeClass( size, 'k-avatar' ),
|
|
36
35
|
styles.roundedClass( rounded ),
|
|
37
36
|
styles.fillModeClass( fillMode, 'k-avatar' ),
|
|
38
|
-
styles.shapeClass( shape, 'k-avatar' ),
|
|
39
37
|
styles.themeColorClass( fillMode, themeColor, 'k-avatar' ),
|
|
40
38
|
styles.borderedClass( bordered, 'k-avatar' ),
|
|
41
39
|
];
|
|
42
40
|
|
|
43
|
-
let legacyClasses = [
|
|
44
|
-
ownClassName,
|
|
45
|
-
'k-avatar',
|
|
46
|
-
`k-avatar-${themeColor}`,
|
|
47
|
-
{
|
|
48
|
-
'k-avatar-circle': rounded === 'circle',
|
|
49
|
-
'k-avatar-rounded': rounded !== 'circle' && rounded !== null
|
|
50
|
-
},
|
|
51
|
-
styles.sizeClass( size, 'k-avatar' ),
|
|
52
|
-
styles.fillModeClass( fillMode, 'k-avatar' ),
|
|
53
|
-
styles.borderedClass( bordered, 'k-avatar' ),
|
|
54
|
-
];
|
|
55
|
-
|
|
56
41
|
let ariaAttr = aria
|
|
57
42
|
? {}
|
|
58
43
|
: {};
|
|
59
44
|
|
|
60
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
|
+
|
|
61
57
|
return (
|
|
62
58
|
<span className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
63
59
|
<span className={`k-avatar-${type}`}>
|
|
@@ -85,8 +81,7 @@ AvatarStatic.defaultProps = {
|
|
|
85
81
|
type: '',
|
|
86
82
|
|
|
87
83
|
size: 'medium',
|
|
88
|
-
|
|
89
|
-
rounded: 'circle',
|
|
84
|
+
rounded: 'full',
|
|
90
85
|
bordered: false,
|
|
91
86
|
|
|
92
87
|
fillMode: 'solid',
|
|
@@ -99,9 +94,8 @@ AvatarStatic.propTypes = {
|
|
|
99
94
|
|
|
100
95
|
type: typeof '',
|
|
101
96
|
|
|
102
|
-
size: typeof [ null, 'small', 'medium', 'large'
|
|
103
|
-
|
|
104
|
-
rounded: typeof [ null, '0', 'small', 'medium', 'large' ],
|
|
97
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
98
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
105
99
|
bordered: typeof false,
|
|
106
100
|
|
|
107
101
|
fillMode: typeof [ null, 'solid', 'outline' ],
|
package/src/button/button.jsx
CHANGED
|
@@ -6,6 +6,7 @@ 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,13 +136,14 @@ 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
145
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
128
|
-
rounded: typeof [ null, '
|
|
146
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
129
147
|
shape: typeof [ null, 'rectangle', 'square' ],
|
|
130
148
|
|
|
131
149
|
fillMode: typeof [ null, 'solid', 'flat', 'outline', 'link' ],
|
|
@@ -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
|
|
package/src/chip/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
```html
|
|
4
4
|
<!-- default rendering -->
|
|
5
|
-
<div class="k-chip k-chip-md k-rounded-
|
|
5
|
+
<div class="k-chip k-chip-md k-rounded-full k-chip-solid k-chip-solid-base">
|
|
6
6
|
<span class="k-chip-text">Chip Text</span>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
```html
|
|
33
33
|
<!-- default rendering -->
|
|
34
34
|
<div class="k-chip-list k-chip-list-md">
|
|
35
|
-
<div class="k-chip k-chip-md k-rounded-
|
|
36
|
-
<div class="k-chip k-chip-md k-rounded-
|
|
37
|
-
<div class="k-chip k-chip-md k-rounded-
|
|
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
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<!-- canonical rendering -->
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
<div class="k-chip" {...props}>...</div>
|
|
45
45
|
<div class="k-chip" {...props}>...</div>
|
|
46
46
|
</div>
|
|
47
|
-
```
|
|
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 };
|
package/src/chip/chip-avatar.jsx
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { AvatarStatic } from '../avatar/index';
|
|
2
2
|
|
|
3
|
-
function ChipAvatarStatic(
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
showAvatar
|
|
7
|
-
} = chipProps;
|
|
8
|
-
|
|
9
|
-
if (!showAvatar) {
|
|
10
|
-
return <></>;
|
|
11
|
-
}
|
|
3
|
+
function ChipAvatarStatic() {
|
|
12
4
|
|
|
13
5
|
return (
|
|
14
6
|
<AvatarStatic className="k-chip-avatar" type="image">
|
|
15
|
-
<img src="../../assets/avatar.jpg"/>
|
|
7
|
+
<img src="../../assets/avatar.jpg" />
|
|
16
8
|
</AvatarStatic>
|
|
17
9
|
);
|
|
18
10
|
|
package/src/chip/chip-list.jsx
CHANGED
|
@@ -12,6 +12,8 @@ function ChipListStatic(props) {
|
|
|
12
12
|
const {
|
|
13
13
|
className: ownClassName,
|
|
14
14
|
|
|
15
|
+
children,
|
|
16
|
+
|
|
15
17
|
size,
|
|
16
18
|
|
|
17
19
|
selection,
|
|
@@ -35,6 +37,7 @@ function ChipListStatic(props) {
|
|
|
35
37
|
|
|
36
38
|
let legacyListClasses = [
|
|
37
39
|
ownClassName,
|
|
40
|
+
'k-chip-list'
|
|
38
41
|
];
|
|
39
42
|
|
|
40
43
|
let ariaAttr = aria
|
|
@@ -44,14 +47,14 @@ function ChipListStatic(props) {
|
|
|
44
47
|
if (legacy) {
|
|
45
48
|
return (
|
|
46
49
|
<div className={legacyListClasses} {...ariaAttr} {...htmlAttributes}>
|
|
47
|
-
|
|
50
|
+
{children}
|
|
48
51
|
</div>
|
|
49
52
|
);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
return (
|
|
53
56
|
<div className={listClasses} {...ariaAttr} {...htmlAttributes}>
|
|
54
|
-
|
|
57
|
+
{children}
|
|
55
58
|
</div>
|
|
56
59
|
);
|
|
57
60
|
}
|
|
@@ -59,14 +62,15 @@ function ChipListStatic(props) {
|
|
|
59
62
|
ChipListStatic.defaultProps = {
|
|
60
63
|
...globalDefaultProps,
|
|
61
64
|
|
|
62
|
-
className: '',
|
|
63
|
-
|
|
64
65
|
size: 'medium',
|
|
65
66
|
|
|
66
67
|
selection: 'none'
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
ChipListStatic.propTypes = {
|
|
71
|
+
className: typeof '',
|
|
72
|
+
children: typeof [],
|
|
73
|
+
|
|
70
74
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
71
75
|
|
|
72
76
|
selection: typeof [ null, 'single', 'multiple' ],
|
|
@@ -74,7 +78,6 @@ ChipListStatic.propTypes = {
|
|
|
74
78
|
aria: typeof false,
|
|
75
79
|
legacy: typeof false,
|
|
76
80
|
|
|
77
|
-
className: typeof '',
|
|
78
81
|
htmlAttributes: typeof []
|
|
79
82
|
};
|
|
80
83
|
|
package/src/chip/chip.jsx
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import * as styles from '../../utils/styles';
|
|
2
2
|
import { Component, globalDefaultProps } from '../component/index';
|
|
3
3
|
import { IconStatic } from '../icon/index';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ChipAvatarStatic } from '../chip/index';
|
|
4
|
+
import { ChipAvatarStatic } from './chip-avatar.jsx';
|
|
5
|
+
import { ChipActionsStatic } from './chip-actions.jsx';
|
|
7
6
|
|
|
8
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
|
+
|
|
9
29
|
render() {
|
|
10
30
|
return <ChipStatic {...this.props} />;
|
|
11
31
|
}
|
|
@@ -18,6 +38,10 @@ function ChipStatic(props) {
|
|
|
18
38
|
children,
|
|
19
39
|
|
|
20
40
|
text,
|
|
41
|
+
icon,
|
|
42
|
+
actions,
|
|
43
|
+
|
|
44
|
+
showAvatar,
|
|
21
45
|
|
|
22
46
|
size,
|
|
23
47
|
rounded,
|
|
@@ -25,9 +49,6 @@ function ChipStatic(props) {
|
|
|
25
49
|
fillMode,
|
|
26
50
|
themeColor,
|
|
27
51
|
|
|
28
|
-
icon,
|
|
29
|
-
showAvatar,
|
|
30
|
-
|
|
31
52
|
hover,
|
|
32
53
|
focus,
|
|
33
54
|
active,
|
|
@@ -48,7 +69,6 @@ function ChipStatic(props) {
|
|
|
48
69
|
styles.fillModeClass( fillMode, 'k-chip' ),
|
|
49
70
|
styles.themeColorClass( fillMode, themeColor, 'k-chip' ),
|
|
50
71
|
{
|
|
51
|
-
'k-chip-has-icon': icon !== '' || showAvatar,
|
|
52
72
|
'k-hover': hover === true,
|
|
53
73
|
'k-focus': focus === true,
|
|
54
74
|
'k-active': active === true,
|
|
@@ -57,21 +77,6 @@ function ChipStatic(props) {
|
|
|
57
77
|
}
|
|
58
78
|
];
|
|
59
79
|
|
|
60
|
-
let legacyClasses = [
|
|
61
|
-
ownClassName,
|
|
62
|
-
'k-chip',
|
|
63
|
-
{
|
|
64
|
-
'k-chip-has-icon': icon !== '' || showAvatar,
|
|
65
|
-
'k-chip-outline': fillMode === 'outline',
|
|
66
|
-
'k-chip-solid': fillMode === 'solid',
|
|
67
|
-
'k-state-hover': hover === true,
|
|
68
|
-
'k-state-focus': focus === true,
|
|
69
|
-
'k-state-active': active === true,
|
|
70
|
-
'k-state-selected': selected === true,
|
|
71
|
-
'k-state-disabled': disabled === true
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
|
|
75
80
|
// Augment attributes
|
|
76
81
|
htmlAttributes.disabled = disabled;
|
|
77
82
|
|
|
@@ -80,18 +85,33 @@ function ChipStatic(props) {
|
|
|
80
85
|
: {};
|
|
81
86
|
|
|
82
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
|
+
|
|
83
104
|
return (
|
|
84
105
|
<div className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
85
106
|
<IconStatic className="k-chip-icon" name={icon} />
|
|
86
|
-
<
|
|
87
|
-
<ChipAvatarStatic {...props} />
|
|
107
|
+
{showAvatar && <ChipAvatarStatic {...props} />}
|
|
88
108
|
<span className="k-chip-content">
|
|
89
109
|
{ children.length
|
|
90
110
|
? children
|
|
91
|
-
: text &&
|
|
92
|
-
|
|
111
|
+
: text && <span className="k-chip-label">{text}</span>
|
|
112
|
+
}
|
|
93
113
|
</span>
|
|
94
|
-
<
|
|
114
|
+
{ actions.length > 0 && <ChipActionsStatic actions={actions} />}
|
|
95
115
|
</div>
|
|
96
116
|
);
|
|
97
117
|
}
|
|
@@ -99,15 +119,14 @@ function ChipStatic(props) {
|
|
|
99
119
|
return (
|
|
100
120
|
<div className={chipClasses} {...ariaAttr} {...htmlAttributes}>
|
|
101
121
|
<IconStatic className="k-chip-icon" name={icon} />
|
|
102
|
-
<
|
|
103
|
-
<ChipAvatarStatic {...props} />
|
|
122
|
+
{showAvatar && <ChipAvatarStatic {...props} />}
|
|
104
123
|
<span className="k-chip-content">
|
|
105
124
|
{ children.length
|
|
106
125
|
? children
|
|
107
|
-
: text &&
|
|
108
|
-
|
|
126
|
+
: text && <span className="k-chip-label k-text-ellipsis">{text}</span>
|
|
127
|
+
}
|
|
109
128
|
</span>
|
|
110
|
-
<
|
|
129
|
+
{ actions.length > 0 && <ChipActionsStatic actions={actions} />}
|
|
111
130
|
</div>
|
|
112
131
|
);
|
|
113
132
|
}
|
|
@@ -119,9 +138,8 @@ ChipStatic.defaultProps = {
|
|
|
119
138
|
|
|
120
139
|
text: '',
|
|
121
140
|
icon: '',
|
|
122
|
-
|
|
141
|
+
actions: [],
|
|
123
142
|
showAvatar: false,
|
|
124
|
-
showSelectedIcon: false,
|
|
125
143
|
|
|
126
144
|
className: '',
|
|
127
145
|
|
|
@@ -133,16 +151,16 @@ ChipStatic.defaultProps = {
|
|
|
133
151
|
};
|
|
134
152
|
|
|
135
153
|
ChipStatic.propTypes = {
|
|
154
|
+
className: typeof '',
|
|
136
155
|
children: typeof [],
|
|
137
156
|
|
|
138
157
|
text: typeof '',
|
|
139
158
|
icon: typeof '',
|
|
140
|
-
|
|
159
|
+
actions: typeof [],
|
|
141
160
|
showAvatar: typeof false,
|
|
142
|
-
showSelectedIcon: typeof false,
|
|
143
161
|
|
|
144
162
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
145
|
-
rounded: typeof [ null, '
|
|
163
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
146
164
|
|
|
147
165
|
fillMode: typeof [ null, 'solid', 'outline' ],
|
|
148
166
|
themeColor: typeof [ null, 'base', 'error', 'warning', 'info', 'success' ],
|
|
@@ -156,7 +174,6 @@ ChipStatic.propTypes = {
|
|
|
156
174
|
aria: typeof false,
|
|
157
175
|
legacy: typeof false,
|
|
158
176
|
|
|
159
|
-
className: typeof '',
|
|
160
177
|
htmlAttributes: typeof []
|
|
161
178
|
};
|
|
162
179
|
|
package/src/chip/index.js
CHANGED