@flipdish/portal-library 1.0.46 → 1.0.48

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,2 +1,2 @@
1
- "use strict";var e=require("./themes/flipdishPublicTheme.cjs.js"),i=require("./ui/NotFoundPage/NotFoundPage.cjs.js"),r=require("./ui/FlipdishStaffContainer/FlipdishStaffContainer.cjs.js"),o=require("./ui/PageLayout/PageLayout.cjs.js"),t=require("./ui/PortalMock/PortalMock.cjs.js"),s=require("./ui/LazyComponent/LazyComponent.cjs.js"),c=require("./ui/Spacer/Spacer.cjs.js"),a=require("./ui/Chip/Chip.cjs.js"),u=require("./ui/Switch/Switch.cjs.js"),n=require("./ui/Form/utilities/formValidation.cjs.js"),l=require("./ui/Form/GenericAutocompleteField.cjs.js"),j=require("./ui/Form/GenericFormContainer.cjs.js"),p=require("./ui/Form/GenericTextField.cjs.js"),d=require("./ui/Form/PaginatedAutocompleteField.cjs.js"),m=require("./ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js"),T=require("./ui/GenericRadioButtons/GenericRadioButtons.cjs.js"),q=require("./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.cjs.js"),x=require("./ui/GenericTable/GenericTable.cjs.js"),G=require("./ui/GenericTableBody/GenericTableBody.cjs.js"),F=require("./ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js"),P=require("./ui/GenericTableTitle/GenericTableTitle.cjs.js");require("react/jsx-runtime"),require("react"),require("../providers/TranslationProvider.cjs.js"),exports.flipdishPublicTheme=e,exports.NotFoundPage=i,exports.FlipdishStaffContainer=r,exports.PageLayout=o.default,exports.PortalMock=t,exports.LazyComponent=s,exports.Spacer=c,exports.Chip=a,exports.Switch=u,exports.formikValidate=n.formikValidate,exports.GenericAutocompleteField=l,exports.GenericFormContainer=j,exports.GenericTextField=p,exports.PaginatedAutocompleteField=d,exports.GenericDatePickerField=m,exports.GenericRadioButtons=T,exports.DateTimeLocalizationProvider=q,exports.GenericTable=x,exports.GenericTableBody=G,exports.GenericTableBodyRow=F,exports.GenericTableTitle=P;
1
+ "use strict";var e=require("./themes/flipdishPublicTheme.cjs.js"),i=require("./ui/NotFoundPage/NotFoundPage.cjs.js"),r=require("./ui/FlipdishStaffContainer/FlipdishStaffContainer.cjs.js"),t=require("./ui/PageLayout/PageLayout.cjs.js"),o=require("./ui/PortalMock/PortalMock.cjs.js"),s=require("./ui/LazyComponent/LazyComponent.cjs.js"),a=require("./ui/Spacer/Spacer.cjs.js"),c=require("./ui/Chip/Chip.cjs.js"),u=require("./ui/Switch/Switch.cjs.js"),n=require("./ui/Form/utilities/formValidation.cjs.js"),l=require("./ui/Form/GenericAutocompleteField.cjs.js"),p=require("./ui/Form/GenericFormContainer.cjs.js"),d=require("./ui/Form/GenericTextField.cjs.js"),j=require("./ui/Form/PaginatedAutocompleteField.cjs.js"),x=require("./ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js"),m=require("./ui/GenericRadioButtons/GenericRadioButtons.cjs.js"),F=require("./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.cjs.js"),q=require("./ui/GenericTable/GenericTable.cjs.js"),T=require("./ui/GenericTableBody/GenericTableBody.cjs.js"),G=require("./ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js"),P=require("./ui/GenericTableTitle/GenericTableTitle.cjs.js");require("react/jsx-runtime"),require("react"),require("../providers/TranslationProvider.cjs.js");var g=require("./renderUtilities/renderUtilities.cjs.js");exports.flipdishPublicTheme=e,exports.NotFoundPage=i,exports.FlipdishStaffContainer=r,exports.PageLayout=t.default,exports.PortalMock=o,exports.LazyComponent=s,exports.Spacer=a,exports.Chip=c,exports.Switch=u,exports.formikValidate=n.formikValidate,exports.GenericAutocompleteField=l,exports.GenericFormContainer=p,exports.GenericTextField=d,exports.PaginatedAutocompleteField=j,exports.GenericDatePickerField=x,exports.GenericRadioButtons=m,exports.DateTimeLocalizationProvider=F,exports.GenericTable=q,exports.GenericTableBody=T,exports.GenericTableBodyRow=G,exports.GenericTableTitle=P,exports.getAppId=g.getAppId,exports.getIsFlipdishStaff=g.getIsFlipdishStaff,exports.getMicroFrontendAttribute=g.getMicroFrontendAttribute,exports.getOrgId=g.getOrgId,exports.lazyWithRetry=g.lazyWithRetry;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -20,3 +20,4 @@ export { default as GenericTable } from './ui/GenericTable/GenericTable.js';
20
20
  export { default as GenericTableBody } from './ui/GenericTableBody/GenericTableBody.js';
21
21
  export { default as GenericTableBodyRow } from './ui/GenericTableBodyRow/GenericTableBodyRow.js';
22
22
  export { default as GenericTableTitle } from './ui/GenericTableTitle/GenericTableTitle.js';
