{"version":3,"file":"FloatingMenu.cjs","names":[],"sources":["../../../src/components/Menu/FloatingMenu.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, {\n  type ComponentPropsWithoutRef,\n  type ReactNode,\n  forwardRef,\n  useId,\n} from \"react\";\nimport styles from \"./FloatingMenu.module.css\";\nimport { MenuTitle } from \"./MenuTitle.tsx\";\n\ninterface Props extends ComponentPropsWithoutRef<\"div\"> {\n  /**\n   * The menu title.\n   */\n  title: string;\n  /**\n   * Whether to show the title. If false, the title will be hidden but still used as a label for screen readers.\n   */\n  showTitle?: boolean;\n  /**\n   * The CSS class.\n   */\n  className?: string;\n  /**\n   * The menu contents.\n   */\n  children: ReactNode;\n}\n\n/**\n * A menu in a floating box, as commonly seen on desktop.\n */\n// This an internal component not intended for export! Consumers should use it\n// via the Menu or ContextMenu components.\nexport const FloatingMenu = forwardRef<HTMLDivElement, Props>(\n  ({ title, showTitle = true, className, children, ...props }, ref) => {\n    const titleId = useId();\n\n    return (\n      <div\n        role=\"menu\"\n        ref={ref}\n        aria-label={showTitle ? undefined : title}\n        aria-labelledby={showTitle ? titleId : undefined}\n        className={classnames(className, styles.menu)}\n        {...props}\n      >\n        {showTitle && (\n          <MenuTitle className={styles.title} title={title} id={titleId} />\n        )}\n        {children}\n      </div>\n    );\n  },\n);\n\nFloatingMenu.displayName = \"FloatingMenu\";\n"],"mappings":";;;;;;;;;;;;AAyCA,IAAa,gBAAA,GAAA,MAAA,aACV,EAAE,OAAO,YAAY,MAAM,WAAW,UAAU,GAAG,SAAS,QAAQ;CACnE,MAAM,WAAA,GAAA,MAAA,QAAiB;AAEvB,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EACE,MAAK;EACA;EACL,cAAY,YAAY,KAAA,IAAY;EACpC,mBAAiB,YAAY,UAAU,KAAA;EACvC,YAAA,GAAA,WAAA,SAAsB,WAAW,4BAAA,QAAO,KAAK;EAC7C,GAAI;YANN,CAQG,aACC,iBAAA,GAAA,kBAAA,KAAC,kBAAA,WAAD;GAAW,WAAW,4BAAA,QAAO;GAAc;GAAO,IAAI;GAAW,CAAA,EAElE,SACG;;EAGX;AAED,aAAa,cAAc"}