@lumx/react 4.17.0-next.1 → 4.17.0-next.3

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.
Files changed (4) hide show
  1. package/index.d.ts +34 -37
  2. package/index.js +227 -191
  3. package/index.js.map +1 -1
  4. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { HorizontalAlignment as HorizontalAlignment$1, Orientation as Orientation$1, Alignment as Alignment$1, Size as Size$1, AspectRatio as AspectRatio$1, ColorPalette as ColorPalette$1, Kind as Kind$1, Emphasis as Emphasis$1, Theme as Theme$1 } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  import * as _lumx_core_js_types from '@lumx/core/js/types';
4
- import { ValueOf as ValueOf$1, GenericProps as GenericProps$1, HasTheme as HasTheme$1, PropsToOverride, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref as HasRequiredLinkHref$1, HasClassName as HasClassName$1, HasCloseMode as HasCloseMode$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, NamedProps, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1 } from '@lumx/core/js/types';
4
+ import { ValueOf as ValueOf$1, GenericProps as GenericProps$1, HasTheme as HasTheme$1, PropsToOverride, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref as HasRequiredLinkHref$1, HasClassName as HasClassName$1, HasCloseMode as HasCloseMode$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1, NamedProps } from '@lumx/core/js/types';
5
5
  export * from '@lumx/core/js/types';
6
6
  import * as React$1 from 'react';
7
7
  import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes } from 'react';
@@ -3472,7 +3472,26 @@ interface LinkPreviewProps extends GenericProps$1, ReactToJSX<LinkPreviewProps$1
3472
3472
  */
3473
3473
  declare const LinkPreview: Comp<LinkPreviewProps, HTMLDivElement>;
3474
3474
 