23
+ export { getAppId, getIsFlipdishStaff, getMicroFrontendAttribute, getOrgId, lazyWithRetry } from './renderUtilities/renderUtilities.js';
@@ -1,2 +1,2 @@
1
- export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as FlipdishStaffContainer}from"./ui/FlipdishStaffContainer/FlipdishStaffContainer.js";export{default as PageLayout}from"./ui/PageLayout/PageLayout.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";export{default as Chip}from"./ui/Chip/Chip.js";export{default as Switch}from"./ui/Switch/Switch.js";export{formikValidate}from"./ui/Form/utilities/formValidation.js";export{default as GenericAutocompleteField}from"./ui/Form/GenericAutocompleteField.js";export{default as GenericFormContainer}from"./ui/Form/GenericFormContainer.js";export{default as GenericTextField}from"./ui/Form/GenericTextField.js";export{default as PaginatedAutocompleteField}from"./ui/Form/PaginatedAutocompleteField.js";export{default as GenericDatePickerField}from"./ui/GenericDateTimePickerField/GenericDateTimePickerField.js";export{default as GenericRadioButtons}from"./ui/GenericRadioButtons/GenericRadioButtons.js";export{default as DateTimeLocalizationProvider}from"./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.js";export{default as GenericTable}from"./ui/GenericTable/GenericTable.js";export{default as GenericTableBody}from"./ui/GenericTableBody/GenericTableBody.js";export{default as GenericTableBodyRow}from"./ui/GenericTableBodyRow/GenericTableBodyRow.js";export{default as GenericTableTitle}from"./ui/GenericTableTitle/GenericTableTitle.js";import"react/jsx-runtime";import"react";import"../providers/TranslationProvider.js";
1
+ export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as FlipdishStaffContainer}from"./ui/FlipdishStaffContainer/FlipdishStaffContainer.js";export{default as PageLayout}from"./ui/PageLayout/PageLayout.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";export{default as Chip}from"./ui/Chip/Chip.js";export{default as Switch}from"./ui/Switch/Switch.js";export{formikValidate}from"./ui/Form/utilities/formValidation.js";export{default as GenericAutocompleteField}from"./ui/Form/GenericAutocompleteField.js";export{default as GenericFormContainer}from"./ui/Form/GenericFormContainer.js";export{default as GenericTextField}from"./ui/Form/GenericTextField.js";export{default as PaginatedAutocompleteField}from"./ui/Form/PaginatedAutocompleteField.js";export{default as GenericDatePickerField}from"./ui/GenericDateTimePickerField/GenericDateTimePickerField.js";export{default as GenericRadioButtons}from"./ui/GenericRadioButtons/GenericRadioButtons.js";export{default as DateTimeLocalizationProvider}from"./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.js";export{default as GenericTable}from"./ui/GenericTable/GenericTable.js";export{default as GenericTableBody}from"./ui/GenericTableBody/GenericTableBody.js";export{default as GenericTableBodyRow}from"./ui/GenericTableBodyRow/GenericTableBodyRow.js";export{default as GenericTableTitle}from"./ui/GenericTableTitle/GenericTableTitle.js";import"react/jsx-runtime";import"react";import"../providers/TranslationProvider.js";export{getAppId,getIsFlipdishStaff,getMicroFrontendAttribute,getOrgId,lazyWithRetry}from"./renderUtilities/renderUtilities.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react");const t=e=>{const t=document.getElementById("flipdish-micro-frontend");return t&&t.getAttribute(e)};exports.getAppId=()=>(void 0).VITE_APPID_OVERRIDE||t("data-appId"),exports.getIsFlipdishStaff=()=>{const e=(void 0).VITE_ISFLIPDISHSTAFFOVERRIDE||t("data-isFlipdishStaff");return"true"===e?.toString()},exports.getMicroFrontendAttribute=t,exports.getOrgId=()=>(void 0).VITE_ORGID_OVERRIDE||t("data-orgId"),exports.lazyWithRetry=t=>e.lazy((async()=>{const e=JSON.parse(window.sessionStorage.getItem("page-has-been-force-refreshed")||"false");try{const e=await t();return window.sessionStorage.setItem("page-has-been-force-refreshed","false"),e}catch(t){if(!e)return window.sessionStorage.setItem("page-has-been-force-refreshed","true"),window.location.reload();throw t}}));
2
+ //# sourceMappingURL=renderUtilities.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderUtilities.cjs.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","undefined","VITE_APPID_OVERRIDE","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","VITE_ORGID_OVERRIDE","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"oCAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI,mBAGzC,UACbK,GAAgBC,qBAAuBP,EAA0B,yCAO1C,KAC9B,MAAMQ,QAAcF,GAAgBG,8BAAgCT,EAA0B,wBAC9F,MAAmC,SAA5BQ,GAAaE,UAAqB,uDANrB,UACbJ,GAAgBK,qBAAuBX,EAA0B,oCAS9CY,GAC1BC,EAAAA,MAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+
3
+ declare const getMicroFrontendAttribute: (key: string) => string | null;
4
+ declare const getAppId: () => string | null;
5
+ declare const getOrgId: () => string | null;
6
+ declare const getIsFlipdishStaff: () => boolean;
7
+ declare const lazyWithRetry: (componentImport: () => any) => React.LazyExoticComponent<React.ComponentType<any>>;
8
+
9
+ export { getAppId, getIsFlipdishStaff, getMicroFrontendAttribute, getOrgId, lazyWithRetry };
@@ -0,0 +1,2 @@
1
+ import{lazy as e}from"react";const t=e=>{const t=document.getElementById("flipdish-micro-frontend");return t&&t.getAttribute(e)},r=()=>import.meta.env.VITE_APPID_OVERRIDE||t("data-appId"),o=()=>import.meta.env.VITE_ORGID_OVERRIDE||t("data-orgId"),a=()=>{const e=import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE||t("data-isFlipdishStaff");return"true"===e?.toString()},n=t=>e((async()=>{const e=JSON.parse(window.sessionStorage.getItem("page-has-been-force-refreshed")||"false");try{const e=await t();return window.sessionStorage.setItem("page-has-been-force-refreshed","false"),e}catch(t){if(!e)return window.sessionStorage.setItem("page-has-been-force-refreshed","true"),window.location.reload();throw t}}));export{r as getAppId,a as getIsFlipdishStaff,t as getMicroFrontendAttribute,o as getOrgId,n as lazyWithRetry};
2
+ //# sourceMappingURL=renderUtilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderUtilities.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","getAppId","env","VITE_APPID_OVERRIDE","getOrgId","VITE_ORGID_OVERRIDE","getIsFlipdishStaff","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","lazyWithRetry","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"6BAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI,EAGpDK,EAAW,gBACDC,IAAIC,qBAAuBR,EAA0B,cAG/DS,EAAW,gBACDF,IAAIG,qBAAuBV,EAA0B,cAG/DW,EAAqB,KAC9B,MAAMC,cAA0BL,IAAIM,8BAAgCb,EAA0B,wBAC9F,MAAmC,SAA5BY,GAAaE,UAAqB,EAIhCC,EAAiBC,GAC1BC,GAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React__default from 'react';
2
2
  import { GenericTableColumns } from '../GenericTable/types.js';
3
3
 
