| Server IP : 38.190.208.107 / Your IP : 216.73.216.189 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.2/wp-content/themes/blocksy/static/js/customizer/components/reach/ |
Upload File : |
import Component from './component-component'
import Portal from './portal'
import { wrapEvent } from './utils'
import {
createElement,
useEffect,
useState,
Fragment,
} from '@wordpress/element'
let createAriaHider = (dialogNode) => {
let originalValues = []
let rootNodes = []
Array.prototype.forEach.call(
document.querySelectorAll('body > *'),
(node) => {
if (node === dialogNode.parentNode) {
return
}
let attr = node.getAttribute('aria-hidden')
let alreadyHidden = attr !== null && attr !== 'false'
if (alreadyHidden) {
return
}
originalValues.push(attr)
rootNodes.push(node)
node.setAttribute('aria-hidden', 'true')
}
)
return () => {
rootNodes.forEach((node, index) => {
let originalValue = originalValues[index]
if (originalValue === null) {
node.removeAttribute('aria-hidden')
} else {
node.setAttribute('aria-hidden', originalValue)
}
})
}
}
let k = () => {}
let portalDidMount = (refs, initialFocusRef) => {
refs.disposeAriaHider = createAriaHider(refs.overlayNode)
}
let contentWillUnmount = ({ refs }) => {
refs.disposeAriaHider()
}
let FocusContext = React.createContext()
let DialogOverlay = React.forwardRef(
(
{
container,
isOpen = true,
onDismiss = k,
initialFocusRef,
onClick,
onKeyDown,
...props
},
forwardRef
) => (
<Component>
{isOpen ? (
<Portal container={container} data-reach-dialog-wrapper>
<Component
refs={{ overlayNode: null, contentNode: null }}
didMount={({ refs }) => {
portalDidMount(refs, initialFocusRef)
}}
willUnmount={contentWillUnmount}>
{({ refs }) => (
<FocusContext.Provider
value={(node) => (refs.contentNode = node)}>
<div
data-reach-dialog-overlay
onClick={wrapEvent(onClick, (event) => {
event.stopPropagation()
onDismiss()
})}
onKeyDown={wrapEvent(onKeyDown, (event) => {
if (event.key === 'Escape') {
event.stopPropagation()
onDismiss()
}
})}
ref={(node) => {
refs.overlayNode = node
forwardRef && forwardRef(node)
}}
{...props}
/>
</FocusContext.Provider>
)}
</Component>
</Portal>
) : null}
</Component>
)
)
DialogOverlay.propTypes = {
initialFocusRef: () => {},
}
let stopPropagation = (event) => event.stopPropagation()
let DialogContent = React.forwardRef(
({ onClick, onKeyDown, ...props }, forwardRef) => (
<FocusContext.Consumer>
{(contentRef) => (
<div
aria-modal="true"
data-reach-dialog-content
tabIndex="-1"
onClick={wrapEvent(onClick, stopPropagation)}
ref={(node) => {
contentRef(node)
forwardRef && forwardRef(node)
}}
{...props}
/>
)}
</FocusContext.Consumer>
)
)
let Dialog = ({ container, isOpen, onDismiss = k, ...props }) => (
<DialogOverlay container={container} isOpen={isOpen} onDismiss={onDismiss}>
<DialogContent {...props} />
</DialogOverlay>
)
export { DialogOverlay, DialogContent, Dialog }