react-magma-dom 5.1.0-rc.8 → 5.1.0-rc.9

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.
@@ -8,13 +8,7 @@ declare const info: {
8
8
  control: {
9
9
  type: string;
10
10
  };
11
- options: string[];
12
- mapping: {
13
- top: DrawerPosition;
14
- left: DrawerPosition;
15
- right: DrawerPosition;
16
- bottom: DrawerPosition;
17
- };
11
+ options: DrawerPosition[];
18
12
  };
19
13
  isInverse: {
20
14
  control: {
@@ -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
  */
@@ -12,8 +12,8 @@ export declare const Default: {
12
12
  textTransform: {
13
13
  control: {
14
14
  type: string;
15
- options: typeof ButtonTextTransform;
16
15
  };
16
+ options: ButtonTextTransform[];
17
17
  };
18
18
  };
19
19
  args: {
@@ -32,8 +32,8 @@ export declare const Inverse: {
32
32
  textTransform: {
33
33
  control: {
34
34
  type: string;
35
- options: typeof ButtonTextTransform;
36
35
  };
36
+ options: ButtonTextTransform[];
37
37
  };
38
38
  };
39
39
  args: {
package/dist/esm/index.js CHANGED
@@ -13844,7 +13844,7 @@ var DropdownMenuNavItem = /*#__PURE__*/forwardRef(function (props, forwardedRef)
13844
13844
  });
13845
13845
  DropdownMenuNavItem.displayName = 'DropdownMenuNavItem';
13846
13846
 
13847
- var _excluded$U = ["aria-label", "children", "id", "variant", "onClick"];
13847
+ var _excluded$U = ["aria-label", "children", "id", "variant", "onClick", "leadingIcon"];
13848
13848
  var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
13849
13849
  var context = useContext(DropdownContext);
13850
13850
  var buttonGroupContext = useContext(ButtonGroupContext);
@@ -13857,6 +13857,7 @@ var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef)
13857
13857
  _resolvedProps$varian = resolvedProps.variant,
13858
13858
  variant = _resolvedProps$varian === void 0 ? ButtonVariant.solid : _resolvedProps$varian,
13859
13859
  onClick = resolvedProps.onClick,
13860
+ leadingIcon = resolvedProps.leadingIcon,
13860
13861
  other = _objectWithoutPropertiesLoose(resolvedProps, _excluded$U);
13861
13862
  var ref = useForkedRef(forwardedRef, resolvedContext.toggleRef);
13862
13863
  var splitButtonRef = useRef(null);
@@ -13892,21 +13893,26 @@ var DropdownSplitButton = /*#__PURE__*/forwardRef(function (props, forwardedRef)
13892
13893
  }
13893
13894
  return theme.spaceScale.spacing01;
13894
13895
  }
13896
+ var sharedButtonProps = useMemo(function () {
13897
+ return _extends({}, other, {
13898
+ id: resolvedContext.dropdownButtonId.current,
13899
+ isInverse: resolvedContext.isInverse,
13900
+ onClick: handleButtonClick,
13901
+ shape: ButtonShape.leftCap,
13902
+ style: {
13903
+ borderRight: 0,
13904
+ marginRight: 0
13905
+ },
13906
+ variant: variant,
13907
+ tabIndex: 0,
13908
+ ref: splitButtonRef
13909
+ });
13910
+ }, [props]);
13895
13911
  return /*#__PURE__*/createElement("div", {
13896
13912
  ref: context.setReference
13897
- }, /*#__PURE__*/createElement(Button, Object.assign({}, other, {
13898
- id: resolvedContext.dropdownButtonId.current,
13899
- isInverse: resolvedContext.isInverse,
13900
- onClick: handleButtonClick,
13901
- shape: ButtonShape.leftCap,
13902
- style: {
13903
- borderRight: 0,
13904
- marginRight: 0
13905
- },
13906
- variant: variant,
13907
- tabIndex: 0,
13908
- ref: splitButtonRef
13909
- }), children), /*#__PURE__*/createElement(IconButton, Object.assign({}, other, {
13913
+ }, leadingIcon ? (/*#__PURE__*/createElement(IconButton, Object.assign({}, sharedButtonProps, {
13914
+ icon: leadingIcon
13915
+ }), children)) : (/*#__PURE__*/createElement(Button, Object.assign({}, sharedButtonProps), children)), /*#__PURE__*/createElement(IconButton, Object.assign({}, other, {
13910
13916
  "aria-expanded": resolvedContext.isOpen,
13911
13917
  "aria-label": ariaLabel || i18n.dropdown.toggleMenuAriaLabel,
13912
13918
  "aria-haspopup": "true",