@plexui/ui 0.25.0 → 0.26.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.
@@ -4,8 +4,8 @@ import clsx from "clsx";
4
4
  import { useId } from "react";
5
5
  import s from "@plexui/styles/components/FieldGroup/FieldGroup.module.css";
6
6
  /** A titled block of rows: `Field row` lines with hairlines between them. */
7
- export function FieldGroup({ title, description, action, footer, bodyClassName, className, children, ...rest }) {
7
+ export function FieldGroup({ title, description, action, footer, columns = false, bodyClassName, className, children, ...rest }) {
8
8
  const titleId = `field-group-${useId()}`;
9
- return (_jsxs("section", { role: "group", "aria-labelledby": title ? titleId : undefined, ...rest, className: clsx(s.FieldGroup, className), children: [(title || description || action) && (_jsxs("div", { className: s.Header, children: [_jsxs("div", { className: s.HeaderText, children: [title && (_jsx("h2", { className: s.Title, id: titleId, children: title })), description && _jsx("p", { className: s.Description, children: description })] }), action] })), _jsx("div", { className: clsx(s.Body, bodyClassName), children: children }), footer] }));
9
+ return (_jsxs("section", { role: "group", "aria-labelledby": title ? titleId : undefined, "data-field-columns": columns ? "" : undefined, ...rest, className: clsx(s.FieldGroup, className), children: [(title || description || action) && (_jsxs("div", { className: s.Header, children: [_jsxs("div", { className: s.HeaderText, children: [title && (_jsx("h2", { className: s.Title, id: titleId, children: title })), description && _jsx("p", { className: s.Description, children: description })] }), action] })), _jsx("div", { className: clsx(s.Body, bodyClassName), children: children }), footer] }));
10
10
  }
11
11
  //# sourceMappingURL=FieldGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,CAAC,MAAM,4DAA4D,CAAA;AA6B1E,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACS;IAChB,MAAM,OAAO,GAAG,eAAe,KAAK,EAAE,EAAE,CAAA;IAExC,OAAO,CACL,mBAAS,IAAI,EAAC,OAAO,qBAAkB,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,KAAM,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,aACnH,CAAC,KAAK,IAAI,WAAW,IAAI,MAAM,CAAC,IAAI,CACnC,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,aACtB,eAAK,SAAS,EAAE,CAAC,CAAC,UAAU,aACzB,KAAK,IAAI,CACR,aAAI,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,YAChC,KAAK,GACH,CACN,EACA,WAAW,IAAI,YAAG,SAAS,EAAE,CAAC,CAAC,WAAW,YAAG,WAAW,GAAK,IAC1D,EACL,MAAM,IACH,CACP,EACD,cAAK,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,YAAG,QAAQ,GAAO,EAC5D,MAAM,IACC,CACX,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useId } from \"react\"\n\nimport s from \"@plexui/styles/components/FieldGroup/FieldGroup.module.css\"\n\nexport type FieldGroupProps = {\n /**\n * Heading over the block. It names the group.\n */\n title?: React.ReactNode\n /**\n * Line under the title.\n */\n description?: React.ReactNode\n /**\n * Content at the end of the header, such as a button.\n */\n action?: React.ReactNode\n /**\n * Content under the block, such as a note.\n */\n footer?: React.ReactNode\n /**\n * CSS class for the block that holds the rows.\n */\n bodyClassName?: string\n /**\n * The rows: `Field row`, or rows of your own.\n */\n children?: React.ReactNode\n} & Omit<React.ComponentProps<\"section\">, \"title\" | \"children\">\n\n/** A titled block of rows: `Field row` lines with hairlines between them. */\nexport function FieldGroup({\n title,\n description,\n action,\n footer,\n bodyClassName,\n className,\n children,\n ...rest\n}: FieldGroupProps) {\n const titleId = `field-group-${useId()}`\n\n return (\n <section role=\"group\" aria-labelledby={title ? titleId : undefined} {...rest} className={clsx(s.FieldGroup, className)}>\n {(title || description || action) && (\n <div className={s.Header}>\n <div className={s.HeaderText}>\n {title && (\n <h2 className={s.Title} id={titleId}>\n {title}\n </h2>\n )}\n {description && <p className={s.Description}>{description}</p>}\n </div>\n {action}\n </div>\n )}\n <div className={clsx(s.Body, bodyClassName)}>{children}</div>\n {footer}\n </section>\n )\n}\n"]}
1
+ {"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,CAAC,MAAM,4DAA4D,CAAA;AAmC1E,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,OAAO,GAAG,KAAK,EACf,aAAa,EACb,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACS;IAChB,MAAM,OAAO,GAAG,eAAe,KAAK,EAAE,EAAE,CAAA;IAExC,OAAO,CACL,mBACE,IAAI,EAAC,OAAO,qBACK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,wBACxB,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KACxC,IAAI,EACR,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,aAEvC,CAAC,KAAK,IAAI,WAAW,IAAI,MAAM,CAAC,IAAI,CACnC,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,aACtB,eAAK,SAAS,EAAE,CAAC,CAAC,UAAU,aACzB,KAAK,IAAI,CACR,aAAI,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,YAChC,KAAK,GACH,CACN,EACA,WAAW,IAAI,YAAG,SAAS,EAAE,CAAC,CAAC,WAAW,YAAG,WAAW,GAAK,IAC1D,EACL,MAAM,IACH,CACP,EACD,cAAK,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,YAAG,QAAQ,GAAO,EAC5D,MAAM,IACC,CACX,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useId } from \"react\"\n\nimport s from \"@plexui/styles/components/FieldGroup/FieldGroup.module.css\"\n\nexport type FieldGroupProps = {\n /**\n * Heading over the block. It names the group.\n */\n title?: React.ReactNode\n /**\n * Line under the title.\n */\n description?: React.ReactNode\n /**\n * Content at the end of the header, such as a button.\n */\n action?: React.ReactNode\n /**\n * Content under the block, such as a note.\n */\n footer?: React.ReactNode\n /**\n * Every value starts at one column, `--field-row-column-width` into the row, on the\n * web and on a phone. Off, values end at the row's edge.\n * @default false\n */\n columns?: boolean\n /**\n * CSS class for the block that holds the rows.\n */\n bodyClassName?: string\n /**\n * The rows: `Field row`, or rows of your own.\n */\n children?: React.ReactNode\n} & Omit<React.ComponentProps<\"section\">, \"title\" | \"children\">\n\n/** A titled block of rows: `Field row` lines with hairlines between them. */\nexport function FieldGroup({\n title,\n description,\n action,\n footer,\n columns = false,\n bodyClassName,\n className,\n children,\n ...rest\n}: FieldGroupProps) {\n const titleId = `field-group-${useId()}`\n\n return (\n <section\n role=\"group\"\n aria-labelledby={title ? titleId : undefined}\n data-field-columns={columns ? \"\" : undefined}\n {...rest}\n className={clsx(s.FieldGroup, className)}\n >\n {(title || description || action) && (\n <div className={s.Header}>\n <div className={s.HeaderText}>\n {title && (\n <h2 className={s.Title} id={titleId}>\n {title}\n </h2>\n )}\n {description && <p className={s.Description}>{description}</p>}\n </div>\n {action}\n </div>\n )}\n <div className={clsx(s.Body, bodyClassName)}>{children}</div>\n {footer}\n </section>\n )\n}\n"]}
@@ -10,7 +10,7 @@ import { Button } from "../Button/index.js";
10
10
  import { Check, ChevronRight } from "../Icon/index.js";
11
11
  import { useLinkComponent } from "../PlexUIProvider/internal.js";
12
12
  import { TransitionGroup } from "../Transition/index.js";
13
- import { createExitGuard, overlayTiming } from "../Transition/shared.js";
13
+ import { createExitGuard, overlayTiming, overlayTimingQuick } from "../Transition/shared.js";
14
14
  import s from "@plexui/styles/components/Menu/Menu.module.css";
15
15
  const MenuContext = createContext(null);
