@redsift/popovers 11.1.3 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +177 -121
- package/index.js +6 -3
- package/index.js.map +1 -1
- package/package.json +5 -5
package/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { ValueOf, ButtonColor, Theme, ContainerProps, Comp, HeadingProps, IconPr
|
|
|
3
3
|
import React$1, { Dispatch, SetStateAction, ReactNode, ComponentProps } from 'react';
|
|
4
4
|
import * as _floating_ui_react from '@floating-ui/react';
|
|
5
5
|
export { FloatingPortal, useMergeRefs } from '@floating-ui/react';
|
|
6
|
+
import * as _floating_ui_react_dom from '@floating-ui/react-dom';
|
|
6
7
|
import * as _floating_ui_core from '@floating-ui/core';
|
|
8
|
+
import * as _floating_ui_utils from '@floating-ui/utils';
|
|
7
9
|
import * as styled_components from 'styled-components';
|
|
8
10
|
import { Theme as Theme$1, ClearWaitingQueueParams } from 'react-toastify';
|
|
9
11
|
|
|
@@ -21,39 +23,48 @@ declare function useDialog({ color, defaultOpen, hasCloseButton, initialFocus, i
|
|
|
21
23
|
bodyRef: React$1.MutableRefObject<null>;
|
|
22
24
|
actionsRef: React$1.MutableRefObject<null>;
|
|
23
25
|
triggerClassName: string | undefined;
|
|
24
|
-
placement:
|
|
25
|
-
strategy:
|
|
26
|
-
middlewareData:
|
|
27
|
-
x: number
|
|
28
|
-
y: number
|
|
26
|
+
placement: _floating_ui_utils.Placement;
|
|
27
|
+
strategy: _floating_ui_utils.Strategy;
|
|
28
|
+
middlewareData: _floating_ui_core.MiddlewareData;
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
isPositioned: boolean;
|
|
29
32
|
update: () => void;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
floatingStyles: React$1.CSSProperties;
|
|
34
|
+
refs: {
|
|
35
|
+
reference: React$1.MutableRefObject<_floating_ui_react_dom.ReferenceType | null>;
|
|
36
|
+
floating: React$1.MutableRefObject<HTMLElement | null>;
|
|
37
|
+
setReference: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
38
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
39
|
+
} & _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
40
|
+
elements: {
|
|
41
|
+
reference: _floating_ui_react_dom.ReferenceType | null;
|
|
42
|
+
floating: HTMLElement | null;
|
|
43
|
+
} & _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
33
44
|
context: {
|
|
34
|
-
x: number
|
|
35
|
-
y: number
|
|
36
|
-
placement:
|
|
37
|
-
strategy:
|
|
38
|
-
middlewareData:
|
|
39
|
-
update: () => void;
|
|
40
|
-
reference: (node: _floating_ui_react.ReferenceType | null) => void;
|
|
41
|
-
floating: (node: HTMLElement | null) => void;
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
placement: _floating_ui_utils.Placement;
|
|
48
|
+
strategy: _floating_ui_utils.Strategy;
|
|
49
|
+
middlewareData: _floating_ui_core.MiddlewareData;
|
|
42
50
|
isPositioned: boolean;
|
|
51
|
+
update: () => void;
|
|
52
|
+
floatingStyles: React$1.CSSProperties;
|
|
43
53
|
open: boolean;
|
|
44
|
-
onOpenChange: (open: boolean) => void;
|
|
54
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: _floating_ui_react.OpenChangeReason | undefined) => void;
|
|
45
55
|
events: _floating_ui_react.FloatingEvents;
|
|
46
56
|
dataRef: React$1.MutableRefObject<_floating_ui_react.ContextData>;
|
|
47
57
|
nodeId: string | undefined;
|
|
58
|
+
floatingId: string | undefined;
|
|
48
59
|
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
49
60
|
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
50
61
|
};
|
|
51
|
-
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
52
|
-
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
53
|
-
isPositioned: boolean;
|
|
54
62
|
getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
55
63
|
getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
56
|
-
getItemProps: (userProps?: React$1.HTMLProps<HTMLElement
|
|
64
|
+
getItemProps: (userProps?: (Omit<React$1.HTMLProps<HTMLElement>, "active" | "selected"> & {
|
|
65
|
+
active?: boolean | undefined;
|
|
66
|
+
selected?: boolean | undefined;
|
|
67
|
+
}) | undefined) => Record<string, unknown>;
|
|
57
68
|
color: string | undefined;
|
|
58
69
|
isOpen: boolean | undefined;
|
|
59
70
|
handleOpen: (collapsed: boolean) => void;
|
|
@@ -246,39 +257,48 @@ declare const useDialogContext: () => {
|
|
|
246
257
|
bodyRef: React$1.MutableRefObject<null>;
|
|
247
258
|
actionsRef: React$1.MutableRefObject<null>;
|
|
248
259
|
triggerClassName: string | undefined;
|
|
249
|
-
placement:
|
|
250
|
-
strategy:
|
|
260
|
+
placement: _floating_ui_utils.Placement;
|
|
261
|
+
strategy: _floating_ui_utils.Strategy;
|
|
251
262
|
middlewareData: _floating_ui_core.MiddlewareData;
|
|
252
|
-
x: number
|
|
253
|
-
y: number
|
|
263
|
+
x: number;
|
|
264
|
+
y: number;
|
|
265
|
+
isPositioned: boolean;
|
|
254
266
|
update: () => void;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
267
|
+
floatingStyles: React$1.CSSProperties;
|
|
268
|
+
refs: {
|
|
269
|
+
reference: React$1.MutableRefObject<_floating_ui_react_dom.ReferenceType | null>;
|
|
270
|
+
floating: React$1.MutableRefObject<HTMLElement | null>;
|
|
271
|
+
setReference: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
272
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
273
|
+
} & _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
274
|
+
elements: {
|
|
275
|
+
reference: _floating_ui_react_dom.ReferenceType | null;
|
|
276
|
+
floating: HTMLElement | null;
|
|
277
|
+
} & _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
258
278
|
context: {
|
|
259
|
-
x: number
|
|
260
|
-
y: number
|
|
261
|
-
placement:
|
|
262
|
-
strategy:
|
|
279
|
+
x: number;
|
|
280
|
+
y: number;
|
|
281
|
+
placement: _floating_ui_utils.Placement;
|
|
282
|
+
strategy: _floating_ui_utils.Strategy;
|
|
263
283
|
middlewareData: _floating_ui_core.MiddlewareData;
|
|
264
|
-
update: () => void;
|
|
265
|
-
reference: (node: _floating_ui_react.ReferenceType | null) => void;
|
|
266
|
-
floating: (node: HTMLElement | null) => void;
|
|
267
284
|
isPositioned: boolean;
|
|
285
|
+
update: () => void;
|
|
286
|
+
floatingStyles: React$1.CSSProperties;
|
|
268
287
|
open: boolean;
|
|
269
|
-
onOpenChange: (open: boolean) => void;
|
|
288
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: _floating_ui_react.OpenChangeReason | undefined) => void;
|
|
270
289
|
events: _floating_ui_react.FloatingEvents;
|
|
271
290
|
dataRef: React$1.MutableRefObject<_floating_ui_react.ContextData>;
|
|
272
291
|
nodeId: string | undefined;
|
|
292
|
+
floatingId: string | undefined;
|
|
273
293
|
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
274
294
|
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
275
295
|
};
|
|
276
|
-
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
277
|
-
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
278
|
-
isPositioned: boolean;
|
|
279
296
|
getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
280
297
|
getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
281
|
-
getItemProps: (userProps?: React$1.HTMLProps<HTMLElement
|
|
298
|
+
getItemProps: (userProps?: (Omit<React$1.HTMLProps<HTMLElement>, "active" | "selected"> & {
|
|
299
|
+
active?: boolean | undefined;
|
|
300
|
+
selected?: boolean | undefined;
|
|
301
|
+
}) | undefined) => Record<string, unknown>;
|
|
282
302
|
color: string | undefined;
|
|
283
303
|
isOpen: boolean | undefined;
|
|
284
304
|
handleOpen: (collapsed: boolean) => void;
|
|
@@ -293,39 +313,48 @@ declare function usePopover({ color, defaultOpen, isModal, isOpen: propsIsOpen,
|
|
|
293
313
|
triggerClassName: string | undefined;
|
|
294
314
|
setHideInsteadOfClose: React$1.Dispatch<React$1.SetStateAction<boolean>> | undefined;
|
|
295
315
|
hideInsteadOfClose: boolean | undefined;
|
|
296
|
-
placement:
|
|
297
|
-
strategy:
|
|
298
|
-
middlewareData:
|
|
299
|
-
x: number
|
|
300
|
-
y: number
|
|
316
|
+
placement: _floating_ui_utils.Placement;
|
|
317
|
+
strategy: _floating_ui_utils.Strategy;
|
|
318
|
+
middlewareData: _floating_ui_core.MiddlewareData;
|
|
319
|
+
x: number;
|
|
320
|
+
y: number;
|
|
321
|
+
isPositioned: boolean;
|
|
301
322
|
update: () => void;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
323
|
+
floatingStyles: React$1.CSSProperties;
|
|
324
|
+
refs: {
|
|
325
|
+
reference: React$1.MutableRefObject<_floating_ui_react_dom.ReferenceType | null>;
|
|
326
|
+
floating: React$1.MutableRefObject<HTMLElement | null>;
|
|
327
|
+
setReference: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
328
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
329
|
+
} & _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
330
|
+
elements: {
|
|
331
|
+
reference: _floating_ui_react_dom.ReferenceType | null;
|
|
332
|
+
floating: HTMLElement | null;
|
|
333
|
+
} & _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
305
334
|
context: {
|
|
306
|
-
x: number
|
|
307
|
-
y: number
|
|
308
|
-
placement:
|
|
309
|
-
strategy:
|
|
310
|
-
middlewareData:
|
|
311
|
-
update: () => void;
|
|
312
|
-
reference: (node: _floating_ui_react.ReferenceType | null) => void;
|
|
313
|
-
floating: (node: HTMLElement | null) => void;
|
|
335
|
+
x: number;
|
|
336
|
+
y: number;
|
|
337
|
+
placement: _floating_ui_utils.Placement;
|
|
338
|
+
strategy: _floating_ui_utils.Strategy;
|
|
339
|
+
middlewareData: _floating_ui_core.MiddlewareData;
|
|
314
340
|
isPositioned: boolean;
|
|
341
|
+
update: () => void;
|
|
342
|
+
floatingStyles: React$1.CSSProperties;
|
|
315
343
|
open: boolean;
|
|
316
|
-
onOpenChange: (open: boolean) => void;
|
|
344
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: _floating_ui_react.OpenChangeReason | undefined) => void;
|
|
317
345
|
events: _floating_ui_react.FloatingEvents;
|
|
318
346
|
dataRef: React$1.MutableRefObject<_floating_ui_react.ContextData>;
|
|
319
347
|
nodeId: string | undefined;
|
|
348
|
+
floatingId: string | undefined;
|
|
320
349
|
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
321
350
|
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
322
351
|
};
|
|
323
|
-
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
324
|
-
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
325
|
-
isPositioned: boolean;
|
|
326
352
|
getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
327
353
|
getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
328
|
-
getItemProps: (userProps?: React$1.HTMLProps<HTMLElement
|
|
354
|
+
getItemProps: (userProps?: (Omit<React$1.HTMLProps<HTMLElement>, "active" | "selected"> & {
|
|
355
|
+
active?: boolean | undefined;
|
|
356
|
+
selected?: boolean | undefined;
|
|
357
|
+
}) | undefined) => Record<string, unknown>;
|
|
329
358
|
color: string | undefined;
|
|
330
359
|
isOpen: boolean | undefined;
|
|
331
360
|
handleOpen: (collapsed: boolean) => void;
|
|
@@ -464,39 +493,48 @@ declare const usePopoverContext: () => {
|
|
|
464
493
|
triggerClassName: string | undefined;
|
|
465
494
|
setHideInsteadOfClose: React$1.Dispatch<React$1.SetStateAction<boolean>> | undefined;
|
|
466
495
|
hideInsteadOfClose: boolean | undefined;
|
|
467
|
-
placement:
|
|
468
|
-
strategy:
|
|
496
|
+
placement: _floating_ui_utils.Placement;
|
|
497
|
+
strategy: _floating_ui_utils.Strategy;
|
|
469
498
|
middlewareData: _floating_ui_core.MiddlewareData;
|
|
470
|
-
x: number
|
|
471
|
-
y: number
|
|
499
|
+
x: number;
|
|
500
|
+
y: number;
|
|
501
|
+
isPositioned: boolean;
|
|
472
502
|
update: () => void;
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
503
|
+
floatingStyles: React$1.CSSProperties;
|
|
504
|
+
refs: {
|
|
505
|
+
reference: React$1.MutableRefObject<_floating_ui_react_dom.ReferenceType | null>;
|
|
506
|
+
floating: React$1.MutableRefObject<HTMLElement | null>;
|
|
507
|
+
setReference: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
508
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
509
|
+
} & _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
510
|
+
elements: {
|
|
511
|
+
reference: _floating_ui_react_dom.ReferenceType | null;
|
|
512
|
+
floating: HTMLElement | null;
|
|
513
|
+
} & _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
476
514
|
context: {
|
|
477
|
-
x: number
|
|
478
|
-
y: number
|
|
479
|
-
placement:
|
|
480
|
-
strategy:
|
|
515
|
+
x: number;
|
|
516
|
+
y: number;
|
|
517
|
+
placement: _floating_ui_utils.Placement;
|
|
518
|
+
strategy: _floating_ui_utils.Strategy;
|
|
481
519
|
middlewareData: _floating_ui_core.MiddlewareData;
|
|
482
|
-
update: () => void;
|
|
483
|
-
reference: (node: _floating_ui_react.ReferenceType | null) => void;
|
|
484
|
-
floating: (node: HTMLElement | null) => void;
|
|
485
520
|
isPositioned: boolean;
|
|
521
|
+
update: () => void;
|
|
522
|
+
floatingStyles: React$1.CSSProperties;
|
|
486
523
|
open: boolean;
|
|
487
|
-
onOpenChange: (open: boolean) => void;
|
|
524
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: _floating_ui_react.OpenChangeReason | undefined) => void;
|
|
488
525
|
events: _floating_ui_react.FloatingEvents;
|
|
489
526
|
dataRef: React$1.MutableRefObject<_floating_ui_react.ContextData>;
|
|
490
527
|
nodeId: string | undefined;
|
|
528
|
+
floatingId: string | undefined;
|
|
491
529
|
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
492
530
|
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
493
531
|
};
|
|
494
|
-
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
495
|
-
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
496
|
-
isPositioned: boolean;
|
|
497
532
|
getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
498
533
|
getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
499
|
-
getItemProps: (userProps?: React$1.HTMLProps<HTMLElement
|
|
534
|
+
getItemProps: (userProps?: (Omit<React$1.HTMLProps<HTMLElement>, "active" | "selected"> & {
|
|
535
|
+
active?: boolean | undefined;
|
|
536
|
+
selected?: boolean | undefined;
|
|
537
|
+
}) | undefined) => Record<string, unknown>;
|
|
500
538
|
color: string | undefined;
|
|
501
539
|
isOpen: boolean | undefined;
|
|
502
540
|
handleOpen: (collapsed: boolean) => void;
|
|
@@ -662,39 +700,48 @@ declare function useTooltip({ color, defaultOpen, delay, placement, isOpen: prop
|
|
|
662
700
|
arrowRef: React$1.MutableRefObject<null>;
|
|
663
701
|
tooltipId: string;
|
|
664
702
|
triggerClassName: string | undefined;
|
|
665
|
-
placement:
|
|
666
|
-
strategy:
|
|
667
|
-
middlewareData:
|
|
668
|
-
x: number
|
|
669
|
-
y: number
|
|
703
|
+
placement: _floating_ui_utils.Placement;
|
|
704
|
+
strategy: _floating_ui_utils.Strategy;
|
|
705
|
+
middlewareData: _floating_ui_core.MiddlewareData;
|
|
706
|
+
x: number;
|
|
707
|
+
y: number;
|
|
708
|
+
isPositioned: boolean;
|
|
670
709
|
update: () => void;
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
710
|
+
floatingStyles: React$1.CSSProperties;
|
|
711
|
+
refs: {
|
|
712
|
+
reference: React$1.MutableRefObject<_floating_ui_react_dom.ReferenceType | null>;
|
|
713
|
+
floating: React$1.MutableRefObject<HTMLElement | null>;
|
|
714
|
+
setReference: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
715
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
716
|
+
} & _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
717
|
+
elements: {
|
|
718
|
+
reference: _floating_ui_react_dom.ReferenceType | null;
|
|
719
|
+
floating: HTMLElement | null;
|
|
720
|
+
} & _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
674
721
|
context: {
|
|
675
|
-
x: number
|
|
676
|
-
y: number
|
|
677
|
-
placement:
|
|
678
|
-
strategy:
|
|
679
|
-
middlewareData:
|
|
680
|
-
update: () => void;
|
|
681
|
-
reference: (node: _floating_ui_react.ReferenceType | null) => void;
|
|
682
|
-
floating: (node: HTMLElement | null) => void;
|
|
722
|
+
x: number;
|
|
723
|
+
y: number;
|
|
724
|
+
placement: _floating_ui_utils.Placement;
|
|
725
|
+
strategy: _floating_ui_utils.Strategy;
|
|
726
|
+
middlewareData: _floating_ui_core.MiddlewareData;
|
|
683
727
|
isPositioned: boolean;
|
|
728
|
+
update: () => void;
|
|
729
|
+
floatingStyles: React$1.CSSProperties;
|
|
684
730
|
open: boolean;
|
|
685
|
-
onOpenChange: (open: boolean) => void;
|
|
731
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: _floating_ui_react.OpenChangeReason | undefined) => void;
|
|
686
732
|
events: _floating_ui_react.FloatingEvents;
|
|
687
733
|
dataRef: React$1.MutableRefObject<_floating_ui_react.ContextData>;
|
|
688
734
|
nodeId: string | undefined;
|
|
735
|
+
floatingId: string | undefined;
|
|
689
736
|
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
690
737
|
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
691
738
|
};
|
|
692
|
-
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
693
|
-
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
694
|
-
isPositioned: boolean;
|
|
695
739
|
getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
696
740
|
getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
697
|
-
getItemProps: (userProps?: React$1.HTMLProps<HTMLElement
|
|
741
|
+
getItemProps: (userProps?: (Omit<React$1.HTMLProps<HTMLElement>, "active" | "selected"> & {
|
|
742
|
+
active?: boolean | undefined;
|
|
743
|
+
selected?: boolean | undefined;
|
|
744
|
+
}) | undefined) => Record<string, unknown>;
|
|
698
745
|
color: string | undefined;
|
|
699
746
|
isOpen: boolean | undefined;
|
|
700
747
|
handleOpen: (collapsed: boolean) => void;
|
|
@@ -741,7 +788,7 @@ interface TooltipProps {
|
|
|
741
788
|
/** Delay time (in ms) for the tooltip to show up. */
|
|
742
789
|
delay?: number;
|
|
743
790
|
/** Default placement of the tooltip. */
|
|
744
|
-
placement?: TooltipPlacement;
|
|
791
|
+
placement?: TooltipPlacement | 'client-point';
|
|
745
792
|
/**
|
|
746
793
|
* Whether the component is opened or not.
|
|
747
794
|
* Used for controlled version.
|
|
@@ -781,39 +828,48 @@ declare const useTooltipContext: () => {
|
|
|
781
828
|
arrowRef: React$1.MutableRefObject<null>;
|
|
782
829
|
tooltipId: string;
|
|
783
830
|
triggerClassName: string | undefined;
|
|
784
|
-
placement:
|
|
785
|
-
strategy:
|
|
831
|
+
placement: _floating_ui_utils.Placement;
|
|
832
|
+
strategy: _floating_ui_utils.Strategy;
|
|
786
833
|
middlewareData: _floating_ui_core.MiddlewareData;
|
|
787
|
-
x: number
|
|
788
|
-
y: number
|
|
834
|
+
x: number;
|
|
835
|
+
y: number;
|
|
836
|
+
isPositioned: boolean;
|
|
789
837
|
update: () => void;
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
838
|
+
floatingStyles: React$1.CSSProperties;
|
|
839
|
+
refs: {
|
|
840
|
+
reference: React$1.MutableRefObject<_floating_ui_react_dom.ReferenceType | null>;
|
|
841
|
+
floating: React$1.MutableRefObject<HTMLElement | null>;
|
|
842
|
+
setReference: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
843
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
844
|
+
} & _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
845
|
+
elements: {
|
|
846
|
+
reference: _floating_ui_react_dom.ReferenceType | null;
|
|
847
|
+
floating: HTMLElement | null;
|
|
848
|
+
} & _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
793
849
|
context: {
|
|
794
|
-
x: number
|
|
795
|
-
y: number
|
|
796
|
-
placement:
|
|
797
|
-
strategy:
|
|
850
|
+
x: number;
|
|
851
|
+
y: number;
|
|
852
|
+
placement: _floating_ui_utils.Placement;
|
|
853
|
+
strategy: _floating_ui_utils.Strategy;
|
|
798
854
|
middlewareData: _floating_ui_core.MiddlewareData;
|
|
799
|
-
update: () => void;
|
|
800
|
-
reference: (node: _floating_ui_react.ReferenceType | null) => void;
|
|
801
|
-
floating: (node: HTMLElement | null) => void;
|
|
802
855
|
isPositioned: boolean;
|
|
856
|
+
update: () => void;
|
|
857
|
+
floatingStyles: React$1.CSSProperties;
|
|
803
858
|
open: boolean;
|
|
804
|
-
onOpenChange: (open: boolean) => void;
|
|
859
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: _floating_ui_react.OpenChangeReason | undefined) => void;
|
|
805
860
|
events: _floating_ui_react.FloatingEvents;
|
|
806
861
|
dataRef: React$1.MutableRefObject<_floating_ui_react.ContextData>;
|
|
807
862
|
nodeId: string | undefined;
|
|
863
|
+
floatingId: string | undefined;
|
|
808
864
|
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
809
865
|
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
810
866
|
};
|
|
811
|
-
refs: _floating_ui_react.ExtendedRefs<_floating_ui_react.ReferenceType>;
|
|
812
|
-
elements: _floating_ui_react.ExtendedElements<_floating_ui_react.ReferenceType>;
|
|
813
|
-
isPositioned: boolean;
|
|
814
867
|
getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
815
868
|
getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
816
|
-
getItemProps: (userProps?: React$1.HTMLProps<HTMLElement
|
|
869
|
+
getItemProps: (userProps?: (Omit<React$1.HTMLProps<HTMLElement>, "active" | "selected"> & {
|
|
870
|
+
active?: boolean | undefined;
|
|
871
|
+
selected?: boolean | undefined;
|
|
872
|
+
}) | undefined) => Record<string, unknown>;
|
|
817
873
|
color: string | undefined;
|
|
818
874
|
isOpen: boolean | undefined;
|
|
819
875
|
handleOpen: (collapsed: boolean) => void;
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { baseContainer, Theme, useBoundingClientRect, baseStyling, baseFlexbox, useId, Skeleton, Heading, Icon, AppContainerContext, useTheme, useMessageFormatter, partitionComponents, isComponent, IconButton, ThemeProvider as ThemeProvider$1, Flexbox, Text, RedsiftTypographyFontWeightSemiBold, Spinner, NotificationsColorPalette, ButtonLink, Button, IconButtonLink, LinkButton, Link } from '@redsift/design-system';
|
|
2
2
|
import React, { forwardRef, useContext, useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
-
import { FloatingOverlay, useMergeRefs, useTransitionStyles, FloatingPortal, FloatingFocusManager, useFloating, useDismiss, useRole, useInteractions, offset, flip, shift, size, autoUpdate, arrow, useHover, safePolygon, useFocus } from '@floating-ui/react';
|
|
3
|
+
import { FloatingOverlay, useMergeRefs, useTransitionStyles, FloatingPortal, FloatingFocusManager, useFloating, useDismiss, useRole, useInteractions, offset, flip, shift, size, autoUpdate, arrow, useClientPoint, useHover, safePolygon, useFocus } from '@floating-ui/react';
|
|
4
4
|
export { FloatingPortal, useMergeRefs } from '@floating-ui/react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import styled, { css } from 'styled-components';
|
|
@@ -2489,7 +2489,7 @@ function useTooltip(_ref) {
|
|
|
2489
2489
|
}
|
|
2490
2490
|
}, [onOpen]);
|
|
2491
2491
|
const data = useFloating({
|
|
2492
|
-
placement,
|
|
2492
|
+
placement: placement === 'client-point' ? 'left' : placement,
|
|
2493
2493
|
open: isOpen,
|
|
2494
2494
|
onOpenChange: handleOpen,
|
|
2495
2495
|
whileElementsMounted: autoUpdate,
|
|
@@ -2502,6 +2502,9 @@ function useTooltip(_ref) {
|
|
|
2502
2502
|
})]
|
|
2503
2503
|
});
|
|
2504
2504
|
const context = data.context;
|
|
2505
|
+
const clientPoint = useClientPoint(context, {
|
|
2506
|
+
enabled: placement === 'client-point'
|
|
2507
|
+
});
|
|
2505
2508
|
const hover = useHover(context, {
|
|
2506
2509
|
move: false,
|
|
2507
2510
|
delay: {
|
|
@@ -2515,7 +2518,7 @@ function useTooltip(_ref) {
|
|
|
2515
2518
|
const role = useRole(context, {
|
|
2516
2519
|
role: 'tooltip'
|
|
2517
2520
|
});
|
|
2518
|
-
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
2521
|
+
const interactions = useInteractions([hover, focus, dismiss, role, clientPoint]);
|
|
2519
2522
|
return React.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2520
2523
|
color,
|
|
2521
2524
|
isOpen,
|