@availity/mui-button 0.2.1 → 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 CHANGED
@@ -2,6 +2,13 @@
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
+
5
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)
6
13
 
7
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)
package/dist/index.d.ts CHANGED
@@ -25,17 +25,8 @@ type IconButtonProps = {
25
25
  * Text for tooltip and aria-label
26
26
  */
27
27
  title: string;
28
- children: React.ReactNode;
29
- /**
30
- * Toggles contained Button styling
31
- */
32
- filled?: boolean;
33
- /**
34
- * The color of the component.
35
- */
36
- color?: "primary" | "secondary" | "tertiary" | "error";
37
- } & Omit<IconButtonProps$1, 'aria-label' | 'color' | 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'disableFocusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
38
- 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>>;
39
30
 
40
31
  type LoadingButtonProps = {
41
32
  children: React.ReactNode;
package/dist/index.js CHANGED
@@ -41,54 +41,36 @@ var overrideProps = {
41
41
  disableFocusRipple: true,
42
42
  disableTouchRipple: true
43
43
  };
44
- var iconOnlyStyles = {
45
- minWidth: 2,
46
- px: 1,
47
- "& .MuiButton-startIcon": {
48
- m: 0
49
- },
50
- "& .MuiButton-endIcon": {
51
- m: 0
52
- }
53
- };
54
44
  var Button = (0, import_react.forwardRef)((props, ref) => {
55
- const { iconOnly, sx, ...rest } = props;
56
- const styles = {
57
- ...iconOnly && iconOnlyStyles
58
- };
59
45
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, {
60
- sx: { ...styles, ...sx },
61
- ...rest,
46
+ ...props,
62
47
  ...overrideProps,
63
48
  ref
64
49
  });
65
50
  });
66
51
 
67
52
  // src/lib/IconButton.tsx
53
+ var import_react2 = require("react");
68
54
  var import_material2 = require("@mui/material");
69
55
  var import_jsx_runtime = require("react/jsx-runtime");
70
- var IconButton = ({ children, title, filled, color = "tertiary", ...rest }) => {
56
+ var overrideProps2 = {
57
+ disableRipple: true
58
+ };
59
+ var IconButton = (0, import_react2.forwardRef)((props, ref) => {
60
+ const { title, ...rest } = props;
71
61
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.Tooltip, {
72
62
  title,
73
- children: filled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
63
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.IconButton, {
74
64
  "aria-label": title,
75
- color,
76
- startIcon: children,
77
- iconOnly: true,
78
65
  ...rest,
79
- children: "\u2060"
80
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.IconButton, {
81
- "aria-label": title,
82
- disableRipple: true,
83
- color: color === "tertiary" ? "secondary" : color,
84
- ...rest,
85
- children
66
+ ...overrideProps2,
67
+ ref
86
68
  })
87
69
  });
88
- };
70
+ });
89
71
 
90
72
  // src/lib/LoadingButton.tsx
91
- var import_react2 = require("react");
73
+ var import_react3 = require("react");
92
74
  var import_LoadingButton = __toESM(require("@mui/lab/LoadingButton"));
93
75
  var import_CircularProgress = __toESM(require("@mui/material/CircularProgress"));
94
76
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -97,7 +79,7 @@ var LoadingIndicator = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Circul
97
79
  size: 16,
98
80
  "aria-label": "loading"
99
81
  });
