norma-library 0.5.137 → 0.5.139
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/esm/components/ProgressBar.d.ts +1 -1
- package/dist/esm/components/ProgressBar.js +16 -12
- package/dist/esm/components/ProgressBar.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/components/tbody/styles.js +1 -1
- package/dist/esm/components/UncontrolledTable/components/tbody/styles.js.map +1 -1
- package/dist/esm/interfaces/ProgressBar.d.ts +5 -0
- package/package.json +1 -1
- package/src/components/ProgressBar.tsx +29 -21
- package/src/components/UncontrolledTable/components/tbody/styles.tsx +0 -2
- package/src/interfaces/ProgressBar.ts +4 -0
- package/src/stories/ProgressBar.stories.tsx +4 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProgressBarBaseProps } from '../interfaces';
|
|
3
|
-
export declare const ProgressBar: ({ value, label, variant, total, className, localeString, colorCustom, color, ...props }: ProgressBarBaseProps) => React.JSX.Element;
|
|
3
|
+
export declare const ProgressBar: ({ value, label, variant, total, className, localeString, colorCustom, color, htmlLabel, ...props }: ProgressBarBaseProps) => React.JSX.Element;
|
|
@@ -4,10 +4,10 @@ import { LinearProgress as MuiProgressBar, linearProgressClasses, Typography } f
|
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
var ProgressBarStyled = styled(MuiProgressBar)(function (_a) {
|
|
6
6
|
var _b;
|
|
7
|
-
var colorCustom = _a.colorCustom;
|
|
7
|
+
var colorCustom = _a.colorCustom, $h = _a.$h;
|
|
8
8
|
return (_b = {
|
|
9
9
|
width: '100%',
|
|
10
|
-
height: '10px',
|
|
10
|
+
height: $h ? "".concat($h, "px") : '10px',
|
|
11
11
|
borderRadius: '10px',
|
|
12
12
|
position: 'relative',
|
|
13
13
|
backgroundColor: colorCustom ? colorCustom.root : undefined
|
|
@@ -20,19 +20,23 @@ var ProgressBarStyled = styled(MuiProgressBar)(function (_a) {
|
|
|
20
20
|
},
|
|
21
21
|
_b);
|
|
22
22
|
});
|
|
23
|
-
var ProgressBarLabelStyled = styled(Typography)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n position: relative;\n text-align: left;\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n position: relative;\n text-align: left;\n"])))
|
|
23
|
+
var ProgressBarLabelStyled = styled(Typography)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n position: relative;\n text-align: left;\n font-size: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n position: relative;\n text-align: left;\n font-size: ", ";\n"])), function (_a) {
|
|
24
|
+
var $fSize = _a.$fSize;
|
|
25
|
+
return $fSize || '1rem';
|
|
26
|
+
});
|
|
24
27
|
export var ProgressBar = function (_a) {
|
|
25
|
-
var _b = _a.value, value = _b === void 0 ? 0 : _b, label = _a.label, _c = _a.variant, variant = _c === void 0 ? 'determinate' : _c, total = _a.total, className = _a.className, localeString = _a.localeString, colorCustom = _a.colorCustom, _d = _a.color, color = _d === void 0 ? 'primary' : _d, props = __rest(_a, ["value", "label", "variant", "total", "className", "localeString", "colorCustom", "color"]);
|
|
28
|
+
var _b = _a.value, value = _b === void 0 ? 0 : _b, label = _a.label, _c = _a.variant, variant = _c === void 0 ? 'determinate' : _c, total = _a.total, className = _a.className, localeString = _a.localeString, colorCustom = _a.colorCustom, _d = _a.color, color = _d === void 0 ? 'primary' : _d, htmlLabel = _a.htmlLabel, props = __rest(_a, ["value", "label", "variant", "total", "className", "localeString", "colorCustom", "color", "htmlLabel"]);
|
|
26
29
|
var percentage = value && total ? (value / total) * 100 : 0;
|
|
27
30
|
return (React.createElement("div", { className: className, style: { minWidth: '100px' } },
|
|
28
|
-
label
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
label ? (React.createElement(ProgressBarLabelStyled, { "$fSize": props.fSize, className: "ProgressBarLabel" },
|
|
32
|
+
React.createElement(React.Fragment, null,
|
|
33
|
+
label,
|
|
34
|
+
!props.hideValue && (React.createElement("span", { style: { right: 0 } },
|
|
35
|
+
localeString ? value.toLocaleString() : value,
|
|
36
|
+
" (",
|
|
37
|
+
percentage.toFixed(2),
|
|
38
|
+
"%)"))))) : (htmlLabel),
|
|
39
|
+
React.createElement(ProgressBarStyled, __assign({ value: percentage, variant: variant, colorCustom: colorCustom, "$h": props.h, color: colorCustom ? undefined : color }, props))));
|
|
36
40
|
};
|
|
37
41
|
var templateObject_1;
|
|
38
42
|
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../src/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,IAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../src/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,IAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAA6C,UAAC,EAAmB;;QAAjB,WAAW,iBAAA,EAAE,EAAE,QAAA;IAAO,OAAA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AAS,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;QACpD,KAAK,CAAC,CAAC,CAAC,CACP,oBAAC,sBAAsB,cAAS,KAAK,CAAC,KAAK,EAAE,SAAS,EAAC,kBAAkB;YACvE;gBACG,KAAK;gBACL,CAAC,KAAK,CAAC,SAAS,IAAI,CACnB,8BAAM,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;oBACtB,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK;;oBAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;yBAClE,CACR,CACA,CACoB,CAC1B,CAAC,CAAC,CAAC,CACF,SAAS,CACV;QAED,oBAAC,iBAAiB,aAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,QACpB,KAAK,CAAC,CAAC,EACX,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAClC,KAAK,EACT,CACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
export var Tr = styled.tr(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: inherit;\n display: table-row;\n vertical-align: middle;\n outline: 0;\n &:nth-of-type(even) {\n background-color: #fafafa;\n }\n"], ["\n color: inherit;\n display: table-row;\n vertical-align: middle;\n outline: 0;\n &:nth-of-type(even) {\n background-color: #fafafa;\n }\n"])));
|
|
4
|
-
export var Td = styled.td(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color:
|
|
4
|
+
export var Td = styled.td(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color: #666666;\n font-size: 0.875rem;\n"], ["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color: #666666;\n font-size: 0.875rem;\n"])));
|
|
5
5
|
var templateObject_1, templateObject_2;
|
|
6
6
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/tbody/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,yNAAK,sJAQ/B,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/tbody/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,yNAAK,sJAQ/B,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,oWAAA,iSAY1B,IAAA,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SxProps } from '@mui/material';
|
|
2
3
|
import { Theme } from '@emotion/react';
|
|
3
4
|
import { OverridableStringUnion } from '@mui/types';
|
|
@@ -18,5 +19,9 @@ export interface ProgressBarBaseProps extends MuiProgressBarBaseProps {
|
|
|
18
19
|
variant?: ProgressVariant;
|
|
19
20
|
localeString?: boolean;
|
|
20
21
|
color?: OverridableStringUnion<ColorVariant, LinearProgressPropsColorOverrides>;
|
|
22
|
+
h?: number;
|
|
23
|
+
hideValue?: boolean;
|
|
24
|
+
fSize?: string;
|
|
25
|
+
htmlLabel?: React.ReactNode;
|
|
21
26
|
}
|
|
22
27
|
export type ProgressBarType = keyof typeof ProgressBar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.139",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.",
|
|
6
6
|
"scripts": {
|
|
@@ -3,29 +3,28 @@ import { LinearProgress as MuiProgressBar, linearProgressClasses, Typography } f
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { ProgressBarBaseProps, CustomColor } from '../interfaces';
|
|
5
5
|
|
|
6
|
-
const ProgressBarStyled = styled(MuiProgressBar)<{ colorCustom?: CustomColor }>(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const ProgressBarStyled = styled(MuiProgressBar)<{ colorCustom?: CustomColor; $h?: number }>(({ colorCustom, $h }) => ({
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: $h ? `${$h}px` : '10px',
|
|
9
|
+
borderRadius: '10px',
|
|
10
|
+
position: 'relative',
|
|
11
|
+
backgroundColor: colorCustom ? colorCustom.root : undefined,
|
|
12
|
+
[`&.${linearProgressClasses.determinate}`]: {
|
|
12
13
|
backgroundColor: colorCustom ? colorCustom.root : undefined,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
);
|
|
14
|
+
},
|
|
15
|
+
[`& .${linearProgressClasses.bar}`]: {
|
|
16
|
+
backgroundColor: colorCustom ? colorCustom.bar : undefined,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
21
19
|
|
|
22
|
-
const ProgressBarLabelStyled = styled(Typography)
|
|
20
|
+
const ProgressBarLabelStyled = styled(Typography)<{ $fSize?: string }>`
|
|
23
21
|
display: flex;
|
|
24
22
|
justify-content: space-between;
|
|
25
23
|
align-items: center;
|
|
26
24
|
margin-bottom: 8px;
|
|
27
25
|
position: relative;
|
|
28
26
|
text-align: left;
|
|
27
|
+
font-size: ${({ $fSize }) => $fSize || '1rem'};
|
|
29
28
|
`;
|
|
30
29
|
|
|
31
30
|
export const ProgressBar = ({
|
|
@@ -37,24 +36,33 @@ export const ProgressBar = ({
|
|
|
37
36
|
localeString,
|
|
38
37
|
colorCustom,
|
|
39
38
|
color = 'primary',
|
|
39
|
+
htmlLabel,
|
|
40
40
|
...props
|
|
41
41
|
}: ProgressBarBaseProps) => {
|
|
42
42
|
const percentage = value && total ? (value / total) * 100 : 0;
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<div className={className} style={{ minWidth: '100px' }}>
|
|
46
|
-
{label
|
|
47
|
-
<ProgressBarLabelStyled>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
46
|
+
{label ? (
|
|
47
|
+
<ProgressBarLabelStyled $fSize={props.fSize} className="ProgressBarLabel">
|
|
48
|
+
<>
|
|
49
|
+
{label}
|
|
50
|
+
{!props.hideValue && (
|
|
51
|
+
<span style={{ right: 0 }}>
|
|
52
|
+
{localeString ? value.toLocaleString() : value} ({percentage.toFixed(2)}%)
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</>
|
|
52
56
|
</ProgressBarLabelStyled>
|
|
57
|
+
) : (
|
|
58
|
+
htmlLabel
|
|
53
59
|
)}
|
|
60
|
+
|
|
54
61
|
<ProgressBarStyled
|
|
55
62
|
value={percentage}
|
|
56
63
|
variant={variant}
|
|
57
64
|
colorCustom={colorCustom}
|
|
65
|
+
$h={props.h}
|
|
58
66
|
color={colorCustom ? undefined : color}
|
|
59
67
|
{...props}
|
|
60
68
|
/>
|
|
@@ -20,6 +20,10 @@ export interface ProgressBarBaseProps extends MuiProgressBarBaseProps {
|
|
|
20
20
|
variant?: ProgressVariant;
|
|
21
21
|
localeString?: boolean;
|
|
22
22
|
color?: OverridableStringUnion<ColorVariant, LinearProgressPropsColorOverrides>;
|
|
23
|
+
h?: number;
|
|
24
|
+
hideValue?: boolean;
|
|
25
|
+
fSize?: string;
|
|
26
|
+
htmlLabel?: React.ReactNode;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export type ProgressBarType = keyof typeof ProgressBar;
|
|
@@ -93,7 +93,7 @@ export const ProgressBarCustomColors: Story = () => (
|
|
|
93
93
|
value={50}
|
|
94
94
|
total={100}
|
|
95
95
|
colorCustom={{ root: 'rgba(179, 222, 105, 0.2)', bar: '#b3de69' }}
|
|
96
|
-
|
|
96
|
+
htmlLabel={<div>Custom Color Green</div>}
|
|
97
97
|
/>
|
|
98
98
|
</div>
|
|
99
99
|
</div>
|
|
@@ -104,6 +104,9 @@ export const ProgressBarCustomColors: Story = () => (
|
|
|
104
104
|
total={100}
|
|
105
105
|
colorCustom={{ root: 'rgba(0, 191, 255, 0.2)', bar: '#00bfff' }}
|
|
106
106
|
label="Custom Color Blue"
|
|
107
|
+
h={5}
|
|
108
|
+
hideValue
|
|
109
|
+
fSize='12px'
|
|
107
110
|
/>
|
|
108
111
|
</div>
|
|
109
112
|
</div>
|