@m4l/layouts 0.1.39 → 0.1.40

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.
@@ -1,25 +1,26 @@
1
- import { useResponsiveDesktop as I, useLocales as $ } from "@m4l/graphics";
2
- import { LanguagePopover as h, Image as x, Typography as a, ScrollBar as m, HelmetPage as W } from "@m4l/components";
3
- import { styled as t, alpha as d } from "@mui/material/styles";
4
- import { useBase as u, useModuleDictionary as g, useDomain as y, useEnvironment as H, BaseProvider as N, FlagsProvider as R, ModuleDictionaryProvider as U, ModuleSkeletonProvider as F } from "@m4l/core";
5
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
6
- const P = t("div")(({
7
- theme: o
1
+ import { useResponsiveDesktop, useLocales } from "@m4l/graphics";
2
+ import { LanguagePopover, Image, Typography, ScrollBar, HelmetPage } from "@m4l/components";
3
+ import { styled, alpha } from "@mui/material/styles";
4
+ import { useBase, useModuleDictionary, useDomain, useEnvironment, BaseProvider, FlagsProvider, ModuleDictionaryProvider, ModuleSkeletonProvider } from "@m4l/core";
5
+ import { jsxs, jsx } from "react/jsx-runtime";
6
+ const InnerModuleRoot = styled("div")(({
7
+ theme
8
8
  }) => ({
9
9
  display: "flex",
10
10
  justifyContent: "center",
11
11
  alignItems: "center",
12
12
  height: "100vh",
13
13
  padding: "20px",
14
- backgroundColor: o.palette.background.background,
15
- [o.breakpoints.down("md")]: {
14
+ backgroundColor: theme.palette.background.background,
15
+ [theme.breakpoints.down("md")]: {
16
16
  padding: "0px"
17
17
  }
18
- })), j = t("div")(({ theme: o }) => ({
18
+ }));
19
+ const DesktopContentRoot = styled("div")(({ theme }) => ({
19
20
  display: "flex",
20
21
  borderRadius: "16px",
21
- backgroundColor: o.palette.background.neutral,
22
- boxShadow: o.customShadows?.z4,
22
+ backgroundColor: theme.palette.background.neutral,
23
+ boxShadow: theme.customShadows?.z4,
23
24
  padding: "20px 0 20px 20px",
24
25
  width: "100%",
25
26
  height: "100%",
@@ -33,7 +34,8 @@ const P = t("div")(({
33
34
  right: "20px",
34
35
  zIndex: 1
35
36
  }
36
- })), T = t("div")(({ theme: o }) => ({
37
+ }));
38
+ const DesktopBanner = styled("div")(({ theme }) => ({
37
39
  display: "flex",
38
40
  flexDirection: "column",
39
41
  justifyContent: "center",
@@ -42,140 +44,151 @@ const P = t("div")(({
42
44
  width: "100%",
43
45
  maxWidth: "400px",
44
46
  height: "100%",
45
- backgroundColor: o.palette.state?.focus,
46
- boxShadow: o.customShadows?.z4,
47
+ backgroundColor: theme.palette.state?.focus,
48
+ boxShadow: theme.customShadows?.z4,
47
49
  padding: "0 60px",
48
50
  gap: "40px",
49
51
  overflow: "hidden",
50
52
  "& .MuiTypography-root": {
51
- color: o.palette.patronus?.marbleLight[10],
53
+ color: theme.palette.patronus?.marbleLight[10],
52
54
  display: "flex",
53
55
  justifyContent: "center",
54
56
  textAlign: "center",
55
57
  textTransform: "uppercase"
56
58
  },
57
59
  "& .M4LTypography-root .MuiSkeleton-root": {
58
- backgroundColor: d(`${o.palette.patronus?.marbleLight[10]}`, 0.24),
60
+ backgroundColor: alpha(`${theme.palette.patronus?.marbleLight[10]}`, 0.24),
59
61
  margin: "auto"
60
62
  }
61
- })), A = t("div")(({ theme: o }) => ({
63
+ }));
64
+ const ContainerLogo$1 = styled("div")(({ theme }) => ({
62
65
  display: "flex",
63
66
  width: "84px",
64
67
  height: "84px",
65
68
  borderRadius: "6px",
66
- backgroundColor: o.palette.state?.active,
69
+ backgroundColor: theme.palette.state?.active,
67
70
  justifyContent: "center",
68
71
  alignItems: "center",
69
- boxShadow: `0px 4px 8px ${d(o.palette.patronus?.coolGrey[70] || "", 0.16)}`,
72
+ boxShadow: `0px 4px 8px ${alpha(theme.palette.patronus?.coolGrey[70] || "", 0.16)}`,
70
73
  "& .M4LImage-root": {
71
- backgroundColor: o.palette.patronus?.marbleLight[10],
74
+ backgroundColor: theme.palette.patronus?.marbleLight[10],
72
75
  borderRadius: "6px"
73
76
  }
74
- })), B = t("div")(() => ({
77
+ }));
78
+ const CompanyName$1 = styled("div")(() => ({
75
79
  display: "flex",
76
80
  flexDirection: "column",
77
81
  gap: "5px",
78
82
  width: "100%"
79
- })), z = t("div")(() => ({
83
+ }));
84
+ const CompanyLeyend = styled("div")(() => ({
80
85
  display: "flex",
81
86
  flexDirection: "column",
82
87
  gap: "5px",
83
88
  width: "100%"
84
- })), G = t("div")(() => ({
89
+ }));
90
+ const FormContent$1 = styled("div")(() => ({
85
91
  display: "flex",
86
92
  flexDirection: "column",
87
93
  padding: "0 60px 0 80px",
88
94
  margin: "auto 0",
89
95
  width: "100%",
90
96
  gap: "20px"
91
- })), E = t("div")(() => ({
97
+ }));
98
+ const WrapperFormContent$1 = styled("div")(() => ({
92
99
  display: "flex",
93
100
  width: "100%",
94
101
  height: "100%"
95
- })), q = t("div")(() => ({
102
+ }));
103
+ const ContainerModuleName$1 = styled("div")(() => ({
96
104
  display: "flex",
97
105
  flexDirection: "column",
98
106
  width: "100%",
99
107
  gap: "4px"
100
- })), J = () => {
108
+ }));
109
+ const DesktopContent = () => {
110
+ const {
111
+ children,
112
+ companyLogoSmallUrl
113
+ } = useBase();
101
114
  const {
102
- children: o,
103
- companyLogoSmallUrl: l
104
- } = u(), {
105
- getLabel: n
106
- } = g(), {
107
- name: r
108
- } = y();
109
- return /* @__PURE__ */ i(j, {
110
- children: [/* @__PURE__ */ e(h, {}), /* @__PURE__ */ i(T, {
111
- children: [/* @__PURE__ */ e(A, {
112
- children: /* @__PURE__ */ e(x, {
113
- src: l,
115
+ getLabel
116
+ } = useModuleDictionary();
117
+ const {
118
+ name
119
+ } = useDomain();
120
+ return /* @__PURE__ */ jsxs(DesktopContentRoot, {
121
+ children: [/* @__PURE__ */ jsx(LanguagePopover, {}), /* @__PURE__ */ jsxs(DesktopBanner, {
122
+ children: [/* @__PURE__ */ jsx(ContainerLogo$1, {
123
+ children: /* @__PURE__ */ jsx(Image, {
124
+ src: companyLogoSmallUrl,
114
125
  ratio: "1:1",
115
126
  width: "64px",
116
127
  height: "64px"
117
128
  })
118
- }), /* @__PURE__ */ i(B, {
119
- children: [/* @__PURE__ */ e(a, {
129
+ }), /* @__PURE__ */ jsxs(CompanyName$1, {
130
+ children: [/* @__PURE__ */ jsx(Typography, {
120
131
  variant: "subtitleDens",
121
132
  skeletonWidth: "70%",
122
133
  skeletongHeight: "24px",
123
- children: r
124
- }), /* @__PURE__ */ e(a, {
134
+ children: name
135
+ }), /* @__PURE__ */ jsx(Typography, {
125
136
  variant: "paragraph",
126
137
  skeletonWidth: "40%",
127
138
  skeletongHeight: "20px",
128
- children: n("company_name_subtitle")
139
+ children: getLabel("company_name_subtitle")
129
140
  })]
130
- }), /* @__PURE__ */ i(z, {
131
- children: [/* @__PURE__ */ e(a, {
141
+ }), /* @__PURE__ */ jsxs(CompanyLeyend, {
142
+ children: [/* @__PURE__ */ jsx(Typography, {
132
143
  variant: "h5",
133
144
  skeletonWidth: "50%",
134
145
  skeletongHeight: "36px",
135
- children: n("module_leyend")
136
- }), /* @__PURE__ */ e(a, {
146
+ children: getLabel("module_leyend")
147
+ }), /* @__PURE__ */ jsx(Typography, {
137
148
  variant: "subtitle",
138
149
  skeletonWidth: "80%",
139
150
  skeletongHeight: "24px",
140
151
  children: "slogan"
141
152
  })]
142
153
  })]
143
- }), /* @__PURE__ */ e(E, {
144
- children: /* @__PURE__ */ e(m, {
145
- children: /* @__PURE__ */ i(G, {
146
- children: [/* @__PURE__ */ i(q, {
147
- children: [/* @__PURE__ */ e(a, {
154
+ }), /* @__PURE__ */ jsx(WrapperFormContent$1, {
155
+ children: /* @__PURE__ */ jsx(ScrollBar, {
156
+ children: /* @__PURE__ */ jsxs(FormContent$1, {
157
+ children: [/* @__PURE__ */ jsxs(ContainerModuleName$1, {
158
+ children: [/* @__PURE__ */ jsx(Typography, {
148
159
  variant: "h5",
149
160
  skeletonWidth: "20%",
150
161
  skeletongHeight: "36px",
151
- children: n("module_name")
152
- }), /* @__PURE__ */ e(a, {
162
+ children: getLabel("module_name")
163
+ }), /* @__PURE__ */ jsx(Typography, {
153
164
  variant: "paragraph",
154
165
  skeletonWidth: "40%",
155
166
  skeletongHeight: "20px",
156
- children: n("module_description")
167
+ children: getLabel("module_description")
157
168
  })]
158
- }), o]
169
+ }), children]
159
170
  })
160
171
  })
161
172
  })]
162
173
  });
163
- }, K = t("div")(({ theme: o }) => ({
174
+ };
175
+ const MobileContentRoot = styled("div")(({ theme }) => ({
164
176
  display: "flex",
165
177
  flexDirection: "column",
166
178
  width: "100%",
167
179
  height: "100%",
168
- backgroundColor: o.palette.background.neutral,
180
+ backgroundColor: theme.palette.background.neutral,
169
181
  padding: "12px",
170
182
  gap: "32px"
171
- })), O = t("div")(({ theme: o }) => ({
183
+ }));
184
+ const MobileBanner = styled("div")(({ theme }) => ({
172
185
  display: "flex",
173
186
  flexDirection: "column",
174
187
  padding: "12px",
175
188
  gap: "20px",
176
189
  width: "100%",
177
- backgroundColor: o.palette.state?.focus,
178
- boxShadow: o.customShadows?.z4,
190
+ backgroundColor: theme.palette.state?.focus,
191
+ boxShadow: theme.customShadows?.z4,
179
192
  position: "relative",
180
193
  borderRadius: "8px",
181
194
  "& .M4LanguagePopover-root": {
@@ -184,162 +197,182 @@ const P = t("div")(({
184
197
  right: "12px"
185
198
  },
186
199
  "& .MuiTypography-root": {
187
- color: o.palette.patronus?.marbleLight[10],
200
+ color: theme.palette.patronus?.marbleLight[10],
188
201
  display: "flex",
189
202
  textTransform: "uppercase"
190
203
  },
191
204
  "& .MuiSkeleton-root": {
192
- backgroundColor: d(`${o.palette.patronus?.marbleLight[10]}`, 0.24),
205
+ backgroundColor: alpha(`${theme.palette.patronus?.marbleLight[10]}`, 0.24),
193
206
  margin: "auto"
194
207
  }
195
208
  }));
196
- t("div")(() => ({
209
+ styled("div")(() => ({
197
210
  display: "flex"
198
211
  }));
199
- const Q = t("div")(({ theme: o }) => ({
212
+ const ContainerLogo = styled("div")(({ theme }) => ({
200
213
  display: "flex",
201
214
  width: "52px",
202
215
  height: "52px",
203
216
  borderRadius: "6px",
204
- backgroundColor: o.palette.state?.active,
217
+ backgroundColor: theme.palette.state?.active,
205
218
  justifyContent: "center",
206
219
  alignItems: "center",
207
- boxShadow: `0px 4px 8px ${d(o.palette.patronus?.coolGrey[70] || "", 0.16)}`,
220
+ boxShadow: `0px 4px 8px ${alpha(theme.palette.patronus?.coolGrey[70] || "", 0.16)}`,
208
221
  "& .M4LImage-root": {
209
- backgroundColor: o.palette.patronus?.marbleLight[10],
222
+ backgroundColor: theme.palette.patronus?.marbleLight[10],
210
223
  borderRadius: "6px"
211
224
  }
212
- })), V = t("div")(() => ({
225
+ }));
226
+ const CompanyName = styled("div")(() => ({
213
227
  display: "flex",
214
228
  flexDirection: "column",
215
229
  width: "100%"
216
- })), X = t("div")(() => ({
230
+ }));
231
+ const FormContent = styled("div")(() => ({
217
232
  display: "flex",
218
233
  flexDirection: "column",
219
234
  padding: "12px",
220
235
  margin: "auto 0",
221
236
  width: "100%",
222
237
  gap: "20px"
223
- })), Y = t("div")(() => ({
238
+ }));
239
+ const WrapperFormContent = styled("div")(() => ({
224
240
  display: "flex",
225
241
  width: "100%",
226
242
  height: "100%",
227
243
  overflow: "hidden"
228
- })), Z = t("div")(() => ({
244
+ }));
245
+ const ContainerModuleName = styled("div")(() => ({
229
246
  display: "flex",
230
247
  flexDirection: "column",
231
248
  width: "100%",
232
249
  gap: "4px"
233
- })), oo = () => {
250
+ }));
251
+ const MobileContent = () => {
252
+ const {
253
+ children,
254
+ companyLogoSmallUrl
255
+ } = useBase();
234
256
  const {
235
- children: o,
236
- companyLogoSmallUrl: l
237
- } = u(), {
238
- getLabel: n
239
- } = g(), {
240
- name: r
241
- } = y();
242
- return /* @__PURE__ */ i(K, {
243
- children: [/* @__PURE__ */ i(O, {
244
- children: [/* @__PURE__ */ e(Q, {
245
- children: /* @__PURE__ */ e(x, {
246
- src: l,
257
+ getLabel
258
+ } = useModuleDictionary();
259
+ const {
260
+ name
261
+ } = useDomain();
262
+ return /* @__PURE__ */ jsxs(MobileContentRoot, {
263
+ children: [/* @__PURE__ */ jsxs(MobileBanner, {
264
+ children: [/* @__PURE__ */ jsx(ContainerLogo, {
265
+ children: /* @__PURE__ */ jsx(Image, {
266
+ src: companyLogoSmallUrl,
247
267
  ratio: "1:1",
248
268
  width: "44px",
249
269
  height: "44px"
250
270
  })
251
- }), /* @__PURE__ */ i(V, {
252
- children: [/* @__PURE__ */ e(a, {
271
+ }), /* @__PURE__ */ jsxs(CompanyName, {
272
+ children: [/* @__PURE__ */ jsx(Typography, {
253
273
  variant: "subtitleDens",
254
274
  skeletonWidth: "70%",
255
275
  skeletongHeight: "24px",
256
- children: r
257
- }), /* @__PURE__ */ e(a, {
276
+ children: name
277
+ }), /* @__PURE__ */ jsx(Typography, {
258
278
  variant: "paragraph",
259
279
  skeletonWidth: "40%",
260
280
  skeletongHeight: "20px",
261
- children: n("company_name_subtitle")
281
+ children: getLabel("company_name_subtitle")
262
282
  })]
263
- }), /* @__PURE__ */ e(h, {})]
264
- }), /* @__PURE__ */ e(Y, {
265
- children: /* @__PURE__ */ e(m, {
266
- children: /* @__PURE__ */ i(X, {
267
- children: [/* @__PURE__ */ i(Z, {
268
- children: [/* @__PURE__ */ e(a, {
283
+ }), /* @__PURE__ */ jsx(LanguagePopover, {})]
284
+ }), /* @__PURE__ */ jsx(WrapperFormContent, {
285
+ children: /* @__PURE__ */ jsx(ScrollBar, {
286
+ children: /* @__PURE__ */ jsxs(FormContent, {
287
+ children: [/* @__PURE__ */ jsxs(ContainerModuleName, {
288
+ children: [/* @__PURE__ */ jsx(Typography, {
269
289
  variant: "h5",
270
290
  skeletonWidth: "20%",
271
291
  skeletongHeight: "36px",
272
- children: n("module_name")
273
- }), /* @__PURE__ */ e(a, {
292
+ children: getLabel("module_name")
293
+ }), /* @__PURE__ */ jsx(Typography, {
274
294
  variant: "paragraph",
275
295
  skeletonWidth: "40%",
276
296
  skeletongHeight: "20px",
277
- children: n("module_description")
297
+ children: getLabel("module_description")
278
298
  })]
279
- }), o]
299
+ }), children]
280
300
  })
281
301
  })
282
302
  })]
283
303
  });
284
- }, eo = () => {
304
+ };
305
+ const InnerModule = () => {
306
+ const {
307
+ getModuleLabel
308
+ } = useModuleDictionary();
309
+ const isDesktop = useResponsiveDesktop();
285
310
  const {
286
- getModuleLabel: o
287
- } = g(), l = I(), {
288
- subtitle: n
289
- } = u();
290
- return /* @__PURE__ */ e(W, {
291
- title: o(),
292
- subtitle: n,
293
- children: /* @__PURE__ */ e(P, {
294
- children: l ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(oo, {})
311
+ subtitle
312
+ } = useBase();
313
+ return /* @__PURE__ */ jsx(HelmetPage, {
314
+ title: getModuleLabel(),
315
+ subtitle,
316
+ children: /* @__PURE__ */ jsx(InnerModuleRoot, {
317
+ children: isDesktop ? /* @__PURE__ */ jsx(DesktopContent, {}) : /* @__PURE__ */ jsx(MobileContent, {})
295
318
  })
296
319
  });
297
- }, ro = (o) => {
320
+ };
321
+ const NoAuthModuleLayout = (props) => {
322
+ const {
323
+ moduleId,
324
+ moduleNameField,
325
+ children,
326
+ componentsDictionary,
327
+ skeletonFlags,
328
+ subtitle,
329
+ companyLogoSmallUrl,
330
+ companyLogoNormalUrl,
331
+ moduleIlustrationUrl
332
+ } = props;
298
333
  const {
299
- moduleId: l,
300
- moduleNameField: n,
301
- children: r,
302
- componentsDictionary: f,
303
- skeletonFlags: b,
304
- subtitle: v,
305
- companyLogoSmallUrl: k,
306
- companyLogoNormalUrl: C,
307
- moduleIlustrationUrl: L
308
- } = o, {
309
- host_static_assets: s,
310
- environment_assets: p
311
- } = H(), w = $().currentLocale?.localeString, D = C || `${s}/${p}/frontend/commons/assets/icons/logotipo_m4l.svg`, M = k || `${s}/${p}/frontend/commons/assets/icons/isotipo_m4l.svg`, _ = L || `${s}/${p}/frontend/domain/host/commons/assets/img/illustration_noauth.png`, c = b;
312
- return c.findIndex((S) => S === "dictionary_loaded") < 0 && c.push("dictionary_loaded"), /* @__PURE__ */ e(N, {
334
+ host_static_assets,
335
+ environment_assets
336
+ } = useEnvironment();
337
+ const localeString = useLocales().currentLocale?.localeString;
338
+ const finalCompanyLogoNormalUrl = companyLogoNormalUrl || `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/logotipo_m4l.svg`;
339
+ const finalCompanyLogoSmallUrl = companyLogoSmallUrl || `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/isotipo_m4l.svg`;
340
+ const finalIllustrationUrl = moduleIlustrationUrl || `${host_static_assets}/${environment_assets}/frontend/domain/host/commons/assets/img/illustration_noauth.png`;
341
+ const finalSkeletonFlags = skeletonFlags;
342
+ if (finalSkeletonFlags.findIndex((f) => f === "dictionary_loaded") < 0) {
343
+ finalSkeletonFlags.push("dictionary_loaded");
344
+ }
345
+ return /* @__PURE__ */ jsx(BaseProvider, {
313
346
  value: {
314
- subtitle: v,
315
- companyLogoSmallUrl: M,
316
- companyLogoNormalUrl: D,
317
- moduleIlustrationUrl: _,
318
- children: r
347
+ subtitle,
348
+ companyLogoSmallUrl: finalCompanyLogoSmallUrl,
349
+ companyLogoNormalUrl: finalCompanyLogoNormalUrl,
350
+ moduleIlustrationUrl: finalIllustrationUrl,
351
+ children
319
352
  },
320
- children: /* @__PURE__ */ e(R, {
321
- children: /* @__PURE__ */ e(U, {
322
- isAuth: !1,
323
- moduleId: l,
324
- moduleNameField: n,
325
- componentsDictionary: f,
326
- currentLang: w,
327
- children: /* @__PURE__ */ e(F, {
328
- flags: c,
329
- children: /* @__PURE__ */ e(eo, {})
353
+ children: /* @__PURE__ */ jsx(FlagsProvider, {
354
+ children: /* @__PURE__ */ jsx(ModuleDictionaryProvider, {
355
+ isAuth: false,
356
+ moduleId,
357
+ moduleNameField,
358
+ componentsDictionary,
359
+ currentLang: localeString,
360
+ children: /* @__PURE__ */ jsx(ModuleSkeletonProvider, {
361
+ flags: finalSkeletonFlags,
362
+ children: /* @__PURE__ */ jsx(InnerModule, {})
330
363
  })
331
364
  })
332
365
  })
333
366
  });
334
367
  };
335
- function so() {
368
+ function getNoAuthModuleLayoutComponentsDictionary() {
336
369
  return ["no_auth_module_layout"];
337
370
  }
338
- const po = {
371
+ const defaultNoAuthModuleLayoutDictionary = {
339
372
  no_auth_module_layout: {}
340
373
  };
341
374
  export {
342
- ro as N,
343
- po as d,
344
- so as g
375
+ NoAuthModuleLayout as N,
376
+ defaultNoAuthModuleLayoutDictionary as d,
377
+ getNoAuthModuleLayoutComponentsDictionary as g
345
378
  };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@m4l/layouts",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "license": "UNLICENSED",
5
5
  "dependencies": {
6
+ "@mui/material": "5.10.4",
6
7
  "@m4l/components": "*",
7
8
  "@m4l/core": "*",
8
9
  "@m4l/graphics": "*",