@progress/kendo-react-buttons 4.14.1 → 5.0.0-dev.202201182040
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
package/dist/npm/Chip/Chip.js
CHANGED
|
@@ -25,6 +25,7 @@ var kendo_react_common_3 = require("@progress/kendo-react-common");
|
|
|
25
25
|
* Represents the Chip component.
|
|
26
26
|
*/
|
|
27
27
|
exports.Chip = React.forwardRef(function (props, ref) {
|
|
28
|
+
var _a;
|
|
28
29
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
29
30
|
var target = React.useRef(null);
|
|
30
31
|
var chipRef = React.useRef(null);
|
|
@@ -34,22 +35,24 @@ exports.Chip = React.forwardRef(function (props, ref) {
|
|
|
34
35
|
props: props
|
|
35
36
|
}); });
|
|
36
37
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var _b = React.useContext(ChipList_1.ChipListSelectionContext), selection = _b[0], dispatchSelection = _b[1];
|
|
39
|
+
var _c = React.useContext(ChipList_1.ChipListFocusContext), focus = _c[0], dispatchFocus = _c[1];
|
|
40
|
+
var _d = React.useContext(ChipList_1.ChipListDataContext), dispatchData = _d[1];
|
|
40
41
|
var selected = React.useMemo(function () {
|
|
41
42
|
return (props.selected || (Array.isArray(selection)
|
|
42
43
|
? selection.some(function (i) { return i === props.value; })
|
|
43
44
|
: selection === props.value));
|
|
44
45
|
}, [props.selected, props.value, selection]);
|
|
45
46
|
var focused = React.useMemo(function () { return focus === props.value; }, [props.value, focus]);
|
|
46
|
-
|
|
47
|
+
/* const look = React.useMemo(
|
|
48
|
+
() => props.look || defaultProps.look,
|
|
49
|
+
[props.look]
|
|
50
|
+
); */
|
|
47
51
|
React.useEffect(function () {
|
|
48
52
|
if (focused && chipRef.current) {
|
|
49
53
|
chipRef.current.focus();
|
|
50
54
|
}
|
|
51
55
|
}, [focused]);
|
|
52
|
-
// React.useEffect(() => dispatchItemsContext({type: FOCUS_ACTION.register, payload: target }), []);
|
|
53
56
|
var handleClick = React.useCallback(function (event) {
|
|
54
57
|
dispatchSelection({ type: selection_reducer_1.SELECTION_ACTION.toggle, payload: props.value, event: event });
|
|
55
58
|
}, [props.onClick, dispatchSelection, props.value]);
|
|
@@ -109,61 +112,55 @@ exports.Chip = React.forwardRef(function (props, ref) {
|
|
|
109
112
|
}
|
|
110
113
|
}, [props.onBlur]);
|
|
111
114
|
var mouseProps = kendo_react_common_3.useMouse(props, target, { onClick: handleClick });
|
|
112
|
-
return (React.createElement("div", __assign({}, mouseProps, { role: props.role, id: props.value, style: props.style, ref: chipRef, dir: dir, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled, undefined), className: kendo_react_common_1.classNames('k-chip', {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}, props.className), "aria-checked": selected, "aria-disabled": props.disabled, "aria-describedby": props.ariaDescribedBy, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown }),
|
|
126
|
-
selected && React.createElement("span", { className: 'k-selected-icon-wrapper' },
|
|
127
|
-
React.createElement("span", { className: "k-selected-icon k-icon " + (props.selectedIcon || defaultProps.selectedIcon) })),
|
|
128
|
-
props.icon && React.createElement("span", { className: "k-icon k-chip-icon " + props.icon }),
|
|
115
|
+
return (React.createElement("div", __assign({}, mouseProps, { role: props.role, id: props.value, style: props.style, ref: chipRef, dir: dir, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled, undefined), className: kendo_react_common_1.classNames('k-chip', (_a = {
|
|
116
|
+
'k-rtl': dir === 'rtl',
|
|
117
|
+
'k-disabled': props.disabled,
|
|
118
|
+
'k-selected': selected,
|
|
119
|
+
'k-focus': focused
|
|
120
|
+
},
|
|
121
|
+
_a["k-chip-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[props.size] || props.size)] = props.size,
|
|
122
|
+
_a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[props.rounded] || props.rounded)] = props.rounded,
|
|
123
|
+
_a["k-chip-" + props.fillMode] = props.fillMode,
|
|
124
|
+
_a["k-chip-" + props.fillMode + "-" + props.themeColor] = Boolean(props.fillMode && props.themeColor),
|
|
125
|
+
_a), props.className), "aria-checked": selected, "aria-disabled": props.disabled, "aria-describedby": props.ariaDescribedBy, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown }),
|
|
126
|
+
(selected && props.selectedIcon) && React.createElement("span", { className: kendo_react_common_1.classNames('k-chip-icon', 'k-icon', props.selectedIcon) }),
|
|
127
|
+
props.icon && React.createElement("span", { className: kendo_react_common_1.classNames('k-chip-icon', 'k-icon', props.icon) }),
|
|
129
128
|
React.createElement("span", { className: 'k-chip-content' }, props.children !== undefined
|
|
130
129
|
? props.children
|
|
131
130
|
: props.text &&
|
|
132
131
|
React.createElement("span", { "aria-label": props.text, className: 'k-chip-label' }, props.text)),
|
|
133
132
|
props.removable &&
|
|
134
|
-
React.createElement("span", { className: 'k-
|
|
135
|
-
React.createElement("span", { className: "k-icon " + props.removeIcon }))));
|
|
133
|
+
React.createElement("span", { className: kendo_react_common_1.classNames('k-chip-icon', 'k-icon', props.removeIcon), onClick: handleRemove })));
|
|
136
134
|
});
|
|
137
135
|
var propTypes = {
|
|
138
136
|
id: PropTypes.string,
|
|
139
137
|
text: PropTypes.string,
|
|
140
138
|
value: PropTypes.any,
|
|
141
|
-
type: PropTypes.oneOf([
|
|
142
|
-
'none',
|
|
143
|
-
'success',
|
|
144
|
-
'warning',
|
|
145
|
-
'error',
|
|
146
|
-
'info'
|
|
147
|
-
]),
|
|
148
139
|
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
149
140
|
removable: PropTypes.bool,
|
|
150
141
|
removeIcon: PropTypes.string,
|
|
151
142
|
disabled: PropTypes.bool,
|
|
152
143
|
icon: PropTypes.string,
|
|
153
144
|
selectedIcon: PropTypes.string,
|
|
154
|
-
look: PropTypes.string,
|
|
155
145
|
onRemove: PropTypes.func,
|
|
156
146
|
dataItem: PropTypes.any,
|
|
157
147
|
selected: PropTypes.bool,
|
|
158
|
-
ariaDescribedBy: PropTypes.string
|
|
148
|
+
ariaDescribedBy: PropTypes.string,
|
|
149
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
150
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
151
|
+
fillMode: PropTypes.oneOf([null, 'outline', 'solid']),
|
|
152
|
+
// eslint-disable-next-line max-len
|
|
153
|
+
themeColor: PropTypes.oneOf([null, 'base', 'info', 'success', 'warning', 'error'])
|
|
159
154
|
};
|
|
160
155
|
var defaultProps = {
|
|
161
156
|
disabled: false,
|
|
162
157
|
removable: false,
|
|
163
|
-
selectedIcon: 'k-i-check',
|
|
164
|
-
look: 'solid',
|
|
165
158
|
removeIcon: 'k-i-close-circle',
|
|
166
|
-
dir: 'ltr'
|
|
159
|
+
dir: 'ltr',
|
|
160
|
+
size: 'medium',
|
|
161
|
+
rounded: 'medium',
|
|
162
|
+
fillMode: 'solid',
|
|
163
|
+
themeColor: 'base'
|
|
167
164
|
};
|
|
168
165
|
exports.Chip.displayName = 'KendoReactChip';
|
|
169
166
|
// TODO: delete casting when @types/react is updated!
|
|
@@ -79,6 +79,18 @@ export interface ChipListProps extends FormComponentProps, KendoMouse<ChipListHa
|
|
|
79
79
|
* Identifies the element(s) which will label the component.
|
|
80
80
|
*/
|
|
81
81
|
ariaLabelledBy?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Configures the `size` of the ChipList.
|
|
84
|
+
*
|
|
85
|
+
* The available options are:
|
|
86
|
+
* - small
|
|
87
|
+
* - medium
|
|
88
|
+
* - large
|
|
89
|
+
* - null—Does not set a size `className`.
|
|
90
|
+
*
|
|
91
|
+
* @default `medium`
|
|
92
|
+
*/
|
|
93
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
82
94
|
}
|
|
83
95
|
/**
|
|
84
96
|
* Represents the target(element and props) of the ChipListChangeEvent.
|
|
@@ -81,6 +81,7 @@ var useData = function (defaultData, args, callback) {
|
|
|
81
81
|
* Represents the ChipList component.
|
|
82
82
|
*/
|
|
83
83
|
exports.ChipList = React.forwardRef(function (props, ref) {
|
|
84
|
+
var _a;
|
|
84
85
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
85
86
|
var target = React.useRef(null);
|
|
86
87
|
var chipListRef = React.useRef(null);
|
|
@@ -101,10 +102,10 @@ exports.ChipList = React.forwardRef(function (props, ref) {
|
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
}, [props.onChange]);
|
|
104
|
-
var
|
|
105
|
+
var _b = useSelection(props.value || props.defaultValue, {
|
|
105
106
|
selection: selection,
|
|
106
107
|
state: props.value
|
|
107
|
-
}, handleChange), stateValue =
|
|
108
|
+
}, handleChange), stateValue = _b[0], dispatchStateValue = _b[1];
|
|
108
109
|
var handleDataChange = React.useCallback(function (newData, event) {
|
|
109
110
|
if (props.onDataChange && target.current) {
|
|
110
111
|
props.onDataChange.call(undefined, {
|
|
@@ -114,10 +115,10 @@ exports.ChipList = React.forwardRef(function (props, ref) {
|
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
}, [props.onDataChange]);
|
|
117
|
-
var
|
|
118
|
+
var _c = useData(props.data || props.defaultData || defaultProps.defaultData, {
|
|
118
119
|
state: props.data,
|
|
119
120
|
valueField: props.valueField || defaultProps.valueField
|
|
120
|
-
}, handleDataChange), stateData =
|
|
121
|
+
}, handleDataChange), stateData = _c[0], dispatchData = _c[1];
|
|
121
122
|
var itemsReducer = React.useCallback(function (acc, current) {
|
|
122
123
|
acc.push(current[props.valueField || defaultProps.valueField]);
|
|
123
124
|
return acc;
|
|
@@ -125,18 +126,18 @@ exports.ChipList = React.forwardRef(function (props, ref) {
|
|
|
125
126
|
var data = React.useMemo(function () { return props.data || stateData; }, [props.data, stateData]);
|
|
126
127
|
var value = React.useMemo(function () { return props.value || stateValue; }, [props.value, stateValue]);
|
|
127
128
|
var items = React.useMemo(function () { return data.reduce(itemsReducer, []); }, [data, itemsReducer]);
|
|
128
|
-
var
|
|
129
|
+
var _d = useFocus({ items: items }), focus = _d[0], dispatchFocus = _d[1];
|
|
129
130
|
var mouseProps = kendo_react_common_1.useMouse(props, target);
|
|
130
131
|
return (React.createElement(exports.ChipListSelectionContext.Provider, { value: [value, dispatchStateValue] },
|
|
131
132
|
React.createElement(exports.ChipListFocusContext.Provider, { value: [focus, dispatchFocus] },
|
|
132
133
|
React.createElement(exports.ChipListDataContext.Provider, { value: [data, dispatchData] },
|
|
133
|
-
React.createElement("div", __assign({ ref: chipListRef }, mouseProps, { role: 'listbox', id: props.id, dir: dir, style: props.style, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled, undefined), className: kendo_react_common_1.classNames('k-chip-list', {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return (React.createElement(ChipComponent, { role: 'option', dataItem: item, key: kendo_react_common_1.getter(props.valueField || defaultProps.valueField)(item), text: kendo_react_common_1.getter(props.textField || defaultProps.textField)(item), value: kendo_react_common_1.getter(props.valueField || defaultProps.valueField)(item) }));
|
|
134
|
+
React.createElement("div", __assign({ ref: chipListRef }, mouseProps, { role: 'listbox', id: props.id, dir: dir, style: props.style, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled, undefined), className: kendo_react_common_1.classNames('k-chip-list', (_a = {
|
|
135
|
+
'k-rtl': dir === 'rtl',
|
|
136
|
+
'k-disabled': props.disabled
|
|
137
|
+
},
|
|
138
|
+
_a["k-chip-list-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[props.size] || props.size)] = props.size,
|
|
139
|
+
_a), props.className), "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy }), data.map(function (item) {
|
|
140
|
+
return (React.createElement(ChipComponent, { role: 'option', dataItem: item, size: props.size, key: kendo_react_common_1.getter(props.valueField || defaultProps.valueField)(item), text: kendo_react_common_1.getter(props.textField || defaultProps.textField)(item), value: kendo_react_common_1.getter(props.valueField || defaultProps.valueField)(item) }));
|
|
140
141
|
}))))));
|
|
141
142
|
});
|
|
142
143
|
var propTypes = {
|
|
@@ -159,6 +160,7 @@ var propTypes = {
|
|
|
159
160
|
};
|
|
160
161
|
var defaultProps = {
|
|
161
162
|
chip: Chip_1.Chip,
|
|
163
|
+
size: 'medium',
|
|
162
164
|
disabled: false,
|
|
163
165
|
defaultValue: null,
|
|
164
166
|
defaultData: [],
|
|
@@ -43,7 +43,7 @@ var kendo_react_popup_1 = require("@progress/kendo-react-popup");
|
|
|
43
43
|
*/
|
|
44
44
|
exports.FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
45
45
|
kendo_react_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
46
|
-
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 =
|
|
46
|
+
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"]);
|
|
47
47
|
var target = React.useRef(null);
|
|
48
48
|
var elementRef = React.useRef(null);
|
|
49
49
|
var listRef = React.useRef(null);
|
|
@@ -59,9 +59,9 @@ exports.FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
|
59
59
|
}); }, [focusElement]);
|
|
60
60
|
React.useImperativeHandle(target, getImperativeHandle);
|
|
61
61
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
62
|
+
var _h = React.useState(false), open = _h[0], setOpen = _h[1];
|
|
63
|
+
var _j = React.useState(false), focused = _j[0], setFocused = _j[1];
|
|
64
|
+
var _k = React.useState(-1), focusedIndex = _k[0], setFocusedIndex = _k[1];
|
|
65
65
|
var buttonId = React.useMemo(function () { return kendo_react_common_2.guid(); }, []);
|
|
66
66
|
var dir = kendo_react_common_2.useDir(elementRef, props.dir);
|
|
67
67
|
var isRtl = dir === 'rtl';
|
|
@@ -193,15 +193,21 @@ exports.FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
|
193
193
|
}
|
|
194
194
|
kendo_react_common_2.dispatchEvent(onKeyDown, event, getImperativeHandle(), undefined);
|
|
195
195
|
}, [onKeyDown, focusedIndex, setFocusedIndex, isRtl, setOpen]);
|
|
196
|
-
var buttonClassNames = React.useMemo(function () {
|
|
197
|
-
|
|
198
|
-
'k-fab-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
var buttonClassNames = React.useMemo(function () {
|
|
197
|
+
var _a;
|
|
198
|
+
return kendo_react_common_2.classNames('k-fab k-fab-solid', (_a = {},
|
|
199
|
+
_a["k-fab-" + shape] = shape,
|
|
200
|
+
_a['k-fab-sm'] = size === 'small',
|
|
201
|
+
_a['k-fab-md'] = size === 'medium',
|
|
202
|
+
_a['k-fab-lg'] = size === 'large',
|
|
203
|
+
_a['k-disabled'] = disabled,
|
|
204
|
+
_a['k-pos-absolute'] = positionMode === 'absolute',
|
|
205
|
+
_a['k-pos-fixed'] = positionMode === 'fixed',
|
|
206
|
+
_a['k-focus'] = focused,
|
|
207
|
+
_a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
208
|
+
_a["k-fab-solid-" + themeColor] = themeColor,
|
|
209
|
+
_a), "k-" + align.vertical + "-" + align.horizontal, className);
|
|
210
|
+
}, [themeColor, size, rounded, shape, disabled, positionMode, align, focused, className]);
|
|
205
211
|
var fabItems = (items && (items.map(function (element, index) {
|
|
206
212
|
return (React.createElement(FloatingActionButtonItem_1.FloatingActionButtonItem, __assign({}, element, { key: index, index: index, id: listId + "-" + index, disabled: disabled || element.disabled, focused: focusedIndex === index, dataItem: element, item: item, className: kendo_react_common_2.classNames(element.className, utils_1.getTextDirectionClass(dir || 'ltr', align.horizontal)), onClick: handleItemClick, onDown: handleItemDown })));
|
|
207
213
|
})));
|
|
@@ -246,9 +252,10 @@ exports.FloatingActionButton.propTypes = {
|
|
|
246
252
|
horizontal: PropTypes.oneOf(['start', 'center', 'end'])
|
|
247
253
|
}),
|
|
248
254
|
positionMode: PropTypes.oneOf(['absolute', 'fixed']),
|
|
249
|
-
shape: PropTypes.oneOf([
|
|
250
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
251
|
-
|
|
255
|
+
shape: PropTypes.oneOf([null, 'rectangle', 'square']),
|
|
256
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
257
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
258
|
+
themeColor: PropTypes.oneOf([null,
|
|
252
259
|
'primary', 'secondary', 'tertiary',
|
|
253
260
|
'info', 'success', 'warning',
|
|
254
261
|
'error', 'dark', 'light', 'inverse'
|
|
@@ -256,8 +263,9 @@ exports.FloatingActionButton.propTypes = {
|
|
|
256
263
|
};
|
|
257
264
|
var defaultProps = {
|
|
258
265
|
align: { vertical: 'bottom', horizontal: 'end' },
|
|
259
|
-
shape: '
|
|
266
|
+
shape: 'rectangle',
|
|
260
267
|
size: 'medium',
|
|
268
|
+
rounded: 'full',
|
|
261
269
|
themeColor: 'primary',
|
|
262
270
|
positionMode: 'fixed'
|
|
263
271
|
};
|
|
@@ -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,52 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
var React = require("react");
|
|
17
4
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
18
5
|
/**
|
|
19
6
|
* @hidden
|
|
20
7
|
*/
|
|
21
|
-
var ButtonItem =
|
|
22
|
-
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(iconClass && (React.createElement("span", { className: iconClass, role: "presentation", key: "icon" }))),
|
|
46
|
-
(dataItem.imageUrl && (React.createElement("img", { className: "k-image", alt: "", src: dataItem.imageUrl, role: "presentation", key: "image" }))),
|
|
47
|
-
text
|
|
48
|
-
]);
|
|
49
|
-
};
|
|
50
|
-
return ButtonItem;
|
|
51
|
-
}(React.Component));
|
|
8
|
+
var ButtonItem = function (props) {
|
|
9
|
+
var _a;
|
|
10
|
+
var handleClick = React.useCallback(function (event) {
|
|
11
|
+
props.onClick(event, props.index);
|
|
12
|
+
}, [props]);
|
|
13
|
+
var As = props.dataItem.render || props.item || (props.item === undefined ? props.render : null);
|
|
14
|
+
var text = props.dataItem.text !== undefined ? props.dataItem.text : (props.textField ? props.dataItem[props.textField] : props.dataItem);
|
|
15
|
+
var item = (React.createElement("li", { id: props.id, className: kendo_react_common_1.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: kendo_react_common_1.classNames('k-link k-menu-link', {
|
|
16
|
+
'k-selected': props.dataItem.selected,
|
|
17
|
+
'k-disabled': props.dataItem.disabled,
|
|
18
|
+
'k-focus': props.focused
|
|
19
|
+
}), key: "icon" }, As
|
|
20
|
+
? (React.createElement(As, { item: props.dataItem, itemIndex: props.index }))
|
|
21
|
+
: (React.createElement(React.Fragment, null,
|
|
22
|
+
(props.dataItem.icon || props.dataItem.iconClass) && (React.createElement("span", { className: kendo_react_common_1.classNames('k-icon', (_a = {},
|
|
23
|
+
_a["k-i-" + props.dataItem.icon] = props.dataItem.icon,
|
|
24
|
+
_a["" + props.dataItem.iconClass] = props.dataItem.iconClass,
|
|
25
|
+
_a)) })),
|
|
26
|
+
(props.dataItem.imageUrl) && (React.createElement("img", { role: "presentation", alt: "", src: props.dataItem.imageUrl, className: 'k-icon' })),
|
|
27
|
+
(text) && (React.createElement("span", { className: "k-menu-link-text" }, text))))))));
|
|
28
|
+
return ((props.item !== undefined && /* to be removed in 5.0.0 */
|
|
29
|
+
props.render !== undefined) ? props.render.call(undefined, item, props) : item);
|
|
30
|
+
};
|
|
31
|
+
ButtonItem.displayName = 'KendoReactButtonItem';
|
|
52
32
|
exports.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;
|
|
@@ -113,11 +113,11 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
113
113
|
}
|
|
114
114
|
_this.setState(newState);
|
|
115
115
|
};
|
|
116
|
-
_this.
|
|
116
|
+
_this.handleFocus = function (event) {
|
|
117
117
|
_this.setState({ focused: true, focusedIndex: _this.opened ? 0 : -1 });
|
|
118
118
|
kendo_react_common_2.dispatchEvent(_this.props.onFocus, event, _this, undefined);
|
|
119
119
|
};
|
|
120
|
-
_this.
|
|
120
|
+
_this.handleBlur = function (event) {
|
|
121
121
|
_this.setState({ focused: false, opened: false, focusedIndex: -1 });
|
|
122
122
|
kendo_react_common_2.dispatchEvent(_this.props.onBlur, event, _this, undefined);
|
|
123
123
|
var fireCloseEvent = _this.opened;
|
|
@@ -176,10 +176,10 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
176
176
|
React.Children.toArray(this.props.children)
|
|
177
177
|
.filter(function (child) { return child && child.type === DropDownButtonItem_1.default; })
|
|
178
178
|
.map(function (child) { return child.props; });
|
|
179
|
-
return (React.createElement("div", { className: kendo_react_common_1.classNames('k-
|
|
180
|
-
'k-
|
|
181
|
-
}), onKeyDown: this.onKeyDown, onFocus: this.
|
|
182
|
-
React.createElement(main_1.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,
|
|
179
|
+
return (React.createElement("div", { className: kendo_react_common_1.classNames('k-dropdown-button', {
|
|
180
|
+
'k-focus': this.state.focused
|
|
181
|
+
}, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
182
|
+
React.createElement(main_1.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),
|
|
183
183
|
this.renderPopup(rtl)));
|
|
184
184
|
};
|
|
185
185
|
/**
|
|
@@ -219,15 +219,18 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
221
|
DropDownButton.prototype.renderPopup = function (rtl) {
|
|
222
|
-
var _a
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
var _a;
|
|
223
|
+
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
224
|
+
return (React.createElement(kendo_react_popup_1.Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: kendo_react_common_1.classNames('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || popup_1.getAnchorAlign(rtl), popupAlign: popupSettings.popupAlign || popup_1.getPopupAlign(rtl), style: rtl ? { direction: 'rtl' } : undefined },
|
|
225
|
+
React.createElement("ul", { role: "menu", id: this.guid, className: kendo_react_common_1.classNames('k-group k-menu-group k-reset', (_a = {},
|
|
226
|
+
_a["k-menu-group-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
227
|
+
_a)) }, this.renderChildItems())));
|
|
225
228
|
};
|
|
226
229
|
DropDownButton.prototype.renderChildItems = function () {
|
|
227
230
|
var _this = this;
|
|
228
231
|
var _a = this.props, item = _a.item, itemRender = _a.itemRender, textField = _a.textField;
|
|
229
232
|
return this.buttonsData.length > 0 ? (this.buttonsData.map(function (dataItem, index) {
|
|
230
|
-
return (React.createElement(ButtonItem_1.default, { 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 }));
|
|
233
|
+
return (React.createElement(ButtonItem_1.default, { 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 }));
|
|
231
234
|
})) : null;
|
|
232
235
|
};
|
|
233
236
|
DropDownButton.prototype.isItemDisabled = function (index) {
|
|
@@ -242,7 +245,6 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
242
245
|
*/
|
|
243
246
|
DropDownButton.propTypes = {
|
|
244
247
|
accessKey: PropTypes.string,
|
|
245
|
-
primary: PropTypes.bool,
|
|
246
248
|
onFocus: PropTypes.func,
|
|
247
249
|
onBlur: PropTypes.func,
|
|
248
250
|
onItemClick: PropTypes.func,
|
|
@@ -258,7 +260,6 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
258
260
|
popupSettings: PropTypes.object,
|
|
259
261
|
itemRender: PropTypes.func,
|
|
260
262
|
item: PropTypes.func,
|
|
261
|
-
look: PropTypes.string,
|
|
262
263
|
className: PropTypes.string,
|
|
263
264
|
buttonClass: PropTypes.string,
|
|
264
265
|
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>;
|