{"version":3,"file":"index-u3w79sfm.js","sources":["../../Client/legacy/Components/Modals/StandardModal/index.tsx"],"sourcesContent":["import { CloseButton } from '@legacy/Components/FormGroups/Buttons';\r\nimport { DropdownFormGroup } from '@legacy/Components/FormGroups/Dropdown';\r\nimport { onClickOutside } from '@shared/Common';\r\nimport { isKeyName, KeyName } from '@shared/Constants';\r\nimport { useKeyboardEvent, useScroll } from '@shared/Hooks';\r\nimport { CSSProperties, MouseEvent, PropsWithChildren, ReactElement, useEffect, useRef } from 'react';\r\n\r\ninterface ModalProps {\r\n /** Required, sets an id for the modal (applies to the modal content, not the overlay) */\r\n id: string;\r\n /** Required, use state to toggle the class that shows the modal */\r\n show: boolean;\r\n /** Required, function that will set the show prop state to false and hide the modal */\r\n hideFn: () => void;\r\n /** Optional, pass in an id for the close button */\r\n closeId?: string;\r\n /** Optional, pass in a className. */\r\n className?: string;\r\n /** Optional, add any dropdown components by ref to control positioning within the modal when scrolling. */\r\n dropdownComponents?: DropdownFormGroup[];\r\n /** Optional, disable the click outside functionality that closes the modal when clicking the background. */\r\n disableClickOutside?: boolean;\r\n}\r\n\r\n/**\r\n * @deprecated The `Modal` component should no longer be used. Instead, use `Modal` from @webkit for new development.\r\n */\r\nfunction Modal({\r\n id,\r\n show,\r\n hideFn,\r\n closeId,\r\n className,\r\n dropdownComponents,\r\n disableClickOutside,\r\n children,\r\n}: PropsWithChildren<ModalProps>) {\r\n const modalContainerRef = useRef<HTMLElement>(null),\r\n modalBodyRef = useRef<HTMLDivElement>(null);\r\n\r\n useKeyboardEvent(e => {\r\n if (isKeyName(e.key, KeyName.Escape)) {\r\n hideFn();\r\n }\r\n });\r\n\r\n useScroll(() => {\r\n if (dropdownComponents) {\r\n dropdownComponents.forEach(d => d.dropDown.onResize());\r\n }\r\n });\r\n\r\n useEffect(() => {\r\n adjustNavPosition();\r\n\r\n if (show) {\r\n document.documentElement.classList.add('scroll-lock-cp');\r\n return;\r\n }\r\n\r\n document.documentElement.classList.remove('scroll-lock-cp');\r\n }, [show]);\r\n\r\n useEffect(() => {\r\n return () => {\r\n document.documentElement.classList.remove('scroll-lock-cp');\r\n };\r\n }, []);\r\n\r\n const hideClass = !show ? ' hide-modal-cp' : '';\r\n\r\n return (\r\n <aside id={id} className={`std-modal-cp${hideClass}`} onClick={onHide} ref={modalContainerRef}>\r\n <section ref={modalBodyRef} className={`std-modal-body-cp${hideClass}${className ? ` ${className}` : ''}`}>\r\n <CloseButton id={closeId} onClick={hideFn} />\r\n\r\n {children}\r\n </section>\r\n </aside>\r\n );\r\n\r\n function adjustNavPosition() {\r\n const nav = document.querySelector('#navbar') as HTMLElement | null;\r\n if (!nav) {\r\n return;\r\n }\r\n\r\n show ? nav.setAttribute('style', 'zIndex:1;') : nav.setAttribute('style', '');\r\n }\r\n\r\n function onHide(e: MouseEvent<HTMLElement>) {\r\n if (disableClickOutside || !modalBodyRef.current) {\r\n return;\r\n }\r\n\r\n onClickOutside(e, modalBodyRef.current, hideFn);\r\n }\r\n}\r\n\r\nexport default Modal;\r\n\r\nexport function ModalTitle({\r\n id,\r\n className,\r\n children,\r\n}: PropsWithChildren<{\r\n id?: string;\r\n className?: string;\r\n}>) {\r\n return (\r\n <h1 id={id ? id : ''} className={`std-modal-title-cp${className ? ` ${className}` : ''}`}>\r\n {children}\r\n </h1>\r\n );\r\n}\r\n\r\nexport function ModalSubTitle({\r\n id,\r\n className,\r\n children,\r\n}: PropsWithChildren<{\r\n id?: string;\r\n className?: string;\r\n}>) {\r\n return (\r\n <h2 id={id ? id : ''} className={`std-modal-sub-title-cp${className ? ` ${className}` : ''}`}>\r\n {children}\r\n </h2>\r\n );\r\n}\r\n\r\nexport function ModalParagraph({\r\n id,\r\n className,\r\n children,\r\n}: PropsWithChildren<{\r\n id?: string;\r\n className?: string;\r\n}>) {\r\n return (\r\n <p id={id ? id : ''} className={`std-modal-paragraph-cp${className ? ` ${className}` : ''}`}>\r\n {children}\r\n </p>\r\n );\r\n}\r\n\r\nexport function ModalText({\r\n id,\r\n className,\r\n style,\r\n children,\r\n}: PropsWithChildren<{\r\n id?: string;\r\n className?: string;\r\n style?: CSSProperties;\r\n}>) {\r\n return (\r\n <div id={id ? id : ''} className={`std-modal-text-cp${className ? ` ${className}` : ''}`} style={style || {}}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\nexport function ModalButtons({ buttons }: { buttons: ReactElement[] }) {\r\n return <div className='std-modal-buttons-cp'>{buttons}</div>;\r\n}\r\n\r\nexport function ModalRow({ className, children }: PropsWithChildren<{ className?: string }>) {\r\n return <div className={`std-modal-row-cp ${className || ''}`}>{children}</div>;\r\n}\r\n\r\nexport function ModalSeparator() {\r\n return <div className='std-modal-separator-cp' />;\r\n}\r\n"],"names":["Modal","id","show","hideFn","closeId","className","dropdownComponents","disableClickOutside","children","modalContainerRef","useRef","modalBodyRef","useKeyboardEvent","e","isKeyName","KeyName","useScroll","d","useEffect","adjustNavPosition","hideClass","jsx","onHide","jsxs","CloseButton","nav","onClickOutside","ModalTitle","ModalSubTitle","ModalParagraph","ModalText","style","ModalButtons","buttons","ModalRow","ModalSeparator"],"mappings":"qSA2BA,SAASA,EAAM,CACX,GAAAC,EACA,KAAAC,EACA,OAAAC,EACA,QAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,SAAAC,CACJ,EAAkC,CAC9B,MAAMC,EAAoBC,EAAAA,OAAoB,IAAI,EAC9CC,EAAeD,SAAuB,IAAI,EAE9CE,EAAsBC,GAAA,CACdC,EAAUD,EAAE,IAAKE,EAAQ,MAAM,GACxBZ,EAAA,CACX,CACH,EAEDa,EAAU,IAAM,CACRV,GACAA,EAAmB,QAAQW,GAAKA,EAAE,SAAS,UAAU,CACzD,CACH,EAEDC,EAAAA,UAAU,IAAM,CAGZ,GAFkBC,EAAA,EAEdjB,EAAM,CACG,SAAA,gBAAgB,UAAU,IAAI,gBAAgB,EACvD,MAAA,CAGK,SAAA,gBAAgB,UAAU,OAAO,gBAAgB,CAAA,EAC3D,CA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