@rivm-loculus-tools/common-frontend 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/app/App/index.js +8 -5
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/fasta/FastaDataImportDialogLoader/FastaDataImportDialogLoader.d.ts +1 -1
- package/dist/components/fasta/FastaDataImportDialogLoader/index.js.map +1 -1
- package/dist/components/ui/ButtonWithMenu/ButtonWithMenu.d.ts +12 -0
- package/dist/components/ui/ButtonWithMenu/index.d.ts +1 -0
- package/dist/components/ui/ButtonWithMenu/index.js +47 -0
- package/dist/components/ui/ButtonWithMenu/index.js.map +1 -0
- package/dist/components/ui/PageCommon/index.js +8 -7
- package/dist/components/ui/PageCommon/index.js.map +1 -1
- package/dist/components/ui/PageCommonDrawer/index.js +12 -11
- package/dist/components/ui/PageCommonDrawer/index.js.map +1 -1
- package/dist/components/ui/PageCommonHeader/PageCommonHeader.d.ts +1 -2
- package/dist/components/ui/PageCommonHeader/index.js +66 -57
- package/dist/components/ui/PageCommonHeader/index.js.map +1 -1
- package/dist/context/pageCommonContext/PageCommonContext.d.ts +11 -1
- package/dist/context/pageCommonContext/PageCommonContextProvider.d.ts +3 -2
- package/dist/context/pageCommonContext/index.js +18 -16
- package/dist/context/pageCommonContext/index.js.map +1 -1
- package/dist/models/config.models.d.ts +3 -6
- package/dist/theme/index.js +17 -17
- package/dist/theme/index.js.map +1 -1
- package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +1 -1
- package/dist/utils/DependencyContainerUtil/index.js +2 -2
- package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
- package/dist/utils/ExportUtil/ExportUtil.d.ts +6 -0
- package/dist/utils/ExportUtil/index.d.ts +1 -0
- package/dist/utils/ExportUtil/index.js +42 -0
- package/dist/utils/ExportUtil/index.js.map +1 -0
- package/dist/utils/StandardConfigUtil/StandardConfigUtil.d.ts +1 -1
- package/dist/utils/StandardConfigUtil/index.js +1 -0
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/package.json +9 -5
- package/dist/components/ui/PageHeaderDocumentationButton/PageHeaderDocumentationButton.d.ts +0 -1
- package/dist/components/ui/PageHeaderDocumentationButton/index.d.ts +0 -1
- package/dist/components/ui/PageHeaderDocumentationButton/index.js +0 -24
- package/dist/components/ui/PageHeaderDocumentationButton/index.js.map +0 -1
|
@@ -78,18 +78,21 @@ function y(e = [], t = []) {
|
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/components/app/App/App.tsx
|
|
80
80
|
var b = ({ children: u, container: d }) => {
|
|
81
|
-
let f = e.resolveConfig(d), p = f.getTouchIconUrl();
|
|
82
|
-
|
|
83
|
-
let
|
|
81
|
+
let f = e.resolveConfig(d), { pageConfig: p } = f, h = f.getTouchIconUrl?.();
|
|
82
|
+
h && document.querySelector("link[rel=\"icon\"]")?.setAttribute("href", h);
|
|
83
|
+
let g = d.resolve(a).emotionCache;
|
|
84
84
|
return /* @__PURE__ */ c(n, {
|
|
85
85
|
container: d,
|
|
86
86
|
children: /* @__PURE__ */ c(m, {
|
|
87
|
-
value:
|
|
87
|
+
value: g,
|
|
88
88
|
children: /* @__PURE__ */ l(s, {
|
|
89
89
|
theme: f.theme,
|
|
90
90
|
children: [/* @__PURE__ */ c(o, {}), /* @__PURE__ */ c(v, {
|
|
91
91
|
FallbackComponent: r,
|
|
92
|
-
children: /* @__PURE__ */ c(i, { children: /* @__PURE__ */ c(t, {
|
|
92
|
+
children: /* @__PURE__ */ c(i, { children: /* @__PURE__ */ c(t, {
|
|
93
|
+
...p,
|
|
94
|
+
children: u
|
|
95
|
+
}) })
|
|
93
96
|
})]
|
|
94
97
|
})
|
|
95
98
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["l","h","i","y","ErrorBoundary","EmotionCacheService","f","createContext","m","r","e","t","o","n","useMemo","createElement","d","C","Component","g","s","c","u","App","config","DependencyContainerUtil","container","touchIconUrl","emotionCache","CommonConfigContextProvider","CacheProvider","ThemeProvider","CssBaseline","ErrorPage","I18nWrapper","PageCommonContextProvider"],"sources":["../../../../../../../node_modules/.pnpm/react-error-boundary@6.1.6_@types+react@19.3.0_react@19.3.0/node_modules/react-error-boundary/dist/react-error-boundary.js","../../../../src/components/app/App/App.tsx"],"sourcesContent":["\"use client\";\nimport { createContext as l, useMemo as h, createElement as i, Component as y, useContext as p, useState as E, forwardRef as B } from \"react\";\nconst f = l(null);\nfunction m({\n children: r,\n didCatch: e,\n error: t,\n resetErrorBoundary: o\n}) {\n const n = h(\n () => ({ didCatch: e, error: t, resetErrorBoundary: o }),\n [e, t, o]\n );\n return i(f.Provider, { value: n }, r);\n}\nconst d = {\n didCatch: !1,\n error: null\n};\nclass C extends y {\n constructor(e) {\n super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = d;\n }\n static getDerivedStateFromError(e) {\n return { didCatch: !0, error: e };\n }\n resetErrorBoundary(...e) {\n const { didCatch: t } = this.state;\n t && (this.props.onReset?.({\n args: e,\n reason: \"imperative-api\"\n }), this.setState(d));\n }\n componentDidCatch(e, t) {\n this.props.onError?.(e, t);\n }\n componentDidUpdate(e, t) {\n const { didCatch: o } = this.state, { resetKeys: n } = this.props;\n o && t.didCatch && g(e.resetKeys, n) && (this.props.onReset?.({\n next: n,\n prev: e.resetKeys,\n reason: \"keys\"\n }), this.setState(d));\n }\n render() {\n const { children: e, fallbackRender: t, FallbackComponent: o, fallback: n } = this.props, { didCatch: s, error: a } = this.state;\n let c = e;\n if (s) {\n const u = {\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof t == \"function\")\n c = t(u);\n else if (o)\n c = i(o, u);\n else if (\"fallback\" in this.props)\n c = n;\n else\n throw a;\n }\n return i(\n m,\n {\n didCatch: s,\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n },\n c\n );\n }\n}\nfunction g(r = [], e = []) {\n return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));\n}\nfunction x(r) {\n return r !== null && typeof r == \"object\" && \"didCatch\" in r && typeof r.didCatch == \"boolean\" && \"error\" in r && \"resetErrorBoundary\" in r && typeof r.resetErrorBoundary == \"function\";\n}\nfunction b(r) {\n if (!x(r))\n throw new Error(\"ErrorBoundaryContext not found\");\n}\nfunction S() {\n const r = p(f);\n b(r);\n const { error: e, resetErrorBoundary: t } = r, [o, n] = E({\n error: null,\n hasError: !1\n }), s = h(\n () => ({\n error: e,\n resetBoundary: () => {\n t(), n({ error: null, hasError: !1 });\n },\n showBoundary: (a) => n({\n error: a,\n hasError: !0\n })\n }),\n [e, t]\n );\n if (o.hasError)\n throw o.error;\n return s;\n}\nfunction w(r) {\n switch (typeof r) {\n case \"object\": {\n if (r !== null && \"message\" in r && typeof r.message == \"string\")\n return r.message;\n break;\n }\n case \"string\":\n return r;\n }\n}\nfunction R(r, e) {\n const t = B(\n (n, s) => i(\n C,\n e,\n i(r, { ...n, ref: s })\n )\n ), o = r.displayName || r.name || \"Unknown\";\n return t.displayName = `withErrorBoundary(${o})`, t;\n}\nexport {\n C as ErrorBoundary,\n f as ErrorBoundaryContext,\n w as getErrorMessage,\n S as useErrorBoundary,\n R as withErrorBoundary\n};\n//# sourceMappingURL=react-error-boundary.js.map\n","import type { DependencyContainer } from 'tsyringe';\nimport { CacheProvider } from '@emotion/react';\nimport {\n CssBaseline,\n ThemeProvider,\n} from '@mui/material';\nimport { ErrorBoundary } from 'react-error-boundary';\nimport type { PropsWithChildren } from 'react';\n\nimport { EmotionCacheService } from '../../../classes/services/EmotionCacheService';\nimport type { ConfigBase } from '../../../models/config.models';\nimport { DependencyContainerUtil } from '../../../utils/DependencyContainerUtil';\nimport { CommonConfigContextProvider } from '../../../context/commonConfigContext';\nimport { ErrorPage } from '../../../pages/ErrorPage';\nimport { I18nWrapper } from '../../ui/I18nWrapper';\nimport { PageCommonContextProvider } from '../../../context/pageCommonContext';\n\nexport type AppProps = PropsWithChildren<{\n readonly container: DependencyContainer;\n}>;\n\nexport const App = ({ children, container }: AppProps) => {\n const config = DependencyContainerUtil.resolveConfig<ConfigBase>(container);\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["l","h","i","y","ErrorBoundary","EmotionCacheService","f","createContext","m","r","e","t","o","n","useMemo","createElement","d","C","Component","g","s","c","u","App","config","DependencyContainerUtil","container","touchIconUrl","emotionCache","CommonConfigContextProvider","CacheProvider","ThemeProvider","CssBaseline","ErrorPage","I18nWrapper","PageCommonContextProvider","pageConfig"],"sources":["../../../../../../../node_modules/.pnpm/react-error-boundary@6.1.6_@types+react@19.3.0_react@19.3.0/node_modules/react-error-boundary/dist/react-error-boundary.js","../../../../src/components/app/App/App.tsx"],"sourcesContent":["\"use client\";\nimport { createContext as l, useMemo as h, createElement as i, Component as y, useContext as p, useState as E, forwardRef as B } from \"react\";\nconst f = l(null);\nfunction m({\n children: r,\n didCatch: e,\n error: t,\n resetErrorBoundary: o\n}) {\n const n = h(\n () => ({ didCatch: e, error: t, resetErrorBoundary: o }),\n [e, t, o]\n );\n return i(f.Provider, { value: n }, r);\n}\nconst d = {\n didCatch: !1,\n error: null\n};\nclass C extends y {\n constructor(e) {\n super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = d;\n }\n static getDerivedStateFromError(e) {\n return { didCatch: !0, error: e };\n }\n resetErrorBoundary(...e) {\n const { didCatch: t } = this.state;\n t && (this.props.onReset?.({\n args: e,\n reason: \"imperative-api\"\n }), this.setState(d));\n }\n componentDidCatch(e, t) {\n this.props.onError?.(e, t);\n }\n componentDidUpdate(e, t) {\n const { didCatch: o } = this.state, { resetKeys: n } = this.props;\n o && t.didCatch && g(e.resetKeys, n) && (this.props.onReset?.({\n next: n,\n prev: e.resetKeys,\n reason: \"keys\"\n }), this.setState(d));\n }\n render() {\n const { children: e, fallbackRender: t, FallbackComponent: o, fallback: n } = this.props, { didCatch: s, error: a } = this.state;\n let c = e;\n if (s) {\n const u = {\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof t == \"function\")\n c = t(u);\n else if (o)\n c = i(o, u);\n else if (\"fallback\" in this.props)\n c = n;\n else\n throw a;\n }\n return i(\n m,\n {\n didCatch: s,\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n },\n c\n );\n }\n}\nfunction g(r = [], e = []) {\n return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));\n}\nfunction x(r) {\n return r !== null && typeof r == \"object\" && \"didCatch\" in r && typeof r.didCatch == \"boolean\" && \"error\" in r && \"resetErrorBoundary\" in r && typeof r.resetErrorBoundary == \"function\";\n}\nfunction b(r) {\n if (!x(r))\n throw new Error(\"ErrorBoundaryContext not found\");\n}\nfunction S() {\n const r = p(f);\n b(r);\n const { error: e, resetErrorBoundary: t } = r, [o, n] = E({\n error: null,\n hasError: !1\n }), s = h(\n () => ({\n error: e,\n resetBoundary: () => {\n t(), n({ error: null, hasError: !1 });\n },\n showBoundary: (a) => n({\n error: a,\n hasError: !0\n })\n }),\n [e, t]\n );\n if (o.hasError)\n throw o.error;\n return s;\n}\nfunction w(r) {\n switch (typeof r) {\n case \"object\": {\n if (r !== null && \"message\" in r && typeof r.message == \"string\")\n return r.message;\n break;\n }\n case \"string\":\n return r;\n }\n}\nfunction R(r, e) {\n const t = B(\n (n, s) => i(\n C,\n e,\n i(r, { ...n, ref: s })\n )\n ), o = r.displayName || r.name || \"Unknown\";\n return t.displayName = `withErrorBoundary(${o})`, t;\n}\nexport {\n C as ErrorBoundary,\n f as ErrorBoundaryContext,\n w as getErrorMessage,\n S as useErrorBoundary,\n R as withErrorBoundary\n};\n//# sourceMappingURL=react-error-boundary.js.map\n","import type { DependencyContainer } from 'tsyringe';\nimport { CacheProvider } from '@emotion/react';\nimport {\n CssBaseline,\n ThemeProvider,\n} from '@mui/material';\nimport { ErrorBoundary } from 'react-error-boundary';\nimport type { PropsWithChildren } from 'react';\n\nimport { EmotionCacheService } from '../../../classes/services/EmotionCacheService';\nimport type { ConfigBase } from '../../../models/config.models';\nimport { DependencyContainerUtil } from '../../../utils/DependencyContainerUtil';\nimport { CommonConfigContextProvider } from '../../../context/commonConfigContext';\nimport { ErrorPage } from '../../../pages/ErrorPage';\nimport { I18nWrapper } from '../../ui/I18nWrapper';\nimport { PageCommonContextProvider } from '../../../context/pageCommonContext';\n\nexport type AppProps = PropsWithChildren<{\n readonly container: DependencyContainer;\n}>;\n\nexport const App = ({ children, container }: AppProps) => {\n const config = DependencyContainerUtil.resolveConfig<ConfigBase>(container);\n const { pageConfig } = config;\n const touchIconUrl = config.getTouchIconUrl?.();\n if (touchIconUrl) {\n document.querySelector('link[rel=\"icon\"]')?.setAttribute('href', touchIconUrl);\n }\n\n const emotionCache = container.resolve(EmotionCacheService).emotionCache;\n\n return (\n <CommonConfigContextProvider container={container}>\n <CacheProvider value={emotionCache}>\n <ThemeProvider theme={config.theme}>\n <CssBaseline />\n <ErrorBoundary FallbackComponent={ErrorPage}>\n <I18nWrapper>\n <PageCommonContextProvider {...pageConfig}>\n {children}\n </PageCommonContextProvider>\n </I18nWrapper>\n </ErrorBoundary>\n </ThemeProvider>\n </CacheProvider>\n </CommonConfigContextProvider>\n );\n};\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;AAEA,IAAMM,IAAIN,EAAE,IAAI;AAChB,SAASQ,EAAE,EACT,UAAUC,GACV,UAAUC,GACV,OAAOC,GACP,oBAAoBC,KACnB;CACD,IAAMC,IAAIZ,SACD;EAAE,UAAUS;EAAG,OAAOC;EAAG,oBAAoBC;CAAE,IACtD;EAACF;EAAGC;EAAGC;CAAC,CACV;CACA,OAAOV,EAAEI,EAAE,UAAU,EAAE,OAAOO,EAAE,GAAGJ,CAAC;AACtC;AACA,IAAMO,IAAI;CACR,UAAU,CAAC;CACX,OAAO;AACT,GACMC,IAAN,cAAgBd,EAAE;CAChB,YAAY,GAAG;EACb,MAAM,CAAC,GAAG,KAAK,qBAAqB,KAAK,mBAAmB,KAAK,IAAI,GAAG,KAAK,QAAQa;CACvF;CACA,OAAO,yBAAyB,GAAG;EACjC,OAAO;GAAE,UAAU,CAAC;GAAG,OAAO;EAAE;CAClC;CACA,mBAAmB,GAAG,GAAG;EACvB,IAAM,EAAE,UAAU,MAAM,KAAK;EAC7B,MAAM,KAAK,MAAM,UAAU;GACzB,MAAM;GACN,QAAQ;EACV,CAAC,GAAG,KAAK,SAASA,CAAC;CACrB;CACA,kBAAkB,GAAG,GAAG;EACtB,KAAK,MAAM,UAAU,GAAG,CAAC;CAC3B;CACA,mBAAmB,GAAG,GAAG;EACvB,IAAM,EAAE,UAAUJ,MAAM,KAAK,OAAO,EAAE,WAAWC,MAAM,KAAK;EAC5D,KAAK,EAAE,YAAYM,EAAE,EAAE,WAAWN,CAAC,MAAM,KAAK,MAAM,UAAU;GAC5D,MAAMA;GACN,MAAM,EAAE;GACR,QAAQ;EACV,CAAC,GAAG,KAAK,SAASG,CAAC;CACrB;CACA,SAAS;EACP,IAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,mBAAmBJ,GAAG,UAAUC,MAAM,KAAK,OAAO,EAAE,UAAUO,GAAG,OAAO,MAAM,KAAK,OACvHC,IAAI;EACR,IAAID,GAAG;GACL,IAAME,IAAI;IACR,OAAO;IACP,oBAAoB,KAAK;GAC3B;GACA,IAAI,OAAO,KAAK,YACd,IAAI,EAAEA,CAAC;QACJ,IAAIV,GACP,IAAIV,EAAEU,GAAGU,CAAC;QACP,IAAI,cAAc,KAAK,OAC1B,IAAIT;QAEJ,MAAM;EACV;EACA,OAAOX,EACLM,GACA;GACE,UAAUY;GACV,OAAO;GACP,oBAAoB,KAAK;EAC3B,GACAC,CACF;CACF;AACF;AACA,SAASF,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG;CACzB,OAAOV,EAAE,WAAWC,EAAE,UAAUD,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,GAAGE,GAAGD,EAAEE,EAAE,CAAC;AACtE;;;ACrDA,IAAaW,KAAO,EAAE,aAAU,mBAA0B;CACxD,IAAMC,IAASC,EAAwB,cAA0BC,CAAS,GACpE,EAAE,kBAAeF,GACjBG,IAAeH,EAAO,kBAAkB;CAC9C,AAAIG,KACF,SAAS,cAAc,oBAAkB,CAAC,EAAE,aAAa,QAAQA,CAAY;CAG/E,IAAMC,IAAeF,EAAU,QAAQrB,CAAmB,CAAC,CAAC;CAE5D,OACE,kBAACwB,GAAD;EAAwC;EACtC,UAAA,kBAACC,GAAD;GAAe,OAAOF;GACpB,UAAA,kBAACG,GAAD;IAAe,OAAOP,EAAO;IAA7B,UAAA,CACE,kBAACQ,GAAD,CAAc,CAAA,GACd,kBAAC5B,GAAD;KAAe,mBAAmB6B;KAChC,UAAA,kBAACC,GAAD,EAAA,UACE,kBAACC,GAAD;MAA2B,GAAIC;MAC5B;KACwB,CAAA,EAChB,CAAA;IACA,CAAA,CACF;;EACF,CAAA;CACY,CAAA;AAEjC"}
|
|
@@ -2,7 +2,7 @@ import { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';
|
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
3
|
import { FastaDataStore } from '../../../stores/fastaDataStore';
|
|
4
4
|
export type FastaDataImportDialogLoaderProps = {
|
|
5
|
-
extraActions
|
|
5
|
+
extraActions?: DialogAction[];
|
|
6
6
|
store: StoreApi<FastaDataStore>;
|
|
7
7
|
};
|
|
8
8
|
export declare const FastaDataImportDialogLoader: ({ extraActions, store }: FastaDataImportDialogLoaderProps) => import('react').JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","useStore","FastaDataImportDialogLoader","setData","store","state","setLoadingStatus","fastaDataImportDialogRef","useRef","useEffect","removers","container","FastaDataEventBusService","initialErrorMessage","remove","urlParams","inputFastaUrl","inputMetadataUrl","LOADING_STATUS","fastaRes","fastaText","metaText","metaRes","metaErr","fastaErr","message","handleError","useCallback","errorMessage","onDataChange","fastaContent","metadataContent","ErrorUtil","onError","Fragment","FastaDataImportDialog"],"sources":["../../../../src/components/fasta/FastaDataImportDialogLoader/FastaDataImportDialogLoader.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport {\n useCallback,\n useEffect,\n useRef,\n} from 'react';\nimport type { StoreApi } from 'zustand';\nimport { useStore } from 'zustand';\n\nimport { FastaDataEventBusService } from '../../../classes/services/FastaDataEventBusService';\nimport { LOADING_STATUS } from '../../../models/fasta.models';\nimport type { FastaDataStore } from '../../../stores/fastaDataStore';\nimport { UrlUtil } from '../../../utils/UrlUtil';\nimport type { FastaDataImportDialogRefMethods } from '../FastaDataImportDialog';\nimport { FastaDataImportDialog } from '../FastaDataImportDialog';\nimport { ErrorUtil } from '../../../utils/ErrorUtil';\n\n\nexport type FastaDataImportDialogLoaderProps = {\n extraActions
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","useStore","FastaDataImportDialogLoader","setData","store","state","setLoadingStatus","fastaDataImportDialogRef","useRef","useEffect","removers","container","FastaDataEventBusService","initialErrorMessage","remove","urlParams","inputFastaUrl","inputMetadataUrl","LOADING_STATUS","fastaRes","fastaText","metaText","metaRes","metaErr","fastaErr","message","handleError","useCallback","errorMessage","onDataChange","fastaContent","metadataContent","ErrorUtil","onError","Fragment","FastaDataImportDialog"],"sources":["../../../../src/components/fasta/FastaDataImportDialogLoader/FastaDataImportDialogLoader.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport {\n useCallback,\n useEffect,\n useRef,\n} from 'react';\nimport type { StoreApi } from 'zustand';\nimport { useStore } from 'zustand';\n\nimport { FastaDataEventBusService } from '../../../classes/services/FastaDataEventBusService';\nimport { LOADING_STATUS } from '../../../models/fasta.models';\nimport type { FastaDataStore } from '../../../stores/fastaDataStore';\nimport { UrlUtil } from '../../../utils/UrlUtil';\nimport type { FastaDataImportDialogRefMethods } from '../FastaDataImportDialog';\nimport { FastaDataImportDialog } from '../FastaDataImportDialog';\nimport { ErrorUtil } from '../../../utils/ErrorUtil';\n\n\nexport type FastaDataImportDialogLoaderProps = {\n extraActions?: DialogAction[];\n store: StoreApi<FastaDataStore>;\n};\n\nexport const FastaDataImportDialogLoader = ({ extraActions, store }: FastaDataImportDialogLoaderProps) => {\n const setData = useStore(store, (state) => state.setData);\n const setLoadingStatus = useStore(store, (state) => state.setLoadingStatus);\n const fastaDataImportDialogRef = useRef<FastaDataImportDialogRefMethods>(null);\n\n useEffect(() => {\n const removers = [\n // eslint-disable-next-line @eslint-react/web-api-no-leaked-event-listener\n container.resolve(FastaDataEventBusService).addEventListener('onShowImportDialog', (initialErrorMessage?: string) => {\n fastaDataImportDialogRef.current?.open(initialErrorMessage ? { initialErrorMessage } : undefined);\n }),\n // eslint-disable-next-line @eslint-react/web-api-no-leaked-event-listener\n container.resolve(FastaDataEventBusService).addEventListener('onCloseImportDialog', () => {\n fastaDataImportDialogRef.current?.close();\n }),\n ];\n return () => {\n removers.forEach((remove) => remove());\n };\n }, []);\n\n useEffect(() => {\n // Scan URL parameters for deep-linking\n const urlParams = new URLSearchParams(window.location.search);\n const inputFastaUrl = urlParams.get('input-fasta');\n const inputMetadataUrl = urlParams.get('input-metadata');\n\n const handleDeepLinking = async () => {\n if (inputFastaUrl) {\n setLoadingStatus(LOADING_STATUS.LOADING);\n try {\n const fastaRes = await fetch(inputFastaUrl);\n if (!fastaRes.ok) {\n throw new Error(`FASTA fetch failed (${fastaRes.status})`);\n }\n const fastaText = await fastaRes.text();\n\n if (!fastaText.trim()) {\n setLoadingStatus(LOADING_STATUS.ERROR);\n throw new Error('The input-fasta URL returned no sequence data. Check that the URL and requested accession(s) are correct.');\n }\n\n let metaText: string | undefined;\n if (inputMetadataUrl) {\n try {\n const metaRes = await fetch(inputMetadataUrl);\n if (metaRes.ok) {\n metaText = await metaRes.text();\n }\n } catch (metaErr) {\n console.warn('[App] Failed to auto-fetch metadata:', metaErr);\n }\n }\n\n await setData(fastaText, metaText);\n } catch (fastaErr) {\n console.error('[App] Failed to auto-load FASTA:', fastaErr);\n const message = fastaErr instanceof Error ? fastaErr.message : 'Failed to auto-load FASTA from the provided URL.';\n container.resolve(FastaDataEventBusService).emit('onShowImportDialog', message);\n }\n } else {\n // PV1-02: Show data loading modal if no data provided via URL query params\n container.resolve(FastaDataEventBusService).emit('onShowImportDialog');\n }\n };\n\n void handleDeepLinking();\n }, [setData, setLoadingStatus]);\n\n const handleError = useCallback((errorMessage: string) => {\n fastaDataImportDialogRef.current?.close();\n container.resolve(FastaDataEventBusService).emit('onShowImportDialog', errorMessage);\n }, []);\n\n const onDataChange = useCallback(async (fastaContent: string, metadataContent?: string) => {\n try {\n await setData(fastaContent, metadataContent);\n fastaDataImportDialogRef.current?.close();\n } catch (e) {\n handleError(ErrorUtil.getErrorMessage(e, 'Unknown error'));\n } finally {\n // clear any search params from the URL\n UrlUtil.clearSearchParams();\n }\n }, [handleError, setData]);\n\n const onError = useCallback((errorMessage: unknown) => {\n handleError(ErrorUtil.getErrorMessage(errorMessage, 'Unknown error'));\n }, [handleError]);\n\n return (\n <>\n <FastaDataImportDialog\n extraActions={extraActions}\n onDataChange={onDataChange}\n onError={onError}\n ref={fastaDataImportDialogRef}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAwBA,IAAaE,KAA+B,EAAE,iBAAc,eAA8C;CACxG,IAAMC,IAAUF,EAASG,IAAQ,MAAUC,EAAM,OAAO,GAClDC,IAAmBL,EAASG,IAAQ,MAAUC,EAAM,gBAAgB,GACpEE,IAA2BC,EAAwC,IAAI;CAkB7E,AAhBAC,QAAgB;EACd,IAAMC,IAAW,CAEfC,EAAU,QAAQC,CAAwB,CAAC,CAAC,iBAAiB,uBAAuB,MAAiC;GACnH,EAAyB,SAAS,KAAKC,IAAsB,EAAE,uBAAoB,IAAI,KAAA,CAAS;EAClG,CAAC,GAEDF,EAAU,QAAQC,CAAwB,CAAC,CAAC,iBAAiB,6BAA6B;GACxF,EAAyB,SAAS,MAAM;EAC1C,CAAC,CACH;EACA,aAAa;GACX,EAAS,SAAS,MAAWE,EAAO,CAAC;EACvC;CACF,GAAG,CAAC,CAAC,GAELL,QAAgB;EAEd,IAAMM,IAAY,IAAI,gBAAgB,OAAO,SAAS,MAAM,GACtDC,IAAgBD,EAAU,IAAI,aAAa,GAC3CE,IAAmBF,EAAU,IAAI,gBAAgB;EAyCvD,aAvCsC;GACpC,IAAIC,GAAe;IACjB,EAAiBE,EAAe,OAAO;IACvC,IAAI;KACF,IAAMC,IAAW,MAAM,MAAMH,CAAa;KAC1C,IAAI,CAACG,EAAS,IACZ,MAAU,MAAM,uBAAuBA,EAAS,OAAO,EAAE;KAE3D,IAAMC,IAAY,MAAMD,EAAS,KAAK;KAEtC,IAAI,CAACC,EAAU,KAAK,GAElB,MADAd,EAAiBY,EAAe,KAAK,GAC3B,MAAM,2GAA2G;KAG7H,IAAIG;KACJ,IAAIJ,GACF,IAAI;MACF,IAAMK,IAAU,MAAM,MAAML,CAAgB;MAC5C,AAAIK,EAAQ,OACV,IAAW,MAAMA,EAAQ,KAAK;KAElC,SAASC,GAAS;MAChB,QAAQ,KAAK,wCAAwCA,CAAO;KAC9D;KAGF,MAAMpB,EAAQiB,GAAWC,CAAQ;IACnC,SAASG,GAAU;KACjB,QAAQ,MAAM,oCAAoCA,CAAQ;KAC1D,IAAMC,IAAUD,aAAoB,QAAQA,EAAS,UAAU;KAC/D,EAAU,QAAQZ,CAAwB,CAAC,CAAC,KAAK,sBAAsBa,CAAO;IAChF;GACF,OAEE,EAAU,QAAQb,CAAwB,CAAC,CAAC,KAAK,oBAAoB;EAEzE,EAEK,CAAkB;CACzB,GAAG,CAACT,GAASG,CAAgB,CAAC;CAE9B,IAAMoB,IAAcC,GAAa,MAAyB;EAExD,AADApB,EAAyB,SAAS,MAAM,GACxCI,EAAU,QAAQC,CAAwB,CAAC,CAAC,KAAK,sBAAsBgB,CAAY;CACrF,GAAG,CAAC,CAAC,GAECC,IAAeF,EAAY,OAAO,GAAsB,MAA6B;EACzF,IAAI;GAEF,AADA,MAAMxB,EAAQ2B,GAAcC,CAAe,GAC3CxB,EAAyB,SAAS,MAAM;EAC1C,SAAS,GAAG;GACV,EAAYyB,EAAU,gBAAgB,GAAG,eAAe,CAAC;EAC3D,UAAU;GAER,EAAQ,kBAAkB;EAC5B;CACF,GAAG,CAACN,GAAavB,CAAO,CAAC,GAEnB8B,IAAUN,GAAa,MAA0B;EACrD,EAAYK,EAAU,gBAAgBJ,GAAc,eAAe,CAAC;CACtE,GAAG,CAACF,CAAW,CAAC;CAEhB,OACE,kBAAA1B,GAAA,EAAA,UACE,kBAACmC,GAAD;EACgB;EACA;EACL;EACT,KAAK5B;CACN,CAAA,EACD,CAAA;AAEN"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export type ButtonWithMenuProps = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
items: Array<{
|
|
5
|
+
icon: ReactElement;
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}>;
|
|
9
|
+
label: string;
|
|
10
|
+
startIcon?: ReactElement;
|
|
11
|
+
};
|
|
12
|
+
export declare const ButtonWithMenu: ({ disabled, items, label, startIcon }: ButtonWithMenuProps) => import('react').JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonWithMenu';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Button as e, ListItemIcon as t, ListItemText as n, Menu as r, MenuItem as i } from "@mui/material";
|
|
2
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback as c, useState as l } from "react";
|
|
4
|
+
//#region src/components/ui/ButtonWithMenu/ButtonWithMenu.tsx
|
|
5
|
+
var u = ({ disabled: u, items: d, label: f, startIcon: p }) => {
|
|
6
|
+
let [m, h] = l(null), g = !!m, _ = c((e) => {
|
|
7
|
+
h(e.currentTarget);
|
|
8
|
+
}, []), v = c(() => {
|
|
9
|
+
h(null);
|
|
10
|
+
}, []);
|
|
11
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(e, {
|
|
12
|
+
color: "inherit",
|
|
13
|
+
disabled: u,
|
|
14
|
+
onClick: _,
|
|
15
|
+
size: "small",
|
|
16
|
+
startIcon: p,
|
|
17
|
+
sx: {
|
|
18
|
+
"&:hover": { backgroundColor: "rgba(255, 255, 255, 0.25)" },
|
|
19
|
+
backgroundColor: "rgba(255, 255, 255, 0.15)",
|
|
20
|
+
color: "#FFFFFF"
|
|
21
|
+
},
|
|
22
|
+
variant: "contained",
|
|
23
|
+
children: f
|
|
24
|
+
}), /* @__PURE__ */ o(r, {
|
|
25
|
+
anchorEl: m,
|
|
26
|
+
anchorOrigin: {
|
|
27
|
+
horizontal: "right",
|
|
28
|
+
vertical: "bottom"
|
|
29
|
+
},
|
|
30
|
+
onClose: v,
|
|
31
|
+
open: g,
|
|
32
|
+
transformOrigin: {
|
|
33
|
+
horizontal: "right",
|
|
34
|
+
vertical: "top"
|
|
35
|
+
},
|
|
36
|
+
children: d.map(({ icon: e, label: r, onClick: a }) => /* @__PURE__ */ s(i, {
|
|
37
|
+
onClick: () => {
|
|
38
|
+
v(), a();
|
|
39
|
+
},
|
|
40
|
+
children: [/* @__PURE__ */ o(t, { children: e }), /* @__PURE__ */ o(n, { primary: r })]
|
|
41
|
+
}, r))
|
|
42
|
+
})] });
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { u as ButtonWithMenu };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","ButtonWithMenu","anchorElement","setAnchorElement","useState","isMenuOpen","onClickMenu","useCallback","event","onCloseMenu","Fragment","Button","label","Menu","items","itemLabel","MenuItem","onClick","ListItemIcon","icon","ListItemText"],"sources":["../../../../src/components/ui/ButtonWithMenu/ButtonWithMenu.tsx"],"sourcesContent":["import {\n Button,\n ListItemIcon,\n ListItemText,\n Menu,\n MenuItem,\n} from '@mui/material';\nimport {\n useCallback,\n useState,\n} from 'react';\nimport type {\n MouseEvent,\n ReactElement,\n} from 'react';\n\nexport type ButtonWithMenuProps = {\n disabled?: boolean;\n items: Array<{\n icon: ReactElement;\n label: string;\n onClick: () => void;\n }>;\n label: string;\n startIcon?: ReactElement;\n};\n\nexport const ButtonWithMenu = ({ disabled, items, label, startIcon }: ButtonWithMenuProps) => {\n const [anchorElement, setAnchorElement] = useState<HTMLElement | null>(null);\n const isMenuOpen = Boolean(anchorElement);\n\n const onClickMenu = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorElement(event.currentTarget);\n }, []);\n\n const onCloseMenu = useCallback(() => {\n setAnchorElement(null);\n }, []);\n\n return (\n <>\n <Button\n color={'inherit'}\n disabled={disabled}\n onClick={onClickMenu}\n size={'small'}\n startIcon={startIcon}\n sx={{\n '&:hover': {\n backgroundColor: 'rgba(255, 255, 255, 0.25)',\n },\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n color: '#FFFFFF',\n }}\n variant={'contained'}\n >\n {label}\n </Button>\n <Menu\n anchorEl={anchorElement}\n anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}\n onClose={onCloseMenu}\n open={isMenuOpen}\n transformOrigin={{ horizontal: 'right', vertical: 'top' }}\n >\n {items.map(({ icon, label: itemLabel, onClick }) => (\n <MenuItem\n key={itemLabel}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => {\n onCloseMenu();\n onClick();\n }}\n >\n <ListItemIcon>\n {icon}\n </ListItemIcon>\n <ListItemText primary={itemLabel} />\n </MenuItem>\n ))}\n </Menu>\n </>\n );\n};\n"],"mappings":";;;;AA2BA,IAAaC,KAAkB,EAAE,aAAU,UAAO,UAAO,mBAAqC;CAC5F,IAAM,CAACC,GAAeC,KAAoBC,EAA6B,IAAI,GACrEC,IAAa,EAAQH,GAErBI,IAAcC,GAAa,MAAyC;EACxE,EAAiBC,EAAM,aAAa;CACtC,GAAG,CAAC,CAAC,GAECC,IAAcF,QAAkB;EACpC,EAAiB,IAAI;CACvB,GAAG,CAAC,CAAC;CAEL,OACE,kBAAAP,GAAA,EAAA,UAAA,CACE,kBAACW,GAAD;EACE,OAAO;EACG;EACV,SAASL;EACT,MAAM;EACK;EACX,IAAI;GACF,WAAW,EACT,iBAAiB,4BACnB;GACA,iBAAiB;GACjB,OAAO;EACT;EACA,SAAS;EAER,UAAAM;CACK,CAAA,GACR,kBAACC,GAAD;EACE,UAAUX;EACV,cAAc;GAAE,YAAY;GAAS,UAAU;EAAS;EACxD,SAASO;EACT,MAAMJ;EACN,iBAAiB;GAAE,YAAY;GAAS,UAAU;EAAM;EAEvD,UAAAS,EAAM,KAAK,EAAE,SAAM,OAAOC,GAAW,iBACpC,kBAACC,GAAD;GAGE,eAAe;IAEb,AADAP,EAAY,GACZQ,EAAQ;GACV;GANF,UAAA,CAQE,kBAACC,GAAD,EAAA,UACGC,EACW,CAAA,GACd,kBAACC,GAAD,EAAc,SAASL,EAAY,CAAA,CAC3B;EAXH,GAAAA,CAWG,CACX;CACG,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
@@ -9,23 +9,24 @@ import { use as s, useEffect as c } from "react";
|
|
|
9
9
|
var l = ({ children: l, isNoInteraction: u, title: d }) => {
|
|
10
10
|
let { drawerComponent: f, headerComponent: p } = t();
|
|
11
11
|
n(d);
|
|
12
|
-
let m = i(), {
|
|
12
|
+
let m = i(), { drawerContainerId: h, isDrawerOpen: g, setIsNoInteraction: _ } = s(e);
|
|
13
13
|
return c(() => {
|
|
14
|
-
|
|
15
|
-
}, [u,
|
|
14
|
+
_(!!u);
|
|
15
|
+
}, [u, _]), /* @__PURE__ */ o(r, {
|
|
16
16
|
sx: {
|
|
17
|
-
display: "
|
|
18
|
-
|
|
17
|
+
display: "grid",
|
|
18
|
+
gridTemplateRows: "max-content auto",
|
|
19
19
|
height: "100vh",
|
|
20
20
|
overflow: "hidden",
|
|
21
21
|
position: "relative",
|
|
22
22
|
width: "100vw"
|
|
23
23
|
},
|
|
24
24
|
children: [p && /* @__PURE__ */ a(p, {}), /* @__PURE__ */ o(r, {
|
|
25
|
+
id: h,
|
|
25
26
|
sx: {
|
|
26
27
|
display: "flex",
|
|
27
28
|
flex: 1,
|
|
28
|
-
height: "
|
|
29
|
+
height: "100%",
|
|
29
30
|
overflow: "hidden",
|
|
30
31
|
position: "relative",
|
|
31
32
|
width: "100%"
|
|
@@ -41,7 +42,7 @@ var l = ({ children: l, isNoInteraction: u, title: d }) => {
|
|
|
41
42
|
duration: m.transitions.duration.leavingScreen,
|
|
42
43
|
easing: m.transitions.easing.sharp
|
|
43
44
|
}),
|
|
44
|
-
width:
|
|
45
|
+
width: g ? "calc(100% - 340px)" : "100%"
|
|
45
46
|
},
|
|
46
47
|
children: l
|
|
47
48
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["PageCommon","DrawerComponent","HeaderComponent","useConfig","title","theme","useTheme","use","PageCommonContext","useEffect","isNoInteraction","setIsNoInteraction","Box","isDrawerOpen"],"sources":["../../../../src/components/ui/PageCommon/PageCommon.tsx"],"sourcesContent":["import {\n Box,\n useTheme,\n} from '@mui/material';\nimport {\n use,\n useEffect,\n} from 'react';\nimport type { ReactNode } from 'react';\n\nimport { DRAWER_WIDTH } from '../../../constants/page.constants';\nimport { PageCommonContext } from '../../../context/pageCommonContext';\nimport { useUpdateDocumentTitle } from '../../../hooks/useUpdateDocumentTitle';\nimport { useConfig } from '../../../hooks/useConfig';\n\nexport type PageCommonProps = {\n readonly children: ReactNode;\n readonly isNoInteraction?: boolean;\n readonly title: string;\n};\n\n\nexport const PageCommon = ({ children, isNoInteraction, title }: PageCommonProps) => {\n const { drawerComponent: DrawerComponent, headerComponent: HeaderComponent } = useConfig();\n\n useUpdateDocumentTitle(title);\n const theme = useTheme();\n const { isDrawerOpen, setIsNoInteraction } = use(PageCommonContext);\n\n useEffect(() => {\n setIsNoInteraction(!!isNoInteraction);\n }, [isNoInteraction, setIsNoInteraction]);\n\n return (\n <Box\n sx={{\n display: '
|
|
1
|
+
{"version":3,"file":"index.js","names":["PageCommon","DrawerComponent","HeaderComponent","useConfig","title","theme","useTheme","use","PageCommonContext","useEffect","isNoInteraction","setIsNoInteraction","Box","drawerContainerId","isDrawerOpen"],"sources":["../../../../src/components/ui/PageCommon/PageCommon.tsx"],"sourcesContent":["import {\n Box,\n useTheme,\n} from '@mui/material';\nimport {\n use,\n useEffect,\n} from 'react';\nimport type { ReactNode } from 'react';\n\nimport { DRAWER_WIDTH } from '../../../constants/page.constants';\nimport { PageCommonContext } from '../../../context/pageCommonContext';\nimport { useUpdateDocumentTitle } from '../../../hooks/useUpdateDocumentTitle';\nimport { useConfig } from '../../../hooks/useConfig';\n\nexport type PageCommonProps = {\n readonly children: ReactNode;\n readonly isNoInteraction?: boolean;\n readonly title: string;\n};\n\n\nexport const PageCommon = ({ children, isNoInteraction, title }: PageCommonProps) => {\n const { drawerComponent: DrawerComponent, headerComponent: HeaderComponent } = useConfig();\n\n useUpdateDocumentTitle(title);\n const theme = useTheme();\n const { drawerContainerId, isDrawerOpen, setIsNoInteraction } = use(PageCommonContext);\n\n useEffect(() => {\n setIsNoInteraction(!!isNoInteraction);\n }, [isNoInteraction, setIsNoInteraction]);\n\n return (\n <Box\n sx={{\n display: 'grid',\n gridTemplateRows: 'max-content auto',\n height: '100vh',\n overflow: 'hidden',\n position: 'relative',\n width: '100vw',\n }}\n >\n {HeaderComponent && <HeaderComponent />}\n <Box\n id={drawerContainerId}\n sx={{\n display: 'flex',\n flex: 1,\n height: '100%',\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n }}\n >\n {DrawerComponent && <DrawerComponent />}\n <Box\n component={'main'}\n sx={{\n flexGrow: 1,\n height: '100%',\n overflow: 'hidden',\n position: 'relative',\n transition: () =>\n theme.transitions.create(['margin', 'width'], {\n duration: theme.transitions.duration.leavingScreen,\n easing: theme.transitions.easing.sharp,\n }),\n width: isDrawerOpen ? `calc(100% - ${DRAWER_WIDTH}px)` : '100%',\n }}\n >\n {children}\n </Box>\n\n </Box>\n </Box>\n );\n};\n"],"mappings":";;;;;;;;AAsBA,IAAaA,KAAc,EAAE,aAAU,oBAAiB,eAA6B;CACnF,IAAM,EAAE,iBAAiBC,GAAiB,iBAAiBC,MAAoBC,EAAU;CAEzF,EAAuBC,CAAK;CAC5B,IAAMC,IAAQC,EAAS,GACjB,EAAE,sBAAmB,iBAAc,0BAAuBC,EAAIC,CAAiB;CAMrF,OAJAC,QAAgB;EACd,EAAmB,CAAC,CAACC,CAAe;CACtC,GAAG,CAACA,GAAiBC,CAAkB,CAAC,GAGtC,kBAACC,GAAD;EACE,IAAI;GACF,SAAS;GACT,kBAAkB;GAClB,QAAQ;GACR,UAAU;GACV,UAAU;GACV,OAAO;EACT;EARF,UAAA,CAUGV,KAAmB,kBAACA,GAAD,CAAkB,CAAA,GACtC,kBAACU,GAAD;GACE,IAAIC;GACJ,IAAI;IACF,SAAS;IACT,MAAM;IACN,QAAQ;IACR,UAAU;IACV,UAAU;IACV,OAAO;GACT;GATF,UAAA,CAWGZ,KAAmB,kBAACA,GAAD,CAAkB,CAAA,GACtC,kBAACW,GAAD;IACE,WAAW;IACX,IAAI;KACF,UAAU;KACV,QAAQ;KACR,UAAU;KACV,UAAU;KACV,kBACEP,EAAM,YAAY,OAAO,CAAC,UAAU,OAAO,GAAG;MAC5C,UAAUA,EAAM,YAAY,SAAS;MACrC,QAAQA,EAAM,YAAY,OAAO;KACnC,CAAC;KACH,OAAOS,IAAe,uBAAmC;IAC3D;IAEC;GACE,CAAA,CAEF;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -5,20 +5,21 @@ import { jsx as n } from "react/jsx-runtime";
|
|
|
5
5
|
import { use as r } from "react";
|
|
6
6
|
//#region src/components/ui/PageCommonDrawer/PageCommonDrawer.tsx
|
|
7
7
|
var i = ({ children: i }) => {
|
|
8
|
-
let {
|
|
8
|
+
let { drawerContainerId: a, isDrawerOpen: o } = r(e);
|
|
9
9
|
return /* @__PURE__ */ n(t, {
|
|
10
10
|
anchor: "left",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
height: "calc(100% - 56px)",
|
|
15
|
-
overflowY: "auto",
|
|
16
|
-
top: "56px",
|
|
17
|
-
width: 340
|
|
18
|
-
},
|
|
19
|
-
flexShrink: 0,
|
|
20
|
-
width: a ? 340 : 0
|
|
11
|
+
ModalProps: {
|
|
12
|
+
container: () => document.getElementById(a),
|
|
13
|
+
style: { position: "absolute" }
|
|
21
14
|
},
|
|
15
|
+
open: o,
|
|
16
|
+
sx: { "& .MuiDrawer-paper": {
|
|
17
|
+
flexShrink: 0,
|
|
18
|
+
height: "100%",
|
|
19
|
+
overflowY: "auto",
|
|
20
|
+
position: "absolute",
|
|
21
|
+
width: o ? 340 : 0
|
|
22
|
+
} },
|
|
22
23
|
variant: "persistent",
|
|
23
24
|
children: i
|
|
24
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["PageCommonDrawer","use","PageCommonContext","Drawer","isDrawerOpen"],"sources":["../../../../src/components/ui/PageCommonDrawer/PageCommonDrawer.tsx"],"sourcesContent":["import { Drawer } from '@mui/material';\nimport { use } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { DRAWER_WIDTH } from '../../../constants/page.constants';\nimport { PageCommonContext } from '../../../context/pageCommonContext';\n\nexport type PageCommonDrawerProps = {\n readonly children: ReactNode;\n};\n\nexport const PageCommonDrawer = ({ children }: PageCommonDrawerProps) => {\n const { isDrawerOpen } = use(PageCommonContext);\n\n return (\n <Drawer\n anchor={'left'}\n open={isDrawerOpen}\n sx={{\n '& .MuiDrawer-paper': {\n height: '
|
|
1
|
+
{"version":3,"file":"index.js","names":["PageCommonDrawer","use","PageCommonContext","Drawer","drawerContainerId","isDrawerOpen"],"sources":["../../../../src/components/ui/PageCommonDrawer/PageCommonDrawer.tsx"],"sourcesContent":["import { Drawer } from '@mui/material';\nimport { use } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { DRAWER_WIDTH } from '../../../constants/page.constants';\nimport { PageCommonContext } from '../../../context/pageCommonContext';\n\nexport type PageCommonDrawerProps = {\n readonly children: ReactNode;\n};\n\nexport const PageCommonDrawer = ({ children }: PageCommonDrawerProps) => {\n const { drawerContainerId, isDrawerOpen } = use(PageCommonContext);\n\n return (\n <Drawer\n anchor={'left'}\n ModalProps={{\n container: () => document.getElementById(drawerContainerId),\n style: { position: 'absolute' }, // Forces modal overlay to stay inside the container\n }}\n open={isDrawerOpen}\n sx={{\n '& .MuiDrawer-paper': {\n flexShrink: 0,\n height: '100%',\n overflowY: 'auto',\n position: 'absolute',\n width: isDrawerOpen ? DRAWER_WIDTH : 0,\n },\n }}\n variant={'persistent'}\n >\n {children}\n </Drawer>\n );\n};\n"],"mappings":";;;;;;AAWA,IAAaA,KAAoB,EAAE,kBAAsC;CACvE,IAAM,EAAE,sBAAmB,oBAAiBC,EAAIC,CAAiB;CAEjE,OACE,kBAACC,GAAD;EACE,QAAQ;EACR,YAAY;GACV,iBAAiB,SAAS,eAAeC,CAAiB;GAC1D,OAAO,EAAE,UAAU,WAAW;EAChC;EACA,MAAMC;EACN,IAAI,EACF,sBAAsB;GACpB,YAAY;GACZ,QAAQ;GACR,WAAW;GACX,UAAU;GACV,OAAOA,IAAA,MAA8B;EACvC,EACF;EACA,SAAS;EAER;CACK,CAAA;AAEZ"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export type PageCommonHeaderProps = {
|
|
3
3
|
readonly centerComponent?: ReactNode;
|
|
4
|
-
readonly icon?: ReactNode;
|
|
5
4
|
readonly rightComponent?: ReactNode;
|
|
6
5
|
readonly title: string;
|
|
7
6
|
};
|
|
8
|
-
export declare const PageCommonHeader: ({ centerComponent,
|
|
7
|
+
export declare const PageCommonHeader: ({ centerComponent, rightComponent, title }: PageCommonHeaderProps) => import('react').JSX.Element;
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { PageCommonContext as e } from "../../../context/pageCommonContext/index.js";
|
|
2
|
-
import { AppBar as t, Box as n, IconButton as r, Toolbar as i, Typography as a } from "@mui/material";
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { use as
|
|
5
|
-
import
|
|
2
|
+
import { AppBar as t, Box as n, IconButton as r, Toolbar as i, Typography as a, useTheme as o } from "@mui/material";
|
|
3
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
import { use as u, useCallback as d } from "react";
|
|
5
|
+
import f from "@mui/icons-material/Menu";
|
|
6
6
|
//#region src/components/ui/PageCommonHeader/PageCommonHeader.tsx
|
|
7
|
-
var
|
|
8
|
-
let { isDrawerOpen:
|
|
9
|
-
|
|
10
|
-
}, [
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
color: "#FFFFFF",
|
|
17
|
-
height: 56,
|
|
18
|
-
justifyContent: "center",
|
|
19
|
-
zIndex: (e) => e.zIndex.drawer + 1
|
|
20
|
-
},
|
|
21
|
-
children: /* @__PURE__ */ c(i, {
|
|
7
|
+
var p = ({ centerComponent: p, rightComponent: m, title: h }) => {
|
|
8
|
+
let g = o(), { afterAppBarComponent: _, afterAppBarRightComponent: v, appBarHeight: y = 48, appBarIcon: b, beforeAppBarComponent: x, beforeAppBarRightComponent: S, isDrawerOpen: C, isNoInteraction: w, setIsDrawerOpen: T } = u(e), E = d(() => {
|
|
9
|
+
T(!C);
|
|
10
|
+
}, [C, T]);
|
|
11
|
+
return /* @__PURE__ */ l(n, { children: [
|
|
12
|
+
x,
|
|
13
|
+
/* @__PURE__ */ c(t, {
|
|
14
|
+
elevation: 1,
|
|
15
|
+
position: "static",
|
|
22
16
|
sx: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
backgroundColor: "primary.main",
|
|
18
|
+
color: "#FFFFFF",
|
|
19
|
+
height: y,
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
zIndex: g.zIndex.drawer + 1
|
|
26
22
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
children: /* @__PURE__ */ l(i, {
|
|
24
|
+
sx: {
|
|
25
|
+
display: "flex",
|
|
26
|
+
justifyContent: "space-between",
|
|
27
|
+
px: `${g.spacing(1)} !important`
|
|
28
|
+
},
|
|
29
|
+
variant: "dense",
|
|
30
|
+
children: [/* @__PURE__ */ l(n, {
|
|
30
31
|
sx: {
|
|
31
32
|
alignItems: "center",
|
|
32
33
|
display: "flex",
|
|
33
34
|
gap: 1.5
|
|
34
35
|
},
|
|
35
36
|
children: [
|
|
36
|
-
!
|
|
37
|
+
!w && /* @__PURE__ */ c(r, {
|
|
37
38
|
"aria-label": "open drawer",
|
|
38
39
|
color: "inherit",
|
|
39
40
|
edge: "start",
|
|
40
|
-
onClick:
|
|
41
|
+
onClick: E,
|
|
41
42
|
size: "small",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ c(f, {})
|
|
43
44
|
}),
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */
|
|
45
|
+
b && /* @__PURE__ */ c(s, { children: b }),
|
|
46
|
+
/* @__PURE__ */ c(a, {
|
|
46
47
|
component: "div",
|
|
47
48
|
noWrap: !0,
|
|
48
49
|
sx: {
|
|
@@ -53,46 +54,54 @@ var f = ({ centerComponent: f, icon: p, rightComponent: m, title: h }) => {
|
|
|
53
54
|
},
|
|
54
55
|
variant: "h6",
|
|
55
56
|
children: h
|
|
56
|
-
}),
|
|
57
|
-
/* @__PURE__ */ s(a, {
|
|
58
|
-
sx: {
|
|
59
|
-
backgroundColor: "rgba(255, 255, 255, 0.15)",
|
|
60
|
-
borderRadius: 1,
|
|
61
|
-
display: {
|
|
62
|
-
sm: "inline-block",
|
|
63
|
-
xs: "none"
|
|
64
|
-
},
|
|
65
|
-
fontSize: "0.7rem",
|
|
66
|
-
fontWeight: 600,
|
|
67
|
-
px: 1,
|
|
68
|
-
py: .25
|
|
69
|
-
},
|
|
70
|
-
variant: "caption",
|
|
71
|
-
children: "Loculus Tool"
|
|
72
57
|
})
|
|
73
58
|
]
|
|
74
|
-
}),
|
|
75
|
-
/* @__PURE__ */ s(n, {
|
|
59
|
+
}), !w && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(n, {
|
|
76
60
|
sx: {
|
|
77
61
|
alignItems: "center",
|
|
78
62
|
display: "flex",
|
|
79
63
|
gap: 1
|
|
80
64
|
},
|
|
81
|
-
children:
|
|
82
|
-
}),
|
|
83
|
-
!_ && /* @__PURE__ */ s(n, {
|
|
65
|
+
children: p
|
|
66
|
+
}), /* @__PURE__ */ l(n, {
|
|
84
67
|
sx: {
|
|
85
68
|
alignItems: "center",
|
|
86
69
|
display: "flex",
|
|
87
70
|
gap: 1
|
|
88
71
|
},
|
|
89
|
-
children:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
children: [
|
|
73
|
+
S && /* @__PURE__ */ c(n, {
|
|
74
|
+
sx: {
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
display: "flex",
|
|
77
|
+
gap: 1
|
|
78
|
+
},
|
|
79
|
+
children: S
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ c(n, {
|
|
82
|
+
sx: {
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
display: "flex",
|
|
85
|
+
gap: 1
|
|
86
|
+
},
|
|
87
|
+
children: m
|
|
88
|
+
}),
|
|
89
|
+
v && /* @__PURE__ */ c(n, {
|
|
90
|
+
sx: {
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
display: "flex",
|
|
93
|
+
gap: 1
|
|
94
|
+
},
|
|
95
|
+
children: v
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
})] })]
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
_
|
|
102
|
+
] });
|
|
94
103
|
};
|
|
95
104
|
//#endregion
|
|
96
|
-
export {
|
|
105
|
+
export { p as PageCommonHeader };
|
|
97
106
|
|
|
98
107
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","MenuIcon","PageCommonHeader","use","PageCommonContext","onToggleDrawerButtonClick","useCallback","isDrawerOpen","setIsDrawerOpen","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","MenuIcon","PageCommonHeader","theme","useTheme","use","PageCommonContext","onToggleDrawerButtonClick","useCallback","isDrawerOpen","setIsDrawerOpen","Box","beforeAppBarComponent","AppBar","appBarHeight","Toolbar","isNoInteraction","IconButton","appBarIcon","Fragment","Typography","title","centerComponent","beforeAppBarRightComponent","rightComponent","afterAppBarRightComponent","afterAppBarComponent"],"sources":["../../../../src/components/ui/PageCommonHeader/PageCommonHeader.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n use,\n useCallback,\n} from 'react';\nimport {\n AppBar,\n Box,\n IconButton,\n Toolbar,\n Typography,\n useTheme,\n} from '@mui/material';\nimport MenuIcon from '@mui/icons-material/Menu';\n\nimport { PageCommonContext } from '../../../context/pageCommonContext';\n\n\nexport type PageCommonHeaderProps = {\n readonly centerComponent?: ReactNode;\n readonly rightComponent?: ReactNode;\n readonly title: string;\n};\n\nexport const PageCommonHeader = ({ centerComponent, rightComponent, title }: PageCommonHeaderProps) => {\n const theme = useTheme();\n const { afterAppBarComponent, afterAppBarRightComponent, appBarHeight = 48, appBarIcon, beforeAppBarComponent, beforeAppBarRightComponent, isDrawerOpen, isNoInteraction, setIsDrawerOpen } = use(PageCommonContext);\n\n const onToggleDrawerButtonClick = useCallback(() => {\n setIsDrawerOpen(!isDrawerOpen);\n }, [isDrawerOpen, setIsDrawerOpen]);\n\n return (\n <Box>\n {beforeAppBarComponent}\n <AppBar\n elevation={1}\n position={'static'}\n sx={{\n backgroundColor: 'primary.main',\n color: '#FFFFFF',\n height: appBarHeight,\n justifyContent: 'center',\n zIndex: theme.zIndex.drawer + 1,\n }}\n >\n <Toolbar\n sx={{\n display: 'flex',\n justifyContent: 'space-between',\n px: `${theme.spacing(1)} !important`, // using !important to override media queries\n }}\n variant={'dense'}\n >\n {/* Left: Menu toggle and App Branding */}\n <Box sx={{ alignItems: 'center', display: 'flex', gap: 1.5 }}>\n {!isNoInteraction && (\n <IconButton\n aria-label={'open drawer'}\n color={'inherit'}\n edge={'start'}\n onClick={onToggleDrawerButtonClick}\n size={'small'}\n >\n <MenuIcon />\n </IconButton>\n )}\n {appBarIcon && (\n <>\n {appBarIcon}\n </>\n )}\n <Typography\n component={'div'}\n noWrap\n sx={{ color: 'inherit', fontSize: '1.05rem', fontWeight: 700, letterSpacing: '-0.01em' }}\n variant={'h6'}\n >\n {title}\n </Typography>\n </Box>\n {!isNoInteraction && (\n <>\n <Box sx={{ alignItems: 'center', display: 'flex', gap: 1 }}>\n {centerComponent}\n </Box>\n <Box sx={{ alignItems: 'center', display: 'flex', gap: 1 }}>\n {beforeAppBarRightComponent && (\n <Box sx={{ alignItems: 'center', display: 'flex', gap: 1 }}>\n {beforeAppBarRightComponent}\n </Box>\n )}\n <Box sx={{ alignItems: 'center', display: 'flex', gap: 1 }}>\n {rightComponent}\n </Box>\n {afterAppBarRightComponent && (\n <Box sx={{ alignItems: 'center', display: 'flex', gap: 1 }}>\n {afterAppBarRightComponent}\n </Box>\n )}\n </Box>\n </>\n )}\n </Toolbar>\n </AppBar>\n {afterAppBarComponent}\n </Box>\n );\n};\n"],"mappings":";;;;;;AAwBA,IAAaE,KAAoB,EAAE,oBAAiB,mBAAgB,eAAmC;CACrG,IAAMC,IAAQC,EAAS,GACjB,EAAE,yBAAsB,8BAA2B,kBAAe,IAAI,eAAY,0BAAuB,+BAA4B,iBAAc,oBAAiB,uBAAoBC,EAAIC,CAAiB,GAE7MC,IAA4BC,QAAkB;EAClD,EAAgB,CAACC,CAAY;CAC/B,GAAG,CAACA,GAAcC,CAAe,CAAC;CAElC,OACE,kBAACC,GAAD,EAAA,UAAA;EACGC;EACD,kBAACC,GAAD;GACE,WAAW;GACX,UAAU;GACV,IAAI;IACF,iBAAiB;IACjB,OAAO;IACP,QAAQC;IACR,gBAAgB;IAChB,QAAQX,EAAM,OAAO,SAAS;GAChC;GAEA,UAAA,kBAACY,GAAD;IACE,IAAI;KACF,SAAS;KACT,gBAAgB;KAChB,IAAI,GAAGZ,EAAM,QAAQ,CAAC,EAAE;IAC1B;IACA,SAAS;IANX,UAAA,CASE,kBAACQ,GAAD;KAAK,IAAI;MAAE,YAAY;MAAU,SAAS;MAAQ,KAAK;KAAI;KAA3D,UAAA;MACG,CAACK,KACA,kBAACC,GAAD;OACE,cAAY;OACZ,OAAO;OACP,MAAM;OACN,SAASV;OACT,MAAM;OAEN,UAAA,kBAACN,GAAD,CAAW,CAAA;MACD,CAAA;MAEbiB,KACC,kBAAAlB,GAAA,EAAA,UACGkB,EACD,CAAA;MAEJ,kBAACE,GAAD;OACE,WAAW;OACX,QAAA;OACA,IAAI;QAAE,OAAO;QAAW,UAAU;QAAW,YAAY;QAAK,eAAe;OAAU;OACvF,SAAS;OAER,UAAAC;MACS,CAAA;KACT;IACJ,CAAA,GAAA,CAACL,KACA,kBAAAhB,GAAA,EAAA,UAAA,CACE,kBAACW,GAAD;KAAK,IAAI;MAAE,YAAY;MAAU,SAAS;MAAQ,KAAK;KAAE;KACtD,UAAAW;IACE,CAAA,GACL,kBAACX,GAAD;KAAK,IAAI;MAAE,YAAY;MAAU,SAAS;MAAQ,KAAK;KAAE;KAAzD,UAAA;MACGY,KACC,kBAACZ,GAAD;OAAK,IAAI;QAAE,YAAY;QAAU,SAAS;QAAQ,KAAK;OAAE;OACtD,UAAAY;MACE,CAAA;MAEP,kBAACZ,GAAD;OAAK,IAAI;QAAE,YAAY;QAAU,SAAS;QAAQ,KAAK;OAAE;OACtD,UAAAa;MACE,CAAA;MACJC,KACC,kBAACd,GAAD;OAAK,IAAI;QAAE,YAAY;QAAU,SAAS;QAAQ,KAAK;OAAE;OACtD,UAAAc;MACE,CAAA;KAEJ;IACL,CAAA,CAAA,EAAA,CAAA,CAEG;;EACH,CAAA;EACPC;CACE,EAAA,CAAA;AAET"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PageCommonConfig = {
|
|
3
|
+
readonly afterAppBarComponent?: ReactNode;
|
|
4
|
+
readonly afterAppBarRightComponent?: ReactNode;
|
|
5
|
+
readonly appBarHeight?: number;
|
|
6
|
+
readonly appBarIcon?: ReactNode;
|
|
7
|
+
readonly beforeAppBarComponent?: ReactNode;
|
|
8
|
+
readonly beforeAppBarRightComponent?: ReactNode;
|
|
9
|
+
};
|
|
1
10
|
export type PageCommonContextData = {
|
|
11
|
+
readonly drawerContainerId: string;
|
|
2
12
|
readonly isDrawerOpen: boolean;
|
|
3
13
|
readonly isNoInteraction: boolean;
|
|
4
14
|
readonly setIsDrawerOpen: (open: boolean) => void;
|
|
5
15
|
readonly setIsNoInteraction: (open: boolean) => void;
|
|
6
|
-
};
|
|
16
|
+
} & PageCommonConfig;
|
|
7
17
|
export declare const PageCommonContext: import('react').Context<PageCommonContextData>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { PageCommonConfig } from './PageCommonContext';
|
|
3
|
+
export type PageCommonContextProviderProps = PropsWithChildren<PageCommonConfig>;
|
|
4
|
+
export declare const PageCommonContextProvider: ({ children, ...props }: PageCommonContextProviderProps) => import('react').JSX.Element;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as t,
|
|
2
|
+
import { createContext as t, useId as n, useMemo as r, useState as i } from "react";
|
|
3
3
|
//#region src/context/pageCommonContext/PageCommonContext.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
var a = t({}), o = ({ children: t, ...o }) => {
|
|
5
|
+
let [s, c] = i(!1), [l, u] = i(!1), d = n(), f = r(() => ({
|
|
6
|
+
...o,
|
|
7
|
+
drawerContainerId: d,
|
|
8
|
+
isDrawerOpen: s,
|
|
9
|
+
isNoInteraction: l,
|
|
10
|
+
setIsDrawerOpen: c,
|
|
11
|
+
setIsNoInteraction: u
|
|
12
|
+
}), [
|
|
13
|
+
s,
|
|
14
|
+
l,
|
|
15
|
+
d,
|
|
16
|
+
o
|
|
17
|
+
]);
|
|
18
|
+
return /* @__PURE__ */ e(a, {
|
|
19
|
+
value: f,
|
|
18
20
|
children: t
|
|
19
21
|
});
|
|
20
22
|
};
|
|
21
23
|
//#endregion
|
|
22
|
-
export {
|
|
24
|
+
export { a as PageCommonContext, o as PageCommonContextProvider };
|
|
23
25
|
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["PageCommonContext","createContext","PageCommonContextProvider","isDrawerOpen","setIsDrawerOpen","useState","isNoInteraction","setIsNoInteraction","contextValue","useMemo"],"sources":["../../../src/context/pageCommonContext/PageCommonContext.ts","../../../src/context/pageCommonContext/PageCommonContextProvider.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport type PageCommonContextData = {\n readonly isDrawerOpen: boolean;\n readonly isNoInteraction: boolean;\n readonly setIsDrawerOpen: (open: boolean) => void;\n readonly setIsNoInteraction: (open: boolean) => void;\n};\n\nexport const PageCommonContext = createContext<PageCommonContextData>({
|
|
1
|
+
{"version":3,"file":"index.js","names":["PageCommonContext","createContext","PageCommonContextProvider","props","isDrawerOpen","setIsDrawerOpen","useState","isNoInteraction","setIsNoInteraction","drawerContainerId","useId","contextValue","useMemo"],"sources":["../../../src/context/pageCommonContext/PageCommonContext.ts","../../../src/context/pageCommonContext/PageCommonContextProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { createContext } from 'react';\n\nexport type PageCommonConfig = {\n readonly afterAppBarComponent?: ReactNode;\n readonly afterAppBarRightComponent?: ReactNode;\n readonly appBarHeight?: number;\n readonly appBarIcon?: ReactNode;\n readonly beforeAppBarComponent?: ReactNode;\n readonly beforeAppBarRightComponent?: ReactNode;\n};\n\nexport type PageCommonContextData = {\n readonly drawerContainerId: string;\n readonly isDrawerOpen: boolean;\n readonly isNoInteraction: boolean;\n readonly setIsDrawerOpen: (open: boolean) => void;\n readonly setIsNoInteraction: (open: boolean) => void;\n} & PageCommonConfig;\n\nexport const PageCommonContext = createContext<PageCommonContextData>({} as PageCommonContextData);\n","import {\n useId,\n useMemo,\n useState,\n} from 'react';\nimport type { PropsWithChildren } from 'react';\n\nimport type {\n PageCommonConfig,\n PageCommonContextData,\n} from './PageCommonContext';\nimport { PageCommonContext } from './PageCommonContext';\n\nexport type PageCommonContextProviderProps = PropsWithChildren<PageCommonConfig>;\n\nexport const PageCommonContextProvider = ({ children, ...props }: PageCommonContextProviderProps) => {\n const [isDrawerOpen, setIsDrawerOpen] = useState(false);\n const [isNoInteraction, setIsNoInteraction] = useState(false);\n const drawerContainerId = useId();\n\n const contextValue = useMemo<PageCommonContextData>(() => {\n return {\n ...props,\n drawerContainerId,\n isDrawerOpen,\n isNoInteraction,\n setIsDrawerOpen,\n setIsNoInteraction,\n };\n }, [isDrawerOpen, isNoInteraction, drawerContainerId, props]);\n\n return (\n <PageCommonContext value={contextValue}>\n { children }\n </PageCommonContext>\n );\n};\n"],"mappings":";;;AAoBA,IAAaA,IAAoBC,EAAqC,CAAC,CAA0B,GCLpFC,KAA6B,EAAE,aAAU,GAAGC,QAA4C;CACnG,IAAM,CAACC,GAAcC,KAAmBC,EAAS,EAAK,GAChD,CAACC,GAAiBC,KAAsBF,EAAS,EAAK,GACtDG,IAAoBC,EAAM,GAE1BC,IAAeC,SACZ;EACL,GAAGT;EACH;EACA;EACA;EACA;EACA;CACF,IACC;EAACC;EAAcG;EAAiBE;EAAmBN;CAAK,CAAC;CAE5D,OACE,kBAACH,GAAD;EAAmB,OAAOW;EACtB;CACe,CAAA;AAEvB"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { CircularProgressProps, Theme } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
readonly fullHeight?: boolean;
|
|
5
|
-
readonly fullWidth?: boolean;
|
|
6
|
-
readonly singleAction?: boolean;
|
|
7
|
-
};
|
|
3
|
+
import { PageCommonConfig } from '../context/pageCommonContext';
|
|
8
4
|
export interface ConfigBase {
|
|
9
5
|
applicationName: string;
|
|
10
6
|
readonly drawerComponent?: () => ReactElement;
|
|
11
|
-
getTouchIconUrl
|
|
7
|
+
getTouchIconUrl?: () => string | undefined;
|
|
12
8
|
readonly headerComponent?: () => ReactElement;
|
|
13
9
|
nonce?: string;
|
|
10
|
+
pageConfig?: PageCommonConfig;
|
|
14
11
|
spinner: {
|
|
15
12
|
DEFAULT_CIRCULAR_PROGRESS_SIZE: CircularProgressProps['size'];
|
|
16
13
|
DEFAULT_TAKING_LONGER_TIMEOUT_MS: number;
|