@availity/mui-button 0.2.0 → 0.3.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/CHANGELOG.md +9 -0
- package/dist/index.d.ts +8 -12
- package/dist/index.js +18 -44
- package/dist/index.mjs +18 -44
- package/package.json +1 -1
- package/src/lib/Button.tsx +13 -37
- package/src/lib/IconButton.tsx +19 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.3.0](https://github.com/Availity/element/compare/@availity/mui-button@0.2.1...@availity/mui-button@0.3.0) (2023-08-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **mui-button:** remove contained iconbutton styles ([a6ee9c9](https://github.com/Availity/element/commit/a6ee9c948fb1511ec2a1bd8b91b0486a1cef53fd))
|
|
11
|
+
|
|
12
|
+
## [0.2.1](https://github.com/Availity/element/compare/@availity/mui-button@0.2.0...@availity/mui-button@0.2.1) (2023-07-31)
|
|
13
|
+
|
|
5
14
|
## [0.2.0](https://github.com/Availity/element/compare/@availity/mui-button@0.1.3...@availity/mui-button@0.2.0) (2023-06-01)
|
|
6
15
|
|
|
7
16
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import * as _mui_material_OverridableComponent from '@mui/material/OverridableCo
|
|
|
3
3
|
import { ButtonProps as ButtonProps$1, IconButtonProps as IconButtonProps$1 } from '@mui/material';
|
|
4
4
|
import { LoadingButtonProps as LoadingButtonProps$1 } from '@mui/lab/LoadingButton';
|
|
5
5
|
|
|
6
|
+
declare module '@mui/material/Button' {
|
|
7
|
+
interface ButtonPropsColorOverrides {
|
|
8
|
+
tertiary: true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
6
11
|
type ButtonProps = {
|
|
7
12
|
/** The color of the component.
|
|
8
13
|
* @default secondary */
|
|
@@ -12,7 +17,7 @@ type ButtonProps = {
|
|
|
12
17
|
variant?: 'outlined' | 'contained';
|
|
13
18
|
/** Internal prop used by IconButton for contained variant. */
|
|
14
19
|
iconOnly?: boolean;
|
|
15
|
-
} & Omit<ButtonProps$1, 'color' | 'variant' | 'disableElevation' | 'disableFocusRipple' | 'disableTouchRipple' | 'centerRipple' | 'disableRipple' | 'focusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
|
|
20
|
+
} & Omit<ButtonProps$1, 'color' | 'component' | 'variant' | 'disableElevation' | 'disableFocusRipple' | 'disableTouchRipple' | 'centerRipple' | 'disableRipple' | 'focusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
|
|
16
21
|
declare const Button: react.ForwardRefExoticComponent<Pick<ButtonProps, keyof _mui_material_OverridableComponent.CommonProps | "form" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "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" | "children" | "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" | "onResize" | "onResizeCapture" | "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" | "action" | "disabled" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "endIcon" | "fullWidth" | "href" | "size" | "startIcon" | "variant" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "iconOnly"> & react.RefAttributes<HTMLButtonElement>>;
|
|
17
22
|
|
|
18
23
|
type IconButtonProps = {
|
|
@@ -20,17 +25,8 @@ type IconButtonProps = {
|
|
|
20
25
|
* Text for tooltip and aria-label
|
|
21
26
|
*/
|
|
22
27
|
title: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Toggles contained Button styling
|
|
26
|
-
*/
|
|
27
|
-
filled?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The color of the component.
|
|
30
|
-
*/
|
|
31
|
-
color?: "primary" | "secondary" | "tertiary" | "error";
|
|
32
|
-
} & Omit<IconButtonProps$1, 'aria-label' | 'color' | 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'disableFocusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
|
|
33
|
-
declare const IconButton: ({ children, title, filled, color, ...rest }: IconButtonProps) => JSX.Element;
|
|
28
|
+
} & Omit<IconButtonProps$1, 'aria-label' | 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'disableFocusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
|
|
29
|
+
declare const IconButton: react.ForwardRefExoticComponent<Pick<IconButtonProps, keyof _mui_material_OverridableComponent.CommonProps | "form" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "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-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" | "children" | "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" | "onResize" | "onResizeCapture" | "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" | "action" | "disabled" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "size" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "edge"> & react.RefAttributes<HTMLButtonElement>>;
|
|
34
30
|
|
|
35
31
|
type LoadingButtonProps = {
|
|
36
32
|
children: React.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -36,67 +36,41 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_material = require("@mui/material");
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
bgcolor: "tertiary.dark"
|
|
44
|
-
},
|
|
45
|
-
"&:active": {
|
|
46
|
-
bgcolor: "tertiary.light"
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var iconOnlyStyles = {
|
|
50
|
-
minWidth: 2,
|
|
51
|
-
px: 1,
|
|
52
|
-
"& .MuiButton-startIcon": {
|
|
53
|
-
m: 0
|
|
54
|
-
},
|
|
55
|
-
"& .MuiButton-endIcon": {
|
|
56
|
-
m: 0
|
|
57
|
-
}
|
|
39
|
+
var overrideProps = {
|
|
40
|
+
disableRipple: true,
|
|
41
|
+
disableFocusRipple: true,
|
|
42
|
+
disableTouchRipple: true
|
|
58
43
|
};
|
|
59
44
|
var Button = (0, import_react.forwardRef)((props, ref) => {
|
|
60
|
-
const { color = "secondary", variant = "contained", iconOnly, sx, ...rest } = props;
|
|
61
|
-
const styles = {
|
|
62
|
-
...color == "tertiary" && variant == "contained" && tertiaryContainedStyles,
|
|
63
|
-
...iconOnly && iconOnlyStyles
|
|
64
|
-
};
|
|
65
45
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
sx: { ...styles, ...sx },
|
|
69
|
-
disableRipple: true,
|
|
70
|
-
...rest,
|
|
46
|
+
...props,
|
|
47
|
+
...overrideProps,
|
|
71
48
|
ref
|
|
72
49
|
});
|
|
73
50
|
});
|
|
74
51
|
|
|
75
52
|
// src/lib/IconButton.tsx
|
|
53
|
+
var import_react2 = require("react");
|
|
76
54
|
var import_material2 = require("@mui/material");
|
|
77
55
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
78
|
-
var
|
|
56
|
+
var overrideProps2 = {
|
|
57
|
+
disableRipple: true
|
|
58
|
+
};
|
|
59
|
+
var IconButton = (0, import_react2.forwardRef)((props, ref) => {
|
|
60
|
+
const { title, ...rest } = props;
|
|
79
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.Tooltip, {
|
|
80
62
|
title,
|
|
81
|
-
children:
|
|
63
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.IconButton, {
|
|
82
64
|
"aria-label": title,
|
|
83
|
-
color,
|
|
84
|
-
startIcon: children,
|
|
85
|
-
iconOnly: true,
|
|
86
65
|
...rest,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"aria-label": title,
|
|
90
|
-
disableRipple: true,
|
|
91
|
-
color: color === "tertiary" ? "secondary" : color,
|
|
92
|
-
...rest,
|
|
93
|
-
children
|
|
66
|
+
...overrideProps2,
|
|
67
|
+
ref
|
|
94
68
|
})
|
|
95
69
|
});
|
|
96
|
-
};
|
|
70
|
+
});
|
|
97
71
|
|
|
98
72
|
// src/lib/LoadingButton.tsx
|
|
99
|
-
var
|
|
73
|
+
var import_react3 = require("react");
|
|
100
74
|
var import_LoadingButton = __toESM(require("@mui/lab/LoadingButton"));
|
|
101
75
|
var import_CircularProgress = __toESM(require("@mui/material/CircularProgress"));
|
|
102
76
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -105,7 +79,7 @@ var LoadingIndicator = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Circul
|
|
|
105
79
|
size: 16,
|
|
106
80
|
"aria-label": "loading"
|
|
107
81
|
});
|
|
108
|
-
var LoadingButton = (0,
|
|
82
|
+
var LoadingButton = (0, import_react3.forwardRef)((props, ref) => {
|
|
109
83
|
const { children, loading, ...rest } = props;
|
|
110
84
|
const loadingPosition = rest.startIcon ? "start" : "end";
|
|
111
85
|
const nonLoadingStyling = rest.startIcon || rest.endIcon || loading ? {} : { padding: "0 .7rem" };
|
package/dist/index.mjs
CHANGED
|
@@ -2,67 +2,41 @@
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Button as MUIButton } from "@mui/material";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
bgcolor: "tertiary.dark"
|
|
10
|
-
},
|
|
11
|
-
"&:active": {
|
|
12
|
-
bgcolor: "tertiary.light"
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var iconOnlyStyles = {
|
|
16
|
-
minWidth: 2,
|
|
17
|
-
px: 1,
|
|
18
|
-
"& .MuiButton-startIcon": {
|
|
19
|
-
m: 0
|
|
20
|
-
},
|
|
21
|
-
"& .MuiButton-endIcon": {
|
|
22
|
-
m: 0
|
|
23
|
-
}
|
|
5
|
+
var overrideProps = {
|
|
6
|
+
disableRipple: true,
|
|
7
|
+
disableFocusRipple: true,
|
|
8
|
+
disableTouchRipple: true
|
|
24
9
|
};
|
|
25
10
|
var Button = forwardRef((props, ref) => {
|
|
26
|
-
const { color = "secondary", variant = "contained", iconOnly, sx, ...rest } = props;
|
|
27
|
-
const styles = {
|
|
28
|
-
...color == "tertiary" && variant == "contained" && tertiaryContainedStyles,
|
|
29
|
-
...iconOnly && iconOnlyStyles
|
|
30
|
-
};
|
|
31
11
|
return /* @__PURE__ */ jsx(MUIButton, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
sx: { ...styles, ...sx },
|
|
35
|
-
disableRipple: true,
|
|
36
|
-
...rest,
|
|
12
|
+
...props,
|
|
13
|
+
...overrideProps,
|
|
37
14
|
ref
|
|
38
15
|
});
|
|
39
16
|
});
|
|
40
17
|
|
|
41
18
|
// src/lib/IconButton.tsx
|
|
19
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
42
20
|
import { IconButton as MuiIconButton, Tooltip } from "@mui/material";
|
|
43
21
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
44
|
-
var
|
|
22
|
+
var overrideProps2 = {
|
|
23
|
+
disableRipple: true
|
|
24
|
+
};
|
|
25
|
+
var IconButton = forwardRef2((props, ref) => {
|
|
26
|
+
const { title, ...rest } = props;
|
|
45
27
|
return /* @__PURE__ */ jsx2(Tooltip, {
|
|
46
28
|
title,
|
|
47
|
-
children:
|
|
29
|
+
children: /* @__PURE__ */ jsx2(MuiIconButton, {
|
|
48
30
|
"aria-label": title,
|
|
49
|
-
color,
|
|
50
|
-
startIcon: children,
|
|
51
|
-
iconOnly: true,
|
|
52
31
|
...rest,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"aria-label": title,
|
|
56
|
-
disableRipple: true,
|
|
57
|
-
color: color === "tertiary" ? "secondary" : color,
|
|
58
|
-
...rest,
|
|
59
|
-
children
|
|
32
|
+
...overrideProps2,
|
|
33
|
+
ref
|
|
60
34
|
})
|
|
61
35
|
});
|
|
62
|
-
};
|
|
36
|
+
});
|
|
63
37
|
|
|
64
38
|
// src/lib/LoadingButton.tsx
|
|
65
|
-
import { forwardRef as
|
|
39
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
66
40
|
import MUILoadingButton from "@mui/lab/LoadingButton";
|
|
67
41
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
68
42
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
@@ -71,7 +45,7 @@ var LoadingIndicator = /* @__PURE__ */ jsx3(CircularProgress, {
|
|
|
71
45
|
size: 16,
|
|
72
46
|
"aria-label": "loading"
|
|
73
47
|
});
|
|
74
|
-
var LoadingButton =
|
|
48
|
+
var LoadingButton = forwardRef3((props, ref) => {
|
|
75
49
|
const { children, loading, ...rest } = props;
|
|
76
50
|
const loadingPosition = rest.startIcon ? "start" : "end";
|
|
77
51
|
const nonLoadingStyling = rest.startIcon || rest.endIcon || loading ? {} : { padding: "0 .7rem" };
|
package/package.json
CHANGED
package/src/lib/Button.tsx
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import { Button as MUIButton } from '@mui/material';
|
|
2
|
+
import { Button as MUIButton, ButtonPropsColorOverrides } from '@mui/material';
|
|
3
3
|
import type { ButtonProps as MUIButtonProps } from '@mui/material';
|
|
4
4
|
|
|
5
|
+
declare module '@mui/material/Button' {
|
|
6
|
+
interface ButtonPropsColorOverrides {
|
|
7
|
+
tertiary: true;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export type ButtonProps = {
|
|
6
12
|
/** The color of the component.
|
|
7
13
|
* @default secondary */
|
|
@@ -14,6 +20,7 @@ export type ButtonProps = {
|
|
|
14
20
|
} & Omit<
|
|
15
21
|
MUIButtonProps,
|
|
16
22
|
| 'color'
|
|
23
|
+
| 'component'
|
|
17
24
|
| 'variant'
|
|
18
25
|
| 'disableElevation'
|
|
19
26
|
| 'disableFocusRipple'
|
|
@@ -25,43 +32,12 @@ export type ButtonProps = {
|
|
|
25
32
|
| 'touchRippleRef'
|
|
26
33
|
>;
|
|
27
34
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
bgcolor: 'tertiary.dark',
|
|
33
|
-
},
|
|
34
|
-
'&:active': {
|
|
35
|
-
bgcolor: 'tertiary.light',
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const iconOnlyStyles = {
|
|
40
|
-
minWidth: 2,
|
|
41
|
-
px: 1,
|
|
42
|
-
'& .MuiButton-startIcon': {
|
|
43
|
-
m: 0,
|
|
44
|
-
},
|
|
45
|
-
'& .MuiButton-endIcon': {
|
|
46
|
-
m: 0,
|
|
47
|
-
},
|
|
35
|
+
const overrideProps = {
|
|
36
|
+
disableRipple: true,
|
|
37
|
+
disableFocusRipple: true,
|
|
38
|
+
disableTouchRipple: true,
|
|
48
39
|
};
|
|
49
40
|
|
|
50
41
|
export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
|
51
|
-
|
|
52
|
-
const styles = {
|
|
53
|
-
...(color == 'tertiary' && variant == 'contained' && tertiaryContainedStyles),
|
|
54
|
-
...(iconOnly && iconOnlyStyles),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<MUIButton
|
|
59
|
-
color={color == 'tertiary' ? 'secondary' : color}
|
|
60
|
-
variant={variant}
|
|
61
|
-
sx={{ ...styles, ...sx }}
|
|
62
|
-
disableRipple
|
|
63
|
-
{...rest}
|
|
64
|
-
ref={ref}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
42
|
+
return <MUIButton {...props} {...overrideProps} ref={ref} />;
|
|
67
43
|
});
|
package/src/lib/IconButton.tsx
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import { IconButton as MuiIconButton, Tooltip } from '@mui/material';
|
|
2
3
|
import type { IconButtonProps as MUIIconButtonProps } from '@mui/material';
|
|
3
|
-
import { Button } from './Button';
|
|
4
4
|
|
|
5
5
|
export type IconButtonProps = {
|
|
6
6
|
/**
|
|
7
7
|
* Text for tooltip and aria-label
|
|
8
8
|
*/
|
|
9
9
|
title: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
} & Omit<
|
|
11
|
+
MUIIconButtonProps,
|
|
12
|
+
| 'aria-label'
|
|
13
|
+
| 'centerRipple'
|
|
14
|
+
| 'disableRipple'
|
|
15
|
+
| 'disableTouchRipple'
|
|
16
|
+
| 'focusRipple'
|
|
17
|
+
| 'disableFocusRipple'
|
|
18
|
+
| 'TouchRippleProps'
|
|
19
|
+
| 'touchRippleRef'
|
|
20
|
+
>;
|
|
21
21
|
|
|
22
|
+
const overrideProps = {
|
|
23
|
+
disableRipple: true,
|
|
24
|
+
};
|
|
22
25
|
|
|
23
|
-
export const IconButton =
|
|
26
|
+
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {
|
|
27
|
+
const { title, ...rest } = props;
|
|
24
28
|
return (
|
|
25
29
|
<Tooltip title={title}>
|
|
26
|
-
{
|
|
27
|
-
<Button aria-label={title} color={color} startIcon={children} iconOnly {...rest}>{'\u2060'}</Button>
|
|
28
|
-
:
|
|
29
|
-
<MuiIconButton aria-label={title} disableRipple color={color === 'tertiary' ? 'secondary' : color} {...rest}>
|
|
30
|
-
{children}
|
|
31
|
-
</MuiIconButton>
|
|
32
|
-
}
|
|
30
|
+
<MuiIconButton aria-label={title} {...rest} {...overrideProps} ref={ref} />
|
|
33
31
|
</Tooltip>
|
|
34
32
|
);
|
|
35
|
-
}
|
|
33
|
+
});
|