@gen-epix/ui-core-components 4.4.1 → 4.5.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/Spinner/index.js +1 -1
- package/dist/components/Spinner/index.js.map +1 -1
- package/dist/context/CoreComponentsConfigContext/CoreComponentsConfigContext.d.ts +7 -0
- package/dist/context/CoreComponentsConfigContext/CoreComponentsConfigContextProvider.d.ts +6 -0
- package/dist/context/CoreComponentsConfigContext/index.d.ts +3 -0
- package/dist/context/{uiCoreComponentsConfigContext → CoreComponentsConfigContext}/index.js +2 -2
- package/dist/context/CoreComponentsConfigContext/index.js.map +1 -0
- package/dist/context/CoreComponentsConfigContext/useCoreComponentsConfigContext.d.ts +2 -0
- package/package.json +4 -4
- package/dist/context/uiCoreComponentsConfigContext/UiCoreComponentsConfigContextProvider.d.ts +0 -6
- package/dist/context/uiCoreComponentsConfigContext/index.d.ts +0 -3
- package/dist/context/uiCoreComponentsConfigContext/index.js.map +0 -1
- package/dist/context/uiCoreComponentsConfigContext/uiCoreComponentsConfigContext.d.ts +0 -7
- package/dist/context/uiCoreComponentsConfigContext/useUiCoreComponentsConfigContext.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCoreComponentsConfigContext as e } from "../../context/CoreComponentsConfigContext/index.js";
|
|
2
2
|
import { useEffect as t, useState as n } from "react";
|
|
3
3
|
import { Box as r, CircularProgress as i, Typography as a } from "@mui/material";
|
|
4
4
|
import { useTranslation as o } from "react-i18next";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DEFAULT_TAKING_LONGER_TIMEOUT_MS","DEFAULT_CIRCULAR_PROGRESS_SIZE","Spinner","isTakingLonger","setIsTakingLonger","useState","useTranslation","
|
|
1
|
+
{"version":3,"file":"index.js","names":["DEFAULT_TAKING_LONGER_TIMEOUT_MS","DEFAULT_CIRCULAR_PROGRESS_SIZE","Spinner","isTakingLonger","setIsTakingLonger","useState","useTranslation","coreComponentsConfig","useCoreComponentsConfigContext","useEffect","handle","takingLongerTimeoutMs","Box","inline","CircularProgress","size","label","visuallyHidden","textColor","Typography","takingLongerLabel"],"sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import type { CircularProgressProps } from '@mui/material';\nimport {\n Box,\n CircularProgress,\n Typography,\n} from '@mui/material';\nimport type { ReactElement } from 'react';\nimport {\n useEffect,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { visuallyHidden } from '@mui/utils';\n\nimport { useCoreComponentsConfigContext } from '../../context/CoreComponentsConfigContext';\n\n\nconst DEFAULT_TAKING_LONGER_TIMEOUT_MS = 5000;\nconst DEFAULT_CIRCULAR_PROGRESS_SIZE = 40;\n\nexport type SpinnerProps = {\n readonly color?: 'inherit' | 'primary' | 'secondary';\n readonly inline?: boolean;\n readonly label?: string;\n readonly size?: CircularProgressProps['size'];\n readonly takingLongerLabel?: string;\n readonly takingLongerTimeoutMs?: number;\n readonly textColor?: string;\n};\n\nexport const Spinner = ({ color = 'primary', inline, label, size, takingLongerLabel, takingLongerTimeoutMs, textColor }: SpinnerProps): ReactElement => {\n const [isTakingLonger, setIsTakingLonger] = useState(false);\n const { t } = useTranslation();\n\n const coreComponentsConfig = useCoreComponentsConfigContext();\n\n useEffect(() => {\n const handle = setTimeout(() => {\n setIsTakingLonger(true);\n }, takingLongerTimeoutMs ?? coreComponentsConfig?.spinner?.defaultTakingLongerTimeoutMs ?? DEFAULT_TAKING_LONGER_TIMEOUT_MS);\n return () => {\n clearTimeout(handle);\n };\n }, [takingLongerTimeoutMs, coreComponentsConfig?.spinner?.defaultTakingLongerTimeoutMs]);\n\n return (\n <Box\n aria-busy={'true'}\n role={'status'}\n sx={{\n alignItems: 'center',\n bottom: inline ? 'auto' : 0,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n left: inline ? 'auto' : 0,\n position: inline ? 'relative' : 'absolute',\n right: inline ? 'auto' : 0,\n top: inline ? 'auto' : 0,\n width: inline ? '100%' : 'auto',\n }}\n >\n <Box\n sx={{\n margin: 1,\n }}\n >\n <CircularProgress\n color={color}\n size={size ?? coreComponentsConfig?.spinner?.defaultCircularProgressSize ?? DEFAULT_CIRCULAR_PROGRESS_SIZE}\n />\n </Box>\n <Box\n sx={{\n ...(!label ? visuallyHidden : undefined),\n color: textColor ?? 'inherit',\n margin: 1,\n }}\n >\n <Typography\n aria-live={'polite'}\n >\n {label ?? t`Loading`}\n </Typography>\n </Box>\n {isTakingLonger && (\n <Box\n sx={{\n color: textColor ?? 'inherit',\n margin: 1,\n }}\n >\n <Typography\n aria-live={'polite'}\n >\n {takingLongerLabel || t`This is taking longer than expected. We are still trying.`}\n </Typography>\n </Box>\n )}\n </Box>\n );\n};\n"],"mappings":";;;;;;;AAiBA,IAAMA,IAAmC,KACnCC,IAAiC,IAY1BC,KAAW,EAAE,WAAQ,WAAW,WAAQ,UAAO,SAAM,sBAAmB,0BAAuB,mBAA4C;CACtJ,IAAM,CAACC,GAAgBC,KAAqBC,EAAS,EAAK,GACpD,EAAE,SAAMC,EAAe,GAEvBC,IAAuBC,EAA+B;CAW5D,OATAC,QAAgB;EACd,IAAMC,IAAS,iBAAiB;GAC9B,EAAkB,EAAI;EACxB,GAAGC,KAAyBJ,GAAsB,SAAS,gCAAgCP,CAAgC;EAC3H,aAAa;GACX,aAAaU,CAAM;EACrB;CACF,GAAG,CAACC,GAAuBJ,GAAsB,SAAS,4BAA4B,CAAC,GAGrF,kBAACK,GAAD;EACE,aAAW;EACX,MAAM;EACN,IAAI;GACF,YAAY;GACZ,QAAQC,IAAS,SAAS;GAC1B,SAAS;GACT,eAAe;GACf,gBAAgB;GAChB,MAAMA,IAAS,SAAS;GACxB,UAAUA,IAAS,aAAa;GAChC,OAAOA,IAAS,SAAS;GACzB,KAAKA,IAAS,SAAS;GACvB,OAAOA,IAAS,SAAS;EAC3B;EAdF,UAAA;GAgBE,kBAACD,GAAD;IACE,IAAI,EACF,QAAQ,EACV;IAEA,UAAA,kBAACE,GAAD;KACS;KACP,MAAMC,KAAQR,GAAsB,SAAS,+BAA+BN;IAC7E,CAAA;GACE,CAAA;GACL,kBAACW,GAAD;IACE,IAAI;KACF,GAAKI,IAAyB,KAAA,IAAjBC;KACb,OAAOC,KAAa;KACpB,QAAQ;IACV;IAEA,UAAA,kBAACC,GAAD;KACE,aAAW;KAEV,UAAAH,KAAS,CAAC;IACD,CAAA;GACT,CAAA;GACJb,KACC,kBAACS,GAAD;IACE,IAAI;KACF,OAAOM,KAAa;KACpB,QAAQ;IACV;IAEA,UAAA,kBAACC,GAAD;KACE,aAAW;KAEV,UAAAC,KAAqB,CAAC;IACb,CAAA;GACT,CAAA;EAEJ;;AAET"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { CoreComponentsConfig } from './CoreComponentsConfigContext';
|
|
3
|
+
export type CoreComponentsContextProviderProps = PropsWithChildren<{
|
|
4
|
+
readonly config: CoreComponentsConfig;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const CoreComponentsContextProvider: (props: CoreComponentsContextProviderProps) => import('react').JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext as e, use as t } from "react";
|
|
2
2
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
//#region src/context/
|
|
3
|
+
//#region src/context/CoreComponentsConfigContext/CoreComponentsConfigContext.tsx
|
|
4
4
|
var r = e(null), i = (e) => {
|
|
5
5
|
let { children: t, config: i } = e;
|
|
6
6
|
return /* @__PURE__ */ n(r, {
|
|
@@ -9,6 +9,6 @@ var r = e(null), i = (e) => {
|
|
|
9
9
|
});
|
|
10
10
|
}, a = () => t(r);
|
|
11
11
|
//#endregion
|
|
12
|
-
export { r as
|
|
12
|
+
export { r as CoreComponentsConfigContext, i as CoreComponentsContextProvider, a as useCoreComponentsConfigContext };
|
|
13
13
|
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["CoreComponentsConfigContext","createContext","CoreComponentsContextProvider","props","config","useCoreComponentsConfigContext","use"],"sources":["../../../src/context/CoreComponentsConfigContext/CoreComponentsConfigContext.tsx","../../../src/context/CoreComponentsConfigContext/CoreComponentsConfigContextProvider.tsx","../../../src/context/CoreComponentsConfigContext/useCoreComponentsConfigContext.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport type CoreComponentsConfig = {\n spinner: {\n defaultCircularProgressSize: number | string;\n defaultTakingLongerTimeoutMs: number;\n };\n};\n\nexport const CoreComponentsConfigContext = createContext<CoreComponentsConfig>(null);\n","import type { PropsWithChildren } from 'react';\n\nimport type { CoreComponentsConfig } from './CoreComponentsConfigContext';\nimport { CoreComponentsConfigContext } from './CoreComponentsConfigContext';\n\n\nexport type CoreComponentsContextProviderProps = PropsWithChildren<{\n readonly config: CoreComponentsConfig;\n}>;\n\nexport const CoreComponentsContextProvider = (\n props: CoreComponentsContextProviderProps,\n) => {\n const { children, config } = props;\n return (\n <CoreComponentsConfigContext value={config}>\n {children}\n </CoreComponentsConfigContext>\n );\n};\n","import { use } from 'react';\n\nimport type { CoreComponentsConfig } from './CoreComponentsConfigContext';\nimport { CoreComponentsConfigContext } from './CoreComponentsConfigContext';\n\nexport const useCoreComponentsConfigContext = (): CoreComponentsConfig => use(CoreComponentsConfigContext);\n"],"mappings":";;;AASA,IAAaA,IAA8BC,EAAoC,IAAI,GCCtEC,KACX,MACG;CACH,IAAM,EAAE,aAAU,cAAWC;CAC7B,OACE,kBAACH,GAAD;EAA6B,OAAOI;EACjC;CAC0B,CAAA;AAEjC,GCdaC,UAA6DC,EAAIN,CAA2B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gen-epix/ui-core-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"homepage": "https://github.com/RIVM-bioinformatics/gen-epix",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"types": "./dist/components/Stepper/index.d.ts",
|
|
55
55
|
"import": "./dist/components/Stepper/index.js"
|
|
56
56
|
},
|
|
57
|
-
"./context/
|
|
58
|
-
"types": "./dist/context/
|
|
59
|
-
"import": "./dist/context/
|
|
57
|
+
"./context/CoreComponentsConfigContext": {
|
|
58
|
+
"types": "./dist/context/CoreComponentsConfigContext/index.d.ts",
|
|
59
|
+
"import": "./dist/context/CoreComponentsConfigContext/index.js"
|
|
60
60
|
},
|
|
61
61
|
"./hoc/withDialog": {
|
|
62
62
|
"types": "./dist/hoc/withDialog/index.d.ts",
|
package/dist/context/uiCoreComponentsConfigContext/UiCoreComponentsConfigContextProvider.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { UiCoreComponentsConfig } from './uiCoreComponentsConfigContext';
|
|
3
|
-
export type UiCoreComponentsContextProviderProps = PropsWithChildren<{
|
|
4
|
-
readonly config: UiCoreComponentsConfig;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const UiCoreComponentsContextProvider: (props: UiCoreComponentsContextProviderProps) => import('react').JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["UiCoreComponentsConfigContext","createContext","UiCoreComponentsContextProvider","props","config","useUiCoreComponentsConfigContext","use"],"sources":["../../../src/context/uiCoreComponentsConfigContext/uiCoreComponentsConfigContext.tsx","../../../src/context/uiCoreComponentsConfigContext/UiCoreComponentsConfigContextProvider.tsx","../../../src/context/uiCoreComponentsConfigContext/useUiCoreComponentsConfigContext.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport type UiCoreComponentsConfig = {\n spinner: {\n defaultCircularProgressSize: number | string;\n defaultTakingLongerTimeoutMs: number;\n };\n};\n\nexport const UiCoreComponentsConfigContext = createContext<UiCoreComponentsConfig>(null);\n","import type { PropsWithChildren } from 'react';\n\nimport type { UiCoreComponentsConfig } from './uiCoreComponentsConfigContext';\nimport { UiCoreComponentsConfigContext } from './uiCoreComponentsConfigContext';\n\n\nexport type UiCoreComponentsContextProviderProps = PropsWithChildren<{\n readonly config: UiCoreComponentsConfig;\n}>;\n\nexport const UiCoreComponentsContextProvider = (\n props: UiCoreComponentsContextProviderProps,\n) => {\n const { children, config } = props;\n return (\n <UiCoreComponentsConfigContext value={config}>\n {children}\n </UiCoreComponentsConfigContext>\n );\n};\n","import { use } from 'react';\n\nimport type { UiCoreComponentsConfig } from './uiCoreComponentsConfigContext';\nimport { UiCoreComponentsConfigContext } from './uiCoreComponentsConfigContext';\n\nexport const useUiCoreComponentsConfigContext = (): UiCoreComponentsConfig => use(UiCoreComponentsConfigContext);\n"],"mappings":";;;AASA,IAAaA,IAAgCC,EAAsC,IAAI,GCC1EC,KACX,MACG;CACH,IAAM,EAAE,aAAU,cAAWC;CAC7B,OACE,kBAACH,GAAD;EAA+B,OAAOI;EACnC;CAC4B,CAAA;AAEnC,GCdaC,UAAiEC,EAAIN,CAA6B"}
|