react-magma-dom 4.11.0-next.6 → 4.11.0-next.7

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.
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { IconProps } from 'react-magma-icons';
2
3
  import { ButtonStyles } from '../Button';
3
4
  export interface DropdownSplitButtonProps extends ButtonStyles {
4
5
  /**
@@ -17,6 +18,10 @@ export interface DropdownSplitButtonProps extends ButtonStyles {
17
18
  * If true, element is disabled
18
19
  */
19
20
  disabled?: boolean;
21
+ /**
22
+ * Leading icon to display on the left side within the component
23
+ */
24
+ leadingIcon?: React.ReactElement<IconProps>;
20
25
  /**
21
26
  * Function that fires when the button is clicked
22
27
  */
package/dist/esm/index.js CHANGED
@@ -14010,7 +14010,7 @@ var DropdownMenuNavItem = /*#__PURE__*/forwardRef(function (props, forwardedRef)
14010
14010
  });
14011
14011
  DropdownMenuNavItem.displayName = 'DropdownMenuNavItem';
14012
14012
 
14013
- var _excluded$U = ["aria-label", "children", "id", "variant", "onClick"];
14013
+ var _excluded$U = ["aria-label", "children", "id", "variant", "onClick", "leadingIcon"];
14014
14014
  var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
14015
14015
  var context = useContext(DropdownContext);
14016
14016
  var buttonGroupContext = useContext(ButtonGroupContext);
@@ -14023,6 +14023,7 @@ var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef)
14023
14023
  _resolvedProps$varian = resolvedProps.variant,
14024
14024
  variant = _resolvedProps$varian === void 0 ? ButtonVariant.solid : _resolvedProps$varian,
14025
14025
  onClick = resolvedProps.onClick,
14026
+ leadingIcon = resolvedProps.leadingIcon,
14026
14027
  other = _objectWithoutPropertiesLoose(resolvedProps, _excluded$U);
14027
14028
  var ref = useForkedRef(forwardedRef, resolvedContext.toggleRef);
14028
14029
  var splitButtonRef = useRef(null);
@@ -14058,21 +14059,26 @@ var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef)
14058
14059
  }
14059
14060
  return theme.spaceScale.spacing01;
14060
14061
  }
14062
+ var sharedButtonProps = useMemo(function () {
14063
+ return _extends({}, other, {
14064
+ id: resolvedContext.dropdownButtonId.current,
14065
+ isInverse: resolvedContext.isInverse,
14066
+ onClick: handleButtonClick,
14067
+ shape: ButtonShape.leftCap,
14068
+ style: {
14069
+ borderRight: 0,
14070
+ marginRight: 0
14071
+ },
14072
+ variant: variant,
14073
+ tabIndex: 0,
14074
+ ref: splitButtonRef
14075
+ });
14076
+ }, [props]);
14061
14077
  return createElement("div", {
14062
14078
  ref: context.setReference
14063
- }, createElement(Button, Object.assign({}, other, {
14064
- id: resolvedContext.dropdownButtonId.current,
14065
- isInverse: resolvedContext.isInverse,
14066
- onClick: handleButtonClick,
14067
- shape: ButtonShape.leftCap,
14068
- style: {
14069
- borderRight: 0,
14070
- marginRight: 0
14071
- },
14072
- variant: variant,
14073
- tabIndex: 0,
14074
- ref: splitButtonRef
14075
- }), children), createElement(IconButton, Object.assign({}, other, {
14079
+ }, leadingIcon ? createElement(IconButton, Object.assign({}, sharedButtonProps, {
14080
+ icon: leadingIcon
14081
+ }), children) : createElement(Button, Object.assign({}, sharedButtonProps), children), createElement(IconButton, Object.assign({}, other, {
14076
14082
  "aria-expanded": resolvedContext.isOpen,
14077
14083
  "aria-label": ariaLabel || i18n.dropdown.toggleMenuAriaLabel,
14078
14084
  "aria-haspopup": "true",