pne-ui 1.0.175 → 1.0.176
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.
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ButtonProps } from '@mui/material';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
export type PneButtonStyle = 'contained' | 'outlined' | 'error' | 'text' | 'pneContained';
|
|
3
4
|
declare const PneButton: <C extends React.ElementType<any>>(props: ButtonProps<C, {
|
|
4
5
|
component?: C;
|
|
5
|
-
}>
|
|
6
|
+
}> & {
|
|
7
|
+
pneStyle?: PneButtonStyle;
|
|
8
|
+
}) => React.JSX.Element;
|
|
6
9
|
export default PneButton;
|
|
@@ -5,7 +5,39 @@ const material_1 = require("@mui/material");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
// https://mui.com/material-ui/guides/typescript/#complications-with-the-component-prop
|
|
7
7
|
const PneButton = (props) => {
|
|
8
|
-
const { sx, children, variant = 'contained', size = 'large', ...rest } = props;
|
|
8
|
+
const { sx, children, variant = 'contained', color, size = 'large', pneStyle = 'contained', ...rest } = props;
|
|
9
|
+
let finalVariant = 'contained';
|
|
10
|
+
let finalColor = 'primary';
|
|
11
|
+
if (pneStyle) {
|
|
12
|
+
switch (pneStyle) {
|
|
13
|
+
case 'contained':
|
|
14
|
+
finalVariant = 'contained';
|
|
15
|
+
finalColor = 'primary';
|
|
16
|
+
break;
|
|
17
|
+
case 'outlined':
|
|
18
|
+
finalVariant = 'outlined';
|
|
19
|
+
finalColor = 'primary';
|
|
20
|
+
break;
|
|
21
|
+
case 'error':
|
|
22
|
+
finalVariant = 'outlined';
|
|
23
|
+
finalColor = 'error';
|
|
24
|
+
break;
|
|
25
|
+
case 'text':
|
|
26
|
+
finalVariant = 'text';
|
|
27
|
+
finalColor = 'primary';
|
|
28
|
+
break;
|
|
29
|
+
case 'pneContained':
|
|
30
|
+
finalVariant = 'contained';
|
|
31
|
+
finalColor = 'pnePrimary';
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
console.warn(`Unknown pneStyle: ${pneStyle}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
finalVariant = variant || finalVariant;
|
|
39
|
+
finalColor = color || finalColor;
|
|
40
|
+
}
|
|
9
41
|
const _sx = [
|
|
10
42
|
{
|
|
11
43
|
height: size === 'large' ? '40px' : 'inherit',
|
|
@@ -16,7 +48,7 @@ const PneButton = (props) => {
|
|
|
16
48
|
},
|
|
17
49
|
...(Array.isArray(sx) ? sx : [sx])
|
|
18
50
|
];
|
|
19
|
-
return React.createElement(material_1.Button, { sx: _sx, variant:
|
|
51
|
+
return React.createElement(material_1.Button, { sx: _sx, variant: finalVariant, color: finalColor, size: size, ...rest }, children);
|
|
20
52
|
};
|
|
21
53
|
exports.default = PneButton;
|
|
22
54
|
//# sourceMappingURL=PneButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PneButton.js","sourceRoot":"","sources":["../../src/component/PneButton.tsx"],"names":[],"mappings":";;;AAAA,4CAA2D;AAC3D,qDAA+B;
|
|
1
|
+
{"version":3,"file":"PneButton.js","sourceRoot":"","sources":["../../src/component/PneButton.tsx"],"names":[],"mappings":";;;AAAA,4CAA2D;AAC3D,qDAA+B;AAI/B,uFAAuF;AACvF,MAAM,SAAS,GAAG,CACd,KAAsE,EACxE,EAAE;IACA,MAAM,EACF,EAAE,EACF,QAAQ,EACR,OAAO,GAAG,WAAW,EACrB,KAAK,EACL,IAAI,GAAG,OAAO,EACd,QAAQ,GAAG,WAAW,EACtB,GAAG,IAAI,EACV,GAAG,KAAK,CAAC;IAEV,IAAI,YAAY,GAA2B,WAAW,CAAA;IACtD,IAAI,UAAU,GAAyB,SAAS,CAAA;IAEhD,IAAI,QAAQ,EAAE,CAAC;QACX,QAAQ,QAAQ,EAAE,CAAC;YACf,KAAK,WAAW;gBACZ,YAAY,GAAG,WAAW,CA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|
2
2
|
import * as React from "react";
|
|
3
|
+
export type PneButtonStyle = 'contained' | 'outlined' | 'error' | 'text' | 'pneContained';
|
|
3
4
|
declare const PneButton: <C extends React.ElementType<any>>(props: ButtonProps<C, {
|
|
4
5
|
component?: C;
|
|
5
|
-
}>
|
|
6
|
+
}> & {
|
|
7
|
+
pneStyle?: PneButtonStyle;
|
|
8
|
+
}) => React.JSX.Element;
|
|
6
9
|
export default PneButton;
|
|
@@ -2,7 +2,39 @@ import { Button } from '@mui/material';
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
// https://mui.com/material-ui/guides/typescript/#complications-with-the-component-prop
|
|
4
4
|
const PneButton = (props) => {
|
|
5
|
-
const { sx, children, variant = 'contained', size = 'large', ...rest } = props;
|
|
5
|
+
const { sx, children, variant = 'contained', color, size = 'large', pneStyle = 'contained', ...rest } = props;
|
|
6
|
+
let finalVariant = 'contained';
|
|
7
|
+
let finalColor = 'primary';
|
|
8
|
+
if (pneStyle) {
|
|
9
|
+
switch (pneStyle) {
|
|
10
|
+
case 'contained':
|
|
11
|
+
finalVariant = 'contained';
|
|
12
|
+
finalColor = 'primary';
|
|
13
|
+
break;
|
|
14
|
+
case 'outlined':
|
|
15
|
+
finalVariant = 'outlined';
|
|
16
|
+
finalColor = 'primary';
|
|
17
|
+
break;
|
|
18
|
+
case 'error':
|
|
19
|
+
finalVariant = 'outlined';
|
|
20
|
+
finalColor = 'error';
|
|
21
|
+
break;
|
|
22
|
+
case 'text':
|
|
23
|
+
finalVariant = 'text';
|
|
24
|
+
finalColor = 'primary';
|
|
25
|
+
break;
|
|
26
|
+
case 'pneContained':
|
|
27
|
+
finalVariant = 'contained';
|
|
28
|
+
finalColor = 'pnePrimary';
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
console.warn(`Unknown pneStyle: ${pneStyle}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
finalVariant = variant || finalVariant;
|
|
36
|
+
finalColor = color || finalColor;
|
|
37
|
+
}
|
|
6
38
|
const _sx = [
|
|
7
39
|
{
|
|
8
40
|
height: size === 'large' ? '40px' : 'inherit',
|
|
@@ -13,7 +45,7 @@ const PneButton = (props) => {
|
|
|
13
45
|
},
|
|
14
46
|
...(Array.isArray(sx) ? sx : [sx])
|
|
15
47
|
];
|
|
16
|
-
return React.createElement(Button, { sx: _sx, variant:
|
|
48
|
+
return React.createElement(Button, { sx: _sx, variant: finalVariant, color: finalColor, size: size, ...rest }, children);
|
|
17
49
|
};
|
|
18
50
|
export default PneButton;
|
|
19
51
|
//# sourceMappingURL=PneButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PneButton.js","sourceRoot":"","sources":["../../src/component/PneButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAuB,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PneButton.js","sourceRoot":"","sources":["../../src/component/PneButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAuB,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,uFAAuF;AACvF,MAAM,SAAS,GAAG,CACd,KAAsE,EACxE,EAAE;IACA,MAAM,EACF,EAAE,EACF,QAAQ,EACR,OAAO,GAAG,WAAW,EACrB,KAAK,EACL,IAAI,GAAG,OAAO,EACd,QAAQ,GAAG,WAAW,EACtB,GAAG,IAAI,EACV,GAAG,KAAK,CAAC;IAEV,IAAI,YAAY,GAA2B,WAAW,CAAA;IACtD,IAAI,UAAU,GAAyB,SAAS,CAAA;IAEhD,IAAI,QAAQ,EAAE,CAAC;QACX,QAAQ,QAAQ,EAAE,CAAC;YACf,KAAK,WAAW;gBACZ,YAAY,GAAG,WAAW,CAAA;gBAC1B,UAAU,GAAG,SAAS,CAAA;gBACtB,MAAK;YACT,KAAK,UAAU;gBACX,YA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