{"version":3,"file":"index.mjs","names":["PropTypes","usePopupState","anchorRef","bindTrigger","bindContextMenu","bindToggle","bindHover","bindFocus","bindMenu","bindPopover","bindPopper","bindDoubleClick","bindDialog","PopupState","children","popupId","variant","parentPopupState","disableAutoFocus","popupState","result","propTypes","func","isRequired","string","oneOf","object","bool"],"sources":["src/index.ts"],"sourcesContent":["import PropTypes from 'prop-types'\n\nimport {\n  usePopupState,\n  anchorRef,\n  bindTrigger,\n  bindContextMenu,\n  bindToggle,\n  bindHover,\n  bindFocus,\n  bindMenu,\n  bindPopover,\n  bindPopper,\n  bindDoubleClick,\n  bindDialog,\n  type Variant,\n  type PopupState as InjectedProps,\n} from './hooks'\n\nexport {\n  anchorRef,\n  bindTrigger,\n  bindContextMenu,\n  bindToggle,\n  bindHover,\n  bindFocus,\n  bindMenu,\n  bindPopover,\n  bindPopper,\n  bindDoubleClick,\n  bindDialog,\n  type Variant,\n  type InjectedProps,\n}\n\nexport type Props = {\n  popupId?: string\n  children: (props: InjectedProps) => any\n  variant: Variant\n  parentPopupState?: InjectedProps | null\n  disableAutoFocus?: boolean | null\n}\n\nexport default function PopupState({\n  children,\n  popupId,\n  variant,\n  parentPopupState,\n  disableAutoFocus,\n}: Props): any {\n  const popupState = usePopupState({\n    popupId,\n    variant,\n    parentPopupState,\n    disableAutoFocus,\n  })\n  const result = children(popupState)\n  return result != null ? result : null\n}\n\nPopupState.propTypes = {\n  /**\n   * The render function.\n   *\n   * @param {object} props the properties injected by `PopupState`:\n   * <ul>\n   *   <li>`open(eventOrAnchorEl)`: opens the popup</li>\n   *   <li>`close()`: closes the popup</li>\n   *   <li>`toggle(eventOrAnchorEl)`: opens the popup if it is closed, or\n   *     closes the popup if it is open.\n   *   </li>\n   *   <li>`setOpen(open, [eventOrAnchorEl])`: sets whether the popup is open.\n   *     `eventOrAnchorEl` is required if `open` is truthy.\n   *   </li>\n   *   <li>`isOpen`: `true`/`false` if the popup is open/closed</li>\n   *   <li>`anchorEl`: the current anchor element (`null` the popup is closed)</li>\n   *   <li>`popupId`: the `popupId` prop you passed</li>\n   * </ul>\n   *\n   * @returns {React.Node} the content to display\n   */\n  children: PropTypes.func.isRequired,\n  /**\n   * The `id` property to use for the popup.  Will be passed to the render\n   * function as `bindPopup.id`, and also used for the `aria-controls` property\n   * passed to the trigger component via `bindTrigger`.\n   */\n  popupId: PropTypes.string,\n  /**\n   * Which type of popup you are controlling.  Use `'popover'` for `Popover`\n   * and `Menu`; use `'popper'` for `Popper`s.  Right now this only affects\n   * whether `aria-controls` or `aria-describedby` is used on the trigger\n   * component.\n   */\n  variant: PropTypes.oneOf(['popover', 'popper']).isRequired,\n  /**\n   * The popupState of the parent menu (for cascading menus)\n   */\n  parentPopupState: PropTypes.object,\n  /**\n   * Will focus the popup when it opens unless disableAutoFocus is explicitly false.\n   */\n  disableAutoFocus: PropTypes.bool,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAElC,SACEC,aAAa,EACbC,SAAS,EACTC,WAAW,EACXC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,eAAe,EACfC,UAAU;AAKZ,SACEV,SAAS,EACTC,WAAW,EACXC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,eAAe,EACfC,UAAU;AAaZ,eAAe,SAASC,UAAUA,CAAC;EACjCC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC,gBAAgB;EAChBC;AACK,CAAC,EAAO;EACb,MAAMC,UAAU,GAAGlB,aAAa,CAAC;IAC/Bc,OAAO;IACPC,OAAO;IACPC,gBAAgB;IAChBC;EACF,CAAC,CAAC;EACF,MAAME,MAAM,GAAGN,QAAQ,CAACK,UAAU,CAAC;EACnC,OAAOC,MAAM,IAAI,IAAI,GAAGA,MAAM,GAAG,IAAI;AACvC;AAEAP,UAAU,CAACQ,SAAS,GAAG;EACrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEP,QAAQ,EAAEd,SAAS,CAACsB,IAAI,CAACC,UAAU;EACnC;AACF;AACA;AACA;AACA;EACER,OAAO,EAAEf,SAAS,CAACwB,MAAM;EACzB;AACF;AACA;AACA;AACA;AACA;EACER,OAAO,EAAEhB,SAAS,CAACyB,KAAK,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAACF,UAAU;EAC1D;AACF;AACA;EACEN,gBAAgB,EAAEjB,SAAS,CAAC0B,MAAM;EAClC;AACF;AACA;EACER,gBAAgB,EAAElB,SAAS,CAAC2B;AAC9B,CAAC","ignoreList":[]}
