@progress/kendo-react-tooltip 7.2.4-develop.3 → 7.2.4-develop.4
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/dist/cdn/js/kendo-react-tooltip.js +8 -5
- package/index.d.mts +520 -5
- package/index.d.ts +520 -23
- package/index.js +8 -5
- package/index.mjs +13 -466
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +3 -3
- package/popover/Popover.js +8 -0
- package/popover/Popover.mjs +185 -0
- package/popover/PopoverActionsBar.js +8 -0
- package/popover/PopoverActionsBar.mjs +45 -0
- package/tooltip/Tooltip.js +8 -0
- package/tooltip/Tooltip.mjs +220 -0
- package/tooltip/utils.js +8 -0
- package/tooltip/utils.mjs +59 -0
- package/package-metadata.d.ts +0 -9
- package/popover/Popover.d.ts +0 -19
- package/popover/PopoverActionsBar.d.ts +0 -23
- package/popover/interfaces/Align.d.ts +0 -28
- package/popover/interfaces/PopoverActionsBarProps.d.ts +0 -31
- package/popover/interfaces/PopoverAnimation.d.ts +0 -10
- package/popover/interfaces/PopoverCloseEvent.d.ts +0 -14
- package/popover/interfaces/PopoverCollision.d.ts +0 -18
- package/popover/interfaces/PopoverCollisionType.d.ts +0 -14
- package/popover/interfaces/PopoverMargin.d.ts +0 -18
- package/popover/interfaces/PopoverOffset.d.ts +0 -18
- package/popover/interfaces/PopoverOpenEvent.d.ts +0 -14
- package/popover/interfaces/PopoverPosition.d.ts +0 -13
- package/popover/interfaces/PopoverPositionEvent.d.ts +0 -22
- package/popover/interfaces/PopoverPositionMode.d.ts +0 -9
- package/popover/interfaces/PopoverProps.d.ts +0 -115
- package/tooltip/Tooltip.d.ts +0 -89
- package/tooltip/TooltipProps.d.ts +0 -112
- package/tooltip/events.d.ts +0 -35
- package/tooltip/utils.d.ts +0 -28
package/index.d.ts
CHANGED
|
@@ -1,23 +1,520 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 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 { BaseEvent } from '@progress/kendo-react-common';
|
|
9
|
+
import { CollisionType } from '@progress/kendo-react-popup';
|
|
10
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
11
|
+
import { Margin } from '@progress/kendo-react-popup';
|
|
12
|
+
import { Offset } from '@progress/kendo-react-popup';
|
|
13
|
+
import { PopupAnimation } from '@progress/kendo-react-popup';
|
|
14
|
+
import { PositionMode } from '@progress/kendo-react-popup';
|
|
15
|
+
import PropTypes from 'prop-types';
|
|
16
|
+
import * as React_2 from 'react';
|
|
17
|
+
import { ZIndexContext } from '@progress/kendo-react-common';
|
|
18
|
+
import { ZIndexContextType } from '@progress/kendo-react-common';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Popover component.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Popover: React_2.ForwardRefExoticComponent<PopoverProps & React_2.RefAttributes<PopoverHandle | null>>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Represents the PopoverActionsBar component.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PopoverActionsBar: React_2.ForwardRefExoticComponent<PopoverActionsBarProps & React_2.RefAttributes<PopoverActionsBarHandle | null>>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents the Object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the PopoverActionBar component.
|
|
32
|
+
*/
|
|
33
|
+
export declare interface PopoverActionsBarHandle {
|
|
34
|
+
/**
|
|
35
|
+
* The props of the PopoverActionsBar.
|
|
36
|
+
*/
|
|
37
|
+
props: PopoverActionsBarProps;
|
|
38
|
+
/**
|
|
39
|
+
* The current element or `null` if there is none.
|
|
40
|
+
*/
|
|
41
|
+
element: HTMLDivElement | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Represents the props of the [KendoReact PopoverActionsBar]({% slug api_tooltip_popoveractionsbar %}) component.
|
|
46
|
+
*/
|
|
47
|
+
export declare interface PopoverActionsBarProps {
|
|
48
|
+
/**
|
|
49
|
+
* Sets the horizontal alignment of the PopoverActionsBar buttons.
|
|
50
|
+
*
|
|
51
|
+
* The possible values are:
|
|
52
|
+
* * `start`
|
|
53
|
+
* * `center`
|
|
54
|
+
* * `end`
|
|
55
|
+
* * `stretched` (default)
|
|
56
|
+
*/
|
|
57
|
+
alignment?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the orientation of the PopoverActionsBar buttons.
|
|
60
|
+
*
|
|
61
|
+
* The possible values are:
|
|
62
|
+
* * `horizontal` (default)
|
|
63
|
+
* * `vertical`
|
|
64
|
+
*/
|
|
65
|
+
orientation?: string;
|
|
66
|
+
/**
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The animation settings of the Popover.
|
|
74
|
+
*/
|
|
75
|
+
export declare interface PopoverAnimation extends PopupAnimation {
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Represents the object of the `Close` Popover event.
|
|
80
|
+
*/
|
|
81
|
+
export declare interface PopoverCloseEvent {
|
|
82
|
+
/**
|
|
83
|
+
* An event target.
|
|
84
|
+
*/
|
|
85
|
+
target: PopoverHandle;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Defines the horizontal and vertical collision behavior of the Popover.
|
|
90
|
+
*/
|
|
91
|
+
export declare interface PopoverCollision {
|
|
92
|
+
/**
|
|
93
|
+
* Defines the horizontal collision behavior of the Popover.
|
|
94
|
+
*/
|
|
95
|
+
horizontal: PopoverCollisionType;
|
|
96
|
+
/**
|
|
97
|
+
* Defines the vertical collision behavior of the Popover.
|
|
98
|
+
*/
|
|
99
|
+
vertical: PopoverCollisionType;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Defines the possible collision behavior when the Popover is not fully visible.
|
|
104
|
+
*
|
|
105
|
+
* The available options are:
|
|
106
|
+
* - `fit`—Moves the Popover horizontally until it is fully displayed in the viewport.
|
|
107
|
+
* - `flip`—Flips the Popover position based on the origin and the position properties.
|
|
108
|
+
* - `none`—The Popover is rendered at its original position. Usable when the Popover is focused on open and the page is scrolled to it.
|
|
109
|
+
*/
|
|
110
|
+
export declare type PopoverCollisionType = CollisionType;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Represents the Object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the Popover component.
|
|
114
|
+
*/
|
|
115
|
+
export declare interface PopoverHandle {
|
|
116
|
+
/**
|
|
117
|
+
* The props of the Popover.
|
|
118
|
+
*/
|
|
119
|
+
props: PopoverProps;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Defines the horizontal and the vertical margin offset of the component.
|
|
124
|
+
*/
|
|
125
|
+
export declare interface PopoverMargin extends Margin {
|
|
126
|
+
/**
|
|
127
|
+
* Defines the possible horizontal margin value.
|
|
128
|
+
*/
|
|
129
|
+
horizontal: number;
|
|
130
|
+
/**
|
|
131
|
+
* Defines the possible vertical margin value.
|
|
132
|
+
*/
|
|
133
|
+
vertical: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The offset position of the Popover.
|
|
138
|
+
*/
|
|
139
|
+
export declare interface PopoverOffset extends Offset {
|
|
140
|
+
/**
|
|
141
|
+
* Defines the top position of the Popover.
|
|
142
|
+
*/
|
|
143
|
+
top: number;
|
|
144
|
+
/**
|
|
145
|
+
* Defines the left position of the Popover.
|
|
146
|
+
*/
|
|
147
|
+
left: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Represents the object of the `Open` Popover event.
|
|
152
|
+
*/
|
|
153
|
+
export declare interface PopoverOpenEvent {
|
|
154
|
+
/**
|
|
155
|
+
* An event target.
|
|
156
|
+
*/
|
|
157
|
+
target: PopoverHandle;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The position of the Popover.
|
|
162
|
+
* The available options are:
|
|
163
|
+
* - `top`
|
|
164
|
+
* - `left`
|
|
165
|
+
* - `bottom`
|
|
166
|
+
* - `right`
|
|
167
|
+
*/
|
|
168
|
+
export declare type PopoverPosition = 'top' | 'left' | 'bottom' | 'right';
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Represents the object of the `Position` Popover event.
|
|
172
|
+
*/
|
|
173
|
+
export declare interface PopoverPositionEvent {
|
|
174
|
+
/**
|
|
175
|
+
* An event target.
|
|
176
|
+
*/
|
|
177
|
+
target: PopoverHandle;
|
|
178
|
+
/**
|
|
179
|
+
* Indicates if the position is fitted.
|
|
180
|
+
*/
|
|
181
|
+
fitted: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Indicates if the position is flipped.
|
|
184
|
+
*/
|
|
185
|
+
flipped: boolean;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The type which defines all possible position modes of the Popover.
|
|
190
|
+
*/
|
|
191
|
+
export declare type PopoverPositionMode = PositionMode;
|
|
192
|
+
|
|
193
|
+
export declare interface PopoverProps {
|
|
194
|
+
/**
|
|
195
|
+
* Specifies the title of the Popover component.
|
|
196
|
+
*/
|
|
197
|
+
title?: React.ReactNode;
|
|
198
|
+
/**
|
|
199
|
+
* Specifies the position of the Popover element relative to the current anchor or offset.
|
|
200
|
+
*/
|
|
201
|
+
position?: PopoverPosition;
|
|
202
|
+
/**
|
|
203
|
+
* Controls the Popover callout element. If set to `false`, the callout element will not be rendered.
|
|
204
|
+
*/
|
|
205
|
+
callout?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Controls the Popover animation. By default, the opening and closing animations are enabled.
|
|
208
|
+
*/
|
|
209
|
+
animate?: boolean | PopoverAnimation;
|
|
210
|
+
/**
|
|
211
|
+
* Specifies the element which will be used as an anchor. The Popover opens next to that element.
|
|
212
|
+
*/
|
|
213
|
+
anchor?: HTMLElement | null;
|
|
214
|
+
/**
|
|
215
|
+
* Defines the container to which the Popover will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
|
|
216
|
+
* * If set to `null` the Popover will be rendered without React Portal.
|
|
217
|
+
*/
|
|
218
|
+
appendTo?: HTMLElement | null;
|
|
219
|
+
/**
|
|
220
|
+
* Configures the collision behavior of the Popover. By default, it's set to `none`.
|
|
221
|
+
*/
|
|
222
|
+
collision?: PopoverCollision;
|
|
223
|
+
/**
|
|
224
|
+
* Configures the margin value that will be added to the Popover dimensions
|
|
225
|
+
* in pixels and leaves a blank space between the Popover and the anchor.
|
|
226
|
+
* By default, it's automatically set based on the Popover position prop.
|
|
227
|
+
*
|
|
228
|
+
*/
|
|
229
|
+
margin?: PopoverMargin;
|
|
230
|
+
/**
|
|
231
|
+
* Specifies the position mode of the component. By default, the Popover uses fixed positioning.
|
|
232
|
+
* To make the Popover acquire absolute positioning, set this option to `absolute`.
|
|
233
|
+
*
|
|
234
|
+
* > If you need to support mobile browsers with the zoom option, use the `absolute` positioning of the Popover.
|
|
235
|
+
*/
|
|
236
|
+
positionMode?: PopoverPositionMode;
|
|
237
|
+
/**
|
|
238
|
+
* Used to set the document scale when using a [scale transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale).
|
|
239
|
+
*
|
|
240
|
+
* The document or container scale is required to compute the popover position correctly. Detecting the scale is not reliable and must be set by providing a value for SCALE.
|
|
241
|
+
*
|
|
242
|
+
* > Using this token is not necessary for user-applied browser zoom.
|
|
243
|
+
*
|
|
244
|
+
*/
|
|
245
|
+
scale?: number;
|
|
246
|
+
/**
|
|
247
|
+
* Specifies the absolute position of the element.
|
|
248
|
+
* The Popover opens next to that point. The pivot point of the Popover is defined by the `position` configuration option.
|
|
249
|
+
* The boundary detection is applied by using the window viewport.
|
|
250
|
+
*/
|
|
251
|
+
offset?: PopoverOffset;
|
|
252
|
+
/**
|
|
253
|
+
* Specifies a list of CSS classes that will be added to the internal animated element.
|
|
254
|
+
*/
|
|
255
|
+
popoverClass?: string | Array<string> | {
|
|
256
|
+
[key: string]: boolean;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Specifies a list of CSS classes that will be added to the Popover element.
|
|
260
|
+
*/
|
|
261
|
+
className?: string | Array<string>;
|
|
262
|
+
/**
|
|
263
|
+
* Specifies the id that will be added to the Popover element.
|
|
264
|
+
*/
|
|
265
|
+
id?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Represents the styles that are applied to the Popover.
|
|
268
|
+
*/
|
|
269
|
+
style?: React.CSSProperties;
|
|
270
|
+
/**
|
|
271
|
+
* Represents the styles that are applied to the content element of the Popover.
|
|
272
|
+
*/
|
|
273
|
+
contentStyle?: React.CSSProperties;
|
|
274
|
+
/**
|
|
275
|
+
* Controls the Popover visibility. Defaults to `false`.
|
|
276
|
+
*/
|
|
277
|
+
show?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Fires after the Popover is opened and the opening animation ends.
|
|
280
|
+
*/
|
|
281
|
+
onOpen?: (event: PopoverOpenEvent) => void;
|
|
282
|
+
/**
|
|
283
|
+
* Fires after the Popover is closed.
|
|
284
|
+
*/
|
|
285
|
+
onClose?: (event: PopoverCloseEvent) => void;
|
|
286
|
+
/**
|
|
287
|
+
* Fires after the Popover position is set.
|
|
288
|
+
*/
|
|
289
|
+
onPosition?: (event: PopoverPositionEvent) => void;
|
|
290
|
+
/**
|
|
291
|
+
* @hidden
|
|
292
|
+
*/
|
|
293
|
+
children?: React.ReactNode;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export declare class Tooltip extends React_2.PureComponent<TooltipProps, TooltipState> {
|
|
297
|
+
/**
|
|
298
|
+
* @hidden
|
|
299
|
+
*/
|
|
300
|
+
static propTypes: {
|
|
301
|
+
anchorElement: PropTypes.Requireable<string>;
|
|
302
|
+
content: PropTypes.Requireable<(...args: any[]) => any>;
|
|
303
|
+
filter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
304
|
+
openDelay: PropTypes.Requireable<number>;
|
|
305
|
+
position: PropTypes.Requireable<string>;
|
|
306
|
+
updateInterval: PropTypes.Requireable<number>;
|
|
307
|
+
};
|
|
308
|
+
static defaultProps: {
|
|
309
|
+
anchorElement: string;
|
|
310
|
+
openDelay: number;
|
|
311
|
+
position: string;
|
|
312
|
+
showCallout: boolean;
|
|
313
|
+
parentTitle: boolean;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* @hidden
|
|
317
|
+
*/
|
|
318
|
+
static contextType: React_2.Context<ZIndexContextType>;
|
|
319
|
+
/**
|
|
320
|
+
* @hidden
|
|
321
|
+
*/
|
|
322
|
+
context: React_2.ContextType<typeof ZIndexContext>;
|
|
323
|
+
/**
|
|
324
|
+
* @hidden
|
|
325
|
+
*/
|
|
326
|
+
readonly state: TooltipState;
|
|
327
|
+
private top;
|
|
328
|
+
private left;
|
|
329
|
+
private openTimeoutId?;
|
|
330
|
+
private updateIntervalId?;
|
|
331
|
+
private willOpen;
|
|
332
|
+
constructor(props: TooltipProps);
|
|
333
|
+
/**
|
|
334
|
+
* @hidden
|
|
335
|
+
*/
|
|
336
|
+
componentDidMount(): void;
|
|
337
|
+
/**
|
|
338
|
+
* @hidden
|
|
339
|
+
*/
|
|
340
|
+
componentWillUnmount(): void;
|
|
341
|
+
/**
|
|
342
|
+
* @hidden
|
|
343
|
+
*/
|
|
344
|
+
componentDidUpdate(): void;
|
|
345
|
+
/**
|
|
346
|
+
* The method is used on the MouseOut event to hide the Tooltip.
|
|
347
|
+
*/
|
|
348
|
+
handleMouseOut: (event: any) => void;
|
|
349
|
+
/**
|
|
350
|
+
* Used on the `MouseOver` event to show the Tooltip.
|
|
351
|
+
*/
|
|
352
|
+
handleMouseOver: (event: any) => void;
|
|
353
|
+
/**
|
|
354
|
+
* @hidden
|
|
355
|
+
*/
|
|
356
|
+
render(): "" | JSX_2.Element | null;
|
|
357
|
+
private handleBodyMousemove;
|
|
358
|
+
private onClose;
|
|
359
|
+
private showToolTip;
|
|
360
|
+
private setUpdateInterval;
|
|
361
|
+
private onIntervalUpdate;
|
|
362
|
+
private isVisible;
|
|
363
|
+
private position;
|
|
364
|
+
private getTitle;
|
|
365
|
+
private calloutClassName;
|
|
366
|
+
private getCurrentZIndex;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export declare interface TooltipEvent extends BaseEvent<Tooltip> {
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* @hidden
|
|
374
|
+
*/
|
|
375
|
+
export declare type TooltipPosition = 'right' | 'left' | 'bottom' | 'top' | 'auto';
|
|
376
|
+
|
|
377
|
+
export declare interface TooltipPositionEvent extends BaseEvent<Tooltip> {
|
|
378
|
+
/**
|
|
379
|
+
* The Tooltip element. Useful to get the actual `width` and `height` of rendered Tooltip.
|
|
380
|
+
*/
|
|
381
|
+
element: HTMLDivElement;
|
|
382
|
+
/**
|
|
383
|
+
* The current target element. Useful to calculate `top` and `left` position of the Tooltip element.
|
|
384
|
+
*/
|
|
385
|
+
targetElement: HTMLElement | null;
|
|
386
|
+
/**
|
|
387
|
+
* The current mouse `top` position;
|
|
388
|
+
*/
|
|
389
|
+
mouseTop: number;
|
|
390
|
+
/**
|
|
391
|
+
* The current mouse `left` position.
|
|
392
|
+
*/
|
|
393
|
+
mouseLeft: number;
|
|
394
|
+
/**
|
|
395
|
+
* The Tooltip anchor element prop.
|
|
396
|
+
*/
|
|
397
|
+
anchorElement?: string;
|
|
398
|
+
/**
|
|
399
|
+
* The Tooltip position prop.
|
|
400
|
+
*/
|
|
401
|
+
position?: TooltipPosition;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Represents the props of the [KendoReact Tooltip component]({% slug overview_tooltip %}).
|
|
406
|
+
*/
|
|
407
|
+
export declare interface TooltipProps {
|
|
408
|
+
/**
|
|
409
|
+
* Specifies the `id` of the wrapping element of the Tooltip component.
|
|
410
|
+
*/
|
|
411
|
+
id?: string;
|
|
412
|
+
/**
|
|
413
|
+
* Sets the anchor element of the Tooltip.
|
|
414
|
+
*
|
|
415
|
+
* The available options are:
|
|
416
|
+
* - (Default) `pointer`—Shows a Tooltip where the cursor is located.
|
|
417
|
+
* - `target`—Positions the Tooltip based on the anchor element.
|
|
418
|
+
*/
|
|
419
|
+
anchorElement?: string;
|
|
420
|
+
/**
|
|
421
|
+
* Defines the container to which the Tooltip will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
|
|
422
|
+
*/
|
|
423
|
+
appendTo?: HTMLElement | null;
|
|
424
|
+
/**
|
|
425
|
+
* Sets the position of the Tooltip ([see example]({% slug positioning_tooltip %})).
|
|
426
|
+
*
|
|
427
|
+
* The available options are:
|
|
428
|
+
* - (Default) `auto`—Positions the Tooltip depending on the available space.
|
|
429
|
+
* - `right`—Positions the Tooltip to the right side of the element.
|
|
430
|
+
* - `left`—Positions the Tooltip to the left side of the element.
|
|
431
|
+
* - `bottom`—Positions the Tooltip at the bottom of the element.
|
|
432
|
+
* - `top`—Positions the Tooltip at the top of the element.
|
|
433
|
+
*/
|
|
434
|
+
position?: TooltipPosition;
|
|
435
|
+
/**
|
|
436
|
+
* Sets a class of the Tooltip animation container.
|
|
437
|
+
*/
|
|
438
|
+
className?: string;
|
|
439
|
+
/**
|
|
440
|
+
* Sets the content of the Tooltip ([see example]({% slug templates_tooltip %})).
|
|
441
|
+
*/
|
|
442
|
+
content?: any;
|
|
443
|
+
/**
|
|
444
|
+
* Sets the content of the Tooltip.
|
|
445
|
+
*/
|
|
446
|
+
children?: any;
|
|
447
|
+
/**
|
|
448
|
+
* Specifies if the Tooltip will be open.
|
|
449
|
+
* Sets the Tooltip in its controlled mode ([see example]({% slug controlledmode_tooltip %})).
|
|
450
|
+
* Requires you to set the `targetElement` property.
|
|
451
|
+
*/
|
|
452
|
+
open?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* Sets a delay in milliseconds.
|
|
455
|
+
*/
|
|
456
|
+
openDelay?: number;
|
|
457
|
+
/**
|
|
458
|
+
* If any of the parent elements has a title, displays a Tooltip.
|
|
459
|
+
*/
|
|
460
|
+
parentTitle?: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* Specifies if the Tooltip callout will be displayed.
|
|
463
|
+
*/
|
|
464
|
+
showCallout?: boolean;
|
|
465
|
+
/**
|
|
466
|
+
* When the position is set to `auto`, sets the start point of the Tooltip callout (in pixels).
|
|
467
|
+
*/
|
|
468
|
+
setCalloutOnPositionAuto?: any;
|
|
469
|
+
/**
|
|
470
|
+
* Specifies the styles which are set to the Tooltip animation container.
|
|
471
|
+
*/
|
|
472
|
+
style?: React.CSSProperties;
|
|
473
|
+
/**
|
|
474
|
+
* Sets the Tooltip target element. You have to use it with the `open` property.
|
|
475
|
+
*/
|
|
476
|
+
targetElement?: any;
|
|
477
|
+
/**
|
|
478
|
+
* Specifies the CSS class names which are set to the Tooltip DOM element.
|
|
479
|
+
*/
|
|
480
|
+
tooltipClassName?: string;
|
|
481
|
+
/**
|
|
482
|
+
* Specifies the styles which are set to the Tooltip DOM element.
|
|
483
|
+
*/
|
|
484
|
+
tooltipStyle?: React.CSSProperties;
|
|
485
|
+
/**
|
|
486
|
+
* Fires when the Tooltip is shown.
|
|
487
|
+
*/
|
|
488
|
+
onOpen?: (event: TooltipEvent) => void;
|
|
489
|
+
/**
|
|
490
|
+
* Fires when the Tooltip is hidden.
|
|
491
|
+
*/
|
|
492
|
+
onClose?: (event: TooltipEvent) => void;
|
|
493
|
+
/**
|
|
494
|
+
* Callback called when the Tooltip calculates it's position. Useful to modify the default position behavior.
|
|
495
|
+
* Require to return the `top` and `left` position of the Tooltip.
|
|
496
|
+
*/
|
|
497
|
+
onPosition?: (event: TooltipPositionEvent) => {
|
|
498
|
+
top: number;
|
|
499
|
+
left: number;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Represents a callback function which determines if a Tooltip will be displayed ([see example]({% slug filter_elements_tooltip %})).
|
|
503
|
+
*/
|
|
504
|
+
filter?: (target: HTMLElement) => void;
|
|
505
|
+
/**
|
|
506
|
+
* The milliseconds interval on which the Tooltip will check for title change. By default the Tooltip does not track for title updates.
|
|
507
|
+
*/
|
|
508
|
+
updateInterval?: number;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* @hidden
|
|
513
|
+
*/
|
|
514
|
+
declare interface TooltipState {
|
|
515
|
+
targetElement: HTMLElement | null;
|
|
516
|
+
open: boolean;
|
|
517
|
+
title: string;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export { }
|
package/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("react"),W=require("react-dom"),n=require("prop-types"),a=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-popup");function N(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=N(Q),et=N(W),c=10,h=10,ot=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;case"left":return i==="pointer"?e-t-c:o.left-t-c;case"right":return i==="pointer"?e+c:o.right+c;case"top":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;default:return i==="pointer"?e<window.screen.availWidth/2?e-c:e-t+c:e<window.screen.availWidth/2?o.left:o.right-t}},nt=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e+h:t.bottom+h;case"left":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"right":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"top":return i==="pointer"?e-o-h:t.top-o-h;default:return i==="pointer"?e<window.innerHeight/2?e+c:e-o-c:e<window.innerHeight/2?t.bottom+h:t.top-o-h}},it=e=>e!==null?e.getBoundingClientRect():document.body.getBoundingClientRect(),st=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],C=e=>{if(e===null)return!1;let t=e;for(;t;){if(t!==null&&t.classList&&t.classList.contains("k-tooltip"))return!0;t.parentNode!==null?t=t.parentNode:t=!1}return st.filter(o=>o===e.className).length>0},x={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},rt=100,R=class extends s.PureComponent{constructor(e){super(e),this.context=0,this.state={targetElement:null,open:!1,title:""},this.top=0,this.left=0,this.willOpen=!1,this.handleMouseOut=t=>{const{targetElement:o}=this.state,i=o?o.ownerDocument:document;let r=i&&i.elementFromPoint(t.clientX,t.clientY);C(r)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const o=t.target;!this.isVisible(o)||C(o)||o===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{a.dispatchEvent(this.props.onClose,t,this,void 0),this.setState({targetElement:null,open:!1,title:""})},this.setUpdateInterval=()=>{this.props.updateInterval&&(this.updateIntervalId=setInterval(this.onIntervalUpdate,this.props.updateInterval))},this.onIntervalUpdate=()=>{const t=this.state.targetElement;t&&(t.parentElement===null?this.onClose({target:t}):this.showToolTip({target:t}))},this.position=t=>{let o=it(this.state.targetElement);const i=ot(this.left,t.offsetWidth,o,this.props.anchorElement,this.props.position),r=nt(this.top,o,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:i,top:r}},this.getTitle=t=>{for(;t;){if(t.getAttribute("title")!==null||t.titleExpando)return{title:t.getAttribute("title")||t.titleExpando,element:t};t=this.props.parentTitle&&t.parentElement||null}return{title:"",element:t}},this.calloutClassName=()=>{switch(this.props.position){case"bottom":return"k-callout k-callout-n";case"left":return"k-callout k-callout-e";case"right":return"k-callout k-callout-w";case"top":return"k-callout k-callout-s";default:return this.top<window.innerHeight/2?"k-callout k-callout-n":"k-callout k-callout-s"}},this.getCurrentZIndex=()=>this.context?this.context:rt,a.validatePackage(x)}componentDidMount(){document&&document.body.addEventListener("mousemove",this.handleBodyMousemove)}componentWillUnmount(){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),document&&document.body.removeEventListener("mousemove",this.handleBodyMousemove)}componentDidUpdate(){this.props.open&&this.props.targetElement&&this.showToolTip({target:this.props.targetElement})}render(){if(this.props.children){const{children:o,...i}=this.props;let r=null;return s.createElement("div",{onMouseOver:p=>{r&&r.handleMouseOver(p)},onMouseOut:p=>{r&&r.handleMouseOut(p)}},s.createElement(R,{ref:p=>r=p,...i}),o)}if(this.props.open===!1)return null;const{targetElement:e}=this.state,t=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&et.createPortal(s.createElement("div",{ref:o=>{if(!o)return;let i;if(this.props.onPosition){const r={element:o,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};i=this.props.onPosition.call(void 0,r)}else i=this.position(o);o.style.left=i.left+"px",o.style.top=i.top+"px"},className:a.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:t,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:a.classNames("k-tooltip",this.props.tooltipClassName),style:{position:"relative",...this.props.tooltipStyle}},s.createElement("div",{className:"k-tooltip-content"},this.props.content&&s.createElement(this.props.content,{title:this.state.title,target:this.state.targetElement})||this.state.title),this.props.showCallout&&s.createElement("div",{ref:o=>{o&&(o.className=this.calloutClassName(),this.props.position==="auto"&&(this.left<window.screen.availWidth/2?o.style.left=this.props.setCalloutOnPositionAuto||"25%":o.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(e){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),e.target.hasChildNodes()&&e.target.childNodes.forEach(i=>{i.nodeName==="title"&&(e.target.titleExpando=i.innerHTML,i.remove())});const t=this.props.targetElement||e.target;let o=this.getTitle(t);if(!o.title){this.state.open&&this.onClose(e);return}o.element&&(o.element.titleExpando=o.title,o.element.title=""),this.willOpen=!0,this.props.openDelay?this.openTimeoutId=window.setTimeout(()=>{this.willOpen&&this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval)},this.props.openDelay):this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&a.dispatchEvent(this.props.onOpen,e,this,void 0)}isVisible(e){return!this.props.filter||this.props.filter(e)}};let v=R;v.propTypes={anchorElement:n.oneOf(["pointer","target"]),content:n.func,filter:n.func,openDelay:n.number,position:n.oneOf(["right","left","top","bottom","auto"]),updateInterval:n.number};v.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1};v.contextType=a.ZIndexContext;const d=s.forwardRef((e,t)=>{const o=s.useRef(null),i=s.useRef(null);return s.useImperativeHandle(i,()=>({props:e,element:o.current})),s.useImperativeHandle(t,()=>i.current),s.createElement("div",{ref:o,className:a.classNames("k-popover-actions","k-actions",{[`k-actions-${e.alignment}`]:e.alignment,[`k-actions-${e.orientation}`]:e.orientation})},e.children)}),lt={alignment:"stretched",orientation:"horizontal"};d.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])};d.defaultProps=lt;d.displayName="KendoReactPopoverActionsBar";const at=12e3,pt=2e3,I=15,ct={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},ut={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},ht={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},dt={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},ft=e=>s.Children.toArray(e).filter(t=>t&&t.type===d),mt=e=>s.Children.toArray(e).filter(t=>t&&t.type!==d),g=s.forwardRef((e,t)=>{a.validatePackage(x);const{callout:o,position:i,title:r,children:p,show:D,anchor:A,appendTo:M,offset:z,animate:L,positionMode:S,scale:U,popoverClass:u,className:_,id:B,style:Z,collision:j,contentStyle:T,onPosition:y,onClose:b,onOpen:k}=e,[F,w]=s.useState(!1),O=i==="top"||i==="bottom",K=e.margin||{vertical:o&&O?I:0,horizontal:o&&!O?I:0},V=ht[i],q=dt[i],P=s.useContext(a.ZIndexContext),X=P?P+pt:at,f=s.useRef(null);s.useImperativeHandle(f,()=>({props:e})),s.useImperativeHandle(t,()=>f.current);const H=s.useCallback(l=>{if(setTimeout(()=>w(l.flipped)),y){const J={target:f.current,flipped:l.flipped,fitted:l.fitted};y.call(void 0,J)}},[y,w]),$=s.useCallback(()=>{if(k){const l={target:f.current};k.call(void 0,l)}},[k]),Y=s.useCallback(()=>{if(b){const l={target:f.current};b.call(void 0,l)}},[b]),m={"k-popover":!0};Array.isArray(u)?u.forEach(l=>m[l]=!0):typeof u=="object"?Object.keys(u).forEach(l=>{m[l]=u[l]}):u&&(m[u]=!0);const G=F?ut[i]:ct[i],E=s.useMemo(()=>s.createElement(s.Fragment,null,r&&s.createElement("div",{className:"k-popover-header"},r),s.createElement("div",{className:"k-popover-body",style:T},mt(p)),ft(p)),[p,T,r]);return s.createElement(a.ZIndexContext.Provider,{value:X},s.createElement(tt.Popup,{id:B,role:"tooltip",animate:L,collision:j,anchor:A,offset:z,margin:K,popupAlign:V,anchorAlign:q,appendTo:M,show:D,scale:U,positionMode:S,style:Z,className:_,popupClass:m,onOpen:$,onClose:Y,onPosition:H},o&&i?s.createElement(s.Fragment,null,s.createElement("div",{className:a.classNames("k-popover-callout",G)}),s.createElement("div",{className:"k-popover-inner"},E)):E))}),vt={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};g.propTypes={callout:n.bool,title:n.node,position:n.oneOf(["top","left","bottom","right"]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),anchor:function(e){const t=e.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(e){const t=e.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popoverClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func};g.defaultProps=vt;g.displayName="KendoReactPopover";exports.Popover=g;exports.PopoverActionsBar=d;exports.Tooltip=v;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./tooltip/Tooltip.js"),e=require("./popover/Popover.js"),r=require("./popover/PopoverActionsBar.js");exports.Tooltip=o.Tooltip;exports.Popover=e.Popover;exports.PopoverActionsBar=r.PopoverActionsBar;
|