4
4
  type TableBodyProps = {
@@ -11,6 +11,6 @@ type TableBodyProps = {
11
11
  onRowClick?: Function;
12
12
  type: 'sticky' | 'normal';
13
13
  };
14
- declare const GenericTableBody: React.FC<TableBodyProps>;
14
+ declare const GenericTableBody: React__default.FC<TableBodyProps>;
15
15
 
16
16
  export { GenericTableBody as default };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React__default from 'react';
2
2
 
3
3
  type TableBodyRowProps = {
4
4
  row: any;
@@ -6,8 +6,8 @@ type TableBodyRowProps = {
6
6
  tableRowTestKey: string;
7
7
  };
8
8
  type TableBodyRowProp = TableBodyRowProps & {
9
- children: React.ReactNode;
9
+ children: React__default.ReactNode;
10
10
  };
11
- declare const GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>>;
11
+ declare const GenericTableBodyRow: React__default.FC<React__default.PropsWithChildren<TableBodyRowProp>>;
12
12
 
13
13
  export { type TableBodyRowProps, GenericTableBodyRow as default };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("@mui/icons-material/Add"),t=require("@mui/icons-material/ArrowBack"),n=require("@mui/material/Grid"),r=require("@mui/material/IconButton"),a=require("@mui/material/styles"),s=require("@mui/material/Typography"),o=require("@mui/material/useMediaQuery"),d=require("./DocumentTitle.cjs.js"),l=require("./FullWidthContainer.cjs.js"),c=require("../FDErrorBoundary/FDErrorBoundary.cjs.js"),m=require("@mui/material/Button"),p=require("../../../utilities/renderUtilities.cjs.js"),h=require("../../../utilities/validation.cjs.js"),g=require("../Spacer/Spacer.cjs.js"),u=require("@mui/material/Box"),x=require("@mui/material/Divider");const j=1112,y=a.styled("div")((({theme:e,fluid:i})=>({maxWidth:i?"none":j,[e.breakpoints.down("md")]:{maxWidth:"none"},margin:e.spacing(2,4)}))),f=a.styled(n)((({theme:e})=>({[e.breakpoints.down("sm")]:{width:"100%",paddingTop:e.spacing(2)}}))),v=a.styled(n)((({theme:e})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:e.spacing(3),paddingBottom:e.spacing(3),[e.breakpoints.down("md")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(3)}}))),b=a.styled(n)((({theme:e})=>({paddingTop:e.spacing(2)}))),k=a.styled(n)((()=>({flexGrow:1}))),B=a.styled("div")((({theme:e})=>({maxWidth:j,paddingBottom:e.spacing(3),[e.breakpoints.down("md")]:{paddingBottom:e.spacing(2),paddingLeft:e.spacing(2),paddingRight:e.spacing(2)}}))),q=a.styled(r,{shouldForwardProp:e=>"hasTitleComponent"!==e})((({theme:e,hasTitleComponent:i})=>({margin:i?e.spacing(-.75,2,-1.5,-1.5):e.spacing(-1.5,2,-1.5,-1.5),[e.breakpoints.only("sm")]:{marginLeft:e.spacing(-2)},[e.breakpoints.only("xs")]:{marginLeft:e.spacing(-2)}}))),w=a.styled("div")((({theme:e})=>({maxWidth:j,marginLeft:e.spacing(6),marginRight:e.spacing(4),paddingBottom:e.spacing(2),[e.breakpoints.only("md")]:{marginLeft:12,marginRight:e.spacing(3)},[e.breakpoints.only("sm")]:{marginLeft:e.spacing(3),marginRight:e.spacing(3),maxWidth:"none"},[e.breakpoints.only("xs")]:{marginLeft:e.spacing(2),marginRight:e.spacing(2),maxWidth:"none"}}))),T=a.styled(n)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),W=a.styled(s)((()=>({lineHeight:"26px"}))),C=a.styled(s)((()=>({fontWeight:"bold"}))),L=a.styled(x)((({theme:e})=>({marginBottom:e.spacing(4)}))),F=({title:i})=>e.jsx(C,{variant:"h5",component:"h2",children:i});exports.PageTitle=F,exports.default=r=>{const{actionBtnTitle:s,caption:x,children:j,contextButtons:C,documentTitle:A,fluid:P=!1,fullWidth:D,header:I,hideHeader:R,actionButtonLink:z,openLinkInNewTab:_=!1,pageHeader:G,showActionButton:H,showAddIcon:M,strictToParent:E,title:S,titleComponent:U,toParent:N,navigate:O,hideDivider:Q=!1,customActionButtons:$}=r,J=a.useTheme(),K=o(J.breakpoints.down("md")),V=p.getMicroFrontendAttribute("data-portal-base-url")||"/",X=z?.startsWith("https://"),Y=X?z:void 0!==z?h.joinUrlPaths(V,z):"";return e.jsxs(y,{fluid:P,children:[A&&e.jsx(d,{children:A}),G||null,e.jsxs(w,{children:[G&&e.jsx(g,{size:16,variant:"vertical"}),!R&&e.jsxs(e.Fragment,{children:[e.jsxs(v,{container:!0,alignItems:"center",direction:"column",children:[e.jsx(n,{item:!0,container:!0,direction:"row",alignContent:"space-between",children:e.jsx(T,{item:!0,children:C&&C.map(((i,t)=>e.jsx("div",{children:i},t)))})}),e.jsxs(b,{item:!0,container:!0,children:[N&&e.jsx(u,{children:e.jsx(q,{"aria-label":"Back","data-testid":"back_button",hasTitleComponent:!!U,component:"button",onClick:()=>{N&&E||N&&history.length<3?O(N):O(-1)},children:e.jsx(t,{})})}),e.jsxs(k,{item:!0,children:[U?e.jsx(U,{}):e.jsx(F,{title:S}),x&&e.jsx(W,{variant:"caption",component:"h3",children:x})]}),H&&e.jsxs(e.Fragment,{children:[K&&e.jsx(g,{size:56,variant:"vertical"}),e.jsx(f,{item:!0,children:e.jsxs(m,{variant:"contained",fullWidth:!0,"data-testid":`Action-button-${s}`,href:_||X?Y:"",target:_?"_blank":void 0,rel:_?"noopener noreferrer":void 0,onClick:_||X?()=>{}:()=>O(z),children:[M&&e.jsx(i,{}),s]})})]}),$&&$.map(((i,t)=>e.jsxs("div",{children:[K&&e.jsx(g,{size:56,variant:"vertical"}),!K&&e.jsx(g,{size:16,variant:"vertical"}),e.jsx(f,{item:!0,children:i})]},t)))]})]}),!Q&&e.jsx(L,{})]}),e.jsxs(l,{fullWidth:D,children:[I?e.jsx(B,{children:I}):null,e.jsx(c,{identifier:A,children:e.jsx(e.Fragment,{children:j})})]})]})]})},exports.maxWidth=j;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("@mui/icons-material/Add"),t=require("@mui/icons-material/ArrowBack"),n=require("@mui/material/Grid"),r=require("@mui/material/IconButton"),a=require("@mui/material/styles"),s=require("@mui/material/Typography"),o=require("@mui/material/useMediaQuery"),d=require("./DocumentTitle.cjs.js"),l=require("./FullWidthContainer.cjs.js"),c=require("../FDErrorBoundary/FDErrorBoundary.cjs.js"),m=require("@mui/material/Button"),p=require("../../renderUtilities/renderUtilities.cjs.js"),h=require("../../../utilities/validation.cjs.js"),g=require("../Spacer/Spacer.cjs.js"),u=require("@mui/material/Box"),x=require("@mui/material/Divider");const j=1112,y=a.styled("div")((({theme:e,fluid:i})=>({maxWidth:i?"none":j,[e.breakpoints.down("md")]:{maxWidth:"none"},margin:e.spacing(2,4)}))),f=a.styled(n)((({theme:e})=>({[e.breakpoints.down("sm")]:{width:"100%",paddingTop:e.spacing(2)}}))),v=a.styled(n)((({theme:e})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:e.spacing(3),paddingBottom:e.spacing(3),[e.breakpoints.down("md")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(3)}}))),b=a.styled(n)((({theme:e})=>({paddingTop:e.spacing(2)}))),k=a.styled(n)((()=>({flexGrow:1}))),B=a.styled("div")((({theme:e})=>({maxWidth:j,paddingBottom:e.spacing(3),[e.breakpoints.down("md")]:{paddingBottom:e.spacing(2),paddingLeft:e.spacing(2),paddingRight:e.spacing(2)}}))),q=a.styled(r,{shouldForwardProp:e=>"hasTitleComponent"!==e})((({theme:e,hasTitleComponent:i})=>({margin:i?e.spacing(-.75,2,-1.5,-1.5):e.spacing(-1.5,2,-1.5,-1.5),[e.breakpoints.only("sm")]:{marginLeft:e.spacing(-2)},[e.breakpoints.only("xs")]:{marginLeft:e.spacing(-2)}}))),w=a.styled("div")((({theme:e})=>({maxWidth:j,marginLeft:e.spacing(6),marginRight:e.spacing(4),paddingBottom:e.spacing(2),[e.breakpoints.only("md")]:{marginLeft:12,marginRight:e.spacing(3)},[e.breakpoints.only("sm")]:{marginLeft:e.spacing(3),marginRight:e.spacing(3),maxWidth:"none"},[e.breakpoints.only("xs")]:{marginLeft:e.spacing(2),marginRight:e.spacing(2),maxWidth:"none"}}))),T=a.styled(n)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),W=a.styled(s)((()=>({lineHeight:"26px"}))),C=a.styled(s)((()=>({fontWeight:"bold"}))),L=a.styled(x)((({theme:e})=>({marginBottom:e.spacing(4)}))),F=({title:i})=>e.jsx(C,{variant:"h5",component:"h2",children:i});exports.PageTitle=F,exports.default=r=>{const{actionBtnTitle:s,caption:x,children:j,contextButtons:C,documentTitle:A,fluid:P=!1,fullWidth:D,header:I,hideHeader:R,actionButtonLink:z,openLinkInNewTab:_=!1,pageHeader:G,showActionButton:H,showAddIcon:M,strictToParent:U,title:E,titleComponent:S,toParent:N,navigate:O,hideDivider:Q=!1,customActionButtons:$}=r,J=a.useTheme(),K=o(J.breakpoints.down("md")),V=p.getMicroFrontendAttribute("data-portal-base-url")||"/",X=z?.startsWith("https://"),Y=X?z:void 0!==z?h.joinUrlPaths(V,z):"";return e.jsxs(y,{fluid:P,children:[A&&e.jsx(d,{children:A}),G||null,e.jsxs(w,{children:[G&&e.jsx(g,{size:16,variant:"vertical"}),!R&&e.jsxs(e.Fragment,{children:[e.jsxs(v,{container:!0,alignItems:"center",direction:"column",children:[e.jsx(n,{item:!0,container:!0,direction:"row",alignContent:"space-between",children:e.jsx(T,{item:!0,children:C&&C.map(((i,t)=>e.jsx("div",{children:i},t)))})}),e.jsxs(b,{item:!0,container:!0,children:[N&&e.jsx(u,{children:e.jsx(q,{"aria-label":"Back","data-testid":"back_button",hasTitleComponent:!!S,component:"button",onClick:()=>{N&&U||N&&history.length<3?O(N):O(-1)},children:e.jsx(t,{})})}),e.jsxs(k,{item:!0,children:[S?e.jsx(S,{}):e.jsx(F,{title:E}),x&&e.jsx(W,{variant:"caption",component:"h3",children:x})]}),H&&e.jsxs(e.Fragment,{children:[K&&e.jsx(g,{size:56,variant:"vertical"}),e.jsx(f,{item:!0,children:e.jsxs(m,{variant:"contained",fullWidth:!0,"data-testid":`Action-button-${s}`,href:_||X?Y:"",target:_?"_blank":void 0,rel:_?"noopener noreferrer":void 0,onClick:_||X?()=>{}:()=>O(z),children:[M&&e.jsx(i,{}),s]})})]}),$&&$.map(((i,t)=>e.jsxs("div",{children:[K&&e.jsx(g,{size:56,variant:"vertical"}),!K&&e.jsx(g,{size:16,variant:"vertical"}),e.jsx(f,{item:!0,children:i})]},t)))]})]}),!Q&&e.jsx(L,{})]}),e.jsxs(l,{fullWidth:D,children:[I?e.jsx(B,{children:I}):null,e.jsx(c,{identifier:A,children:e.jsx(e.Fragment,{children:j})})]})]})]})},exports.maxWidth=j;
