react-magma-dom 4.11.0-next.5 → 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
@@ -3430,7 +3430,9 @@ function buildAIActiveColor(initialProps) {
3430
3430
  return props.theme.colors.neutral100;
3431
3431
  }
3432
3432
  function buildBoxShadow(props) {
3433
- return "0 1px 6px " + curriedTransparentize(0.5, props.theme.colors.primary400);
3433
+ if (!props.disabled) {
3434
+ return props.isInverse ? "0 2px 6px 0 " + curriedTransparentize(0.82, props.theme.colors.neutral900) : "0 1px 6px " + curriedTransparentize(0.5, props.theme.colors.primary400);
3435
+ }
3434
3436
  }
3435
3437
 
3436
3438
  var _templateObject;
@@ -14008,7 +14010,7 @@ var DropdownMenuNavItem = /*#__PURE__*/forwardRef(function (props, forwardedRef)
14008
14010
  });
14009
14011
  DropdownMenuNavItem.displayName = 'DropdownMenuNavItem';
14010
14012
 
14011
- var _excluded$U = ["aria-label", "children", "id", "variant", "onClick"];
14013
+ var _excluded$U = ["aria-label", "children", "id", "variant", "onClick", "leadingIcon"];
14012
14014
  var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
14013
14015
  var context = useContext(DropdownContext);
14014
14016
  var buttonGroupContext = useContext(ButtonGroupContext);
@@ -14021,6 +14023,7 @@ var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef)
14021
14023
  _resolvedProps$varian = resolvedProps.variant,
14022
14024
  variant = _resolvedProps$varian === void 0 ? ButtonVariant.solid : _resolvedProps$varian,
14023
14025
  onClick = resolvedProps.onClick,
14026
+ leadingIcon = resolvedProps.leadingIcon,
14024
14027
  other = _objectWithoutPropertiesLoose(resolvedProps, _excluded$U);
14025
14028
  var ref = useForkedRef(forwardedRef, resolvedContext.toggleRef);
14026
14029
  var splitButtonRef = useRef(null);
@@ -14056,21 +14059,26 @@ var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef)
14056
14059
  }
14057
14060
  return theme.spaceScale.spacing01;
14058
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]);
14059
14077
  return createElement("div", {
14060
14078
  ref: context.setReference
14061
- }, createElement(Button, Object.assign({}, other, {
14062
- id: resolvedContext.dropdownButtonId.current,
14063
- isInverse: resolvedContext.isInverse,
14064
- onClick: handleButtonClick,
14065
- shape: ButtonShape.leftCap,
14066
- style: {
14067
- borderRight: 0,
14068
- marginRight: 0
14069
- },
14070
- variant: variant,
14071
- tabIndex: 0,
14072
- ref: splitButtonRef
14073
- }), 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, {
14074
14082
  "aria-expanded": resolvedContext.isOpen,
14075
14083
  "aria-label": ariaLabel || i18n.dropdown.toggleMenuAriaLabel,
14076
14084
  "aria-haspopup": "true",