@progress/kendo-react-buttons 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/Button.d.ts +114 -0
- package/Button.js +1 -1
- package/Button.mjs +42 -44
- package/ButtonGroup.d.ts +47 -0
- package/ButtonGroupInterface.d.ts +39 -0
- package/ButtonInterface.d.ts +49 -0
- package/Chip/Chip.d.ts +425 -0
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +43 -39
- package/Chip/ChipList.d.ts +221 -0
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +40 -41
- package/Chip/chip-list-contexts.d.ts +20 -0
- package/Chip/data-reducer.d.ts +29 -0
- package/Chip/focus-reducer.d.ts +31 -0
- package/Chip/selection-reducer.d.ts +37 -0
- package/FloatingActionButton/FloatingActionButton.d.ts +23 -0
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +85 -85
- package/FloatingActionButton/FloatingActionButtonItem.d.ts +132 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +20 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +31 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +354 -0
- package/FloatingActionButton/models/align-offset.d.ts +27 -0
- package/FloatingActionButton/models/align.d.ts +34 -0
- package/FloatingActionButton/models/events.d.ts +28 -0
- package/FloatingActionButton/models/position-mode.d.ts +16 -0
- package/FloatingActionButton/models/rounded.d.ts +19 -0
- package/FloatingActionButton/models/size.d.ts +18 -0
- package/FloatingActionButton/models/theme-color.d.ts +25 -0
- package/FloatingActionButton/utils.d.ts +34 -0
- package/ListButton/ButtonItem.d.ts +72 -0
- package/ListButton/DropDownButton.d.ts +153 -0
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +62 -46
- package/ListButton/DropDownButtonItem.d.ts +37 -0
- package/ListButton/SplitButton.d.ts +142 -0
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +29 -13
- package/ListButton/SplitButtonItem.d.ts +32 -0
- package/ListButton/models/ButtonItem.d.ts +41 -0
- package/ListButton/models/ListButtonProps.d.ts +411 -0
- package/ListButton/models/PopupSettings.d.ts +35 -0
- package/ListButton/models/events.d.ts +59 -0
- package/ListButton/utils/navigation.d.ts +12 -0
- package/ListButton/utils/popup.d.ts +16 -0
- package/SpeechToTextButton/SpeechToTextButton.d.ts +36 -0
- package/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/SpeechToTextButton/SpeechToTextButton.mjs +24 -24
- package/SpeechToTextButton/interfaces/SpeechToTextButtonHandle.d.ts +28 -0
- package/SpeechToTextButton/interfaces/SpeechToTextButtonProps.d.ts +117 -0
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/index.d.mts +43 -2928
- package/index.d.ts +43 -2928
- package/messages/index.d.ts +22 -0
- package/models/index.d.ts +95 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +5 -5
- package/toolbar/Toolbar.d.ts +38 -0
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +15 -15
- package/toolbar/events/ToolbarResizeEvent.d.ts +29 -0
- package/toolbar/interfaces/ToolbarHandle.d.ts +21 -0
- package/toolbar/interfaces/ToolbarOverflowProps.d.ts +50 -0
- package/toolbar/interfaces/ToolbarProps.d.ts +128 -0
- package/toolbar/messages/index.d.ts +27 -0
- package/toolbar/tools/ToolbarItem.d.ts +47 -0
- package/toolbar/tools/ToolbarOverflowSection.d.ts +21 -0
- package/toolbar/tools/ToolbarScrollButton.d.ts +23 -0
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +11 -20
- package/toolbar/tools/ToolbarScrollable.d.ts +28 -0
- package/toolbar/tools/ToolbarSeparator.d.ts +22 -0
- package/toolbar/tools/ToolbarSpacer.d.ts +30 -0
- package/util.d.ts +31 -0
package/Chip/Chip.d.ts
ADDED
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { SVGIcon } from '@progress/kendo-react-common';
|
|
9
|
+
import { ChipRemoveEvent, ChipMouseEvent, ChipFocusEvent, ChipKeyboardEvent } from './../models/index.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Represents the properties of [Chip](https://www.telerik.com/kendo-react-ui/components/buttons/api/chip) component.
|
|
13
|
+
*/
|
|
14
|
+
export interface ChipProps {
|
|
15
|
+
/**
|
|
16
|
+
* Sets the `id` property of the top div element of the Chip.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```jsx
|
|
20
|
+
* <Chip id="chip1" />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
id?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Sets additional classes to the Chip.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```jsx
|
|
29
|
+
* <Chip className="custom-chip" />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The React elements that will be rendered as custom content inside the Chip.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```jsx
|
|
38
|
+
* <Chip>Custom Content</Chip>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the `tabIndex` attribute.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```jsx
|
|
47
|
+
* <Chip tabIndex={0} />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
tabIndex?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Sets additional CSS styles to the Chip.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```jsx
|
|
56
|
+
* <Chip style={{ margin: '10px' }} />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
style?: React.CSSProperties;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the label text of the Chip.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```jsx
|
|
65
|
+
* <Chip text="Label" />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
text?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the `id` value of the Chip.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```jsx
|
|
74
|
+
* <Chip value="chip1" />
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
value?: any;
|
|
78
|
+
/**
|
|
79
|
+
* The Chip direction 'ltr' as default or 'rtl'.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```jsx
|
|
83
|
+
* <Chip dir="rtl" />
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
dir?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Determines if the Chip could be removed.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```jsx
|
|
92
|
+
* <Chip removable />
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
removable?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Determines if the Chip has custom font `removeIcon`.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```jsx
|
|
101
|
+
* <Chip removeIcon="k-i-close" />
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
removeIcon?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Determines if the Chip has custom SVG `removeIcon`.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```jsx
|
|
110
|
+
* import { gearIcon } from '@progress/kendo-svg-icons';
|
|
111
|
+
*
|
|
112
|
+
* <Chip removeSvgIcon={gearIcon} />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
removeSvgIcon?: SVGIcon;
|
|
116
|
+
/**
|
|
117
|
+
* Determines if the Chip is disabled.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```jsx
|
|
121
|
+
* <Chip disabled />
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Determines if the Chip has a font `icon`.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```jsx
|
|
130
|
+
* <Chip icon="k-i-user" />
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
icon?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Determines if the Chip has an SVG `icon`.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```jsx
|
|
139
|
+
* import { gearIcon } from '@progress/kendo-svg-icons';
|
|
140
|
+
*
|
|
141
|
+
* <Chip svgIcon={gearIcon} />
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
svgIcon?: SVGIcon;
|
|
145
|
+
/**
|
|
146
|
+
* Determines if the Chip has an avatar.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```jsx
|
|
150
|
+
* <Chip avatar={{ image: 'avatar.png', imageAlt: 'Avatar' }} />
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
avatar?: ChipAvatarProps;
|
|
154
|
+
/**
|
|
155
|
+
* Determines if the Chip has custom selection font `icon`.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```jsx
|
|
159
|
+
* <Chip selectedIcon="k-i-check" />
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
selectedIcon?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Determines if the Chip has custom selection SVG `icon`.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```jsx
|
|
168
|
+
* import { gearIcon } from '@progress/kendo-svg-icons';
|
|
169
|
+
*
|
|
170
|
+
* <Chip selectedSvgIcon={gearIcon} />
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
selectedSvgIcon?: SVGIcon;
|
|
174
|
+
/**
|
|
175
|
+
* Fires on Chip removing.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```jsx
|
|
179
|
+
* <Chip onRemove={(event) => console.log(event)} />
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
onRemove?: (event: ChipRemoveEvent) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Fires on `onClick` event.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```jsx
|
|
188
|
+
* <Chip onClick={(event) => console.log(event)} />
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
onClick?: (event: ChipMouseEvent) => void;
|
|
192
|
+
/**
|
|
193
|
+
* Fires on `onMouseDown` event.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```jsx
|
|
197
|
+
* <Chip onMouseDown={(event) => console.log(event)} />
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
onMouseDown?: (event: ChipMouseEvent) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Fires on `onMouseUp` event.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```jsx
|
|
206
|
+
* <Chip onMouseUp={(event) => console.log(event)} />
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
onMouseUp?: (event: ChipMouseEvent) => void;
|
|
210
|
+
/**
|
|
211
|
+
* Fires on `onDoubleClick` event.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```jsx
|
|
215
|
+
* <Chip onDoubleClick={(event) => console.log(event)} />
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
onDoubleClick?: (event: ChipMouseEvent) => void;
|
|
219
|
+
/**
|
|
220
|
+
* Fires on `onMouseEnter` event.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```jsx
|
|
224
|
+
* <Chip onMouseEnter={(event) => console.log(event)} />
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
onMouseEnter?: (event: ChipMouseEvent) => void;
|
|
228
|
+
/**
|
|
229
|
+
* Fires on `onMouseLeave` event.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```jsx
|
|
233
|
+
* <Chip onMouseLeave={(event) => console.log(event)} />
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
onMouseLeave?: (event: ChipMouseEvent) => void;
|
|
237
|
+
/**
|
|
238
|
+
* Fires on `onMouseMove` event.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```jsx
|
|
242
|
+
* <Chip onMouseMove={(event) => console.log(event)} />
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
onMouseMove?: (event: ChipMouseEvent) => void;
|
|
246
|
+
/**
|
|
247
|
+
* Fires on `onMouseOut` event.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```jsx
|
|
251
|
+
* <Chip onMouseOut={(event) => console.log(event)} />
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
onMouseOut?: (event: ChipMouseEvent) => void;
|
|
255
|
+
/**
|
|
256
|
+
* Fires on `onMouseOver` event.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```jsx
|
|
260
|
+
* <Chip onMouseOver={(event) => console.log(event)} />
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
onMouseOver?: (event: ChipMouseEvent) => void;
|
|
264
|
+
/**
|
|
265
|
+
* Fires on `onKeyDown` event.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```jsx
|
|
269
|
+
* <Chip onKeyDown={(event) => console.log(event)} />
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
onKeyDown?: (event: ChipKeyboardEvent) => void;
|
|
273
|
+
/**
|
|
274
|
+
* Fires on `onFocus` event.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```jsx
|
|
278
|
+
* <Chip onFocus={(event) => console.log(event)} />
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
onFocus?: (event: ChipFocusEvent) => void;
|
|
282
|
+
/**
|
|
283
|
+
* Fires on `onBlur` event.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```jsx
|
|
287
|
+
* <Chip onBlur={(event) => console.log(event)} />
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
onBlur?: (event: ChipFocusEvent) => void;
|
|
291
|
+
/**
|
|
292
|
+
* Represents the item data, coming from the `ChipList` component.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```jsx
|
|
296
|
+
* <Chip dataItem={{ text: 'Chip1' }} />
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
dataItem?: any;
|
|
300
|
+
/**
|
|
301
|
+
* Determines if the Chip is selected.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```jsx
|
|
305
|
+
* <Chip selected />
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
selected?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Identifies the element(s) which describe the component, similar to an [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
311
|
+
* For example, these elements could contain an error or a hint message.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```jsx
|
|
315
|
+
* <Chip ariaDescribedBy="description" />
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
ariaDescribedBy?: string;
|
|
319
|
+
/**
|
|
320
|
+
* @hidden
|
|
321
|
+
*/
|
|
322
|
+
role?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Configures the `size` of the Chip.
|
|
325
|
+
* The available options are:
|
|
326
|
+
* - `small`
|
|
327
|
+
* - `medium`
|
|
328
|
+
* - `large`
|
|
329
|
+
*
|
|
330
|
+
* @default undefined (theme-controlled)
|
|
331
|
+
* @example
|
|
332
|
+
* ```jsx
|
|
333
|
+
* <Chip size="large" />
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
size?: 'small' | 'medium' | 'large';
|
|
337
|
+
/**
|
|
338
|
+
* Configures the `roundness` of the Chip.
|
|
339
|
+
* The available options are:
|
|
340
|
+
* - `small`
|
|
341
|
+
* - `medium`
|
|
342
|
+
* - `large`
|
|
343
|
+
* - `full`
|
|
344
|
+
*
|
|
345
|
+
* @default undefined (theme-controlled)
|
|
346
|
+
* @example
|
|
347
|
+
* ```jsx
|
|
348
|
+
* <Chip rounded="full" />
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
rounded?: 'small' | 'medium' | 'large' | 'full';
|
|
352
|
+
/**
|
|
353
|
+
* Configures the `fillMode` of the Chip.
|
|
354
|
+
* The available options are:
|
|
355
|
+
* - `solid`
|
|
356
|
+
* - `outline`
|
|
357
|
+
*
|
|
358
|
+
* @default undefined (theme-controlled)
|
|
359
|
+
* @example
|
|
360
|
+
* ```jsx
|
|
361
|
+
* <Chip fillMode="outline" />
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
fillMode?: 'solid' | 'outline';
|
|
365
|
+
/**
|
|
366
|
+
* Configures the `themeColor` of the Chip.
|
|
367
|
+
* The available options are:
|
|
368
|
+
* - `base`
|
|
369
|
+
* - `info`
|
|
370
|
+
* - `success`
|
|
371
|
+
* - `warning`
|
|
372
|
+
* - `error`
|
|
373
|
+
*
|
|
374
|
+
* @default undefined (theme-controlled)
|
|
375
|
+
* @example
|
|
376
|
+
* ```jsx
|
|
377
|
+
* <Chip themeColor="success" />
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
themeColor?: 'base' | 'info' | 'success' | 'warning' | 'error';
|
|
381
|
+
/**
|
|
382
|
+
* Represents the label of the Chip component.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```jsx
|
|
386
|
+
* <Chip ariaLabel="Chip Label" />
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
ariaLabel?: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Represents the target(element and props) of the ChipRemoveEvent.
|
|
393
|
+
*/
|
|
394
|
+
export interface ChipHandle {
|
|
395
|
+
/**
|
|
396
|
+
* The current element or `null` if there is no one.
|
|
397
|
+
*/
|
|
398
|
+
element: HTMLDivElement | null;
|
|
399
|
+
/**
|
|
400
|
+
* The props values of the Chip.
|
|
401
|
+
*/
|
|
402
|
+
props: ChipProps;
|
|
403
|
+
}
|
|
404
|
+
export interface ChipAvatarProps {
|
|
405
|
+
/**
|
|
406
|
+
* Sets the image of the avatar.
|
|
407
|
+
*/
|
|
408
|
+
image: string;
|
|
409
|
+
/**
|
|
410
|
+
* Defines the alternative text of the avatar image.
|
|
411
|
+
*/
|
|
412
|
+
imageAlt: string;
|
|
413
|
+
/**
|
|
414
|
+
* Configures the `roundness` of the avatar
|
|
415
|
+
*/
|
|
416
|
+
rounded?: 'small' | 'medium' | 'large' | 'full';
|
|
417
|
+
/**
|
|
418
|
+
* Sets additional CSS styles to the avatar
|
|
419
|
+
*/
|
|
420
|
+
style?: React.CSSProperties;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Represents the Chip component.
|
|
424
|
+
*/
|
|
425
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<ChipHandle | null>>;
|
package/Chip/Chip.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react"),c=require("prop-types"),k=require("./chip-list-contexts.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react"),c=require("prop-types"),k=require("./chip-list-contexts.js"),t=require("@progress/kendo-react-common"),D=require("@progress/kendo-svg-icons"),y=require("./focus-reducer.js"),q=require("./data-reducer.js"),N=require("./selection-reducer.js");function B(e){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const i=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(d,l,i.get?i:{enumerable:!0,get:()=>e[l]})}}return d.default=e,Object.freeze(d)}const a=B(z),O=a.forwardRef((e,d)=>{const l=a.useRef(null),i=a.useRef(null),{disabled:I=o.disabled,fillMode:u=o.fillMode,themeColor:E=o.themeColor,size:f=o.size,rounded:g=o.rounded,dir:A=o.dir,removeIcon:T=o.removeIcon,removeSvgIcon:M=o.removeSvgIcon,removable:m=o.removable}=e,S=t.useDir(i,A);a.useImperativeHandle(l,()=>({element:i.current,props:e})),a.useImperativeHandle(d,()=>l.current);const[v,r]=a.useContext(k.ChipListSelectionContext),[x,s]=a.useContext(k.ChipListFocusContext),[,R]=a.useContext(k.ChipListDataContext),C=a.useMemo(()=>e.selected||(Array.isArray(v)?v.some(n=>n===e.value):v===e.value),[e.selected,e.value,v]),h=a.useMemo(()=>x===e.value,[e.value,x]);a.useEffect(()=>{h&&i.current&&i.current.focus()},[h]);const _=a.useCallback(n=>{r({type:N.SELECTION_ACTION.toggle,payload:e.value,event:n})},[r,e.value]),b=a.useCallback(n=>{m&&(R({type:q.CHIP_DATA_ACTION.remove,payload:e.value,event:n}),s({type:y.FOCUS_ACTION.reset,payload:e.value,event:n}),r({type:N.SELECTION_ACTION.remove,payload:e.value,event:n}),e.onRemove&&e.onRemove.call(void 0,{target:l.current,syntheticEvent:n}))},[e.onRemove,e.value,m,R,s,r]),F=a.useCallback(n=>{switch(n.keyCode){case t.Keys.left:s({type:y.FOCUS_ACTION.prev,payload:e.value,event:n});break;case t.Keys.right:s({type:y.FOCUS_ACTION.next,payload:e.value,event:n});break;case t.Keys.enter:r({type:N.SELECTION_ACTION.toggle,payload:e.value,event:n});break;case t.Keys.delete:b(n);break}e.onKeyDown&&e.onKeyDown.call(void 0,{target:l.current,syntheticEvent:n})},[e.onKeyDown,e.value,s,r,b]),K=a.useCallback(n=>{s({payload:e.value,type:y.FOCUS_ACTION.current,event:n}),e.onFocus&&e.onFocus.call(void 0,{target:l.current,syntheticEvent:n})},[e.onFocus,e.value,s]),P=a.useCallback(n=>{e.onBlur&&e.onBlur.call(void 0,{target:l.current,syntheticEvent:n})},[e.onBlur]),w=t.useMouse(e,l,{onClick:_});return a.createElement("div",{...w,role:e.role||"button",id:e.value,style:e.style,ref:i,dir:S,tabIndex:t.getTabIndex(e.tabIndex,I,void 0),className:t.classNames("k-chip",{"k-rtl":S==="rtl","k-disabled":I,"k-selected":C,"k-focus":h,[`k-chip-${t.kendoThemeMaps.sizeMap[f]||f}`]:f,[`k-rounded-${t.kendoThemeMaps.roundedMap[g]||g}`]:g,[`k-chip-${u}`]:u,[`k-chip-${u}-${E}`]:!!(u&&E)},e.className),"aria-pressed":e.role?void 0:C,"aria-disabled":I,"aria-describedby":e.ariaDescribedBy,"aria-keyshortcuts":m?"Enter Delete":void 0,onFocus:K,onBlur:P,onKeyDown:F},C&&(e.selectedIcon||e.selectedSvgIcon)&&a.createElement(t.IconWrap,{className:"k-chip-icon",name:e.selectedIcon?t.toIconName(e.selectedIcon):void 0,icon:e.selectedSvgIcon,size:"small"}),(e.icon||e.svgIcon)&&a.createElement(t.IconWrap,{className:"k-chip-icon",name:e.icon?t.toIconName(e.icon):void 0,icon:e.svgIcon,size:"small"}),e.avatar&&a.createElement("div",{className:t.classNames("k-chip-avatar","k-avatar",e.avatar.rounded&&`k-rounded-${e.avatar.rounded}`),style:e.avatar.style},a.createElement("span",{className:"k-avatar-image"},a.createElement("img",{src:e.avatar.image,alt:e.avatar.imageAlt}))),a.createElement("span",{className:"k-chip-content"},e.children!==void 0?e.children:e.text&&a.createElement("span",{"aria-label":e.ariaLabel||e.text,className:"k-chip-label"},e.text)),m&&a.createElement("span",{className:"k-chip-actions"},a.createElement("span",{className:t.classNames("k-chip-action","k-chip-remove-action"),onClick:b},a.createElement(t.IconWrap,{name:T?t.toIconName(T):void 0,icon:M||D.xCircleIcon,size:"small"}))))}),L={id:c.string,text:c.string,value:c.any,dir:c.oneOf(["ltr","rtl"]),removable:c.bool,removeIcon:c.string,removeIconSvg:t.svgIconPropType,disabled:c.bool,icon:c.string,svgIcon:t.svgIconPropType,selectedIcon:c.string,selectedIconSvg:t.svgIconPropType,onRemove:c.func,dataItem:c.any,selected:c.bool,ariaDescribedBy:c.string,size:c.oneOf(["small","medium","large"]),rounded:c.oneOf(["small","medium","large","full"]),fillMode:c.oneOf(["outline","solid"]),themeColor:c.oneOf(["base","info","success","warning","error"])},o={disabled:!1,removable:!1,removeIcon:"k-i-x-circle",removeSvgIcon:D.xCircleIcon,dir:"ltr",size:void 0,rounded:void 0,fillMode:void 0,themeColor:void 0};O.displayName="KendoReactChip";O.propTypes=L;exports.Chip=O;
|
package/Chip/Chip.mjs
CHANGED
|
@@ -8,44 +8,44 @@
|
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import l from "prop-types";
|
|
10
10
|
import { ChipListSelectionContext as H, ChipListFocusContext as U, ChipListDataContext as W } from "./chip-list-contexts.mjs";
|
|
11
|
-
import { useDir as j, Keys as u, useMouse as q,
|
|
11
|
+
import { useDir as j, Keys as u, useMouse as q, classNames as I, getTabIndex as G, kendoThemeMaps as O, IconWrap as C, toIconName as E, svgIconPropType as x } from "@progress/kendo-react-common";
|
|
12
12
|
import { xCircleIcon as w } from "@progress/kendo-svg-icons";
|
|
13
13
|
import { FOCUS_ACTION as v } from "./focus-reducer.mjs";
|
|
14
14
|
import { CHIP_DATA_ACTION as J } from "./data-reducer.mjs";
|
|
15
|
-
import { SELECTION_ACTION as
|
|
15
|
+
import { SELECTION_ACTION as N } from "./selection-reducer.mjs";
|
|
16
16
|
const z = a.forwardRef((e, A) => {
|
|
17
17
|
const c = a.useRef(null), d = a.useRef(null), {
|
|
18
18
|
disabled: y = n.disabled,
|
|
19
19
|
fillMode: r = n.fillMode,
|
|
20
|
-
themeColor:
|
|
20
|
+
themeColor: D = n.themeColor,
|
|
21
21
|
size: f = n.size,
|
|
22
22
|
rounded: h = n.rounded,
|
|
23
23
|
dir: B = n.dir,
|
|
24
|
-
removeIcon:
|
|
24
|
+
removeIcon: R = n.removeIcon,
|
|
25
25
|
removeSvgIcon: F = n.removeSvgIcon,
|
|
26
26
|
removable: s = n.removable
|
|
27
|
-
} = e,
|
|
27
|
+
} = e, S = j(d, B);
|
|
28
28
|
a.useImperativeHandle(c, () => ({
|
|
29
29
|
element: d.current,
|
|
30
30
|
props: e
|
|
31
31
|
})), a.useImperativeHandle(A, () => c.current);
|
|
32
|
-
const [m, i] = a.useContext(H), [
|
|
32
|
+
const [m, i] = a.useContext(H), [T, o] = a.useContext(U), [, M] = a.useContext(W), k = a.useMemo(() => e.selected || (Array.isArray(m) ? m.some((t) => t === e.value) : m === e.value), [e.selected, e.value, m]), g = a.useMemo(() => T === e.value, [e.value, T]);
|
|
33
33
|
a.useEffect(() => {
|
|
34
|
-
|
|
35
|
-
}, [
|
|
34
|
+
g && d.current && d.current.focus();
|
|
35
|
+
}, [g]);
|
|
36
36
|
const K = a.useCallback(
|
|
37
37
|
(t) => {
|
|
38
|
-
i({ type:
|
|
38
|
+
i({ type: N.toggle, payload: e.value, event: t });
|
|
39
39
|
},
|
|
40
40
|
[i, e.value]
|
|
41
|
-
),
|
|
41
|
+
), b = a.useCallback(
|
|
42
42
|
(t) => {
|
|
43
|
-
s && (
|
|
43
|
+
s && (M({ type: J.remove, payload: e.value, event: t }), o({ type: v.reset, payload: e.value, event: t }), i({ type: N.remove, payload: e.value, event: t }), e.onRemove && e.onRemove.call(void 0, {
|
|
44
44
|
target: c.current,
|
|
45
45
|
syntheticEvent: t
|
|
46
46
|
}));
|
|
47
47
|
},
|
|
48
|
-
[e.onRemove, e.value, s,
|
|
48
|
+
[e.onRemove, e.value, s, M, o, i]
|
|
49
49
|
), $ = a.useCallback(
|
|
50
50
|
(t) => {
|
|
51
51
|
switch (t.keyCode) {
|
|
@@ -56,10 +56,10 @@ const z = a.forwardRef((e, A) => {
|
|
|
56
56
|
o({ type: v.next, payload: e.value, event: t });
|
|
57
57
|
break;
|
|
58
58
|
case u.enter:
|
|
59
|
-
i({ type:
|
|
59
|
+
i({ type: N.toggle, payload: e.value, event: t });
|
|
60
60
|
break;
|
|
61
61
|
case u.delete:
|
|
62
|
-
|
|
62
|
+
b(t);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
e.onKeyDown && e.onKeyDown.call(void 0, {
|
|
@@ -67,7 +67,7 @@ const z = a.forwardRef((e, A) => {
|
|
|
67
67
|
syntheticEvent: t
|
|
68
68
|
});
|
|
69
69
|
},
|
|
70
|
-
[e.onKeyDown, e.value, o, i,
|
|
70
|
+
[e.onKeyDown, e.value, o, i, b]
|
|
71
71
|
), L = a.useCallback(
|
|
72
72
|
(t) => {
|
|
73
73
|
o({ payload: e.value, type: v.current, event: t }), e.onFocus && e.onFocus.call(void 0, {
|
|
@@ -93,19 +93,19 @@ const z = a.forwardRef((e, A) => {
|
|
|
93
93
|
id: e.value,
|
|
94
94
|
style: e.style,
|
|
95
95
|
ref: d,
|
|
96
|
-
dir:
|
|
96
|
+
dir: S,
|
|
97
97
|
tabIndex: G(e.tabIndex, y, void 0),
|
|
98
|
-
className:
|
|
98
|
+
className: I(
|
|
99
99
|
"k-chip",
|
|
100
100
|
{
|
|
101
|
-
"k-rtl":
|
|
101
|
+
"k-rtl": S === "rtl",
|
|
102
102
|
"k-disabled": y,
|
|
103
103
|
"k-selected": k,
|
|
104
|
-
"k-focus":
|
|
104
|
+
"k-focus": g,
|
|
105
105
|
[`k-chip-${O.sizeMap[f] || f}`]: f,
|
|
106
106
|
[`k-rounded-${O.roundedMap[h] || h}`]: h,
|
|
107
107
|
[`k-chip-${r}`]: r,
|
|
108
|
-
[`k-chip-${r}-${
|
|
108
|
+
[`k-chip-${r}-${D}`]: !!(r && D)
|
|
109
109
|
},
|
|
110
110
|
e.className
|
|
111
111
|
),
|
|
@@ -118,19 +118,19 @@ const z = a.forwardRef((e, A) => {
|
|
|
118
118
|
onKeyDown: $
|
|
119
119
|
},
|
|
120
120
|
k && (e.selectedIcon || e.selectedSvgIcon) && /* @__PURE__ */ a.createElement(
|
|
121
|
-
|
|
121
|
+
C,
|
|
122
122
|
{
|
|
123
123
|
className: "k-chip-icon",
|
|
124
|
-
name: e.selectedIcon ?
|
|
124
|
+
name: e.selectedIcon ? E(e.selectedIcon) : void 0,
|
|
125
125
|
icon: e.selectedSvgIcon,
|
|
126
126
|
size: "small"
|
|
127
127
|
}
|
|
128
128
|
),
|
|
129
129
|
(e.icon || e.svgIcon) && /* @__PURE__ */ a.createElement(
|
|
130
|
-
|
|
130
|
+
C,
|
|
131
131
|
{
|
|
132
132
|
className: "k-chip-icon",
|
|
133
|
-
name: e.icon ?
|
|
133
|
+
name: e.icon ? E(e.icon) : void 0,
|
|
134
134
|
icon: e.svgIcon,
|
|
135
135
|
size: "small"
|
|
136
136
|
}
|
|
@@ -138,16 +138,20 @@ const z = a.forwardRef((e, A) => {
|
|
|
138
138
|
e.avatar && /* @__PURE__ */ a.createElement(
|
|
139
139
|
"div",
|
|
140
140
|
{
|
|
141
|
-
className:
|
|
141
|
+
className: I(
|
|
142
|
+
"k-chip-avatar",
|
|
143
|
+
"k-avatar",
|
|
144
|
+
e.avatar.rounded && `k-rounded-${e.avatar.rounded}`
|
|
145
|
+
),
|
|
142
146
|
style: e.avatar.style
|
|
143
147
|
},
|
|
144
148
|
/* @__PURE__ */ a.createElement("span", { className: "k-avatar-image" }, /* @__PURE__ */ a.createElement("img", { src: e.avatar.image, alt: e.avatar.imageAlt }))
|
|
145
149
|
),
|
|
146
150
|
/* @__PURE__ */ a.createElement("span", { className: "k-chip-content" }, e.children !== void 0 ? e.children : e.text && /* @__PURE__ */ a.createElement("span", { "aria-label": e.ariaLabel || e.text, className: "k-chip-label" }, e.text)),
|
|
147
|
-
s && /* @__PURE__ */ a.createElement("span", { className: "k-chip-actions" }, /* @__PURE__ */ a.createElement("span", { className:
|
|
148
|
-
|
|
151
|
+
s && /* @__PURE__ */ a.createElement("span", { className: "k-chip-actions" }, /* @__PURE__ */ a.createElement("span", { className: I("k-chip-action", "k-chip-remove-action"), onClick: b }, /* @__PURE__ */ a.createElement(
|
|
152
|
+
C,
|
|
149
153
|
{
|
|
150
|
-
name:
|
|
154
|
+
name: R ? E(R) : void 0,
|
|
151
155
|
icon: F || w,
|
|
152
156
|
size: "small"
|
|
153
157
|
}
|
|
@@ -160,31 +164,31 @@ const z = a.forwardRef((e, A) => {
|
|
|
160
164
|
dir: l.oneOf(["ltr", "rtl"]),
|
|
161
165
|
removable: l.bool,
|
|
162
166
|
removeIcon: l.string,
|
|
163
|
-
removeIconSvg:
|
|
167
|
+
removeIconSvg: x,
|
|
164
168
|
disabled: l.bool,
|
|
165
169
|
icon: l.string,
|
|
166
|
-
svgIcon:
|
|
170
|
+
svgIcon: x,
|
|
167
171
|
selectedIcon: l.string,
|
|
168
|
-
selectedIconSvg:
|
|
172
|
+
selectedIconSvg: x,
|
|
169
173
|
onRemove: l.func,
|
|
170
174
|
dataItem: l.any,
|
|
171
175
|
selected: l.bool,
|
|
172
176
|
ariaDescribedBy: l.string,
|
|
173
|
-
size: l.oneOf([
|
|
174
|
-
rounded: l.oneOf([
|
|
175
|
-
fillMode: l.oneOf([
|
|
177
|
+
size: l.oneOf(["small", "medium", "large"]),
|
|
178
|
+
rounded: l.oneOf(["small", "medium", "large", "full"]),
|
|
179
|
+
fillMode: l.oneOf(["outline", "solid"]),
|
|
176
180
|
// eslint-disable-next-line max-len
|
|
177
|
-
themeColor: l.oneOf([
|
|
181
|
+
themeColor: l.oneOf(["base", "info", "success", "warning", "error"])
|
|
178
182
|
}, n = {
|
|
179
183
|
disabled: !1,
|
|
180
184
|
removable: !1,
|
|
181
185
|
removeIcon: "k-i-x-circle",
|
|
182
186
|
removeSvgIcon: w,
|
|
183
187
|
dir: "ltr",
|
|
184
|
-
size:
|
|
185
|
-
rounded:
|
|
186
|
-
fillMode:
|
|
187
|
-
themeColor:
|
|
188
|
+
size: void 0,
|
|
189
|
+
rounded: void 0,
|
|
190
|
+
fillMode: void 0,
|
|
191
|
+
themeColor: void 0
|
|
188
192
|
};
|
|
189
193
|
z.displayName = "KendoReactChip";
|
|
190
194
|
z.propTypes = Q;
|