2
2
  //# sourceMappingURL=PageLayout.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageLayout.cjs.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../../utilities/renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\nconst StyledBackButton = styled(IconButton, {\n shouldForwardProp: (prop) => prop !== 'hasTitleComponent',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n})<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>\n {contextButtons && contextButtons.map((button, index) => <div key={index}>{button}</div>)}\n </StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button, index) => (\n <div key={index}>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </div>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","shouldForwardProp","prop","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","jsxs","Spacer","size","container","direction","jsx","item","alignContent","map","button","index","Box","onClick","history","length","ArrowBackIcon","_Fragment","Button","href","target","rel","Add","FullWidthContainer","FDErrorBoundary","identifier"],"mappings":"ouBAwBO,MAAMA,EAAW,KAGlBC,EAAgBC,EAAMA,OAAC,MAAPA,EAAkC,EAAGC,QAAOC,YAAa,CAC3EJ,SAAUI,EAAQ,OAASJ,EAC3B,CAACG,EAAME,YAAYC,KAAK,OAAQ,CAC5BN,SAAU,QAEdO,OAAQJ,EAAMK,QAAQ,EAAG,OAGvBC,EAAyBP,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACxD,CAACA,EAAME,YAAYC,KAAK,OAAQ,CAC5BK,MAAO,OACPC,WAAYT,EAAMK,QAAQ,QAI5BK,EAAeX,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CAC9CW,SAAU,SACVC,WAAY,aACZH,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,GAE7B,CAACL,EAAME,YAAYC,KAAK,OAAQ,CAC5BM,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,QAI/BS,EAAuBf,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACtDS,WAAYT,EAAMK,QAAQ,OAGxBU,EAAqBhB,EAAAA,OAAOQ,EAAPR,EAAa,KAAO,CAC3CiB,SAAU,MAGRC,EAAmBlB,EAAAA,OAAO,MAAPA,EAAc,EAAGC,YAAa,CACnDH,WACAgB,cAAeb,EAAMK,QAAQ,GAE7B,CAACL,EAAME,YAAYC,KAAK,OAAQ,CAC5BU,cAAeb,EAAMK,QAAQ,GAC7Ba,YAAalB,EAAMK,QAAQ,GAC3Bc,aAAcnB,EAAMK,QAAQ,QAI9Be,EAAmBrB,EAAMA,OAACsB,EAAY,CACxCC,kBAAoBC,GAAkB,sBAATA,GADRxB,EAG0B,EAAGC,QAAOwB,wBAAyB,CAClFpB,OAAQoB,EAAoBxB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/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\nconst StyledBackButton = styled(IconButton, {\n shouldForwardProp: (prop) => prop !== 'hasTitleComponent',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n})<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>\n {contextButtons && contextButtons.map((button, index) => <div key={index}>{button}</div>)}\n </StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button, index) => (\n <div key={index}>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </div>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","shouldForwardProp","prop","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","jsxs","Spacer","size","container","direction","jsx","item","alignContent","map","button","index","Box","onClick","history","length","ArrowBackIcon","_Fragment","Button","href","target","rel","Add","FullWidthContainer","FDErrorBoundary","identifier"],"mappings":"uuBAwBO,MAAMA,EAAW,KAGlBC,EAAgBC,EAAMA,OAAC,MAAPA,EAAkC,EAAGC,QAAOC,YAAa,CAC3EJ,SAAUI,EAAQ,OAASJ,EAC3B,CAACG,EAAME,YAAYC,KAAK,OAAQ,CAC5BN,SAAU,QAEdO,OAAQJ,EAAMK,QAAQ,EAAG,OAGvBC,EAAyBP,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACxD,CAACA,EAAME,YAAYC,KAAK,OAAQ,CAC5BK,MAAO,OACPC,WAAYT,EAAMK,QAAQ,QAI5BK,EAAeX,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CAC9CW,SAAU,SACVC,WAAY,aACZH,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,GAE7B,CAACL,EAAME,YAAYC,KAAK,OAA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CAEjGa,GAAehB,MAACyD,EAAG,CAAA,GACnBpD,UAKhBkB,GACGA,EAAoBqB,KAAI,CAACC,EAAQC,IAC7BZ,wBACKT,GAAYzB,MAACqC,EAAM,CAACC,KAAM,GAAIrC,QAAQ,cACrCwB,GAAYzB,EAAAyC,IAACJ,EAAO,CAAAC,KAAM,GAAIrC,QAAQ,aACxCD,EAAAA,IAACpC,GAAuB8E,MAAI,EAAAvC,SAAE0C,MAHxBC,YAQxBxB,GAAetB,EAACyC,IAAA9C,EAAoB,OAG9CuC,EAAAA,KAACwB,EAAmB,CAAAjD,UAAWA,EAASN,SAAA,CACnCO,EAASV,MAACzB,EAAgB,CAAA4B,SAAEO,IAA6B,KAC1DV,EAAAA,IAAC2D,EAAe,CAACC,WAAYpD,EACzBL,SAAAH,MAAAoD,EAAAA,SAAA,CAAAjD,SAAGA,cAKrB"}
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React, { ReactNode, ComponentType } from 'react';
2
+ import React__default, { ReactNode, ComponentType } from 'react';
3
3
 
