@astral/ui 1.6.1 → 1.7.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/Fab/Fab.d.ts +8 -0
- package/Fab/Fab.js +33 -0
- package/Fab/enums.d.ts +17 -0
- package/Fab/enums.js +23 -0
- package/Fab/index.d.ts +2 -0
- package/Fab/index.js +18 -0
- package/Fab/styles.d.ts +38 -0
- package/Fab/styles.js +84 -0
- package/Fab/types.d.ts +2 -0
- package/Fab/types.js +2 -0
- package/esm/Fab/Fab.d.ts +8 -0
- package/esm/Fab/Fab.js +30 -0
- package/esm/Fab/enums.d.ts +17 -0
- package/esm/Fab/enums.js +20 -0
- package/esm/Fab/index.d.ts +2 -0
- package/esm/Fab/index.js +2 -0
- package/esm/Fab/styles.d.ts +38 -0
- package/esm/Fab/styles.js +81 -0
- package/esm/Fab/types.d.ts +2 -0
- package/esm/Fab/types.js +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
package/Fab/Fab.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FabProps as MuiFabProps } from '@mui/material/Fab';
|
|
3
|
+
import { FabColor } from './types';
|
|
4
|
+
export declare type FabProps = Omit<MuiFabProps, 'color' | 'variant'> & {
|
|
5
|
+
color?: FabColor;
|
|
6
|
+
variant?: MuiFabProps['variant'] | 'square';
|
|
7
|
+
};
|
|
8
|
+
export declare const Fab: import("react").ForwardRefExoticComponent<Pick<FabProps, "disabled" | "action" | "color" | "translate" | "href" | "onFocusVisible" | "tabIndex" | "type" | "children" | "form" | "slot" | "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" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & import("react").RefAttributes<HTMLButtonElement>>;
|
package/Fab/Fab.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.Fab = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
var react_1 = require("react");
|
|
28
|
+
var styles_1 = require("./styles");
|
|
29
|
+
var enums_1 = require("./enums");
|
|
30
|
+
exports.Fab = (0, react_1.forwardRef)(function (_a) {
|
|
31
|
+
var ref = _a.ref, _b = _a.variant, variant = _b === void 0 ? 'square' : _b, _c = _a.size, size = _c === void 0 ? enums_1.FabSizes.Large : _c, _d = _a.color, color = _d === void 0 ? 'primary' : _d, props = __rest(_a, ["ref", "variant", "size", "color"]);
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledFab, __assign({}, props, { variant: variant === 'square' ? 'circular' : variant, isSquare: variant === 'square', size: size, color: color, ref: ref })));
|
|
33
|
+
});
|
package/Fab/enums.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum FabSizes {
|
|
2
|
+
Small = "small",
|
|
3
|
+
Medium = "medium",
|
|
4
|
+
Large = "large"
|
|
5
|
+
}
|
|
6
|
+
export declare enum FabStates {
|
|
7
|
+
Default = "default",
|
|
8
|
+
Hover = "hover",
|
|
9
|
+
Active = "active"
|
|
10
|
+
}
|
|
11
|
+
export declare enum FabColors {
|
|
12
|
+
Default = "default",
|
|
13
|
+
Primary = "primary",
|
|
14
|
+
Error = "error",
|
|
15
|
+
Success = "success",
|
|
16
|
+
Warning = "warning"
|
|
17
|
+
}
|
package/Fab/enums.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FabColors = exports.FabStates = exports.FabSizes = void 0;
|
|
4
|
+
var FabSizes;
|
|
5
|
+
(function (FabSizes) {
|
|
6
|
+
FabSizes["Small"] = "small";
|
|
7
|
+
FabSizes["Medium"] = "medium";
|
|
8
|
+
FabSizes["Large"] = "large";
|
|
9
|
+
})(FabSizes = exports.FabSizes || (exports.FabSizes = {}));
|
|
10
|
+
var FabStates;
|
|
11
|
+
(function (FabStates) {
|
|
12
|
+
FabStates["Default"] = "default";
|
|
13
|
+
FabStates["Hover"] = "hover";
|
|
14
|
+
FabStates["Active"] = "active";
|
|
15
|
+
})(FabStates = exports.FabStates || (exports.FabStates = {}));
|
|
16
|
+
var FabColors;
|
|
17
|
+
(function (FabColors) {
|
|
18
|
+
FabColors["Default"] = "default";
|
|
19
|
+
FabColors["Primary"] = "primary";
|
|
20
|
+
FabColors["Error"] = "error";
|
|
21
|
+
FabColors["Success"] = "success";
|
|
22
|
+
FabColors["Warning"] = "warning";
|
|
23
|
+
})(FabColors = exports.FabColors || (exports.FabColors = {}));
|
package/Fab/index.d.ts
ADDED
package/Fab/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Fab"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
package/Fab/styles.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledFab: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").FabClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "primary" | "secondary" | "default" | "error" | "warning" | "info" | "success" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableFocusRipple?: boolean | undefined;
|
|
8
|
+
disableRipple?: boolean | undefined;
|
|
9
|
+
href?: string | undefined;
|
|
10
|
+
size?: "large" | "medium" | "small" | undefined;
|
|
11
|
+
variant?: "circular" | "extended" | undefined;
|
|
12
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
13
|
+
} & Omit<{
|
|
14
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
15
|
+
centerRipple?: boolean | undefined;
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
18
|
+
disabled?: boolean | undefined;
|
|
19
|
+
disableRipple?: boolean | undefined;
|
|
20
|
+
disableTouchRipple?: boolean | undefined;
|
|
21
|
+
focusRipple?: boolean | undefined;
|
|
22
|
+
focusVisibleClassName?: string | undefined;
|
|
23
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
24
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
25
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
|
+
tabIndex?: number | undefined;
|
|
27
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
28
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
29
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | "css" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
30
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
31
|
+
}, "disabled" | "action" | "color" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
32
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
33
|
+
} & Omit<import("@mui/material").FabProps<"button", {}>, "color" | "variant"> & {
|
|
34
|
+
color?: "primary" | "default" | "error" | "warning" | "success" | undefined;
|
|
35
|
+
variant?: "square" | "circular" | "extended" | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
isSquare: boolean;
|
|
38
|
+
}, {}, {}>;
|
package/Fab/styles.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.StyledFab = void 0;
|
|
19
|
+
var material_1 = require("@mui/material");
|
|
20
|
+
var styles_1 = require("../styles");
|
|
21
|
+
var enums_1 = require("./enums");
|
|
22
|
+
var getBgColor = function (_a) {
|
|
23
|
+
var theme = _a.theme, color = _a.color, fabState = _a.fabState;
|
|
24
|
+
var backgroundColors = {
|
|
25
|
+
colored: theme.palette[color && color !== enums_1.FabColors.Default ? color : enums_1.FabColors.Primary][800],
|
|
26
|
+
default: theme.palette.grey[100],
|
|
27
|
+
defaultHover: theme.palette.primary[100],
|
|
28
|
+
error: theme.palette.red[800],
|
|
29
|
+
errorHover: theme.palette.red[900],
|
|
30
|
+
};
|
|
31
|
+
if (color === enums_1.FabColors.Default) {
|
|
32
|
+
if (fabState === enums_1.FabStates.Active || fabState === enums_1.FabStates.Hover) {
|
|
33
|
+
return backgroundColors.defaultHover;
|
|
34
|
+
}
|
|
35
|
+
return backgroundColors[enums_1.FabStates.Default];
|
|
36
|
+
}
|
|
37
|
+
if (color === enums_1.FabColors.Error) {
|
|
38
|
+
if (fabState === enums_1.FabStates.Active || fabState === enums_1.FabStates.Hover) {
|
|
39
|
+
return backgroundColors.errorHover;
|
|
40
|
+
}
|
|
41
|
+
return backgroundColors.error;
|
|
42
|
+
}
|
|
43
|
+
return backgroundColors.colored;
|
|
44
|
+
};
|
|
45
|
+
var getColor = function (_a) {
|
|
46
|
+
var theme = _a.theme, color = _a.color, fabState = _a.fabState;
|
|
47
|
+
var colors = {
|
|
48
|
+
colored: theme.palette.grey[100],
|
|
49
|
+
default: theme.palette.grey[900],
|
|
50
|
+
hover: theme.palette.primary[800],
|
|
51
|
+
};
|
|
52
|
+
if (color === enums_1.FabColors.Default) {
|
|
53
|
+
return colors[fabState];
|
|
54
|
+
}
|
|
55
|
+
return colors.colored;
|
|
56
|
+
};
|
|
57
|
+
var getSize = function (props) {
|
|
58
|
+
var sizes = {
|
|
59
|
+
small: '42px',
|
|
60
|
+
medium: '52px',
|
|
61
|
+
large: '62px',
|
|
62
|
+
};
|
|
63
|
+
return sizes[props.size || enums_1.FabSizes.Large];
|
|
64
|
+
};
|
|
65
|
+
var getBorderRadius = function (props) {
|
|
66
|
+
var variants = {
|
|
67
|
+
square: props.theme.shape.small,
|
|
68
|
+
circular: '50%',
|
|
69
|
+
};
|
|
70
|
+
if (props.isSquare) {
|
|
71
|
+
return variants.square;
|
|
72
|
+
}
|
|
73
|
+
return variants[props.variant || 'square'];
|
|
74
|
+
};
|
|
75
|
+
exports.StyledFab = (0, styles_1.styled)(material_1.Fab, {
|
|
76
|
+
shouldForwardProp: function (props) { return props !== 'size' && props !== 'isSquare'; },
|
|
77
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n\n color: ", ";\n\n background: ", ";\n border-radius: ", ";\n\n :active {\n color: ", ";\n\n background: ", ";\n }\n\n :hover {\n color: ", ";\n\n background: ", ";\n }\n"], ["\n width: ", ";\n height: ", ";\n\n color: ", ";\n\n background: ", ";\n border-radius: ", ";\n\n :active {\n color: ", ";\n\n background: ", ";\n }\n\n :hover {\n color: ", ";\n\n background: ", ";\n }\n"])), function (props) { return getSize(props); }, function (props) { return getSize(props); }, function (props) { return getColor(__assign(__assign({}, props), { fabState: enums_1.FabStates.Default })); }, function (props) {
|
|
78
|
+
return getBgColor(__assign(__assign({}, props), { fabState: enums_1.FabStates.Default }));
|
|
79
|
+
}, function (props) { return getBorderRadius(props); }, function (props) { return getColor(__assign(__assign({}, props), { fabState: enums_1.FabStates.Active })); }, function (props) {
|
|
80
|
+
return getBgColor(__assign(__assign({}, props), { fabState: enums_1.FabStates.Active }));
|
|
81
|
+
}, function (props) { return getColor(__assign(__assign({}, props), { fabState: enums_1.FabStates.Hover })); }, function (props) {
|
|
82
|
+
return getBgColor(__assign(__assign({}, props), { fabState: enums_1.FabStates.Hover }));
|
|
83
|
+
});
|
|
84
|
+
var templateObject_1;
|
package/Fab/types.d.ts
ADDED
package/Fab/types.js
ADDED
package/esm/Fab/Fab.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FabProps as MuiFabProps } from '@mui/material/Fab';
|
|
3
|
+
import { FabColor } from './types';
|
|
4
|
+
export declare type FabProps = Omit<MuiFabProps, 'color' | 'variant'> & {
|
|
5
|
+
color?: FabColor;
|
|
6
|
+
variant?: MuiFabProps['variant'] | 'square';
|
|
7
|
+
};
|
|
8
|
+
export declare const Fab: import("react").ForwardRefExoticComponent<Pick<FabProps, "disabled" | "action" | "color" | "translate" | "href" | "onFocusVisible" | "tabIndex" | "type" | "children" | "form" | "slot" | "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" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & import("react").RefAttributes<HTMLButtonElement>>;
|
package/esm/Fab/Fab.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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 { forwardRef } from 'react';
|
|
25
|
+
import { StyledFab } from './styles';
|
|
26
|
+
import { FabSizes } from './enums';
|
|
27
|
+
export var Fab = forwardRef(function (_a) {
|
|
28
|
+
var ref = _a.ref, _b = _a.variant, variant = _b === void 0 ? 'square' : _b, _c = _a.size, size = _c === void 0 ? FabSizes.Large : _c, _d = _a.color, color = _d === void 0 ? 'primary' : _d, props = __rest(_a, ["ref", "variant", "size", "color"]);
|
|
29
|
+
return (_jsx(StyledFab, __assign({}, props, { variant: variant === 'square' ? 'circular' : variant, isSquare: variant === 'square', size: size, color: color, ref: ref })));
|
|
30
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum FabSizes {
|
|
2
|
+
Small = "small",
|
|
3
|
+
Medium = "medium",
|
|
4
|
+
Large = "large"
|
|
5
|
+
}
|
|
6
|
+
export declare enum FabStates {
|
|
7
|
+
Default = "default",
|
|
8
|
+
Hover = "hover",
|
|
9
|
+
Active = "active"
|
|
10
|
+
}
|
|
11
|
+
export declare enum FabColors {
|
|
12
|
+
Default = "default",
|
|
13
|
+
Primary = "primary",
|
|
14
|
+
Error = "error",
|
|
15
|
+
Success = "success",
|
|
16
|
+
Warning = "warning"
|
|
17
|
+
}
|
package/esm/Fab/enums.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var FabSizes;
|
|
2
|
+
(function (FabSizes) {
|
|
3
|
+
FabSizes["Small"] = "small";
|
|
4
|
+
FabSizes["Medium"] = "medium";
|
|
5
|
+
FabSizes["Large"] = "large";
|
|
6
|
+
})(FabSizes || (FabSizes = {}));
|
|
7
|
+
export var FabStates;
|
|
8
|
+
(function (FabStates) {
|
|
9
|
+
FabStates["Default"] = "default";
|
|
10
|
+
FabStates["Hover"] = "hover";
|
|
11
|
+
FabStates["Active"] = "active";
|
|
12
|
+
})(FabStates || (FabStates = {}));
|
|
13
|
+
export var FabColors;
|
|
14
|
+
(function (FabColors) {
|
|
15
|
+
FabColors["Default"] = "default";
|
|
16
|
+
FabColors["Primary"] = "primary";
|
|
17
|
+
FabColors["Error"] = "error";
|
|
18
|
+
FabColors["Success"] = "success";
|
|
19
|
+
FabColors["Warning"] = "warning";
|
|
20
|
+
})(FabColors || (FabColors = {}));
|
package/esm/Fab/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledFab: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").FabClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "primary" | "secondary" | "default" | "error" | "warning" | "info" | "success" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableFocusRipple?: boolean | undefined;
|
|
8
|
+
disableRipple?: boolean | undefined;
|
|
9
|
+
href?: string | undefined;
|
|
10
|
+
size?: "large" | "medium" | "small" | undefined;
|
|
11
|
+
variant?: "circular" | "extended" | undefined;
|
|
12
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
13
|
+
} & Omit<{
|
|
14
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
15
|
+
centerRipple?: boolean | undefined;
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
18
|
+
disabled?: boolean | undefined;
|
|
19
|
+
disableRipple?: boolean | undefined;
|
|
20
|
+
disableTouchRipple?: boolean | undefined;
|
|
21
|
+
focusRipple?: boolean | undefined;
|
|
22
|
+
focusVisibleClassName?: string | undefined;
|
|
23
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
24
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
25
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
|
+
tabIndex?: number | undefined;
|
|
27
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
28
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
29
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | "css" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
30
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
31
|
+
}, "disabled" | "action" | "color" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
32
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
33
|
+
} & Omit<import("@mui/material").FabProps<"button", {}>, "color" | "variant"> & {
|
|
34
|
+
color?: "primary" | "default" | "error" | "warning" | "success" | undefined;
|
|
35
|
+
variant?: "square" | "circular" | "extended" | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
isSquare: boolean;
|
|
38
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { Fab } from '@mui/material';
|
|
17
|
+
import { styled } from '../styles';
|
|
18
|
+
import { FabColors, FabSizes, FabStates } from './enums';
|
|
19
|
+
var getBgColor = function (_a) {
|
|
20
|
+
var theme = _a.theme, color = _a.color, fabState = _a.fabState;
|
|
21
|
+
var backgroundColors = {
|
|
22
|
+
colored: theme.palette[color && color !== FabColors.Default ? color : FabColors.Primary][800],
|
|
23
|
+
default: theme.palette.grey[100],
|
|
24
|
+
defaultHover: theme.palette.primary[100],
|
|
25
|
+
error: theme.palette.red[800],
|
|
26
|
+
errorHover: theme.palette.red[900],
|
|
27
|
+
};
|
|
28
|
+
if (color === FabColors.Default) {
|
|
29
|
+
if (fabState === FabStates.Active || fabState === FabStates.Hover) {
|
|
30
|
+
return backgroundColors.defaultHover;
|
|
31
|
+
}
|
|
32
|
+
return backgroundColors[FabStates.Default];
|
|
33
|
+
}
|
|
34
|
+
if (color === FabColors.Error) {
|
|
35
|
+
if (fabState === FabStates.Active || fabState === FabStates.Hover) {
|
|
36
|
+
return backgroundColors.errorHover;
|
|
37
|
+
}
|
|
38
|
+
return backgroundColors.error;
|
|
39
|
+
}
|
|
40
|
+
return backgroundColors.colored;
|
|
41
|
+
};
|
|
42
|
+
var getColor = function (_a) {
|
|
43
|
+
var theme = _a.theme, color = _a.color, fabState = _a.fabState;
|
|
44
|
+
var colors = {
|
|
45
|
+
colored: theme.palette.grey[100],
|
|
46
|
+
default: theme.palette.grey[900],
|
|
47
|
+
hover: theme.palette.primary[800],
|
|
48
|
+
};
|
|
49
|
+
if (color === FabColors.Default) {
|
|
50
|
+
return colors[fabState];
|
|
51
|
+
}
|
|
52
|
+
return colors.colored;
|
|
53
|
+
};
|
|
54
|
+
var getSize = function (props) {
|
|
55
|
+
var sizes = {
|
|
56
|
+
small: '42px',
|
|
57
|
+
medium: '52px',
|
|
58
|
+
large: '62px',
|
|
59
|
+
};
|
|
60
|
+
return sizes[props.size || FabSizes.Large];
|
|
61
|
+
};
|
|
62
|
+
var getBorderRadius = function (props) {
|
|
63
|
+
var variants = {
|
|
64
|
+
square: props.theme.shape.small,
|
|
65
|
+
circular: '50%',
|
|
66
|
+
};
|
|
67
|
+
if (props.isSquare) {
|
|
68
|
+
return variants.square;
|
|
69
|
+
}
|
|
70
|
+
return variants[props.variant || 'square'];
|
|
71
|
+
};
|
|
72
|
+
export var StyledFab = styled(Fab, {
|
|
73
|
+
shouldForwardProp: function (props) { return props !== 'size' && props !== 'isSquare'; },
|
|
74
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n\n color: ", ";\n\n background: ", ";\n border-radius: ", ";\n\n :active {\n color: ", ";\n\n background: ", ";\n }\n\n :hover {\n color: ", ";\n\n background: ", ";\n }\n"], ["\n width: ", ";\n height: ", ";\n\n color: ", ";\n\n background: ", ";\n border-radius: ", ";\n\n :active {\n color: ", ";\n\n background: ", ";\n }\n\n :hover {\n color: ", ";\n\n background: ", ";\n }\n"])), function (props) { return getSize(props); }, function (props) { return getSize(props); }, function (props) { return getColor(__assign(__assign({}, props), { fabState: FabStates.Default })); }, function (props) {
|
|
75
|
+
return getBgColor(__assign(__assign({}, props), { fabState: FabStates.Default }));
|
|
76
|
+
}, function (props) { return getBorderRadius(props); }, function (props) { return getColor(__assign(__assign({}, props), { fabState: FabStates.Active })); }, function (props) {
|
|
77
|
+
return getBgColor(__assign(__assign({}, props), { fabState: FabStates.Active }));
|
|
78
|
+
}, function (props) { return getColor(__assign(__assign({}, props), { fabState: FabStates.Hover })); }, function (props) {
|
|
79
|
+
return getBgColor(__assign(__assign({}, props), { fabState: FabStates.Hover }));
|
|
80
|
+
});
|
|
81
|
+
var templateObject_1;
|
package/esm/Fab/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './DialogContent';
|
|
|
19
19
|
export * from './DialogContentText';
|
|
20
20
|
export * from './DialogTitle';
|
|
21
21
|
export * from './DropdownButton';
|
|
22
|
+
export * from './Fab';
|
|
22
23
|
export * from './Fade';
|
|
23
24
|
export * from './FormControlLabel';
|
|
24
25
|
export * from './FormHelperText';
|
package/esm/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from './DialogContent';
|
|
|
19
19
|
export * from './DialogContentText';
|
|
20
20
|
export * from './DialogTitle';
|
|
21
21
|
export * from './DropdownButton';
|
|
22
|
+
export * from './Fab';
|
|
22
23
|
export * from './Fade';
|
|
23
24
|
export * from './FormControlLabel';
|
|
24
25
|
export * from './FormHelperText';
|
package/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './DialogContent';
|
|
|
19
19
|
export * from './DialogContentText';
|
|
20
20
|
export * from './DialogTitle';
|
|
21
21
|
export * from './DropdownButton';
|
|
22
|
+
export * from './Fab';
|
|
22
23
|
export * from './Fade';
|
|
23
24
|
export * from './FormControlLabel';
|
|
24
25
|
export * from './FormHelperText';
|
package/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __exportStar(require("./DialogContent"), exports);
|
|
|
35
35
|
__exportStar(require("./DialogContentText"), exports);
|
|
36
36
|
__exportStar(require("./DialogTitle"), exports);
|
|
37
37
|
__exportStar(require("./DropdownButton"), exports);
|
|
38
|
+
__exportStar(require("./Fab"), exports);
|
|
38
39
|
__exportStar(require("./Fade"), exports);
|
|
39
40
|
__exportStar(require("./FormControlLabel"), exports);
|
|
40
41
|
__exportStar(require("./FormHelperText"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astral/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.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.7.0",
|
|
12
12
|
"@emotion/cache": "11.7.1",
|
|
13
13
|
"@emotion/react": "11.9.0",
|
|
14
14
|
"@emotion/server": "11.4.0",
|