@progress/kendo-react-buttons 6.1.1-dev.202311151536 → 7.0.0-develop.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.
Files changed (189) hide show
  1. package/{dist/es/Button.d.ts → Button.d.ts} +5 -1
  2. package/{dist/npm/ButtonGroup.d.ts → ButtonGroup.d.ts} +5 -1
  3. package/{dist/es/ButtonGroupInterface.d.ts → ButtonGroupInterface.d.ts} +4 -1
  4. package/{dist/npm/ButtonInterface.d.ts → ButtonInterface.d.ts} +4 -0
  5. package/{dist/npm/Chip → Chip}/Chip.d.ts +4 -0
  6. package/{dist/npm/Chip → Chip}/ChipList.d.ts +4 -12
  7. package/Chip/chip-list-contexts.d.ts +17 -0
  8. package/{dist/npm/Chip → Chip}/data-reducer.d.ts +5 -1
  9. package/{dist/es/Chip → Chip}/focus-reducer.d.ts +5 -2
  10. package/{dist/npm/Chip → Chip}/selection-reducer.d.ts +5 -1
  11. package/{dist/npm/FloatingActionButton → FloatingActionButton}/FloatingActionButton.d.ts +4 -0
  12. package/{dist/es/FloatingActionButton → FloatingActionButton}/FloatingActionButtonItem.d.ts +4 -0
  13. package/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +17 -0
  14. package/{dist/es/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonPopupSettings.d.ts +4 -0
  15. package/{dist/npm/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonProps.d.ts +5 -2
  16. package/{dist/es/FloatingActionButton → FloatingActionButton}/models/align-offset.d.ts +4 -0
  17. package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/align.d.ts +4 -0
  18. package/{dist/es/FloatingActionButton → FloatingActionButton}/models/events.d.ts +5 -1
  19. package/FloatingActionButton/models/position-mode.d.ts +13 -0
  20. package/FloatingActionButton/models/rounded.d.ts +16 -0
  21. package/FloatingActionButton/models/size.d.ts +15 -0
  22. package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/theme-color.d.ts +5 -1
  23. package/{dist/npm/FloatingActionButton → FloatingActionButton}/utils.d.ts +4 -0
  24. package/LICENSE.md +1 -1
  25. package/{dist/es/ListButton → ListButton}/ButtonItem.d.ts +4 -0
  26. package/{dist/es/ListButton → ListButton}/DropDownButton.d.ts +5 -1
  27. package/{dist/npm/ListButton → ListButton}/DropDownButtonItem.d.ts +4 -0
  28. package/{dist/npm/ListButton → ListButton}/SplitButton.d.ts +5 -1
  29. package/{dist/es/ListButton → ListButton}/SplitButtonItem.d.ts +4 -0
  30. package/{dist/npm/ListButton → ListButton}/models/ButtonItem.d.ts +4 -0
  31. package/{dist/npm/ListButton → ListButton}/models/ListButtonProps.d.ts +4 -1
  32. package/{dist/npm/ListButton → ListButton}/models/PopupSettings.d.ts +4 -0
  33. package/{dist/npm/ListButton → ListButton}/models/events.d.ts +4 -0
  34. package/ListButton/utils/navigation.d.ts +9 -0
  35. package/ListButton/utils/popup.d.ts +13 -0
  36. package/dist/cdn/js/kendo-react-buttons.js +5 -1
  37. package/index.d.ts +36 -0
  38. package/index.js +5 -0
  39. package/index.mjs +1877 -0
  40. package/{dist/npm/models → models}/index.d.ts +4 -1
  41. package/package-metadata.d.ts +9 -0
  42. package/package.json +28 -42
  43. package/{dist/es/toolbar → toolbar}/Toolbar.d.ts +5 -1
  44. package/{dist/es/toolbar → toolbar}/tools/ToolbarItem.d.ts +5 -1
  45. package/toolbar/tools/ToolbarSeparator.d.ts +20 -0
  46. package/{dist/es/toolbar → toolbar}/tools/ToolbarSpacer.d.ts +4 -0
  47. package/{dist/npm/util.d.ts → util.d.ts} +4 -0
  48. package/about.md +0 -3
  49. package/dist/es/Button.js +0 -171
  50. package/dist/es/ButtonGroup.d.ts +0 -32
  51. package/dist/es/ButtonGroup.js +0 -101
  52. package/dist/es/ButtonGroupInterface.js +0 -2
  53. package/dist/es/ButtonInterface.d.ts +0 -35
  54. package/dist/es/ButtonInterface.js +0 -3
  55. package/dist/es/Chip/Chip.d.ts +0 -234
  56. package/dist/es/Chip/Chip.js +0 -173
  57. package/dist/es/Chip/ChipList.d.ts +0 -123
  58. package/dist/es/Chip/ChipList.js +0 -177
  59. package/dist/es/Chip/data-reducer.d.ts +0 -22
  60. package/dist/es/Chip/data-reducer.js +0 -26
  61. package/dist/es/Chip/focus-reducer.js +0 -32
  62. package/dist/es/Chip/selection-reducer.d.ts +0 -30
  63. package/dist/es/Chip/selection-reducer.js +0 -75
  64. package/dist/es/FloatingActionButton/FloatingActionButton.d.ts +0 -17
  65. package/dist/es/FloatingActionButton/FloatingActionButton.js +0 -281
  66. package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +0 -82
  67. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
  68. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -1
  69. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -1
  70. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +0 -216
  71. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -1
  72. package/dist/es/FloatingActionButton/models/align-offset.js +0 -1
  73. package/dist/es/FloatingActionButton/models/align.d.ts +0 -27
  74. package/dist/es/FloatingActionButton/models/align.js +0 -1
  75. package/dist/es/FloatingActionButton/models/events.js +0 -1
  76. package/dist/es/FloatingActionButton/models/position-mode.d.ts +0 -9
  77. package/dist/es/FloatingActionButton/models/position-mode.js +0 -1
  78. package/dist/es/FloatingActionButton/models/rounded.d.ts +0 -12
  79. package/dist/es/FloatingActionButton/models/rounded.js +0 -1
  80. package/dist/es/FloatingActionButton/models/size.d.ts +0 -11
  81. package/dist/es/FloatingActionButton/models/size.js +0 -1
  82. package/dist/es/FloatingActionButton/models/theme-color.d.ts +0 -18
  83. package/dist/es/FloatingActionButton/models/theme-color.js +0 -1
  84. package/dist/es/FloatingActionButton/utils.d.ts +0 -27
  85. package/dist/es/FloatingActionButton/utils.js +0 -93
  86. package/dist/es/ListButton/ButtonItem.js +0 -24
  87. package/dist/es/ListButton/DropDownButton.js +0 -325
  88. package/dist/es/ListButton/DropDownButtonItem.d.ts +0 -30
  89. package/dist/es/ListButton/DropDownButtonItem.js +0 -43
  90. package/dist/es/ListButton/SplitButton.d.ts +0 -120
  91. package/dist/es/ListButton/SplitButton.js +0 -334
  92. package/dist/es/ListButton/SplitButtonItem.js +0 -42
  93. package/dist/es/ListButton/models/ButtonItem.d.ts +0 -34
  94. package/dist/es/ListButton/models/ButtonItem.js +0 -3
  95. package/dist/es/ListButton/models/ListButtonProps.d.ts +0 -336
  96. package/dist/es/ListButton/models/ListButtonProps.js +0 -2
  97. package/dist/es/ListButton/models/PopupSettings.d.ts +0 -24
  98. package/dist/es/ListButton/models/PopupSettings.js +0 -1
  99. package/dist/es/ListButton/models/events.d.ts +0 -47
  100. package/dist/es/ListButton/models/events.js +0 -1
  101. package/dist/es/ListButton/utils/navigation.d.ts +0 -5
  102. package/dist/es/ListButton/utils/navigation.js +0 -29
  103. package/dist/es/ListButton/utils/popup.d.ts +0 -9
  104. package/dist/es/ListButton/utils/popup.js +0 -20
  105. package/dist/es/main.d.ts +0 -32
  106. package/dist/es/main.js +0 -17
  107. package/dist/es/models/index.d.ts +0 -89
  108. package/dist/es/models/index.js +0 -1
  109. package/dist/es/package-metadata.d.ts +0 -5
  110. package/dist/es/package-metadata.js +0 -11
  111. package/dist/es/toolbar/Toolbar.js +0 -214
  112. package/dist/es/toolbar/tools/ToolbarItem.js +0 -56
  113. package/dist/es/toolbar/tools/ToolbarSeparator.d.ts +0 -16
  114. package/dist/es/toolbar/tools/ToolbarSeparator.js +0 -31
  115. package/dist/es/toolbar/tools/ToolbarSpacer.js +0 -20
  116. package/dist/es/util.d.ts +0 -27
  117. package/dist/es/util.js +0 -37
  118. package/dist/npm/Button.d.ts +0 -138
  119. package/dist/npm/Button.js +0 -174
  120. package/dist/npm/ButtonGroup.js +0 -104
  121. package/dist/npm/ButtonGroupInterface.d.ts +0 -33
  122. package/dist/npm/ButtonGroupInterface.js +0 -3
  123. package/dist/npm/ButtonInterface.js +0 -4
  124. package/dist/npm/Chip/Chip.js +0 -176
  125. package/dist/npm/Chip/ChipList.js +0 -180
  126. package/dist/npm/Chip/data-reducer.js +0 -30
  127. package/dist/npm/Chip/focus-reducer.d.ts +0 -25
  128. package/dist/npm/Chip/focus-reducer.js +0 -36
  129. package/dist/npm/Chip/selection-reducer.js +0 -79
  130. package/dist/npm/FloatingActionButton/FloatingActionButton.js +0 -284
  131. package/dist/npm/FloatingActionButton/FloatingActionButtonItem.d.ts +0 -105
  132. package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +0 -85
  133. package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
  134. package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -2
  135. package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +0 -24
  136. package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -2
  137. package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -2
  138. package/dist/npm/FloatingActionButton/models/align-offset.d.ts +0 -20
  139. package/dist/npm/FloatingActionButton/models/align-offset.js +0 -2
  140. package/dist/npm/FloatingActionButton/models/align.js +0 -2
  141. package/dist/npm/FloatingActionButton/models/events.d.ts +0 -21
  142. package/dist/npm/FloatingActionButton/models/events.js +0 -2
  143. package/dist/npm/FloatingActionButton/models/position-mode.d.ts +0 -9
  144. package/dist/npm/FloatingActionButton/models/position-mode.js +0 -2
  145. package/dist/npm/FloatingActionButton/models/rounded.d.ts +0 -12
  146. package/dist/npm/FloatingActionButton/models/rounded.js +0 -2
  147. package/dist/npm/FloatingActionButton/models/size.d.ts +0 -11
  148. package/dist/npm/FloatingActionButton/models/size.js +0 -2
  149. package/dist/npm/FloatingActionButton/models/theme-color.js +0 -2
  150. package/dist/npm/FloatingActionButton/utils.js +0 -101
  151. package/dist/npm/ListButton/ButtonItem.d.ts +0 -30
  152. package/dist/npm/ListButton/ButtonItem.js +0 -28
  153. package/dist/npm/ListButton/DropDownButton.d.ts +0 -118
  154. package/dist/npm/ListButton/DropDownButton.js +0 -328
  155. package/dist/npm/ListButton/DropDownButtonItem.js +0 -46
  156. package/dist/npm/ListButton/SplitButton.js +0 -337
  157. package/dist/npm/ListButton/SplitButtonItem.d.ts +0 -25
  158. package/dist/npm/ListButton/SplitButtonItem.js +0 -45
  159. package/dist/npm/ListButton/models/ButtonItem.js +0 -4
  160. package/dist/npm/ListButton/models/ListButtonProps.js +0 -3
  161. package/dist/npm/ListButton/models/PopupSettings.js +0 -2
  162. package/dist/npm/ListButton/models/events.js +0 -2
  163. package/dist/npm/ListButton/utils/navigation.d.ts +0 -5
  164. package/dist/npm/ListButton/utils/navigation.js +0 -32
  165. package/dist/npm/ListButton/utils/popup.d.ts +0 -9
  166. package/dist/npm/ListButton/utils/popup.js +0 -25
  167. package/dist/npm/main.d.ts +0 -32
  168. package/dist/npm/main.js +0 -48
  169. package/dist/npm/models/index.js +0 -2
  170. package/dist/npm/package-metadata.d.ts +0 -5
  171. package/dist/npm/package-metadata.js +0 -14
  172. package/dist/npm/toolbar/Toolbar.d.ts +0 -171
  173. package/dist/npm/toolbar/Toolbar.js +0 -217
  174. package/dist/npm/toolbar/tools/ToolbarItem.d.ts +0 -38
  175. package/dist/npm/toolbar/tools/ToolbarItem.js +0 -59
  176. package/dist/npm/toolbar/tools/ToolbarSeparator.d.ts +0 -16
  177. package/dist/npm/toolbar/tools/ToolbarSeparator.js +0 -34
  178. package/dist/npm/toolbar/tools/ToolbarSpacer.d.ts +0 -23
  179. package/dist/npm/toolbar/tools/ToolbarSpacer.js +0 -23
  180. package/dist/npm/util.js +0 -40
  181. package/dist/systemjs/kendo-react-buttons.js +0 -1
  182. package/e2e-next/button.basic.tests.ts +0 -24
  183. package/e2e-next/buttongroup.basic.tests.ts +0 -24
  184. package/e2e-next/chip.basic.tests.ts +0 -24
  185. package/e2e-next/chiplist.basic.tests.ts +0 -24
  186. package/e2e-next/dropdownbutton.basic.tests.ts +0 -24
  187. package/e2e-next/floatingactionbutton.basic.tests.ts +0 -24
  188. package/e2e-next/splitbutton.basic.tests.ts +0 -24
  189. package/e2e-next/toolbar.basic.tests.ts +0 -24
@@ -1,325 +0,0 @@
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- import * as React from 'react';
28
- import * as PropTypes from 'prop-types';
29
- import { Button } from './../main';
30
- import { classNames, guid, Keys, kendoThemeMaps, svgIconPropType, getActiveElement } from '@progress/kendo-react-common';
31
- import { dispatchEvent } from '@progress/kendo-react-common';
32
- import { navigate as navigation } from './utils/navigation';
33
- import { DropDownButtonItem } from './DropDownButtonItem';
34
- import { ButtonItem } from './ButtonItem';
35
- import { Popup } from '@progress/kendo-react-popup';
36
- import { getAnchorAlign, getPopupAlign } from './utils/popup';
37
- import { validatePackage } from '@progress/kendo-react-common';
38
- import { packageMetadata } from '../package-metadata';
39
- /**
40
- * Represents the [KendoReact DropDownButton component]({% slug overview_dropdownbutton %}).
41
- *
42
- * @example
43
- * ```jsx
44
- * class App extends React.Component {
45
- * render() {
46
- * return (
47
- * <DropDownButton text="Act">
48
- * <DropDownButtonItem text="Item1" />
49
- * <DropDownButtonItem text="Item2" />
50
- * <DropDownButtonItem text="Item3" />
51
- * </DropDownButton>
52
- * );
53
- * }
54
- * }
55
- * ReactDOM.render(<App />, document.querySelector('my-app'));
56
- * ```
57
- */
58
- var DropDownButton = /** @class */ (function (_super) {
59
- __extends(DropDownButton, _super);
60
- function DropDownButton(props) {
61
- var _this = _super.call(this, props) || this;
62
- /**
63
- * @hidden
64
- */
65
- _this.state = {
66
- opened: false,
67
- focused: false,
68
- focusedIndex: -1
69
- };
70
- _this.wrapper = null;
71
- _this.mainButton = null;
72
- _this.list = null;
73
- _this.skipFocus = false;
74
- _this.guid = guid();
75
- _this.buttonsData = [];
76
- _this.onKeyDown = function (event) {
77
- var focusedIndex = _this.state.focusedIndex;
78
- if (event.altKey) {
79
- if (!_this.opened && event.keyCode === Keys.down) {
80
- _this.setOpen(true);
81
- _this.dispatchPopupEvent(event, true);
82
- _this.setState({ focusedIndex: 0 });
83
- }
84
- else if (_this.opened && event.keyCode === Keys.up) {
85
- _this.setState({ focusedIndex: -1 });
86
- _this.setOpen(false);
87
- }
88
- return;
89
- }
90
- var newState = __assign({}, _this.state);
91
- if (event.keyCode === Keys.enter || event.keyCode === Keys.space) {
92
- if (focusedIndex >= 0) {
93
- _this.dispatchClickEvent(event, focusedIndex);
94
- }
95
- // Prevent default because otherwise when an item is selected
96
- // click on the default button gets emitted which opens the popup again.
97
- event.preventDefault();
98
- var notOpened = !_this.opened;
99
- _this.setOpen(notOpened);
100
- if (notOpened) {
101
- _this.dispatchPopupEvent(event, true);
102
- _this.setState({ focusedIndex: _this.opened ? -1 : 0 });
103
- }
104
- return;
105
- }
106
- else if (_this.opened && event.keyCode === Keys.esc) {
107
- _this.setState({ focusedIndex: -1 });
108
- _this.setOpen(false);
109
- return;
110
- }
111
- if (_this.opened) {
112
- var newFocused = navigation(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
113
- newState.focusedIndex = newFocused;
114
- var arrowKey = event.keyCode === Keys.up || event.keyCode === Keys.down ||
115
- event.keyCode === Keys.left || event.keyCode === Keys.right;
116
- if (!event.altKey && (arrowKey || event.keyCode === Keys.home || event.keyCode === Keys.end)) {
117
- // Needed to notify the parent listeners that event is handled.
118
- event.preventDefault();
119
- }
120
- }
121
- _this.setState(newState);
122
- };
123
- _this.switchFocus = function (focusFn) {
124
- _this.skipFocus = true;
125
- focusFn();
126
- window.setTimeout(function () { return _this.skipFocus = false; }, 0);
127
- };
128
- _this.handleFocus = function (event) {
129
- if (_this.skipFocus) {
130
- return;
131
- }
132
- _this.setState({ focused: true, focusedIndex: _this.opened ? 0 : -1 });
133
- dispatchEvent(_this.props.onFocus, event, _this, undefined);
134
- };
135
- _this.handleBlur = function (event) {
136
- if (_this.skipFocus) {
137
- return;
138
- }
139
- _this.setState({ focused: false, focusedIndex: -1 });
140
- _this.setOpen(false);
141
- dispatchEvent(_this.props.onBlur, event, _this, undefined);
142
- };
143
- _this.setOpen = function (value) {
144
- _this.openedDuringOnChange = value;
145
- _this.setState({ opened: value });
146
- };
147
- _this.onItemClick = function (event, clickedItemIndex) {
148
- _this.setState({ focusedIndex: -1 });
149
- _this.setOpen(false);
150
- _this.dispatchClickEvent(event, clickedItemIndex);
151
- };
152
- _this.onItemDown = function (event) {
153
- var activeElement = getActiveElement(document);
154
- if (activeElement === _this.list) {
155
- event.preventDefault();
156
- }
157
- };
158
- _this.mouseDown = function (event) {
159
- event.preventDefault();
160
- var activeElement = getActiveElement(document);
161
- if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
162
- _this.element.focus();
163
- }
164
- };
165
- _this.onPopupClose = function () {
166
- if (_this.state.focused) {
167
- _this.switchFocus(function () {
168
- if (_this.element) {
169
- _this.element.removeAttribute('tabindex');
170
- _this.element.focus({ preventScroll: true });
171
- }
172
- });
173
- }
174
- _this.dispatchPopupEvent({}, false);
175
- };
176
- _this.listRef = function (list) {
177
- _this.list = list;
178
- if (list && _this.state.focused) {
179
- _this.switchFocus(function () {
180
- list.focus({ preventScroll: true });
181
- if (_this.element) {
182
- _this.element.tabIndex = -1;
183
- }
184
- });
185
- }
186
- };
187
- _this.onClickMainButton = function (event) {
188
- if (!_this.buttonsData.length) {
189
- return;
190
- }
191
- var toOpen = !_this.opened;
192
- _this.setState({
193
- focused: true,
194
- focusedIndex: toOpen ? 0 : -1
195
- });
196
- _this.setOpen(toOpen);
197
- if (toOpen) {
198
- _this.dispatchPopupEvent(event, toOpen);
199
- }
200
- };
201
- _this.dispatchPopupEvent = function (dispatchedEvent, open) {
202
- dispatchEvent(open ? _this.props.onOpen : _this.props.onClose, dispatchedEvent, _this, undefined);
203
- _this.openedDuringOnChange = undefined;
204
- };
205
- validatePackage(packageMetadata);
206
- return _this;
207
- }
208
- Object.defineProperty(DropDownButton.prototype, "opened", {
209
- get: function () {
210
- return this.openedDuringOnChange !== undefined
211
- ? this.openedDuringOnChange
212
- : this.props.opened === undefined
213
- ? this.state.opened
214
- : this.props.opened;
215
- },
216
- enumerable: false,
217
- configurable: true
218
- });
219
- /**
220
- * @hidden
221
- */
222
- DropDownButton.prototype.render = function () {
223
- var _this = this;
224
- var rtl = this.isRtl();
225
- var dir = rtl ? 'rtl' : undefined;
226
- var _a = this.props, id = _a.id, style = _a.style, tabIndex = _a.tabIndex, disabled = _a.disabled;
227
- this.buttonsData = this.props.items ||
228
- React.Children.toArray(this.props.children)
229
- .filter(function (child) { return child && child.type === DropDownButtonItem; })
230
- .map(function (child) { return child.props; });
231
- return (React.createElement("div", { id: id, style: style, className: classNames('k-dropdown-button', {
232
- 'k-focus': this.state.focused
233
- }, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
234
- React.createElement(Button, { size: this.props.size, 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, svgIcon: this.props.svgIcon, 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-haspopup": true, "aria-expanded": this.opened || undefined, "aria-label": this.props.ariaLabel, "aria-controls": this.opened ? this.guid : undefined, id: 'button-' + this.guid, title: this.props.title }, this.props.text),
235
- this.renderPopup(rtl)));
236
- };
237
- /**
238
- * @hidden
239
- */
240
- DropDownButton.prototype.componentDidMount = function () {
241
- // If this.props.opened is true during the initial render, the popup is not aligned.
242
- if ((this.props.dir === undefined && this.isRtl()) || this.opened) {
243
- this.forceUpdate();
244
- }
245
- };
246
- Object.defineProperty(DropDownButton.prototype, "element", {
247
- /**
248
- * The DOM element of main button.
249
- */
250
- get: function () {
251
- return this.mainButton;
252
- },
253
- enumerable: false,
254
- configurable: true
255
- });
256
- DropDownButton.prototype.dispatchClickEvent = function (dispatchedEvent, index) {
257
- if (!this.isItemDisabled(index)) {
258
- dispatchEvent(this.props.onItemClick, dispatchedEvent, this, {
259
- item: this.buttonsData[index],
260
- itemIndex: index
261
- });
262
- }
263
- };
264
- DropDownButton.prototype.renderPopup = function (rtl) {
265
- var _a;
266
- var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
267
- var focusedIndex = this.state.focusedIndex;
268
- 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, onClose: this.onPopupClose },
269
- React.createElement("ul", { role: "menu", id: this.guid, "aria-labelledby": 'button-' + this.guid, tabIndex: -1, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, ref: this.listRef, className: classNames('k-group k-menu-group k-reset', (_a = {},
270
- _a["k-menu-group-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
271
- _a)) }, this.renderChildItems())));
272
- };
273
- DropDownButton.prototype.renderChildItems = function () {
274
- var _this = this;
275
- var _a = this.props, item = _a.item, itemRender = _a.itemRender, textField = _a.textField;
276
- return this.buttonsData.length > 0 ? (this.buttonsData.map(function (dataItem, index) {
277
- 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: "".concat(_this.guid, "-").concat(index) }));
278
- })) : null;
279
- };
280
- DropDownButton.prototype.isItemDisabled = function (index) {
281
- return this.buttonsData[index] ? this.buttonsData[index].disabled : this.props.disabled;
282
- };
283
- DropDownButton.prototype.isRtl = function () {
284
- return this.props.dir !== undefined ? this.props.dir === 'rtl' :
285
- !!this.wrapper && getComputedStyle(this.wrapper).direction === 'rtl';
286
- };
287
- /**
288
- * @hidden
289
- */
290
- DropDownButton.propTypes = {
291
- accessKey: PropTypes.string,
292
- ariaLabel: PropTypes.string,
293
- title: PropTypes.string,
294
- onFocus: PropTypes.func,
295
- onBlur: PropTypes.func,
296
- onItemClick: PropTypes.func,
297
- onOpen: PropTypes.func,
298
- onClose: PropTypes.func,
299
- items: PropTypes.arrayOf(PropTypes.any),
300
- textField: PropTypes.string,
301
- tabIndex: PropTypes.number,
302
- disabled: PropTypes.bool,
303
- icon: PropTypes.string,
304
- svgIcon: svgIconPropType,
305
- iconClass: PropTypes.string,
306
- imageUrl: PropTypes.string,
307
- popupSettings: PropTypes.object,
308
- itemRender: PropTypes.func,
309
- item: PropTypes.func,
310
- className: PropTypes.string,
311
- buttonClass: PropTypes.string,
312
- dir: PropTypes.string
313
- };
314
- /**
315
- * @hidden
316
- */
317
- DropDownButton.defaultProps = {
318
- size: 'medium',
319
- rounded: 'medium',
320
- fillMode: 'solid',
321
- themeColor: 'base'
322
- };
323
- return DropDownButton;
324
- }(React.Component));
325
- export { DropDownButton };
@@ -1,30 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { ButtonItem } from './models/ButtonItem';
4
- /**
5
- * The properties of the KendoReact DropDownButtonItem component.
6
- */
7
- export interface DropDownButtonItemProps extends ButtonItem {
8
- /**
9
- * Determines the selected state of the ButtonItem component.
10
- */
11
- selected?: boolean;
12
- }
13
- export declare class DropDownButtonItem extends React.Component<DropDownButtonItemProps, {}> {
14
- /**
15
- * @hidden
16
- */
17
- static propTypes: {
18
- text: PropTypes.Requireable<string>;
19
- icon: PropTypes.Requireable<string>;
20
- iconClass: PropTypes.Requireable<string>;
21
- imageUrl: PropTypes.Requireable<string>;
22
- selected: PropTypes.Requireable<boolean>;
23
- disabled: PropTypes.Requireable<boolean>;
24
- render: PropTypes.Requireable<any>;
25
- };
26
- /**
27
- * @hidden
28
- */
29
- render(): null;
30
- }
@@ -1,43 +0,0 @@
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import * as PropTypes from 'prop-types';
18
- var DropDownButtonItem = /** @class */ (function (_super) {
19
- __extends(DropDownButtonItem, _super);
20
- function DropDownButtonItem() {
21
- return _super !== null && _super.apply(this, arguments) || this;
22
- }
23
- /**
24
- * @hidden
25
- */
26
- DropDownButtonItem.prototype.render = function () {
27
- return null;
28
- };
29
- /**
30
- * @hidden
31
- */
32
- DropDownButtonItem.propTypes = {
33
- text: PropTypes.string,
34
- icon: PropTypes.string,
35
- iconClass: PropTypes.string,
36
- imageUrl: PropTypes.string,
37
- selected: PropTypes.bool,
38
- disabled: PropTypes.bool,
39
- render: PropTypes.any
40
- };
41
- return DropDownButtonItem;
42
- }(React.Component));
43
- export { DropDownButtonItem };
@@ -1,120 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { SplitButtonProps } from './models/ListButtonProps';
4
- /**
5
- * @hidden
6
- */
7
- export interface SplitButtonState {
8
- focusedIndex?: number;
9
- focused?: boolean;
10
- opened?: boolean;
11
- }
12
- /**
13
- * Represents the [KendoReact SplitButton component]({% slug overview_splitbutton %}).
14
- *
15
- * @example
16
- * ```jsx
17
- * class App extends React.Component {
18
- * render() {
19
- * return (
20
- * <SplitButton text="Act">
21
- * <SplitButtonItem text="Item1" />
22
- * <SplitButtonItem text="Item2" />
23
- * <SplitButtonItem text="Item3" />
24
- * </SplitButton>
25
- * );
26
- * }
27
- * }
28
- * ReactDOM.render(<App />, document.querySelector('my-app'));
29
- * ```
30
- */
31
- export declare class SplitButton extends React.Component<SplitButtonProps, SplitButtonState> {
32
- /**
33
- * @hidden
34
- */
35
- static propTypes: {
36
- accessKey: PropTypes.Requireable<string>;
37
- ariaLabel: PropTypes.Requireable<string>;
38
- title: PropTypes.Requireable<string>;
39
- onButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
40
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
41
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
42
- onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
43
- onOpen: PropTypes.Requireable<(...args: any[]) => any>;
44
- onClose: PropTypes.Requireable<(...args: any[]) => any>;
45
- text: PropTypes.Requireable<string>;
46
- items: PropTypes.Requireable<any[]>;
47
- textField: PropTypes.Requireable<string>;
48
- tabIndex: PropTypes.Requireable<number>;
49
- disabled: PropTypes.Requireable<boolean>;
50
- icon: PropTypes.Requireable<string>;
51
- svgIcon: PropTypes.Requireable<PropTypes.InferProps<{
52
- name: PropTypes.Validator<string>;
53
- content: PropTypes.Validator<string>;
54
- viewBox: PropTypes.Validator<string>;
55
- }>>;
56
- iconClass: PropTypes.Requireable<string>;
57
- imageUrl: PropTypes.Requireable<string>;
58
- popupSettings: PropTypes.Requireable<object>;
59
- itemRender: PropTypes.Requireable<any>;
60
- item: PropTypes.Requireable<(...args: any[]) => any>;
61
- className: PropTypes.Requireable<string>;
62
- buttonClass: PropTypes.Requireable<string>;
63
- dir: PropTypes.Requireable<string>;
64
- };
65
- /**
66
- * @hidden
67
- */
68
- static defaultProps: {
69
- size: string;
70
- rounded: string;
71
- fillMode: string;
72
- themeColor: string;
73
- };
74
- /**
75
- * @hidden
76
- */
77
- readonly state: {
78
- focused: boolean;
79
- focusedIndex: number;
80
- opened: boolean;
81
- };
82
- private wrapper;
83
- private mainButton;
84
- private list;
85
- private guid;
86
- private skipFocus;
87
- private buttonsData;
88
- private openedDuringOnChange?;
89
- constructor(props: SplitButtonProps);
90
- private get opened();
91
- /**
92
- * @hidden
93
- */
94
- render(): JSX.Element;
95
- /**
96
- * @hidden
97
- */
98
- componentDidMount(): void;
99
- /**
100
- * The DOM element of main button.
101
- */
102
- get element(): HTMLButtonElement | null;
103
- private onKeyDown;
104
- private switchFocus;
105
- private onFocus;
106
- private setOpen;
107
- private onItemClick;
108
- private onBlur;
109
- private dispatchClickEvent;
110
- private renderPopup;
111
- private onPopupClose;
112
- private listRef;
113
- private renderChildItems;
114
- private onSplitPartClick;
115
- private onDownSplitPart;
116
- private onItemDown;
117
- private dispatchPopupEvent;
118
- private isItemDisabled;
119
- private isRtl;
120
- }