4
4
  type Props = {
5
5
  actionBtnTitle?: string;
@@ -17,7 +17,7 @@ type Props = {
17
17
  showAddIcon?: boolean;
18
18
  strictToParent?: boolean;
19
19
  title: ReactNode;
20
- titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;
20
+ titleComponent?: ComponentType<React__default.PropsWithChildren<unknown>>;
21
21
  toParent?: string;
22
22
  openLinkInNewTab?: boolean;
23
23
  navigate: (to: any) => void;
@@ -1,2 +1,2 @@
1
- import{jsxs as i,jsx as t,Fragment as n}from"react/jsx-runtime";import e from"@mui/icons-material/Add";import a from"@mui/icons-material/ArrowBack";import r from"@mui/material/Grid";import o from"@mui/material/IconButton";import{styled as m,useTheme as d}from"@mui/material/styles";import l from"@mui/material/Typography";import p from"@mui/material/useMediaQuery";import c from"./DocumentTitle.js";import s from"./FullWidthContainer.js";import h from"../FDErrorBoundary/FDErrorBoundary.js";import g from"@mui/material/Button";import{getMicroFrontendAttribute as u}from"../../../utilities/renderUtilities.js";import{joinUrlPaths as f}from"../../../utilities/validation.js";import v from"../Spacer/Spacer.js";import b from"@mui/material/Box";import x from"@mui/material/Divider";const k=1112,B=m("div")((({theme:i,fluid:t})=>({maxWidth:t?"none":k,[i.breakpoints.down("md")]:{maxWidth:"none"},margin:i.spacing(2,4)}))),w=m(r)((({theme:i})=>({[i.breakpoints.down("sm")]:{width:"100%",paddingTop:i.spacing(2)}}))),y=m(r)((({theme:i})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:i.spacing(3),paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingTop:i.spacing(2),paddingBottom:i.spacing(3)}}))),T=m(r)((({theme:i})=>({paddingTop:i.spacing(2)}))),W=m(r)((()=>({flexGrow:1}))),C=m("div")((({theme:i})=>({maxWidth:k,paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingBottom:i.spacing(2),paddingLeft:i.spacing(2),paddingRight:i.spacing(2)}}))),L=m(o,{shouldForwardProp:i=>"hasTitleComponent"!==i})((({theme:i,hasTitleComponent:t})=>({margin:t?i.spacing(-.75,2,-1.5,-1.5):i.spacing(-1.5,2,-1.5,-1.5),[i.breakpoints.only("sm")]:{marginLeft:i.spacing(-2)},[i.breakpoints.only("xs")]:{marginLeft:i.spacing(-2)}}))),j=m("div")((({theme:i})=>({maxWidth:k,marginLeft:i.spacing(6),marginRight:i.spacing(4),paddingBottom:i.spacing(2),[i.breakpoints.only("md")]:{marginLeft:12,marginRight:i.spacing(3)},[i.breakpoints.only("sm")]:{marginLeft:i.spacing(3),marginRight:i.spacing(3),maxWidth:"none"},[i.breakpoints.only("xs")]:{marginLeft:i.spacing(2),marginRight:i.spacing(2),maxWidth:"none"}}))),A=m(r)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),D=m(l)((()=>({lineHeight:"26px"}))),I=m(l)((()=>({fontWeight:"bold"}))),R=m(x)((({theme:i})=>({marginBottom:i.spacing(4)}))),z=({title:i})=>t(I,{variant:"h5",component:"h2",children:i}),F=o=>{const{actionBtnTitle:m,caption:l,children:x,contextButtons:k,documentTitle:I,fluid:F=!1,fullWidth:G,header:H,hideHeader:P,actionButtonLink:E,openLinkInNewTab:S=!1,pageHeader:_,showActionButton:M,showAddIcon:N,strictToParent:Q,title:U,titleComponent:$,toParent:q,navigate:J,hideDivider:K=!1,customActionButtons:O}=o,V=d(),X=p(V.breakpoints.down("md")),Y=u("data-portal-base-url")||"/",Z=E?.startsWith("https://"),ii=Z?E:void 0!==E?f(Y,E):"";return i(B,{fluid:F,children:[I&&t(c,{children:I}),_||null,i(j,{children:[_&&t(v,{size:16,variant:"vertical"}),!P&&i(n,{children:[i(y,{container:!0,alignItems:"center",direction:"column",children:[t(r,{item:!0,container:!0,direction:"row",alignContent:"space-between",children:t(A,{item:!0,children:k&&k.map(((i,n)=>t("div",{children:i},n)))})}),i(T,{item:!0,container:!0,children:[q&&t(b,{children:t(L,{"aria-label":"Back","data-testid":"back_button",hasTitleComponent:!!$,component:"button",onClick:()=>{q&&Q||q&&history.length<3?J(q):J(-1)},children:t(a,{})})}),i(W,{item:!0,children:[$?t($,{}):t(z,{title:U}),l&&t(D,{variant:"caption",component:"h3",children:l})]}),M&&i(n,{children:[X&&t(v,{size:56,variant:"vertical"}),t(w,{item:!0,children:i(g,{variant:"contained",fullWidth:!0,"data-testid":`Action-button-${m}`,href:S||Z?ii:"",target:S?"_blank":void 0,rel:S?"noopener noreferrer":void 0,onClick:S||Z?()=>{}:()=>J(E),children:[N&&t(e,{}),m]})})]}),O&&O.map(((n,e)=>i("div",{children:[X&&t(v,{size:56,variant:"vertical"}),!X&&t(v,{size:16,variant:"vertical"}),t(w,{item:!0,children:n})]},e)))]})]}),!K&&t(R,{})]}),i(s,{fullWidth:G,children:[H?t(C,{children:H}):null,t(h,{identifier:I,children:t(n,{children:x})})]})]})]})};export{z as PageTitle,F as default,k as maxWidth};
1
+ import{jsxs as i,jsx as t,Fragment as n}from"react/jsx-runtime";import e from"@mui/icons-material/Add";import r from"@mui/icons-material/ArrowBack";import a from"@mui/material/Grid";import o from"@mui/material/IconButton";import{styled as m,useTheme as d}from"@mui/material/styles";import l from"@mui/material/Typography";import p from"@mui/material/useMediaQuery";import c from"./DocumentTitle.js";import s from"./FullWidthContainer.js";import h from"../FDErrorBoundary/FDErrorBoundary.js";import g from"@mui/material/Button";import{getMicroFrontendAttribute as u}from"../../renderUtilities/renderUtilities.js";import{joinUrlPaths as f}from"../../../utilities/validation.js";import v from"../Spacer/Spacer.js";import b from"@mui/material/Box";import x from"@mui/material/Divider";const k=1112,B=m("div")((({theme:i,fluid:t})=>({maxWidth:t?"none":k,[i.breakpoints.down("md")]:{maxWidth:"none"},margin:i.spacing(2,4)}))),w=m(a)((({theme:i})=>({[i.breakpoints.down("sm")]:{width:"100%",paddingTop:i.spacing(2)}}))),y=m(a)((({theme:i})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:i.spacing(3),paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingTop:i.spacing(2),paddingBottom:i.spacing(3)}}))),T=m(a)((({theme:i})=>({paddingTop:i.spacing(2)}))),W=m(a)((()=>({flexGrow:1}))),C=m("div")((({theme:i})=>({maxWidth:k,paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingBottom:i.spacing(2),paddingLeft:i.spacing(2),paddingRight:i.spacing(2)}}))),L=m(o,{shouldForwardProp:i=>"hasTitleComponent"!==i})((({theme:i,hasTitleComponent:t})=>({margin:t?i.spacing(-.75,2,-1.5,-1.5):i.spacing(-1.5,2,-1.5,-1.5),[i.breakpoints.only("sm")]:{marginLeft:i.spacing(-2)},[i.breakpoints.only("xs")]:{marginLeft:i.spacing(-2)}}))),j=m("div")((({theme:i})=>({maxWidth:k,marginLeft:i.spacing(6),marginRight:i.spacing(4),paddingBottom:i.spacing(2),[i.breakpoints.only("md")]:{marginLeft:12,marginRight:i.spacing(3)},[i.breakpoints.only("sm")]:{marginLeft:i.spacing(3),marginRight:i.spacing(3),maxWidth:"none"},[i.breakpoints.only("xs")]:{marginLeft:i.spacing(2),marginRight:i.spacing(2),maxWidth:"none"}}))),A=m(a)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),D=m(l)((()=>({lineHeight:"26px"}))),I=m(l)((()=>({fontWeight:"bold"}))),R=m(x)((({theme:i})=>({marginBottom:i.spacing(4)}))),z=({title:i})=>t(I,{variant:"h5",component:"h2",children:i}),F=o=>{const{actionBtnTitle:m,caption:l,children:x,contextButtons:k,documentTitle:I,fluid:F=!1,fullWidth:G,header:H,hideHeader:P,actionButtonLink:E,openLinkInNewTab:S=!1,pageHeader:U,showActionButton:_,showAddIcon:M,strictToParent:N,title:Q,titleComponent:$,toParent:q,navigate:J,hideDivider:K=!1,customActionButtons:O}=o,V=d(),X=p(V.breakpoints.down("md")),Y=u("data-portal-base-url")||"/",Z=E?.startsWith("https://"),ii=Z?E:void 0!==E?f(Y,E):"";return i(B,{fluid:F,children:[I&&t(c,{children:I}),U||null,i(j,{children:[U&&t(v,{size:16,variant:"vertical"}),!P&&i(n,{children:[i(y,{container:!0,alignItems:"center",direction:"column",children:[t(a,{item:!0,container:!0,direction:"row",alignContent:"space-between",children:t(A,{item:!0,children:k&&k.map(((i,n)=>t("div",{children:i},n)))})}),i(T,{item:!0,container:!0,children:[q&&t(b,{children:t(L,{"aria-label":"Back","data-testid":"back_button",hasTitleComponent:!!$,component:"button",onClick:()=>{q&&N||q&&history.length<3?J(q):J(-1)},children:t(r,{})})}),i(W,{item:!0,children:[$?t($,{}):t(z,{title:Q}),l&&t(D,{variant:"caption",component:"h3",children:l})]}),_&&i(n,{children:[X&&t(v,{size:56,variant:"vertical"}),t(w,{item:!0,children:i(g,{variant:"contained",fullWidth:!0,"data-testid":`Action-button-${m}`,href:S||Z?ii:"",target:S?"_blank":void 0,rel:S?"noopener noreferrer":void 0,onClick:S||Z?()=>{}:()=>J(E),children:[M&&t(e,{}),m]})})]}),O&&O.map(((n,e)=>i("div",{children:[X&&t(v,{size:56,variant:"vertical"}),!X&&t(v,{size:16,variant:"vertical"}),t(w,{item:!0,children:n})]},e)))]})]}),!K&&t(R,{})]}),i(s,{fullWidth:G,children:[H?t(C,{children:H}):null,t(h,{identifier:I,children:t(n,{children:x})})]})]})]})};export{z as PageTitle,F as default,k as maxWidth};
2
2
  //# sourceMappingURL=PageLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageLayout.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../../utilities/renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\nconst StyledBackButton = styled(IconButton, {\n shouldForwardProp: (prop) => prop !== 'hasTitleComponent',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n})<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>\n {contextButtons && contextButtons.map((button, index) => <div key={index}>{button}</div>)}\n </StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button, index) => (\n <div key={index}>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </div>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","shouldForwardProp","prop","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","PageLayout","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","Spacer","size","container","direction","item","alignContent","map","button","index","Box","onClick","history","length","ArrowBackIcon","_Fragment","Button","href","target","rel","Add","FullWidthContainer","FDErrorBoundary","identifier"],"mappings":"0wBAwBO,MAAMA,EAAW,KAGlBC,EAAgBC,EAAO,MAAPA,EAAkC,EAAGC,QAAOC,YAAa,CAC3EJ,SAAUI,EAAQ,OAASJ,EAC3B,CAACG,EAAME,YAAYC,KAAK,OAAQ,CAC5BN,SAAU,QAEdO,OAAQJ,EAAMK,QAAQ,EAAG,OAGvBC,EAAyBP,EAA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mB,EAChDc,QAAUjC,GAAqBgB,EAA2D,OAAnC,IAAMR,EAAST,GAA4BV,SAAA,CAEjGc,GAAejB,EAACwD,EAAG,CAAA,GACnBlD,UAKhBkB,GACGA,EAAoBmB,KAAI,CAACC,EAAQC,IAC7BV,mBACKT,GAAY1B,EAACqC,EAAM,CAACC,KAAM,GAAIrC,QAAQ,cACrCyB,GAAY1B,EAACqC,EAAO,CAAAC,KAAM,GAAIrC,QAAQ,aACxCD,EAACpC,GAAuB6E,MAAI,EAAAtC,SAAEyC,MAHxBC,YAQxBtB,GAAevB,EAACL,EAAoB,OAG9CwC,EAACsB,EAAmB,CAAA/C,UAAWA,EAASP,SAAA,CACnCQ,EAASX,EAACzB,EAAgB,CAAA4B,SAAEQ,IAA6B,KAC1DX,EAAC0D,EAAe,CAACC,WAAYlD,EACzBN,SAAAH,EAAAmD,EAAA,CAAAhD,SAAGA,cAKrB"}