100
- var LoadingButton = (0, import_react2.forwardRef)((props, ref) => {
82
+ var LoadingButton = (0, import_react3.forwardRef)((props, ref) => {
101
83
  const { children, loading, ...rest } = props;
102
84
  const loadingPosition = rest.startIcon ? "start" : "end";
103
85
  const nonLoadingStyling = rest.startIcon || rest.endIcon || loading ? {} : { padding: "0 .7rem" };
package/dist/index.mjs CHANGED
@@ -7,54 +7,36 @@ var overrideProps = {
7
7
  disableFocusRipple: true,
8
8
  disableTouchRipple: true
9
9
  };
10
- var iconOnlyStyles = {
11
- minWidth: 2,
12
- px: 1,
13
- "& .MuiButton-startIcon": {
14
- m: 0
15
- },
16
- "& .MuiButton-endIcon": {
17
- m: 0
18
- }
19
- };
20
10
  var Button = forwardRef((props, ref) => {
21
- const { iconOnly, sx, ...rest } = props;
22
- const styles = {
23
- ...iconOnly && iconOnlyStyles
24
- };
25
11
  return /* @__PURE__ */ jsx(MUIButton, {
26
- sx: { ...styles, ...sx },
27
- ...rest,
12
+ ...props,
28
13
  ...overrideProps,
29
14
  ref
30
15
  });
31
16
  });
32
17
 
33
18
  // src/lib/IconButton.tsx
19
+ import { forwardRef as forwardRef2 } from "react";
34
20
  import { IconButton as MuiIconButton, Tooltip } from "@mui/material";
35
21
  import { jsx as jsx2 } from "react/jsx-runtime";
36
- var IconButton = ({ children, title, filled, color = "tertiary", ...rest }) => {
22
+ var overrideProps2 = {
23
+ disableRipple: true
24
+ };
25
+ var IconButton = forwardRef2((props, ref) => {
26
+ const { title, ...rest } = props;
37
27
  return /* @__PURE__ */ jsx2(Tooltip, {
38
28
  title,
39
- children: filled ? /* @__PURE__ */ jsx2(Button, {
40
- "aria-label": title,
41
- color,
42
- startIcon: children,
43
- iconOnly: true,
44
- ...rest,
45
- children: "\u2060"
46
- }) : /* @__PURE__ */ jsx2(MuiIconButton, {
29
+ children: /* @__PURE__ */ jsx2(MuiIconButton, {
47
30
  "aria-label": title,
48
- disableRipple: true,
49
- color: color === "tertiary" ? "secondary" : color,
50
31
  ...rest,
51
- children
32
+ ...overrideProps2,
33
+ ref
52
34
  })
53
35
  });
54
- };
36
+ });
55
37
 
56
38
  // src/lib/LoadingButton.tsx
57
- import { forwardRef as forwardRef2 } from "react";
39
+ import { forwardRef as forwardRef3 } from "react";
58
40
  import MUILoadingButton from "@mui/lab/LoadingButton";
59
41
  import CircularProgress from "@mui/material/CircularProgress";
60
42
  import { jsx as jsx3 } from "react/jsx-runtime";
@@ -63,7 +45,7 @@ var LoadingIndicator = /* @__PURE__ */ jsx3(CircularProgress, {
63
45
  size: 16,
64
46
  "aria-label": "loading"
65
47
  });
66
- var LoadingButton = forwardRef2((props, ref) => {
48
+ var LoadingButton = forwardRef3((props, ref) => {
67
49
  const { children, loading, ...rest } = props;
68
50
  const loadingPosition = rest.startIcon ? "start" : "end";
69
51
  const nonLoadingStyling = rest.startIcon || rest.endIcon || loading ? {} : { padding: "0 .7rem" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-button",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Availity MUI Button Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -38,22 +38,6 @@ const overrideProps = {
38
38
  disableTouchRipple: true,
39
39
  };
40
40
 
41
- const iconOnlyStyles = {
42
- minWidth: 2,
43
- px: 1,
44
- '& .MuiButton-startIcon': {
45
- m: 0,
46
- },
47
- '& .MuiButton-endIcon': {
48
- m: 0,
49
- },
50
- };
51
-
52
41
  export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
53
- const { iconOnly, sx, ...rest } = props;
54
- const styles = {
55
- ...(iconOnly && iconOnlyStyles),
56
- };
57
-
58
- return <MUIButton sx={{ ...styles, ...sx }} {...rest} {...overrideProps} ref={ref} />;
42
+ return <MUIButton {...props} {...overrideProps} ref={ref} />;
59
43
  });
@@ -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
- children: React.ReactNode;
11
- /**
12
- * Toggles contained Button styling
13
- */
14
- filled?: boolean;
15
- /**
16
- * The color of the component.
17
- */
18
- color?: "primary" | "secondary" | "tertiary" | "error";
19
- } & Omit<MUIIconButtonProps, 'aria-label' | 'color' | 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'disableFocusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
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 = ({ children, title, filled, color = 'tertiary', ...rest }: IconButtonProps): JSX.Element => {
26
+ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {
27
+ const { title, ...rest } = props;
24
28
  return (
25
29
  <Tooltip title={title}>
26
- { filled ?
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
+ });