3475
+ type MenuButtonVariant = 'button' | 'icon-button' | 'chip' | 'link';
3476
+ /** ARIA keys set by MenuButton on the trigger — omitted from variant component props. */
3477
+ type MenuButtonAriaKeys = 'aria-haspopup' | 'aria-controls' | 'aria-expanded';
3478
+ /** Per-variant keys internally managed by MenuButton — omitted from variant component props. */
3479
+ type MenuButtonVariantsInternalKeys = {
3480
+ button: MenuButtonAriaKeys;
3481
+ 'icon-button': MenuButtonAriaKeys;
3482
+ chip: MenuButtonAriaKeys | 'isClickable';
3483
+ link: MenuButtonAriaKeys | 'href' | 'linkAs';
3484
+ };
3485
+ /** Discriminated union of MenuButton props across all trigger variants. */
3486
+ type MenuButtonVariantsProps<TBase, TVariantProps extends Record<MenuButtonVariant, any>> = {
3487
+ [V in MenuButtonVariant]: TBase & (V extends 'button' ? {
3488
+ variant?: V;
3489
+ } : {
3490
+ variant: V;
3491
+ }) & Omit<TVariantProps[V], MenuButtonVariantsInternalKeys[V] | keyof TBase>;
3492
+ }[MenuButtonVariant];
3475
3493
  interface MenuButtonProps$1 {
3494
+ variant?: MenuButtonVariant;
3476
3495
  label?: JSXElement;
3477
3496
  children?: JSXElement;
3478
3497
  triggerProps?: Record<string, any>;
@@ -3481,25 +3500,9 @@ interface MenuButtonProps$1 {
3481
3500
  }
3482
3501
 
3483
3502
  /** MenuPopover props. */
3484
- interface MenuPopoverProps$1 extends HasClassName {
3503
+ interface MenuPopoverProps$1 extends HasClassName, Pick<PopoverProps$1, 'placement' | 'anchorRef' | 'isOpen' | 'handleClose'> {
3485
3504
  /** Popover content (a `Menu`). */
3486
3505
  children?: JSXElement;
3487
- /** Whether the popover is open. */
3488
- isOpen?: boolean;
3489
- /** Placement relative to the anchor. Defaults to `'bottom-start'`. */
3490
- placement?: Placement;
3491
- /** Reference to the anchor element. */
3492
- anchorRef?: CommonRef;
3493
- /** Callback invoked when the popover requests to close (click away, escape). */
3494
- handleClose?(): void;
3495
- /** Whether the popover should close when clicking outside. Default: true. */
3496
- closeOnClickAway?: boolean;
3497
- /** Whether the popover should close on Escape. Default: true. */
3498
- closeOnEscape?: boolean;
3499
- /** Whether to render in a portal. Default: false (avoid stacking-context surprises). */
3500
- usePortal?: boolean;
3501
- /** Whether to focus the anchor on close. Default: true. */
3502
- focusAnchorOnClose?: boolean;
3503
3506
  }
3504
3507
 
3505
3508
  /** Popover props forwarded to the inner Popover (minus managed props). */
@@ -3509,35 +3512,27 @@ interface MenuPopoverProps extends ReactToJSX<MenuPopoverProps$1, 'isOpen' | 'an
3509
3512
  children: ReactNode;
3510
3513
  }
3511
3514
 
3512
- /** Keys managed by MenuButton omitted from the polymorphic trigger props. */
3513
- type OmittedTriggerKeys = 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'label' | 'children' | 'ref';
3514
- /** Polymorphic trigger props with index signature stripped and managed keys removed. */
3515
- type TriggerProps$1<E extends ElementType$1> = Omit<NamedProps<React__default.ComponentProps<E>>, OmittedTriggerKeys>;
3516
- /** Menu button props */
3517
- type MenuButtonProps<E extends ElementType$1 = typeof Button> = TriggerProps$1<E> & ReactToJSX<MenuButtonProps$1, 'triggerProps'> & {
3518
- /** Customize the rendered trigger component. */
3519
- as?: E;
3515
+ /** Props that MenuButton explicitly declares. */
3516
+ type MenuButtonBase = ReactToJSX<MenuButtonProps$1, 'triggerProps' | 'variant'> & {
3520
3517
  children?: React__default.ReactNode;
3521
3518
  popoverProps?: MenuPopoverProps;
3522
3519
  onOpen?: (isOpen: boolean) => void;
3520
+ label: string;
3523
3521
  };
3522
+ /** MenuButton props — discriminated union over the variant to inherit the target component's props. */
3523
+ type MenuButtonProps = MenuButtonVariantsProps<MenuButtonBase, {
3524
+ button: ButtonProps;
3525
+ 'icon-button': IconButtonProps;
3526
+ chip: ChipProps;
3527
+ link: LinkProps;
3528
+ }>;
3524
3529
  /**
3525
3530
  * MenuButton component.
3526
3531
  *
3527
3532
  * @param props Component props.
3528
3533
  * @return React element.
3529
3534
  */
3530
- declare const MenuButton: (<E extends ElementType$1 = Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>(props: TriggerProps$1<E> & ReactToJSX<MenuButtonProps$1, "triggerProps"> & {
3531
- /** Customize the rendered trigger component. */
3532
- as?: E | undefined;
3533
- children?: React__default.ReactNode;
3534
- popoverProps?: MenuPopoverProps;
3535
- onOpen?: (isOpen: boolean) => void;
3536
- } & React__default.ComponentProps<E> & {
3537
- ref?: ComponentRef<E> | undefined;
3538
- }) => React__default.JSX.Element) & {
3539
- displayName: string;
3540
- };
3535
+ declare const MenuButton: Comp<MenuButtonProps, HTMLElement>;
3541
3536
 
3542
3537
  /** MenuItem props. */
3543
3538
  interface MenuItemProps$1 extends HasClassName {
@@ -3573,6 +3568,8 @@ interface MenuItemProps<E extends ElementType$1 = 'button'> extends GenericProps
3573
3568
  onClick?(event: SyntheticEvent): void;
3574
3569
  /** MDI icon rendered as `<Icon size="xs" />` prepended to the `before` slot. */
3575
3570
  icon?: string;
3571
+ /** MDI icon rendered as `<Icon size="xs" />` appended to the `after` slot. */
3572
+ afterIcon?: string;
3576
3573
  /** Foreground color applied to the icon and label text. */
3577
3574
  color?: ColorPalette$1;
3578
3575
  /** Content rendered before the label (rendered AFTER `icon` if both are provided). */