@trii/components 3.1.3 → 3.1.5
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/async-state/package.json +9 -9
- package/dist/cjs/async-state.js.map +1 -1
- package/dist/cjs/index.js +105 -105
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/theme.js +1 -1
- package/dist/cjs/theme.js.map +1 -1
- package/dist/esm/async-state.js.map +1 -1
- package/dist/esm/index.js +105 -105
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/theme.js +1 -1
- package/dist/esm/theme.js.map +1 -1
- package/dist/index.d.ts +36 -5
- package/dist/theme.d.ts +36 -5
- package/dist/types/asyncState/__tests__/asyncState.test.d.ts +1 -0
- package/dist/types/asyncState/__tests__/useAsyncData.test.d.ts +1 -0
- package/dist/types/components/AsyncContent/__tests__/AsyncContent.test.d.ts +1 -0
- package/dist/types/components/AsyncContent/__tests__/AsyncContentI18n.test.d.ts +1 -0
- package/dist/types/components/ContactInfoPopup/ContactInfoPopup.stories.d.ts +9 -0
- package/dist/types/components/ContactSidebar/ContactSidebar.stories.d.ts +58 -0
- package/dist/types/components/EditContactModal/EditContactModal.stories.d.ts +9 -0
- package/dist/types/components/EventsDialog/components/LinkContactsSelect/styles.d.ts +6 -0
- package/dist/types/components/EventsDialog/components/LocationTextField/MapLocationPicker.d.ts +8 -0
- package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/components/GoogleMap/index.d.ts +1 -0
- package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/components/index.d.ts +1 -0
- package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/index.d.ts +3 -0
- package/dist/types/components/EventsDialog/hooks/index.d.ts +9 -0
- package/dist/types/components/EventsDialog/hooks/useSelect.d.ts +14 -0
- package/dist/types/components/EventsDialog/utils/eventValidation.d.ts +37 -0
- package/dist/types/components/EventsDialog/utils/googleMapsUtils.d.ts +5 -0
- package/dist/types/components/EventsDialog/utils/keyboardNavigation.d.ts +24 -0
- package/dist/types/components/PanelErrorBoundary/__tests__/PanelErrorBoundary.test.d.ts +1 -0
- package/dist/types/theme/MuiComponentsConfig.test.d.ts +1 -0
- package/dist/types/theme/darkThemeComponents.d.ts +3 -0
- package/dist/types/theme/index.d.ts +2 -0
- package/dist/types/theme/themePreference.d.ts +14 -0
- package/dist/types/theme/themePreference.test.d.ts +1 -0
- package/dist/types/theme/themeProvider.d.ts +17 -0
- package/dist/types/theme/themeProvider.test.d.ts +1 -0
- package/dist/types/theme/themeSlice.d.ts +6 -5
- package/package.json +194 -174
- package/readme +71 -71
- package/theme/package.json +9 -9
- package/dist/types/components/EditContactModal/context/LanguageContext.d.ts +0 -9
- package/dist/types/components/EventsDialog/theme/MuiComponentsConfig.d.ts +0 -3
- package/dist/types/components/EventsDialog/theme/index.d.ts +0 -4
- package/dist/types/components/EventsDialog/theme/themeProvider.d.ts +0 -74
- package/dist/types/components/EventsDialog/theme/themeSlice.d.ts +0 -52
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
/**
|
|
3
|
+
* El componente es SOLO el panel de contacto (sin el header de vistas
|
|
4
|
+
* Contacto/Interacción/Asistente, que vive en el host) y su root es un
|
|
5
|
+
* Fragment: el decorator provee el contenedor flex `position: relative`
|
|
6
|
+
* contra el que se posicionan el overlay y el skeleton.
|
|
7
|
+
*
|
|
8
|
+
* El panel resuelve todo contra la API con `baseUrl` + `spaceId`, así que en
|
|
9
|
+
* Storybook hay que apuntarlo a un espacio real (y estar logueado, porque el
|
|
10
|
+
* token lo inyecta el interceptor del anfitrión).
|
|
11
|
+
*
|
|
12
|
+
* Ver README.md para el detalle de cada prop.
|
|
13
|
+
*/
|
|
14
|
+
declare const meta: {
|
|
15
|
+
component: (props: import("./ChatDetailsSidebar").ChatDetailsSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: string;
|
|
18
|
+
};
|
|
19
|
+
tags: string[];
|
|
20
|
+
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
21
|
+
baseUrl: string;
|
|
22
|
+
spaceId: string;
|
|
23
|
+
onEntityUpdated?: ((entity: import("@trii/types/dist/Contacts").IContact | import("@trii/types/dist/Contacts").IBusiness) => void) | undefined;
|
|
24
|
+
chat?: import("./ChatDetailsSidebar").SidebarChatIntegration | undefined;
|
|
25
|
+
googleMapsApiKey?: string | undefined;
|
|
26
|
+
navigate?: ((path: string) => void) | undefined;
|
|
27
|
+
language?: string | undefined;
|
|
28
|
+
active?: boolean | undefined;
|
|
29
|
+
contactId: string | null;
|
|
30
|
+
entityType: "contact" | "business";
|
|
31
|
+
initialEntity?: (import("@trii/types/dist/Contacts").IContact | import("@trii/types/dist/Contacts").IBusiness | null) | undefined;
|
|
32
|
+
entity?: never | undefined;
|
|
33
|
+
} | {
|
|
34
|
+
baseUrl: string;
|
|
35
|
+
spaceId: string;
|
|
36
|
+
onEntityUpdated?: ((entity: import("@trii/types/dist/Contacts").IContact | import("@trii/types/dist/Contacts").IBusiness) => void) | undefined;
|
|
37
|
+
chat?: import("./ChatDetailsSidebar").SidebarChatIntegration | undefined;
|
|
38
|
+
googleMapsApiKey?: string | undefined;
|
|
39
|
+
navigate?: ((path: string) => void) | undefined;
|
|
40
|
+
language?: string | undefined;
|
|
41
|
+
active?: boolean | undefined;
|
|
42
|
+
entity: import("@trii/types/dist/Contacts").IContact | import("@trii/types/dist/Contacts").IBusiness;
|
|
43
|
+
contactId?: never | undefined;
|
|
44
|
+
entityType?: never | undefined;
|
|
45
|
+
initialEntity?: never | undefined;
|
|
46
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
47
|
+
};
|
|
48
|
+
export default meta;
|
|
49
|
+
type Story = StoryObj<typeof meta>;
|
|
50
|
+
/**
|
|
51
|
+
* Forma A (recomendada): se le pasa la ficha completa y de ahí deduce el id y
|
|
52
|
+
* el tipo. Sin `chat`, o sea en modo ficha.
|
|
53
|
+
*/
|
|
54
|
+
export declare const ConEntidad: Story;
|
|
55
|
+
/** Forma B: solo el id, declarando el tipo a mano. */
|
|
56
|
+
export declare const ConId: Story;
|
|
57
|
+
/** Empresa: el tipo sale del `isBusiness` de la entidad. */
|
|
58
|
+
export declare const Empresa: Story;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const SelectPrimaryContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/system").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
|
|
4
|
+
export declare const SelectSecondaryContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/system").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
5
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
6
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
|
package/dist/types/components/EventsDialog/components/LocationTextField/MapLocationPicker.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface MapLocationPickerProps {
|
|
3
|
+
onLocationSelect: (address: string, lat: number, lng: number) => void;
|
|
4
|
+
initialAddress?: string;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const MapLocationPicker: React.FC<MapLocationPickerProps>;
|
|
8
|
+
export default MapLocationPicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './GoogleMapStandalone';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as GoogleMapStandalone } from './GoogleMap/GoogleMapStandalone';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as useField, useFieldInitialState, type UseFieldType } from './useField';
|
|
2
|
+
export { default as useSelect, type UseSelect } from './useSelect';
|
|
3
|
+
export { default as useDialog, useDialogInitialState, type UseDialog } from './useDialog';
|
|
4
|
+
export { default as useEvent, useEventInitialState, type UseEvent, type UseDateState, type UseLinkContact, } from './useEvent';
|
|
5
|
+
export { type UseNotificationsType } from './useNotifications';
|
|
6
|
+
export { default as useTask, useTaskInitialState, type UseTask } from './useTask';
|
|
7
|
+
export { default as useCalendar, useCalendarInitialState, type UseCalendarType, } from './useCalendar';
|
|
8
|
+
export { default as useCalendarEvents, useCalendarEventsInitialState, type UseCalendarEventsType, type CalendarEvent, } from './useCalendarEvents';
|
|
9
|
+
export { default as useCalendarTasks, useCalendarTasksInitialState, type UseCalendarTasksType, type CalendarTask, } from './useCalendarTasks';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SelectChangeEvent } from '@mui/material';
|
|
3
|
+
export interface UseSelect {
|
|
4
|
+
actions: {
|
|
5
|
+
resetValue: () => void;
|
|
6
|
+
changeValue: (newValue: string | number) => void;
|
|
7
|
+
};
|
|
8
|
+
attributes: {
|
|
9
|
+
value: string | number;
|
|
10
|
+
onChange: (event: SelectChangeEvent<string>, child: ReactNode) => void;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare const useSelect: (initialValue: string | number) => UseSelect;
|
|
14
|
+
export default useSelect;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilidades para validación de eventos del calendario
|
|
3
|
+
*/
|
|
4
|
+
export interface CalendarItem {
|
|
5
|
+
id?: string;
|
|
6
|
+
start: Date | string;
|
|
7
|
+
end: Date | string;
|
|
8
|
+
title?: string;
|
|
9
|
+
kind?: 'event' | 'task';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Verifica si dos eventos se solapan en el tiempo
|
|
13
|
+
*/
|
|
14
|
+
export declare const eventsOverlap: (event1: CalendarItem, event2: CalendarItem) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Encuentra todos los eventos que se solapan con un evento dado
|
|
17
|
+
*/
|
|
18
|
+
export declare const findOverlappingEvents: (targetEvent: CalendarItem, allEvents: CalendarItem[]) => CalendarItem[];
|
|
19
|
+
/**
|
|
20
|
+
* Valida que un evento tenga fechas válidas
|
|
21
|
+
*/
|
|
22
|
+
export declare const validateEventDates: (event: CalendarItem) => {
|
|
23
|
+
isValid: boolean;
|
|
24
|
+
error?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Genera un mensaje descriptivo sobre eventos solapados
|
|
28
|
+
*/
|
|
29
|
+
export declare const getOverlapWarningMessage: (overlappingEvents: CalendarItem[]) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Calcula la duración de un evento en minutos
|
|
32
|
+
*/
|
|
33
|
+
export declare const getEventDuration: (event: CalendarItem) => number;
|
|
34
|
+
/**
|
|
35
|
+
* Verifica si un evento es de todo el día
|
|
36
|
+
*/
|
|
37
|
+
export declare const isAllDayEvent: (event: CalendarItem) => boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exportaciones de googleMapsLoader para mantener compatibilidad
|
|
3
|
+
* Este archivo actúa como alias para las funciones de Google Maps
|
|
4
|
+
*/
|
|
5
|
+
export { GOOGLE_MAPS_CONFIG, GOOGLE_MAPS_SCRIPT_CONFIG, useGoogleMapsLoader, loadGoogleMapsAsync, getStaticMapUrl, geocodeAddress, } from './googleMapsLoader';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilidades para navegación por teclado en el calendario
|
|
3
|
+
*/
|
|
4
|
+
type View = 'month' | 'week' | 'day' | 'work_week' | 'agenda';
|
|
5
|
+
export interface KeyboardNavigationConfig {
|
|
6
|
+
onNavigate: (action: 'PREV' | 'NEXT' | 'TODAY' | 'DATE', date?: Date) => void;
|
|
7
|
+
onViewChange: (view: View) => void;
|
|
8
|
+
onCreateEvent?: () => void;
|
|
9
|
+
currentDate: Date;
|
|
10
|
+
currentView: View;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Maneja los eventos de teclado para el calendario
|
|
14
|
+
*/
|
|
15
|
+
export declare const handleCalendarKeyDown: (event: KeyboardEvent, config: KeyboardNavigationConfig) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Genera el mensaje de ayuda para atajos de teclado
|
|
18
|
+
*/
|
|
19
|
+
export declare const getKeyboardShortcutsHelp: () => string;
|
|
20
|
+
/**
|
|
21
|
+
* Genera los atributos ARIA para el calendario
|
|
22
|
+
*/
|
|
23
|
+
export declare const getCalendarAriaAttributes: (currentView: View, currentDate: Date) => Record<string, string>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,3 +3,5 @@ export type { MuiComponentsConfigOptions } from './MuiComponentsConfig';
|
|
|
3
3
|
export { default as themeReducer } from './themeSlice';
|
|
4
4
|
export * from './themeProvider';
|
|
5
5
|
export * from './themeSlice';
|
|
6
|
+
export { THEME_PREFERENCES, normalizeThemePreference, resolveThemePreference, observeThemePreference } from './themePreference';
|
|
7
|
+
export type { ThemePreference, ResolvedTheme, LegacyThemeName } from './themePreference';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ThemePreference = 'light' | 'dark' | 'system';
|
|
2
|
+
export type ResolvedTheme = 'light' | 'dark';
|
|
3
|
+
export declare const THEME_PREFERENCES: readonly ThemePreference[];
|
|
4
|
+
export declare const LEGACY_THEME_NAMES: readonly ["lightBlueIndigo", "lightBlue", "lightRed", "lightGreen", "lightPink", "lightPurple", "lightTeal", "lightLime", "lightYellow", "lightAmber", "lightOrange", "lightBrown", "lightGray", "darkBlue", "darkBlack"];
|
|
5
|
+
export type LegacyThemeName = typeof LEGACY_THEME_NAMES[number];
|
|
6
|
+
export type ThemeName = ThemePreference | LegacyThemeName;
|
|
7
|
+
export declare const isValidThemeName: (name: string) => name is ThemeName;
|
|
8
|
+
/** Missing/unknown preferences follow the OS. Existing choices keep their mode. */
|
|
9
|
+
export declare const normalizeThemePreference: (name?: string | null) => ThemePreference;
|
|
10
|
+
export declare const resolveThemePreference: (preference: ThemePreference, systemDark?: boolean) => ResolvedTheme;
|
|
11
|
+
/** Emits immediately; caller must unsubscribe on unmount/preference change.
|
|
12
|
+
* Does not persist or call an API when the OS appearance changes.
|
|
13
|
+
*/
|
|
14
|
+
export declare const observeThemePreference: (preference: ThemePreference, listener: (mode: ResolvedTheme) => void) => (() => void);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -57,18 +57,35 @@ declare module '@mui/material/styles' {
|
|
|
57
57
|
name?: string;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
export declare const lightTheme: Theme;
|
|
61
|
+
export declare const darkTheme: Theme;
|
|
62
|
+
/** @deprecated Use lightTheme. */
|
|
60
63
|
export declare const lightBlueIndigo: Theme;
|
|
64
|
+
/** @deprecated Use lightTheme. */
|
|
61
65
|
export declare const lightBlue: Theme;
|
|
66
|
+
/** @deprecated Use lightTheme. */
|
|
62
67
|
export declare const lightRed: Theme;
|
|
68
|
+
/** @deprecated Use lightTheme. */
|
|
63
69
|
export declare const lightGreen: Theme;
|
|
70
|
+
/** @deprecated Use lightTheme. */
|
|
64
71
|
export declare const lightPink: Theme;
|
|
72
|
+
/** @deprecated Use lightTheme. */
|
|
65
73
|
export declare const lightPurple: Theme;
|
|
74
|
+
/** @deprecated Use lightTheme. */
|
|
66
75
|
export declare const lightTeal: Theme;
|
|
76
|
+
/** @deprecated Use lightTheme. */
|
|
67
77
|
export declare const lightLime: Theme;
|
|
78
|
+
/** @deprecated Use lightTheme. */
|
|
68
79
|
export declare const lightYellow: Theme;
|
|
80
|
+
/** @deprecated Use lightTheme. */
|
|
69
81
|
export declare const lightAmber: Theme;
|
|
82
|
+
/** @deprecated Use lightTheme. */
|
|
70
83
|
export declare const lightOrange: Theme;
|
|
84
|
+
/** @deprecated Use lightTheme. */
|
|
71
85
|
export declare const lightBrown: Theme;
|
|
86
|
+
/** @deprecated Use lightTheme. */
|
|
72
87
|
export declare const lightGray: Theme;
|
|
88
|
+
/** @deprecated Use darkTheme. */
|
|
73
89
|
export declare const darkBlue: Theme;
|
|
90
|
+
/** @deprecated Use darkTheme. */
|
|
74
91
|
export declare const darkBlack: Theme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Theme } from '@mui/material';
|
|
2
|
+
import { ThemeName, ThemePreference, ResolvedTheme } from './themePreference';
|
|
3
|
+
export { isValidThemeName } from './themePreference';
|
|
4
|
+
export type { ThemeName } from './themePreference';
|
|
2
5
|
/**
|
|
3
6
|
* Forma mínima del store que necesita este slice: la app que lo use tiene que
|
|
4
7
|
* tener `Theme` y `User.user.uid`.
|
|
@@ -13,11 +16,10 @@ export interface ThemeRootState {
|
|
|
13
16
|
};
|
|
14
17
|
Theme: ThemeState;
|
|
15
18
|
}
|
|
16
|
-
/** Nombres de tema disponibles. */
|
|
17
|
-
export type ThemeName = 'lightBlueIndigo' | 'darkBlack' | 'darkBlue' | 'lightAmber' | 'lightBlue' | 'lightBrown' | 'lightGray' | 'lightGreen' | 'lightLime' | 'lightOrange' | 'lightPink' | 'lightPurple' | 'lightRed' | 'lightTeal' | 'lightYellow';
|
|
18
19
|
/** Estado del slice. */
|
|
19
20
|
export interface ThemeState {
|
|
20
21
|
themeSelected: Theme;
|
|
22
|
+
preference: ThemePreference;
|
|
21
23
|
darkMode: boolean;
|
|
22
24
|
toggleStatus: 'idle' | 'toggled';
|
|
23
25
|
}
|
|
@@ -34,9 +36,8 @@ export declare const updateTheme: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
34
36
|
fulfilledMeta?: unknown;
|
|
35
37
|
rejectedMeta?: unknown;
|
|
36
38
|
}>;
|
|
37
|
-
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const toggleTheme: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<ThemeName, "Theme/toggleTheme">, toggleModeTheme: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"Theme/toggleModeTheme">;
|
|
39
|
+
export declare const selectThemePreference: (state: ThemeRootState) => ThemePreference;
|
|
40
|
+
export declare const toggleTheme: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<ThemeName, "Theme/toggleTheme">, toggleModeTheme: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"Theme/toggleModeTheme">, systemThemeChanged: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<ResolvedTheme, "Theme/systemThemeChanged">;
|
|
40
41
|
export declare const selectThemeToggleStatus: (state: ThemeRootState) => "idle" | "toggled";
|
|
41
42
|
export declare const selectTheme: (state: ThemeRootState) => Theme;
|
|
42
43
|
export declare const selectDarkTheme: (state: ThemeRootState) => boolean;
|