@m4l/components 4.0.0 → 4.1.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/components/MFIsolationApp/{MFIsolationApp-gs8L4yRC.js → MFIsolationApp-BteTTKTJ.js} +2 -1
- package/contexts/AppearanceComponentContext/AppearanceComponentContext-Dh1xxcRq.js +19 -0
- package/contexts/AppearanceComponentContext/AppearanceComponentContext.d.ts +16 -0
- package/contexts/AppearanceComponentContext/AppearanceComponentStore-sJMNJ0WN.js +24 -0
- package/contexts/AppearanceComponentContext/AppearanceComponentStore.d.ts +20 -0
- package/contexts/AppearanceComponentContext/index-l0sNRNKZ.js +1 -0
- package/contexts/AppearanceComponentContext/index.d.ts +3 -0
- package/contexts/AppearanceComponentContext/useAppearanceComponentStore-Cn0YUt4u.js +15 -0
- package/contexts/AppearanceComponentContext/useAppearanceComponentStore.d.ts +2 -0
- package/contexts/index.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/useComponentSize/index-l0sNRNKZ.js +1 -0
- package/hooks/useComponentSize/index.d.ts +1 -0
- package/hooks/useComponentSize/useComponentSize-IEs8SldY.js +9 -0
- package/hooks/useComponentSize/useComponentSize.d.ts +9 -0
- package/index.js +17 -11
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import NProgress from "nprogress";
|
|
|
7
7
|
import { LocalesProvider, getLocaleFromNetwork, ResponsiveContainerProvider } from "@m4l/graphics";
|
|
8
8
|
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, axiosOperation, AuthProvider } from "@m4l/core";
|
|
9
9
|
import { T as TOAST_CONTAINER_ID } from "./constants-pKuV2ytz.js";
|
|
10
|
+
import { A as AppearanceComponentProvider } from "../../contexts/AppearanceComponentContext/AppearanceComponentContext-Dh1xxcRq.js";
|
|
10
11
|
import { c as createToaster } from "../ToastContainer/helpers/toaster-DzYEKmB3.js";
|
|
11
12
|
import { M as MFAuthApp } from "./subcomponents/MFAuthApp/MFAuthApp-_B9NLBK_.js";
|
|
12
13
|
import { T as ToastContainer } from "../ToastContainer/ToastContainer-CbeZ1op9.js";
|
|
@@ -111,7 +112,7 @@ function MFIsolationApp(props) {
|
|
|
111
112
|
onSelectLayout: (modId) => {
|
|
112
113
|
console.log("onSelectLayout", modId);
|
|
113
114
|
},
|
|
114
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, { observedDivRef, children })
|
|
115
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, { observedDivRef, children: /* @__PURE__ */ jsx(AppearanceComponentProvider, { children }) })
|
|
115
116
|
}
|
|
116
117
|
)
|
|
117
118
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useRef } from "react";
|
|
3
|
+
import { DEFAULT_SIZE } from "@m4l/styles";
|
|
4
|
+
import { c as createAppearanceComponentStore } from "./AppearanceComponentStore-sJMNJ0WN.js";
|
|
5
|
+
const AppearanceComponentContext = createContext(null);
|
|
6
|
+
function AppearanceComponentProvider(props) {
|
|
7
|
+
const { defaultSize, children } = props;
|
|
8
|
+
const appearanceComponentStoreRef = useRef();
|
|
9
|
+
if (!appearanceComponentStoreRef.current) {
|
|
10
|
+
appearanceComponentStoreRef.current = createAppearanceComponentStore({
|
|
11
|
+
defaultSize: defaultSize || DEFAULT_SIZE
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsx(AppearanceComponentContext.Provider, { value: appearanceComponentStoreRef.current, children });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
AppearanceComponentProvider as A,
|
|
18
|
+
AppearanceComponentContext as a
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { type AppearanceComponentState } from './AppearanceComponentStore';
|
|
3
|
+
export declare const AppearanceComponentContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./AppearanceComponentStore").AppearanceComponentStore>, "setState"> & {
|
|
4
|
+
setState<A extends string | {
|
|
5
|
+
type: unknown;
|
|
6
|
+
}>(partial: import("./AppearanceComponentStore").AppearanceComponentStore | Partial<import("./AppearanceComponentStore").AppearanceComponentStore> | ((state: import("./AppearanceComponentStore").AppearanceComponentStore) => import("./AppearanceComponentStore").AppearanceComponentStore | Partial<import("./AppearanceComponentStore").AppearanceComponentStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
7
|
+
}, "setState"> & {
|
|
8
|
+
setState(nextStateOrUpdater: import("./AppearanceComponentStore").AppearanceComponentStore | Partial<import("./AppearanceComponentStore").AppearanceComponentStore> | ((state: import("immer/dist/internal").WritableDraft<import("./AppearanceComponentStore").AppearanceComponentStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
9
|
+
type: unknown;
|
|
10
|
+
} | undefined): void;
|
|
11
|
+
}) | null>;
|
|
12
|
+
interface AppearanceComponentContextProps extends Partial<AppearanceComponentState> {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function AppearanceComponentProvider(props: AppearanceComponentContextProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createStore } from "zustand";
|
|
2
|
+
import { devtools } from "zustand/middleware";
|
|
3
|
+
import { immer } from "zustand/middleware/immer";
|
|
4
|
+
import { DEFAULT_SIZE } from "@m4l/styles";
|
|
5
|
+
const createAppearanceComponentStore = (initProps) => {
|
|
6
|
+
return createStore(
|
|
7
|
+
devtools(
|
|
8
|
+
immer((set) => ({
|
|
9
|
+
defaultSize: initProps.defaultSize ?? DEFAULT_SIZE,
|
|
10
|
+
actions: {
|
|
11
|
+
setDefaultSize: (newDefaultSize) => {
|
|
12
|
+
set((state) => {
|
|
13
|
+
state.defaultSize = newDefaultSize;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
})),
|
|
18
|
+
{ name: "AppearanceComponentStore" }
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
createAppearanceComponentStore as c
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Sizes } from '@m4l/styles';
|
|
2
|
+
export interface AppearanceComponentState {
|
|
3
|
+
defaultSize: Sizes;
|
|
4
|
+
}
|
|
5
|
+
export interface AppearanceComponentActions {
|
|
6
|
+
actions: {
|
|
7
|
+
setDefaultSize: (newDefaultSize: Sizes) => void;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare type AppearanceComponentStore = AppearanceComponentState & AppearanceComponentActions;
|
|
11
|
+
export declare const createAppearanceComponentStore: (initProps: AppearanceComponentState) => Omit<Omit<import("zustand").StoreApi<AppearanceComponentStore>, "setState"> & {
|
|
12
|
+
setState<A extends string | {
|
|
13
|
+
type: unknown;
|
|
14
|
+
}>(partial: AppearanceComponentStore | Partial<AppearanceComponentStore> | ((state: AppearanceComponentStore) => AppearanceComponentStore | Partial<AppearanceComponentStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
15
|
+
}, "setState"> & {
|
|
16
|
+
setState(nextStateOrUpdater: AppearanceComponentStore | Partial<AppearanceComponentStore> | ((state: import("immer/dist/internal").WritableDraft<AppearanceComponentStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
17
|
+
type: unknown;
|
|
18
|
+
} | undefined): void;
|
|
19
|
+
};
|
|
20
|
+
export declare type AppearanceComponentReturnType = ReturnType<typeof createAppearanceComponentStore>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { useStore } from "zustand";
|
|
3
|
+
import { shallow } from "zustand/shallow";
|
|
4
|
+
import { a as AppearanceComponentContext } from "./AppearanceComponentContext-Dh1xxcRq.js";
|
|
5
|
+
function useAppearanceComponentStore(selector, equalityFn) {
|
|
6
|
+
const store = useContext(AppearanceComponentContext);
|
|
7
|
+
if (!store)
|
|
8
|
+
throw new Error(
|
|
9
|
+
"useAppearanceComponentStore context must be use inside AppearanceComponentContext"
|
|
10
|
+
);
|
|
11
|
+
return useStore(store, selector, equalityFn ?? shallow);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
useAppearanceComponentStore as u
|
|
15
|
+
};
|
package/contexts/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export * from './ModalContext/types';
|
|
|
4
4
|
export type { FormInitialValues, FormStatusLoad } from './RHFormContext/types';
|
|
5
5
|
export { RHFormProvider } from './RHFormContext';
|
|
6
6
|
export { getFormComponentsDictionary } from './RHFormContext/dictionary';
|
|
7
|
+
export { useAppearanceComponentStore, AppearanceComponentProvider, } from './AppearanceComponentContext';
|
package/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useComponentSize } from './useComponentSize';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { u as useAppearanceComponentStore } from "../../contexts/AppearanceComponentContext/useAppearanceComponentStore-Cn0YUt4u.js";
|
|
2
|
+
function useComponentSize(componentSize = null) {
|
|
3
|
+
const defaultSize = useAppearanceComponentStore((state) => state.defaultSize);
|
|
4
|
+
const setDefaultSize = useAppearanceComponentStore((state) => state.actions.setDefaultSize);
|
|
5
|
+
return { currentSize: componentSize ?? defaultSize, setDefaultSize };
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
useComponentSize as u
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
/**
|
|
3
|
+
* hook usado para obtener el valor por defecto para los componentes que usan la prop size
|
|
4
|
+
* @return { currentSize, setDefaultSize } objeto con el valor por default del size y la función para cambiarlo
|
|
5
|
+
*/
|
|
6
|
+
export declare function useComponentSize(componentSize?: Sizes | null | undefined): {
|
|
7
|
+
currentSize: Sizes;
|
|
8
|
+
setDefaultSize: (newDefaultSize: Sizes) => void;
|
|
9
|
+
};
|
package/index.js
CHANGED
|
@@ -150,18 +150,21 @@ import { A as A15 } from "./components/commercial/AppBarCommercial/index-BbLE2KQ
|
|
|
150
150
|
import { H as H3 } from "./components/commercial/HamburgerMenu/HamburgerMenu-B_wv12aV.js";
|
|
151
151
|
import { T as T12 } from "./components/commercial/TopBar/TopBar-CQBs7prv.js";
|
|
152
152
|
import { S as S6 } from "./components/commercial/SectionCommercial/index-A54Y957q.js";
|
|
153
|
-
import { M as M10 } from "./components/MFIsolationApp/MFIsolationApp-
|
|
153
|
+
import { M as M10 } from "./components/MFIsolationApp/MFIsolationApp-BteTTKTJ.js";
|
|
154
154
|
import { B as B6 } from "./components/BaseModule/BaseModule-ut5-cA-D.js";
|
|
155
155
|
import { a as a10, D as D6, M as M11 } from "./components/areas/contexts/DynamicMFParmsContext/index-SHbC_49A.js";
|
|
156
156
|
import { R as R15 } from "./contexts/RHFormContext/index-DE-wmCBw.js";
|
|
157
157
|
import { g as g25 } from "./contexts/RHFormContext/dictionary-Dsuwh7PB.js";
|
|
158
|
+
import { u as u7 } from "./contexts/AppearanceComponentContext/useAppearanceComponentStore-Cn0YUt4u.js";
|
|
159
|
+
import { A as A16 } from "./contexts/AppearanceComponentContext/AppearanceComponentContext-Dh1xxcRq.js";
|
|
158
160
|
import { a as a11, M as M12 } from "./contexts/ModalContext/index-B7tc4o1X.js";
|
|
159
|
-
import { u as
|
|
160
|
-
import { u as
|
|
161
|
-
import { u as
|
|
161
|
+
import { u as u8 } from "./hooks/useFormAddEdit/index-BNAXqhmd.js";
|
|
162
|
+
import { u as u9 } from "./hooks/useModal/index-CvlomTtY.js";
|
|
163
|
+
import { u as u10 } from "./hooks/useTab/index-CRVh_6kE.js";
|
|
162
164
|
import { g as g26 } from "./hooks/useFormAddEdit/dictionary-DFRDT91K.js";
|
|
163
|
-
import { u as
|
|
164
|
-
import { u as
|
|
165
|
+
import { u as u11 } from "./hooks/useFormFocus/index-B1F2sySJ.js";
|
|
166
|
+
import { u as u12 } from "./hooks/useInterval/index-CVxgquG2.js";
|
|
167
|
+
import { u as u13 } from "./hooks/useComponentSize/useComponentSize-IEs8SldY.js";
|
|
165
168
|
export {
|
|
166
169
|
A5 as AREAS_DICTIONARY_ID,
|
|
167
170
|
A6 as Accordion,
|
|
@@ -174,6 +177,7 @@ export {
|
|
|
174
177
|
A as AnimatedScroll,
|
|
175
178
|
A13 as AppBar,
|
|
176
179
|
A15 as AppBarComercial,
|
|
180
|
+
A16 as AppearanceComponentProvider,
|
|
177
181
|
A2 as AreasAdmin,
|
|
178
182
|
a3 as AreasContext,
|
|
179
183
|
A4 as AreasProvider,
|
|
@@ -337,16 +341,18 @@ export {
|
|
|
337
341
|
g26 as getformAddEditDictionary,
|
|
338
342
|
i as isEqualLayout,
|
|
339
343
|
k as isEqualLayouts,
|
|
344
|
+
u7 as useAppearanceComponentStore,
|
|
345
|
+
u13 as useComponentSize,
|
|
340
346
|
u as useDynamicMFParametersStore,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
347
|
+
u8 as useFormAddEdit,
|
|
348
|
+
u11 as useFormFocus,
|
|
349
|
+
u12 as useInterval,
|
|
344
350
|
u4 as useMapStore,
|
|
345
351
|
u5 as useMapToolsStore,
|
|
346
|
-
|
|
352
|
+
u9 as useModal,
|
|
347
353
|
u6 as usePopupsStore,
|
|
348
354
|
u3 as useSetWindowsTitle,
|
|
349
|
-
|
|
355
|
+
u10 as useTab,
|
|
350
356
|
u2 as useWindowToolsMF,
|
|
351
357
|
v2 as varBounce,
|
|
352
358
|
v3 as varContainer,
|