@eclass/ui-kit 1.19.2 → 1.21.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.
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { IAlertProps } from './types.d';
3
+ /**
4
+ * Componente de alerta embebida que puede tener 4 estados diferentes.
5
+ * Opcionalmente puede llevar un botón. El botón puede mostrar sólo un texto
6
+ * o un texto junto a un ícono.
7
+ * @example Implementación de alerta con botón y margen
8
+ * <Alert
9
+ * state='info'
10
+ * buttonName='Texto botón'
11
+ * buttonIcon={<Multimedia />}
12
+ * onClick={() => alert('hola')}
13
+ * m='0 20px'>
14
+ * Mensaje
15
+ * </Alert>
16
+ */
17
+ export declare function Alert({ children, canDismiss, buttonText, buttonIcon, buttonLink, onClick, state, m, }: IAlertProps): JSX.Element;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { IFlashNotificationProps } from './types.d';
3
+ /**
4
+ * Componente de notificación flash que se muestra centrada en la parte superior de la pantalla.
5
+ * Para implementarlo, se usa en conjunto con el hook useFlashNotification.
6
+ * @example Llamado useFlashNotification y asignación de props
7
+ * const { show, active, config } = useFlashNotification({
8
+ * state: 'info',
9
+ * message: 'Respuesta guardada',
10
+ *})
11
+ * @example Definición de trigger que activa la notificación
12
+ * <button onClick={() => { active()}}> Activar notificación </button>
13
+ * @example Componente FlashNotification recibiendo argumentos
14
+ * <FlashNotification {...config} show={show} />
15
+ */
16
+ export declare function FlashNotification({ message, state, show, m, }: IFlashNotificationProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { Alert } from './Alert';
2
+ export { FlashNotification } from './FlashNotification';
3
+ export { useFlashNotification } from './utils/useFlashNotification';
@@ -0,0 +1,62 @@
1
+ type TState = 'error' | 'info' | 'success' | 'warning'
2
+ export interface IAlertProps {
3
+ /**
4
+ * Mensaje de alerta
5
+ */
6
+ children?: React.ReactChild | React.ReactChild[]
7
+ /**
8
+ * Muestra el botón para cerrar
9
+ */
10
+ canDismiss?: boolean
11
+ /**
12
+ * Texto del botón
13
+ */
14
+ buttonText?: string
15
+ /**
16
+ * Ícono del botón
17
+ */
18
+ buttonIcon?: React.ReactElement
19
+ /**
20
+ * Boolean que determina si el botón es tipo link
21
+ */
22
+ buttonLink?: boolean
23
+ /**
24
+ * Función del botón
25
+ */
26
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void
27
+ /**
28
+ * Estado que define color e ícono de la alerta
29
+ * @exampe
30
+ * 'error'
31
+ * 'info'
32
+ * 'success'
33
+ * 'warning'
34
+ */
35
+ state: TState
36
+ /**
37
+ * Margen
38
+ */
39
+ m?: string
40
+ }
41
+
42
+ export interface IFlashNotificationProps {
43
+ /**
44
+ * Margen
45
+ */
46
+ m?: string
47
+ /**
48
+ * Mensaje que muestra la notificación
49
+ */
50
+ message: string
51
+ /**
52
+ * Estado que define color e ícono de la alerta
53
+ * @exampe
54
+ * 'error'
55
+ * 'info'
56
+ * 'success'
57
+ * 'warning'
58
+ * @
59
+ */
60
+ state: TState
61
+ show?: boolean
62
+ }
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ export declare const alertStates: {
3
+ success: {
4
+ icon: JSX.Element;
5
+ bg: string;
6
+ id: string;
7
+ };
8
+ error: {
9
+ icon: JSX.Element;
10
+ bg: string;
11
+ id: string;
12
+ };
13
+ info: {
14
+ icon: JSX.Element;
15
+ bg: string;
16
+ id: string;
17
+ };
18
+ warning: {
19
+ icon: JSX.Element;
20
+ bg: string;
21
+ id: string;
22
+ };
23
+ };
@@ -0,0 +1 @@
1
+ export declare const handleTime: (message: string) => number;
@@ -0,0 +1,18 @@
1
+ import { IFlashNotificationProps } from '../types';
2
+ /**
3
+ * Hook que actúa como trigger del componente FlashNotification,
4
+ * usando los siguientes parámetros:
5
+ * show: boolean que indica si la notificación se está mostrando o no,
6
+ * active: función que modifica el estado de show,
7
+ * config: contiene los valores de 'state' y message'
8
+ * @example Llamado useFlashNotification y asignación de props
9
+ * const { show, active, config } = useFlashNotification({
10
+ * state: 'info',
11
+ * message: 'Respuesta guardada',
12
+ *})
13
+ * @example Definición de trigger que activa la notificación
14
+ * <button onClick={() => { active()}}> Activar notificación </button>
15
+ * @example Componente FlashNotification recibiendo argumentos
16
+ * <FlashNotification {...config} show={show} />
17
+ */
18
+ export declare const useFlashNotification: ({ state, message }: IFlashNotificationProps) => any;
@@ -1 +1,2 @@
1
1
  export * from './CourseList';
2
+ export * from './Alerts';