@astral/ui 0.1.0 → 0.1.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.
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +13 -0
- package/cjs/src/Badge/Badge.d.ts +3 -0
- package/cjs/src/Badge/Badge.js +31 -0
- package/cjs/src/Badge/index.d.ts +2 -0
- package/cjs/src/Badge/index.js +14 -0
- package/cjs/src/Badge/styled.d.ts +50 -0
- package/cjs/src/Badge/styled.js +63 -0
- package/cjs/src/Badge/types.d.ts +5 -0
- package/cjs/src/Badge/types.js +2 -0
- package/cjs/src/Button/Button.d.ts +2 -0
- package/cjs/src/Button/Button.js +33 -0
- package/cjs/src/Button/index.d.ts +2 -0
- package/cjs/src/Button/index.js +14 -0
- package/cjs/src/Button/styled.d.ts +13 -0
- package/cjs/src/Button/styled.js +33 -0
- package/cjs/src/Button/types.d.ts +7 -0
- package/cjs/src/Button/types.js +2 -0
- package/cjs/src/ButtonBase/ButtonBase.d.ts +2 -0
- package/cjs/src/ButtonBase/ButtonBase.js +33 -0
- package/cjs/src/ButtonBase/constants.d.ts +22 -0
- package/cjs/src/ButtonBase/constants.js +29 -0
- package/cjs/src/ButtonBase/index.d.ts +3 -0
- package/cjs/src/ButtonBase/index.js +15 -0
- package/cjs/src/ButtonBase/styled.d.ts +32 -0
- package/cjs/src/ButtonBase/styled.js +224 -0
- package/cjs/src/ButtonBase/types.d.ts +11 -0
- package/cjs/src/ButtonBase/types.js +2 -0
- package/cjs/src/CircularProgress/CircularProgress.d.ts +3 -0
- package/cjs/src/CircularProgress/CircularProgress.js +33 -0
- package/cjs/src/CircularProgress/constants.d.ts +9 -0
- package/cjs/src/CircularProgress/constants.js +14 -0
- package/cjs/src/CircularProgress/index.d.ts +2 -0
- package/cjs/src/CircularProgress/index.js +14 -0
- package/cjs/src/CircularProgress/styled.d.ts +8 -0
- package/cjs/src/CircularProgress/styled.js +26 -0
- package/cjs/src/CircularProgress/types.d.ts +8 -0
- package/cjs/src/CircularProgress/types.js +2 -0
- package/cjs/src/IconButton/IconButton.d.ts +2 -0
- package/cjs/src/IconButton/IconButton.js +32 -0
- package/cjs/src/IconButton/index.d.ts +1 -0
- package/cjs/src/IconButton/index.js +13 -0
- package/cjs/src/IconButton/styled.d.ts +19 -0
- package/cjs/src/IconButton/styled.js +25 -0
- package/cjs/src/ThemeProvider/ThemeProvider.d.ts +7 -0
- package/cjs/src/ThemeProvider/ThemeProvider.js +22 -0
- package/cjs/src/ThemeProvider/index.d.ts +1 -0
- package/cjs/src/ThemeProvider/index.js +13 -0
- package/cjs/src/Typography/Typography.d.ts +7 -0
- package/cjs/src/Typography/Typography.js +36 -0
- package/cjs/src/Typography/index.d.ts +1 -0
- package/cjs/src/Typography/index.js +13 -0
- package/cjs/src/index.d.ts +8 -0
- package/cjs/src/index.js +20 -0
- package/cjs/src/styles/index.d.ts +1 -0
- package/cjs/src/styles/index.js +13 -0
- package/cjs/src/styles/styled/index.d.ts +1 -0
- package/cjs/src/styles/styled/index.js +13 -0
- package/cjs/src/styles/styled/styled.d.ts +2 -0
- package/cjs/src/styles/styled/styled.js +8 -0
- package/cjs/src/styles/styled/types.d.ts +48 -0
- package/cjs/src/styles/styled/types.js +2 -0
- package/cjs/src/theme/__tests__/BaseTheme.test.d.ts +1 -0
- package/cjs/src/theme/__tests__/BaseTheme.test.js +56 -0
- package/cjs/src/theme/baseTheme.d.ts +27 -0
- package/cjs/src/theme/baseTheme.js +23 -0
- package/cjs/src/theme/components.d.ts +20 -0
- package/cjs/src/theme/components.js +28 -0
- package/cjs/src/theme/constants.d.ts +9 -0
- package/cjs/src/theme/constants.js +13 -0
- package/cjs/src/theme/elevation.d.ts +8 -0
- package/cjs/src/theme/elevation.js +10 -0
- package/cjs/src/theme/index.d.ts +5 -0
- package/cjs/src/theme/index.js +17 -0
- package/cjs/src/theme/palette/brandPalette.d.ts +15 -0
- package/cjs/src/theme/palette/brandPalette.js +85 -0
- package/cjs/src/theme/palette/index.d.ts +2 -0
- package/cjs/src/theme/palette/index.js +14 -0
- package/cjs/src/theme/palette/palette.d.ts +29 -0
- package/cjs/src/theme/palette/palette.js +108 -0
- package/cjs/src/theme/shape.d.ts +6 -0
- package/cjs/src/theme/shape.js +8 -0
- package/cjs/src/theme/typography.d.ts +19 -0
- package/cjs/src/theme/typography.js +112 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/src/Badge/Badge.d.ts +3 -0
- package/esm/src/Badge/Badge.js +29 -0
- package/esm/src/Badge/index.d.ts +2 -0
- package/esm/src/Badge/index.js +2 -0
- package/esm/src/Badge/styled.d.ts +50 -0
- package/esm/src/Badge/styled.js +60 -0
- package/esm/src/Badge/types.d.ts +5 -0
- package/esm/src/Badge/types.js +1 -0
- package/esm/src/Button/Button.d.ts +2 -0
- package/esm/src/Button/Button.js +29 -0
- package/esm/src/Button/index.d.ts +2 -0
- package/esm/src/Button/index.js +2 -0
- package/esm/src/Button/styled.d.ts +13 -0
- package/esm/src/Button/styled.js +30 -0
- package/esm/src/Button/types.d.ts +7 -0
- package/esm/src/Button/types.js +1 -0
- package/esm/src/ButtonBase/ButtonBase.d.ts +2 -0
- package/esm/src/ButtonBase/ButtonBase.js +29 -0
- package/esm/src/ButtonBase/constants.d.ts +22 -0
- package/esm/src/ButtonBase/constants.js +26 -0
- package/esm/src/ButtonBase/index.d.ts +3 -0
- package/esm/src/ButtonBase/index.js +3 -0
- package/esm/src/ButtonBase/styled.d.ts +32 -0
- package/esm/src/ButtonBase/styled.js +196 -0
- package/esm/src/ButtonBase/types.d.ts +11 -0
- package/esm/src/ButtonBase/types.js +1 -0
- package/esm/src/CircularProgress/CircularProgress.d.ts +3 -0
- package/esm/src/CircularProgress/CircularProgress.js +29 -0
- package/esm/src/CircularProgress/constants.d.ts +9 -0
- package/esm/src/CircularProgress/constants.js +11 -0
- package/esm/src/CircularProgress/index.d.ts +2 -0
- package/esm/src/CircularProgress/index.js +2 -0
- package/esm/src/CircularProgress/styled.d.ts +8 -0
- package/esm/src/CircularProgress/styled.js +23 -0
- package/esm/src/CircularProgress/types.d.ts +8 -0
- package/esm/src/CircularProgress/types.js +1 -0
- package/esm/src/IconButton/IconButton.d.ts +2 -0
- package/esm/src/IconButton/IconButton.js +28 -0
- package/esm/src/IconButton/index.d.ts +1 -0
- package/esm/src/IconButton/index.js +1 -0
- package/esm/src/IconButton/styled.d.ts +19 -0
- package/esm/src/IconButton/styled.js +21 -0
- package/esm/src/ThemeProvider/ThemeProvider.d.ts +7 -0
- package/esm/src/ThemeProvider/ThemeProvider.js +18 -0
- package/esm/src/ThemeProvider/index.d.ts +1 -0
- package/esm/src/ThemeProvider/index.js +1 -0
- package/esm/src/Typography/Typography.d.ts +7 -0
- package/esm/src/Typography/Typography.js +29 -0
- package/esm/src/Typography/index.d.ts +1 -0
- package/esm/src/Typography/index.js +1 -0
- package/esm/src/index.d.ts +8 -0
- package/esm/src/index.js +8 -0
- package/esm/src/styles/index.d.ts +1 -0
- package/esm/src/styles/index.js +1 -0
- package/esm/src/styles/styled/index.d.ts +1 -0
- package/esm/src/styles/styled/index.js +1 -0
- package/esm/src/styles/styled/styled.d.ts +2 -0
- package/esm/src/styles/styled/styled.js +2 -0
- package/esm/src/styles/styled/types.d.ts +48 -0
- package/esm/src/styles/styled/types.js +1 -0
- package/esm/src/theme/__tests__/BaseTheme.test.d.ts +1 -0
- package/esm/src/theme/__tests__/BaseTheme.test.js +54 -0
- package/esm/src/theme/baseTheme.d.ts +27 -0
- package/esm/src/theme/baseTheme.js +19 -0
- package/esm/src/theme/components.d.ts +20 -0
- package/esm/src/theme/components.js +24 -0
- package/esm/src/theme/constants.d.ts +9 -0
- package/esm/src/theme/constants.js +10 -0
- package/esm/src/theme/elevation.d.ts +8 -0
- package/esm/src/theme/elevation.js +7 -0
- package/esm/src/theme/index.d.ts +5 -0
- package/esm/src/theme/index.js +5 -0
- package/esm/src/theme/palette/brandPalette.d.ts +15 -0
- package/esm/src/theme/palette/brandPalette.js +82 -0
- package/esm/src/theme/palette/index.d.ts +2 -0
- package/esm/src/theme/palette/index.js +2 -0
- package/esm/src/theme/palette/palette.d.ts +29 -0
- package/esm/src/theme/palette/palette.js +104 -0
- package/esm/src/theme/shape.d.ts +6 -0
- package/esm/src/theme/shape.js +5 -0
- package/esm/src/theme/typography.d.ts +19 -0
- package/esm/src/theme/typography.js +108 -0
- package/package.json +6 -12
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typography = exports.pxToRem = void 0;
|
|
4
|
+
var HTML_FONT_SIZE = 14;
|
|
5
|
+
// Т.к. нет досутпа к теме, написал функцию для конвертации px в rem
|
|
6
|
+
var pxToRem = function (fontSize, htmlFontSize) {
|
|
7
|
+
if (htmlFontSize === void 0) { htmlFontSize = HTML_FONT_SIZE; }
|
|
8
|
+
return fontSize / htmlFontSize + "rem";
|
|
9
|
+
};
|
|
10
|
+
exports.pxToRem = pxToRem;
|
|
11
|
+
exports.typography = {
|
|
12
|
+
fontSize: 14,
|
|
13
|
+
htmlFontSize: 14,
|
|
14
|
+
fontWeightLight: 300,
|
|
15
|
+
fontWeightRegular: 400,
|
|
16
|
+
fontWeightMedium: 500,
|
|
17
|
+
fontWeightBold: 700,
|
|
18
|
+
fontFamily: ['Ubuntu', 'sans-serif'].join(','),
|
|
19
|
+
get h1() {
|
|
20
|
+
return {
|
|
21
|
+
fontSize: (0, exports.pxToRem)(35, this.htmlFontSize),
|
|
22
|
+
fontWeight: this.fontWeightMedium,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
get h2() {
|
|
26
|
+
return {
|
|
27
|
+
fontSize: (0, exports.pxToRem)(29, this.htmlFontSize),
|
|
28
|
+
fontWeight: this.fontWeightMedium,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
get h3() {
|
|
32
|
+
return {
|
|
33
|
+
fontSize: (0, exports.pxToRem)(24, this.htmlFontSize),
|
|
34
|
+
fontWeight: this.fontWeightMedium,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
get h4() {
|
|
38
|
+
return {
|
|
39
|
+
fontSize: (0, exports.pxToRem)(20, this.htmlFontSize),
|
|
40
|
+
fontWeight: this.fontWeightMedium,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
get h5() {
|
|
44
|
+
return {
|
|
45
|
+
fontSize: (0, exports.pxToRem)(16, this.htmlFontSize),
|
|
46
|
+
fontWeight: this.fontWeightMedium,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
get h6() {
|
|
50
|
+
return {
|
|
51
|
+
fontSize: (0, exports.pxToRem)(14, this.htmlFontSize),
|
|
52
|
+
fontWeight: this.fontWeightMedium,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
get h7() {
|
|
56
|
+
return {
|
|
57
|
+
fontSize: (0, exports.pxToRem)(12, this.htmlFontSize),
|
|
58
|
+
fontWeight: this.fontWeightMedium,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
get h8() {
|
|
62
|
+
return {
|
|
63
|
+
fontSize: (0, exports.pxToRem)(12, this.htmlFontSize),
|
|
64
|
+
fontWeight: this.fontWeightMedium,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
get h9() {
|
|
68
|
+
return {
|
|
69
|
+
fontSize: (0, exports.pxToRem)(11, this.htmlFontSize),
|
|
70
|
+
fontWeight: this.fontWeightBold,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
get button() {
|
|
74
|
+
return {
|
|
75
|
+
fontSize: (0, exports.pxToRem)(14, this.htmlFontSize),
|
|
76
|
+
fontWeight: this.fontWeightMedium,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
get ui() {
|
|
80
|
+
return {
|
|
81
|
+
fontSize: (0, exports.pxToRem)(14, this.htmlFontSize),
|
|
82
|
+
fontWeight: this.fontWeightRegular,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
get link() {
|
|
86
|
+
return {
|
|
87
|
+
fontSize: (0, exports.pxToRem)(14, this.htmlFontSize),
|
|
88
|
+
fontWeight: this.fontWeightRegular,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
get pointer() {
|
|
92
|
+
return {
|
|
93
|
+
fontSize: (0, exports.pxToRem)(12, this.htmlFontSize),
|
|
94
|
+
fontWeight: this.fontWeightMedium,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
get small() {
|
|
98
|
+
return {
|
|
99
|
+
fontSize: (0, exports.pxToRem)(12, this.htmlFontSize),
|
|
100
|
+
fontWeight: this.fontWeightRegular,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
get code() {
|
|
104
|
+
return {
|
|
105
|
+
fontSize: (0, exports.pxToRem)(12, this.htmlFontSize),
|
|
106
|
+
fontWeight: this.fontWeightLight,
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
body1: {
|
|
110
|
+
fontSize: '1rem',
|
|
111
|
+
},
|
|
112
|
+
};
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { StyledBadge } from './styled';
|
|
25
|
+
var Badge = function (_a) {
|
|
26
|
+
var children = _a.children, color = _a.color, props = __rest(_a, ["children", "color"]);
|
|
27
|
+
return (_jsx(StyledBadge, __assign({ customColor: color }, props, { max: 99 }, { children: children }), void 0));
|
|
28
|
+
};
|
|
29
|
+
export default Badge;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Theme } from '../theme';
|
|
3
|
+
import { BadgeColor, BadgeProps } from './types';
|
|
4
|
+
export declare const StyledBadge: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
classes?: (Partial<import("@mui/material").BadgeUnstyledClasses> & {
|
|
6
|
+
colorPrimary?: string | undefined;
|
|
7
|
+
colorSecondary?: string | undefined;
|
|
8
|
+
colorError?: string | undefined;
|
|
9
|
+
colorInfo?: string | undefined;
|
|
10
|
+
colorSuccess?: string | undefined;
|
|
11
|
+
colorWarning?: string | undefined;
|
|
12
|
+
anchorOriginTopRightRectangular?: string | undefined;
|
|
13
|
+
anchorOriginBottomRightRectangular?: string | undefined;
|
|
14
|
+
anchorOriginTopLeftRectangular?: string | undefined;
|
|
15
|
+
anchorOriginBottomLeftRectangular?: string | undefined;
|
|
16
|
+
anchorOriginTopRightCircular?: string | undefined;
|
|
17
|
+
anchorOriginBottomRightCircular?: string | undefined;
|
|
18
|
+
anchorOriginTopLeftCircular?: string | undefined;
|
|
19
|
+
anchorOriginBottomLeftCircular?: string | undefined;
|
|
20
|
+
overlapRectangular?: string | undefined;
|
|
21
|
+
overlapCircular?: string | undefined;
|
|
22
|
+
}) | undefined;
|
|
23
|
+
color?: "primary" | "secondary" | "default" | "error" | "warning" | "info" | "success" | undefined;
|
|
24
|
+
overlap?: "circular" | "rectangular" | undefined;
|
|
25
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
|
+
variant?: "dot" | "standard" | undefined;
|
|
27
|
+
} & {
|
|
28
|
+
anchorOrigin?: import("@mui/material").BadgeOrigin | undefined;
|
|
29
|
+
components?: {
|
|
30
|
+
Root?: import("react").ElementType<any> | undefined;
|
|
31
|
+
Badge?: import("react").ElementType<any> | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
componentsProps?: {
|
|
34
|
+
root?: (import("react").HTMLAttributes<HTMLSpanElement> & import("@mui/material").BadgeUnstyledComponentsPropsOverrides) | undefined;
|
|
35
|
+
badge?: (import("react").HTMLAttributes<HTMLSpanElement> & import("@mui/material").BadgeUnstyledComponentsPropsOverrides) | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
badgeContent?: import("react").ReactNode;
|
|
38
|
+
children?: import("react").ReactNode;
|
|
39
|
+
classes?: Partial<import("@mui/material").BadgeUnstyledClasses> | undefined;
|
|
40
|
+
invisible?: boolean | undefined;
|
|
41
|
+
max?: number | undefined;
|
|
42
|
+
showZero?: boolean | undefined;
|
|
43
|
+
variant?: string | undefined;
|
|
44
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
45
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
46
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "sx" | "variant" | "components" | "componentsProps" | "invisible" | "overlap" | "anchorOrigin" | "badgeContent" | "max" | "showZero"> & {
|
|
47
|
+
theme?: Theme | undefined;
|
|
48
|
+
} & Omit<BadgeProps, "color"> & {
|
|
49
|
+
customColor: BadgeColor;
|
|
50
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { Badge } from '@mui/material';
|
|
6
|
+
import { styled } from '../styles';
|
|
7
|
+
var getBgColor = function (_a) {
|
|
8
|
+
var customColor = _a.customColor, theme = _a.theme;
|
|
9
|
+
if (customColor === 'grey')
|
|
10
|
+
return theme.palette.grey[300];
|
|
11
|
+
if (customColor === 'errorLight')
|
|
12
|
+
return theme.palette.error.light;
|
|
13
|
+
if (customColor === 'success')
|
|
14
|
+
return theme.palette.success.light;
|
|
15
|
+
if (customColor === 'primary')
|
|
16
|
+
return theme.palette.primary.main;
|
|
17
|
+
if (customColor === 'white')
|
|
18
|
+
return theme.palette.background.default;
|
|
19
|
+
if (customColor === 'error')
|
|
20
|
+
return theme.palette.error.dark;
|
|
21
|
+
return theme.palette.primary.main;
|
|
22
|
+
};
|
|
23
|
+
var getTextColor = function (_a) {
|
|
24
|
+
var customColor = _a.customColor, theme = _a.theme;
|
|
25
|
+
if (customColor === 'grey')
|
|
26
|
+
return theme.palette.text.primary;
|
|
27
|
+
if (customColor === 'primary')
|
|
28
|
+
return theme.palette.primary.contrastText;
|
|
29
|
+
if (customColor === 'white')
|
|
30
|
+
return theme.palette.primary.main;
|
|
31
|
+
if (customColor === 'error')
|
|
32
|
+
return theme.palette.error.contrastText;
|
|
33
|
+
if (customColor === 'errorLight')
|
|
34
|
+
return theme.palette.error.dark;
|
|
35
|
+
if (customColor === 'success')
|
|
36
|
+
return theme.palette.success.dark;
|
|
37
|
+
return theme.palette.primary.contrastText;
|
|
38
|
+
};
|
|
39
|
+
export var StyledBadge = styled(Badge, {
|
|
40
|
+
shouldForwardProp: function (prop) { return prop !== 'customColor'; },
|
|
41
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .MuiBadge-badge {\n height: 20px;\n border-radius: 12px;\n line-height: 20px;\n background-color: ", ";\n color: ", ";\n padding: ", ";\n font-size: ", ";\n border: 2px solid ", ";\n }\n\n .MuiBadge-dot {\n width: 12px;\n height: 12px;\n border: 2px solid ", ";\n }\n"], ["\n .MuiBadge-badge {\n height: 20px;\n border-radius: 12px;\n line-height: 20px;\n background-color: ", ";\n color: ", ";\n padding: ", ";\n font-size: ", ";\n border: 2px solid ", ";\n }\n\n .MuiBadge-dot {\n width: 12px;\n height: 12px;\n border: 2px solid ", ";\n }\n"])), function (_a) {
|
|
42
|
+
var customColor = _a.customColor, theme = _a.theme;
|
|
43
|
+
return getBgColor({ customColor: customColor, theme: theme });
|
|
44
|
+
}, function (_a) {
|
|
45
|
+
var customColor = _a.customColor, theme = _a.theme;
|
|
46
|
+
return getTextColor({ customColor: customColor, theme: theme });
|
|
47
|
+
}, function (_a) {
|
|
48
|
+
var theme = _a.theme;
|
|
49
|
+
return theme.spacing(0, 1);
|
|
50
|
+
}, function (_a) {
|
|
51
|
+
var theme = _a.theme;
|
|
52
|
+
return theme.typography.small.fontSize;
|
|
53
|
+
}, function (_a) {
|
|
54
|
+
var theme = _a.theme;
|
|
55
|
+
return theme.palette.common.white;
|
|
56
|
+
}, function (_a) {
|
|
57
|
+
var theme = _a.theme;
|
|
58
|
+
return theme.palette.common.white;
|
|
59
|
+
});
|
|
60
|
+
var templateObject_1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { CircularProgress } from '../CircularProgress';
|
|
25
|
+
import { StyledButton } from './styled';
|
|
26
|
+
export var Button = function (_a) {
|
|
27
|
+
var children = _a.children, startIcon = _a.startIcon, endIcon = _a.endIcon, loading = _a.loading, props = __rest(_a, ["children", "startIcon", "endIcon", "loading"]);
|
|
28
|
+
return (_jsxs(StyledButton, __assign({ loading: loading }, props, { children: [_jsx("span", { children: startIcon }, void 0), children, loading && _jsx(CircularProgress, {}, void 0), _jsx("span", { children: endIcon }, void 0)] }), void 0));
|
|
29
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Theme } from '../theme';
|
|
3
|
+
export declare const StyledButton: import("@emotion/styled").StyledComponent<Omit<import("@mui/base/ButtonUnstyled/ButtonUnstyledProps").default<"button", {}>, "color" | "variant" | "size"> & {
|
|
4
|
+
color?: "primary" | "error" | "warning" | "success" | undefined;
|
|
5
|
+
variant?: "link" | "light" | "text" | "contained" | undefined;
|
|
6
|
+
size?: "large" | "medium" | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
theme?: Theme | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
loading?: boolean | undefined;
|
|
11
|
+
startIcon?: import("react").ReactNode;
|
|
12
|
+
endIcon?: import("react").ReactNode;
|
|
13
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { styled } from '../styles';
|
|
6
|
+
import { ButtonBase, ButtonVariants } from '../ButtonBase';
|
|
7
|
+
var getProgressColor = function (_a) {
|
|
8
|
+
var theme = _a.theme, variant = _a.variant;
|
|
9
|
+
if (variant === ButtonVariants.CONTAINED)
|
|
10
|
+
return theme.palette.primary.contrastText;
|
|
11
|
+
return theme.palette.grey['900'];
|
|
12
|
+
};
|
|
13
|
+
export var StyledButton = styled(ButtonBase, {
|
|
14
|
+
shouldForwardProp: function (prop) {
|
|
15
|
+
return prop !== 'startIcon' && prop !== 'endIcon' && prop !== 'loading';
|
|
16
|
+
},
|
|
17
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: ", ";\n color: ", ";\n\n > span:first-of-type {\n display: inherit;\n margin-right: ", ";\n }\n\n > span:last-of-type {\n display: inherit;\n margin-left: ", ";\n }\n\n .MuiCircularProgress-root {\n width: 16px !important;\n height: 16px !important;\n transform: translate(-50%, -50%);\n position: absolute;\n\n color: ", ";\n }\n"], ["\n pointer-events: ", ";\n color: ", ";\n\n > span:first-of-type {\n display: inherit;\n margin-right: ", ";\n }\n\n > span:last-of-type {\n display: inherit;\n margin-left: ", ";\n }\n\n .MuiCircularProgress-root {\n width: 16px !important;\n height: 16px !important;\n transform: translate(-50%, -50%);\n position: absolute;\n\n color: ", ";\n }\n"])), function (_a) {
|
|
18
|
+
var loading = _a.loading;
|
|
19
|
+
return (loading ? 'none' : 'inherit');
|
|
20
|
+
}, function (_a) {
|
|
21
|
+
var loading = _a.loading;
|
|
22
|
+
return loading && 'transparent';
|
|
23
|
+
}, function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return theme.spacing(2);
|
|
26
|
+
}, function (_a) {
|
|
27
|
+
var theme = _a.theme;
|
|
28
|
+
return theme.spacing(2);
|
|
29
|
+
}, getProgressColor);
|
|
30
|
+
var templateObject_1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { ButtonColors, ButtonVariants } from './constants';
|
|
25
|
+
import { StyledButtonBase } from './styled';
|
|
26
|
+
export var ButtonBase = function (_a) {
|
|
27
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? ButtonVariants.CONTAINED : _b, _c = _a.color, color = _c === void 0 ? ButtonColors.PRIMARY : _c, props = __rest(_a, ["children", "variant", "color"]);
|
|
28
|
+
return (_jsx(StyledButtonBase, __assign({}, props, { customColor: color, customVariant: variant }, { children: children }), void 0));
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum ButtonColors {
|
|
2
|
+
ERROR = "error",
|
|
3
|
+
SUCCESS = "success",
|
|
4
|
+
WARNING = "warning",
|
|
5
|
+
PRIMARY = "primary"
|
|
6
|
+
}
|
|
7
|
+
export declare enum ButtonVariants {
|
|
8
|
+
CONTAINED = "contained",
|
|
9
|
+
LIGHT = "light",
|
|
10
|
+
TEXT = "text",
|
|
11
|
+
LINK = "link"
|
|
12
|
+
}
|
|
13
|
+
export declare enum ButtonSizes {
|
|
14
|
+
MEDIUM = "medium",
|
|
15
|
+
LARGE = "large"
|
|
16
|
+
}
|
|
17
|
+
export declare enum ButtonStates {
|
|
18
|
+
DEFAULT = "default",
|
|
19
|
+
ACTIVE = "active",
|
|
20
|
+
FOCUS = "focus",
|
|
21
|
+
HOVER = "hover"
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export var ButtonColors;
|
|
2
|
+
(function (ButtonColors) {
|
|
3
|
+
ButtonColors["ERROR"] = "error";
|
|
4
|
+
ButtonColors["SUCCESS"] = "success";
|
|
5
|
+
ButtonColors["WARNING"] = "warning";
|
|
6
|
+
ButtonColors["PRIMARY"] = "primary";
|
|
7
|
+
})(ButtonColors || (ButtonColors = {}));
|
|
8
|
+
export var ButtonVariants;
|
|
9
|
+
(function (ButtonVariants) {
|
|
10
|
+
ButtonVariants["CONTAINED"] = "contained";
|
|
11
|
+
ButtonVariants["LIGHT"] = "light";
|
|
12
|
+
ButtonVariants["TEXT"] = "text";
|
|
13
|
+
ButtonVariants["LINK"] = "link";
|
|
14
|
+
})(ButtonVariants || (ButtonVariants = {}));
|
|
15
|
+
export var ButtonSizes;
|
|
16
|
+
(function (ButtonSizes) {
|
|
17
|
+
ButtonSizes["MEDIUM"] = "medium";
|
|
18
|
+
ButtonSizes["LARGE"] = "large";
|
|
19
|
+
})(ButtonSizes || (ButtonSizes = {}));
|
|
20
|
+
export var ButtonStates;
|
|
21
|
+
(function (ButtonStates) {
|
|
22
|
+
ButtonStates["DEFAULT"] = "default";
|
|
23
|
+
ButtonStates["ACTIVE"] = "active";
|
|
24
|
+
ButtonStates["FOCUS"] = "focus";
|
|
25
|
+
ButtonStates["HOVER"] = "hover";
|
|
26
|
+
})(ButtonStates || (ButtonStates = {}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Palette, Theme } from '../theme';
|
|
3
|
+
import { BaseButtonProps, ButtonColor, ButtonSize, ButtonState, ButtonVariant } from './types';
|
|
4
|
+
declare type StyledButtonBaseThemeProps = {
|
|
5
|
+
customColor?: ButtonColor;
|
|
6
|
+
customVariant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
theme: Theme;
|
|
9
|
+
};
|
|
10
|
+
export declare const getColor: ({ theme, customVariant, customColor, buttonState, }: StyledButtonBaseThemeProps & {
|
|
11
|
+
buttonState: ButtonState;
|
|
12
|
+
}) => string;
|
|
13
|
+
export declare const getBgText: ({ palette, buttonState, colorVariant, }: {
|
|
14
|
+
palette: Palette;
|
|
15
|
+
buttonState: ButtonState;
|
|
16
|
+
colorVariant: string;
|
|
17
|
+
}) => string;
|
|
18
|
+
export declare const getBgColor: ({ customColor, customVariant, buttonState, theme, }: StyledButtonBaseThemeProps & {
|
|
19
|
+
buttonState: ButtonState;
|
|
20
|
+
}) => string;
|
|
21
|
+
export declare const getButtonHeight: ({ size, }: StyledButtonBaseThemeProps) => string;
|
|
22
|
+
export declare const getButtonPadding: ({ size, theme, }: StyledButtonBaseThemeProps) => string;
|
|
23
|
+
export declare const getDisabledBgColor: ({ theme, customVariant, }: StyledButtonBaseThemeProps) => string;
|
|
24
|
+
export declare const StyledButtonBase: import("@emotion/styled").StyledComponent<Pick<import("@mui/base/ButtonUnstyled").ButtonUnstyledOwnProps & Omit<any, keyof import("@mui/base/ButtonUnstyled").ButtonUnstyledOwnProps> & {
|
|
25
|
+
component?: import("react").ElementType<any> | undefined;
|
|
26
|
+
}, string | number | symbol> & import("react").RefAttributes<any> & {
|
|
27
|
+
theme?: Theme | undefined;
|
|
28
|
+
} & Omit<BaseButtonProps, "color" | "variant"> & {
|
|
29
|
+
customColor?: "primary" | "error" | "warning" | "success" | undefined;
|
|
30
|
+
customVariant?: "link" | "light" | "text" | "contained" | undefined;
|
|
31
|
+
}, {}, {}>;
|
|
32
|
+
export {};
|