@televet/kibble-ui 1.16.2 → 1.17.0-beta.44rn6j6.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.
@@ -4,8 +4,9 @@ import { IconProps } from 'components/MediaAndIcons';
4
4
  import { AlertVariant } from './alert.types';
5
5
  import { ButtonProps } from 'components/Forms/Button';
6
6
  import { TextProps } from 'components/Typography/Text';
7
+ import { Status } from '../feedback.types';
7
8
  export interface AlertProps extends CAlertProps {
8
- status?: AlertVariant;
9
+ status?: AlertVariant | Status;
9
10
  showIcon?: boolean;
10
11
  iconProps?: IconProps;
11
12
  showButton?: boolean;
@@ -1,8 +1,7 @@
1
- import { AlertButtonAlignment, AlertVariant } from '../../alert.types';
1
+ import { AlertButtonAlignment } from '../../alert.types';
2
2
  import { ButtonProps } from 'components/Forms/Button';
3
3
  export interface AlertButtonProps extends ButtonProps {
4
4
  alignment: AlertButtonAlignment;
5
- status: AlertVariant;
6
5
  pairedWithCloseButton?: boolean;
7
6
  }
8
- export declare const AlertButton: ({ status, alignment, variant, size, pairedWithCloseButton, ...rest }: AlertButtonProps) => JSX.Element;
7
+ export declare const AlertButton: ({ alignment, variant, size, pairedWithCloseButton, ...rest }: AlertButtonProps) => JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { AlertVariant } from '../../alert.types';
2
2
  import { IconProps } from 'components/MediaAndIcons/Icon';
3
+ import { Status } from '../../../feedback.types';
3
4
  export interface AlertIconProps extends IconProps {
4
- status: AlertVariant;
5
+ status: AlertVariant | Status;
5
6
  }
6
7
  export declare const AlertIcon: ({ status, ...rest }: AlertIconProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './useToast';
@@ -0,0 +1,7 @@
1
+ export declare type LogicalToastPosition = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
2
+ export declare type ToastPositionWithLogical = LogicalToastPosition | 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right';
3
+ export declare type ToastPosition = Exclude<ToastPositionWithLogical, LogicalToastPosition>;
4
+ export declare type WithoutLogicalPosition<T> = Omit<T, 'position'> & {
5
+ position?: ToastPosition;
6
+ };
7
+ export declare function getToastPlacement(position: ToastPositionWithLogical | undefined, dir: 'ltr' | 'rtl'): ToastPosition | undefined;
@@ -0,0 +1,77 @@
1
+ import * as React from 'react';
2
+ import { ColorMode, useChakra } from '@chakra-ui/system';
3
+ import { RenderProps, ToastOptions, ToastPositionWithLogical } from '@chakra-ui/react';
4
+ import { ToastId } from '@chakra-ui/toast/dist/declarations/src/toast.types';
5
+ import { Status } from '../feedback.types';
6
+ export interface UseToastOptions {
7
+ /**
8
+ * The placement of the toast
9
+ *
10
+ * @default "top"
11
+ */
12
+ position?: ToastPositionWithLogical;
13
+ /**
14
+ * The delay before the toast hides (in milliseconds)
15
+ * If set to `null`, toast will never dismiss.
16
+ *
17
+ * @default 5000 ( = 5000ms )
18
+ */
19
+ duration?: ToastOptions['duration'];
20
+ /**
21
+ * Render a component toast component.
22
+ * Any component passed will receive 2 props: `id` and `onClose`.
23
+ */
24
+ render?(props: RenderProps): React.ReactNode;
25
+ /**
26
+ * The title of the toast
27
+ */
28
+ title: string;
29
+ /**
30
+ * The description of the toast
31
+ */
32
+ description?: string;
33
+ /**
34
+ * If `true`, toast will show a close button
35
+ */
36
+ isClosable?: boolean;
37
+ /**
38
+ * The status of the toast.
39
+ */
40
+ status?: Status;
41
+ /**
42
+ * The `id` of the toast.
43
+ *
44
+ * Mostly used when you need to prevent duplicate.
45
+ * By default, we generate a unique `id` for each toast
46
+ */
47
+ id?: ToastId;
48
+ /**
49
+ * Callback function to run side effects after the toast has closed.
50
+ */
51
+ onCloseComplete?: () => void;
52
+ /**
53
+ * Optional style overrides for the container wrapping the toast component.
54
+ */
55
+ containerStyle?: React.CSSProperties;
56
+ /**
57
+ * Used to manually close the toast.
58
+ */
59
+ onClose?: () => void;
60
+ buttonTitle?: string;
61
+ onButtonClick?: () => void;
62
+ }
63
+ export declare type CreateStandAloneToastParam = Partial<ReturnType<typeof useChakra> & {
64
+ setColorMode: (value: ColorMode) => void;
65
+ defaultOptions: UseToastOptions;
66
+ }>;
67
+ export declare const defaultStandaloneParam: Required<CreateStandAloneToastParam>;
68
+ /**
69
+ * Create a toast from outside of React Components
70
+ */
71
+ export declare const createStandaloneToast: ({ theme, defaultOptions, }?: CreateStandAloneToastParam) => (options?: UseToastOptions | undefined) => ToastId | undefined;
72
+ /**
73
+ * React hook used to create a function that can be used
74
+ * to show toasts in an application.
75
+ */
76
+ export declare const useToast: (options?: UseToastOptions | undefined) => (options?: UseToastOptions | undefined) => ToastId | undefined;
77
+ export default useToast;
@@ -0,0 +1 @@
1
+ export declare type Status = 'info' | 'success' | 'warning' | 'error';
@@ -1,2 +1,3 @@
1
1
  export * from './Alert';
2
+ export * from './Toast';
2
3
  export * from './Spinner';
@@ -18,4 +18,4 @@ export interface DatePickerProps {
18
18
  *
19
19
  * More dateFormat info: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
20
20
  */
21
- export declare const DatePicker: ({ date, onDateChange, inputProps, placement, dateFormat, minYear, maxYear, }: DatePickerProps) => JSX.Element;
21
+ export declare const BetaDatePicker: ({ date, onDateChange, inputProps, placement, dateFormat, minYear, maxYear, }: DatePickerProps) => JSX.Element;