@progress/kendo-react-buttons 6.1.1 → 7.0.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/es/Button.d.ts → Button.d.ts} +5 -1
- package/{dist/npm/ButtonGroup.d.ts → ButtonGroup.d.ts} +5 -1
- package/{dist/es/ButtonGroupInterface.d.ts → ButtonGroupInterface.d.ts} +4 -1
- package/{dist/npm/ButtonInterface.d.ts → ButtonInterface.d.ts} +4 -0
- package/{dist/npm/Chip → Chip}/Chip.d.ts +4 -0
- package/{dist/npm/Chip → Chip}/ChipList.d.ts +4 -12
- package/Chip/chip-list-contexts.d.ts +17 -0
- package/{dist/npm/Chip → Chip}/data-reducer.d.ts +5 -1
- package/{dist/es/Chip → Chip}/focus-reducer.d.ts +5 -2
- package/{dist/npm/Chip → Chip}/selection-reducer.d.ts +5 -1
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/FloatingActionButton.d.ts +4 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/FloatingActionButtonItem.d.ts +4 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +17 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonPopupSettings.d.ts +4 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonProps.d.ts +5 -2
- package/{dist/es/FloatingActionButton → FloatingActionButton}/models/align-offset.d.ts +4 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/align.d.ts +4 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/models/events.d.ts +5 -1
- package/FloatingActionButton/models/position-mode.d.ts +13 -0
- package/FloatingActionButton/models/rounded.d.ts +16 -0
- package/FloatingActionButton/models/size.d.ts +15 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/theme-color.d.ts +5 -1
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/utils.d.ts +4 -0
- package/LICENSE.md +1 -1
- package/{dist/es/ListButton → ListButton}/ButtonItem.d.ts +4 -0
- package/{dist/es/ListButton → ListButton}/DropDownButton.d.ts +5 -1
- package/{dist/npm/ListButton → ListButton}/DropDownButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/SplitButton.d.ts +5 -1
- package/{dist/es/ListButton → ListButton}/SplitButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/ButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/ListButtonProps.d.ts +4 -1
- package/{dist/npm/ListButton → ListButton}/models/PopupSettings.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/events.d.ts +4 -0
- package/ListButton/utils/navigation.d.ts +9 -0
- package/ListButton/utils/popup.d.ts +13 -0
- package/dist/cdn/js/kendo-react-buttons.js +5 -1
- package/index.d.ts +36 -0
- package/index.js +5 -0
- package/index.mjs +1877 -0
- package/{dist/npm/models → models}/index.d.ts +4 -1
- package/package-metadata.d.ts +9 -0
- package/package.json +28 -42
- package/{dist/es/toolbar → toolbar}/Toolbar.d.ts +5 -1
- package/{dist/es/toolbar → toolbar}/tools/ToolbarItem.d.ts +5 -1
- package/toolbar/tools/ToolbarSeparator.d.ts +20 -0
- package/{dist/es/toolbar → toolbar}/tools/ToolbarSpacer.d.ts +4 -0
- package/{dist/npm/util.d.ts → util.d.ts} +4 -0
- package/about.md +0 -3
- package/dist/es/Button.js +0 -171
- package/dist/es/ButtonGroup.d.ts +0 -32
- package/dist/es/ButtonGroup.js +0 -101
- package/dist/es/ButtonGroupInterface.js +0 -2
- package/dist/es/ButtonInterface.d.ts +0 -35
- package/dist/es/ButtonInterface.js +0 -3
- package/dist/es/Chip/Chip.d.ts +0 -234
- package/dist/es/Chip/Chip.js +0 -173
- package/dist/es/Chip/ChipList.d.ts +0 -123
- package/dist/es/Chip/ChipList.js +0 -177
- package/dist/es/Chip/data-reducer.d.ts +0 -22
- package/dist/es/Chip/data-reducer.js +0 -26
- package/dist/es/Chip/focus-reducer.js +0 -32
- package/dist/es/Chip/selection-reducer.d.ts +0 -30
- package/dist/es/Chip/selection-reducer.js +0 -75
- package/dist/es/FloatingActionButton/FloatingActionButton.d.ts +0 -17
- package/dist/es/FloatingActionButton/FloatingActionButton.js +0 -281
- package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +0 -82
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -1
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -1
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +0 -216
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -1
- package/dist/es/FloatingActionButton/models/align-offset.js +0 -1
- package/dist/es/FloatingActionButton/models/align.d.ts +0 -27
- package/dist/es/FloatingActionButton/models/align.js +0 -1
- package/dist/es/FloatingActionButton/models/events.js +0 -1
- package/dist/es/FloatingActionButton/models/position-mode.d.ts +0 -9
- package/dist/es/FloatingActionButton/models/position-mode.js +0 -1
- package/dist/es/FloatingActionButton/models/rounded.d.ts +0 -12
- package/dist/es/FloatingActionButton/models/rounded.js +0 -1
- package/dist/es/FloatingActionButton/models/size.d.ts +0 -11
- package/dist/es/FloatingActionButton/models/size.js +0 -1
- package/dist/es/FloatingActionButton/models/theme-color.d.ts +0 -18
- package/dist/es/FloatingActionButton/models/theme-color.js +0 -1
- package/dist/es/FloatingActionButton/utils.d.ts +0 -27
- package/dist/es/FloatingActionButton/utils.js +0 -93
- package/dist/es/ListButton/ButtonItem.js +0 -24
- package/dist/es/ListButton/DropDownButton.js +0 -325
- package/dist/es/ListButton/DropDownButtonItem.d.ts +0 -30
- package/dist/es/ListButton/DropDownButtonItem.js +0 -43
- package/dist/es/ListButton/SplitButton.d.ts +0 -120
- package/dist/es/ListButton/SplitButton.js +0 -334
- package/dist/es/ListButton/SplitButtonItem.js +0 -42
- package/dist/es/ListButton/models/ButtonItem.d.ts +0 -34
- package/dist/es/ListButton/models/ButtonItem.js +0 -3
- package/dist/es/ListButton/models/ListButtonProps.d.ts +0 -336
- package/dist/es/ListButton/models/ListButtonProps.js +0 -2
- package/dist/es/ListButton/models/PopupSettings.d.ts +0 -24
- package/dist/es/ListButton/models/PopupSettings.js +0 -1
- package/dist/es/ListButton/models/events.d.ts +0 -47
- package/dist/es/ListButton/models/events.js +0 -1
- package/dist/es/ListButton/utils/navigation.d.ts +0 -5
- package/dist/es/ListButton/utils/navigation.js +0 -29
- package/dist/es/ListButton/utils/popup.d.ts +0 -9
- package/dist/es/ListButton/utils/popup.js +0 -20
- package/dist/es/main.d.ts +0 -32
- package/dist/es/main.js +0 -17
- package/dist/es/models/index.d.ts +0 -89
- package/dist/es/models/index.js +0 -1
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/toolbar/Toolbar.js +0 -214
- package/dist/es/toolbar/tools/ToolbarItem.js +0 -56
- package/dist/es/toolbar/tools/ToolbarSeparator.d.ts +0 -16
- package/dist/es/toolbar/tools/ToolbarSeparator.js +0 -31
- package/dist/es/toolbar/tools/ToolbarSpacer.js +0 -20
- package/dist/es/util.d.ts +0 -27
- package/dist/es/util.js +0 -37
- package/dist/npm/Button.d.ts +0 -138
- package/dist/npm/Button.js +0 -174
- package/dist/npm/ButtonGroup.js +0 -104
- package/dist/npm/ButtonGroupInterface.d.ts +0 -33
- package/dist/npm/ButtonGroupInterface.js +0 -3
- package/dist/npm/ButtonInterface.js +0 -4
- package/dist/npm/Chip/Chip.js +0 -176
- package/dist/npm/Chip/ChipList.js +0 -180
- package/dist/npm/Chip/data-reducer.js +0 -30
- package/dist/npm/Chip/focus-reducer.d.ts +0 -25
- package/dist/npm/Chip/focus-reducer.js +0 -36
- package/dist/npm/Chip/selection-reducer.js +0 -79
- package/dist/npm/FloatingActionButton/FloatingActionButton.js +0 -284
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.d.ts +0 -105
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +0 -85
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -2
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +0 -24
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -2
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -2
- package/dist/npm/FloatingActionButton/models/align-offset.d.ts +0 -20
- package/dist/npm/FloatingActionButton/models/align-offset.js +0 -2
- package/dist/npm/FloatingActionButton/models/align.js +0 -2
- package/dist/npm/FloatingActionButton/models/events.d.ts +0 -21
- package/dist/npm/FloatingActionButton/models/events.js +0 -2
- package/dist/npm/FloatingActionButton/models/position-mode.d.ts +0 -9
- package/dist/npm/FloatingActionButton/models/position-mode.js +0 -2
- package/dist/npm/FloatingActionButton/models/rounded.d.ts +0 -12
- package/dist/npm/FloatingActionButton/models/rounded.js +0 -2
- package/dist/npm/FloatingActionButton/models/size.d.ts +0 -11
- package/dist/npm/FloatingActionButton/models/size.js +0 -2
- package/dist/npm/FloatingActionButton/models/theme-color.js +0 -2
- package/dist/npm/FloatingActionButton/utils.js +0 -101
- package/dist/npm/ListButton/ButtonItem.d.ts +0 -30
- package/dist/npm/ListButton/ButtonItem.js +0 -28
- package/dist/npm/ListButton/DropDownButton.d.ts +0 -118
- package/dist/npm/ListButton/DropDownButton.js +0 -328
- package/dist/npm/ListButton/DropDownButtonItem.js +0 -46
- package/dist/npm/ListButton/SplitButton.js +0 -337
- package/dist/npm/ListButton/SplitButtonItem.d.ts +0 -25
- package/dist/npm/ListButton/SplitButtonItem.js +0 -45
- package/dist/npm/ListButton/models/ButtonItem.js +0 -4
- package/dist/npm/ListButton/models/ListButtonProps.js +0 -3
- package/dist/npm/ListButton/models/PopupSettings.js +0 -2
- package/dist/npm/ListButton/models/events.js +0 -2
- package/dist/npm/ListButton/utils/navigation.d.ts +0 -5
- package/dist/npm/ListButton/utils/navigation.js +0 -32
- package/dist/npm/ListButton/utils/popup.d.ts +0 -9
- package/dist/npm/ListButton/utils/popup.js +0 -25
- package/dist/npm/main.d.ts +0 -32
- package/dist/npm/main.js +0 -48
- package/dist/npm/models/index.js +0 -2
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/toolbar/Toolbar.d.ts +0 -171
- package/dist/npm/toolbar/Toolbar.js +0 -217
- package/dist/npm/toolbar/tools/ToolbarItem.d.ts +0 -38
- package/dist/npm/toolbar/tools/ToolbarItem.js +0 -59
- package/dist/npm/toolbar/tools/ToolbarSeparator.d.ts +0 -16
- package/dist/npm/toolbar/tools/ToolbarSeparator.js +0 -34
- package/dist/npm/toolbar/tools/ToolbarSpacer.d.ts +0 -23
- package/dist/npm/toolbar/tools/ToolbarSpacer.js +0 -23
- package/dist/npm/util.js +0 -40
- package/dist/systemjs/kendo-react-buttons.js +0 -1
- package/e2e-next/button.basic.tests.ts +0 -24
- package/e2e-next/buttongroup.basic.tests.ts +0 -24
- package/e2e-next/chip.basic.tests.ts +0 -24
- package/e2e-next/chiplist.basic.tests.ts +0 -24
- package/e2e-next/dropdownbutton.basic.tests.ts +0 -24
- package/e2e-next/floatingactionbutton.basic.tests.ts +0 -24
- package/e2e-next/splitbutton.basic.tests.ts +0 -24
- package/e2e-next/toolbar.basic.tests.ts +0 -24
package/dist/es/Chip/ChipList.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import * as PropTypes from 'prop-types';
|
|
14
|
-
import { useDir, getter, getTabIndex, classNames, useMouse, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
15
|
-
import { selectionReducer } from './selection-reducer';
|
|
16
|
-
import { focusReducer } from './focus-reducer';
|
|
17
|
-
import { dataReducer } from './data-reducer';
|
|
18
|
-
import { Chip } from './Chip';
|
|
19
|
-
import { validatePackage } from '@progress/kendo-react-common';
|
|
20
|
-
import { packageMetadata } from '../package-metadata';
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
export var ChipListSelectionContext = React.createContext([null, function (_args) {
|
|
25
|
-
/**/
|
|
26
|
-
}]);
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export var ChipListFocusContext = React.createContext([null, function (_args) {
|
|
31
|
-
/**/
|
|
32
|
-
}]);
|
|
33
|
-
/**
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
36
|
-
export var ChipListDataContext = React.createContext([null, function (_args) {
|
|
37
|
-
/**/
|
|
38
|
-
}]);
|
|
39
|
-
/**
|
|
40
|
-
* @hidden
|
|
41
|
-
*/
|
|
42
|
-
var useSelection = function (defaultValue, args, callback) {
|
|
43
|
-
var _a = React.useState(defaultValue), state = _a[0], setState = _a[1];
|
|
44
|
-
var handleDispatchSelection = function (action) {
|
|
45
|
-
var newState = selectionReducer(args.state || state, __assign(__assign({}, action), args));
|
|
46
|
-
if (callback) {
|
|
47
|
-
callback(newState, action.event);
|
|
48
|
-
}
|
|
49
|
-
setState(newState);
|
|
50
|
-
};
|
|
51
|
-
return [state, handleDispatchSelection];
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* @hidden
|
|
55
|
-
*/
|
|
56
|
-
var useFocus = function (args) {
|
|
57
|
-
var _a = React.useState(null), state = _a[0], setState = _a[1];
|
|
58
|
-
var handleDispatchFocus = function (action) {
|
|
59
|
-
var newState = focusReducer(action.payload, __assign(__assign({}, action), args));
|
|
60
|
-
setState(newState);
|
|
61
|
-
};
|
|
62
|
-
return [state, handleDispatchFocus];
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* @hidden
|
|
66
|
-
*/
|
|
67
|
-
var useData = function (defaultData, args, callback) {
|
|
68
|
-
var _a = React.useState(defaultData), state = _a[0], setState = _a[1];
|
|
69
|
-
var handleDispatchData = function (action) {
|
|
70
|
-
var newState = dataReducer(args.state || state, __assign(__assign({}, action), args));
|
|
71
|
-
if (callback) {
|
|
72
|
-
callback(newState, action.event);
|
|
73
|
-
}
|
|
74
|
-
setState(newState);
|
|
75
|
-
};
|
|
76
|
-
return [state, handleDispatchData];
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Represents the ChipList component.
|
|
80
|
-
*/
|
|
81
|
-
export var ChipList = React.forwardRef(function (props, ref) {
|
|
82
|
-
var _a;
|
|
83
|
-
validatePackage(packageMetadata);
|
|
84
|
-
var target = React.useRef(null);
|
|
85
|
-
var chipListRef = React.useRef(null);
|
|
86
|
-
var dir = useDir(chipListRef, props.dir);
|
|
87
|
-
var chip = props.chip, id = props.id, style = props.style, tabIndex = props.tabIndex, disabled = props.disabled, size = props.size, className = props.className, ariaDescribedBy = props.ariaDescribedBy, ariaLabelledBy = props.ariaLabelledBy, _b = props.selection, selection = _b === void 0 ? defaultProps.selection : _b, _c = props.value, value = _c === void 0 ? defaultProps.defaultValue : _c, _d = props.defaultData, defaultData = _d === void 0 ? defaultProps.defaultData : _d, _e = props.valueField, valueField = _e === void 0 ? defaultProps.valueField : _e, _f = props.textField, textField = _f === void 0 ? defaultProps.textField : _f, onChange = props.onChange, onDataChange = props.onDataChange;
|
|
88
|
-
var ChipComponent = React.useMemo(function () { return chip || Chip; }, [chip, Chip]);
|
|
89
|
-
React.useImperativeHandle(target, function () { return ({
|
|
90
|
-
element: chipListRef.current,
|
|
91
|
-
props: props
|
|
92
|
-
}); });
|
|
93
|
-
React.useImperativeHandle(ref, function () { return target.current; });
|
|
94
|
-
var handleChange = React.useCallback(function (newValue, event) {
|
|
95
|
-
if (onChange && target.current) {
|
|
96
|
-
onChange.call(undefined, {
|
|
97
|
-
value: newValue,
|
|
98
|
-
target: target.current,
|
|
99
|
-
syntheticEvent: event
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}, [onChange]);
|
|
103
|
-
var _g = useSelection(value, {
|
|
104
|
-
selection: selection,
|
|
105
|
-
state: value
|
|
106
|
-
}, handleChange), stateValue = _g[0], dispatchStateValue = _g[1];
|
|
107
|
-
var handleDataChange = React.useCallback(function (newData, event) {
|
|
108
|
-
if (onDataChange && target.current) {
|
|
109
|
-
onDataChange.call(undefined, {
|
|
110
|
-
value: newData,
|
|
111
|
-
target: target.current,
|
|
112
|
-
syntheticEvent: event
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}, [onDataChange]);
|
|
116
|
-
var _h = useData(props.data || defaultData, {
|
|
117
|
-
state: props.data,
|
|
118
|
-
valueField: valueField
|
|
119
|
-
}, handleDataChange), stateData = _h[0], dispatchData = _h[1];
|
|
120
|
-
var itemsReducer = React.useCallback(function (acc, current) {
|
|
121
|
-
acc.push(current[valueField]);
|
|
122
|
-
return acc;
|
|
123
|
-
}, [valueField]);
|
|
124
|
-
var data = React.useMemo(function () { return props.data || stateData; }, [props.data, stateData]);
|
|
125
|
-
var chipValue = React.useMemo(function () { return value || stateValue; }, [value, stateValue]);
|
|
126
|
-
var items = React.useMemo(function () { return data.reduce(itemsReducer, []); }, [data, itemsReducer]);
|
|
127
|
-
var valueGetter = React.useCallback(function (item) { return getter(valueField)(item); }, [valueField]);
|
|
128
|
-
var textGetter = React.useCallback(function (item) { return getter(textField)(item); }, [textField]);
|
|
129
|
-
var _j = useFocus({ items: items }), focus = _j[0], dispatchFocus = _j[1];
|
|
130
|
-
var mouseProps = useMouse(props, target);
|
|
131
|
-
return (React.createElement(ChipListSelectionContext.Provider, { value: [chipValue, dispatchStateValue] },
|
|
132
|
-
React.createElement(ChipListFocusContext.Provider, { value: [focus, dispatchFocus] },
|
|
133
|
-
React.createElement(ChipListDataContext.Provider, { value: [data, dispatchData] },
|
|
134
|
-
React.createElement("div", __assign({ ref: chipListRef }, mouseProps, { role: 'listbox', id: id, dir: dir, style: style, tabIndex: getTabIndex(tabIndex, disabled, undefined), className: classNames('k-chip-list', (_a = {
|
|
135
|
-
'k-rtl': dir === 'rtl',
|
|
136
|
-
'k-disabled': disabled
|
|
137
|
-
},
|
|
138
|
-
_a["k-chip-list-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
139
|
-
_a), className), "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy }), data.map(function (item, index) {
|
|
140
|
-
return (React.createElement(ChipComponent, { role: 'option', dataItem: item, size: size, key: [valueGetter(item), index].join('-'), text: textGetter(item), value: valueGetter(item), ariaLabel: item.ariaLabel, svgIcon: item.svgIcon || undefined }));
|
|
141
|
-
}))))));
|
|
142
|
-
});
|
|
143
|
-
var propTypes = {
|
|
144
|
-
id: PropTypes.string,
|
|
145
|
-
className: PropTypes.string,
|
|
146
|
-
tabIndex: PropTypes.number,
|
|
147
|
-
data: PropTypes.any,
|
|
148
|
-
defaultData: PropTypes.arrayOf(PropTypes.any),
|
|
149
|
-
onDataChange: PropTypes.func,
|
|
150
|
-
value: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]),
|
|
151
|
-
defaultValue: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]),
|
|
152
|
-
onChange: PropTypes.func,
|
|
153
|
-
selection: PropTypes.oneOf(['single', 'none', 'multiple']),
|
|
154
|
-
textField: PropTypes.string,
|
|
155
|
-
valueField: PropTypes.string,
|
|
156
|
-
disabled: PropTypes.bool,
|
|
157
|
-
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
158
|
-
ariaLabelledBy: PropTypes.string,
|
|
159
|
-
ariaDescribedBy: PropTypes.string,
|
|
160
|
-
size: PropTypes.oneOf([null, 'small', 'medium', 'large'])
|
|
161
|
-
};
|
|
162
|
-
var defaultProps = {
|
|
163
|
-
chip: Chip,
|
|
164
|
-
size: 'medium',
|
|
165
|
-
disabled: false,
|
|
166
|
-
defaultValue: null,
|
|
167
|
-
defaultData: [],
|
|
168
|
-
dir: 'ltr',
|
|
169
|
-
selection: 'none',
|
|
170
|
-
textField: 'text',
|
|
171
|
-
valueField: 'value',
|
|
172
|
-
removable: 'removable'
|
|
173
|
-
};
|
|
174
|
-
ChipList.displayName = 'KendoReactChipList';
|
|
175
|
-
// TODO: delete casting when @types/react is updated!
|
|
176
|
-
ChipList.propTypes = propTypes;
|
|
177
|
-
ChipList.defaultProps = defaultProps;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare enum CHIP_DATA_ACTION {
|
|
6
|
-
remove = "remove",
|
|
7
|
-
add = "add",
|
|
8
|
-
reorder = "reorder"
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare type DataAction = {
|
|
14
|
-
type: CHIP_DATA_ACTION;
|
|
15
|
-
payload?: any;
|
|
16
|
-
valueField: string;
|
|
17
|
-
event?: React.SyntheticEvent<any>;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
export declare const dataReducer: (state: any, action: DataAction) => any;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hidden
|
|
3
|
-
*/
|
|
4
|
-
export var CHIP_DATA_ACTION;
|
|
5
|
-
(function (CHIP_DATA_ACTION) {
|
|
6
|
-
CHIP_DATA_ACTION["remove"] = "remove";
|
|
7
|
-
CHIP_DATA_ACTION["add"] = "add";
|
|
8
|
-
CHIP_DATA_ACTION["reorder"] = "reorder";
|
|
9
|
-
})(CHIP_DATA_ACTION || (CHIP_DATA_ACTION = {}));
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export var dataReducer = function (state, action) {
|
|
14
|
-
switch (action.type) {
|
|
15
|
-
case CHIP_DATA_ACTION.add:
|
|
16
|
-
// TODO v2
|
|
17
|
-
break;
|
|
18
|
-
case CHIP_DATA_ACTION.remove:
|
|
19
|
-
return state.filter(function (i) { return i[action.valueField] !== action.payload; });
|
|
20
|
-
case CHIP_DATA_ACTION.reorder:
|
|
21
|
-
// TODO v2
|
|
22
|
-
break;
|
|
23
|
-
default:
|
|
24
|
-
return state;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hidden
|
|
3
|
-
*/
|
|
4
|
-
export var FOCUS_ACTION;
|
|
5
|
-
(function (FOCUS_ACTION) {
|
|
6
|
-
FOCUS_ACTION["next"] = "next";
|
|
7
|
-
FOCUS_ACTION["prev"] = "prev";
|
|
8
|
-
FOCUS_ACTION["current"] = "current";
|
|
9
|
-
FOCUS_ACTION["reset"] = "reset";
|
|
10
|
-
})(FOCUS_ACTION || (FOCUS_ACTION = {}));
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export var focusReducer = function (state, action) {
|
|
15
|
-
var currentIndex = action.items.findIndex(function (i) { return i === state; });
|
|
16
|
-
switch (action.type) {
|
|
17
|
-
case FOCUS_ACTION.next:
|
|
18
|
-
return currentIndex === action.items.length - 1
|
|
19
|
-
? state
|
|
20
|
-
: action.items[currentIndex + 1];
|
|
21
|
-
case FOCUS_ACTION.prev:
|
|
22
|
-
return currentIndex === 0
|
|
23
|
-
? state
|
|
24
|
-
: action.items[currentIndex - 1];
|
|
25
|
-
case FOCUS_ACTION.current:
|
|
26
|
-
return action.payload;
|
|
27
|
-
case FOCUS_ACTION.reset:
|
|
28
|
-
return null;
|
|
29
|
-
default:
|
|
30
|
-
return state;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare enum SELECTION_TYPE {
|
|
6
|
-
single = "single",
|
|
7
|
-
multiple = "multiple",
|
|
8
|
-
none = "none"
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare enum SELECTION_ACTION {
|
|
14
|
-
toggle = "toggle",
|
|
15
|
-
remove = "remove"
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
export declare type SelectionAction = {
|
|
21
|
-
type?: SELECTION_ACTION;
|
|
22
|
-
selection: SELECTION_TYPE;
|
|
23
|
-
payload?: string;
|
|
24
|
-
event?: React.SyntheticEvent<any>;
|
|
25
|
-
state?: any;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export declare const selectionReducer: (state: any, action: SelectionAction) => any;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export var SELECTION_TYPE;
|
|
14
|
-
(function (SELECTION_TYPE) {
|
|
15
|
-
SELECTION_TYPE["single"] = "single";
|
|
16
|
-
SELECTION_TYPE["multiple"] = "multiple";
|
|
17
|
-
SELECTION_TYPE["none"] = "none";
|
|
18
|
-
})(SELECTION_TYPE || (SELECTION_TYPE = {}));
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
export var SELECTION_ACTION;
|
|
23
|
-
(function (SELECTION_ACTION) {
|
|
24
|
-
SELECTION_ACTION["toggle"] = "toggle";
|
|
25
|
-
SELECTION_ACTION["remove"] = "remove";
|
|
26
|
-
})(SELECTION_ACTION || (SELECTION_ACTION = {}));
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export var selectionReducer = function (state, action) {
|
|
31
|
-
switch (action.selection) {
|
|
32
|
-
case SELECTION_TYPE.single:
|
|
33
|
-
switch (action.type) {
|
|
34
|
-
case SELECTION_ACTION.toggle: {
|
|
35
|
-
if (!Array.isArray(state) || state === null) {
|
|
36
|
-
return action.payload === state ? null : action.payload;
|
|
37
|
-
}
|
|
38
|
-
throw new Error('State cannot be an array in single selection');
|
|
39
|
-
}
|
|
40
|
-
case SELECTION_ACTION.remove: {
|
|
41
|
-
return action.payload === state ? null : state;
|
|
42
|
-
}
|
|
43
|
-
default:
|
|
44
|
-
return state;
|
|
45
|
-
}
|
|
46
|
-
case SELECTION_TYPE.multiple:
|
|
47
|
-
switch (action.type) {
|
|
48
|
-
case SELECTION_ACTION.toggle: {
|
|
49
|
-
if (Array.isArray(state)) {
|
|
50
|
-
return state.some(function (i) { return i === action.payload; })
|
|
51
|
-
? state.filter(function (i) { return i !== action.payload; })
|
|
52
|
-
: __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
53
|
-
}
|
|
54
|
-
if (state === null) {
|
|
55
|
-
return [action.payload];
|
|
56
|
-
}
|
|
57
|
-
throw new Error('State cannot be non-array in multiple selection');
|
|
58
|
-
}
|
|
59
|
-
case SELECTION_ACTION.remove: {
|
|
60
|
-
if (Array.isArray(state)) {
|
|
61
|
-
return state.some(function (i) { return i === action.payload; })
|
|
62
|
-
? state.filter(function (i) { return i !== action.payload; })
|
|
63
|
-
: __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
64
|
-
}
|
|
65
|
-
return state;
|
|
66
|
-
}
|
|
67
|
-
default:
|
|
68
|
-
return state;
|
|
69
|
-
}
|
|
70
|
-
case SELECTION_TYPE.none:
|
|
71
|
-
return null;
|
|
72
|
-
default:
|
|
73
|
-
return state;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { FloatingActionButtonHandle } from './interfaces/FloatingActionButtonHandle';
|
|
3
|
-
import { FloatingActionButtonProps } from './interfaces/FloatingActionButtonProps';
|
|
4
|
-
/**
|
|
5
|
-
* Represents the [KendoReact FloatingActionButton component]({% slug overview_floatingactionbutton %}).
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```jsx
|
|
9
|
-
* const App = () => {
|
|
10
|
-
* return (
|
|
11
|
-
* <FloatingActionButton icon="plus" text="Create"/>
|
|
12
|
-
* );
|
|
13
|
-
* };
|
|
14
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare const FloatingActionButton: React.ForwardRefExoticComponent<FloatingActionButtonProps & React.RefAttributes<FloatingActionButtonHandle | null>>;
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import * as React from 'react';
|
|
24
|
-
import * as PropTypes from 'prop-types';
|
|
25
|
-
import { getActiveElement, IconWrap, kendoThemeMaps, svgIconPropType, useZIndexContext, validatePackage, ZIndexContext } from '@progress/kendo-react-common';
|
|
26
|
-
import { classNames, guid, useDir, dispatchEvent, Keys, getTabIndex } from '@progress/kendo-react-common';
|
|
27
|
-
import { FloatingActionButtonItem } from './FloatingActionButtonItem';
|
|
28
|
-
import { packageMetadata } from '../package-metadata';
|
|
29
|
-
import { position, getAnchorAlign, getPopupAlign, getTextDirectionClass } from './utils';
|
|
30
|
-
import { Popup } from '@progress/kendo-react-popup';
|
|
31
|
-
/** @hidden */
|
|
32
|
-
var ZINDEX_FAB_STEP = 2;
|
|
33
|
-
/** @hidden */
|
|
34
|
-
var DEFAULT_FAB_ZINDEX = 100;
|
|
35
|
-
/**
|
|
36
|
-
* Represents the [KendoReact FloatingActionButton component]({% slug overview_floatingactionbutton %}).
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```jsx
|
|
40
|
-
* const App = () => {
|
|
41
|
-
* return (
|
|
42
|
-
* <FloatingActionButton icon="plus" text="Create"/>
|
|
43
|
-
* );
|
|
44
|
-
* };
|
|
45
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export var FloatingActionButton = React.forwardRef(function (props, ref) {
|
|
49
|
-
validatePackage(packageMetadata);
|
|
50
|
-
var _a = props.align, align = _a === void 0 ? defaultProps.align : _a, alignOffset = props.alignOffset, className = props.className, disabled = props.disabled, icon = props.icon, svgIcon = props.svgIcon, 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.size, size = _c === void 0 ? defaultProps.size : _c, style = props.style, _d = props.rounded, rounded = _d === void 0 ? defaultProps.rounded : _d, _e = props.themeColor, themeColor = _e === void 0 ? defaultProps.themeColor : _e, overlayStyle = props.overlayStyle, tabIndex = props.tabIndex, accessKey = props.accessKey, _f = props.popupSettings, popupSettings = _f === void 0 ? {} : _f, modal = props.modal, 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", "svgIcon", "iconClass", "id", "items", "item", "text", "positionMode", "size", "style", "rounded", "themeColor", "overlayStyle", "tabIndex", "accessKey", "popupSettings", "modal", "onClick", "onItemClick", "onFocus", "onBlur", "onKeyDown", "onOpen", "onClose"]);
|
|
51
|
-
var zIndexContext = useZIndexContext();
|
|
52
|
-
var currentZIndex = zIndexContext ? zIndexContext + ZINDEX_FAB_STEP : DEFAULT_FAB_ZINDEX;
|
|
53
|
-
var target = React.useRef(null);
|
|
54
|
-
var elementRef = React.useRef(null);
|
|
55
|
-
var listRef = React.useRef(null);
|
|
56
|
-
var popupRef = React.useRef(null);
|
|
57
|
-
var focusElement = React.useCallback(function () {
|
|
58
|
-
if (elementRef.current) {
|
|
59
|
-
elementRef.current.focus();
|
|
60
|
-
}
|
|
61
|
-
}, []);
|
|
62
|
-
var getImperativeHandle = React.useCallback(function () { return ({
|
|
63
|
-
element: elementRef.current,
|
|
64
|
-
focus: focusElement
|
|
65
|
-
}); }, [focusElement]);
|
|
66
|
-
React.useImperativeHandle(target, getImperativeHandle);
|
|
67
|
-
React.useImperativeHandle(ref, function () { return target.current; });
|
|
68
|
-
var _g = React.useState(false), open = _g[0], setOpen = _g[1];
|
|
69
|
-
var _h = React.useState(false), focused = _h[0], setFocused = _h[1];
|
|
70
|
-
var _j = React.useState(-1), focusedIndex = _j[0], setFocusedIndex = _j[1];
|
|
71
|
-
var buttonId = React.useMemo(function () { return guid(); }, []);
|
|
72
|
-
var dir = useDir(elementRef, props.dir);
|
|
73
|
-
var isRtl = dir === 'rtl';
|
|
74
|
-
var listId = React.useMemo(function () { return guid(); }, []);
|
|
75
|
-
React.useEffect(function () {
|
|
76
|
-
position(elementRef, align, alignOffset, isRtl);
|
|
77
|
-
}, [elementRef, align, alignOffset, isRtl]);
|
|
78
|
-
React.useEffect(function () {
|
|
79
|
-
if (focused && elementRef && elementRef.current) {
|
|
80
|
-
// firefox in mac does not focus on mouse-down, next line fixes this
|
|
81
|
-
elementRef.current.focus();
|
|
82
|
-
}
|
|
83
|
-
}, [focused, elementRef]);
|
|
84
|
-
var dispatchPopupEvent = React.useCallback(function (dispatchedEvent, isOpen) {
|
|
85
|
-
if (!items) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
dispatchEvent(isOpen ? onOpen : onClose, dispatchedEvent, getImperativeHandle(), undefined);
|
|
89
|
-
}, [onOpen, onClose, items]);
|
|
90
|
-
var handleClick = React.useCallback(function (event) {
|
|
91
|
-
if (!event.target || disabled) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (!items && onClick) {
|
|
95
|
-
dispatchEvent(onClick, event, getImperativeHandle(), undefined);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
setOpen(!open);
|
|
99
|
-
setFocused(true);
|
|
100
|
-
setFocusedIndex(!open ? 0 : -1);
|
|
101
|
-
dispatchPopupEvent(event, !open);
|
|
102
|
-
}
|
|
103
|
-
}, [setOpen, setFocused, setFocusedIndex, onClick, dispatchPopupEvent,
|
|
104
|
-
open, items, disabled]);
|
|
105
|
-
var handleFocus = React.useCallback(function (event) {
|
|
106
|
-
setFocused(true);
|
|
107
|
-
setFocusedIndex(open ? 0 : -1);
|
|
108
|
-
if (onFocus) {
|
|
109
|
-
dispatchEvent(onFocus, event, getImperativeHandle(), undefined);
|
|
110
|
-
}
|
|
111
|
-
}, [onFocus, setFocused, setFocusedIndex]);
|
|
112
|
-
var handleBlur = React.useCallback(function (event) {
|
|
113
|
-
setFocused(false);
|
|
114
|
-
setOpen(false);
|
|
115
|
-
setFocusedIndex(-1);
|
|
116
|
-
dispatchEvent(onBlur, event, getImperativeHandle(), undefined);
|
|
117
|
-
var fireCloseEvent = open;
|
|
118
|
-
if (fireCloseEvent) {
|
|
119
|
-
dispatchPopupEvent(event, false);
|
|
120
|
-
}
|
|
121
|
-
}, [onBlur, setFocused, setOpen, setFocusedIndex, dispatchPopupEvent]);
|
|
122
|
-
var handleMouseDown = React.useCallback(function (event) {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
}, []);
|
|
125
|
-
var dispatchItemClickEvent = React.useCallback(function (dispatchedEvent, index) {
|
|
126
|
-
if (!items) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (!items[index].disabled) {
|
|
130
|
-
dispatchEvent(onItemClick, dispatchedEvent, getImperativeHandle(), {
|
|
131
|
-
itemProps: items[index],
|
|
132
|
-
itemIndex: index
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}, [onItemClick]);
|
|
136
|
-
var handleItemClick = React.useCallback(function (event, clickedItemIndex) {
|
|
137
|
-
if (!event.target || !items) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
setFocusedIndex(clickedItemIndex);
|
|
141
|
-
setOpen(false);
|
|
142
|
-
dispatchItemClickEvent(event, clickedItemIndex);
|
|
143
|
-
dispatchPopupEvent(event, false);
|
|
144
|
-
}, [setFocusedIndex, setOpen, dispatchItemClickEvent, dispatchPopupEvent]);
|
|
145
|
-
var handleItemDown = React.useCallback(function (event) {
|
|
146
|
-
var activeElement = getActiveElement(document);
|
|
147
|
-
if (activeElement === elementRef.current) {
|
|
148
|
-
event.preventDefault();
|
|
149
|
-
}
|
|
150
|
-
}, [elementRef]);
|
|
151
|
-
var handleKeyDown = React.useCallback(function (event) {
|
|
152
|
-
var currIndex = focusedIndex;
|
|
153
|
-
var maxNavIndex = items ? items.length - 1 : -1;
|
|
154
|
-
var isAtBottom = align.vertical === 'bottom';
|
|
155
|
-
switch (event.keyCode) {
|
|
156
|
-
case Keys.enter:
|
|
157
|
-
case Keys.space:
|
|
158
|
-
if (currIndex >= 0) {
|
|
159
|
-
dispatchItemClickEvent(event, currIndex);
|
|
160
|
-
}
|
|
161
|
-
event.preventDefault();
|
|
162
|
-
setOpen(!open);
|
|
163
|
-
setFocusedIndex(!open ? 0 : -1);
|
|
164
|
-
break;
|
|
165
|
-
case Keys.esc:
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
setOpen(false);
|
|
168
|
-
setFocusedIndex(-1);
|
|
169
|
-
break;
|
|
170
|
-
case Keys.home:
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
setFocusedIndex(0);
|
|
173
|
-
break;
|
|
174
|
-
case Keys.end:
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
setFocusedIndex(maxNavIndex);
|
|
177
|
-
break;
|
|
178
|
-
case Keys.down:
|
|
179
|
-
case Keys.right:
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
if (currIndex < maxNavIndex && !isAtBottom) {
|
|
182
|
-
setFocusedIndex(currIndex + 1);
|
|
183
|
-
}
|
|
184
|
-
if (currIndex > 0 && isAtBottom) {
|
|
185
|
-
setFocusedIndex(currIndex - 1);
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
case Keys.up:
|
|
189
|
-
case Keys.left:
|
|
190
|
-
event.preventDefault();
|
|
191
|
-
if (currIndex > 0 && !isAtBottom) {
|
|
192
|
-
setFocusedIndex(currIndex - 1);
|
|
193
|
-
}
|
|
194
|
-
if (currIndex < maxNavIndex && isAtBottom) {
|
|
195
|
-
setFocusedIndex(currIndex + 1);
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
default:
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
dispatchEvent(onKeyDown, event, getImperativeHandle(), undefined);
|
|
202
|
-
}, [onKeyDown, focusedIndex, setFocusedIndex, isRtl, setOpen]);
|
|
203
|
-
var buttonClassNames = React.useMemo(function () {
|
|
204
|
-
var _a;
|
|
205
|
-
return classNames('k-fab k-fab-solid', (_a = {
|
|
206
|
-
'k-fab-sm': size === 'small',
|
|
207
|
-
'k-fab-md': size === 'medium',
|
|
208
|
-
'k-fab-lg': size === 'large',
|
|
209
|
-
'k-disabled': disabled,
|
|
210
|
-
'k-pos-absolute': positionMode === 'absolute',
|
|
211
|
-
'k-pos-fixed': positionMode === 'fixed',
|
|
212
|
-
'k-focus': focused
|
|
213
|
-
},
|
|
214
|
-
_a["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
215
|
-
_a["k-fab-solid-".concat(themeColor)] = themeColor,
|
|
216
|
-
_a), "k-".concat(align.vertical, "-").concat(align.horizontal), className);
|
|
217
|
-
}, [themeColor, size, rounded, disabled, positionMode, align, focused, className]);
|
|
218
|
-
var fabItems = (items && (items.map(function (element, index) {
|
|
219
|
-
return (React.createElement(FloatingActionButtonItem, __assign({}, element, { key: index, index: index, id: "".concat(listId, "-").concat(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 })));
|
|
220
|
-
})));
|
|
221
|
-
var isIconFab = Boolean((icon || svgIcon) && !text);
|
|
222
|
-
var fabWidth = elementRef.current ? elementRef.current.offsetWidth : 0;
|
|
223
|
-
var iconWidth = 32;
|
|
224
|
-
var spacing = (fabWidth / 2) - (iconWidth / 2);
|
|
225
|
-
return (React.createElement(ZIndexContext.Provider, { value: currentZIndex },
|
|
226
|
-
React.createElement(React.Fragment, null,
|
|
227
|
-
React.createElement("button", __assign({ ref: elementRef, id: id || buttonId, role: items ? 'menubutton' : 'button', type: 'button', "aria-disabled": disabled, "aria-expanded": items ? open : undefined, "aria-haspopup": items ? true : false, "aria-label": "".concat(text || '', " floatingactionbutton"), "aria-owns": items ? listId : undefined, "aria-activedescendant": focusedIndex >= 0 && items ? "".concat(listId, "-").concat(focusedIndex) : undefined, tabIndex: getTabIndex(tabIndex, disabled), accessKey: accessKey, dir: dir, disabled: disabled, className: buttonClassNames, style: style, onClick: handleClick, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown }, others),
|
|
228
|
-
(icon || svgIcon) ?
|
|
229
|
-
React.createElement(IconWrap, { className: "k-fab-icon", name: icon, icon: svgIcon }) :
|
|
230
|
-
iconClass ?
|
|
231
|
-
React.createElement("span", { role: "presentation", className: iconClass }) : null,
|
|
232
|
-
text && React.createElement("span", { className: "k-fab-text" }, text)),
|
|
233
|
-
modal && open && (React.createElement("div", { className: "k-overlay", style: __assign({ zIndex: currentZIndex }, overlayStyle) })),
|
|
234
|
-
React.createElement(Popup, { ref: popupRef, anchor: elementRef.current, show: open, animate: popupSettings.animate, popupClass: classNames('k-popup-transparent k-fab-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || getAnchorAlign(align, isRtl), popupAlign: popupSettings.popupAlign || getPopupAlign(align, isRtl), style: { boxShadow: 'none' } },
|
|
235
|
-
React.createElement("ul", { ref: listRef, role: 'menu', "aria-labelledby": id, id: listId, className: classNames('k-fab-items', {
|
|
236
|
-
'k-fab-items-bottom': align.vertical !== 'bottom',
|
|
237
|
-
'k-fab-items-top': align.vertical === 'bottom'
|
|
238
|
-
}), style: {
|
|
239
|
-
paddingLeft: isIconFab ? spacing : undefined,
|
|
240
|
-
paddingRight: isIconFab ? spacing : undefined
|
|
241
|
-
} }, fabItems)))));
|
|
242
|
-
});
|
|
243
|
-
FloatingActionButton.propTypes = {
|
|
244
|
-
className: PropTypes.string,
|
|
245
|
-
style: PropTypes.object,
|
|
246
|
-
id: PropTypes.string,
|
|
247
|
-
dir: PropTypes.string,
|
|
248
|
-
tabIndex: PropTypes.number,
|
|
249
|
-
accessKey: PropTypes.string,
|
|
250
|
-
disabled: PropTypes.bool,
|
|
251
|
-
icon: PropTypes.string,
|
|
252
|
-
svgIcon: svgIconPropType,
|
|
253
|
-
iconClass: PropTypes.string,
|
|
254
|
-
text: PropTypes.string,
|
|
255
|
-
alignOffset: PropTypes.shape({
|
|
256
|
-
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
257
|
-
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
258
|
-
}),
|
|
259
|
-
align: PropTypes.shape({
|
|
260
|
-
vertical: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
261
|
-
horizontal: PropTypes.oneOf(['start', 'center', 'end'])
|
|
262
|
-
}),
|
|
263
|
-
positionMode: PropTypes.oneOf(['absolute', 'fixed']),
|
|
264
|
-
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
265
|
-
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
266
|
-
themeColor: PropTypes.oneOf([null,
|
|
267
|
-
'primary', 'secondary', 'tertiary',
|
|
268
|
-
'info', 'success', 'warning',
|
|
269
|
-
'error', 'dark', 'light', 'inverse'
|
|
270
|
-
]),
|
|
271
|
-
modal: PropTypes.bool,
|
|
272
|
-
overlayStyle: PropTypes.object
|
|
273
|
-
};
|
|
274
|
-
var defaultProps = {
|
|
275
|
-
align: { vertical: 'bottom', horizontal: 'end' },
|
|
276
|
-
size: 'medium',
|
|
277
|
-
rounded: 'full',
|
|
278
|
-
themeColor: 'primary',
|
|
279
|
-
positionMode: 'fixed'
|
|
280
|
-
};
|
|
281
|
-
FloatingActionButton.displayName = 'KendoFloatingActionButton';
|