@progress/kendo-react-buttons 6.1.1 → 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,334 +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
- import { Button } from './../main';
19
- import { classNames, getActiveElement, guid, kendoThemeMaps, Keys, svgIconPropType } from '@progress/kendo-react-common';
20
- import { dispatchEvent } from '@progress/kendo-react-common';
21
- import { ButtonItem } from './ButtonItem';
22
- import { SplitButtonItem } from './SplitButtonItem';
23
- import { navigate as navigation } from './utils/navigation';
24
- import { Popup } from '@progress/kendo-react-popup';
25
- import { getAnchorAlign, getPopupAlign } from './utils/popup';
26
- import { validatePackage } from '@progress/kendo-react-common';
27
- import { packageMetadata } from '../package-metadata';
28
- import { caretAltDownIcon } from '@progress/kendo-svg-icons';
29
- /**
30
- * Represents the [KendoReact SplitButton component]({% slug overview_splitbutton %}).
31
- *
32
- * @example
33
- * ```jsx
34
- * class App extends React.Component {
35
- * render() {
36
- * return (
37
- * <SplitButton text="Act">
38
- * <SplitButtonItem text="Item1" />
39
- * <SplitButtonItem text="Item2" />
40
- * <SplitButtonItem text="Item3" />
41
- * </SplitButton>
42
- * );
43
- * }
44
- * }
45
- * ReactDOM.render(<App />, document.querySelector('my-app'));
46
- * ```
47
- */
48
- var SplitButton = /** @class */ (function (_super) {
49
- __extends(SplitButton, _super);
50
- function SplitButton(props) {
51
- var _this = _super.call(this, props) || this;
52
- /**
53
- * @hidden
54
- */
55
- _this.state = {
56
- focused: false,
57
- focusedIndex: -1,
58
- opened: false
59
- };
60
- _this.wrapper = null;
61
- _this.mainButton = null;
62
- _this.list = null;
63
- _this.guid = guid();
64
- _this.skipFocus = false;
65
- _this.buttonsData = [];
66
- _this.onKeyDown = function (event) {
67
- var focusedIndex = _this.state.focusedIndex;
68
- if (event.altKey) {
69
- if (!_this.opened && event.keyCode === Keys.down) {
70
- _this.dispatchPopupEvent(event, true);
71
- _this.setState({ focusedIndex: 0 });
72
- _this.setOpen(true);
73
- }
74
- else if (_this.opened && event.keyCode === Keys.up) {
75
- _this.setState({ focusedIndex: -1 });
76
- _this.setOpen(false);
77
- }
78
- return;
79
- }
80
- var newState = undefined;
81
- if (event.keyCode === Keys.enter || event.keyCode === Keys.space) {
82
- // Prevent default because otherwise when an item is selected
83
- // click on the default button gets emitted which opens the popup again.
84
- event.preventDefault();
85
- _this.dispatchClickEvent(event, focusedIndex);
86
- if (focusedIndex >= 0) {
87
- newState = {
88
- focusedIndex: _this.opened ? -1 : 0
89
- };
90
- var notOpened = !_this.opened;
91
- _this.setOpen(notOpened);
92
- if (notOpened) {
93
- _this.dispatchPopupEvent(event, notOpened);
94
- }
95
- }
96
- }
97
- else if (_this.opened && event.keyCode === Keys.esc) {
98
- _this.setState({ focusedIndex: -1 });
99
- _this.setOpen(false);
100
- return;
101
- }
102
- if (_this.opened) {
103
- var newFocused = navigation(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
104
- if (newFocused !== focusedIndex) {
105
- newState = newState || {};
106
- newState.focusedIndex = newFocused;
107
- }
108
- var arrowKey = event.keyCode === Keys.up || event.keyCode === Keys.down ||
109
- event.keyCode === Keys.left || event.keyCode === Keys.right;
110
- if (!event.altKey && (arrowKey || event.keyCode === Keys.home || event.keyCode === Keys.end)) {
111
- // Needed to notify the parent listeners that event is handled.
112
- event.preventDefault();
113
- }
114
- }
115
- if (newState) {
116
- _this.setState(newState);
117
- }
118
- };
119
- _this.switchFocus = function (focusFn) {
120
- _this.skipFocus = true;
121
- focusFn();
122
- window.setTimeout(function () { return _this.skipFocus = false; }, 0);
123
- };
124
- _this.onFocus = function (event) {
125
- if (_this.skipFocus) {
126
- return;
127
- }
128
- dispatchEvent(_this.props.onFocus, event, _this, undefined);
129
- _this.setState({ focused: true });
130
- };
131
- _this.setOpen = function (value) {
132
- _this.openedDuringOnChange = value;
133
- _this.setState({ opened: value });
134
- };
135
- _this.onItemClick = function (event, clickedItemIndex) {
136
- var opened = _this.opened;
137
- if (opened) {
138
- _this.setState({ focusedIndex: 0 });
139
- _this.setOpen(false);
140
- }
141
- _this.dispatchClickEvent(event, clickedItemIndex);
142
- };
143
- _this.onBlur = function (event) {
144
- if (_this.skipFocus) {
145
- return;
146
- }
147
- _this.setState({
148
- focused: false,
149
- focusedIndex: -1
150
- });
151
- _this.setOpen(false);
152
- dispatchEvent(_this.props.onBlur, event, _this, undefined);
153
- };
154
- _this.onPopupClose = function () {
155
- if (_this.state.focused) {
156
- _this.switchFocus(function () {
157
- if (_this.element) {
158
- _this.element.removeAttribute('tabindex');
159
- _this.element.focus({ preventScroll: true });
160
- }
161
- });
162
- }
163
- _this.dispatchPopupEvent({}, false);
164
- };
165
- _this.listRef = function (list) {
166
- _this.list = list;
167
- if (list && _this.state.focused) {
168
- _this.switchFocus(function () {
169
- list.focus({ preventScroll: true });
170
- if (_this.element) {
171
- _this.element.tabIndex = -1;
172
- }
173
- });
174
- }
175
- };
176
- _this.onSplitPartClick = function (event) {
177
- if (_this.buttonsData.length) {
178
- var toOpen = !_this.opened;
179
- if (toOpen) {
180
- _this.dispatchPopupEvent(event, toOpen);
181
- }
182
- _this.setState({
183
- focusedIndex: toOpen ? 0 : -1,
184
- focused: true
185
- });
186
- _this.setOpen(toOpen);
187
- }
188
- };
189
- _this.onDownSplitPart = function (event) {
190
- event.preventDefault();
191
- var activeElement = getActiveElement(document);
192
- if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
193
- _this.element.focus();
194
- }
195
- };
196
- _this.onItemDown = function (event) {
197
- var activeElement = getActiveElement(document);
198
- if (activeElement === _this.list) {
199
- event.preventDefault();
200
- }
201
- };
202
- _this.dispatchPopupEvent = function (dispatchedEvent, open) {
203
- dispatchEvent(open ? _this.props.onOpen : _this.props.onClose, dispatchedEvent, _this, undefined);
204
- _this.openedDuringOnChange = undefined;
205
- };
206
- validatePackage(packageMetadata);
207
- return _this;
208
- }
209
- Object.defineProperty(SplitButton.prototype, "opened", {
210
- get: function () {
211
- return this.openedDuringOnChange !== undefined
212
- ? this.openedDuringOnChange
213
- : this.props.opened === undefined
214
- ? this.state.opened
215
- : this.props.opened;
216
- },
217
- enumerable: false,
218
- configurable: true
219
- });
220
- /**
221
- * @hidden
222
- */
223
- SplitButton.prototype.render = function () {
224
- var _this = this;
225
- this.buttonsData = this.props.items ||
226
- React.Children.toArray(this.props.children)
227
- .filter(function (child) { return child && child.type === SplitButtonItem; })
228
- .map(function (child) { return child.props; });
229
- var rtl = this.isRtl();
230
- var dir = rtl ? 'rtl' : undefined;
231
- var _a = this.props, id = _a.id, style = _a.style, tabIndex = _a.tabIndex, disabled = _a.disabled;
232
- return (React.createElement("div", { id: id, style: style, className: classNames('k-split-button', 'k-button-group', {
233
- 'k-focus': this.state.focused
234
- }, "k-rounded-".concat(kendoThemeMaps.roundedMap[this.props.rounded || 'medium']), this.props.className), onKeyDown: this.onKeyDown, onFocus: this.onFocus, onBlur: this.onBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
235
- React.createElement(Button, { ref: function (el) { return _this.mainButton = el && el.element; }, type: "button", size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: function (event) { return _this.onItemClick(event, -1); }, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, className: this.props.buttonClass, icon: this.props.icon, svgIcon: this.props.svgIcon, iconClass: this.props.iconClass, imageUrl: this.props.imageUrl, dir: dir, "aria-disabled": disabled, "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),
236
- React.createElement(Button, { type: "button", size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, icon: "caret-alt-down", svgIcon: caretAltDownIcon, className: "k-split-button-arrow", disabled: disabled || undefined, tabIndex: -1, onClick: this.onSplitPartClick, onMouseDown: this.onDownSplitPart, onPointerDown: this.onDownSplitPart, dir: dir, "aria-label": "menu toggling button" }),
237
- this.renderPopup(rtl)));
238
- };
239
- /**
240
- * @hidden
241
- */
242
- SplitButton.prototype.componentDidMount = function () {
243
- // If this.props.opened is true during the initial render, the popup is not aligned.
244
- if ((this.props.dir === undefined && this.isRtl()) || this.opened) {
245
- this.forceUpdate();
246
- }
247
- };
248
- Object.defineProperty(SplitButton.prototype, "element", {
249
- /**
250
- * The DOM element of main button.
251
- */
252
- get: function () {
253
- return this.mainButton;
254
- },
255
- enumerable: false,
256
- configurable: true
257
- });
258
- SplitButton.prototype.dispatchClickEvent = function (dispatchedEvent, clickedItemIndex) {
259
- if (!this.isItemDisabled(clickedItemIndex)) {
260
- if (clickedItemIndex === -1) {
261
- dispatchEvent(this.props.onButtonClick, dispatchedEvent, this, undefined);
262
- }
263
- else {
264
- dispatchEvent(this.props.onItemClick, dispatchedEvent, this, {
265
- item: this.buttonsData[clickedItemIndex],
266
- itemIndex: clickedItemIndex
267
- });
268
- }
269
- }
270
- };
271
- SplitButton.prototype.renderPopup = function (rtl) {
272
- var _a;
273
- var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
274
- var focusedIndex = this.state.focusedIndex;
275
- 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 },
276
- React.createElement("ul", { role: "menu", id: this.guid, "aria-labelledby": 'button-' + this.guid, tabIndex: -1, ref: this.listRef, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, className: classNames('k-group k-menu-group k-reset', (_a = {},
277
- _a["k-menu-group-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
278
- _a)) }, this.renderChildItems())));
279
- };
280
- SplitButton.prototype.renderChildItems = function () {
281
- var _this = this;
282
- var _a = this.props, item = _a.item, itemRender = _a.itemRender, textField = _a.textField;
283
- return this.buttonsData.length > 0 ? (this.buttonsData.map(function (dataItem, index) {
284
- return (React.createElement(ButtonItem, { className: "k-menu-item", dataItem: dataItem, textField: textField, focused: _this.state.focusedIndex === index, onClick: _this.onItemClick, onDown: _this.onItemDown, render: itemRender, item: item, key: index, index: index, id: "".concat(_this.guid, "-").concat(index) }));
285
- })) : null;
286
- };
287
- SplitButton.prototype.isItemDisabled = function (index) {
288
- return this.buttonsData[index] ? this.buttonsData[index].disabled : this.props.disabled;
289
- };
290
- SplitButton.prototype.isRtl = function () {
291
- return this.props.dir !== undefined ? this.props.dir === 'rtl' :
292
- !!this.wrapper && getComputedStyle(this.wrapper).direction === 'rtl';
293
- };
294
- /**
295
- * @hidden
296
- */
297
- SplitButton.propTypes = {
298
- accessKey: PropTypes.string,
299
- ariaLabel: PropTypes.string,
300
- title: PropTypes.string,
301
- onButtonClick: PropTypes.func,
302
- onFocus: PropTypes.func,
303
- onBlur: PropTypes.func,
304
- onItemClick: PropTypes.func,
305
- onOpen: PropTypes.func,
306
- onClose: PropTypes.func,
307
- text: PropTypes.string,
308
- items: PropTypes.arrayOf(PropTypes.any),
309
- textField: PropTypes.string,
310
- tabIndex: PropTypes.number,
311
- disabled: PropTypes.bool,
312
- icon: PropTypes.string,
313
- svgIcon: svgIconPropType,
314
- iconClass: PropTypes.string,
315
- imageUrl: PropTypes.string,
316
- popupSettings: PropTypes.object,
317
- itemRender: PropTypes.any,
318
- item: PropTypes.func,
319
- className: PropTypes.string,
320
- buttonClass: PropTypes.string,
321
- dir: PropTypes.string
322
- };
323
- /**
324
- * @hidden
325
- */
326
- SplitButton.defaultProps = {
327
- size: 'medium',
328
- rounded: 'medium',
329
- fillMode: 'solid',
330
- themeColor: 'base'
331
- };
332
- return SplitButton;
333
- }(React.Component));
334
- export { SplitButton };
@@ -1,42 +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 SplitButtonItem = /** @class */ (function (_super) {
19
- __extends(SplitButtonItem, _super);
20
- function SplitButtonItem() {
21
- return _super !== null && _super.apply(this, arguments) || this;
22
- }
23
- /**
24
- * @hidden
25
- */
26
- SplitButtonItem.prototype.render = function () {
27
- return null;
28
- };
29
- /**
30
- * @hidden
31
- */
32
- SplitButtonItem.propTypes = {
33
- text: PropTypes.string,
34
- icon: PropTypes.string,
35
- iconClass: PropTypes.string,
36
- imageUrl: PropTypes.string,
37
- disabled: PropTypes.bool,
38
- render: PropTypes.any
39
- };
40
- return SplitButtonItem;
41
- }(React.Component));
42
- export { SplitButtonItem };
@@ -1,34 +0,0 @@
1
- import { SVGIcon } from '@progress/kendo-react-common';
2
- /**
3
- * The interface for describing items that can be passed to the `items` property of the SplitButton or the DropDownButton as an alternative to passing them as children.
4
- */
5
- export interface ButtonItem {
6
- /**
7
- * Specifies the text of the item.
8
- */
9
- text: string;
10
- /**
11
- * Defines an icon that will be rendered next to the item text.
12
- */
13
- icon?: string;
14
- /**
15
- * Defines an SVG icon that will be rendered next to the item text.
16
- */
17
- svgIcon?: SVGIcon;
18
- /**
19
- * Defines an icon with a custom CSS class that will be rendered next to the item text.
20
- */
21
- iconClass?: string;
22
- /**
23
- * Defines the location of an image that will be displayed next to the item text.
24
- */
25
- imageUrl?: string;
26
- /**
27
- * Determines whether the item is disabled.
28
- */
29
- disabled?: boolean;
30
- /**
31
- * A React functional or class component for rendering the item. The default rendering includes an icon, an image, and text.
32
- */
33
- render?: any;
34
- }
@@ -1,3 +0,0 @@
1
- /* eslint-disable max-len */
2
- export {};
3
- // tslint:enable:max-line-length