@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,234 +0,0 @@
1
- import * as React from 'react';
2
- import { SVGIcon } from '@progress/kendo-react-common';
3
- import { ChipRemoveEvent, ChipMouseEvent, ChipFocusEvent, ChipKeyboardEvent } from './../models/index';
4
- /**
5
- * Represents the properties of [Chip]({% slug api_buttons_chip %}) component.
6
- */
7
- export interface ChipProps {
8
- /**
9
- * Sets the `id` property of the top div element of the Chip.
10
- */
11
- id?: string;
12
- /**
13
- * Sets additional classes to the Chip.
14
- */
15
- className?: string;
16
- /**
17
- * The React elements that will be rendered as custom content inside the Chip.
18
- */
19
- children?: React.ReactNode;
20
- /**
21
- * Sets the `tabIndex` attribute.
22
- */
23
- tabIndex?: number;
24
- /**
25
- * Sets additional CSS styles to the Chip.
26
- */
27
- style?: React.CSSProperties;
28
- /**
29
- * Sets the label text of the Chip.
30
- */
31
- text?: string;
32
- /**
33
- * Sets the `id` value of the Chip.
34
- */
35
- value?: any;
36
- /**
37
- * The Chip direction 'ltr' as default or 'rtl'.
38
- */
39
- dir?: string;
40
- /**
41
- * Determines if the Chip could be removed.
42
- */
43
- removable?: boolean;
44
- /**
45
- * Determines if the Chip has custom font `removeIcon`.
46
- */
47
- removeIcon?: string;
48
- /**
49
- * Determines if the Chip has custom SVG `removeIcon`.
50
- */
51
- removeSvgIcon?: SVGIcon;
52
- /**
53
- * Determines if the Chip is disabled.
54
- */
55
- disabled?: boolean;
56
- /**
57
- * Determines if the Chip has a font `icon`.
58
- */
59
- icon?: string;
60
- /**
61
- * Determines if the Chip has an SVG `icon`.
62
- */
63
- svgIcon?: SVGIcon;
64
- /**
65
- * Determines if the Chip has an avatar.
66
- */
67
- avatar?: ChipAvatarProps;
68
- /**
69
- * Determines if the Chip has custom selection font `icon`.
70
- */
71
- selectedIcon?: string;
72
- /**
73
- * Determines if the Chip has custom selection SVG `icon`.
74
- */
75
- selectedSvgIcon?: SVGIcon;
76
- /**
77
- * Triggered on Chip removing.
78
- */
79
- onRemove?: (event: ChipRemoveEvent) => void;
80
- /**
81
- * Triggered on `onClick` event.
82
- */
83
- onClick?: (event: ChipMouseEvent) => void;
84
- /**
85
- * Triggered on `onMouseDown` event.
86
- */
87
- onMouseDown?: (event: ChipMouseEvent) => void;
88
- /**
89
- * Triggered on `onMouseUp` event.
90
- */
91
- onMouseUp?: (event: ChipMouseEvent) => void;
92
- /**
93
- * Triggered on `onDoubleClick` event.
94
- */
95
- onDoubleClick?: (event: ChipMouseEvent) => void;
96
- /**
97
- * Triggered on `onMouseEnter` event.
98
- */
99
- onMouseEnter?: (event: ChipMouseEvent) => void;
100
- /**
101
- * Triggered on `onMouseLeave` event.
102
- */
103
- onMouseLeave?: (event: ChipMouseEvent) => void;
104
- /**
105
- * Triggered on `onMouseMove` event.
106
- */
107
- onMouseMove?: (event: ChipMouseEvent) => void;
108
- /**
109
- * Triggered on `onMouseOut` event.
110
- */
111
- onMouseOut?: (event: ChipMouseEvent) => void;
112
- /**
113
- * Triggered on `onMouseOver` event.
114
- */
115
- onMouseOver?: (event: ChipMouseEvent) => void;
116
- /**
117
- * Triggered on `onKeyDown` event.
118
- */
119
- onKeyDown?: (event: ChipKeyboardEvent) => void;
120
- /**
121
- * Triggered on `onFocus` event.
122
- */
123
- onFocus?: (event: ChipFocusEvent) => void;
124
- /**
125
- * Triggered on `onBlur` event.
126
- */
127
- onBlur?: (event: ChipFocusEvent) => void;
128
- /**
129
- * Represents the item data, coming from the `ChipList` component.
130
- */
131
- dataItem?: any;
132
- /**
133
- * Determines if the Chip is selected.
134
- */
135
- selected?: boolean;
136
- /**
137
- * Identifies the element(s) which will 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).
138
- * For example, these elements could contain an error or a hint message.
139
- */
140
- ariaDescribedBy?: string;
141
- /**
142
- * @hidden
143
- */
144
- role?: string;
145
- /**
146
- * Configures the `size` of the Chip.
147
- *
148
- * The available options are:
149
- * - small
150
- * - medium
151
- * - large
152
- * - null—Does not set a size `className`.
153
- *
154
- * @default `medium`
155
- */
156
- size?: null | 'small' | 'medium' | 'large';
157
- /**
158
- * Configures the `roundness` of the Chip.
159
- *
160
- * The available options are:
161
- * - small
162
- * - medium
163
- * - large
164
- * - full
165
- * - null—Does not set a rounded `className`.
166
- *
167
- * @default `medium`
168
- */
169
- rounded?: null | 'small' | 'medium' | 'large' | 'full';
170
- /**
171
- * Configures the `fillMode` of the Chip.
172
- *
173
- * The available options are:
174
- * - solid
175
- * - outline
176
- * - null—Does not set a fillMode `className`.
177
- *
178
- * @default `solid`
179
- */
180
- fillMode?: null | 'solid' | 'outline';
181
- /**
182
- * Configures the `themeColor` of the Chip.
183
- *
184
- * The available options are:
185
- * - base
186
- * - info
187
- * - success
188
- * - warning
189
- * - error
190
- * - null—Does not set a themeColor `className`.
191
- *
192
- * @default `base`
193
- */
194
- themeColor?: null | 'base' | 'info' | 'success' | 'warning' | 'error';
195
- /**
196
- * Represents the label of the Chip component.
197
- */
198
- ariaLabel?: string;
199
- }
200
- /**
201
- * Represents the target(element and props) of the ChipRemoveEvent.
202
- */
203
- export interface ChipHandle {
204
- /**
205
- * The current element or `null` if there is no one.
206
- */
207
- element: HTMLDivElement | null;
208
- /**
209
- * The props values of the Chip.
210
- */
211
- props: ChipProps;
212
- }
213
- export interface ChipAvatarProps {
214
- /**
215
- * Sets the image of the avatar.
216
- */
217
- image: string;
218
- /**
219
- * Defines the alternative text of the avatar image.
220
- */
221
- imageAlt: string;
222
- /**
223
- * Configures the `roundness` of the avatar
224
- */
225
- rounded?: null | 'small' | 'medium' | 'large' | 'full';
226
- /**
227
- * Sets additional CSS styles to the avatar
228
- */
229
- style?: React.CSSProperties;
230
- }
231
- /**
232
- * Represents the Chip component.
233
- */
234
- export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<ChipHandle | null>>;
@@ -1,173 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import * as React from 'react';
13
- import * as PropTypes from 'prop-types';
14
- import { ChipListSelectionContext, ChipListFocusContext, ChipListDataContext } from './ChipList';
15
- import { classNames, useDir, getTabIndex, Keys, IconWrap, kendoThemeMaps, toIconName, svgIconPropType } from '@progress/kendo-react-common';
16
- import { xCircleIcon } from '@progress/kendo-svg-icons';
17
- import { FOCUS_ACTION } from './focus-reducer';
18
- import { CHIP_DATA_ACTION } from './data-reducer';
19
- import { SELECTION_ACTION } from './selection-reducer';
20
- import { validatePackage } from '@progress/kendo-react-common';
21
- import { packageMetadata } from '../package-metadata';
22
- import { useMouse } from '@progress/kendo-react-common';
23
- /**
24
- * Represents the Chip component.
25
- */
26
- export var Chip = React.forwardRef(function (props, ref) {
27
- var _a;
28
- validatePackage(packageMetadata);
29
- var target = React.useRef(null);
30
- var chipRef = React.useRef(null);
31
- var dir = useDir(chipRef, props.dir);
32
- React.useImperativeHandle(target, function () { return ({
33
- element: chipRef.current,
34
- props: props
35
- }); });
36
- React.useImperativeHandle(ref, function () { return target.current; });
37
- var _b = React.useContext(ChipListSelectionContext), selection = _b[0], dispatchSelection = _b[1];
38
- var _c = React.useContext(ChipListFocusContext), focus = _c[0], dispatchFocus = _c[1];
39
- var _d = React.useContext(ChipListDataContext), dispatchData = _d[1];
40
- var selected = React.useMemo(function () {
41
- return (props.selected || (Array.isArray(selection)
42
- ? selection.some(function (i) { return i === props.value; })
43
- : selection === props.value));
44
- }, [props.selected, props.value, selection]);
45
- var focused = React.useMemo(function () { return focus === props.value; }, [props.value, focus]);
46
- React.useEffect(function () {
47
- if (focused && chipRef.current) {
48
- chipRef.current.focus();
49
- }
50
- }, [focused]);
51
- var handleClick = React.useCallback(function (event) {
52
- dispatchSelection({ type: SELECTION_ACTION.toggle, payload: props.value, event: event });
53
- }, [dispatchSelection, props.value]);
54
- var handleRemove = React.useCallback(function (event) {
55
- if (!props.removable) {
56
- return;
57
- }
58
- dispatchData({ type: CHIP_DATA_ACTION.remove, payload: props.value, event: event });
59
- dispatchFocus({ type: FOCUS_ACTION.reset, payload: props.value, event: event });
60
- dispatchSelection({ type: SELECTION_ACTION.remove, payload: props.value, event: event });
61
- if (props.onRemove) {
62
- props.onRemove.call(undefined, {
63
- target: target.current,
64
- syntheticEvent: event
65
- });
66
- }
67
- }, [props.onRemove, props.value, props.removable, dispatchData, dispatchFocus, dispatchSelection]);
68
- var handleKeyDown = React.useCallback(function (event) {
69
- switch (event.keyCode) {
70
- case Keys.left:
71
- dispatchFocus({ type: FOCUS_ACTION.prev, payload: props.value, event: event });
72
- break;
73
- case Keys.right:
74
- dispatchFocus({ type: FOCUS_ACTION.next, payload: props.value, event: event });
75
- break;
76
- case Keys.enter:
77
- dispatchSelection({ type: SELECTION_ACTION.toggle, payload: props.value, event: event });
78
- break;
79
- case Keys.delete:
80
- handleRemove(event);
81
- break;
82
- default:
83
- break;
84
- }
85
- if (props.onKeyDown) {
86
- props.onKeyDown.call(undefined, {
87
- target: target.current,
88
- syntheticEvent: event
89
- });
90
- }
91
- }, [props.onKeyDown, props.value, dispatchFocus, dispatchSelection, handleRemove]);
92
- var handleFocus = React.useCallback(function (event) {
93
- dispatchFocus({ payload: props.value, type: FOCUS_ACTION.current, event: event });
94
- if (props.onFocus) {
95
- props.onFocus.call(undefined, {
96
- target: target.current,
97
- syntheticEvent: event
98
- });
99
- }
100
- }, [props.onFocus, props.value, dispatchFocus]);
101
- var handleBlur = React.useCallback(function (event) {
102
- if (props.onBlur) {
103
- props.onBlur.call(undefined, {
104
- target: target.current,
105
- syntheticEvent: event
106
- });
107
- }
108
- }, [props.onBlur]);
109
- var mouseProps = useMouse(props, target, { onClick: handleClick });
110
- return (React.createElement("div", __assign({}, mouseProps, { role: props.role, id: props.value, style: props.style, ref: chipRef, dir: dir, tabIndex: getTabIndex(props.tabIndex, props.disabled, undefined), className: classNames('k-chip', (_a = {
111
- 'k-rtl': dir === 'rtl',
112
- 'k-disabled': props.disabled,
113
- 'k-selected': selected,
114
- 'k-focus': focused
115
- },
116
- _a["k-chip-".concat(kendoThemeMaps.sizeMap[props.size] || props.size)] = props.size,
117
- _a["k-rounded-".concat(kendoThemeMaps.roundedMap[props.rounded] || props.rounded)] = props.rounded,
118
- _a["k-chip-".concat(props.fillMode)] = props.fillMode,
119
- _a["k-chip-".concat(props.fillMode, "-").concat(props.themeColor)] = Boolean(props.fillMode && props.themeColor),
120
- _a), props.className), "aria-checked": selected, "aria-disabled": props.disabled, "aria-describedby": props.ariaDescribedBy, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown }),
121
- (selected && (props.selectedIcon || props.selectedSvgIcon)) &&
122
- React.createElement(IconWrap, { className: 'k-chip-icon', name: props.selectedIcon ? toIconName(props.selectedIcon) : undefined, icon: props.selectedSvgIcon, size: 'small' }),
123
- (props.icon || props.svgIcon) &&
124
- React.createElement(IconWrap, { className: 'k-chip-icon', name: props.icon ? toIconName(props.icon) : undefined, icon: props.svgIcon, size: 'small' }),
125
- (props.avatar) &&
126
- React.createElement("div", { className: "k-chip-avatar k-avatar k-rounded-".concat(props.avatar.rounded, " k-avatar-md k-avatar-solid k-avatar-solid-primary"), style: props.avatar.style },
127
- React.createElement("span", { className: "k-avatar-image" },
128
- React.createElement("img", { src: props.avatar.image, alt: props.avatar.imageAlt }))),
129
- React.createElement("span", { className: 'k-chip-content' }, props.children !== undefined
130
- ? props.children
131
- : props.text &&
132
- React.createElement("span", { "aria-label": props.ariaLabel || props.text, className: 'k-chip-label' }, props.text)),
133
- props.removable && (React.createElement("span", { className: "k-chip-actions" },
134
- React.createElement("span", { className: classNames('k-chip-action', 'k-chip-remove-action'), onClick: handleRemove },
135
- React.createElement(IconWrap, { name: props.removeIcon ? toIconName(props.removeIcon) : undefined, icon: props.removeSvgIcon || xCircleIcon, size: 'small' }))))));
136
- });
137
- var propTypes = {
138
- id: PropTypes.string,
139
- text: PropTypes.string,
140
- value: PropTypes.any,
141
- dir: PropTypes.oneOf(['ltr', 'rtl']),
142
- removable: PropTypes.bool,
143
- removeIcon: PropTypes.string,
144
- removeIconSvg: svgIconPropType,
145
- disabled: PropTypes.bool,
146
- icon: PropTypes.string,
147
- svgIcon: svgIconPropType,
148
- selectedIcon: PropTypes.string,
149
- selectedIconSvg: svgIconPropType,
150
- onRemove: PropTypes.func,
151
- dataItem: PropTypes.any,
152
- selected: PropTypes.bool,
153
- ariaDescribedBy: PropTypes.string,
154
- size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
155
- rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
156
- fillMode: PropTypes.oneOf([null, 'outline', 'solid']),
157
- // eslint-disable-next-line max-len
158
- themeColor: PropTypes.oneOf([null, 'base', 'info', 'success', 'warning', 'error'])
159
- };
160
- var defaultProps = {
161
- disabled: false,
162
- removable: false,
163
- removeIcon: 'k-i-x-circle',
164
- dir: 'ltr',
165
- size: 'medium',
166
- rounded: 'medium',
167
- fillMode: 'solid',
168
- themeColor: 'base'
169
- };
170
- Chip.displayName = 'KendoReactChip';
171
- // TODO: delete casting when @types/react is updated!
172
- Chip.propTypes = propTypes;
173
- Chip.defaultProps = defaultProps;
@@ -1,123 +0,0 @@
1
- import * as React from 'react';
2
- import { FormComponentProps, KendoMouse } from '@progress/kendo-react-common';
3
- import { ChipProps } from './Chip';
4
- import { ChipListChangeEvent, ChipListDataChangeEvent } from './../models/index';
5
- /**
6
- * Represents the properties of [ChipList]({% slug api_buttons_chiplist %}) component.
7
- */
8
- export interface ChipListProps extends FormComponentProps, KendoMouse<ChipListHandle, HTMLDivElement> {
9
- /**
10
- * Sets the `id` property of the top div element of the ChipList.
11
- */
12
- id?: string;
13
- /**
14
- * Sets additional classes to the ChipList.
15
- */
16
- className?: string;
17
- /**
18
- * Sets the `tabIndex` attribute.
19
- */
20
- tabIndex?: number;
21
- /**
22
- * Sets additional CSS styles to the ChipList.
23
- */
24
- style?: React.CSSProperties;
25
- /**
26
- * Represents Chip component.
27
- */
28
- chip?: React.ComponentType<ChipProps>;
29
- /**
30
- * Represents the data about the child Chips.
31
- */
32
- data?: any;
33
- /**
34
- * Represents the default data about the child Chips.
35
- */
36
- defaultData?: any[];
37
- /**
38
- * Triggered after Chip data change.
39
- */
40
- onDataChange?: (event: ChipListDataChangeEvent) => void;
41
- /**
42
- * Represents the selection state of Chip component.
43
- */
44
- value?: any | any[];
45
- /**
46
- * Represents the default value of the selection state of Chip component.
47
- */
48
- defaultValue?: any | any[];
49
- /**
50
- * Triggered after value change.
51
- */
52
- onChange?: (event: ChipListChangeEvent) => void;
53
- /**
54
- * Represents the selection state of Chip component.
55
- */
56
- selection?: string;
57
- /**
58
- * Represents the `text` field of Chip, used for the `label`.
59
- */
60
- textField?: string;
61
- /**
62
- * Represents the `value` field of Chip, used for setting the Chip `id`.
63
- */
64
- valueField?: string;
65
- /**
66
- * Determines of ChipList is disabled.
67
- */
68
- disabled?: boolean;
69
- /**
70
- * The ChipList direction 'ltr' as default or 'rtl'.
71
- */
72
- dir?: string;
73
- /**
74
- * Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
75
- * For example these elements could contain error or hint message.
76
- */
77
- ariaDescribedBy?: string;
78
- /**
79
- * Identifies the element(s) which will label the component.
80
- */
81
- ariaLabelledBy?: string;
82
- /**
83
- * Configures the `size` of the ChipList.
84
- *
85
- * The available options are:
86
- * - small
87
- * - medium
88
- * - large
89
- * - null&mdash;Does not set a size `className`.
90
- *
91
- * @default `medium`
92
- */
93
- size?: null | 'small' | 'medium' | 'large';
94
- }
95
- /**
96
- * Represents the target(element and props) of the ChipListChangeEvent.
97
- */
98
- export interface ChipListHandle {
99
- /**
100
- * The current element or `null` if there is no one.
101
- */
102
- element: HTMLDivElement | null;
103
- /**
104
- * The props values of the ChipList.
105
- */
106
- props: ChipListProps;
107
- }
108
- /**
109
- * @hidden
110
- */
111
- export declare const ChipListSelectionContext: React.Context<[string | string[] | null, Function]>;
112
- /**
113
- * @hidden
114
- */
115
- export declare const ChipListFocusContext: React.Context<[string | string[] | null, Function]>;
116
- /**
117
- * @hidden
118
- */
119
- export declare const ChipListDataContext: React.Context<[string | null, Function]>;
120
- /**
121
- * Represents the ChipList component.
122
- */
123
- export declare const ChipList: React.ForwardRefExoticComponent<ChipListProps & React.RefAttributes<ChipListHandle | null>>;