@clicktap/ui 0.14.15 → 0.14.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{forwardRef as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{forwardRef as u,useId as v}from"react";import{ModalOverlay as h}from"react-aria-components";import{motion as y,AnimatePresence as b}from"framer-motion";import{useDialogTrigger as x}from"../DialogTrigger/DialogTrigger.js";import{cn as M}from"../../utils/cn.js";const O=u(({style:i,...r},e)=>o(h,{...r,ref:e,style:i})),g=y.create(O);function a({animate:i,animation:r,setAnimation:e,className:t,animationVariants:d,children:l,...s}){const m=v(),{key:c,...f}=s;return o(g,{isExiting:r==="hidden",onAnimationComplete:p=>{e(n=>p==="hidden"&&n==="hidden"?"unmounted":n)},variants:d||{hidden:{opacity:0,backdropFilter:"blur(0px)",transition:{delay:.08}},visible:{opacity:1,backdropFilter:"blur(8px)"}},initial:"hidden",animate:i,exit:"hidden",className:M("bg-black/30","fixed top-0 left-0","z-50","w-screen h-[var(--visual-viewport-height)]",t),...f,children:l},c||m)}function j(i){const{isOpen:r}=i,{animation:e,setAnimation:t}=x();return r!==void 0?o(b,{children:r&&o(a,{...i,animate:"visible",animation:e,setAnimation:t})}):o(a,{...i,animate:e,animation:e,setAnimation:t})}export{j as ModalOverlay,j as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useId } from 'react';
|
|
4
|
-
import type { Dispatch, ReactNode,
|
|
4
|
+
import type { CSSProperties, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
5
5
|
import { ModalOverlay as UIModalOverlay } from 'react-aria-components';
|
|
6
6
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
7
7
|
import { useDialogTrigger } from '../DialogTrigger/DialogTrigger';
|
|
@@ -10,17 +10,16 @@ import type { DriverAnimationState } from '../DialogTrigger/DialogTrigger.types'
|
|
|
10
10
|
import { cn } from '../../utils/cn';
|
|
11
11
|
import type { ModalOverlayProps } from './ModalOverlay.types';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
({ style, ...props }, ref: Ref<HTMLElement>) => {
|
|
16
|
-
// Separate the dynamic style logic
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
18
|
-
const ariaStyle = typeof style === 'function' ? style(props) : style;
|
|
19
|
-
|
|
13
|
+
const ForwardedModalOverlay = forwardRef<HTMLDivElement, ModalOverlayProps>(
|
|
14
|
+
({ style, ...props }, ref) => {
|
|
20
15
|
return (
|
|
21
16
|
// Pass only static styles to framer-motion
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
<UIModalOverlay
|
|
18
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
19
|
+
{...props}
|
|
20
|
+
ref={ref}
|
|
21
|
+
style={style as CSSProperties}
|
|
22
|
+
/>
|
|
24
23
|
);
|
|
25
24
|
}
|
|
26
25
|
);
|