{"version":3,"sources":["../src/components/Dialog/dialogContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n// Core types live here to avoid circular deps with Dialog.types.ts\nexport type DialogModalType = 'modal' | 'non-modal' | 'alert';\n\nexport type DialogOpenChangeData =\n  | { type: 'escapeKeyDown'; open: boolean; event: React.KeyboardEvent<HTMLDialogElement> }\n  | { type: 'backdropClick'; open: boolean; event: React.MouseEvent<HTMLDialogElement> }\n  | { type: 'surfaceToggle'; open: boolean; event: Event }\n  | { type: 'triggerClick'; open: boolean; event: React.MouseEvent };\n\nexport type DialogContextValue = {\n  open: boolean;\n  modalType: DialogModalType;\n  dialogTitleId: string;\n  isNestedDialog: boolean;\n  inertTrapFocus: boolean;\n  unmountOnClose: boolean;\n  requestOpenChange: (data: DialogOpenChangeData) => void;\n};\n\nexport type DialogSurfaceContextValue = boolean;\n\nconst defaultDialogContextValue: DialogContextValue = {\n  open: false,\n  modalType: 'modal',\n  dialogTitleId: '',\n  isNestedDialog: false,\n  inertTrapFocus: false,\n  unmountOnClose: true,\n  requestOpenChange() {\n    /* noop */\n  },\n};\n\nexport const DialogContext = React.createContext<DialogContextValue | undefined>(undefined);\n\nexport const DialogSurfaceContext = React.createContext<DialogSurfaceContextValue | undefined>(undefined);\n\nexport const useDialogContext = (): DialogContextValue => React.useContext(DialogContext) ?? defaultDialogContextValue;\n\nexport const useDialogSurfaceContext = (): DialogSurfaceContextValue => React.useContext(DialogSurfaceContext) ?? false;\n"],"names":["DialogContext","DialogSurfaceContext","useDialogContext","useDialogSurfaceContext","defaultDialogContextValue","open","modalType","dialogTitleId","isNestedDialog","inertTrapFocus","unmountOnClose","requestOpenChange","React","createContext","undefined","useContext"],"mappings":"AAAA;;;;;;;;;;;;IAqCaA,aAAa;eAAbA;;IAEAC,oBAAoB;eAApBA;;IAEAC,gBAAgB;eAAhBA;;IAEAC,uBAAuB;eAAvBA;;;;iEAzCU;AAuBvB,MAAMC,4BAAgD;IACpDC,MAAM;IACNC,WAAW;IACXC,eAAe;IACfC,gBAAgB;IAChBC,gBAAgB;IAChBC,gBAAgB;IAChBC;IACE,QAAQ,GACV;AACF;AAEO,MAAMX,gBAAgBY,OAAMC,aAAa,CAAiCC;AAE1E,MAAMb,uBAAuBW,OAAMC,aAAa,CAAwCC;AAExF,MAAMZ,mBAAmB,IAA0BU,OAAMG,UAAU,CAACf,kBAAkBI;AAEtF,MAAMD,0BAA0B,IAAiCS,OAAMG,UAAU,CAACd,yBAAyB"}