@redsift/popovers 7.5.1 → 7.6.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/CONTRIBUTING.md +1 -1
- package/index.d.ts +123 -1
- package/index.js +1372 -103
- package/index.js.map +1 -1
- package/package.json +8 -9
package/CONTRIBUTING.md
CHANGED
|
@@ -40,7 +40,7 @@ The Design System is following a monorepo architecture, providing multiple packa
|
|
|
40
40
|
|
|
41
41
|
- `@redsift/popovers`
|
|
42
42
|
|
|
43
|
-
This package provides popover components. Popover components are based on [floating-ui](https://floating-ui.com/) and [@floating-ui/react](https://floating-ui.com/docs/react).
|
|
43
|
+
This package provides popover components. Popover components are based on [floating-ui](https://floating-ui.com/) and [@floating-ui/react](https://floating-ui.com/docs/react). Toasts are based on [react-toastify](https://fkhadra.github.io/react-toastify).
|
|
44
44
|
|
|
45
45
|
- `@redsift/table`
|
|
46
46
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React$1, { Ref, ReactElement, Dispatch, SetStateAction, ReactNode, ComponentProps } from 'react';
|
|
2
2
|
import * as _floating_ui_react from '@floating-ui/react';
|
|
3
|
+
import { ClearWaitingQueueParams } from 'react-toastify';
|
|
3
4
|
|
|
4
5
|
/** Component Type. */
|
|
5
6
|
type Comp<P, T = HTMLElement> = {
|
|
@@ -670,6 +671,127 @@ declare const usePopoverContext: () => {
|
|
|
670
671
|
handleOpen: (collapsed: boolean) => void;
|
|
671
672
|
};
|
|
672
673
|
|
|
674
|
+
/**
|
|
675
|
+
* Component variant.
|
|
676
|
+
*/
|
|
677
|
+
declare const ToastVariant: {
|
|
678
|
+
readonly success: "success";
|
|
679
|
+
readonly error: "error";
|
|
680
|
+
readonly warning: "warning";
|
|
681
|
+
readonly info: "info";
|
|
682
|
+
readonly loading: "loading";
|
|
683
|
+
};
|
|
684
|
+
type ToastVariant = ValueOf<typeof ToastVariant>;
|
|
685
|
+
declare const ToastPlacement: {
|
|
686
|
+
readonly 'top-right': "top-right";
|
|
687
|
+
readonly 'top-center': "top-center";
|
|
688
|
+
readonly 'top-left': "top-left";
|
|
689
|
+
readonly 'bottom-right': "bottom-right";
|
|
690
|
+
readonly 'bottom-center': "bottom-center";
|
|
691
|
+
readonly 'bottom-left': "bottom-left";
|
|
692
|
+
};
|
|
693
|
+
type ToastPlacement = ValueOf<typeof ToastPlacement>;
|
|
694
|
+
/**
|
|
695
|
+
* Component props.
|
|
696
|
+
*/
|
|
697
|
+
interface ToastProps extends Omit<ComponentProps<'div'>, 'id' | 'style'>, SpacingProps, SizingProps {
|
|
698
|
+
/** Whether the component has a close button or not. */
|
|
699
|
+
closeButton?: boolean | ReactNode;
|
|
700
|
+
/** Title. */
|
|
701
|
+
title?: string;
|
|
702
|
+
/** Variant */
|
|
703
|
+
variant?: ToastVariant;
|
|
704
|
+
}
|
|
705
|
+
type StyledToastProps = Omit<ToastProps, 'variant' | 'id'> & {
|
|
706
|
+
$hasTitle: boolean;
|
|
707
|
+
$variant: ToastProps['variant'];
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* The Toast component.
|
|
712
|
+
*/
|
|
713
|
+
declare const Toast: Comp<ToastProps & {
|
|
714
|
+
closeToast?: () => void;
|
|
715
|
+
}, HTMLDivElement>;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Component props.
|
|
719
|
+
*/
|
|
720
|
+
interface ToastContainerProps {
|
|
721
|
+
/** Delay in ms to close the toast. If set to false, the notification needs to be closed manually. */
|
|
722
|
+
autoClose?: number | false;
|
|
723
|
+
/** Dismiss toast on click. */
|
|
724
|
+
closeOnClick?: boolean;
|
|
725
|
+
/** Allow Toasts to be draggable. */
|
|
726
|
+
draggable?: boolean;
|
|
727
|
+
/** Whether the progress bar is displayed or not on all Toasts. */
|
|
728
|
+
hideProgressBar?: boolean;
|
|
729
|
+
/** Used to limit the number of toast displayed on screen at the same time. */
|
|
730
|
+
limit?: number;
|
|
731
|
+
/** Pause the timer when the window loses focus. */
|
|
732
|
+
pauseOnFocusLoss?: boolean;
|
|
733
|
+
/** Keep the timer running or not on hover. */
|
|
734
|
+
pauseOnHover?: boolean;
|
|
735
|
+
/** Default placement for all Toasts. */
|
|
736
|
+
placement?: ToastPlacement;
|
|
737
|
+
/** Supports right to left content. */
|
|
738
|
+
rtl?: boolean;
|
|
739
|
+
}
|
|
740
|
+
type StyledToastContainerProps = ToastContainerProps & {};
|
|
741
|
+
interface ToastOptions {
|
|
742
|
+
/** Delay in ms to close the toast. If set to false, the notification needs to be closed manually. */
|
|
743
|
+
autoClose?: number | false;
|
|
744
|
+
/** Dismiss toast on click. */
|
|
745
|
+
closeOnClick?: boolean;
|
|
746
|
+
/** Content. */
|
|
747
|
+
content?: ReactNode;
|
|
748
|
+
/** Let you delay the toast appearance. Pass a value in ms. */
|
|
749
|
+
delay?: number;
|
|
750
|
+
/** Allow toast to be draggable. */
|
|
751
|
+
draggable?: boolean;
|
|
752
|
+
/** Whether the component has a close button or not. */
|
|
753
|
+
closeButton?: boolean | ReactNode;
|
|
754
|
+
/** Whether or not the progress bar is displayed. */
|
|
755
|
+
hideProgressBar?: boolean;
|
|
756
|
+
/** Pause the timer when the window loses focus. */
|
|
757
|
+
pauseOnFocusLoss?: boolean;
|
|
758
|
+
/** Keep the timer running or not on hover. */
|
|
759
|
+
pauseOnHover?: boolean;
|
|
760
|
+
/** Placement of the Toast. */
|
|
761
|
+
placement?: ToastPlacement;
|
|
762
|
+
/** Title. */
|
|
763
|
+
title?: string;
|
|
764
|
+
/** Variant */
|
|
765
|
+
variant?: ToastVariant;
|
|
766
|
+
}
|
|
767
|
+
type Id = number | string;
|
|
768
|
+
type useToastReturnType = {
|
|
769
|
+
notify: (options: ToastOptions, props?: Omit<ToastProps, 'ref' | 'closeButton'>) => Id;
|
|
770
|
+
clearWaitingQueue: (params?: ClearWaitingQueueParams | undefined) => void;
|
|
771
|
+
dismiss: (id?: Id | undefined) => void;
|
|
772
|
+
done: (id: Id) => void;
|
|
773
|
+
error: (options: Omit<ToastOptions, 'variant'>, props?: Omit<ToastProps, 'ref'>) => Id;
|
|
774
|
+
isActive: (id: Id) => boolean;
|
|
775
|
+
info: (options: Omit<ToastOptions, 'variant'>, props?: Omit<ToastProps, 'ref'>) => Id;
|
|
776
|
+
loading: (options: Omit<ToastOptions, 'variant'>, props?: Omit<ToastProps, 'ref'>) => Id;
|
|
777
|
+
promise: (promise: Promise<unknown> | (() => Promise<unknown>), { pending, success, error, }: {
|
|
778
|
+
pending: Pick<ToastOptions, 'content' | 'title' | 'variant'>;
|
|
779
|
+
success: Pick<ToastOptions, 'content' | 'title' | 'variant'>;
|
|
780
|
+
error: Pick<ToastOptions, 'content' | 'title' | 'variant'>;
|
|
781
|
+
}, options?: Omit<ToastOptions, 'content' | 'title' | 'variant'>, props?: Omit<ToastProps, 'ref'>) => void;
|
|
782
|
+
success: (options: Omit<ToastOptions, 'variant'>, props?: Omit<ToastProps, 'ref'>) => Id;
|
|
783
|
+
update: (id: number | string, { content, placement, title, variant, ...options }: ToastOptions, props?: Omit<ToastProps, 'ref'>) => void;
|
|
784
|
+
warning: (options: Omit<ToastOptions, 'variant'>, props?: Omit<ToastProps, 'ref'>) => Id;
|
|
785
|
+
};
|
|
786
|
+
type useToastProps = () => useToastReturnType;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* The ToastContainer component.
|
|
790
|
+
*/
|
|
791
|
+
declare const ToastContainer: Comp<ToastContainerProps, HTMLDivElement>;
|
|
792
|
+
|
|
793
|
+
declare const useToast: useToastProps;
|
|
794
|
+
|
|
673
795
|
declare function useTooltip({ defaultOpen, delay, placement, isOpen: propsIsOpen, onOpen, tooltipId: propsTooltipId, }: Omit<TooltipProps, 'children'>): {
|
|
674
796
|
arrowRef: React$1.MutableRefObject<null>;
|
|
675
797
|
tooltipId: string;
|
|
@@ -841,4 +963,4 @@ declare const useTooltipContext: () => {
|
|
|
841
963
|
handleOpen: (collapsed: boolean) => void;
|
|
842
964
|
};
|
|
843
965
|
|
|
844
|
-
export { BaseDialog, BaseDialogContent, BasePopover, BaseTooltip, Dialog, DialogContent, DialogContentActions, DialogContentActionsProps, DialogContentBody, DialogContentBodyProps, DialogContentHeader, DialogContentHeaderProps, DialogContentProps, DialogContext, DialogProps, DialogSize, DialogState, DialogTrigger, DialogTriggerProps, Popover, PopoverContent, PopoverContentProps, PopoverContext, PopoverPlacement, PopoverProps, PopoverState, PopoverTrigger, PopoverTriggerProps, StyledDialogContentActionsProps, StyledDialogContentBodyProps, StyledDialogContentHeaderProps, StyledDialogContentProps, StyledDialogProps, StyledPopoverContentProps, StyledPopoverProps, StyledTooltipContentProps, StyledTooltipProps, Tooltip, TooltipContent, TooltipContentProps, TooltipContext, TooltipPlacement, TooltipProps, TooltipState, TooltipTrigger, TooltipTriggerProps, useDialog, useDialogContext, usePopover, usePopoverContext, useTooltip, useTooltipContext };
|
|
966
|
+
export { BaseDialog, BaseDialogContent, BasePopover, BaseTooltip, Dialog, DialogContent, DialogContentActions, DialogContentActionsProps, DialogContentBody, DialogContentBodyProps, DialogContentHeader, DialogContentHeaderProps, DialogContentProps, DialogContext, DialogProps, DialogSize, DialogState, DialogTrigger, DialogTriggerProps, Popover, PopoverContent, PopoverContentProps, PopoverContext, PopoverPlacement, PopoverProps, PopoverState, PopoverTrigger, PopoverTriggerProps, StyledDialogContentActionsProps, StyledDialogContentBodyProps, StyledDialogContentHeaderProps, StyledDialogContentProps, StyledDialogProps, StyledPopoverContentProps, StyledPopoverProps, StyledToastContainerProps, StyledToastProps, StyledTooltipContentProps, StyledTooltipProps, Toast, ToastContainer, ToastContainerProps, ToastOptions, ToastPlacement, ToastProps, ToastVariant, Tooltip, TooltipContent, TooltipContentProps, TooltipContext, TooltipPlacement, TooltipProps, TooltipState, TooltipTrigger, TooltipTriggerProps, useDialog, useDialogContext, usePopover, usePopoverContext, useToast, useToastProps, useToastReturnType, useTooltip, useTooltipContext };
|