react-motion-modal 1.1.0 → 1.1.1

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.
package/dist/index.d.ts CHANGED
@@ -4,13 +4,13 @@ import { StoreApi } from 'zustand/vanilla';
4
4
  import { TargetAndTransition } from 'motion';
5
5
  import { UseBoundStore } from 'zustand/react';
6
6
 
7
- declare type ActiveModal = {
7
+ export declare type ActiveModal = {
8
8
  id: string;
9
9
  name: ModalName;
10
10
  params?: Params<ModalName>;
11
11
  };
12
12
 
13
- declare type BaseModalParams = {
13
+ export declare type BaseModalParams = {
14
14
  /**
15
15
  * Function to close the modal
16
16
  */
@@ -50,30 +50,32 @@ declare type BaseModalParams = {
50
50
  };
51
51
  };
52
52
 
53
- declare type ModalAction = {
53
+ export declare type ModalAction = {
54
54
  closeModal: (name?: ModalName) => void;
55
55
  closeAllModal: () => void;
56
56
  openModal: <T extends ModalName>(name: T, params?: Omit<Params<T>, 'closeModal'>) => void;
57
57
  };
58
58
 
59
- declare type ModalComponent<T = any> = (props: T) => ReactElement;
59
+ export declare type ModalComponent<T = any> = (props: T) => ReactElement;
60
60
 
61
- declare type ModalConfig = {
61
+ export declare type ModalConfig = {
62
62
  [K in ModalName]: ModalComponent<Params<K>>;
63
63
  };
64
64
 
65
65
  export declare interface ModalDefinition {
66
66
  }
67
67
 
68
- declare type ModalName = keyof ModalDefinition;
68
+ export declare type ModalName = keyof ModalDefinition;
69
+
70
+ export declare type ModalParams<T extends ModalName> = Omit<Params<T>, 'animate' | 'body' | 'container' | 'onClose'>;
69
71
 
70
72
  export declare const ModalProvider: ({ modals, initialParams }: Props) => ReactPortal | null;
71
73
 
72
- declare type ModalState = {
74
+ export declare type ModalState = {
73
75
  activeModals: ActiveModal[];
74
76
  };
75
77
 
76
- declare type Params<T extends ModalName> = ModalDefinition[T] & BaseModalParams;
78
+ export declare type Params<T extends ModalName> = ModalDefinition[T] & BaseModalParams;
77
79
 
78
80
  declare type Props = {
79
81
  modals: ModalConfig;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-font-weight:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-semibold:600;--radius-md:.375rem;--radius-xl:.75rem;--blur-sm:8px;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.top-0{top:calc(var(--spacing)*0)}.top-1\\/2{top:50%}.right-0{right:calc(var(--spacing)*0)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.flex{display:flex}.h-screen{height:100vh}.max-h-screen{max-height:100vh}.w-screen{width:100vw}.max-w-screen{max-width:100vw}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-2{gap:calc(var(--spacing)*2)}.overflow-auto{overflow:auto}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.bg-black{background-color:var(--color-black)}.bg-black\\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-blue-400{background-color:var(--color-blue-400)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-all{word-break:break-all}.text-blue-500{color:var(--color-blue-500)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}@media (hover:hover){.hover\\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\\:bg-gray-600:hover{background-color:var(--color-gray-600)}.hover\\:opacity-80:hover{opacity:.8}}@media (min-width:64rem){.lg\\:left-1\\/2{left:50%}.lg\\:-translate-x-1\\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { jsx as re, Fragment as Oo, jsxs as Lo } from "react/jsx-runtime";
3
2
  import * as Pn from "react";
4
- import Mt, { createContext as Fe, useRef as ue, useLayoutEffect as Ko, useEffect as Rt, useId as Mn, useContext as H, useInsertionEffect as Gi, useMemo as ke, useCallback as $i, Children as Io, isValidElement as Bo, useState as fs, forwardRef as Fo, Fragment as Wi, createElement as jo, Component as No } from "react";
3
+ import Mt, { createContext as Fe, useRef as ue, useLayoutEffect as Oo, useEffect as Rt, useId as Mn, useContext as H, useInsertionEffect as Gi, useMemo as ke, useCallback as $i, Children as Lo, isValidElement as Ko, useState as fs, forwardRef as Io, Fragment as Wi, createElement as Bo, Component as Fo } from "react";
4
+ import { jsx as re, Fragment as jo, jsxs as No } from "react/jsx-runtime";
5
5
  const z = [];
6
6
  for (let e = 0; e < 256; ++e)
7
7
  z.push((e + 256).toString(16).slice(1));
@@ -573,7 +573,7 @@ function kn(e) {
573
573
  const t = ue(null);
574
574
  return t.current === null && (t.current = e()), t.current;
575
575
  }
576
- const En = typeof window < "u", Hi = En ? Ko : Rt, _t = /* @__PURE__ */ Fe(null);
576
+ const En = typeof window < "u", Hi = En ? Oo : Rt, _t = /* @__PURE__ */ Fe(null);
577
577
  function Dn(e, t) {
578
578
  e.indexOf(t) === -1 && e.push(t);
579
579
  }
@@ -2495,8 +2495,8 @@ function Ir(e = !0) {
2495
2495
  const gt = (e) => e.key || "";
2496
2496
  function Us(e) {
2497
2497
  const t = [];
2498
- return Io.forEach(e, (n) => {
2499
- Bo(n) && t.push(n);
2498
+ return Lo.forEach(e, (n) => {
2499
+ Ko(n) && t.push(n);
2500
2500
  }), t;
2501
2501
  }
2502
2502
  const tc = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presenceAffectsLayout: i = !0, mode: o = "sync", propagate: r = !1, anchorX: c = "left", root: a }) => {
@@ -2519,7 +2519,7 @@ const tc = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presen
2519
2519
  }
2520
2520
  process.env.NODE_ENV !== "production" && o === "wait" && b.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
2521
2521
  const { forceRender: g } = H(An);
2522
- return re(Oo, { children: b.map((w) => {
2522
+ return re(jo, { children: b.map((w) => {
2523
2523
  const T = gt(w), v = r && !l ? !1 : d === b || u.includes(T), E = () => {
2524
2524
  if (S.has(T))
2525
2525
  S.set(T, !0);
@@ -2747,10 +2747,10 @@ function pc({ preloadedFeatures: e, createVisualElement: t, useRender: n, useVis
2747
2747
  const x = yc(f);
2748
2748
  l = x.MeasureLayout, u.visualElement = fc(i, y, f, t, x.ProjectionNode);
2749
2749
  }
2750
- return Lo(Ot.Provider, { value: u, children: [l && u.visualElement ? re(l, { visualElement: u.visualElement, ...f }) : null, n(i, c, uc(y, u.visualElement, a), y, d, u.visualElement)] });
2750
+ return No(Ot.Provider, { value: u, children: [l && u.visualElement ? re(l, { visualElement: u.visualElement, ...f }) : null, n(i, c, uc(y, u.visualElement, a), y, d, u.visualElement)] });
2751
2751
  }
2752
2752
  o.displayName = `motion.${typeof i == "string" ? i : `create(${i.displayName ?? i.name ?? ""})`}`;
2753
- const r = Fo(o);
2753
+ const r = Io(o);
2754
2754
  return r[cc] = i, r;
2755
2755
  }
2756
2756
  function mc({ layoutId: e }) {
@@ -2952,7 +2952,7 @@ function is(e) {
2952
2952
  function Dc(e = !1) {
2953
2953
  return (n, s, i, { latestValues: o }, r) => {
2954
2954
  const a = (is(n) ? kc : Cc)(s, o, r, n), l = rc(s, typeof n == "string", e), f = n !== Wi ? { ...l, ...a, ref: i } : {}, { children: d } = s, u = ke(() => Y(d) ? d.get() : d, [d]);
2955
- return jo(n, {
2955
+ return Bo(n, {
2956
2956
  ...f,
2957
2957
  children: u
2958
2958
  });
@@ -4021,7 +4021,7 @@ const We = {
4021
4021
  }
4022
4022
  };
4023
4023
  let di = !1;
4024
- class Ou extends No {
4024
+ class Ou extends Fo {
4025
4025
  /**
4026
4026
  * This only mounts projection nodes for components that
4027
4027
  * need measuring, we might want to do it for all components
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-motion-modal",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",