@etsoo/materialui 1.2.10 → 1.2.11

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,8 @@
1
+ /// <reference types="react" />
2
+ import { CircularProgressProps, TypographyProps } from "@mui/material";
3
+ export type PercentCircularProgressProps = CircularProgressProps & {
4
+ value: number;
5
+ valueUnit?: string;
6
+ textProps?: TypographyProps<"div">;
7
+ };
8
+ export declare function PercentCircularProgress(props: PercentCircularProgressProps): JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { Box, CircularProgress, Typography } from "@mui/material";
2
+ import React from "react";
3
+ export function PercentCircularProgress(props) {
4
+ // Destruct
5
+ const { textProps, valueUnit = "%", ...rest } = props;
6
+ // Component
7
+ return (React.createElement(Box, { sx: { position: "relative", display: "inline-flex" } },
8
+ React.createElement(CircularProgress, { variant: "determinate", ...rest }),
9
+ React.createElement(Box, { sx: {
10
+ top: 0,
11
+ left: 0,
12
+ bottom: 0,
13
+ right: 0,
14
+ position: "absolute",
15
+ display: "flex",
16
+ alignItems: "center",
17
+ justifyContent: "center"
18
+ } },
19
+ React.createElement(Typography, { variant: "caption", component: "div", color: "text.secondary", ...textProps }, `${Math.round(props.value)}${valueUnit}`))));
20
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { LinearProgressProps, TypographyProps } from "@mui/material";
3
+ export type PercentLinearProgressProps = LinearProgressProps & {
4
+ value: number;
5
+ valueUnit?: string;
6
+ textProps?: TypographyProps;
7
+ };
8
+ export declare function PercentLinearProgress(props: PercentLinearProgressProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { Box, LinearProgress, Typography } from "@mui/material";
2
+ import React from "react";
3
+ export function PercentLinearProgress(props) {
4
+ // Destruct
5
+ const { textProps, valueUnit = "%", ...rest } = props;
6
+ // Component
7
+ return (React.createElement(Box, { sx: { display: "flex", alignItems: "center" } },
8
+ React.createElement(Box, { sx: { width: "100%", mr: 1 } },
9
+ React.createElement(LinearProgress, { variant: "determinate", ...rest })),
10
+ React.createElement(Box, { sx: { minWidth: 35 } },
11
+ React.createElement(Typography, { variant: "caption", color: "text.secondary", ...textProps }, `${Math.round(props.value)}${valueUnit}`))));
12
+ }
package/lib/index.d.ts CHANGED
@@ -69,6 +69,8 @@ export * from "./MUGlobal";
69
69
  export * from "./NotifierMU";
70
70
  export * from "./OptionBool";
71
71
  export * from "./OptionGroup";
72
+ export * from "./PercentCircularProgress";
73
+ export * from "./PercentLinearProgress";
72
74
  export * from "./PList";
73
75
  export * from "./ProgressCount";
74
76
  export * from "./PullToRefreshUI";
package/lib/index.js CHANGED
@@ -69,6 +69,8 @@ export * from "./MUGlobal";
69
69
  export * from "./NotifierMU";
70
70
  export * from "./OptionBool";
71
71
  export * from "./OptionGroup";
72
+ export * from "./PercentCircularProgress";
73
+ export * from "./PercentLinearProgress";
72
74
  export * from "./PList";
73
75
  export * from "./ProgressCount";
74
76
  export * from "./PullToRefreshUI";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -0,0 +1,45 @@
1
+ import {
2
+ Box,
3
+ CircularProgress,
4
+ CircularProgressProps,
5
+ Typography,
6
+ TypographyProps
7
+ } from "@mui/material";
8
+ import React from "react";
9
+
10
+ export type PercentCircularProgressProps = CircularProgressProps & {
11
+ value: number;
12
+ valueUnit?: string;
13
+ textProps?: TypographyProps<"div">;
14
+ };
15
+
16
+ export function PercentCircularProgress(props: PercentCircularProgressProps) {
17
+ // Destruct
18
+ const { textProps, valueUnit = "%", ...rest } = props;
19
+
20
+ // Component
21
+ return (
22
+ <Box sx={{ position: "relative", display: "inline-flex" }}>
23
+ <CircularProgress variant="determinate" {...rest} />
24
+ <Box
25
+ sx={{
26
+ top: 0,
27
+ left: 0,
28
+ bottom: 0,
29
+ right: 0,
30
+ position: "absolute",
31
+ display: "flex",
32
+ alignItems: "center",
33
+ justifyContent: "center"
34
+ }}
35
+ >
36
+ <Typography
37
+ variant="caption"
38
+ component="div"
39
+ color="text.secondary"
40
+ {...textProps}
41
+ >{`${Math.round(props.value)}${valueUnit}`}</Typography>
42
+ </Box>
43
+ </Box>
44
+ );
45
+ }
@@ -0,0 +1,35 @@
1
+ import {
2
+ Box,
3
+ LinearProgress,
4
+ LinearProgressProps,
5
+ Typography,
6
+ TypographyProps
7
+ } from "@mui/material";
8
+ import React from "react";
9
+
10
+ export type PercentLinearProgressProps = LinearProgressProps & {
11
+ value: number;
12
+ valueUnit?: string;
13
+ textProps?: TypographyProps;
14
+ };
15
+
16
+ export function PercentLinearProgress(props: PercentLinearProgressProps) {
17
+ // Destruct
18
+ const { textProps, valueUnit = "%", ...rest } = props;
19
+
20
+ // Component
21
+ return (
22
+ <Box sx={{ display: "flex", alignItems: "center" }}>
23
+ <Box sx={{ width: "100%", mr: 1 }}>
24
+ <LinearProgress variant="determinate" {...rest} />
25
+ </Box>
26
+ <Box sx={{ minWidth: 35 }}>
27
+ <Typography
28
+ variant="caption"
29
+ color="text.secondary"
30
+ {...textProps}
31
+ >{`${Math.round(props.value)}${valueUnit}`}</Typography>
32
+ </Box>
33
+ </Box>
34
+ );
35
+ }
package/src/index.ts CHANGED
@@ -72,6 +72,8 @@ export * from "./MUGlobal";
72
72
  export * from "./NotifierMU";
73
73
  export * from "./OptionBool";
74
74
  export * from "./OptionGroup";
75
+ export * from "./PercentCircularProgress";
76
+ export * from "./PercentLinearProgress";
75
77
  export * from "./PList";
76
78
  export * from "./ProgressCount";
77
79
  export * from "./PullToRefreshUI";