@flipdish/portal-library 1.0.13 → 1.0.15

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.
Files changed (44) hide show
  1. package/dist/components/index.d.ts +5 -0
  2. package/dist/components/index.esm.js +6 -0
  3. package/dist/components/index.esm.js.map +1 -0
  4. package/dist/components/index.js +16 -0
  5. package/dist/components/index.js.map +1 -0
  6. package/dist/components/themes/flipdishPublicTheme.d.ts +19 -0
  7. package/dist/components/themes/flipdishPublicTheme.esm.js +171 -0
  8. package/dist/components/themes/flipdishPublicTheme.esm.js.map +1 -0
  9. package/dist/components/themes/flipdishPublicTheme.js +173 -0
  10. package/dist/components/themes/flipdishPublicTheme.js.map +1 -0
  11. package/dist/components/ui/LazyComponent/LazyComponent.d.ts +9 -0
  12. package/dist/components/ui/LazyComponent/LazyComponent.esm.js +14 -0
  13. package/dist/components/ui/LazyComponent/LazyComponent.esm.js.map +1 -0
  14. package/dist/components/ui/LazyComponent/LazyComponent.js +16 -0
  15. package/dist/components/ui/LazyComponent/LazyComponent.js.map +1 -0
  16. package/dist/components/ui/NotFoundPage/NotFoundPage.d.ts +5 -0
  17. package/dist/components/ui/NotFoundPage/NotFoundPage.esm.js +18 -0
  18. package/dist/components/ui/NotFoundPage/NotFoundPage.esm.js.map +1 -0
  19. package/dist/components/ui/NotFoundPage/NotFoundPage.js +20 -0
  20. package/dist/components/ui/NotFoundPage/NotFoundPage.js.map +1 -0
  21. package/dist/components/ui/PortalMock/PortalMock.d.ts +9 -0
  22. package/dist/components/ui/PortalMock/PortalMock.esm.js +45 -0
  23. package/dist/components/ui/PortalMock/PortalMock.esm.js.map +1 -0
  24. package/dist/components/ui/PortalMock/PortalMock.js +47 -0
  25. package/dist/components/ui/PortalMock/PortalMock.js.map +1 -0
  26. package/dist/components/ui/Spacer/Spacer.d.ts +12 -0
  27. package/dist/components/ui/Spacer/Spacer.esm.js +32 -0
  28. package/dist/components/ui/Spacer/Spacer.esm.js.map +1 -0
  29. package/dist/components/ui/Spacer/Spacer.js +34 -0
  30. package/dist/components/ui/Spacer/Spacer.js.map +1 -0
  31. package/dist/localization/en.json.esm.js +52 -0
  32. package/dist/localization/en.json.esm.js.map +1 -0
  33. package/dist/localization/en.json.js +67 -0
  34. package/dist/localization/en.json.js.map +1 -0
  35. package/dist/providers/TranslationProvider.esm.js +21 -0
  36. package/dist/providers/TranslationProvider.esm.js.map +1 -0
  37. package/dist/providers/TranslationProvider.js +23 -0
  38. package/dist/providers/TranslationProvider.js.map +1 -0
  39. package/package.json +1 -1
  40. package/dist/index.d.ts +0 -42
  41. package/dist/index.esm.js +0 -325
  42. package/dist/index.esm.js.map +0 -1
  43. package/dist/index.js +0 -331
  44. package/dist/index.js.map +0 -1
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var styles = require('@mui/material/styles');
5
+ var material = require('@mui/material');
6
+
7
+ const StyledHeader = styles.styled('div')(({ theme }) => ({
8
+ display: 'flex',
9
+ justifyContent: 'center',
10
+ alignItems: 'center',
11
+ backgroundColor: theme.palette.grey[300],
12
+ height: '65px',
13
+ color: theme.palette.text.primary,
14
+ borderBottom: `2px solid ${theme.palette.grey[400]}`,
15
+ }));
16
+ const StyledSidebar = styles.styled('div')(({ theme }) => ({
17
+ display: 'flex',
18
+ justifyContent: 'center',
19
+ alignItems: 'center',
20
+ backgroundColor: theme.palette.grey[300],
21
+ height: '100%',
22
+ color: theme.palette.text.primary,
23
+ }));
24
+ const drawerWidth = 198;
25
+ const PortalMock = ({ children, loadedFromPortal }) => {
26
+ const theme = styles.useTheme();
27
+ if (loadedFromPortal) {
28
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
29
+ }
30
+ const drawer = (jsxRuntime.jsx(StyledSidebar, { children: jsxRuntime.jsx(material.Typography, { sx: { fontWeight: 'bold' }, children: "Sidebar" }) }));
31
+ return (jsxRuntime.jsxs(material.Box, { sx: { display: 'flex' }, children: [jsxRuntime.jsx(material.CssBaseline, {}), jsxRuntime.jsx(material.AppBar, { position: "fixed", sx: {
32
+ width: { sm: `calc(100% - ${drawerWidth}px)` },
33
+ ml: { sm: `${drawerWidth}px` },
34
+ boxShadow: 'none',
35
+ }, children: jsxRuntime.jsx(StyledHeader, { children: jsxRuntime.jsx(material.Typography, { sx: { fontWeight: 'bold' }, children: "Header" }) }) }), jsxRuntime.jsx(material.Box, { component: "nav", sx: { width: { sm: drawerWidth }, flexShrink: { sm: 0 } }, "aria-label": "mailbox folders", children: jsxRuntime.jsx(material.Drawer, { variant: "permanent", sx: {
36
+ display: { xs: 'none', sm: 'block' },
37
+ '& .MuiDrawer-paper': {
38
+ boxSizing: 'border-box',
39
+ width: drawerWidth,
40
+ borderColor: theme.palette.grey[400],
41
+ borderWidth: '2px',
42
+ },
43
+ }, open: true, children: drawer }) }), jsxRuntime.jsx(material.Box, { component: "main", sx: { flexGrow: 1, width: { sm: `calc(100% - ${drawerWidth}px)`, marginTop: '65px' } }, children: children })] }));
44
+ };
45
+
46
+ module.exports = PortalMock;
47
+ //# sourceMappingURL=PortalMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PortalMock.js","sources":["../../../../src/components/ui/PortalMock/PortalMock.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\nimport { AppBar, Box, CssBaseline, Drawer, Typography } from '@mui/material';\n\nconst StyledHeader = styled('div')(({ theme }) => ({\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: theme.palette.grey[300],\n height: '65px',\n color: theme.palette.text.primary,\n borderBottom: `2px solid ${theme.palette.grey[400]}`,\n}));\n\nconst StyledSidebar = styled('div')(({ theme }) => ({\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: theme.palette.grey[300],\n height: '100%',\n color: theme.palette.text.primary,\n}));\n\ntype Props = {\n loadedFromPortal: boolean;\n children: React.ReactNode;\n};\nconst drawerWidth = 198;\n\nconst PortalMock = ({ children, loadedFromPortal }: Props) => {\n const theme = useTheme();\n\n if (loadedFromPortal) {\n return <>{children}</>;\n }\n\n const drawer = (\n <StyledSidebar>\n <Typography sx={{ fontWeight: 'bold' }}>Sidebar</Typography>\n </StyledSidebar>\n );\n\n return (\n <Box sx={{ display: 'flex' }}>\n <CssBaseline />\n <AppBar\n position=\"fixed\"\n sx={{\n width: { sm: `calc(100% - ${drawerWidth}px)` },\n ml: { sm: `${drawerWidth}px` },\n boxShadow: 'none',\n }}\n >\n <StyledHeader>\n <Typography sx={{ fontWeight: 'bold' }}>Header</Typography>\n </StyledHeader>\n </AppBar>\n <Box component=\"nav\" sx={{ width: { sm: drawerWidth }, flexShrink: { sm: 0 } }} aria-label=\"mailbox folders\">\n <Drawer\n variant=\"permanent\"\n sx={{\n display: { xs: 'none', sm: 'block' },\n '& .MuiDrawer-paper': {\n boxSizing: 'border-box',\n width: drawerWidth,\n borderColor: theme.palette.grey[400],\n borderWidth: '2px',\n },\n }}\n open\n >\n {drawer}\n </Drawer>\n </Box>\n <Box component=\"main\" sx={{ flexGrow: 1, width: { sm: `calc(100% - ${drawerWidth}px)`, marginTop: '65px' } }}>\n {children}\n </Box>\n </Box>\n );\n};\n\nexport default PortalMock;\n"],"names":["styled","useTheme","_jsx","_Fragment","Typography","_jsxs","Box","CssBaseline","AppBar","Drawer"],"mappings":";;;;;;AAGA,MAAM,YAAY,GAAGA,aAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM;AAC/C,IAAA,OAAO,EAAE,MAAM;AACf,IAAA,cAAc,EAAE,QAAQ;AACxB,IAAA,UAAU,EAAE,QAAQ;IACpB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AACxC,IAAA,MAAM,EAAE,MAAM;AACd,IAAA,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;IACjC,YAAY,EAAE,CAAa,UAAA,EAAA,KAA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* as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface ISpacerProps {
5
+ className?: string;
6
+ variant?: 'horizontal' | 'vertical';
7
+ size?: 8 | 16 | 24 | 32 | 40 | 56;
8
+ children?: ReactNode;
9
+ }
10
+ declare const Spacer: ({ className, variant, size, children }: ISpacerProps) => react_jsx_runtime.JSX.Element;
11
+
12
+ export { type ISpacerProps, Spacer as default };
@@ -0,0 +1,32 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { styled } from '@mui/material/styles';
3
+
4
+ const SpacerDiv = styled('div')(({ size = 8, variant, children }) => {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const style = {
7
+ padding: children ? `${size}px` : undefined,
8
+ };
9
+ if (!children) {
10
+ if (variant === 'horizontal') {
11
+ style.height = `${size}px`;
12
+ }
13
+ else if (variant === 'vertical') {
14
+ style.width = `${size}px`;
15
+ }
16
+ }
17
+ else {
18
+ if (variant === 'horizontal') {
19
+ style.margin = `${size}px 0`;
20
+ }
21
+ else if (variant === 'vertical') {
22
+ style.margin = `0 ${size}px`;
23
+ }
24
+ }
25
+ return style;
26
+ });
27
+ const Spacer = ({ className, variant, size = 8, children }) => {
28
+ return (jsx(SpacerDiv, { className: className, variant: variant, size: size, children: children }));
29
+ };
30
+
31
+ export { Spacer as default };
32
+ //# sourceMappingURL=Spacer.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spacer.esm.js","sources":["../../../../src/components/ui/Spacer/Spacer.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nexport interface ISpacerProps {\n className?: string;\n variant?: 'horizontal' | 'vertical';\n size?: 8 | 16 | 24 | 32 | 40 | 56;\n children?: ReactNode;\n}\n\nconst SpacerDiv = styled('div')<ISpacerProps>(({ size = 8, variant, children }) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const style: any = {\n padding: children ? `${size}px` : undefined,\n };\n\n if (!children) {\n if (variant === 'horizontal') {\n style.height = `${size}px`;\n } else if (variant === 'vertical') {\n style.width = `${size}px`;\n }\n } else {\n if (variant === 'horizontal') {\n style.margin = `${size}px 0`;\n } else if (variant === 'vertical') {\n style.margin = `0 ${size}px`;\n }\n }\n\n return style;\n});\n\nconst Spacer = ({ className, variant, size = 8, children }: ISpacerProps) => {\n return (\n <SpacerDiv className={className} variant={variant} size={size}>\n {children}\n </SpacerDiv>\n );\n};\n\nexport default Spacer;\n"],"names":["_jsx"],"mappings":";;;AAUA,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAe,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;;AAE9E,IAAA,MAAM,KAAK,GAAQ;QACf,OAAO,EAAE,QAAQ,GAAG,CAAG,EAAA,IAAI,CAAI,EAAA,CAAA,GAAG,SAAS;KAC9C,CAAC;IAEF,IAAI,CAAC,QAAQ,EAAE;AACX,QAAA,IAAI,OAAO,KAAK,YAAY,EAAE;AAC1B,YAAA,KAAK,CAAC,MAAM,GAAG,CAAG,EAAA,IAAI,IAAI,CAAC;SAC9B;AAAM,aAAA,IAAI,OAAO,KAAK,UAAU,EAAE;AAC/B,YAAA,KAAK,CAAC,KAAK,GAAG,CAAG,EAAA,IAAI,IAAI,CAAC;SAC7B;KACJ;SAAM;AACH,QAAA,IAAI,OAAO,KAAK,YAAY,EAAE;AAC1B,YAAA,KAAK,CAAC,MAAM,GAAG,CAAG,EAAA,IAAI,MAAM,CAAC;SAChC;AAAM,aAAA,IAAI,OAAO,KAAK,UAAU,EAAE;AAC/B,YAAA,KAAK,CAAC,MAAM,GAAG,CAAK,EAAA,EAAA,IAAI,IAAI,CAAC;SAChC;KACJ;AAED,IAAA,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAgB,KAAI;AACxE,IAAA,QACIA,GAAC,CAAA,SAAS,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,YACxD,QAAQ,EAAA,CACD,EACd;AACN;;;;"}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var styles = require('@mui/material/styles');
5
+
6
+ const SpacerDiv = styles.styled('div')(({ size = 8, variant, children }) => {
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ const style = {
9
+ padding: children ? `${size}px` : undefined,
10
+ };
11
+ if (!children) {
12
+ if (variant === 'horizontal') {
13
+ style.height = `${size}px`;
14
+ }
15
+ else if (variant === 'vertical') {
16
+ style.width = `${size}px`;
17
+ }
18
+ }
19
+ else {
20
+ if (variant === 'horizontal') {
21
+ style.margin = `${size}px 0`;
22
+ }
23
+ else if (variant === 'vertical') {
24
+ style.margin = `0 ${size}px`;
25
+ }
26
+ }
27
+ return style;
28
+ });
29
+ const Spacer = ({ className, variant, size = 8, children }) => {
30
+ return (jsxRuntime.jsx(SpacerDiv, { className: className, variant: variant, size: size, children: children }));
31
+ };
32
+
33
+ module.exports = Spacer;
34
+ //# sourceMappingURL=Spacer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spacer.js","sources":["../../../../src/components/ui/Spacer/Spacer.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nexport interface ISpacerProps {\n className?: string;\n variant?: 'horizontal' | 'vertical';\n size?: 8 | 16 | 24 | 32 | 40 | 56;\n children?: ReactNode;\n}\n\nconst SpacerDiv = styled('div')<ISpacerProps>(({ size = 8, variant, children }) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const style: any = {\n padding: children ? `${size}px` : undefined,\n };\n\n if (!children) {\n if (variant === 'horizontal') {\n style.height = `${size}px`;\n } else if (variant === 'vertical') {\n style.width = `${size}px`;\n }\n } else {\n if (variant === 'horizontal') {\n style.margin = `${size}px 0`;\n } else if (variant === 'vertical') {\n style.margin = `0 ${size}px`;\n }\n }\n\n return style;\n});\n\nconst Spacer = ({ className, variant, size = 8, children }: ISpacerProps) => {\n return (\n <SpacerDiv className={className} variant={variant} size={size}>\n {children}\n </SpacerDiv>\n );\n};\n\nexport default Spacer;\n"],"names":["styled","_jsx"],"mappings":";;;;;AAUA,MAAM,SAAS,GAAGA,aAAM,CAAC,KAAK,CAAC,CAAe,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;;AAE9E,IAAA,MAAM,KAAK,GAAQ;QACf,OAAO,EAAE,QAAQ,GAAG,CAAG,EAAA,IAAI,CAAI,EAAA,CAAA,GAAG,SAAS;KAC9C,CAAC;IAEF,IAAI,CAAC,QAAQ,EAAE;AACX,QAAA,IAAI,OAAO,KAAK,YAAY,EAAE;AAC1B,YAAA,KAAK,CAAC,MAAM,GAAG,CAAG,EAAA,IAAI,IAAI,CAAC;SAC9B;AAAM,aAAA,IAAI,OAAO,KAAK,UAAU,EAAE;AAC/B,YAAA,KAAK,CAAC,KAAK,GAAG,CAAG,EAAA,IAAI,IAAI,CAAC;SAC7B;KACJ;SAAM;AACH,QAAA,IAAI,OAAO,KAAK,YAAY,EAAE;AAC1B,YAAA,KAAK,CAAC,MAAM,GAAG,CAAG,EAAA,IAAI,MAAM,CAAC;SAChC;AAAM,aAAA,IAAI,OAAO,KAAK,UAAU,EAAE;AAC/B,YAAA,KAAK,CAAC,MAAM,GAAG,CAAK,EAAA,EAAA,IAAI,IAAI,CAAC;SAChC;KACJ;AAED,IAAA,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAgB,KAAI;AACxE,IAAA,QACIC,cAAC,CAAA,SAAS,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,YACxD,QAAQ,EAAA,CACD,EACd;AACN;;;;"}
@@ -0,0 +1,52 @@
1
+ var Home = {
2
+ value: "Home"
3
+ };
4
+ var About = {
5
+ value: "About"
6
+ };
7
+ var Welcome_to_new_portal = {
8
+ value: "Welcome to the new Flipdish Portal"
9
+ };
10
+ var Page_Not_Found = {
11
+ value: "Page Not Found"
12
+ };
13
+ var Click_vite_react = {
14
+ value: "Click on the Vite and React logos to learn more"
15
+ };
16
+ var Go_to_about_page = {
17
+ value: "Go to About Page"
18
+ };
19
+ var Go_to_home_page = {
20
+ value: "Go to home Page"
21
+ };
22
+ var Welcome_about_page = {
23
+ value: "Welcome to the About Page"
24
+ };
25
+ var About_Page = {
26
+ value: "About Page"
27
+ };
28
+ var Something_went_wrong_please_refresh_the_page = {
29
+ value: "Something went wrong, please refresh the page"
30
+ };
31
+ var Count_is = {
32
+ value: "Count is {count}"
33
+ };
34
+ var en = {
35
+ Home: Home,
36
+ About: About,
37
+ Welcome_to_new_portal: Welcome_to_new_portal,
38
+ Page_Not_Found: Page_Not_Found,
39
+ "Micro-Frontend_Example": {
40
+ value: "Micro-Frontend Example"
41
+ },
42
+ Click_vite_react: Click_vite_react,
43
+ Go_to_about_page: Go_to_about_page,
44
+ Go_to_home_page: Go_to_home_page,
45
+ Welcome_about_page: Welcome_about_page,
46
+ About_Page: About_Page,
47
+ Something_went_wrong_please_refresh_the_page: Something_went_wrong_please_refresh_the_page,
48
+ Count_is: Count_is
49
+ };
50
+
51
+ export { About, About_Page, Click_vite_react, Count_is, Go_to_about_page, Go_to_home_page, Home, Page_Not_Found, Something_went_wrong_please_refresh_the_page, Welcome_about_page, Welcome_to_new_portal, en as default };
52
+ //# sourceMappingURL=en.json.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Home = {
6
+ value: "Home"
7
+ };
8
+ var About = {
9
+ value: "About"
10
+ };
11
+ var Welcome_to_new_portal = {
12
+ value: "Welcome to the new Flipdish Portal"
13
+ };
14
+ var Page_Not_Found = {
15
+ value: "Page Not Found"
16
+ };
17
+ var Click_vite_react = {
18
+ value: "Click on the Vite and React logos to learn more"
19
+ };
20
+ var Go_to_about_page = {
21
+ value: "Go to About Page"
22
+ };
23
+ var Go_to_home_page = {
24
+ value: "Go to home Page"
25
+ };
26
+ var Welcome_about_page = {
27
+ value: "Welcome to the About Page"
28
+ };
29
+ var About_Page = {
30
+ value: "About Page"
31
+ };
32
+ var Something_went_wrong_please_refresh_the_page = {
33
+ value: "Something went wrong, please refresh the page"
34
+ };
35
+ var Count_is = {
36
+ value: "Count is {count}"
37
+ };
38
+ var en = {
39
+ Home: Home,
40
+ About: About,
41
+ Welcome_to_new_portal: Welcome_to_new_portal,
42
+ Page_Not_Found: Page_Not_Found,
43
+ "Micro-Frontend_Example": {
44
+ value: "Micro-Frontend Example"
45
+ },
46
+ Click_vite_react: Click_vite_react,
47
+ Go_to_about_page: Go_to_about_page,
48
+ Go_to_home_page: Go_to_home_page,
49
+ Welcome_about_page: Welcome_about_page,
50
+ About_Page: About_Page,
51
+ Something_went_wrong_please_refresh_the_page: Something_went_wrong_please_refresh_the_page,
52
+ Count_is: Count_is
53
+ };
54
+
55
+ exports.About = About;
56
+ exports.About_Page = About_Page;
57
+ exports.Click_vite_react = Click_vite_react;
58
+ exports.Count_is = Count_is;
59
+ exports.Go_to_about_page = Go_to_about_page;
60
+ exports.Go_to_home_page = Go_to_home_page;
61
+ exports.Home = Home;
62
+ exports.Page_Not_Found = Page_Not_Found;
63
+ exports.Something_went_wrong_please_refresh_the_page = Something_went_wrong_please_refresh_the_page;
64
+ exports.Welcome_about_page = Welcome_about_page;
65
+ exports.Welcome_to_new_portal = Welcome_to_new_portal;
66
+ exports.default = en;
67
+ //# sourceMappingURL=en.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import 'react/jsx-runtime';
2
+ import { createContext, useContext, useCallback } from 'react';
3
+ import en from '../localization/en.json.esm.js';
4
+
5
+ const TranslationContext = createContext({});
6
+ const useTranslation = () => {
7
+ const { translations } = useContext(TranslationContext);
8
+ const translate = useCallback((key, data) => {
9
+ let translation = translations?.[key]?.value || en[key]?.value || key;
10
+ if (data && translation) {
11
+ Object.keys(data)?.forEach((key) => {
12
+ translation = translation.replace(new RegExp(`{${key}}`, 'g'), `${data[key]}`);
13
+ });
14
+ }
15
+ return translation;
16
+ }, [translations]);
17
+ return { translate, translations };
18
+ };
19
+
20
+ export { useTranslation };
21
+ //# sourceMappingURL=TranslationProvider.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationProvider.esm.js","sources":["../../src/providers/TranslationProvider.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useState } from 'react';\nimport en from '../../../../localization/en.json';\nimport { getMicroFrontendAttribute } from '../utilities/renderUtilities';\n\ndeclare global {\n type TranslationId = keyof typeof en;\n}\n\ntype Translation = { value: string };\n\ninterface TranslationBase {\n translations: Record<string, Translation>;\n}\n\nconst TranslationContext = createContext<TranslationBase>({} as unknown as TranslationBase);\n\ntype TranslationProp = {\n children: JSX.Element;\n} & TranslationBase;\n\nexport const TranslationProvider = ({ children, translations }: TranslationProp): JSX.Element => {\n const value = { translations };\n return <TranslationContext.Provider value={value}>{children}</TranslationContext.Provider>;\n};\n\nexport const useTranslation = (): {\n translate: (key: TranslationId, data?: Record<string, string | number>) => string;\n translations: Record<string, Translation>;\n} => {\n const { translations } = useContext(TranslationContext);\n\n const translate = useCallback(\n (key: TranslationId, data?: Record<string, string | number>): string => {\n let translation = translations?.[key]?.value || en[key]?.value || key;\n if (data && translation) {\n Object.keys(data)?.forEach((key) => {\n translation = translation.replace(new RegExp(`{${key}}`, 'g'), `${data[key]}`);\n });\n }\n return translation;\n },\n [translations],\n );\n return { translate, translations };\n};\n\nconst languagesToLoad = ['nl', 'en-US', 'de', 'fr', 'it', 'es', 'pt', 'es-MX', 'dev-lang'];\n\nexport const useLoadTranslations = () => {\n const [translations, setTranslations] = useState<{\n loading: boolean;\n translations?: Record<string, { value: string }>;\n }>({ loading: true, translations: {} });\n const languageFromParentDiv = getMicroFrontendAttribute('data-language') || '';\n\n useEffect(() => {\n const fetchJSONData = async () => {\n // en loaded as default fallback already\n const shouldLoadLanguage = languagesToLoad.includes(languageFromParentDiv);\n if (shouldLoadLanguage) {\n import(`../../../../localization/${languageFromParentDiv}.json`)\n .then((response) => response.default) // Access the default export of the module\n .then((text) => {\n setTranslations({ loading: false, translations: text });\n })\n .catch((error) => {\n setTranslations({ loading: false });\n window.fdlogger?.error(`Error while fetching ${languageFromParentDiv || 'en'} language JSON data: ${error.message}`);\n });\n } else {\n setTranslations({ loading: false });\n }\n };\n\n void fetchJSONData();\n }, [languageFromParentDiv]);\n\n return {\n translations: translations.translations || {},\n loading: translations.loading,\n };\n};\n"],"names":[],"mappings":";;;;AAcA,MAAM,kBAAkB,GAAG,aAAa,CAAkB,EAAgC,CAAC,CAAC;AAWrF,MAAM,cAAc,GAAG,MAG1B;IACA,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAExD,MAAM,SAAS,GAAG,WAAW,CACzB,CAAC,GAAkB,EAAE,IAAsC,KAAY;AACnE,QAAA,IAAI,WAAW,GAAG,YAAY,GAAG,GAAG,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC;AACtE,QAAA,IAAI,IAAI,IAAI,WAAW,EAAE;YACrB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,KAAI;gBAC/B,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,CAAG,EAAE,GAAG,CAAC,EAAE,CAAG,EAAA,IAAI,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC,CAAC;AACnF,aAAC,CAAC,CAAC;SACN;AACD,QAAA,OAAO,WAAW,CAAC;AACvB,KAAC,EACD,CAAC,YAAY,CAAC,CACjB,CAAC;AACF,IAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACvC;;;;"}
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var en = require('../localization/en.json.js');
6
+
7
+ const TranslationContext = react.createContext({});
8
+ const useTranslation = () => {
9
+ const { translations } = react.useContext(TranslationContext);
10
+ const translate = react.useCallback((key, data) => {
11
+ let translation = translations?.[key]?.value || en.default[key]?.value || key;
12
+ if (data && translation) {
13
+ Object.keys(data)?.forEach((key) => {
14
+ translation = translation.replace(new RegExp(`{${key}}`, 'g'), `${data[key]}`);
15
+ });
16
+ }
17
+ return translation;
18
+ }, [translations]);
19
+ return { translate, translations };
20
+ };
21
+
22
+ exports.useTranslation = useTranslation;
23
+ //# sourceMappingURL=TranslationProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationProvider.js","sources":["../../src/providers/TranslationProvider.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useState } from 'react';\nimport en from '../../../../localization/en.json';\nimport { getMicroFrontendAttribute } from '../utilities/renderUtilities';\n\ndeclare global {\n type TranslationId = keyof typeof en;\n}\n\ntype Translation = { value: string };\n\ninterface TranslationBase {\n translations: Record<string, Translation>;\n}\n\nconst TranslationContext = createContext<TranslationBase>({} as unknown as TranslationBase);\n\ntype TranslationProp = {\n children: JSX.Element;\n} & TranslationBase;\n\nexport const TranslationProvider = ({ children, translations }: TranslationProp): JSX.Element => {\n const value = { translations };\n return <TranslationContext.Provider value={value}>{children}</TranslationContext.Provider>;\n};\n\nexport const useTranslation = (): {\n translate: (key: TranslationId, data?: Record<string, string | number>) => string;\n translations: Record<string, Translation>;\n} => {\n const { translations } = useContext(TranslationContext);\n\n const translate = useCallback(\n (key: TranslationId, data?: Record<string, string | number>): string => {\n let translation = translations?.[key]?.value || en[key]?.value || key;\n if (data && translation) {\n Object.keys(data)?.forEach((key) => {\n translation = translation.replace(new RegExp(`{${key}}`, 'g'), `${data[key]}`);\n });\n }\n return translation;\n },\n [translations],\n );\n return { translate, translations };\n};\n\nconst languagesToLoad = ['nl', 'en-US', 'de', 'fr', 'it', 'es', 'pt', 'es-MX', 'dev-lang'];\n\nexport const useLoadTranslations = () => {\n const [translations, setTranslations] = useState<{\n loading: boolean;\n translations?: Record<string, { value: string }>;\n }>({ loading: true, translations: {} });\n const languageFromParentDiv = getMicroFrontendAttribute('data-language') || '';\n\n useEffect(() => {\n const fetchJSONData = async () => {\n // en loaded as default fallback already\n const shouldLoadLanguage = languagesToLoad.includes(languageFromParentDiv);\n if (shouldLoadLanguage) {\n import(`../../../../localization/${languageFromParentDiv}.json`)\n .then((response) => response.default) // Access the default export of the module\n .then((text) => {\n setTranslations({ loading: false, translations: text });\n })\n .catch((error) => {\n setTranslations({ loading: false });\n window.fdlogger?.error(`Error while fetching ${languageFromParentDiv || 'en'} language JSON data: ${error.message}`);\n });\n } else {\n setTranslations({ loading: false });\n }\n };\n\n void fetchJSONData();\n }, [languageFromParentDiv]);\n\n return {\n translations: translations.translations || {},\n loading: translations.loading,\n };\n};\n"],"names":["createContext","useContext","useCallback","en"],"mappings":";;;;;;AAcA,MAAM,kBAAkB,GAAGA,mBAAa,CAAkB,EAAgC,CAAC,CAAC;AAWrF,MAAM,cAAc,GAAG,MAG1B;IACA,MAAM,EAAE,YAAY,EAAE,GAAGC,gBAAU,CAAC,kBAAkB,CAAC,CAAC;IAExD,MAAM,SAAS,GAAGC,iBAAW,CACzB,CAAC,GAAkB,EAAE,IAAsC,KAAY;AACnE,QAAA,IAAI,WAAW,GAAG,YAAY,GAAG,GAAG,CAAC,EAAE,KAAK,IAAIC,UAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC;AACtE,QAAA,IAAI,IAAI,IAAI,WAAW,EAAE;YACrB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,KAAI;gBAC/B,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,CAAG,EAAE,GAAG,CAAC,EAAE,CAAG,EAAA,IAAI,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC,CAAC;AACnF,aAAC,CAAC,CAAC;SACN;AACD,QAAA,OAAO,WAAW,CAAC;AACvB,KAAC,EACD,CAAC,YAAY,CAAC,CACjB,CAAC;AACF,IAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACvC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/portal-library",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
package/dist/index.d.ts DELETED
@@ -1,42 +0,0 @@
1
- import * as _mui_material from '@mui/material';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { ReactNode } from 'react';
4
-
5
- declare const _default: _mui_material.Theme;
6
-
7
- declare module '@mui/material/styles' {
8
- interface Palette {
9
- black: Palette['primary'];
10
- white: Palette['primary'];
11
- flippyBlue: Palette['primary'];
12
- freezerBurn: Palette['primary'];
13
- spricyCarrot: Palette['primary'];
14
- pebble: Palette['primary'];
15
- donutPanic: Palette['primary'];
16
- eletricLime: Palette['primary'];
17
- pending: Palette['primary'];
18
- }
19
- }
20
-
21
- declare const NotFoundPage: () => react_jsx_runtime.JSX.Element;
22
-
23
- type Props = {
24
- loadedFromPortal: boolean;
25
- children: React.ReactNode;
26
- };
27
- declare const PortalMock: ({ children, loadedFromPortal }: Props) => react_jsx_runtime.JSX.Element;
28
-
29
- type LazyComponentProps = {
30
- children: ReactNode;
31
- };
32
- declare const LazyComponent: ({ children }: LazyComponentProps) => react_jsx_runtime.JSX.Element;
33
-
34
- interface ISpacerProps {
35
- className?: string;
36
- variant?: 'horizontal' | 'vertical';
37
- size?: 8 | 16 | 24 | 32 | 40 | 56;
38
- children?: ReactNode;
39
- }
40
- declare const Spacer: ({ className, variant, size, children }: ISpacerProps) => react_jsx_runtime.JSX.Element;
41
-
42
- export { LazyComponent, NotFoundPage, PortalMock, Spacer, _default as flipdishPublicTheme };