@progress/kendo-react-listbox 13.3.0-develop.9 → 13.4.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.
package/index.d.mts CHANGED
@@ -5,427 +5,13 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { BaseEvent } from '@progress/kendo-react-common';
9
- import { ComponentType } from 'react';
10
- import { ForwardRefExoticComponent } from 'react';
11
- import * as React_2 from 'react';
12
- import { RefAttributes } from 'react';
13
-
14
- /**
15
- * Represents the KendoReact ListBox Component.
16
- */
17
- export declare const ListBox: ForwardRefExoticComponent<ListBoxProps & RefAttributes<any>>;
18
-
19
- /**
20
- * The ListBox component.
21
- */
22
- declare const ListBox_2: React_2.ForwardRefExoticComponent<ListBoxProps & React_2.RefAttributes<ListBoxHandle | null>>;
23
-
24
- /** @hidden */
25
- declare type ListBox_2 = ListBoxHandle;
26
-
27
- /**
28
- * The event that is triggered during drag operations on the ListBox.
29
- */
30
- export declare interface ListBoxDragEvent extends BaseEvent<ListBox_2> {
31
- /**
32
- * The data item involved in the drag operation.
33
- */
34
- dataItem?: any;
35
- }
36
-
37
- /**
38
- * The event that is triggered when a dragged element leaves the ListBox.
39
- */
40
- declare interface ListBoxDragLeaveEvent extends BaseEvent<ListBox_2> {
41
- }
42
-
43
- /**
44
- * The base event for ListBox operations.
45
- */
46
- export declare interface ListBoxEvent extends BaseEvent<ListBox_2> {
47
- }
48
-
49
- /**
50
- * The ListBox ref.
51
- */
52
- declare interface ListBoxHandle {
53
- /**
54
- * The current element or `null` if there is no one.
55
- */
56
- element: HTMLDivElement | null;
57
- /**
58
- * The props value of the ListBox.
59
- */
60
- props: ListBoxProps;
61
- }
62
-
63
- /**
64
- * The event that is triggered when an item in the ListBox is clicked.
65
- */
66
- export declare interface ListBoxItemClickEvent extends BaseEvent<ListBox_2> {
67
- /**
68
- * The data item that was clicked.
69
- */
70
- dataItem?: any;
71
- }
72
-
73
- /**
74
- * The event that is triggered when a keyboard navigation action is performed.
75
- */
76
- export declare interface ListBoxItemNavigateEvent extends BaseEvent<ListBox_2> {
77
- /**
78
- * The name of the action that was performed.
79
- */
80
- actionName?: string;
81
- }
82
-
83
- /**
84
- * The event that is triggered when an item in the ListBox is selected.
85
- */
86
- export declare interface ListBoxItemSelectEvent extends BaseEvent<ListBox_2> {
87
- /**
88
- * The data item that was selected.
89
- */
90
- dataItem?: any;
91
- }
92
-
93
- /**
94
- * The event that is triggered when a key is pressed down over the ListBox.
95
- */
96
- export declare interface ListBoxKeyDownEvent extends BaseEvent<ListBox_2> {
97
- }
98
-
99
- /**
100
- * Represents the props of the [KendoReact ListBox component](https://www.telerik.com/kendo-react-ui/components/listbox).
101
- */
102
- export declare interface ListBoxProps {
103
- /**
104
- * Sets a `class` of the ListBox container.
105
- *
106
- * @example
107
- * ```jsx
108
- * <ListBox className="custom-class" />
109
- * ```
110
- */
111
- className?: string;
112
- /**
113
- * Sets an `id` of the ListBox container.
114
- *
115
- * @example
116
- * ```jsx
117
- * <ListBox id="listbox-id" />
118
- * ```
119
- */
120
- id?: string;
121
- /**
122
- * Configures the `size` of the ListBox.
123
- *
124
- * The available options are:
125
- * - small
126
- * - medium
127
- * - large
128
- * - null&mdash;Does not set a size `className`.
129
- *
130
- * @default `medium`
131
- *
132
- * @example
133
- * ```jsx
134
- * <ListBox size="large" />
135
- * ```
136
- */
137
- size?: null | 'small' | 'medium' | 'large';
138
- /**
139
- * Specifies the styles which are set to the ListBox container.
140
- *
141
- * @example
142
- * ```jsx
143
- * <ListBox style={{ width: '300px' }} />
144
- * ```
145
- */
146
- style?: React.CSSProperties;
147
- /**
148
- * Sets the data of the ListBox.
149
- *
150
- * @example
151
- * ```jsx
152
- * <ListBox data={[{ text: 'Item 1' }, { text: 'Item 2' }]} />
153
- * ```
154
- */
155
- data: Array<any>;
156
- /**
157
- * Makes the items of the ListBox draggable.
158
- *
159
- * @default true
160
- *
161
- * @example
162
- * ```jsx
163
- * <ListBox draggable={false} />
164
- * ```
165
- */
166
- draggable?: boolean;
167
- /**
168
- * Sets the selected field of the ListBox. Based on the value of this field, an item is selected or not.
169
- *
170
- * @example
171
- * ```jsx
172
- * <ListBox selectedField="isSelected" />
173
- * ```
174
- */
175
- selectedField?: string;
176
- /**
177
- * Sets the data item field that represents the item text. If the data contains only primitive values, do not define it.
178
- *
179
- * @example
180
- * ```jsx
181
- * <ListBox textField="name" />
182
- * ```
183
- */
184
- textField: string;
185
- /**
186
- * The field that is used during form submission. Defaults to the `textField` if not set.
187
- *
188
- * @example
189
- * ```jsx
190
- * <ListBox valueField="id" />
191
- * ```
192
- */
193
- valueField?: string;
194
- /**
195
- * Sets the position of the toolbar of the ListBox if one is set. The ListBox may have no toolbar.
196
- *
197
- * The possible values are:
198
- * - `top`
199
- * - `bottom`
200
- * - `left`
201
- * - `right` (Default)
202
- * - `none`
203
- *
204
- * @default 'right'
205
- *
206
- * @example
207
- * ```jsx
208
- * <ListBox toolbarPosition="top" />
209
- * ```
210
- */
211
- toolbarPosition?: toolbarPosition | string;
212
- /**
213
- * Renders a toolbar component next to the ListBox.
214
- *
215
- * @example
216
- * ```jsx
217
- * <ListBox toolbar={CustomToolbar} />
218
- * ```
219
- */
220
- toolbar?: null | ComponentType<any>;
221
- /**
222
- * Defines the component that will be rendered for each item of the data collection.
223
- *
224
- * @example
225
- * ```jsx
226
- * const CustomItem = (props) => <div>{props.text}</div>;
227
- *
228
- * <ListBox item={CustomItem} />
229
- * ```
230
- */
231
- item?: React.ComponentType<any>;
232
- /**
233
- * Fires when an item from the ListBox is clicked. Contains the clicked item.
234
- *
235
- * @example
236
- * ```jsx
237
- * <ListBox onItemClick={(event) => console.log(event.item)} />
238
- * ```
239
- */
240
- onItemClick?: (event: ListBoxItemClickEvent) => void;
241
- /**
242
- * Fires when an item from the ListBox is selected. Contains the selected item.
243
- *
244
- * @example
245
- * ```jsx
246
- * <ListBox onItemSelect={(event) => console.log(event.item)} />
247
- * ```
248
- */
249
- onItemSelect?: (event: ListBoxItemSelectEvent) => void;
250
- /**
251
- * Fires on keydown over the ListBox list items. You can use it to add extra keyboard navigation options.
252
- *
253
- * @example
254
- * ```jsx
255
- * <ListBox onKeyDown={(event) => console.log(event.keyCode)} />
256
- * ```
257
- */
258
- onKeyDown?: (event: ListBoxKeyDownEvent) => void;
259
- /**
260
- * Fires when the user starts to drag an item from the ListBox. The event contains information about the item that is being dragged.
261
- *
262
- * @example
263
- * ```jsx
264
- * <ListBox onDragStart={(event) => console.log(event.item)} />
265
- * ```
266
- */
267
- onDragStart?: (event: ListBoxDragEvent) => void;
268
- /**
269
- * Fires when the user drags over an item from the ListBox. The event contains information about the item that is dragged over.
270
- *
271
- * @example
272
- * ```jsx
273
- * <ListBox onDragOver={(event) => console.log(event.item)} />
274
- * ```
275
- */
276
- onDragOver?: (event: ListBoxDragEvent) => void;
277
- /**
278
- * Fires when the user drops an item. The event contains information about the drop target item.
279
- *
280
- * @example
281
- * ```jsx
282
- * <ListBox onDrop={(event) => console.log(event.item)} />
283
- * ```
284
- */
285
- onDrop?: (event: ListBoxDragEvent) => void;
286
- /**
287
- * Fires when a dragged element or text selection leaves the ListBox element.
288
- *
289
- * @example
290
- * ```jsx
291
- * <ListBox onDragLeave={(event) => console.log(event.item)} />
292
- * ```
293
- */
294
- onDragLeave?: (event: ListBoxDragLeaveEvent) => void;
295
- /**
296
- * Fires when a keyboard navigation action is triggered.
297
- *
298
- * @example
299
- * ```jsx
300
- * <ListBox onKeyboardNavigate={(event) => console.log(event.item)} />
301
- * ```
302
- */
303
- onKeyboardNavigate?: (event: ListBoxItemNavigateEvent) => void;
304
- }
305
-
306
- export declare const ListBoxToolbar: React_2.ForwardRefExoticComponent<ListBoxToolbarProps & React_2.RefAttributes<ListBoxToolbarHandle | null>>;
307
-
308
- /** @hidden */
309
- export declare type ListBoxToolbar = ListBoxToolbarHandle;
310
-
311
- /**
312
- * The event that is triggered when a tool in the ListBoxToolbar is clicked.
313
- */
314
- export declare interface ListBoxToolbarClickEvent extends BaseEvent<ListBoxToolbar> {
315
- /**
316
- * The name of the tool that was clicked.
317
- */
318
- toolName?: string;
319
- }
320
-
321
- /**
322
- * The base event for ListBoxToolbar operations.
323
- */
324
- declare interface ListBoxToolbarEvent extends BaseEvent<ListBoxToolbar> {
325
- }
326
-
327
- /**
328
- * @hidden
329
- */
330
- declare interface ListBoxToolbarHandle {
331
- onToolClick?: (event: ListBoxToolbarEvent) => void;
332
- props: ListBoxToolbarProps;
333
- context: {};
334
- state: {};
335
- refs: {};
336
- }
337
-
338
- export declare interface ListBoxToolbarProps {
339
- /**
340
- * Sets the tools of the ListBoxToolbar. By default, the ListBoxToolbar renders no tools.
341
- * The built-in tools are:
342
- * * `moveUp`
343
- * * `moveDown`
344
- * * `transferTo`
345
- * * `transferFrom`
346
- * * `transferAllTo`
347
- * * `transferAllFrom`
348
- * * `remove`
349
- */
350
- tools?: Array<string>;
351
- /**
352
- * Configures the `size` of the buttons inside the ListBoxToolbar.
353
- *
354
- * The available options are:
355
- * - small
356
- * - medium
357
- * - large
358
- * - null&mdash;Does not set a size `className`.
359
- *
360
- * @default `medium`
361
- */
362
- size?: null | 'small' | 'medium' | 'large';
363
- /**
364
- * The data of the main ListBox.
365
- */
366
- data: Array<any>;
367
- /**
368
- * The data of the connected ListBox.
369
- */
370
- dataConnected: Array<any>;
371
- /**
372
- * Set the selected field of the ListBoxToolbar.
373
- * Based on that value of that field the ListBoxToolbar will determine which actions are allowed and which disabled.
374
- */
375
- selectedField?: string;
376
- /**
377
- * Fires when one of the ListBoxToolbar tools is clicked.
378
- */
379
- onToolClick?: (event: ListBoxToolbarClickEvent) => void;
380
- /**
381
- * @hidden
382
- */
383
- dir?: string;
384
- }
385
-
386
- /**
387
- * @hidden
388
- */
389
- export declare const moveItem: (from: number, to: number, data: Array<any>) => any[];
390
-
391
- /**
392
- * Processes the data collections based on the clicked ListBoxToolbar tool.
393
- *
394
- * @param {T[]} listBoxOneData - The first data collection.
395
- * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
396
- * @param {string} toolName - The tool that was clicked.
397
- * @param {string} selectedField - The field that contains the selected information in the data object.
398
- * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
399
- */
400
- export declare const processListBoxData: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, toolName: string, selectedField: string) => {
401
- listBoxOneData: any[];
402
- listBoxTwoData: any[];
403
- };
404
-
405
- /**
406
- * Processes the data collections based on the dragged and dropped item.
407
- *
408
- * @param {T[]} listBoxOneData - The first data collection.
409
- * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
410
- * @param {any} dragItem - The item that was dragged.
411
- * @param {any} dropItem - The drop target item.
412
- * @param {string} valueField - The field which points to the unique value of each data item.
413
- * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
414
- */
415
- export declare const processListBoxDragAndDrop: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, dragItem: any, dropItem: any, valueField: string) => {
416
- listBoxOneData: any[];
417
- listBoxTwoData: any[];
418
- };
419
-
420
- /**
421
- * Defines the possible positions for the ListBox toolbar.
422
- */
423
- declare enum toolbarPosition {
424
- TOP = "top",
425
- BOTTOM = "bottom",
426
- LEFT = "left",
427
- RIGHT = "right",
428
- NONE = "none"
429
- }
430
-
431
- export { }
8
+ import { ListBoxProps } from './interfaces/ListBoxProps.js';
9
+ import { ListBoxToolbar } from './ListBoxToolbar.js';
10
+ import { ListBoxToolbarProps } from './interfaces/ListBoxToolBarProps.js';
11
+ import { processListBoxData, moveItem, processListBoxDragAndDrop } from './utils.js';
12
+ import { ListBoxDragEvent, ListBoxItemClickEvent, ListBoxKeyDownEvent, ListBoxToolbarClickEvent, ListBoxEvent, ListBoxItemSelectEvent, ListBoxItemNavigateEvent } from './interfaces/ListBoxEvents.js';
13
+ /**
14
+ * Represents the KendoReact ListBox Component.
15
+ */
16
+ declare const ListBox: import('react').ForwardRefExoticComponent<ListBoxProps & import('react').RefAttributes<any>>;
17
+ export { ListBox, ListBoxProps, ListBoxToolbar, ListBoxToolbarProps, processListBoxData, moveItem, processListBoxDragAndDrop, ListBoxDragEvent, ListBoxItemClickEvent, ListBoxKeyDownEvent, ListBoxToolbarClickEvent, ListBoxEvent, ListBoxItemSelectEvent, ListBoxItemNavigateEvent };