@progress/kendo-react-buttons 4.14.1 → 5.0.1
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/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/dist/es/Button.d.ts +79 -5
- package/dist/es/Button.js +30 -31
- package/dist/es/ButtonGroup.js +1 -1
- package/dist/es/ButtonInterface.d.ts +0 -13
- package/dist/es/Chip/Chip.d.ts +51 -9
- package/dist/es/Chip/Chip.js +34 -37
- package/dist/es/Chip/ChipList.d.ts +12 -0
- package/dist/es/Chip/ChipList.js +15 -13
- package/dist/es/FloatingActionButton/FloatingActionButton.js +26 -18
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +18 -4
- package/dist/es/FloatingActionButton/models/rounded.d.ts +12 -0
- package/dist/es/{buttonLook.js → FloatingActionButton/models/rounded.js} +0 -0
- package/dist/es/FloatingActionButton/models/shape.d.ts +2 -1
- package/dist/es/FloatingActionButton/models/size.d.ts +2 -1
- package/dist/es/FloatingActionButton/models/theme-color.d.ts +2 -1
- package/dist/es/ListButton/ButtonItem.d.ts +6 -5
- package/dist/es/ListButton/ButtonItem.js +24 -44
- package/dist/es/ListButton/DropDownButton.d.ts +2 -4
- package/dist/es/ListButton/DropDownButton.js +14 -13
- package/dist/es/ListButton/SplitButton.d.ts +0 -1
- package/dist/es/ListButton/SplitButton.js +13 -13
- package/dist/es/ListButton/models/ListButtonProps.d.ts +125 -13
- package/dist/es/main.d.ts +3 -3
- package/dist/es/models/index.d.ts +0 -16
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/util.js +3 -3
- package/dist/npm/Button.d.ts +79 -5
- package/dist/npm/Button.js +29 -30
- package/dist/npm/ButtonGroup.js +1 -1
- package/dist/npm/ButtonInterface.d.ts +0 -13
- package/dist/npm/Chip/Chip.d.ts +51 -9
- package/dist/npm/Chip/Chip.js +33 -36
- package/dist/npm/Chip/ChipList.d.ts +12 -0
- package/dist/npm/Chip/ChipList.js +14 -12
- package/dist/npm/FloatingActionButton/FloatingActionButton.js +25 -17
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +18 -4
- package/dist/npm/FloatingActionButton/models/rounded.d.ts +12 -0
- package/dist/npm/{buttonLook.js → FloatingActionButton/models/rounded.js} +0 -0
- package/dist/npm/FloatingActionButton/models/shape.d.ts +2 -1
- package/dist/npm/FloatingActionButton/models/size.d.ts +2 -1
- package/dist/npm/FloatingActionButton/models/theme-color.d.ts +2 -1
- package/dist/npm/ListButton/ButtonItem.d.ts +6 -5
- package/dist/npm/ListButton/ButtonItem.js +24 -44
- package/dist/npm/ListButton/DropDownButton.d.ts +2 -4
- package/dist/npm/ListButton/DropDownButton.js +13 -12
- package/dist/npm/ListButton/SplitButton.d.ts +0 -1
- package/dist/npm/ListButton/SplitButton.js +12 -12
- package/dist/npm/ListButton/models/ListButtonProps.d.ts +125 -13
- package/dist/npm/main.d.ts +3 -3
- package/dist/npm/models/index.d.ts +0 -16
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/util.js +3 -3
- package/dist/systemjs/kendo-react-buttons.js +1 -1
- package/package.json +11 -10
- package/dist/es/buttonLook.d.ts +0 -14
- package/dist/npm/buttonLook.d.ts +0 -14
|
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
};
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import * as PropTypes from 'prop-types';
|
|
23
|
-
import { validatePackage } from '@progress/kendo-react-common';
|
|
23
|
+
import { kendoThemeMaps, validatePackage } from '@progress/kendo-react-common';
|
|
24
24
|
import { classNames, guid, useDir, dispatchEvent, Keys, getTabIndex } from '@progress/kendo-react-common';
|
|
25
25
|
import { FloatingActionButtonItem } from './FloatingActionButtonItem';
|
|
26
26
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -41,7 +41,7 @@ import { Popup } from '@progress/kendo-react-popup';
|
|
|
41
41
|
*/
|
|
42
42
|
export var FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
43
43
|
validatePackage(packageMetadata);
|
|
44
|
-
var _a = props.align, align = _a === void 0 ? defaultProps.align : _a, alignOffset = props.alignOffset, className = props.className, disabled = props.disabled, icon = props.icon, iconClass = props.iconClass, id = props.id, items = props.items, item = props.item, text = props.text, _b = props.positionMode, positionMode = _b === void 0 ? defaultProps.positionMode : _b, _c = props.shape, shape = _c === void 0 ? defaultProps.shape : _c, _d = props.size, size = _d === void 0 ? defaultProps.size : _d, style = props.style, _e = props.themeColor, themeColor =
|
|
44
|
+
var _a = props.align, align = _a === void 0 ? defaultProps.align : _a, alignOffset = props.alignOffset, className = props.className, disabled = props.disabled, icon = props.icon, iconClass = props.iconClass, id = props.id, items = props.items, item = props.item, text = props.text, _b = props.positionMode, positionMode = _b === void 0 ? defaultProps.positionMode : _b, _c = props.shape, shape = _c === void 0 ? defaultProps.shape : _c, _d = props.size, size = _d === void 0 ? defaultProps.size : _d, style = props.style, _e = props.rounded, rounded = _e === void 0 ? defaultProps.rounded : _e, _f = props.themeColor, themeColor = _f === void 0 ? defaultProps.themeColor : _f, tabIndex = props.tabIndex, accessKey = props.accessKey, _g = props.popupSettings, popupSettings = _g === void 0 ? {} : _g, onClick = props.onClick, onItemClick = props.onItemClick, onFocus = props.onFocus, onBlur = props.onBlur, onKeyDown = props.onKeyDown, onOpen = props.onOpen, onClose = props.onClose, others = __rest(props, ["align", "alignOffset", "className", "disabled", "icon", "iconClass", "id", "items", "item", "text", "positionMode", "shape", "size", "style", "rounded", "themeColor", "tabIndex", "accessKey", "popupSettings", "onClick", "onItemClick", "onFocus", "onBlur", "onKeyDown", "onOpen", "onClose"]);
|
|
45
45
|
var target = React.useRef(null);
|
|
46
46
|
var elementRef = React.useRef(null);
|
|
47
47
|
var listRef = React.useRef(null);
|
|
@@ -57,9 +57,9 @@ export var FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
|
57
57
|
}); }, [focusElement]);
|
|
58
58
|
React.useImperativeHandle(target, getImperativeHandle);
|
|
59
59
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var
|
|
60
|
+
var _h = React.useState(false), open = _h[0], setOpen = _h[1];
|
|
61
|
+
var _j = React.useState(false), focused = _j[0], setFocused = _j[1];
|
|
62
|
+
var _k = React.useState(-1), focusedIndex = _k[0], setFocusedIndex = _k[1];
|
|
63
63
|
var buttonId = React.useMemo(function () { return guid(); }, []);
|
|
64
64
|
var dir = useDir(elementRef, props.dir);
|
|
65
65
|
var isRtl = dir === 'rtl';
|
|
@@ -191,15 +191,21 @@ export var FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
|
191
191
|
}
|
|
192
192
|
dispatchEvent(onKeyDown, event, getImperativeHandle(), undefined);
|
|
193
193
|
}, [onKeyDown, focusedIndex, setFocusedIndex, isRtl, setOpen]);
|
|
194
|
-
var buttonClassNames = React.useMemo(function () {
|
|
195
|
-
|
|
196
|
-
'k-fab-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
var buttonClassNames = React.useMemo(function () {
|
|
195
|
+
var _a;
|
|
196
|
+
return classNames('k-fab k-fab-solid', (_a = {},
|
|
197
|
+
_a["k-fab-" + shape] = shape,
|
|
198
|
+
_a['k-fab-sm'] = size === 'small',
|
|
199
|
+
_a['k-fab-md'] = size === 'medium',
|
|
200
|
+
_a['k-fab-lg'] = size === 'large',
|
|
201
|
+
_a['k-disabled'] = disabled,
|
|
202
|
+
_a['k-pos-absolute'] = positionMode === 'absolute',
|
|
203
|
+
_a['k-pos-fixed'] = positionMode === 'fixed',
|
|
204
|
+
_a['k-focus'] = focused,
|
|
205
|
+
_a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
206
|
+
_a["k-fab-solid-" + themeColor] = themeColor,
|
|
207
|
+
_a), "k-" + align.vertical + "-" + align.horizontal, className);
|
|
208
|
+
}, [themeColor, size, rounded, shape, disabled, positionMode, align, focused, className]);
|
|
203
209
|
var fabItems = (items && (items.map(function (element, index) {
|
|
204
210
|
return (React.createElement(FloatingActionButtonItem, __assign({}, element, { key: index, index: index, id: listId + "-" + index, disabled: disabled || element.disabled, focused: focusedIndex === index, dataItem: element, item: item, className: classNames(element.className, getTextDirectionClass(dir || 'ltr', align.horizontal)), onClick: handleItemClick, onDown: handleItemDown })));
|
|
205
211
|
})));
|
|
@@ -244,9 +250,10 @@ FloatingActionButton.propTypes = {
|
|
|
244
250
|
horizontal: PropTypes.oneOf(['start', 'center', 'end'])
|
|
245
251
|
}),
|
|
246
252
|
positionMode: PropTypes.oneOf(['absolute', 'fixed']),
|
|
247
|
-
shape: PropTypes.oneOf([
|
|
248
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
249
|
-
|
|
253
|
+
shape: PropTypes.oneOf([null, 'rectangle', 'square']),
|
|
254
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
255
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
256
|
+
themeColor: PropTypes.oneOf([null,
|
|
250
257
|
'primary', 'secondary', 'tertiary',
|
|
251
258
|
'info', 'success', 'warning',
|
|
252
259
|
'error', 'dark', 'light', 'inverse'
|
|
@@ -254,8 +261,9 @@ FloatingActionButton.propTypes = {
|
|
|
254
261
|
};
|
|
255
262
|
var defaultProps = {
|
|
256
263
|
align: { vertical: 'bottom', horizontal: 'end' },
|
|
257
|
-
shape: '
|
|
264
|
+
shape: 'rectangle',
|
|
258
265
|
size: 'medium',
|
|
266
|
+
rounded: 'full',
|
|
259
267
|
themeColor: 'primary',
|
|
260
268
|
positionMode: 'fixed'
|
|
261
269
|
};
|
|
@@ -8,6 +8,7 @@ import { FloatingActionButtonPositionMode } from '../models/position-mode';
|
|
|
8
8
|
import { FloatingActionButtonShape } from '../models/shape';
|
|
9
9
|
import { FloatingActionButtonSize } from '../models/size';
|
|
10
10
|
import { FloatingActionButtonThemeColor } from '../models/theme-color';
|
|
11
|
+
import { FloatingActionButtonRounded } from '../models/rounded';
|
|
11
12
|
/**
|
|
12
13
|
* @hidden
|
|
13
14
|
*/
|
|
@@ -101,13 +102,11 @@ export interface FloatingActionButtonProps extends Omit<React.ButtonHTMLAttribut
|
|
|
101
102
|
* [see example]({% slug appearance_floatingactionbutton %}).
|
|
102
103
|
*
|
|
103
104
|
* The possible values are:
|
|
104
|
-
* * `pill`(Default)—Applies border radius equal to half of the height of the FloatingActionButton.
|
|
105
|
-
* If the Floating Action Button contains only icon, the shape will be circle.
|
|
106
|
-
* * `circle`—Applies circle shape on the FloatingActionButton.
|
|
107
105
|
* * `rectangle`—Applies no border radius on the FloatingActionButton.
|
|
108
|
-
* * `rounded`—Applies default border radius on the FloatingActionButton.
|
|
109
106
|
* * `square`—Applies square shape on the FloatingActionButton.
|
|
107
|
+
* * `null`—Does not set a shape `className`.
|
|
110
108
|
*
|
|
109
|
+
* @default `rectangle`
|
|
111
110
|
*/
|
|
112
111
|
shape?: FloatingActionButtonShape;
|
|
113
112
|
/**
|
|
@@ -118,9 +117,23 @@ export interface FloatingActionButtonProps extends Omit<React.ButtonHTMLAttribut
|
|
|
118
117
|
* * `small`—Applies half of the default padding, e.g. `8px`.
|
|
119
118
|
* * `medium` (Default)—Applies the default padding, e.g. `16px`.
|
|
120
119
|
* * `large`—Applies one and one half of the default padding, e.g. `24px`.
|
|
120
|
+
* * `null`—Does not set a size `className`.
|
|
121
121
|
*
|
|
122
122
|
*/
|
|
123
123
|
size?: FloatingActionButtonSize;
|
|
124
|
+
/**
|
|
125
|
+
* Specifies the rounding of the Floating Action Button.
|
|
126
|
+
*
|
|
127
|
+
* The possible values are:
|
|
128
|
+
* * `small`
|
|
129
|
+
* * `medium`
|
|
130
|
+
* * `large`
|
|
131
|
+
* * `full`
|
|
132
|
+
* * `null`—Does not set a rounded `className`.
|
|
133
|
+
*
|
|
134
|
+
* @default `full`
|
|
135
|
+
*/
|
|
136
|
+
rounded?: FloatingActionButtonRounded;
|
|
124
137
|
/**
|
|
125
138
|
* Specifies the theme color of the Floating Action Button
|
|
126
139
|
* [see example]({% slug appearance_floatingactionbutton %}).
|
|
@@ -136,6 +149,7 @@ export interface FloatingActionButtonProps extends Omit<React.ButtonHTMLAttribut
|
|
|
136
149
|
* * `dark`— Applies coloring based on the dark theme color.
|
|
137
150
|
* * `light`— Applies coloring based on the light theme color.
|
|
138
151
|
* * `inverse`— Applies coloring based on the inverse theme color.
|
|
152
|
+
* * `null`—Does not set a theme color `className`.
|
|
139
153
|
*
|
|
140
154
|
*/
|
|
141
155
|
themeColor?: FloatingActionButtonThemeColor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the rounding of the Floating Action Button.
|
|
3
|
+
*
|
|
4
|
+
* The possible values are:
|
|
5
|
+
* * `small`
|
|
6
|
+
* * `medium`
|
|
7
|
+
* * `large`
|
|
8
|
+
* * `full`
|
|
9
|
+
* * `null`—Does not set a rounded `className`.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare type FloatingActionButtonRounded = null | 'small' | 'medium' | 'large' | 'full';
|
|
File without changes
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* * `rectangle`—Applies no border radius on the FloatingActionButton.
|
|
9
9
|
* * `rounded`—Applies default border radius on the FloatingActionButton.
|
|
10
10
|
* * `square`—Applies square shape on the FloatingActionButton.
|
|
11
|
+
* * `null`—Does not set a shape `className`.
|
|
11
12
|
*
|
|
12
13
|
*/
|
|
13
|
-
export declare type FloatingActionButtonShape =
|
|
14
|
+
export declare type FloatingActionButtonShape = null | 'rectangle' | 'square';
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* * `small`—Applies half of the default padding, e.g. `8px`.
|
|
6
6
|
* * `medium` (Default)—Applies the default padding, e.g. `16px`.
|
|
7
7
|
* * `large`—Applies one and one half of the default padding, e.g. `24px`.
|
|
8
|
+
* * `null`—Does not set a size `className`.
|
|
8
9
|
*
|
|
9
10
|
*/
|
|
10
|
-
export declare type FloatingActionButtonSize = 'small' | 'medium' | 'large';
|
|
11
|
+
export declare type FloatingActionButtonSize = null | 'small' | 'medium' | 'large';
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* * `dark`— Applies coloring based on the dark theme color.
|
|
13
13
|
* * `light`— Applies coloring based on the light theme color.
|
|
14
14
|
* * `inverse`— Applies coloring based on the inverse theme color.
|
|
15
|
+
* * `null`—Does not set a theme color `className`.
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
17
|
-
export declare type FloatingActionButtonThemeColor = 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | 'inverse';
|
|
18
|
+
export declare type FloatingActionButtonThemeColor = null | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | 'inverse';
|
|
@@ -19,12 +19,13 @@ export interface ButtonItemProps {
|
|
|
19
19
|
dataItem: any;
|
|
20
20
|
id?: string;
|
|
21
21
|
textField?: string;
|
|
22
|
+
className?: string;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* @hidden
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
declare const ButtonItem: {
|
|
28
|
+
(props: ButtonItemProps): any;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
export default ButtonItem;
|
|
@@ -1,50 +1,30 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
1
|
import * as React from 'react';
|
|
15
2
|
import { classNames } from '@progress/kendo-react-common';
|
|
16
3
|
/**
|
|
17
4
|
* @hidden
|
|
18
5
|
*/
|
|
19
|
-
var ButtonItem =
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(iconClass && (React.createElement("span", { className: iconClass, role: "presentation", key: "icon" }))),
|
|
44
|
-
(dataItem.imageUrl && (React.createElement("img", { className: "k-image", alt: "", src: dataItem.imageUrl, role: "presentation", key: "image" }))),
|
|
45
|
-
text
|
|
46
|
-
]);
|
|
47
|
-
};
|
|
48
|
-
return ButtonItem;
|
|
49
|
-
}(React.Component));
|
|
6
|
+
var ButtonItem = function (props) {
|
|
7
|
+
var _a;
|
|
8
|
+
var handleClick = React.useCallback(function (event) {
|
|
9
|
+
props.onClick(event, props.index);
|
|
10
|
+
}, [props]);
|
|
11
|
+
var As = props.dataItem.render || props.item || (props.item === undefined ? props.render : null);
|
|
12
|
+
var text = props.dataItem.text !== undefined ? props.dataItem.text : (props.textField ? props.dataItem[props.textField] : props.dataItem);
|
|
13
|
+
var item = (React.createElement("li", { id: props.id, className: classNames('k-item', props.className), onClick: handleClick, onMouseDown: props.onDown, onPointerDown: props.onDown, role: "menuItem", "aria-disabled": props.dataItem.disabled || undefined }, (React.createElement("span", { tabIndex: -1, className: classNames('k-link k-menu-link', {
|
|
14
|
+
'k-selected': props.dataItem.selected,
|
|
15
|
+
'k-disabled': props.dataItem.disabled,
|
|
16
|
+
'k-focus': props.focused
|
|
17
|
+
}), key: "icon" }, As
|
|
18
|
+
? (React.createElement(As, { item: props.dataItem, itemIndex: props.index }))
|
|
19
|
+
: (React.createElement(React.Fragment, null,
|
|
20
|
+
(props.dataItem.icon || props.dataItem.iconClass) && (React.createElement("span", { className: classNames('k-icon', (_a = {},
|
|
21
|
+
_a["k-i-" + props.dataItem.icon] = props.dataItem.icon,
|
|
22
|
+
_a["" + props.dataItem.iconClass] = props.dataItem.iconClass,
|
|
23
|
+
_a)) })),
|
|
24
|
+
(props.dataItem.imageUrl) && (React.createElement("img", { role: "presentation", alt: "", src: props.dataItem.imageUrl, className: 'k-icon' })),
|
|
25
|
+
(text) && (React.createElement("span", { className: "k-menu-link-text" }, text))))))));
|
|
26
|
+
return ((props.item !== undefined && /* to be removed in 5.0.0 */
|
|
27
|
+
props.render !== undefined) ? props.render.call(undefined, item, props) : item);
|
|
28
|
+
};
|
|
29
|
+
ButtonItem.displayName = 'KendoReactButtonItem';
|
|
50
30
|
export default ButtonItem;
|
|
@@ -34,7 +34,6 @@ export default class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
34
34
|
*/
|
|
35
35
|
static propTypes: {
|
|
36
36
|
accessKey: PropTypes.Requireable<string>;
|
|
37
|
-
primary: PropTypes.Requireable<boolean>;
|
|
38
37
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
38
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
39
|
onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -50,7 +49,6 @@ export default class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
50
49
|
popupSettings: PropTypes.Requireable<object>;
|
|
51
50
|
itemRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
51
|
item: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
-
look: PropTypes.Requireable<string>;
|
|
54
52
|
className: PropTypes.Requireable<string>;
|
|
55
53
|
buttonClass: PropTypes.Requireable<string>;
|
|
56
54
|
dir: PropTypes.Requireable<string>;
|
|
@@ -86,8 +84,8 @@ export default class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
86
84
|
*/
|
|
87
85
|
readonly element: HTMLButtonElement | null;
|
|
88
86
|
private onKeyDown;
|
|
89
|
-
private
|
|
90
|
-
private
|
|
87
|
+
private handleFocus;
|
|
88
|
+
private handleBlur;
|
|
91
89
|
private onItemClick;
|
|
92
90
|
private onItemDown;
|
|
93
91
|
private mouseDown;
|
|
@@ -25,7 +25,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
import * as React from 'react';
|
|
26
26
|
import * as PropTypes from 'prop-types';
|
|
27
27
|
import { Button } from './../main';
|
|
28
|
-
import { classNames, guid, Keys } from '@progress/kendo-react-common';
|
|
28
|
+
import { classNames, guid, Keys, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
29
29
|
import { dispatchEvent } from '@progress/kendo-react-common';
|
|
30
30
|
import navigation from './utils/navigation';
|
|
31
31
|
import DropDownButtonItem from './DropDownButtonItem';
|
|
@@ -111,11 +111,11 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
111
111
|
}
|
|
112
112
|
_this.setState(newState);
|
|
113
113
|
};
|
|
114
|
-
_this.
|
|
114
|
+
_this.handleFocus = function (event) {
|
|
115
115
|
_this.setState({ focused: true, focusedIndex: _this.opened ? 0 : -1 });
|
|
116
116
|
dispatchEvent(_this.props.onFocus, event, _this, undefined);
|
|
117
117
|
};
|
|
118
|
-
_this.
|
|
118
|
+
_this.handleBlur = function (event) {
|
|
119
119
|
_this.setState({ focused: false, opened: false, focusedIndex: -1 });
|
|
120
120
|
dispatchEvent(_this.props.onBlur, event, _this, undefined);
|
|
121
121
|
var fireCloseEvent = _this.opened;
|
|
@@ -174,10 +174,10 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
174
174
|
React.Children.toArray(this.props.children)
|
|
175
175
|
.filter(function (child) { return child && child.type === DropDownButtonItem; })
|
|
176
176
|
.map(function (child) { return child.props; });
|
|
177
|
-
return (React.createElement("div", { className: classNames('k-
|
|
178
|
-
'k-
|
|
179
|
-
}), onKeyDown: this.onKeyDown, onFocus: this.
|
|
180
|
-
React.createElement(Button, { onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl,
|
|
177
|
+
return (React.createElement("div", { className: classNames('k-dropdown-button', {
|
|
178
|
+
'k-focus': this.state.focused
|
|
179
|
+
}, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
180
|
+
React.createElement(Button, { size: this.props.size, shape: this.props.shape, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (btn) { return _this.mainButton = btn && btn.element; }, type: "button", "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": this.opened, "aria-label": this.props.text + " dropdownbutton", "aria-owns": this.guid, "aria-activedescendant": focusedIndex >= 0 ? this.guid + "-" + focusedIndex : undefined }, this.props.text),
|
|
181
181
|
this.renderPopup(rtl)));
|
|
182
182
|
};
|
|
183
183
|
/**
|
|
@@ -217,15 +217,18 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
DropDownButton.prototype.renderPopup = function (rtl) {
|
|
220
|
-
var _a
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
var _a;
|
|
221
|
+
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
222
|
+
return (React.createElement(Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: classNames('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl), popupAlign: popupSettings.popupAlign || getPopupAlign(rtl), style: rtl ? { direction: 'rtl' } : undefined },
|
|
223
|
+
React.createElement("ul", { role: "menu", id: this.guid, className: classNames('k-group k-menu-group k-reset', (_a = {},
|
|
224
|
+
_a["k-menu-group-" + (kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
225
|
+
_a)) }, this.renderChildItems())));
|
|
223
226
|
};
|
|
224
227
|
DropDownButton.prototype.renderChildItems = function () {
|
|
225
228
|
var _this = this;
|
|
226
229
|
var _a = this.props, item = _a.item, itemRender = _a.itemRender, textField = _a.textField;
|
|
227
230
|
return this.buttonsData.length > 0 ? (this.buttonsData.map(function (dataItem, index) {
|
|
228
|
-
return (React.createElement(ButtonItem, { dataItem: dataItem, textField: textField, focused: _this.state.focusedIndex === index, onClick: _this.onItemClick, onDown: _this.onItemDown, render: itemRender, item: item, index: index, key: index, id: _this.guid + "-" + index }));
|
|
231
|
+
return (React.createElement(ButtonItem, { className: "k-menu-item", dataItem: dataItem, textField: textField, focused: _this.state.focusedIndex === index, onClick: _this.onItemClick, onDown: _this.onItemDown, render: itemRender, item: item, index: index, key: index, id: _this.guid + "-" + index }));
|
|
229
232
|
})) : null;
|
|
230
233
|
};
|
|
231
234
|
DropDownButton.prototype.isItemDisabled = function (index) {
|
|
@@ -240,7 +243,6 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
240
243
|
*/
|
|
241
244
|
DropDownButton.propTypes = {
|
|
242
245
|
accessKey: PropTypes.string,
|
|
243
|
-
primary: PropTypes.bool,
|
|
244
246
|
onFocus: PropTypes.func,
|
|
245
247
|
onBlur: PropTypes.func,
|
|
246
248
|
onItemClick: PropTypes.func,
|
|
@@ -256,7 +258,6 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
256
258
|
popupSettings: PropTypes.object,
|
|
257
259
|
itemRender: PropTypes.func,
|
|
258
260
|
item: PropTypes.func,
|
|
259
|
-
look: PropTypes.string,
|
|
260
261
|
className: PropTypes.string,
|
|
261
262
|
buttonClass: PropTypes.string,
|
|
262
263
|
dir: PropTypes.string
|
|
@@ -51,7 +51,6 @@ export default class SplitButton extends React.Component<SplitButtonProps, Split
|
|
|
51
51
|
popupSettings: PropTypes.Requireable<object>;
|
|
52
52
|
itemRender: PropTypes.Requireable<any>;
|
|
53
53
|
item: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
-
look: PropTypes.Requireable<string>;
|
|
55
54
|
className: PropTypes.Requireable<string>;
|
|
56
55
|
buttonClass: PropTypes.Requireable<string>;
|
|
57
56
|
dir: PropTypes.Requireable<string>;
|
|
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import * as PropTypes from 'prop-types';
|
|
16
16
|
import { Button } from './../main';
|
|
17
|
-
import { classNames, guid, Keys } from '@progress/kendo-react-common';
|
|
17
|
+
import { classNames, guid, kendoThemeMaps, Keys } from '@progress/kendo-react-common';
|
|
18
18
|
import { dispatchEvent } from '@progress/kendo-react-common';
|
|
19
19
|
import ButtonItem from './ButtonItem';
|
|
20
20
|
import SplitButtonItem from './SplitButtonItem';
|
|
@@ -23,8 +23,6 @@ import { Popup } from '@progress/kendo-react-popup';
|
|
|
23
23
|
import { getAnchorAlign, getPopupAlign } from './utils/popup';
|
|
24
24
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
25
25
|
import { packageMetadata } from '../package-metadata';
|
|
26
|
-
import util from '../util';
|
|
27
|
-
var styles = util.styles;
|
|
28
26
|
/**
|
|
29
27
|
* Represents the [KendoReact SplitButton component]({% slug overview_splitbutton %}).
|
|
30
28
|
*
|
|
@@ -184,11 +182,11 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
184
182
|
var dir = rtl ? 'rtl' : undefined;
|
|
185
183
|
var _a = this.props, tabIndex = _a.tabIndex, disabled = _a.disabled;
|
|
186
184
|
var focusedIndex = this.state.focusedIndex;
|
|
187
|
-
return (React.createElement("div", { className: classNames('k-
|
|
188
|
-
'k-
|
|
189
|
-
}, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.onFocus, onBlur: this.onBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
190
|
-
React.createElement(Button, { onClick: function (event) { return _this.onItemClick(event, -1); }, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, className: this.props.buttonClass, icon: this.props.icon, iconClass: this.props.iconClass, imageUrl: this.props.imageUrl,
|
|
191
|
-
React.createElement(Button, { icon: "arrow-s", disabled: disabled || undefined, tabIndex: -1,
|
|
185
|
+
return (React.createElement("div", { className: classNames('k-split-button', 'k-button-group', {
|
|
186
|
+
'k-focus': this.state.focused
|
|
187
|
+
}, "k-rounded-" + kendoThemeMaps.roundedMap[this.props.rounded || 'medium'], this.props.className), onKeyDown: this.onKeyDown, onFocus: this.onFocus, onBlur: this.onBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
188
|
+
React.createElement(Button, { size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: function (event) { return _this.onItemClick(event, -1); }, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, className: this.props.buttonClass, icon: this.props.icon, iconClass: this.props.iconClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (el) { return _this.mainButton = el && el.element; }, type: "button", "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": this.opened, "aria-label": this.props.text + " splitbutton", "aria-owns": this.guid, "aria-activedescendant": focusedIndex >= 0 ? this.guid + "-" + focusedIndex : undefined }, this.props.text),
|
|
189
|
+
React.createElement(Button, { size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, icon: "arrow-s", disabled: disabled || undefined, tabIndex: -1, onClick: this.onSplitPartClick, onMouseDown: this.onDownSplitPart, onPointerDown: this.onDownSplitPart, dir: dir, "aria-label": "menu toggling button" }),
|
|
192
190
|
this.renderPopup(rtl)));
|
|
193
191
|
};
|
|
194
192
|
/**
|
|
@@ -224,15 +222,18 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
224
222
|
}
|
|
225
223
|
};
|
|
226
224
|
SplitButton.prototype.renderPopup = function (rtl) {
|
|
227
|
-
var _a
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
var _a;
|
|
226
|
+
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
227
|
+
return (React.createElement(Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: classNames('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl), popupAlign: popupSettings.popupAlign || getPopupAlign(rtl), style: rtl ? { direction: 'rtl' } : undefined },
|
|
228
|
+
React.createElement("ul", { role: "menu", id: this.guid, className: classNames('k-group k-menu-group k-reset', (_a = {},
|
|
229
|
+
_a["k-menu-group-" + (kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
230
|
+
_a)) }, this.renderChildItems())));
|
|
230
231
|
};
|
|
231
232
|
SplitButton.prototype.renderChildItems = function () {
|
|
232
233
|
var _this = this;
|
|
233
234
|
var _a = this.props, item = _a.item, itemRender = _a.itemRender, textField = _a.textField;
|
|
234
235
|
return this.buttonsData.length > 0 ? (this.buttonsData.map(function (dataItem, index) {
|
|
235
|
-
return (React.createElement(ButtonItem, { dataItem: dataItem, textField: textField, focused: _this.state.focusedIndex === index, onClick: _this.onItemClick, onDown: _this.onItemDown, render: itemRender, item: item, key: index, index: index, id: _this.guid + "-" + index }));
|
|
236
|
+
return (React.createElement(ButtonItem, { className: "k-menu-item", dataItem: dataItem, textField: textField, focused: _this.state.focusedIndex === index, onClick: _this.onItemClick, onDown: _this.onItemDown, render: itemRender, item: item, key: index, index: index, id: _this.guid + "-" + index }));
|
|
236
237
|
})) : null;
|
|
237
238
|
};
|
|
238
239
|
SplitButton.prototype.isItemDisabled = function (index) {
|
|
@@ -264,7 +265,6 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
264
265
|
popupSettings: PropTypes.object,
|
|
265
266
|
itemRender: PropTypes.any,
|
|
266
267
|
item: PropTypes.func,
|
|
267
|
-
look: PropTypes.string,
|
|
268
268
|
className: PropTypes.string,
|
|
269
269
|
buttonClass: PropTypes.string,
|
|
270
270
|
dir: PropTypes.string
|