@astral/ui 1.9.1 → 1.10.0
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/Button/Button.js +4 -4
- package/Button/styles.d.ts +72 -0
- package/Button/styles.js +19 -0
- package/ButtonBase/ButtonBase.js +4 -4
- package/ButtonBase/enums.d.ts +23 -0
- package/ButtonBase/{constants.js → enums.js} +15 -14
- package/ButtonBase/index.d.ts +1 -1
- package/ButtonBase/index.js +1 -1
- package/{esm/ButtonBase/styled.d.ts → ButtonBase/styles.d.ts} +10 -8
- package/ButtonBase/{styled.js → styles.js} +43 -24
- package/ButtonBase/types.d.ts +1 -1
- package/GlobalStyles/GlobalStyles.js +8 -3
- package/IconButton/IconButton.js +1 -1
- package/IconButton/styles.d.ts +4 -3
- package/IconButton/styles.js +18 -7
- package/esm/Button/Button.js +4 -4
- package/esm/Button/styles.d.ts +72 -0
- package/esm/Button/styles.js +16 -0
- package/esm/ButtonBase/ButtonBase.js +4 -4
- package/esm/ButtonBase/enums.d.ts +23 -0
- package/esm/ButtonBase/enums.js +27 -0
- package/esm/ButtonBase/index.d.ts +1 -1
- package/esm/ButtonBase/index.js +1 -1
- package/{ButtonBase/styled.d.ts → esm/ButtonBase/styles.d.ts} +10 -8
- package/esm/ButtonBase/{styled.js → styles.js} +40 -23
- package/esm/ButtonBase/types.d.ts +1 -1
- package/esm/GlobalStyles/GlobalStyles.js +8 -3
- package/esm/IconButton/IconButton.js +2 -2
- package/esm/IconButton/styles.d.ts +4 -3
- package/esm/IconButton/styles.js +15 -5
- package/esm/theme/components/MuiButton.js +9 -9
- package/esm/theme/components/MuiLoadingButton.js +2 -2
- package/package.json +2 -2
- package/theme/components/MuiButton.js +20 -20
- package/theme/components/MuiLoadingButton.js +3 -3
- package/ButtonBase/constants.d.ts +0 -22
- package/esm/ButtonBase/constants.d.ts +0 -22
- package/esm/ButtonBase/constants.js +0 -26
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const LoadingButtonWrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
classes?: (Partial<import("@mui/material").ButtonClasses> & {
|
|
4
|
+
root?: string | undefined;
|
|
5
|
+
loading?: string | undefined;
|
|
6
|
+
loadingIndicator?: string | undefined;
|
|
7
|
+
loadingIndicatorCenter?: string | undefined;
|
|
8
|
+
loadingIndicatorStart?: string | undefined;
|
|
9
|
+
loadingIndicatorEnd?: string | undefined;
|
|
10
|
+
endIconLoadingEnd?: string | undefined;
|
|
11
|
+
startIconLoadingStart?: string | undefined;
|
|
12
|
+
}) | undefined;
|
|
13
|
+
loading?: boolean | undefined;
|
|
14
|
+
loadingIndicator?: import("react").ReactNode;
|
|
15
|
+
loadingPosition?: "center" | "end" | "start" | undefined;
|
|
16
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
17
|
+
} & Omit<{
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
20
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableElevation?: boolean | undefined;
|
|
23
|
+
disableFocusRipple?: boolean | undefined;
|
|
24
|
+
endIcon?: import("react").ReactNode;
|
|
25
|
+
fullWidth?: boolean | undefined;
|
|
26
|
+
href?: string | undefined;
|
|
27
|
+
size?: "large" | "medium" | "small" | undefined;
|
|
28
|
+
startIcon?: import("react").ReactNode;
|
|
29
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
30
|
+
variant?: "link" | "light" | "outlined" | "text" | "contained" | undefined;
|
|
31
|
+
} & Omit<{
|
|
32
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
33
|
+
centerRipple?: boolean | undefined;
|
|
34
|
+
children?: import("react").ReactNode;
|
|
35
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
36
|
+
disabled?: boolean | undefined;
|
|
37
|
+
disableRipple?: boolean | undefined;
|
|
38
|
+
disableTouchRipple?: boolean | undefined;
|
|
39
|
+
focusRipple?: boolean | undefined;
|
|
40
|
+
focusVisibleClassName?: string | undefined;
|
|
41
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
42
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
43
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
44
|
+
tabIndex?: number | undefined;
|
|
45
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
46
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
47
|
+
}, "classes">, "classes"> & Omit<{
|
|
48
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
49
|
+
centerRipple?: boolean | undefined;
|
|
50
|
+
children?: import("react").ReactNode;
|
|
51
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
52
|
+
disabled?: boolean | undefined;
|
|
53
|
+
disableRipple?: boolean | undefined;
|
|
54
|
+
disableTouchRipple?: boolean | undefined;
|
|
55
|
+
focusRipple?: boolean | undefined;
|
|
56
|
+
focusVisibleClassName?: string | undefined;
|
|
57
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
58
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
59
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
60
|
+
tabIndex?: number | undefined;
|
|
61
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
62
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
63
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | "css" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
64
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
65
|
+
}, "disabled" | "action" | "color" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon" | "loading" | "loadingIndicator" | "loadingPosition"> & {
|
|
66
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
67
|
+
} & Omit<import("@mui/lab").LoadingButtonProps<"button", {}>, "color" | "variant"> & {
|
|
68
|
+
variant?: "link" | "light" | "text" | "contained" | undefined;
|
|
69
|
+
color?: "primary" | "error" | "warning" | "success" | undefined;
|
|
70
|
+
component?: import("react").ElementType<any> | undefined;
|
|
71
|
+
selected?: boolean | undefined;
|
|
72
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { LoadingButton } from '@mui/lab';
|
|
6
|
+
import { styled } from '../styles';
|
|
7
|
+
import { getButtonHeightMobile, getButtonPaddingMobile, } from '../ButtonBase/styles';
|
|
8
|
+
export var LoadingButtonWrapper = styled(LoadingButton, {
|
|
9
|
+
shouldForwardProp: function (prop) {
|
|
10
|
+
return prop !== 'customColor' && prop !== 'customVariant';
|
|
11
|
+
},
|
|
12
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " {\n height: ", ";\n padding: ", ";\n\n white-space: nowrap;\n }\n"], ["\n ", " {\n height: ", ";\n padding: ", ";\n\n white-space: nowrap;\n }\n"])), function (_a) {
|
|
13
|
+
var theme = _a.theme;
|
|
14
|
+
return theme.breakpoints.down('sm');
|
|
15
|
+
}, getButtonHeightMobile, getButtonPaddingMobile);
|
|
16
|
+
var templateObject_1;
|
|
@@ -22,9 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import { forwardRef } from 'react';
|
|
25
|
-
import { ButtonColors, ButtonVariants } from './
|
|
26
|
-
import {
|
|
25
|
+
import { ButtonColors, ButtonVariants } from './enums';
|
|
26
|
+
import { ButtonBaseWrapper } from './styles';
|
|
27
27
|
export var ButtonBase = forwardRef(function (_a, ref) {
|
|
28
|
-
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? ButtonVariants.
|
|
29
|
-
return (_jsx(
|
|
28
|
+
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"]);
|
|
29
|
+
return (_jsx(ButtonBaseWrapper, __assign({ ref: ref }, props, { customColor: color, customVariant: variant }, { children: children })));
|
|
30
30
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
Small = "small",
|
|
15
|
+
Medium = "medium",
|
|
16
|
+
Large = "large"
|
|
17
|
+
}
|
|
18
|
+
export declare enum ButtonStates {
|
|
19
|
+
Default = "default",
|
|
20
|
+
Active = "active",
|
|
21
|
+
Focus = "focus",
|
|
22
|
+
Hover = "hover"
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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["Small"] = "small";
|
|
18
|
+
ButtonSizes["Medium"] = "medium";
|
|
19
|
+
ButtonSizes["Large"] = "large";
|
|
20
|
+
})(ButtonSizes || (ButtonSizes = {}));
|
|
21
|
+
export var ButtonStates;
|
|
22
|
+
(function (ButtonStates) {
|
|
23
|
+
ButtonStates["Default"] = "default";
|
|
24
|
+
ButtonStates["Active"] = "active";
|
|
25
|
+
ButtonStates["Focus"] = "focus";
|
|
26
|
+
ButtonStates["Hover"] = "hover";
|
|
27
|
+
})(ButtonStates || (ButtonStates = {}));
|
package/esm/ButtonBase/index.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Theme } from '../theme';
|
|
3
3
|
import { BaseButtonProps, ButtonColor, ButtonSize, ButtonState, ButtonVariant } from './types';
|
|
4
|
-
export declare type
|
|
4
|
+
export declare type ButtonBaseWrapperProps = Omit<BaseButtonProps, 'color' | 'variant'> & {
|
|
5
5
|
customColor?: ButtonColor;
|
|
6
6
|
customVariant?: ButtonVariant;
|
|
7
7
|
};
|
|
8
|
-
export declare type
|
|
8
|
+
export declare type ButtonBaseWrapperThemeProps = {
|
|
9
9
|
customColor?: ButtonColor;
|
|
10
10
|
customVariant?: ButtonVariant;
|
|
11
11
|
selected?: boolean;
|
|
12
12
|
size?: ButtonSize;
|
|
13
13
|
theme: Theme;
|
|
14
14
|
};
|
|
15
|
-
export declare const getColor: ({ theme, customVariant, customColor, buttonState, selected, }:
|
|
15
|
+
export declare const getColor: ({ theme, customVariant, customColor, buttonState, selected, }: ButtonBaseWrapperThemeProps & {
|
|
16
16
|
buttonState: ButtonState;
|
|
17
17
|
}) => string;
|
|
18
|
-
export declare const getBgColor: ({ selected, customColor, customVariant, buttonState, theme, }:
|
|
18
|
+
export declare const getBgColor: ({ selected, customColor, customVariant, buttonState, theme, }: ButtonBaseWrapperThemeProps & {
|
|
19
19
|
buttonState: ButtonState;
|
|
20
20
|
}) => string;
|
|
21
|
-
export declare const getButtonHeight: ({ size, }:
|
|
22
|
-
export declare const getButtonPadding: ({ size, theme, }:
|
|
23
|
-
export declare const getDisabledBgColor: ({ theme, customVariant, }:
|
|
24
|
-
export declare const
|
|
21
|
+
export declare const getButtonHeight: ({ size, }: ButtonBaseWrapperThemeProps) => string;
|
|
22
|
+
export declare const getButtonPadding: ({ size, theme, }: ButtonBaseWrapperThemeProps) => string;
|
|
23
|
+
export declare const getDisabledBgColor: ({ theme, customVariant, }: ButtonBaseWrapperThemeProps) => string;
|
|
24
|
+
export declare const getButtonPaddingMobile: ({ size, theme, }: ButtonBaseWrapperThemeProps) => string;
|
|
25
|
+
export declare const getButtonHeightMobile: ({ size, }: ButtonBaseWrapperThemeProps) => string;
|
|
26
|
+
export declare const ButtonBaseWrapper: import("@emotion/styled").StyledComponent<Pick<import("@mui/base/ButtonUnstyled").ButtonUnstyledOwnProps & Omit<any, keyof import("@mui/base/ButtonUnstyled").ButtonUnstyledOwnProps> & {
|
|
25
27
|
component?: import("react").ElementType<any> | undefined;
|
|
26
28
|
}, string | number | symbol> & import("react").RefAttributes<any> & {
|
|
27
29
|
theme?: import("@emotion/react").Theme | undefined;
|
|
@@ -15,7 +15,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
15
15
|
};
|
|
16
16
|
import ButtonUnstyled, { buttonUnstyledClasses, } from '@mui/base/ButtonUnstyled';
|
|
17
17
|
import { styled } from '../styles';
|
|
18
|
-
import { ButtonSizes, ButtonStates, ButtonVariants } from './
|
|
18
|
+
import { ButtonSizes, ButtonStates, ButtonVariants } from './enums';
|
|
19
19
|
export var getColor = function (_a) {
|
|
20
20
|
var theme = _a.theme, customVariant = _a.customVariant, customColor = _a.customColor, buttonState = _a.buttonState, selected = _a.selected;
|
|
21
21
|
var textColorVariants = {
|
|
@@ -66,17 +66,17 @@ export var getColor = function (_a) {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
if (selected) {
|
|
69
|
-
return customVariant !== ButtonVariants.
|
|
69
|
+
return customVariant !== ButtonVariants.Link
|
|
70
70
|
? theme.palette.primary.contrastText
|
|
71
71
|
: textColorVariants.selected[buttonState];
|
|
72
72
|
}
|
|
73
|
-
if (customVariant === ButtonVariants.
|
|
73
|
+
if (customVariant === ButtonVariants.Contained) {
|
|
74
74
|
return textColorVariants.contained;
|
|
75
75
|
}
|
|
76
|
-
if (customVariant === ButtonVariants.
|
|
76
|
+
if (customVariant === ButtonVariants.Light && customColor) {
|
|
77
77
|
return textColorVariants.light[customColor][buttonState];
|
|
78
78
|
}
|
|
79
|
-
if (customVariant === ButtonVariants.
|
|
79
|
+
if (customVariant === ButtonVariants.Text) {
|
|
80
80
|
return textColorVariants.text[buttonState];
|
|
81
81
|
}
|
|
82
82
|
return textColorVariants.link[buttonState];
|
|
@@ -150,48 +150,65 @@ export var getBgColor = function (_a) {
|
|
|
150
150
|
},
|
|
151
151
|
link: 'transparent',
|
|
152
152
|
};
|
|
153
|
-
if (selected && customVariant !== ButtonVariants.
|
|
153
|
+
if (selected && customVariant !== ButtonVariants.Link) {
|
|
154
154
|
return bgColorVariants.selected[buttonState];
|
|
155
155
|
}
|
|
156
|
-
if (customVariant === ButtonVariants.
|
|
156
|
+
if (customVariant === ButtonVariants.Light && customColor) {
|
|
157
157
|
return bgColorVariants.light[customColor][buttonState];
|
|
158
158
|
}
|
|
159
|
-
if (customVariant === ButtonVariants.
|
|
159
|
+
if (customVariant === ButtonVariants.Contained && customColor) {
|
|
160
160
|
return bgColorVariants.contained[customColor][buttonState];
|
|
161
161
|
}
|
|
162
|
-
if (customVariant === ButtonVariants.
|
|
162
|
+
if (customVariant === ButtonVariants.Text) {
|
|
163
163
|
return bgColorVariants.text[buttonState];
|
|
164
164
|
}
|
|
165
165
|
return bgColorVariants.link;
|
|
166
166
|
};
|
|
167
167
|
export var getButtonHeight = function (_a) {
|
|
168
168
|
var size = _a.size;
|
|
169
|
-
if (size === ButtonSizes.
|
|
169
|
+
if (size === ButtonSizes.Large) {
|
|
170
170
|
return '40px';
|
|
171
171
|
}
|
|
172
172
|
return '32px';
|
|
173
173
|
};
|
|
174
174
|
export var getButtonPadding = function (_a) {
|
|
175
175
|
var size = _a.size, theme = _a.theme;
|
|
176
|
-
if (size === ButtonSizes.
|
|
176
|
+
if (size === ButtonSizes.Large) {
|
|
177
177
|
return theme.spacing(2, 4, 2, 4);
|
|
178
178
|
}
|
|
179
179
|
return theme.spacing(1, 3, 1, 3);
|
|
180
180
|
};
|
|
181
181
|
export var getDisabledBgColor = function (_a) {
|
|
182
182
|
var theme = _a.theme, customVariant = _a.customVariant;
|
|
183
|
-
if (customVariant === ButtonVariants.
|
|
184
|
-
customVariant === ButtonVariants.
|
|
183
|
+
if (customVariant === ButtonVariants.Link ||
|
|
184
|
+
customVariant === ButtonVariants.Text) {
|
|
185
185
|
return 'transparent';
|
|
186
186
|
}
|
|
187
187
|
return theme.palette.grey['100'];
|
|
188
188
|
};
|
|
189
|
-
export var
|
|
189
|
+
export var getButtonPaddingMobile = function (_a) {
|
|
190
|
+
var size = _a.size, theme = _a.theme;
|
|
191
|
+
if (size === ButtonSizes.Small) {
|
|
192
|
+
return theme.spacing(2, 3);
|
|
193
|
+
}
|
|
194
|
+
return theme.spacing(4, 3);
|
|
195
|
+
};
|
|
196
|
+
export var getButtonHeightMobile = function (_a) {
|
|
197
|
+
var size = _a.size;
|
|
198
|
+
if (size === ButtonSizes.Small) {
|
|
199
|
+
return '32px';
|
|
200
|
+
}
|
|
201
|
+
return '48px';
|
|
202
|
+
};
|
|
203
|
+
export var ButtonBaseWrapper = styled(ButtonUnstyled, {
|
|
190
204
|
shouldForwardProp: function (prop) {
|
|
191
205
|
return prop !== 'customColor' && prop !== 'customVariant';
|
|
192
206
|
},
|
|
193
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: ", ";\n padding: ", ";\n\n color: ", ";\n font-weight: ", ";\n font-size: ", ";\n font-family: Ubuntu, serif;\n\n background-color: ", ";\n border: none;\n border-radius: ", ";\n cursor: pointer;\n\n &:hover {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:focus {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n\n background-color: ", ";\n outline: none;\n }\n\n &.", " {\n color: ", ";\n\n background-color: ", ";\n cursor: unset;\n }\n\n &.", " {\n outline: 2px solid ", ";\n }\n"], ["\n position: relative;\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: ", ";\n padding: ", ";\n\n color: ", ";\n font-weight: ", ";\n font-size: ", ";\n font-family: Ubuntu, serif;\n\n background-color: ", ";\n border: none;\n border-radius: ", ";\n cursor: pointer;\n\n &:hover {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:focus {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n\n background-color: ", ";\n outline: none;\n }\n\n &.", " {\n color: ", ";\n\n background-color: ", ";\n cursor: unset;\n }\n\n &.", " {\n outline: 2px solid ", ";\n }\n"])), getButtonHeight, getButtonPadding, function (
|
|
194
|
-
|
|
207
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: ", ";\n padding: ", ";\n\n ", " {\n height: ", ";\n padding: ", ";\n }\n\n color: ", ";\n font-weight: ", ";\n font-size: ", ";\n font-family: Ubuntu, serif;\n\n background-color: ", ";\n\n border: none;\n border-radius: ", ";\n cursor: pointer;\n\n &:hover {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:focus {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n\n background-color: ", ";\n outline: none;\n }\n\n &.", " {\n color: ", ";\n\n background-color: ", ";\n cursor: unset;\n }\n\n &.", " {\n outline: 2px solid ", ";\n }\n"], ["\n position: relative;\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: ", ";\n padding: ", ";\n\n ", " {\n height: ", ";\n padding: ", ";\n }\n\n color: ", ";\n font-weight: ", ";\n font-size: ", ";\n font-family: Ubuntu, serif;\n\n background-color: ", ";\n\n border: none;\n border-radius: ", ";\n cursor: pointer;\n\n &:hover {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:focus {\n color: ", ";\n\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n\n background-color: ", ";\n outline: none;\n }\n\n &.", " {\n color: ", ";\n\n background-color: ", ";\n cursor: unset;\n }\n\n &.", " {\n outline: 2px solid ", ";\n }\n"])), getButtonHeight, getButtonPadding, function (_a) {
|
|
208
|
+
var theme = _a.theme;
|
|
209
|
+
return theme.breakpoints.down('sm');
|
|
210
|
+
}, getButtonHeightMobile, getButtonPaddingMobile, function (props) {
|
|
211
|
+
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.Default }));
|
|
195
212
|
}, function (_a) {
|
|
196
213
|
var theme = _a.theme;
|
|
197
214
|
return theme.typography.button.fontWeight;
|
|
@@ -199,22 +216,22 @@ export var StyledButtonBase = styled(ButtonUnstyled, {
|
|
|
199
216
|
var theme = _a.theme;
|
|
200
217
|
return theme.typography.button.fontSize;
|
|
201
218
|
}, function (props) {
|
|
202
|
-
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
219
|
+
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.Default }));
|
|
203
220
|
}, function (_a) {
|
|
204
221
|
var theme = _a.theme;
|
|
205
222
|
return theme.shape.small;
|
|
206
223
|
}, function (props) {
|
|
207
|
-
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
224
|
+
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.Hover }));
|
|
208
225
|
}, function (props) {
|
|
209
|
-
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
226
|
+
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.Hover }));
|
|
210
227
|
}, function (props) {
|
|
211
|
-
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
228
|
+
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.Focus }));
|
|
212
229
|
}, function (props) {
|
|
213
|
-
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
230
|
+
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.Focus }));
|
|
214
231
|
}, function (props) {
|
|
215
|
-
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
232
|
+
return getColor(__assign(__assign({}, props), { buttonState: ButtonStates.Active }));
|
|
216
233
|
}, function (props) {
|
|
217
|
-
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.
|
|
234
|
+
return getBgColor(__assign(__assign({}, props), { buttonState: ButtonStates.Active }));
|
|
218
235
|
}, buttonUnstyledClasses.disabled, function (_a) {
|
|
219
236
|
var theme = _a.theme;
|
|
220
237
|
return theme.palette.grey['500'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ButtonUnstyledProps } from '@mui/base/ButtonUnstyled';
|
|
2
|
-
import { ButtonColors, ButtonSizes, ButtonStates, ButtonVariants } from './
|
|
2
|
+
import { ButtonColors, ButtonSizes, ButtonStates, ButtonVariants } from './enums';
|
|
3
3
|
export declare type ButtonColor = `${ButtonColors}`;
|
|
4
4
|
export declare type ButtonVariant = `${ButtonVariants}`;
|
|
5
5
|
export declare type ButtonSize = `${ButtonSizes}`;
|
|
@@ -25,12 +25,17 @@ import { Global } from '@emotion/react';
|
|
|
25
25
|
import { CssBaseline } from '@mui/material';
|
|
26
26
|
import { useTheme } from '../theme';
|
|
27
27
|
export var GlobalStyles = function (_a) {
|
|
28
|
+
var _b;
|
|
28
29
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
29
30
|
var theme = useTheme();
|
|
30
31
|
return (_jsxs(_Fragment, { children: [_jsx(CssBaseline, __assign({}, props, { children: children })), _jsx(Global, { styles: {
|
|
31
|
-
html: {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
html: (_b = {
|
|
33
|
+
fontSize: theme.typography.htmlFontSize
|
|
34
|
+
},
|
|
35
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
36
|
+
fontSize: 16,
|
|
37
|
+
},
|
|
38
|
+
_b),
|
|
34
39
|
'*': {
|
|
35
40
|
scrollbarWidth: 'thin',
|
|
36
41
|
},
|
|
@@ -22,8 +22,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import { forwardRef } from 'react';
|
|
25
|
-
import {
|
|
25
|
+
import { IconButtonWrapper } from './styles';
|
|
26
26
|
export var IconButton = forwardRef(function (_a, ref) {
|
|
27
27
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
28
|
-
return (_jsx(
|
|
28
|
+
return (_jsx(IconButtonWrapper, __assign({}, props, { ref: ref }, { children: children })));
|
|
29
29
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Theme } from '../theme';
|
|
3
3
|
import { ButtonProps } from '../Button';
|
|
4
|
-
declare type
|
|
4
|
+
declare type IconButtonWrapperThemeProps = ButtonProps & {
|
|
5
5
|
theme: Theme;
|
|
6
6
|
};
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
7
|
+
export declare const getButtonSize: ({ size, }: IconButtonWrapperThemeProps) => string;
|
|
8
|
+
export declare const getButtonSizeMobile: ({ size, }: IconButtonWrapperThemeProps) => string;
|
|
9
|
+
export declare const IconButtonWrapper: import("@emotion/styled").StyledComponent<Pick<import("../ButtonBase").BaseButtonProps, "color" | "translate" | keyof import("@mui/base").ButtonUnstyledOwnProps | "form" | "slot" | "style" | "title" | "key" | "css" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "size" | "component" | "selected"> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
9
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
11
|
} & Omit<import("@mui/lab").LoadingButtonProps<"button", {}>, "color" | "variant"> & {
|
|
11
12
|
variant?: "link" | "light" | "text" | "contained" | undefined;
|
package/esm/IconButton/styles.js
CHANGED
|
@@ -4,19 +4,29 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import { styled } from '../styles';
|
|
6
6
|
import { ButtonBase, ButtonSizes } from '../ButtonBase';
|
|
7
|
-
export var
|
|
7
|
+
export var getButtonSize = function (_a) {
|
|
8
8
|
var size = _a.size;
|
|
9
|
-
if (size === ButtonSizes.
|
|
9
|
+
if (size === ButtonSizes.Large) {
|
|
10
10
|
return '40px';
|
|
11
11
|
}
|
|
12
12
|
return '32px';
|
|
13
13
|
};
|
|
14
|
-
export var
|
|
14
|
+
export var getButtonSizeMobile = function (_a) {
|
|
15
|
+
var size = _a.size;
|
|
16
|
+
if (size === ButtonSizes.Small) {
|
|
17
|
+
return '36px';
|
|
18
|
+
}
|
|
19
|
+
return '48px';
|
|
20
|
+
};
|
|
21
|
+
export var IconButtonWrapper = styled(ButtonBase, {
|
|
15
22
|
shouldForwardProp: function (prop) {
|
|
16
23
|
return prop !== 'startIcon' && prop !== 'endIcon' && prop !== 'loading';
|
|
17
24
|
},
|
|
18
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n padding: ", ";\n"], ["\n width: ", ";\n height: ", ";\n padding: ", ";\n"])),
|
|
25
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n padding: ", ";\n\n ", " {\n width: ", ";\n height: ", ";\n }\n"], ["\n width: ", ";\n height: ", ";\n padding: ", ";\n\n ", " {\n width: ", ";\n height: ", ";\n }\n"])), getButtonSize, getButtonSize, function (_a) {
|
|
19
26
|
var theme = _a.theme;
|
|
20
27
|
return theme.spacing(1);
|
|
21
|
-
})
|
|
28
|
+
}, function (_a) {
|
|
29
|
+
var theme = _a.theme;
|
|
30
|
+
return theme.breakpoints.down('sm');
|
|
31
|
+
}, getButtonSizeMobile, getButtonSizeMobile);
|
|
22
32
|
var templateObject_1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ButtonStates } from '../../ButtonBase';
|
|
2
|
-
import { getBgColor, getButtonHeight, getButtonPadding, getColor, getDisabledBgColor, } from '../../ButtonBase/
|
|
2
|
+
import { getBgColor, getButtonHeight, getButtonPadding, getColor, getDisabledBgColor, } from '../../ButtonBase/styles';
|
|
3
3
|
export var MuiButton = {
|
|
4
4
|
defaultProps: {
|
|
5
5
|
disableRipple: true,
|
|
@@ -18,13 +18,13 @@ export var MuiButton = {
|
|
|
18
18
|
theme: theme,
|
|
19
19
|
customVariant: customVariant,
|
|
20
20
|
customColor: customColor,
|
|
21
|
-
buttonState: ButtonStates.
|
|
21
|
+
buttonState: ButtonStates.Default,
|
|
22
22
|
}),
|
|
23
23
|
backgroundColor: getBgColor({
|
|
24
24
|
selected: selected,
|
|
25
25
|
customColor: customColor,
|
|
26
26
|
customVariant: customVariant,
|
|
27
|
-
buttonState: ButtonStates.
|
|
27
|
+
buttonState: ButtonStates.Default,
|
|
28
28
|
theme: theme,
|
|
29
29
|
}),
|
|
30
30
|
height: getButtonHeight({
|
|
@@ -47,14 +47,14 @@ export var MuiButton = {
|
|
|
47
47
|
theme: theme,
|
|
48
48
|
customVariant: customVariant,
|
|
49
49
|
customColor: customColor,
|
|
50
|
-
buttonState: ButtonStates.
|
|
50
|
+
buttonState: ButtonStates.Hover,
|
|
51
51
|
}),
|
|
52
52
|
backgroundColor: getBgColor({
|
|
53
53
|
selected: selected,
|
|
54
54
|
customColor: customColor,
|
|
55
55
|
customVariant: customVariant,
|
|
56
56
|
theme: theme,
|
|
57
|
-
buttonState: ButtonStates.
|
|
57
|
+
buttonState: ButtonStates.Hover,
|
|
58
58
|
}),
|
|
59
59
|
boxShadow: 'none',
|
|
60
60
|
},
|
|
@@ -64,14 +64,14 @@ export var MuiButton = {
|
|
|
64
64
|
customColor: customColor,
|
|
65
65
|
customVariant: customVariant,
|
|
66
66
|
theme: theme,
|
|
67
|
-
buttonState: ButtonStates.
|
|
67
|
+
buttonState: ButtonStates.Active,
|
|
68
68
|
}),
|
|
69
69
|
backgroundColor: getBgColor({
|
|
70
70
|
selected: selected,
|
|
71
71
|
customColor: customColor,
|
|
72
72
|
customVariant: customVariant,
|
|
73
73
|
theme: theme,
|
|
74
|
-
buttonState: ButtonStates.
|
|
74
|
+
buttonState: ButtonStates.Active,
|
|
75
75
|
}),
|
|
76
76
|
outline: 'none',
|
|
77
77
|
},
|
|
@@ -88,14 +88,14 @@ export var MuiButton = {
|
|
|
88
88
|
theme: theme,
|
|
89
89
|
customVariant: customVariant,
|
|
90
90
|
customColor: customColor,
|
|
91
|
-
buttonState: ButtonStates.
|
|
91
|
+
buttonState: ButtonStates.Focus,
|
|
92
92
|
}),
|
|
93
93
|
backgroundColor: getBgColor({
|
|
94
94
|
selected: selected,
|
|
95
95
|
customColor: customColor,
|
|
96
96
|
customVariant: customVariant,
|
|
97
97
|
theme: theme,
|
|
98
|
-
buttonState: ButtonStates.
|
|
98
|
+
buttonState: ButtonStates.Focus,
|
|
99
99
|
}),
|
|
100
100
|
outline: "2px solid ".concat(theme.palette.primary['400']),
|
|
101
101
|
boxShadow: 'none',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { loadingButtonClasses } from '@mui/lab';
|
|
2
2
|
import { ButtonStates } from '../../ButtonBase';
|
|
3
|
-
import { getBgColor } from '../../ButtonBase/
|
|
3
|
+
import { getBgColor } from '../../ButtonBase/styles';
|
|
4
4
|
export var MuiLoadingButton = {
|
|
5
5
|
defaultProps: {
|
|
6
6
|
disableRipple: true,
|
|
@@ -17,7 +17,7 @@ export var MuiLoadingButton = {
|
|
|
17
17
|
customColor: customColor,
|
|
18
18
|
customVariant: customVariant,
|
|
19
19
|
theme: theme,
|
|
20
|
-
buttonState: ButtonStates.
|
|
20
|
+
buttonState: ButtonStates.Default,
|
|
21
21
|
}),
|
|
22
22
|
},
|
|
23
23
|
_b;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astral/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"browser": "./src/index.ts",
|
|
5
5
|
"jest": {
|
|
6
6
|
"moduleNameMapper": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@astral/icons": "^1.
|
|
11
|
+
"@astral/icons": "^1.10.0",
|
|
12
12
|
"@emotion/cache": "11.7.1",
|
|
13
13
|
"@emotion/react": "11.9.0",
|
|
14
14
|
"@emotion/server": "11.4.0",
|