16
16
  const useMenuContext = () => {
@@ -178,7 +178,7 @@ const SubTrigger = ({ className, children, disabled, }) => {
178
178
  };
179
179
  const SubContent = ({ children, sideOffset = 4, alignOffset = -6, width = "auto", minWidth = "auto", maxHeight, pill = false, }) => {
180
180
  const { open } = useSubmenuContext();
181
- return (_jsx(DropdownMenu.Portal, { forceMount: true, children: _jsx(TransitionGroup, { className: s.Menu, ...overlayTiming, overlay: true, children: open && (_jsx(DropdownMenu.SubContent, { className: s.MenuList, "data-pill": pill ? "" : undefined, sideOffset: sideOffset, alignOffset: alignOffset, avoidCollisions: true, collisionPadding: { bottom: 30, top: 30, left: 12, right: 12 }, onEscapeKeyDown: preventDefaultHandler, style: toCssVariables({
181
+ return (_jsx(DropdownMenu.Portal, { forceMount: true, children: _jsx(TransitionGroup, { className: s.Menu, ...overlayTimingQuick, overlay: true, children: open && (_jsx(DropdownMenu.SubContent, { className: s.MenuList, "data-submenu": "", "data-pill": pill ? "" : undefined, sideOffset: sideOffset, alignOffset: alignOffset, avoidCollisions: true, collisionPadding: { bottom: 30, top: 30, left: 12, right: 12 }, onEscapeKeyDown: preventDefaultHandler, style: toCssVariables({
182
182
  "menu-width": width,
183
183
  "menu-min-width": minWidth,
184
184
  "menu-max-height": maxHeight,
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../src/components/Menu/Menu.t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U,CAAA;AAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;AAC5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;AAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;AAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;AAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;AAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport { DropdownMenu } from \"radix-ui\"\nimport React, {\n type ComponentProps,\n type ComponentType,\n createContext,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from \"react\"\n\nimport clsx from \"clsx\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { Button } from \"../Button\"\nimport { Check, ChevronRight } from \"../Icon\"\nimport { useLinkComponent } from \"../PlexUIProvider/internal\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming } from \"../Transition/shared\"\nimport s from \"@plexui/styles/components/Menu/Menu.module.css\"\n\ntype MenuContextValue = {\n open: boolean\n setOpen: (next: boolean) => void\n}\n\nconst MenuContext = createContext<MenuContextValue | null>(null)\n\nconst useMenuContext = () => {\n const context = useContext(MenuContext)\n\n if (!context) {\n throw new Error(\"Menu components must be wrapped in <Menu />\")\n }\n\n return context\n}\n\nexport type MenuProps = {\n children: React.ReactNode\n /** Force the menu to remain open or closed */\n forceOpen?: boolean\n /** Callback triggered when the modal is opened */\n onOpen?: () => void\n /** Callback triggered when the modal is closed */\n onClose?: () => void\n /**\n * When set to `true`, interaction with outside elements will be disabled and only menu content will be visible to screen readers.\n * @default false\n */\n modal?: boolean\n}\n\nexport const Menu = ({ children, forceOpen, onOpen, onClose, modal = false }: MenuProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = forceOpen ?? open\n\n const latestOnOpen = useLatestValue(onOpen)\n const latestOnClose = useLatestValue(onClose)\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n setOpen(nextState)\n if (nextState) {\n latestOnOpen.current?.()\n } else {\n latestOnClose.current?.()\n }\n },\n [latestOnOpen, latestOnClose],\n )\n\n useEscCloseStack(open, () => {\n handleOpenChange(false)\n })\n\n const store = useMemo<MenuContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <MenuContext.Provider value={store}>\n <DropdownMenu.Root open={isOpen} onOpenChange={handleOpenChange} modal={modal}>\n {children}\n </DropdownMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuItemProps = {\n className?: string\n children: React.ReactNode\n /**\n * Second line under the item's label: what this action does, or which\n * value it carries. The label goes semibold on its own, the same way a\n * Select option with a description does — same pattern, same anatomy.\n */\n description?: ReactNode\n /** Callback triggered when the item is pressed */\n onSelect?: DropdownMenu.DropdownMenuItemProps[\"onSelect\"]\n /** Callback triggered when the item is clicked */\n onClick?: DropdownMenu.DropdownMenuItemProps[\"onClick\"]\n /** Disables the menu item */\n disabled?: boolean\n /** Marks a destructive action (delete, remove, leave): the item is drawn in the danger color */\n danger?: boolean\n}\n\nconst Item = ({ className, children, description, disabled, danger, onSelect, onClick }: MenuItemProps) => {\n const { open } = useMenuContext()\n\n // This handler patches over focus races with core Radix primitives\n // https://github.com/radix-ui/primitives/blob/main/packages/react/menu/src/Menu.tsx#L712-L734\n const handlePreventAfterClose = (evt: React.PointerEvent<HTMLDivElement>) => {\n // Prevent default behavior when we're always known to be closing\n if (!open) {\n evt.preventDefault()\n }\n }\n\n // A described item stacks its two lines; without a description the item\n // keeps the plain flex row that icons and ItemActions rely on.\n const content =\n description === undefined ? (\n children\n ) : (\n <div className={s.ItemLeading}>\n <div>{children}</div>\n <div className={s.ItemDescription}>{description}</div>\n </div>\n )\n\n // Custom click handlers: either callback makes the item interactive\n if (onSelect || onClick) {\n return (\n <DropdownMenu.Item\n className={clsx(s.MenuItem, className)}\n onSelect={onSelect}\n onClick={onClick}\n disabled={disabled}\n data-danger={danger ? \"\" : undefined}\n onPointerMove={handlePreventAfterClose}\n onPointerLeave={handlePreventAfterClose}\n >\n <div className={s.PressableInner}>{content}</div>\n </DropdownMenu.Item>\n )\n }\n\n // Read-only content - will not appear interactive.\n return <div className={clsx(s.MenuItemContent, className)}>{content}</div>\n}\n\nconst ItemActions = ({ className, children }: { className?: string; children: ReactNode }) => {\n return <div className={clsx(s.ItemActions, className)}>{children}</div>\n}\n\nconst ItemAction = ({\n children,\n onClick,\n \"aria-label\": ariaLabel,\n}: {\n children: ReactNode\n onClick: (evt: MouseEvent) => void\n /** Accessible name; the action is an icon-only button */\n \"aria-label\"?: string\n}) => {\n const { setOpen } = useMenuContext()\n\n return (\n <Button\n className=\"rounded-sm\"\n color=\"secondary\"\n size=\"xs\"\n uniform\n iconSize=\"sm\"\n variant=\"ghost\"\n aria-label={ariaLabel}\n onClick={(evt) => {\n evt.stopPropagation()\n setOpen(false)\n onClick(evt)\n }}\n >\n {children}\n </Button>\n )\n}\n\ntype MenuLinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"children\"> & {\n /** Content rendered inside the Link */\n children: React.ReactNode\n /** Disables the menu item */\n disabled?: boolean\n /** Marks a destructive destination: the item is drawn in the danger color */\n danger?: boolean\n}\n\ntype MenuLink = <\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends ComponentType<any> | \"a\" = PlexUI.LinkComponent,\n>(\n props: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> &\n MenuLinkProps & {\n /**\n * Override the default component used for the link. This is useful for\n * using a routing library, or SSR rendering.\n * purposes.\n *\n * @default 'a'\n */\n as?: T\n } & ComponentProps<T>,\n) => ReactNode\n\nconst Link = ((\n props: MenuLinkProps & { href?: string; to?: string; as?: PlexUI.LinkComponent },\n) => {\n const { className, children, href, to, disabled, danger, as: OverrideComponent, ...restProps } = props\n const { open } = useMenuContext()\n\n const propPath = href || to\n // When a path is not provided, default to an anchor\n const isExternal = propPath ? /^https?:\\/\\//.test(propPath) : true\n const DefaultComponent = useLinkComponent()\n const Component = OverrideComponent || (isExternal ? \"a\" : DefaultComponent)\n\n // This handler patches over focus races with core Radix primitives\n // https://github.com/radix-ui/primitives/blob/main/packages/react/menu/src/Menu.tsx#L712-L734\n const handlePreventAfterClose = (evt: React.PointerEvent<HTMLDivElement>) => {\n // Prevent default behavior when we're always known to be closing\n if (!open) {\n evt.preventDefault()\n }\n }\n\n const linkProps = isExternal\n ? { target: \"_blank\", rel: \"noopener noreferrer\", href: href ?? to }\n : { href, to }\n\n return (\n <DropdownMenu.Item\n asChild\n className={clsx(s.MenuItem, className)}\n disabled={disabled}\n data-danger={danger ? \"\" : undefined}\n onPointerMove={isExternal ? undefined : handlePreventAfterClose}\n onPointerLeave={isExternal ? undefined : handlePreventAfterClose}\n >\n <Component\n {...linkProps}\n {...restProps}\n onClick={(event: React.MouseEvent<HTMLAnchorElement>) => {\n restProps.onClick?.(event)\n // Radix skips selecting a disabled item, not the link's navigation\n if (disabled) event.preventDefault()\n }}\n >\n <span className={s.PressableInner}>{children}</span>\n </Component>\n </DropdownMenu.Item>\n )\n}) as MenuLink\n\nconst Separator = ({ className }: { className?: string }) => {\n return <DropdownMenu.Separator className={clsx(s.Separator, className)} role=\"separator\" />\n}\n\n\nconst Label = ({ className, children }: { className?: string; children: ReactNode }) => {\n return (\n <DropdownMenu.Label className={clsx(s.MenuLabel, className)}>\n {children}\n </DropdownMenu.Label>\n )\n}\n\nconst Group = ({\n className,\n children,\n}: {\n className?: string\n children: ReactNode\n}) => {\n return <DropdownMenu.Group className={className}>{children}</DropdownMenu.Group>\n}\n\nexport type MenuContentProps = {\n children: React.ReactNode\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * @default bottom\n */\n side?: DropdownMenu.DropdownMenuContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 5\n */\n sideOffset?: DropdownMenu.DropdownMenuContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: DropdownMenu.DropdownMenuContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: DropdownMenu.DropdownMenuContentProps[\"alignOffset\"]\n /**\n * Defines the `width` property of the content\n * @default auto\n */\n width?: number | \"auto\"\n /**\n * Defines the `min-width` property of the content, in pixels.\n * @default 300\n */\n minWidth?: number | \"auto\"\n /**\n * Defines the `max-width` property of the content, in pixels.\n */\n maxHeight?: number\n /**\n * Rounder list with fully rounded rows, for menus that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n /**\n * Layout direction of menu items.\n * Use `\"horizontal\"` for icon-based toolbars (iOS-style).\n * @default \"vertical\"\n */\n layout?: \"vertical\" | \"horizontal\"\n /**\n * Size of horizontal menu items. Controls icon size and padding.\n * Only applies when `layout=\"horizontal\"`.\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\"\n /**\n * Event handler called when auto-focus tries to return to the trigger\n * after the menu closes. Call `event.preventDefault()` to prevent the\n * trigger from regaining focus (and its focus-visible ring).\n */\n onCloseAutoFocus?: DropdownMenu.DropdownMenuContentProps[\"onCloseAutoFocus\"]\n}\n\nconst Content = ({\n children,\n side,\n sideOffset = 5,\n align,\n alignOffset,\n width,\n minWidth,\n maxHeight,\n pill = false,\n layout = \"vertical\",\n size,\n onCloseAutoFocus,\n}: MenuContentProps) => {\n const { open } = useMenuContext()\n const [exitGuard] = useState(createExitGuard)\n const isHorizontal = layout === \"horizontal\"\n\n return (\n <DropdownMenu.Portal forceMount>\n <TransitionGroup className={s.Menu} {...overlayTiming} {...exitGuard.transition} overlay>\n {open && (\n <DropdownMenu.Content\n key=\"dropdown\"\n forceMount\n className={s.MenuList}\n data-pill={pill ? \"\" : undefined}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n avoidCollisions\n collisionPadding={{ bottom: 30, top: 30, left: 12, right: 12 }}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={exitGuard.onInteractOutside}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n }}\n data-layout={isHorizontal ? \"horizontal\" : undefined}\n data-size={isHorizontal && size ? size : undefined}\n style={toCssVariables({\n \"menu-width\": width,\n \"menu-min-width\": isHorizontal ? \"auto\" : minWidth,\n \"menu-max-height\": maxHeight,\n })}\n >\n {children}\n </DropdownMenu.Content>\n )}\n </TransitionGroup>\n </DropdownMenu.Portal>\n )\n}\n\nconst Trigger = ({\n children,\n disabled,\n ...restProps\n}: DropdownMenu.DropdownMenuTriggerProps & { ref?: React.Ref<HTMLButtonElement> }) => {\n // Always composes onto the child (asChild after the spread wins over a\n // caller's asChild); other props (aria-*, handlers, ref) reach it through\n // the Slot instead of being dropped\n return (\n <DropdownMenu.Trigger {...restProps} asChild disabled={disabled}>\n {children}\n </DropdownMenu.Trigger>\n )\n}\n\ntype SubmenuContextValue = {\n open: boolean\n setOpen: (next: boolean) => void\n triggerRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst SubmenuContext = createContext<SubmenuContextValue | null>(null)\n\nconst useSubmenuContext = () => {\n const context = useContext(SubmenuContext)\n\n if (!context) {\n throw new Error(\"Submenu components must be wrapped in <Sub />\")\n }\n\n return context\n}\n\nexport type SubmenuProps = {\n children: React.ReactNode\n /** Force the menu to remain open or closed */\n forceOpen?: boolean\n /** Callback triggered when the modal is opened */\n onOpen?: () => void\n /** Callback triggered when the modal is closed */\n onClose?: () => void\n}\n\nconst Sub = ({ children, forceOpen, onOpen, onClose }: SubmenuProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const triggerRef = useRef<HTMLDivElement>(null)\n const isOpen = forceOpen ?? open\n\n const latestOnOpen = useLatestValue(onOpen)\n const latestOnClose = useLatestValue(onClose)\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n setOpen(nextState)\n if (nextState) {\n latestOnOpen.current?.()\n } else {\n latestOnClose.current?.()\n }\n },\n [latestOnOpen, latestOnClose],\n )\n\n useEscCloseStack(open, () => {\n handleOpenChange(false)\n // Ensure trigger is focused\n triggerRef.current?.focus()\n })\n\n const store = useMemo<SubmenuContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n triggerRef,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <SubmenuContext.Provider value={store}>\n <DropdownMenu.Sub open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </DropdownMenu.Sub>\n </SubmenuContext.Provider>\n )\n}\n\nconst SubTrigger = ({\n className,\n children,\n disabled,\n}: {\n className?: string\n children: ReactNode\n disabled?: boolean\n}) => {\n const { open } = useMenuContext()\n const { triggerRef } = useSubmenuContext()\n\n // This handler patches over focus races with core Radix primitives\n // https://github.com/radix-ui/primitives/blob/main/packages/react/menu/src/Menu.tsx#L712-L734\n const handlePreventAfterClose = (evt: React.PointerEvent<HTMLDivElement>) => {\n // Prevent default behavior when we know the outer menu is closing\n if (!open) {\n evt.preventDefault()\n }\n }\n\n return (\n <DropdownMenu.SubTrigger\n ref={triggerRef}\n className={clsx(s.MenuItem, s.SubMenuItem, className)}\n disabled={disabled}\n onPointerMove={handlePreventAfterClose}\n onPointerLeave={handlePreventAfterClose}\n >\n <div className={s.PressableInner}>\n {children}\n <ChevronRight width=\"16\" height=\"16\" className={s.SubTriggerIcon} />\n </div>\n </DropdownMenu.SubTrigger>\n )\n}\n\ntype SubContentProps = {\n children: ReactNode\n sideOffset?: DropdownMenu.DropdownMenuSubContentProps[\"sideOffset\"]\n alignOffset?: DropdownMenu.DropdownMenuSubContentProps[\"alignOffset\"]\n width?: number | \"auto\"\n minWidth?: number | \"auto\"\n maxHeight?: number\n pill?: boolean\n}\n\nconst SubContent = ({\n children,\n sideOffset = 4,\n alignOffset = -6,\n width = \"auto\",\n minWidth = \"auto\",\n maxHeight,\n pill = false,\n}: SubContentProps) => {\n const { open } = useSubmenuContext()\n\n return (\n <DropdownMenu.Portal forceMount>\n <TransitionGroup className={s.Menu} {...overlayTiming} overlay>\n {open && (\n <DropdownMenu.SubContent\n key=\"submenu\"\n className={s.MenuList}\n data-pill={pill ? \"\" : undefined}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n avoidCollisions\n collisionPadding={{ bottom: 30, top: 30, left: 12, right: 12 }}\n onEscapeKeyDown={preventDefaultHandler}\n style={toCssVariables({\n \"menu-width\": width,\n \"menu-min-width\": minWidth,\n \"menu-max-height\": maxHeight,\n })}\n >\n {children}\n </DropdownMenu.SubContent>\n )}\n </TransitionGroup>\n </DropdownMenu.Portal>\n )\n}\n\nexport type MenuRadioGroupProps<T extends string> = {\n /** Controlled value */\n value: T\n /** Fired when selection changes */\n onChange: (value: T) => void\n children: ReactNode\n /**\n * The orientation of the indicator within the radio item.\n * @default end\n */\n indicatorPosition?: \"start\" | \"end\"\n}\n\nconst RadioGroup = <T extends string>({\n children,\n value,\n onChange,\n indicatorPosition = \"end\",\n ...props\n}: MenuRadioGroupProps<T>) => (\n <DropdownMenu.RadioGroup\n {...props}\n value={value}\n onValueChange={(v: string) => onChange(v as T)}\n data-indicator-position={indicatorPosition}\n >\n {children}\n </DropdownMenu.RadioGroup>\n)\n\nexport type MenuRadioItemProps<T extends string> = {\n value: T\n /** Class applied to the radio item */\n className?: string\n children: ReactNode\n /** Callback triggered when the radio item is pressed */\n onSelect?: DropdownMenu.DropdownMenuItemProps[\"onSelect\"]\n /** Disables the radio item */\n disabled?: boolean\n}\n\nconst RadioItem = <T extends string>({ className, children, ...props }: MenuRadioItemProps<T>) => (\n <DropdownMenu.RadioItem className={clsx(s.MenuItem, s.RadioItem, className)} {...props}>\n <div className={s.PressableInner}>\n <div className={s.RadioIndicator}>\n <DropdownMenu.ItemIndicator className={s.RadioIndicatorActive} />\n </div>\n {children}\n </div>\n </DropdownMenu.RadioItem>\n)\n\nexport type MenuCheckboxItemProps = {\n /** Controlled checked state of the checkbox item */\n checked?: DropdownMenu.DropdownMenuCheckboxItemProps[\"checked\"]\n /** Event handler called when the checked state changes */\n onCheckedChange?: DropdownMenu.DropdownMenuCheckboxItemProps[\"onCheckedChange\"]\n /** Class applied to the checkbox item */\n className?: string\n children: ReactNode\n /** Callback triggered when the checkbox item is pressed */\n onSelect?: DropdownMenu.DropdownMenuItemProps[\"onSelect\"]\n /** Disables the checkbox item */\n disabled?: boolean\n /**\n * The orientation of the indicator within the checkbox item.\n * @default end\n */\n indicatorPosition?: \"start\" | \"end\"\n /**\n * Visual treatment for the checkbox indicator.\n * @default solid\n */\n indicatorVariant?: \"solid\" | \"ghost\"\n}\nconst CheckboxItem = ({\n className,\n children,\n indicatorPosition = \"end\",\n indicatorVariant = \"solid\",\n ...props\n}: MenuCheckboxItemProps) => (\n <DropdownMenu.CheckboxItem\n className={clsx(s.MenuItem, s.CheckboxItem, className)}\n {...props}\n data-indicator-position={indicatorPosition}\n data-indicator-variant={indicatorVariant}\n >\n <div className={s.PressableInner}>\n <div className={s.CheckboxIndicator}>\n <DropdownMenu.ItemIndicator>\n {indicatorVariant === \"ghost\" ? (\n <Check className=\"size-4\" />\n ) : (\n <div className={s.CheckboxCircle}>\n <Check className=\"size-4\" />\n </div>\n )}\n </DropdownMenu.ItemIndicator>\n </div>\n {children}\n </div>\n </DropdownMenu.CheckboxItem>\n)\n\nMenu.Content = Content\nMenu.Item = Item\nMenu.ItemActions = ItemActions\nMenu.ItemAction = ItemAction\nMenu.Link = Link\nMenu.Separator = Separator\nMenu.Trigger = Trigger\nMenu.Sub = Sub\nMenu.SubTrigger = SubTrigger\nMenu.SubContent = SubContent\nMenu.CheckboxItem = CheckboxItem\nMenu.RadioGroup = RadioGroup\nMenu.RadioItem = RadioItem\nMenu.Label = Label\nMenu.Group = Group\n"]}
1
+ {"version":3,"file":"Menu.js","sourceRo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AC,GAAG,GAAG,GAAG,CAAA;AACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;AAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;AAC5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;AAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;AAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;AAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;AAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport { DropdownMenu } from \"radix-ui\"\nimport React, {\n type ComponentProps,\n type ComponentType,\n createContext,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from \"react\"\n\nimport clsx from \"clsx\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { Button } from \"../Button\"\nimport { Check, ChevronRight } from \"../Icon\"\nimport { useLinkComponent } from \"../PlexUIProvider/internal\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingQuick } from \"../Transition/shared\"\nimport s from \"@plexui/styles/components/Menu/Menu.module.css\"\n\ntype MenuContextValue = {\n open: boolean\n setOpen: (next: boolean) => void\n}\n\nconst MenuContext = createContext<MenuContextValue | null>(null)\n\nconst useMenuContext = () => {\n const context = useContext(MenuContext)\n\n if (!context) {\n throw new Error(\"Menu components must be wrapped in <Menu />\")\n }\n\n return context\n}\n\nexport type MenuProps = {\n children: React.ReactNode\n /** Force the menu to remain open or closed */\n forceOpen?: boolean\n /** Callback triggered when the modal is opened */\n onOpen?: () => void\n /** Callback triggered when the modal is closed */\n onClose?: () => void\n /**\n * When set to `true`, interaction with outside elements will be disabled and only menu content will be visible to screen readers.\n * @default false\n */\n modal?: boolean\n}\n\nexport const Menu = ({ children, forceOpen, onOpen, onClose, modal = false }: MenuProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = forceOpen ?? open\n\n const latestOnOpen = useLatestValue(onOpen)\n const latestOnClose = useLatestValue(onClose)\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n setOpen(nextState)\n if (nextState) {\n latestOnOpen.current?.()\n } else {\n latestOnClose.current?.()\n }\n },\n [latestOnOpen, latestOnClose],\n )\n\n useEscCloseStack(open, () => {\n handleOpenChange(false)\n })\n\n const store = useMemo<MenuContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <MenuContext.Provider value={store}>\n <DropdownMenu.Root open={isOpen} onOpenChange={handleOpenChange} modal={modal}>\n {children}\n </DropdownMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuItemProps = {\n className?: string\n children: React.ReactNode\n /**\n * Second line under the item's label: what this action does, or which\n * value it carries. The label goes semibold on its own, the same way a\n * Select option with a description does — same pattern, same anatomy.\n */\n description?: ReactNode\n /** Callback triggered when the item is pressed */\n onSelect?: DropdownMenu.DropdownMenuItemProps[\"onSelect\"]\n /** Callback triggered when the item is clicked */\n onClick?: DropdownMenu.DropdownMenuItemProps[\"onClick\"]\n /** Disables the menu item */\n disabled?: boolean\n /** Marks a destructive action (delete, remove, leave): the item is drawn in the danger color */\n danger?: boolean\n}\n\nconst Item = ({ className, children, description, disabled, danger, onSelect, onClick }: MenuItemProps) => {\n const { open } = useMenuContext()\n\n // This handler patches over focus races with core Radix primitives\n // https://github.com/radix-ui/primitives/blob/main/packages/react/menu/src/Menu.tsx#L712-L734\n const handlePreventAfterClose = (evt: React.PointerEvent<HTMLDivElement>) => {\n // Prevent default behavior when we're always known to be closing\n if (!open) {\n evt.preventDefault()\n }\n }\n\n // A described item stacks its two lines; without a description the item\n // keeps the plain flex row that icons and ItemActions rely on.\n const content =\n description === undefined ? (\n children\n ) : (\n <div className={s.ItemLeading}>\n <div>{children}</div>\n <div className={s.ItemDescription}>{description}</div>\n </div>\n )\n\n // Custom click handlers: either callback makes the item interactive\n if (onSelect || onClick) {\n return (\n <DropdownMenu.Item\n className={clsx(s.MenuItem, className)}\n onSelect={onSelect}\n onClick={onClick}\n disabled={disabled}\n data-danger={danger ? \"\" : undefined}\n onPointerMove={handlePreventAfterClose}\n onPointerLeave={handlePreventAfterClose}\n >\n <div className={s.PressableInner}>{content}</div>\n </DropdownMenu.Item>\n )\n }\n\n // Read-only content - will not appear interactive.\n return <div className={clsx(s.MenuItemContent, className)}>{content}</div>\n}\n\nconst ItemActions = ({ className, children }: { className?: string; children: ReactNode }) => {\n return <div className={clsx(s.ItemActions, className)}>{children}</div>\n}\n\nconst ItemAction = ({\n children,\n onClick,\n \"aria-label\": ariaLabel,\n}: {\n children: ReactNode\n onClick: (evt: MouseEvent) => void\n /** Accessible name; the action is an icon-only button */\n \"aria-label\"?: string\n}) => {\n const { setOpen } = useMenuContext()\n\n return (\n <Button\n className=\"rounded-sm\"\n color=\"secondary\"\n size=\"xs\"\n uniform\n iconSize=\"sm\"\n variant=\"ghost\"\n aria-label={ariaLabel}\n onClick={(evt) => {\n evt.stopPropagation()\n setOpen(false)\n onClick(evt)\n }}\n >\n {children}\n </Button>\n )\n}\n\ntype MenuLinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"children\"> & {\n /** Content rendered inside the Link */\n children: React.ReactNode\n /** Disables the menu item */\n disabled?: boolean\n /** Marks a destructive destination: the item is drawn in the danger color */\n danger?: boolean\n}\n\ntype MenuLink = <\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends ComponentType<any> | \"a\" = PlexUI.LinkComponent,\n>(\n props: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> &\n MenuLinkProps & {\n /**\n * Override the default component used for the link. This is useful for\n * using a routing library, or SSR rendering.\n * purposes.\n *\n * @default 'a'\n */\n as?: T\n } & ComponentProps<T>,\n) => ReactNode\n\nconst Link = ((\n props: MenuLinkProps & { href?: string; to?: string; as?: PlexUI.LinkComponent },\n) => {\n const { className, children, href, to, disabled, danger, as: OverrideComponent, ...restProps } = props\n const { open } = useMenuContext()\n\n const propPath = href || to\n // When a path is not provided, default to an anchor\n const isExternal = propPath ? /^https?:\\/\\//.test(propPath) : true\n const DefaultComponent = useLinkComponent()\n const Component = OverrideComponent || (isExternal ? \"a\" : DefaultComponent)\n\n // This handler patches over focus races with core Radix primitives\n // https://github.com/radix-ui/primitives/blob/main/packages/react/menu/src/Menu.tsx#L712-L734\n const handlePreventAfterClose = (evt: React.PointerEvent<HTMLDivElement>) => {\n // Prevent default behavior when we're always known to be closing\n if (!open) {\n evt.preventDefault()\n }\n }\n\n const linkProps = isExternal\n ? { target: \"_blank\", rel: \"noopener noreferrer\", href: href ?? to }\n : { href, to }\n\n return (\n <DropdownMenu.Item\n asChild\n className={clsx(s.MenuItem, className)}\n disabled={disabled}\n data-danger={danger ? \"\" : undefined}\n onPointerMove={isExternal ? undefined : handlePreventAfterClose}\n onPointerLeave={isExternal ? undefined : handlePreventAfterClose}\n >\n <Component\n {...linkProps}\n {...restProps}\n onClick={(event: React.MouseEvent<HTMLAnchorElement>) => {\n restProps.onClick?.(event)\n // Radix skips selecting a disabled item, not the link's navigation\n if (disabled) event.preventDefault()\n }}\n >\n <span className={s.PressableInner}>{children}</span>\n </Component>\n </DropdownMenu.Item>\n )\n}) as MenuLink\n\nconst Separator = ({ className }: { className?: string }) => {\n return <DropdownMenu.Separator className={clsx(s.Separator, className)} role=\"separator\" />\n}\n\n\nconst Label = ({ className, children }: { className?: string; children: ReactNode }) => {\n return (\n <DropdownMenu.Label className={clsx(s.MenuLabel, className)}>\n {children}\n </DropdownMenu.Label>\n )\n}\n\nconst Group = ({\n className,\n children,\n}: {\n className?: string\n children: ReactNode\n}) => {\n return <DropdownMenu.Group className={className}>{children}</DropdownMenu.Group>\n}\n\nexport type MenuContentProps = {\n children: React.ReactNode\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * @default bottom\n */\n side?: DropdownMenu.DropdownMenuContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 5\n */\n sideOffset?: DropdownMenu.DropdownMenuContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: DropdownMenu.DropdownMenuContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: DropdownMenu.DropdownMenuContentProps[\"alignOffset\"]\n /**\n * Defines the `width` property of the content\n * @default auto\n */\n width?: number | \"auto\"\n /**\n * Defines the `min-width` property of the content, in pixels.\n * @default 300\n */\n minWidth?: number | \"auto\"\n /**\n * Defines the `max-width` property of the content, in pixels.\n */\n maxHeight?: number\n /**\n * Rounder list with fully rounded rows, for menus that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n /**\n * Layout direction of menu items.\n * Use `\"horizontal\"` for icon-based toolbars (iOS-style).\n * @default \"vertical\"\n */\n layout?: \"vertical\" | \"horizontal\"\n /**\n * Size of horizontal menu items. Controls icon size and padding.\n * Only applies when `layout=\"horizontal\"`.\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\"\n /**\n * Event handler called when auto-focus tries to return to the trigger\n * after the menu closes. Call `event.preventDefault()` to prevent the\n * trigger from regaining focus (and its focus-visible ring).\n */\n onCloseAutoFocus?: DropdownMenu.DropdownMenuContentProps[\"onCloseAutoFocus\"]\n}\n\nconst Content = ({\n children,\n side,\n sideOffset = 5,\n align,\n alignOffset,\n width,\n minWidth,\n maxHeight,\n pill = false,\n layout = \"vertical\",\n size,\n onCloseAutoFocus,\n}: MenuContentProps) => {\n const { open } = useMenuContext()\n const [exitGuard] = useState(createExitGuard)\n const isHorizontal = layout === \"horizontal\"\n\n return (\n <DropdownMenu.Portal forceMount>\n <TransitionGroup className={s.Menu} {...overlayTiming} {...exitGuard.transition} overlay>\n {open && (\n <DropdownMenu.Content\n key=\"dropdown\"\n forceMount\n className={s.MenuList}\n data-pill={pill ? \"\" : undefined}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n avoidCollisions\n collisionPadding={{ bottom: 30, top: 30, left: 12, right: 12 }}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={exitGuard.onInteractOutside}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n }}\n data-layout={isHorizontal ? \"horizontal\" : undefined}\n data-size={isHorizontal && size ? size : undefined}\n style={toCssVariables({\n \"menu-width\": width,\n \"menu-min-width\": isHorizontal ? \"auto\" : minWidth,\n \"menu-max-height\": maxHeight,\n })}\n >\n {children}\n </DropdownMenu.Content>\n )}\n </TransitionGroup>\n </DropdownMenu.Portal>\n )\n}\n\nconst Trigger = ({\n children,\n disabled,\n ...restProps\n}: DropdownMenu.DropdownMenuTriggerProps & { ref?: React.Ref<HTMLButtonElement> }) => {\n // Always composes onto the child (asChild after the spread wins over a\n // caller's asChild); other props (aria-*, handlers, ref) reach it through\n // the Slot instead of being dropped\n return (\n <DropdownMenu.Trigger {...restProps} asChild disabled={disabled}>\n {children}\n </DropdownMenu.Trigger>\n )\n}\n\ntype SubmenuContextValue = {\n open: boolean\n setOpen: (next: boolean) => void\n triggerRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst SubmenuContext = createContext<SubmenuContextValue | null>(null)\n\nconst useSubmenuContext = () => {\n const context = useContext(SubmenuContext)\n\n if (!context) {\n throw new Error(\"Submenu components must be wrapped in <Sub />\")\n }\n\n return context\n}\n\nexport type SubmenuProps = {\n children: React.ReactNode\n /** Force the menu to remain open or closed */\n forceOpen?: boolean\n /** Callback triggered when the modal is opened */\n onOpen?: () => void\n /** Callback triggered when the modal is closed */\n onClose?: () => void\n}\n\nconst Sub = ({ children, forceOpen, onOpen, onClose }: SubmenuProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const triggerRef = useRef<HTMLDivElement>(null)\n const isOpen = forceOpen ?? open\n\n const latestOnOpen = useLatestValue(onOpen)\n const latestOnClose = useLatestValue(onClose)\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n setOpen(nextState)\n if (nextState) {\n latestOnOpen.current?.()\n } else {\n latestOnClose.current?.()\n }\n },\n [latestOnOpen, latestOnClose],\n )\n\n useEscCloseStack(open, () => {\n handleOpenChange(false)\n // Ensure trigger is focused\n triggerRef.current?.focus()\n })\n\n const store = useMemo<SubmenuContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n triggerRef,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <SubmenuContext.Provider value={store}>\n <DropdownMenu.Sub open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </DropdownMenu.Sub>\n </SubmenuContext.Provider>\n )\n}\n\nconst SubTrigger = ({\n className,\n children,\n disabled,\n}: {\n className?: string\n children: ReactNode\n disabled?: boolean\n}) => {\n const { open } = useMenuContext()\n const { triggerRef } = useSubmenuContext()\n\n // This handler patches over focus races with core Radix primitives\n // https://github.com/radix-ui/primitives/blob/main/packages/react/menu/src/Menu.tsx#L712-L734\n const handlePreventAfterClose = (evt: React.PointerEvent<HTMLDivElement>) => {\n // Prevent default behavior when we know the outer menu is closing\n if (!open) {\n evt.preventDefault()\n }\n }\n\n return (\n <DropdownMenu.SubTrigger\n ref={triggerRef}\n className={clsx(s.MenuItem, s.SubMenuItem, className)}\n disabled={disabled}\n onPointerMove={handlePreventAfterClose}\n onPointerLeave={handlePreventAfterClose}\n >\n <div className={s.PressableInner}>\n {children}\n <ChevronRight width=\"16\" height=\"16\" className={s.SubTriggerIcon} />\n </div>\n </DropdownMenu.SubTrigger>\n )\n}\n\ntype SubContentProps = {\n children: ReactNode\n sideOffset?: DropdownMenu.DropdownMenuSubContentProps[\"sideOffset\"]\n alignOffset?: DropdownMenu.DropdownMenuSubContentProps[\"alignOffset\"]\n width?: number | \"auto\"\n minWidth?: number | \"auto\"\n maxHeight?: number\n pill?: boolean\n}\n\nconst SubContent = ({\n children,\n sideOffset = 4,\n alignOffset = -6,\n width = \"auto\",\n minWidth = \"auto\",\n maxHeight,\n pill = false,\n}: SubContentProps) => {\n const { open } = useSubmenuContext()\n\n return (\n <DropdownMenu.Portal forceMount>\n <TransitionGroup className={s.Menu} {...overlayTimingQuick} overlay>\n {open && (\n <DropdownMenu.SubContent\n key=\"submenu\"\n className={s.MenuList}\n data-submenu=\"\"\n data-pill={pill ? \"\" : undefined}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n avoidCollisions\n collisionPadding={{ bottom: 30, top: 30, left: 12, right: 12 }}\n onEscapeKeyDown={preventDefaultHandler}\n style={toCssVariables({\n \"menu-width\": width,\n \"menu-min-width\": minWidth,\n \"menu-max-height\": maxHeight,\n })}\n >\n {children}\n </DropdownMenu.SubContent>\n )}\n </TransitionGroup>\n </DropdownMenu.Portal>\n )\n}\n\nexport type MenuRadioGroupProps<T extends string> = {\n /** Controlled value */\n value: T\n /** Fired when selection changes */\n onChange: (value: T) => void\n children: ReactNode\n /**\n * The orientation of the indicator within the radio item.\n * @default end\n */\n indicatorPosition?: \"start\" | \"end\"\n}\n\nconst RadioGroup = <T extends string>({\n children,\n value,\n onChange,\n indicatorPosition = \"end\",\n ...props\n}: MenuRadioGroupProps<T>) => (\n <DropdownMenu.RadioGroup\n {...props}\n value={value}\n onValueChange={(v: string) => onChange(v as T)}\n data-indicator-position={indicatorPosition}\n >\n {children}\n </DropdownMenu.RadioGroup>\n)\n\nexport type MenuRadioItemProps<T extends string> = {\n value: T\n /** Class applied to the radio item */\n className?: string\n children: ReactNode\n /** Callback triggered when the radio item is pressed */\n onSelect?: DropdownMenu.DropdownMenuItemProps[\"onSelect\"]\n /** Disables the radio item */\n disabled?: boolean\n}\n\nconst RadioItem = <T extends string>({ className, children, ...props }: MenuRadioItemProps<T>) => (\n <DropdownMenu.RadioItem className={clsx(s.MenuItem, s.RadioItem, className)} {...props}>\n <div className={s.PressableInner}>\n <div className={s.RadioIndicator}>\n <DropdownMenu.ItemIndicator className={s.RadioIndicatorActive} />\n </div>\n {children}\n </div>\n </DropdownMenu.RadioItem>\n)\n\nexport type MenuCheckboxItemProps = {\n /** Controlled checked state of the checkbox item */\n checked?: DropdownMenu.DropdownMenuCheckboxItemProps[\"checked\"]\n /** Event handler called when the checked state changes */\n onCheckedChange?: DropdownMenu.DropdownMenuCheckboxItemProps[\"onCheckedChange\"]\n /** Class applied to the checkbox item */\n className?: string\n children: ReactNode\n /** Callback triggered when the checkbox item is pressed */\n onSelect?: DropdownMenu.DropdownMenuItemProps[\"onSelect\"]\n /** Disables the checkbox item */\n disabled?: boolean\n /**\n * The orientation of the indicator within the checkbox item.\n * @default end\n */\n indicatorPosition?: \"start\" | \"end\"\n /**\n * Visual treatment for the checkbox indicator.\n * @default solid\n */\n indicatorVariant?: \"solid\" | \"ghost\"\n}\nconst CheckboxItem = ({\n className,\n children,\n indicatorPosition = \"end\",\n indicatorVariant = \"solid\",\n ...props\n}: MenuCheckboxItemProps) => (\n <DropdownMenu.CheckboxItem\n className={clsx(s.MenuItem, s.CheckboxItem, className)}\n {...props}\n data-indicator-position={indicatorPosition}\n data-indicator-variant={indicatorVariant}\n >\n <div className={s.PressableInner}>\n <div className={s.CheckboxIndicator}>\n <DropdownMenu.ItemIndicator>\n {indicatorVariant === \"ghost\" ? (\n <Check className=\"size-4\" />\n ) : (\n <div className={s.CheckboxCircle}>\n <Check className=\"size-4\" />\n </div>\n )}\n </DropdownMenu.ItemIndicator>\n </div>\n {children}\n </div>\n </DropdownMenu.CheckboxItem>\n)\n\nMenu.Content = Content\nMenu.Item = Item\nMenu.ItemActions = ItemActions\nMenu.ItemAction = ItemAction\nMenu.Link = Link\nMenu.Separator = Separator\nMenu.Trigger = Trigger\nMenu.Sub = Sub\nMenu.SubTrigger = SubTrigger\nMenu.SubContent = SubContent\nMenu.CheckboxItem = CheckboxItem\nMenu.RadioGroup = RadioGroup\nMenu.RadioItem = RadioItem\nMenu.Label = Label\nMenu.Group = Group\n"]}
@@ -19,6 +19,8 @@ export const noop = () => { };
19
19
  export const overlayTiming = { enterDuration: 250, exitDuration: 150 };
20
20
  /** A panel that crosses the screen: a sheet or a side panel */
21
21
  export const overlayTimingLarge = { enterDuration: 300, exitDuration: 200 };
22
+ /** A submenu: it opens after a hover delay of its own, so it shows at once */
23
+ export const overlayTimingQuick = { enterDuration: 100, exitDuration: 100 };
22
24
  /**
23
25
  * An overlay stays a dismissable layer through its exit. A press on its trigger
24
26
  * turns it around, and the layer must not count that press as outside and
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/Transition/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAwDnD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAyB,EAAE,EAAE,CAC3D,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAA;AAOrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAyB,EACzB,cAAuB,KAAK,EAC5B,gBAAwB,iBAAiB,EAClB,EAAE;IACzB,MAAM,aAAa,GAA0B,EAAE,CAAA;IAC/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACnC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACxE,2FAA2F;YAC3F,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC3B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IAAI,KAAK,CAAC,IAAI,GAAG,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,oDAAoD,aAAa,KAAK,CAAC,CAAA;IACzF,CAAC;AACH,CAAC","sourcesContent":["import React, { Children, useCallback, useRef } from \"react\"\nimport { isDev, isTest } from \"../../lib/constants\"\n\nexport type TransitionDefinition = {\n opacity?: number\n /** The horizontal translation value in pixels */\n x?: number\n /** The horizontal vertical value in pixels */\n y?: number\n /** The opacity value ranging from 0 to 1. */\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n blur?: number\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type InitialTransitionDefinition = Omit<\n TransitionDefinition,\n \"duration\" | \"delay\" | \"timingFunction\"\n>\n\nexport type LayoutTransitionDefinition = {\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type CallbackType =\n | \"enter\"\n | \"enter-active\"\n | \"enter-complete\"\n | \"exit\"\n | \"exit-active\"\n | \"exit-complete\"\n\n// Transition callbacks and types shared across implementations\nexport type TransitionGroupChildCallback = (element: HTMLDivElement) => void\n\nexport type TransitionGroupChildCallbacks = {\n /** Callback fired when an enter animation is staged (e.g., component mounted to the DOM) */\n onEnter: TransitionGroupChildCallback\n /** Callback fired when an enter animation starts */\n onEnterActive: TransitionGroupChildCallback\n /** Callback fired when an enter animation completes */\n onEnterComplete: TransitionGroupChildCallback\n /** Callback fired when an exit animation is staged */\n onExit: TransitionGroupChildCallback\n /** Callback fired when an exit animation starts */\n onExitActive: TransitionGroupChildCallback\n /** Callback fired when an exit animation completes (e.g., component unmounted from the DOM) */\n onExitComplete: TransitionGroupChildCallback\n}\n\nexport const NonNullChildren = (children: React.ReactNode) =>\n Children.toArray(children).filter((child) => child !== null && child !== undefined)\n\n// Shared keyed-children and transition helpers\nexport interface ReactElementWithKey extends React.ReactElement {\n key: string\n}\n\nexport const ChildrenWithKeys = (\n children: React.ReactNode,\n shouldThrow: boolean = false,\n componentName: string = \"TransitionGroup\",\n): ReactElementWithKey[] => {\n const validChildren: ReactElementWithKey[] = []\n Children.forEach(children, (child) => {\n if (child && typeof child === \"object\" && \"key\" in child && !!child.key) {\n // @ts-expect-error -- The above conditional is enough coercion that the component is valid\n validChildren.push(child)\n } else if (shouldThrow) {\n throw new Error(`Child elements of <${componentName} /> must include a \\`key\\``)\n }\n })\n return validChildren\n}\n\nexport const noop = () => {}\n\n// Overlay timers, in step with the `--motion-*` tokens\nexport const overlayTiming = { enterDuration: 250, exitDuration: 150 }\n/** A panel that crosses the screen: a sheet or a side panel */\nexport const overlayTimingLarge = { enterDuration: 300, exitDuration: 200 }\n\n/**\n * An overlay stays a dismissable layer through its exit. A press on its trigger\n * turns it around, and the layer must not count that press as outside and\n * close it again: pass `transition` to the TransitionGroup and\n * `onInteractOutside` to the layer.\n */\nexport const createExitGuard = () => {\n let exiting = false\n return {\n transition: {\n onExit: () => {\n exiting = true\n },\n onEnterActive: () => {\n exiting = false\n },\n onExitComplete: () => {\n exiting = false\n },\n },\n onInteractOutside: (event: Event) => {\n if (exiting) event.preventDefault()\n },\n }\n}\n\nexport const useChildCallback = (cb: (el: HTMLDivElement) => void) => {\n const ref = useRef(cb)\n ref.current = cb\n return useCallback<(el: HTMLDivElement) => void>((element) => ref.current(element), [])\n}\n\nexport type InsertMethod = \"append\" | \"prepend\"\n\nexport function computeNextRenderChildren<\n RenderChild extends { component: ReactElementWithKey; shouldRender: boolean },\n>(\n propChildrenArray: ReactElementWithKey[],\n currentRenderChildren: RenderChild[],\n createDefaultRenderChildProps: (child: ReactElementWithKey) => RenderChild,\n insertMethod: InsertMethod,\n): RenderChild[] {\n // Sets, not plain objects: a key such as \"constructor\" must not match an\n // inherited Object property\n const propChildKeys = new Set(propChildrenArray.map((child) => child.key))\n const currentRenderChildKeys = new Set(currentRenderChildren.map((child) => child.component.key))\n\n const newRenderChildren: RenderChild[] = propChildrenArray\n .filter((propChild) => !currentRenderChildKeys.has(propChild.key))\n .map(createDefaultRenderChildProps)\n\n const updatedCurrentChildren: RenderChild[] = currentRenderChildren.map((childProps) => ({\n ...childProps,\n component:\n propChildrenArray.find(({ key }) => key === childProps.component.key) || childProps.component,\n shouldRender: propChildKeys.has(childProps.component.key),\n }))\n\n return insertMethod === \"append\"\n ? updatedCurrentChildren.concat(newRenderChildren)\n : newRenderChildren.concat(updatedCurrentChildren)\n}\n\nexport function assertSingleChildWhenRef(\n componentName: string,\n ref: React.Ref<unknown> | undefined,\n childrenCount: number,\n): void {\n if ((isTest || isDev) && ref && childrenCount > 1) {\n throw new Error(`Cannot use forwardRef with multiple children in <${componentName} />`)\n }\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/Transition/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAwDnD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAyB,EAAE,EAAE,CAC3D,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAA;AAOrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAyB,EACzB,cAAuB,KAAK,EAC5B,gBAAwB,iBAAiB,EAClB,EAAE;IACzB,MAAM,aAAa,GAA0B,EAAE,CAAA;IAC/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACnC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACxE,2FAA2F;YAC3F,aAAa,CAAC,IAAI,CAAC,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CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAA;AACtD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,aAAqB,EACrB,GAAmC,EACnC,aAAqB;IAErB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,GAAG,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,oDAAoD,aAAa,KAAK,CAAC,CAAA;IACzF,CAAC;AACH,CAAC","sourcesContent":["import React, { Children, useCallback, useRef } from \"react\"\nimport { isDev, isTest } from \"../../lib/constants\"\n\nexport type TransitionDefinition = {\n opacity?: number\n /** The horizontal translation value in pixels */\n x?: number\n /** The horizontal vertical value in pixels */\n y?: number\n /** The opacity value ranging from 0 to 1. */\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n blur?: number\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type InitialTransitionDefinition = Omit<\n TransitionDefinition,\n \"duration\" | \"delay\" | \"timingFunction\"\n>\n\nexport type LayoutTransitionDefinition = {\n duration?: number\n delay?: number\n timingFunction?: string\n}\n\nexport type CallbackType =\n | \"enter\"\n | \"enter-active\"\n | \"enter-complete\"\n | \"exit\"\n | \"exit-active\"\n | \"exit-complete\"\n\n// Transition callbacks and types shared across implementations\nexport type TransitionGroupChildCallback = (element: HTMLDivElement) => void\n\nexport type TransitionGroupChildCallbacks = {\n /** Callback fired when an enter animation is staged (e.g., component mounted to the DOM) */\n onEnter: TransitionGroupChildCallback\n /** Callback fired when an enter animation starts */\n onEnterActive: TransitionGroupChildCallback\n /** Callback fired when an enter animation completes */\n onEnterComplete: TransitionGroupChildCallback\n /** Callback fired when an exit animation is staged */\n onExit: TransitionGroupChildCallback\n /** Callback fired when an exit animation starts */\n onExitActive: TransitionGroupChildCallback\n /** Callback fired when an exit animation completes (e.g., component unmounted from the DOM) */\n onExitComplete: TransitionGroupChildCallback\n}\n\nexport const NonNullChildren = (children: React.ReactNode) =>\n Children.toArray(children).filter((child) => child !== null && child !== undefined)\n\n// Shared keyed-children and transition helpers\nexport interface ReactElementWithKey extends React.ReactElement {\n key: string\n}\n\nexport const ChildrenWithKeys = (\n children: React.ReactNode,\n shouldThrow: boolean = false,\n componentName: string = \"TransitionGroup\",\n): ReactElementWithKey[] => {\n const validChildren: ReactElementWithKey[] = []\n Children.forEach(children, (child) => {\n if (child && typeof child === \"object\" && \"key\" in child && !!child.key) {\n // @ts-expect-error -- The above conditional is enough coercion that the component is valid\n validChildren.push(child)\n } else if (shouldThrow) {\n throw new Error(`Child elements of <${componentName} /> must include a \\`key\\``)\n }\n })\n return validChildren\n}\n\nexport const noop = () => {}\n\n// Overlay timers, in step with the `--motion-*` tokens\nexport const overlayTiming = { enterDuration: 250, exitDuration: 150 }\n/** A panel that crosses the screen: a sheet or a side panel */\nexport const overlayTimingLarge = { enterDuration: 300, exitDuration: 200 }\n/** A submenu: it opens after a hover delay of its own, so it shows at once */\nexport const overlayTimingQuick = { enterDuration: 100, exitDuration: 100 }\n\n/**\n * An overlay stays a dismissable layer through its exit. A press on its trigger\n * turns it around, and the layer must not count that press as outside and\n * close it again: pass `transition` to the TransitionGroup and\n * `onInteractOutside` to the layer.\n */\nexport const createExitGuard = () => {\n let exiting = false\n return {\n transition: {\n onExit: () => {\n exiting = true\n },\n onEnterActive: () => {\n exiting = false\n },\n onExitComplete: () => {\n exiting = false\n },\n },\n onInteractOutside: (event: Event) => {\n if (exiting) event.preventDefault()\n },\n }\n}\n\nexport const useChildCallback = (cb: (el: HTMLDivElement) => void) => {\n const ref = useRef(cb)\n ref.current = cb\n return useCallback<(el: HTMLDivElement) => void>((element) => ref.current(element), [])\n}\n\nexport type InsertMethod = \"append\" | \"prepend\"\n\nexport function computeNextRenderChildren<\n RenderChild extends { component: ReactElementWithKey; shouldRender: boolean },\n>(\n propChildrenArray: ReactElementWithKey[],\n currentRenderChildren: RenderChild[],\n createDefaultRenderChildProps: (child: ReactElementWithKey) => RenderChild,\n insertMethod: InsertMethod,\n): RenderChild[] {\n // Sets, not plain objects: a key such as \"constructor\" must not match an\n // inherited Object property\n const propChildKeys = new Set(propChildrenArray.map((child) => child.key))\n const currentRenderChildKeys = new Set(currentRenderChildren.map((child) => child.component.key))\n\n const newRenderChildren: RenderChild[] = propChildrenArray\n .filter((propChild) => !currentRenderChildKeys.has(propChild.key))\n .map(createDefaultRenderChildProps)\n\n const updatedCurrentChildren: RenderChild[] = currentRenderChildren.map((childProps) => ({\n ...childProps,\n component:\n propChildrenArray.find(({ key }) => key === childProps.component.key) || childProps.component,\n shouldRender: propChildKeys.has(childProps.component.key),\n }))\n\n return insertMethod === \"append\"\n ? updatedCurrentChildren.concat(newRenderChildren)\n : newRenderChildren.concat(updatedCurrentChildren)\n}\n\nexport function assertSingleChildWhenRef(\n componentName: string,\n ref: React.Ref<unknown> | undefined,\n childrenCount: number,\n): void {\n if ((isTest || isDev) && ref && childrenCount > 1) {\n throw new Error(`Cannot use forwardRef with multiple children in <${componentName} />`)\n }\n}\n"]}
@@ -15,6 +15,12 @@ export type FieldGroupProps = {
15
15
  * Content under the block, such as a note.
16
16
  */
17
17
  footer?: React.ReactNode;
18
+ /**
19
+ * Every value starts at one column, `--field-row-column-width` into the row, on the
20
+ * web and on a phone. Off, values end at the row's edge.
21
+ * @default false
22
+ */
23
+ columns?: boolean;
18
24
  /**
19
25
  * CSS class for the block that holds the rows.
20
26
  */
@@ -25,4 +31,4 @@ export type FieldGroupProps = {
25
31
  children?: React.ReactNode;
26
32
  } & Omit<React.ComponentProps<"section">, "title" | "children">;
27
33
  /** A titled block of rows: `Field row` lines with hairlines between them. */
28
- export declare function FieldGroup({ title, description, action, footer, bodyClassName, className, children, ...rest }: FieldGroupProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function FieldGroup({ title, description, action, footer, columns, bodyClassName, className, children, ...rest }: FieldGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -52,6 +52,11 @@ export declare const overlayTimingLarge: {
52
52
  enterDuration: number;
53
53
  exitDuration: number;
54
54
  };
55
+ /** A submenu: it opens after a hover delay of its own, so it shows at once */
56
+ export declare const overlayTimingQuick: {
57
+ enterDuration: number;
58
+ exitDuration: number;
59
+ };
55
60
  /**
56
61
  * An overlay stays a dismissable layer through its exit. A press on its trigger
57
62
  * turns it around, and the layer must not count that press as outside and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/ui",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "Modern design system for building high-quality applications",
5
5
  "type": "module",
6
6
  "license": "MIT",