@balena/ui-shared-components 5.1.0 → 5.2.0-build-spinner-1983f8cedfb5b10c4e6e61effe5e97db93ff8d8a-1

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,15 @@
1
+ import { BoxProps } from '@mui/material';
2
+ export interface SpinnerProps extends Pick<BoxProps, 'sx' | 'children'> {
3
+ show?: boolean;
4
+ label?: string;
5
+ zIndex?: number;
6
+ bgVariant?: 'light' | 'dark';
7
+ size?: keyof typeof SIZE_MAPPING;
8
+ }
9
+ declare const SIZE_MAPPING: {
10
+ small: string;
11
+ medium: string;
12
+ large: string;
13
+ };
14
+ export declare const Spinner: ({ show, children, label, sx, zIndex, bgVariant, size, }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, CircularProgress, Typography, Backdrop, } from '@mui/material';
3
+ import { color } from '@balena/design-tokens';
4
+ // TODO use design tokens when available
5
+ const SIZE_MAPPING = {
6
+ small: '14px',
7
+ medium: '20px',
8
+ large: '24px',
9
+ };
10
+ export const Spinner = ({ show = true, children, label, sx, zIndex, bgVariant = 'light', size = 'medium', }) => {
11
+ const SpinnerContent = (_jsxs(_Fragment, { children: [_jsx(CircularProgress, { size: SIZE_MAPPING[size] }), label != null && (_jsx(Typography, Object.assign({ color: bgVariant === 'dark' ? color.text.inverse.value : 'default' }, { children: label })))] }));
12
+ return children ? (_jsxs(Box, Object.assign({ position: "relative", height: "100%" }, { children: [children, _jsx(Backdrop, Object.assign({ sx: [
13
+ {
14
+ gap: 1,
15
+ position: 'absolute',
16
+ backgroundColor: bgVariant === 'light' ? color.bg.overlay.light.value : null,
17
+ },
18
+ ...(Array.isArray(sx) ? sx : [sx]),
19
+ ], open: show }, { children: SpinnerContent }))] }))) : (_jsx(Box, Object.assign({ sx: [
20
+ Object.assign({ display: show ? 'flex' : 'none', alignItems: 'center', justifyContent: 'center', gap: 1, height: '100%', width: '100%' }, (zIndex != null && { zIndex })),
21
+ ...(Array.isArray(sx) ? sx : [sx]),
22
+ ], onClick: (e) => {
23
+ e.preventDefault();
24
+ e.stopPropagation();
25
+ } }, { children: SpinnerContent })));
26
+ };
package/dist/index.d.ts CHANGED
@@ -34,6 +34,8 @@ export { OrderedListItem } from './components/OrderedListItem';
34
34
  export type { RouterLinkWithTrackingProps } from './components/RouterLinkWithTracking';
35
35
  export { RouterLinkWithTracking } from './components/RouterLinkWithTracking';
36
36
  export { SnackbarProviderBase as SnackbarProvider } from './components/SnackbarProvider';
37
+ export type { SpinnerProps } from './components/Spinner';
38
+ export { Spinner } from './components/Spinner';
37
39
  export { SurroundingOverlay } from './components/SurroundingOverlay';
38
40
  export type { SurroundingOverlayProps } from './components/SurroundingOverlay';
39
41
  export type { TooltipProps } from './components/Tooltip';
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export { MUILinkWithTracking } from './components/MUILinkWithTracking';
15
15
  export { OrderedListItem } from './components/OrderedListItem';
16
16
  export { RouterLinkWithTracking } from './components/RouterLinkWithTracking';
17
17
  export { SnackbarProviderBase as SnackbarProvider } from './components/SnackbarProvider';
18
+ export { Spinner } from './components/Spinner';
18
19
  export { SurroundingOverlay } from './components/SurroundingOverlay';
19
20
  export { Tooltip } from './components/Tooltip';
20
21
  export { Tabs } from './components/Tabs';
package/dist/theme.js CHANGED
@@ -642,12 +642,12 @@ export const theme = createTheme({
642
642
  },
643
643
  },
644
644
  MuiLink: {
645
+ defaultProps: { underline: 'none' },
645
646
  styleOverrides: {
646
647
  root: {
647
- color: '#00AEEF',
648
- textDecoration: 'none',
648
+ color: color.text.accent.value,
649
649
  '&:hover': {
650
- color: '#008bbf',
650
+ color: color.palette.blue[800].value,
651
651
  },
652
652
  },
653
653
  },
@@ -790,5 +790,13 @@ export const theme = createTheme({
790
790
  },
791
791
  },
792
792
  },
793
+ MuiBackdrop: {
794
+ styleOverrides: {
795
+ root: {
796
+ background: color.bg.overlay.dark.value,
797
+ },
798
+ invisible: { background: 'unset' },
799
+ },
800
+ },
793
801
  },
794
802
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "5.1.0",
3
+ "version": "5.2.0-build-spinner-1983f8cedfb5b10c4e6e61effe5e97db93ff8d8a-1",
4
4
  "main": "./dist/index.js",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -9,7 +9,7 @@
9
9
  "README.md"
10
10
  ],
11
11
  "dependencies": {
12
- "@balena/design-tokens": "^0.4.1",
12
+ "@balena/design-tokens": "0.4.1-build-overlay-colors-0c9aa36223db9deb5784fc2aa0ec6409d337fa78-1",
13
13
  "@emotion/react": "^11.10.6",
14
14
  "@emotion/styled": "^11.10.6",
15
15
  "@fortawesome/free-solid-svg-icons": "^6.5.1",
@@ -110,6 +110,6 @@
110
110
  },
111
111
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
112
112
  "versionist": {
113
- "publishedAt": "2024-04-11T12:52:02.651Z"
113
+ "publishedAt": "2024-04-12T14:34:25.137Z"
114
114
  }
115
115
  }