1
+ {"version":3,"file":"PageLayout.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\nconst StyledBackButton = styled(IconButton, {\n shouldForwardProp: (prop) => prop !== 'hasTitleComponent',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n})<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>\n {contextButtons && contextButtons.map((button, index) => <div key={index}>{button}</div>)}\n </StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button, index) => (\n <div key={index}>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </div>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","shouldForwardProp","prop","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","PageLayout","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","Spacer","size","container","direction","item","alignContent","map","button","index","Box","onClick","history","length","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,GACGmB,EAAAgB,EAAA,CAAAhD,SAAA,CACKuB,GAAY1B,EAACqC,EAAO,CAAAC,KAAM,GAAIrC,QAAQ,aACvCD,EAACpC,EAAuB,CAAA6E,iBACpBN,EAACiB,GACGnD,QAAQ,YACRS,WAAW,gBACE,iBAAiBJ,IAC9B+C,KAAMvC,GAAoBgB,EAAwBE,GAAwB,GAC1EsB,OAAQxC,EAAmB,cAAWmB,EACtCsB,IAAKzC,EAAmB,2BAAwBmB,EAChDc,QAAUjC,GAAqBgB,EAA2D,OAAnC,IAAMR,EAAST,GAA4BV,SAAA,CAEjGc,GAAejB,EAACwD,EAAG,CAAA,GACnBlD,UAKhBkB,GACGA,EAAoBmB,KAAI,CAACC,EAAQC,IAC7BV,mBACKT,GAAY1B,EAACqC,EAAM,CAACC,KAAM,GAAIrC,QAAQ,cACrCyB,GAAY1B,EAACqC,EAAO,CAAAC,KAAM,GAAIrC,QAAQ,aACxCD,EAACpC,GAAuB6E,MAAI,EAAAtC,SAAEyC,MAHxBC,YAQxBtB,GAAevB,EAACL,EAAoB,OAG9CwC,EAACsB,EAAmB,CAAA/C,UAAWA,EAASP,SAAA,CACnCQ,EAASX,EAACzB,EAAgB,CAAA4B,SAAEQ,IAA6B,KAC1DX,EAAC0D,EAAe,CAACC,WAAYlD,EACzBN,SAAAH,EAAAmD,EAAA,CAAAhD,SAAGA,cAKrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"TranslationProvider.cjs.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":["TranslationContext","createContext","translations","useContext","translate","useCallback","key","data","translation","value","en","Object","keys","forEach","replace","RegExp"],"mappings":"6GAcA,MAAMA,EAAqBC,EAAAA,cAA+B,CAAA,0BAW5B,KAI1B,MAAMC,aAAEA,GAAiBC,EAAUA,WAACH,GAcpC,MAAO,CAAEI,UAZSC,EAAAA,aACd,CAACC,EAAoBC,KACjB,IAAIC,EAAcN,IAAeI,IAAMG,OAASC,EAAAA,QAAGJ,IAAMG,OAASH,EAMlE,OALIC,GAAQC,GACRG,OAAOC,KAAKL,IAAOM,SAASP,IACxBE,EAAcA,EAAYM,QAAQ,IAAIC,OAAO,IAAIT,KAAQ,KAAM,GAAGC,EAAKD,KAAO,IAG/EE,CAAW,GAEtB,CAACN,IAEeA,eAAc"}
1
+ {"version":3,"file":"TranslationProvider.cjs.js","sources":["../../src/providers/TranslationProvider.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useState } from 'react';\nimport en from '../../../../localization/en.json';\nimport { getMicroFrontendAttribute } from '../components/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":["TranslationContext","createContext","translations","useContext","translate","useCallback","key","data","translation","value","en","Object","keys","forEach","replace","RegExp"],"mappings":"6GAcA,MAAMA,EAAqBC,EAAAA,cAA+B,CAAA,0BAW5B,KAI1B,MAAMC,aAAEA,GAAiBC,EAAUA,WAACH,GAcpC,MAAO,CAAEI,UAZSC,EAAAA,aACd,CAACC,EAAoBC,KACjB,IAAIC,EAAcN,IAAeI,IAAMG,OAASC,EAAAA,QAAGJ,IAAMG,OAASH,EAMlE,OALIC,GAAQC,GACRG,OAAOC,KAAKL,IAAOM,SAASP,IACxBE,EAAcA,EAAYM,QAAQ,IAAIC,OAAO,IAAIT,KAAQ,KAAM,GAAGC,EAAKD,KAAO,IAG/EE,CAAW,GAEtB,CAACN,IAEeA,eAAc"}
@@ -1 +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":["TranslationContext","createContext","useTranslation","translations","useContext","translate","useCallback","key","data","translation","value","en","Object","keys","forEach","replace","RegExp"],"mappings":"2IAcA,MAAMA,EAAqBC,EAA+B,CAAA,GAW7CC,EAAiB,KAI1B,MAAMC,aAAEA,GAAiBC,EAAWJ,GAcpC,MAAO,CAAEK,UAZSC,GACd,CAACC,EAAoBC,KACjB,IAAIC,EAAcN,IAAeI,IAAMG,OAASC,EAAGJ,IAAMG,OAASH,EAMlE,OALIC,GAAQC,GACRG,OAAOC,KAAKL,IAAOM,SAASP,IACxBE,EAAcA,EAAYM,QAAQ,IAAIC,OAAO,IAAIT,KAAQ,KAAM,GAAGC,EAAKD,KAAO,IAG/EE,CAAW,GAEtB,CAACN,IAEeA,eAAc"}
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 '../components/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":["TranslationContext","createContext","useTranslation","translations","useContext","translate","useCallback","key","data","translation","value","en","Object","keys","forEach","replace","RegExp"],"mappings":"2IAcA,MAAMA,EAAqBC,EAA+B,CAAA,GAW7CC,EAAiB,KAI1B,MAAMC,aAAEA,GAAiBC,EAAWJ,GAcpC,MAAO,CAAEK,UAZSC,GACd,CAACC,EAAoBC,KACjB,IAAIC,EAAcN,IAAeI,IAAMG,OAASC,EAAGJ,IAAMG,OAASH,EAMlE,OALIC,GAAQC,GACRG,OAAOC,KAAKL,IAAOM,SAASP,IACxBE,EAAcA,EAAYM,QAAQ,IAAIC,OAAO,IAAIT,KAAQ,KAAM,GAAGC,EAAKD,KAAO,IAG/EE,CAAW,GAEtB,CAACN,IAEeA,eAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/portal-library",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,2 +0,0 @@
1
- "use strict";require("react");exports.getMicroFrontendAttribute=t=>{const e=document.getElementById("flipdish-micro-frontend");return e&&e.getAttribute(t)};
2
- //# sourceMappingURL=renderUtilities.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderUtilities.cjs.js","sources":["../../src/utilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["key","microFrontendDiv","document","getElementById","getAttribute"],"mappings":"gEAE0CA,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI"}
@@ -1,2 +0,0 @@
1
- import"react";const t=t=>{const e=document.getElementById("flipdish-micro-frontend");return e&&e.getAttribute(t)};export{t as getMicroFrontendAttribute};
2
- //# sourceMappingURL=renderUtilities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderUtilities.js","sources":["../../src/utilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute"],"mappings":"cAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI"}