@availity/mui-button 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.2.1](https://github.com/Availity/element/compare/@availity/mui-button@0.2.0...@availity/mui-button@0.2.1) (2023-07-31)
6
+
5
7
  ## [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
8
 
7
9
 
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 = {
package/dist/index.js CHANGED
@@ -36,15 +36,10 @@ 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 tertiaryContainedStyles = {
40
- bgcolor: "tertiary.main",
41
- color: "black",
42
- "&:focus, &:hover": {
43
- bgcolor: "tertiary.dark"
44
- },
45
- "&:active": {
46
- bgcolor: "tertiary.light"
47
- }
39
+ var overrideProps = {
40
+ disableRipple: true,
41
+ disableFocusRipple: true,
42
+ disableTouchRipple: true
48
43
  };
49
44
  var iconOnlyStyles = {
50
45
  minWidth: 2,
@@ -57,17 +52,14 @@ var iconOnlyStyles = {
57
52
  }
58
53
  };
59
54
  var Button = (0, import_react.forwardRef)((props, ref) => {
60
- const { color = "secondary", variant = "contained", iconOnly, sx, ...rest } = props;
55
+ const { iconOnly, sx, ...rest } = props;
61
56
  const styles = {
62
- ...color == "tertiary" && variant == "contained" && tertiaryContainedStyles,
63
57
  ...iconOnly && iconOnlyStyles
64
58
  };
65
59
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, {
66
- color: color == "tertiary" ? "secondary" : color,
67
- variant,
68
60
  sx: { ...styles, ...sx },
69
- disableRipple: true,
70
61
  ...rest,
62
+ ...overrideProps,
71
63
  ref
72
64
  });
73
65
  });
package/dist/index.mjs CHANGED
@@ -2,15 +2,10 @@
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 tertiaryContainedStyles = {
6
- bgcolor: "tertiary.main",
7
- color: "black",
8
- "&:focus, &:hover": {
9
- bgcolor: "tertiary.dark"
10
- },
11
- "&:active": {
12
- bgcolor: "tertiary.light"
13
- }
5
+ var overrideProps = {
6
+ disableRipple: true,
7
+ disableFocusRipple: true,
8
+ disableTouchRipple: true
14
9
  };
15
10
  var iconOnlyStyles = {
16
11
  minWidth: 2,
@@ -23,17 +18,14 @@ var iconOnlyStyles = {
23
18
  }
24
19
  };
25
20
  var Button = forwardRef((props, ref) => {
26
- const { color = "secondary", variant = "contained", iconOnly, sx, ...rest } = props;
21
+ const { iconOnly, sx, ...rest } = props;
27
22
  const styles = {
28
- ...color == "tertiary" && variant == "contained" && tertiaryContainedStyles,
29
23
  ...iconOnly && iconOnlyStyles
30
24
  };
31
25
  return /* @__PURE__ */ jsx(MUIButton, {
32
- color: color == "tertiary" ? "secondary" : color,
33
- variant,
34
26
  sx: { ...styles, ...sx },
35
- disableRipple: true,
36
27
  ...rest,
28
+ ...overrideProps,
37
29
  ref
38
30
  });
39
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-button",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Availity MUI Button Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -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,15 +32,10 @@ export type ButtonProps = {
25
32
  | 'touchRippleRef'
26
33
  >;
27
34
 
28
- const tertiaryContainedStyles = {
29
- bgcolor: 'tertiary.main',
30
- color: 'black',
31
- '&:focus, &:hover': {
32
- bgcolor: 'tertiary.dark',
33
- },
34
- '&:active': {
35
- bgcolor: 'tertiary.light',
36
- },
35
+ const overrideProps = {
36
+ disableRipple: true,
37
+ disableFocusRipple: true,
38
+ disableTouchRipple: true,
37
39
  };
38
40
 
39
41
  const iconOnlyStyles = {
@@ -48,20 +50,10 @@ const iconOnlyStyles = {
48
50
  };
49
51
 
50
52
  export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
51
- const { color = 'secondary', variant = 'contained', iconOnly, sx, ...rest } = props;
53
+ const { iconOnly, sx, ...rest } = props;
52
54
  const styles = {
53
- ...(color == 'tertiary' && variant == 'contained' && tertiaryContainedStyles),
54
55
  ...(iconOnly && iconOnlyStyles),
55
56
  };
56
57
 
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
- );
58
+ return <MUIButton sx={{ ...styles, ...sx }} {...rest} {...overrideProps} ref={ref} />;
67
59
  });