@visin/frontend-core 0.1.2 → 0.1.3

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.
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Props for the ErrorPage component
4
+ */
5
+ export interface ErrorPageProps {
6
+ /** The main error title to display */
7
+ title?: string;
8
+ /** The error message content (can be text or React elements) */
9
+ message?: string | ReactNode;
10
+ /** Custom icon to display (defaults to error icon) */
11
+ icon?: ReactNode;
12
+ /** Whether to show the retry button */
13
+ showRetry?: boolean;
14
+ /** Callback function when retry button is clicked */
15
+ onRetry?: () => void;
16
+ }
17
+ export declare function ErrorPage({ title, message, icon, showRetry, onRetry }: ErrorPageProps): import("react").JSX.Element;
18
+ //# sourceMappingURL=ErrorPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorPage.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorPage/ErrorPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,sDAAsD;IACtD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,EACxB,KAA6B,EAC7B,OAMC,EACD,IAAsE,EACtE,SAAgB,EAChB,OAAwC,EACzC,EAAE,cAAc,+BA0BhB"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Typography, Button } from '@mui/material';
3
+ import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
4
+ export function ErrorPage({ title = 'Configuration Error', message = (_jsxs(_Fragment, { children: ["Failed to load application configuration.", _jsx("br", {}), "Please check your network connection and try again."] })), icon = _jsx(ErrorOutlineIcon, { sx: { fontSize: 80, color: 'error.main' } }), showRetry = true, onRetry = () => window.location.reload() }) {
5
+ return (_jsxs(Box, { sx: {
6
+ display: 'flex',
7
+ flexDirection: 'column',
8
+ alignItems: 'center',
9
+ justifyContent: 'center',
10
+ height: '100vh',
11
+ gap: 2
12
+ }, children: [icon, _jsx(Typography, { variant: "h4", color: "error", fontWeight: 600, gutterBottom: true, children: title }), _jsx(Typography, { variant: "body1", color: "text.secondary", textAlign: "center", mb: showRetry ? 2 : 0, children: message }), showRetry && (_jsx(Button, { variant: "contained", color: "primary", onClick: onRetry, children: "Retry" }))] }));
13
+ }
14
+ //# sourceMappingURL=ErrorPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorPage.js","sourceRoot":"","sources":["../../../src/components/ErrorPage/ErrorPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAkBhE,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,GAAG,qBAAqB,EAC7B,OAAO,GAAG,CACR,2EAEE,cAAM,2DAEL,CACJ,EACD,IAAI,GAAG,KAAC,gBAAgB,IAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,GAAI,EACtE,SAAS,GAAG,IAAI,EAChB,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,EACzB;IACf,OAAO,CACL,MAAC,GAAG,IACF,EAAE,EAAE;YACF,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,MAAM,EAAE,OAAO;YACf,GAAG,EAAE,CAAC;SACP,aAEA,IAAI,EACL,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,YAAY,kBACjE,KAAK,GACK,EACb,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,gBAAgB,EAAC,SAAS,EAAC,QAAQ,EAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YACxF,OAAO,GACG,EACZ,SAAS,IAAI,CACZ,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,sBAEnD,CACV,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ErrorPage } from './ErrorPage';
2
+ export type { ErrorPageProps } from './ErrorPage';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorPage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ErrorPage } from './ErrorPage';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ErrorPage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Props for the Loader component
3
+ */
4
+ export interface LoaderProps {
5
+ /** The loading message to display below the spinner */
6
+ message?: string;
7
+ /** Size of the loading spinner in pixels */
8
+ size?: number;
9
+ /** Whether to take full viewport height or auto height */
10
+ fullHeight?: boolean;
11
+ }
12
+ export declare function Loader({ message, size, fullHeight }: LoaderProps): import("react").JSX.Element;
13
+ //# sourceMappingURL=Loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loader.d.ts","sourceRoot":"","sources":["../../../src/components/Loader/Loader.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,EAAE,OAAsB,EAAE,IAAS,EAAE,UAAiB,EAAE,EAAE,WAAW,+BAmB3F"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, CircularProgress, Typography } from '@mui/material';
3
+ export function Loader({ message = 'Loading...', size = 48, fullHeight = true }) {
4
+ return (_jsxs(Box, { sx: {
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ alignItems: 'center',
8
+ justifyContent: 'center',
9
+ height: fullHeight ? '100vh' : 'auto',
10
+ gap: 2,
11
+ py: fullHeight ? 0 : 8
12
+ }, children: [_jsx(CircularProgress, { size: size }), _jsx(Typography, { variant: "body1", color: "text.secondary", children: message })] }));
13
+ }
14
+ //# sourceMappingURL=Loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../../src/components/Loader/Loader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAclE,MAAM,UAAU,MAAM,CAAC,EAAE,OAAO,GAAG,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,UAAU,GAAG,IAAI,EAAe;IAC1F,OAAO,CACL,MAAC,GAAG,IACF,EAAE,EAAE;YACF,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;YACrC,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvB,aAED,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,GAAI,EAChC,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,gBAAgB,YAC/C,OAAO,GACG,IACT,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Loader } from './Loader';
2
+ export type { LoaderProps } from './Loader';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Loader/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Loader } from './Loader';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Loader/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  export { createApiClient, ApiError } from './apiClient';
2
2
  export type { ApiClientOptions, ApiRequestOptions, ApiClient } from './apiClient';
3
+ export { Loader } from './components/Loader';
4
+ export type { LoaderProps } from './components/Loader';
5
+ export { ErrorPage } from './components/ErrorPage';
6
+ export type { ErrorPageProps } from './components/ErrorPage';
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  // @visin/frontend-core - Shared frontend auth/API-client logic for Visin frontends
2
2
  export { createApiClient, ApiError } from './apiClient';
3
+ export { Loader } from './components/Loader';
4
+ export { ErrorPage } from './components/ErrorPage';
3
5
  // Not yet extracted: account-front's `authService.ts`, auth-front's
4
6
  // `authFlow.ts`, and vision-front's `AuthContext.tsx` implement auth
5
7
  // (token storage, login/logout, session checks) three different ways
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGxD,oEAAoE;AACpE,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,kEAAkE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,oEAAoE;AACpE,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,kEAAkE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visin/frontend-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Shared frontend auth/API-client logic for Visin frontends",
5
5
  "author": "Toomas Tahves",
6
6
  "license": "MIT",
@@ -33,12 +33,24 @@
33
33
  "auth",
34
34
  "api-client"
35
35
  ],
36
+ "peerDependencies": {
37
+ "@mui/icons-material": "^7.3.11",
38
+ "@mui/material": "^7.3.11",
39
+ "react": "^19.2.7"
40
+ },
36
41
  "devDependencies": {
37
42
  "@eslint/js": "^10.0.1",
43
+ "@mui/icons-material": "^7.3.11",
44
+ "@mui/material": "^7.3.11",
45
+ "@testing-library/jest-dom": "^6.6.3",
46
+ "@testing-library/react": "^16.3.0",
38
47
  "@types/node": "^26.0.1",
48
+ "@types/react": "^19.2.17",
39
49
  "@vitest/coverage-v8": "^3.2.4",
40
50
  "eslint": "^10.6.0",
41
51
  "jsdom": "^26.1.0",
52
+ "react": "^19.2.7",
53
+ "react-dom": "^19.2.7",
42
54
  "standard-version": "^9.5.0",
43
55
  "typescript": "^6.0.3",
44
56
  "typescript-eslint": "^8.62.1",