lizaui 3.0.51 → 3.0.53
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/calendar/index.cjs.js +1 -1
- package/dist/calendar/index.es.js +1 -1
- package/dist/chunks/index-32mPyHbg.js +65 -0
- package/dist/chunks/index-32mPyHbg.js.map +1 -0
- package/dist/chunks/index-BNmRGtA6.js +35 -0
- package/dist/chunks/index-BNmRGtA6.js.map +1 -0
- package/dist/chunks/{index-16iPHlf0.js → index-DALlpGON.js} +1122 -1151
- package/dist/chunks/index-DALlpGON.js.map +1 -0
- package/dist/chunks/index-DCbyaYR7.js +2 -0
- package/dist/chunks/index-DCbyaYR7.js.map +1 -0
- package/dist/chunks/label-error-8p4Smomu.js +2 -0
- package/dist/chunks/{label-error-noAu6DKg.js.map → label-error-8p4Smomu.js.map} +1 -1
- package/dist/chunks/label-error-D2dOTiDS.js +10 -0
- package/dist/chunks/{label-error-DwHE_f3w.js.map → label-error-D2dOTiDS.js.map} +1 -1
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.type.d.ts +6 -2
- package/dist/components/modal/modal.type.d.ts.map +1 -1
- package/dist/modal/index.cjs.js +1 -1
- package/dist/modal/index.cjs.js.map +1 -1
- package/dist/modal/index.es.js +145 -59
- package/dist/modal/index.es.js.map +1 -1
- package/dist/pagination/index.cjs.js +1 -1
- package/dist/pagination/index.es.js +1 -1
- package/dist/select-input/index.cjs.js +1 -1
- package/dist/select-input/index.es.js +1 -1
- package/dist/ui/index.cjs.js +3 -3
- package/dist/ui/index.cjs.js.map +1 -1
- package/dist/ui/index.es.js +243 -242
- package/dist/ui/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-16iPHlf0.js.map +0 -1
- package/dist/chunks/index-CMmK7lyb.js +0 -65
- package/dist/chunks/index-CMmK7lyb.js.map +0 -1
- package/dist/chunks/label-error-DwHE_f3w.js +0 -10
- package/dist/chunks/label-error-noAu6DKg.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const O=require("./clsx-C11secjj.js"),m=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,y=O.clsx,b=(e,l)=>n=>{var d;if((l==null?void 0:l.variants)==null)return y(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=l,V=Object.keys(o).map(t=>{const a=n==null?void 0:n[t],u=s==null?void 0:s[t];if(a===null)return null;const i=m(a)||m(u);return o[t][i]}),v=n&&Object.entries(n).reduce((t,a)=>{let[u,i]=a;return i===void 0||(t[u]=i),t},{}),N=l==null||(d=l.compoundVariants)===null||d===void 0?void 0:d.reduce((t,a)=>{let{class:u,className:i,...C}=a;return Object.entries(C).every(f=>{let[c,r]=f;return Array.isArray(r)?r.includes({...s,...v}[c]):{...s,...v}[c]===r})?[...t,u,i]:t},[]);return y(e,V,N,n==null?void 0:n.class,n==null?void 0:n.className)};exports.cva=b;
|
|
2
|
+
//# sourceMappingURL=index-DCbyaYR7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DCbyaYR7.js","sources":["../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"],"sourcesContent":["/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n"],"names":["falsyToString","value","cx","clsx","cva","base","config","props","_config_compoundVariants","variants","defaultVariants","getVariantClassNames","variant","variantProp","defaultVariantProp","variantKey","propsWithoutUndefined","acc","param","key","getCompoundVariantClassNames","cvClass","cvClassName","compoundVariantOptions"],"mappings":"mDAeMA,EAAiBC,GAAQ,OAAOA,GAAU,UAAY,GAAGA,CAAK,GAAKA,IAAU,EAAI,IAAMA,EAChFC,EAAKC,EAAI,KACTC,EAAM,CAACC,EAAMC,IAAUC,GAAQ,CACpC,IAAIC,EACJ,IAAKF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KAA2B,OAASA,EAAM,MAAOA,GAAU,KAA2B,OAASA,EAAM,SAAS,CACpM","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const t=require("./jsx-runtime-DFswc9zO.js"),n=require("./bundle-mjs-Bta93uUH.js"),a=({text:e,className:r})=>{const s=n.twMerge("text-danger font-normal text-xs mt-1 leading-none",r);return t.jsxRuntimeExports.jsx("span",{className:s,children:e})};exports.LabelError=a;
|
|
2
|
+
//# sourceMappingURL=label-error-8p4Smomu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-error-
|
|
1
|
+
{"version":3,"file":"label-error-8p4Smomu.js","sources":["../../src/components/ui/label-error.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nexport type LabelErrorType = {\n\t/**\n\t * @description\n\t * Propiedad para colocar el texto.\n\t * @type\n\t * Puede recibir **string**\n\t */\n\ttext: string;\n\t/**\n\t * @description\n\t * Propiedad para brindar clases personalizadas al componente, este se situa en el container del label.\n\t */\n\tclassName?: string;\n};\n\nexport const LabelError = ({ text, className }: LabelErrorType) => {\n\tconst classLabel = twMerge(\"text-danger font-normal text-xs mt-1 leading-none\", className);\n\n\treturn <span className={classLabel}>{text}</span>;\n};\n"],"names":["LabelError","text","className","classLabel","twMerge","jsx"],"mappings":"gGAgBaA,EAAa,CAAC,CAAE,KAAAC,EAAM,UAAAC,KAAgC,CAC5D,MAAAC,EAAaC,EAAAA,QAAQ,oDAAqDF,CAAS,EAEzF,OAAQG,EAAAA,kBAAAA,IAAA,OAAA,CAAK,UAAWF,EAAa,SAAKF,EAAA,CAC3C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { j as s } from "./jsx-runtime-BYq8_R6m.js";
|
|
2
|
+
import { t as a } from "./bundle-mjs-kGHm2Pod.js";
|
|
3
|
+
const m = ({ text: t, className: r }) => {
|
|
4
|
+
const e = a("text-danger font-normal text-xs mt-1 leading-none", r);
|
|
5
|
+
return /* @__PURE__ */ s.jsx("span", { className: e, children: t });
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
m as L
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=label-error-D2dOTiDS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-error-
|
|
1
|
+
{"version":3,"file":"label-error-D2dOTiDS.js","sources":["../../src/components/ui/label-error.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nexport type LabelErrorType = {\n\t/**\n\t * @description\n\t * Propiedad para colocar el texto.\n\t * @type\n\t * Puede recibir **string**\n\t */\n\ttext: string;\n\t/**\n\t * @description\n\t * Propiedad para brindar clases personalizadas al componente, este se situa en el container del label.\n\t */\n\tclassName?: string;\n};\n\nexport const LabelError = ({ text, className }: LabelErrorType) => {\n\tconst classLabel = twMerge(\"text-danger font-normal text-xs mt-1 leading-none\", className);\n\n\treturn <span className={classLabel}>{text}</span>;\n};\n"],"names":["LabelError","text","className","classLabel","twMerge","jsx"],"mappings":";;AAgBO,MAAMA,IAAa,CAAC,EAAE,MAAAC,GAAM,WAAAC,QAAgC;AAC5D,QAAAC,IAAaC,EAAQ,qDAAqDF,CAAS;AAEzF,SAAQG,gBAAAA,EAAAA,IAAA,QAAA,EAAK,WAAWF,GAAa,UAAKF,GAAA;AAC3C;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModalBodyType, ModalFooterType, ModalHeaderType, ModalType } from './modal.type';
|
|
2
|
-
export declare const Modal: ({ modalId, isShow, isVisible, children, style, classNameOverlay, styleContainer,
|
|
2
|
+
export declare const Modal: ({ modalId, isShow, isVisible, children, style, classNameOverlay, styleContainer, onClickOutside, classNameDialog, classNameContent, backdrop, size, isKeyboardDismissDisabled, shadow, radius, }: ModalType) => import('react').ReactPortal | null;
|
|
3
3
|
export declare const ModalBody: import('react').ForwardRefExoticComponent<ModalBodyType & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export declare const ModalHeader: ({ title, showCloseButton, disabled, onClick, className, styled, children }: ModalHeaderType) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const ModalFooter: ({ children, className, styled }: ModalFooterType) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAgG/F,eAAO,MAAM,KAAK,GAAI,kMAgBnB,SAAS,uCA+EX,CAAC;AAEF,eAAO,MAAM,SAAS,0GAMpB,CAAC;AAGH,eAAO,MAAM,WAAW,GAAI,4EAA2F,eAAe,4CAyBrI,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,iCAAiC,eAAe,4CAM3E,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, Ref } from 'react';
|
|
2
|
-
export type SizeModalInterface =
|
|
2
|
+
export type SizeModalInterface = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "full";
|
|
3
|
+
export type ShadowModalType = "none" | "sm" | "md" | "lg";
|
|
3
4
|
export interface useModalInterface<T = any> {
|
|
4
5
|
modalId: string;
|
|
5
6
|
isModal: boolean;
|
|
@@ -19,14 +20,17 @@ export interface ModalType {
|
|
|
19
20
|
children: React.ReactNode;
|
|
20
21
|
isShow: boolean;
|
|
21
22
|
isVisible: boolean;
|
|
23
|
+
isKeyboardDismissDisabled?: boolean;
|
|
22
24
|
style?: CSSProperties;
|
|
23
25
|
styleContainer?: CSSProperties;
|
|
24
26
|
classNameOverlay?: string;
|
|
25
27
|
classNameDialog?: string;
|
|
26
28
|
classNameContent?: string;
|
|
27
29
|
width?: number | string;
|
|
28
|
-
|
|
30
|
+
onClickOutside?: () => void;
|
|
29
31
|
backdrop?: "transparent" | "opaque" | "blur";
|
|
32
|
+
shadow?: ShadowModalType;
|
|
33
|
+
radius?: "none" | "sm" | "md" | "lg";
|
|
30
34
|
}
|
|
31
35
|
export interface ModalBodyType {
|
|
32
36
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.type.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"modal.type.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAC3G,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAE;AAE3D,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,CAAC,CAAC;IACb,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,E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,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/modal/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/jsx-runtime-DFswc9zO.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/jsx-runtime-DFswc9zO.js"),k=require("react-dom"),x=require("react"),r=require("../chunks/utils-B759n5Vp.js"),q=require("../chunks/button-BnNW_eev.js"),I=require("../chunks/index-DCbyaYR7.js"),i=require("../chunks/ripple-CPzedX6a.js"),m={ease:[.36,.66,.4,1]},b={scaleInOut:{enter:{transform:"scale(1)",opacity:1,transition:{duration:.4,ease:m.ease}},exit:{transform:"scale(1.03)",opacity:0,transition:{duration:.3,ease:m.ease}}},fade:{enter:{opacity:1,transition:{duration:.4,ease:m.ease}},exit:{opacity:0,transition:{duration:.3,ease:m.ease}}}},h=I.cva("",{variants:{size:{xs:{base:"max-w-xs"},sm:{base:"max-w-sm"},md:{base:"max-w-md"},lg:{base:"max-w-lg"},xl:{base:"max-w-xl"},"2xl":{base:"max-w-2xl"},"3xl":{base:"max-w-3xl"},"4xl":{base:"max-w-4xl"},"5xl":{base:"max-w-5xl"},full:{base:"my-0 mx-0 sm:mx-0 sm:my-0 max-w-full h-[100dvh] min-h-[100dvh] !rounded-none"}},radius:{none:{base:"rounded-none"},sm:{base:"rounded-sm"},md:{base:"rounded-md"},lg:{base:"rounded-lg"}},shadow:{none:{base:"shadow-none"},sm:{base:"shadow-sm"},md:{base:"shadow-md"},lg:{base:"shadow-lg"}},backdrop:{transparent:{backdrop:"bg-transparent"},opaque:{backdrop:"bg-black/50"},blur:{backdrop:"backdrop-blur-md backdrop-saturate-150 bg-overlay/30"}},scrollBehavior:{normal:{base:"overflow-y-hidden"},inside:{base:"max-h-[calc(100%_-_8rem)]",body:"overflow-y-auto"},outside:{wrapper:"items-start sm:items-start overflow-y-auto",base:"my-16"}}},defaultVariants:{size:"md",radius:"lg",shadow:"sm",backdrop:"opaque",scrollBehavior:"normal"}}),B=({modalId:s,isShow:a,isVisible:t,children:o,style:l,classNameOverlay:u="",styleContainer:c,onClickOutside:d,classNameDialog:g="modal-custom-dialog",classNameContent:w="modal-custom-content",backdrop:j="opaque",size:v="md",isKeyboardDismissDisabled:p=!1,shadow:R="md",radius:E="lg"})=>{const N=x.useRef(null);if(x.useEffect(()=>(typeof window<"u"&&t&&document.body.classList.add("modal-open"),()=>{typeof window<"u"&&document.body.classList.remove("modal-open")}),[t]),x.useEffect(()=>{const n=M=>{M.key==="Escape"&&!p&&(d==null||d())};return a&&document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[a,p,d]),typeof window>"u")return null;const f=document.getElementById("modal-root");return f?k.createPortal(e.jsxRuntimeExports.jsx(i.AnimatePresence,{children:a&&e.jsxRuntimeExports.jsx(i.LazyMotion,{features:()=>Promise.resolve().then(()=>require("../chunks/index-_vOj2iyM.js")).then(n=>n.domAnimation),children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.m.div,{initial:"exit",animate:"enter",exit:"exit",variants:b.fade,className:r.cn("fixed inset-0 z-50",h({backdrop:j}),u),onClick:d,"aria-hidden":!a,role:"dialog","aria-modal":"true",tabIndex:-1,id:s},"modal-overlay"),e.jsxRuntimeExports.jsx(i.m.div,{initial:"exit",animate:"enter",exit:"exit",variants:b.scaleInOut,ref:N,onClick:n=>n.stopPropagation(),className:r.cn("fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50 grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 rounded-lg p-6 shadow-lg bg-content1",h({size:v,radius:E,shadow:R}),g),style:l,children:e.jsxRuntimeExports.jsx("div",{className:r.cn("modal-custom-content w-full flex flex-col gap-2",w),style:c,children:o})},"modal-content")]})})}),f):null},y=x.forwardRef(({children:s,className:a="",styled:t,height:o},l)=>e.jsxRuntimeExports.jsx("div",{className:r.cn("modal-custom-body flex-1",a),ref:l,style:{...t,height:o?`${o}px`:"auto"},children:s}));y.displayName="ModalBodyPortalComponent";const L=({title:s,showCloseButton:a=!0,disabled:t=!1,onClick:o,className:l,styled:u,children:c})=>e.jsxRuntimeExports.jsxs("div",{className:r.cn("modal-custom-header w-full flex flex-col gap-2 text-center sm:text-left",l),style:u,children:[c||e.jsxRuntimeExports.jsx("h4",{className:"modal-custom-title text-lg leading-none font-semibold",children:s}),a&&e.jsxRuntimeExports.jsx("div",{className:"absolute top-3 right-4 disabled:pointer-events-none",children:e.jsxRuntimeExports.jsxs(q.Button,{isIconOnly:!0,variant:"light",radius:"full","aria-label":"Close",onClick:o,disabled:t,className:"p-0 w-[36px] h-[36px] min-w-auto bg-default-100 hover:bg-default-200 text-default-500 hover:text-default-600 dark:bg-default-100 dark:hover:bg-default-200 dark:text-default-500 dark:hover:text-default-600 disabled:opacity-50 disabled:pointer-events-none",children:[e.jsxRuntimeExports.jsxs("svg",{width:"20",height:"20",fill:"currentColor",role:"img","aria-hidden":"true",children:[e.jsxRuntimeExports.jsx("path",{fill:"none",d:"M0 0h21v21H0z"}),e.jsxRuntimeExports.jsx("path",{d:"m12.12 10 4.07-4.06a1.5 1.5 0 1 0-2.11-2.12L10 7.88 5.94 3.81a1.5 1.5 0 1 0-2.12 2.12L7.88 10l-4.07 4.06a1.5 1.5 0 0 0 0 2.12 1.51 1.51 0 0 0 2.13 0L10 12.12l4.06 4.07a1.45 1.45 0 0 0 1.06.44 1.5 1.5 0 0 0 1.06-2.56Z"})]}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})})]}),A=({children:s,className:a,styled:t})=>e.jsxRuntimeExports.jsx("div",{className:r.cn("modal-custom-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto",a),style:t,children:s});exports.Modal=B;exports.ModalBody=y;exports.ModalFooter=A;exports.ModalHeader=L;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/components/transition/transition-utils.ts","../../src/components/modal/modal.tsx"],"sourcesContent":["import type { Target, TargetAndTransition, Transition } from \"framer-motion\";\n\ntype WithMotionState<P> = Partial<Record<\"enter\" | \"exit\", P>>;\n\nexport type TransitionConfig = WithMotionState<Transition>;\n\nexport type TransitionEndConfig = WithMotionState<Target>;\n\nexport type TransitionProperties = {\n\t/**\n\t * Custom `transition` definition for `enter` and `exit`\n\t */\n\ttransition?: TransitionConfig;\n\t/**\n\t * Custom `transitionEnd` definition for `enter` and `exit`\n\t */\n\ttransitionEnd?: TransitionEndConfig;\n};\n\ntype TargetResolver<P = {}> = (props: P & TransitionProperties) => TargetAndTransition;\n\ntype Variant<P = {}> = TargetAndTransition | TargetResolver<P>;\n\nexport type Variants<P = {}> = Record<\n\tstring,\n\t{\n\t\tenter: Variant<P>;\n\t\texit: Variant<P>;\n\t\tinitial?: Variant<P>;\n\t}\n>;\n\nexport const TRANSITION_EASINGS = {\n\tease: [0.36, 0.66, 0.4, 1],\n\teaseIn: [0.4, 0, 1, 1],\n\teaseOut: [0, 0, 0.2, 1],\n\teaseInOut: [0.4, 0, 0.2, 1],\n\tspring: [0.155, 1.105, 0.295, 1.12],\n\tspringOut: [0.57, -0.15, 0.62, 0.07],\n\tsoftSpring: [0.16, 1.11, 0.3, 1.02],\n} as const;\n\nexport const TRANSITION_DEFAULTS = {\n\tenter: {\n\t\tduration: 0.2,\n\t\tease: TRANSITION_EASINGS.easeOut,\n\t},\n\texit: {\n\t\tduration: 0.1,\n\t\tease: TRANSITION_EASINGS.easeIn,\n\t},\n} as const;\n\nexport const TRANSITION_VARIANTS: Variants = {\n\tscaleSpring: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.85)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscaleSpringOpacity: {\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.8)\",\n\t\t},\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransform: \"scale(1)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.96)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscale: {\n\t\tenter: { scale: 1 },\n\t\texit: { scale: 0.95 },\n\t},\n\tscaleFadeIn: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.25,\n\t\t\t\tease: TRANSITION_EASINGS.easeIn,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.95)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.2,\n\t\t\t\tease: TRANSITION_EASINGS.easeOut,\n\t\t\t},\n\t\t},\n\t},\n\tscaleInOut: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(1.03)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tfade: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tcollapse: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\theight: \"auto\",\n\t\t\ttransition: {\n\t\t\t\theight: {\n\t\t\t\t\ttype: \"spring\",\n\t\t\t\t\tbounce: 0,\n\t\t\t\t\tduration: 0.3,\n\t\t\t\t},\n\t\t\t\topacity: {\n\t\t\t\t\tease: \"ease\" as any,\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\theight: 0,\n\t\t\ttransition: {\n\t\t\t\tease: \"ease\" as any,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t},\n};\n","\"use client\";\n\nimport ReactDOM from \"react-dom\";\nimport { forwardRef, type Ref, useEffect, useRef } from \"react\";\nimport type { ModalBodyType, ModalFooterType, ModalHeaderType, ModalType } from \"./modal.type\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"../button\";\nimport { AnimatePresence } from \"framer-motion\";\nimport { LazyMotion, m } from \"framer-motion\";\nimport { TRANSITION_VARIANTS } from \"../transition/transition-utils\";\n\nexport const Modal = ({\n\tmodalId,\n\tisShow,\n\tisVisible,\n\tchildren,\n\tstyle,\n\tclassNameOverlay = \"\",\n\tstyleContainer,\n\tcloseModalClickOut,\n\tclassNameDialog = \"modal-custom-dialog\",\n\tclassNameContent = \"modal-custom-content\",\n\tbackdrop = \"opaque\",\n}: ModalType) => {\n\tconst modalBodyRef = useRef<HTMLDivElement>(null);\n\tuseEffect(() => {\n\t\tif (typeof window !== \"undefined\" && isVisible) {\n\t\t\tdocument.body.classList.add(\"modal-open\");\n\t\t}\n\t\treturn () => {\n\t\t\tif (typeof window !== \"undefined\") {\n\t\t\t\tdocument.body.classList.remove(\"modal-open\");\n\t\t\t}\n\t\t};\n\t}, [isVisible]);\n\n\tif (typeof window === \"undefined\") return null;\n\n\tconst modalRoot = document.getElementById(\"modal-root\");\n\tif (!modalRoot) return null;\n\n\tlet overlayClass = \"\";\n\n\tswitch (backdrop) {\n\t\tcase \"transparent\":\n\t\t\toverlayClass = \"bg-transparent\";\n\t\t\tbreak;\n\t\tcase \"opaque\":\n\t\t\toverlayClass = \"bg-black/50\";\n\t\t\tbreak;\n\t\tcase \"blur\":\n\t\t\toverlayClass = \"backdrop-blur-md backdrop-saturate-150 bg-overlay/30\";\n\t\t\tbreak;\n\t}\n\n\treturn ReactDOM.createPortal(\n\t\t<AnimatePresence>\n\t\t\t{isShow && (\n\t\t\t\t<LazyMotion features={() => import(\"framer-motion\").then((res) => res.domAnimation)}>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-overlay\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.fade}\n\t\t\t\t\t\t\tclassName={cn(\"fixed inset-0 z-50\", overlayClass, classNameOverlay)}\n\t\t\t\t\t\t\tonClick={closeModalClickOut}\n\t\t\t\t\t\t\taria-hidden={!isShow}\n\t\t\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tid={modalId}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-content\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.scaleInOut}\n\t\t\t\t\t\t\tref={modalBodyRef}\n\t\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50 grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 rounded-lg p-6 shadow-lg bg-content1\",\n\t\t\t\t\t\t\t\tclassNameDialog,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className={cn(\"modal-custom-content w-full flex flex-col gap-2\", classNameContent)} style={styleContainer}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</m.div>\n\t\t\t\t\t</>\n\t\t\t\t</LazyMotion>\n\t\t\t)}\n\t\t</AnimatePresence>,\n\t\tmodalRoot,\n\t);\n};\n\nexport const ModalBody = forwardRef(({ children, className = \"\", styled, height }: ModalBodyType, ref: Ref<HTMLDivElement>) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-body flex-1\", className)} ref={ref} style={{ ...styled, height: height ? `${height}px` : \"auto\" }}>\n\t\t\t{children}\n\t\t</div>\n\t);\n});\nModalBody.displayName = \"ModalBodyPortalComponent\";\n\nexport const ModalHeader = ({ title, showCloseButton = true, disabled = false, onClick, className, styled, children }: ModalHeaderType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-header w-full flex flex-col gap-2 text-center sm:text-left\", className)} style={styled}>\n\t\t\t{children || <h4 className=\"modal-custom-title text-lg leading-none font-semibold\">{title}</h4>}\n\t\t\t{showCloseButton && (\n\t\t\t\t<div className=\"absolute top-3 right-4 disabled:pointer-events-none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tisIconOnly\n\t\t\t\t\t\tvariant=\"light\"\n\t\t\t\t\t\tradius=\"full\"\n\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tclassName=\"p-0 w-[36px] h-[36px] min-w-auto bg-default-100 hover:bg-default-200 text-default-500 hover:text-default-600 dark:bg-default-100 dark:hover:bg-default-200 dark:text-default-500 dark:hover:text-default-600 disabled:opacity-50 disabled:pointer-events-none\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<svg width=\"20\" height=\"20\" fill=\"currentColor\" role=\"img\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t<path fill=\"none\" d=\"M0 0h21v21H0z\"></path>\n\t\t\t\t\t\t\t<path d=\"m12.12 10 4.07-4.06a1.5 1.5 0 1 0-2.11-2.12L10 7.88 5.94 3.81a1.5 1.5 0 1 0-2.12 2.12L7.88 10l-4.07 4.06a1.5 1.5 0 0 0 0 2.12 1.51 1.51 0 0 0 2.13 0L10 12.12l4.06 4.07a1.45 1.45 0 0 0 1.06.44 1.5 1.5 0 0 0 1.06-2.56Z\"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport const ModalFooter = ({ children, className, styled }: ModalFooterType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto\", className)} style={styled}>\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n"],"names":["TRANSITION_EASINGS","TRANSITION_VARIANTS","Modal","modalId","isShow","isVisible","children","style","classNameOverlay","styleContainer","closeModalClickOut","classNameDialog","classNameContent","backdrop","modalBodyRef","useRef","useEffect","modalRoot","overlayClass","ReactDOM","AnimatePresence","jsx","LazyMotion","res","jsxs","Fragment","m","cn","e","ModalBody","forwardRef","className","styled","height","ref","ModalHeader","title","showCloseButton","disabled","onClick","Button","ModalFooter"],"mappings":"4SAgCaA,EAAqB,CACjC,KAAM,CAAC,IAAM,IAAM,GAAK,CAAC,CAO1B,EAaaC,EAAgC,CAkE5C,WAAY,CACX,MAAO,CACN,UAAW,WACX,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMD,EAAmB,IAAA,CAE3B,EACA,KAAM,CACL,UAAW,cACX,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMA,EAAmB,IAAA,CAC1B,CAEF,EACA,KAAM,CACL,MAAO,CACN,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMA,EAAmB,IAAA,CAE3B,EACA,KAAM,CACL,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMA,EAAmB,IAAA,CAC1B,CACD,CA2BF,ECvKaE,EAAQ,CAAC,CACrB,QAAAC,EACA,OAAAC,EACA,UAAAC,EACA,SAAAC,EACA,MAAAC,EACA,iBAAAC,EAAmB,GACnB,eAAAC,EACA,mBAAAC,EACA,gBAAAC,EAAkB,sBAClB,iBAAAC,EAAmB,uBACnB,SAAAC,EAAW,QACZ,IAAiB,CACV,MAAAC,EAAeC,SAAuB,IAAI,EAY5C,GAXJC,EAAAA,UAAU,KACL,OAAO,OAAW,KAAeX,GAC3B,SAAA,KAAK,UAAU,IAAI,YAAY,EAElC,IAAM,CACR,OAAO,OAAW,KACZ,SAAA,KAAK,UAAU,OA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"index.cjs.js","sources":["../../src/components/transition/transition-utils.ts","../../src/components/modal/modal.tsx"],"sourcesContent":["import type { Target, TargetAndTransition, Transition } from \"framer-motion\";\n\ntype WithMotionState<P> = Partial<Record<\"enter\" | \"exit\", P>>;\n\nexport type TransitionConfig = WithMotionState<Transition>;\n\nexport type TransitionEndConfig = WithMotionState<Target>;\n\nexport type TransitionProperties = {\n\t/**\n\t * Custom `transition` definition for `enter` and `exit`\n\t */\n\ttransition?: TransitionConfig;\n\t/**\n\t * Custom `transitionEnd` definition for `enter` and `exit`\n\t */\n\ttransitionEnd?: TransitionEndConfig;\n};\n\ntype TargetResolver<P = {}> = (props: P & TransitionProperties) => TargetAndTransition;\n\ntype Variant<P = {}> = TargetAndTransition | TargetResolver<P>;\n\nexport type Variants<P = {}> = Record<\n\tstring,\n\t{\n\t\tenter: Variant<P>;\n\t\texit: Variant<P>;\n\t\tinitial?: Variant<P>;\n\t}\n>;\n\nexport const TRANSITION_EASINGS = {\n\tease: [0.36, 0.66, 0.4, 1],\n\teaseIn: [0.4, 0, 1, 1],\n\teaseOut: [0, 0, 0.2, 1],\n\teaseInOut: [0.4, 0, 0.2, 1],\n\tspring: [0.155, 1.105, 0.295, 1.12],\n\tspringOut: [0.57, -0.15, 0.62, 0.07],\n\tsoftSpring: [0.16, 1.11, 0.3, 1.02],\n} as const;\n\nexport const TRANSITION_DEFAULTS = {\n\tenter: {\n\t\tduration: 0.2,\n\t\tease: TRANSITION_EASINGS.easeOut,\n\t},\n\texit: {\n\t\tduration: 0.1,\n\t\tease: TRANSITION_EASINGS.easeIn,\n\t},\n} as const;\n\nexport const TRANSITION_VARIANTS: Variants = {\n\tscaleSpring: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.85)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscaleSpringOpacity: {\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.8)\",\n\t\t},\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransform: \"scale(1)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.96)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscale: {\n\t\tenter: { scale: 1 },\n\t\texit: { scale: 0.95 },\n\t},\n\tscaleFadeIn: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.25,\n\t\t\t\tease: TRANSITION_EASINGS.easeIn,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.95)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.2,\n\t\t\t\tease: TRANSITION_EASINGS.easeOut,\n\t\t\t},\n\t\t},\n\t},\n\tscaleInOut: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(1.03)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tfade: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tcollapse: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\theight: \"auto\",\n\t\t\ttransition: {\n\t\t\t\theight: {\n\t\t\t\t\ttype: \"spring\",\n\t\t\t\t\tbounce: 0,\n\t\t\t\t\tduration: 0.3,\n\t\t\t\t},\n\t\t\t\topacity: {\n\t\t\t\t\tease: \"ease\" as any,\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\theight: 0,\n\t\t\ttransition: {\n\t\t\t\tease: \"ease\" as any,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t},\n};\n","\"use client\";\n\nimport ReactDOM from \"react-dom\";\nimport { forwardRef, type Ref, useEffect, useRef } from \"react\";\nimport type { ModalBodyType, ModalFooterType, ModalHeaderType, ModalType } from \"./modal.type\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"../button\";\nimport { AnimatePresence } from \"framer-motion\";\nimport { LazyMotion, m } from \"framer-motion\";\nimport { TRANSITION_VARIANTS } from \"../transition/transition-utils\";\nimport { cva } from \"class-variance-authority\";\n\nconst modalStyles = cva(\"\", {\n\tvariants: {\n\t\tsize: {\n\t\t\t\"xs\": {\n\t\t\t\tbase: \"max-w-xs\",\n\t\t\t},\n\t\t\t\"sm\": {\n\t\t\t\tbase: \"max-w-sm\",\n\t\t\t},\n\t\t\t\"md\": {\n\t\t\t\tbase: \"max-w-md\",\n\t\t\t},\n\t\t\t\"lg\": {\n\t\t\t\tbase: \"max-w-lg\",\n\t\t\t},\n\t\t\t\"xl\": {\n\t\t\t\tbase: \"max-w-xl\",\n\t\t\t},\n\t\t\t\"2xl\": {\n\t\t\t\tbase: \"max-w-2xl\",\n\t\t\t},\n\t\t\t\"3xl\": {\n\t\t\t\tbase: \"max-w-3xl\",\n\t\t\t},\n\t\t\t\"4xl\": {\n\t\t\t\tbase: \"max-w-4xl\",\n\t\t\t},\n\t\t\t\"5xl\": {\n\t\t\t\tbase: \"max-w-5xl\",\n\t\t\t},\n\t\t\t\"full\": {\n\t\t\t\tbase: \"my-0 mx-0 sm:mx-0 sm:my-0 max-w-full h-[100dvh] min-h-[100dvh] !rounded-none\",\n\t\t\t},\n\t\t},\n\t\tradius: {\n\t\t\tnone: { base: \"rounded-none\" },\n\t\t\tsm: { base: \"rounded-sm\" },\n\t\t\tmd: { base: \"rounded-md\" },\n\t\t\tlg: { base: \"rounded-lg\" },\n\t\t},\n\t\tshadow: {\n\t\t\tnone: {\n\t\t\t\tbase: \"shadow-none\",\n\t\t\t},\n\t\t\tsm: {\n\t\t\t\tbase: \"shadow-sm\",\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\tbase: \"shadow-md\",\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\tbase: \"shadow-lg\",\n\t\t\t},\n\t\t},\n\t\tbackdrop: {\n\t\t\ttransparent: {\n\t\t\t\tbackdrop: \"bg-transparent\",\n\t\t\t},\n\t\t\topaque: {\n\t\t\t\tbackdrop: \"bg-black/50\",\n\t\t\t},\n\t\t\tblur: {\n\t\t\t\tbackdrop: \"backdrop-blur-md backdrop-saturate-150 bg-overlay/30\",\n\t\t\t},\n\t\t},\n\t\tscrollBehavior: {\n\t\t\tnormal: {\n\t\t\t\tbase: \"overflow-y-hidden\",\n\t\t\t},\n\t\t\tinside: {\n\t\t\t\tbase: \"max-h-[calc(100%_-_8rem)]\",\n\t\t\t\tbody: \"overflow-y-auto\",\n\t\t\t},\n\t\t\toutside: {\n\t\t\t\twrapper: \"items-start sm:items-start overflow-y-auto\",\n\t\t\t\tbase: \"my-16\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t\tradius: \"lg\",\n\t\tshadow: \"sm\",\n\t\tbackdrop: \"opaque\",\n\t\tscrollBehavior: \"normal\",\n\t},\n});\n\nexport const Modal = ({\n\tmodalId,\n\tisShow,\n\tisVisible,\n\tchildren,\n\tstyle,\n\tclassNameOverlay = \"\",\n\tstyleContainer,\n\tonClickOutside,\n\tclassNameDialog = \"modal-custom-dialog\",\n\tclassNameContent = \"modal-custom-content\",\n\tbackdrop = \"opaque\",\n\tsize = \"md\",\n\tisKeyboardDismissDisabled = false,\n\tshadow = \"md\",\n radius = \"lg\",\n}: ModalType) => {\n\tconst modalBodyRef = useRef<HTMLDivElement>(null);\n\tuseEffect(() => {\n\t\tif (typeof window !== \"undefined\" && isVisible) {\n\t\t\tdocument.body.classList.add(\"modal-open\");\n\t\t}\n\t\treturn () => {\n\t\t\tif (typeof window !== \"undefined\") {\n\t\t\t\tdocument.body.classList.remove(\"modal-open\");\n\t\t\t}\n\t\t};\n\t}, [isVisible]);\n\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (e: KeyboardEvent) => {\n\t\t\tif (e.key === \"Escape\" && !isKeyboardDismissDisabled) {\n\t\t\t\tonClickOutside?.();\n\t\t\t}\n\t\t};\n\n\t\tif (isShow) {\n\t\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\t}\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t};\n\t}, [isShow, isKeyboardDismissDisabled, onClickOutside]);\n\n\tif (typeof window === \"undefined\") return null;\n\n\tconst modalRoot = document.getElementById(\"modal-root\");\n\tif (!modalRoot) return null;\n\n\treturn ReactDOM.createPortal(\n\t\t<AnimatePresence>\n\t\t\t{isShow && (\n\t\t\t\t<LazyMotion features={() => import(\"framer-motion\").then((res) => res.domAnimation)}>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-overlay\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.fade}\n\t\t\t\t\t\t\tclassName={cn(\"fixed inset-0 z-50\", modalStyles({ backdrop }), classNameOverlay)}\n\t\t\t\t\t\t\tonClick={onClickOutside}\n\t\t\t\t\t\t\taria-hidden={!isShow}\n\t\t\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tid={modalId}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-content\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.scaleInOut}\n\t\t\t\t\t\t\tref={modalBodyRef}\n\t\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50 grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 rounded-lg p-6 shadow-lg bg-content1\",\n\t\t\t\t\t\t\t\tmodalStyles({ size, radius , shadow }),\n\t\t\t\t\t\t\t\tclassNameDialog,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className={cn(\"modal-custom-content w-full flex flex-col gap-2\", classNameContent)} style={styleContainer}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</m.div>\n\t\t\t\t\t</>\n\t\t\t\t</LazyMotion>\n\t\t\t)}\n\t\t</AnimatePresence>,\n\t\tmodalRoot,\n\t);\n};\n\nexport const ModalBody = forwardRef(({ children, className = \"\", styled, height }: ModalBodyType, ref: Ref<HTMLDivElement>) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-body flex-1\", className)} ref={ref} style={{ ...styled, height: height ? `${height}px` : \"auto\" }}>\n\t\t\t{children}\n\t\t</div>\n\t);\n});\nModalBody.displayName = \"ModalBodyPortalComponent\";\n\nexport const ModalHeader = ({ title, showCloseButton = true, disabled = false, onClick, className, styled, children }: ModalHeaderType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-header w-full flex flex-col gap-2 text-center sm:text-left\", className)} style={styled}>\n\t\t\t{children || <h4 className=\"modal-custom-title text-lg leading-none font-semibold\">{title}</h4>}\n\t\t\t{showCloseButton && (\n\t\t\t\t<div className=\"absolute top-3 right-4 disabled:pointer-events-none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tisIconOnly\n\t\t\t\t\t\tvariant=\"light\"\n\t\t\t\t\t\tradius=\"full\"\n\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tclassName=\"p-0 w-[36px] h-[36px] min-w-auto bg-default-100 hover:bg-default-200 text-default-500 hover:text-default-600 dark:bg-default-100 dark:hover:bg-default-200 dark:text-default-500 dark:hover:text-default-600 disabled:opacity-50 disabled:pointer-events-none\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<svg width=\"20\" height=\"20\" fill=\"currentColor\" role=\"img\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t<path fill=\"none\" d=\"M0 0h21v21H0z\"></path>\n\t\t\t\t\t\t\t<path d=\"m12.12 10 4.07-4.06a1.5 1.5 0 1 0-2.11-2.12L10 7.88 5.94 3.81a1.5 1.5 0 1 0-2.12 2.12L7.88 10l-4.07 4.06a1.5 1.5 0 0 0 0 2.12 1.51 1.51 0 0 0 2.13 0L10 12.12l4.06 4.07a1.45 1.45 0 0 0 1.06.44 1.5 1.5 0 0 0 1.06-2.56Z\"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport const ModalFooter = ({ children, className, styled }: ModalFooterType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto\", className)} style={styled}>\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n"],"names":["TRANSITION_EASINGS","TRANSITION_VARIANTS","modalStyles","cva","Modal","modalId","isShow","isVisible","children","style","classNameOverlay","styleContainer","onClickOutside","classNameDialog","classNameContent","backdrop","size","isKeyboardDismissDisabled","shadow","radius","modalBodyRef","useRef","useEffect","handleKeyDown","e","modalRoot","ReactDOM","AnimatePresence","jsx","LazyMotion","res","jsxs","Fragment","m","cn","ModalBody","forwardRef","className","styled","height","ref","ModalHeader","title","showCloseButton","disabled","onClick","Button","ModalFooter"],"mappings":"qVAgCaA,EAAqB,CACjC,KAAM,CAAC,IAAM,IAAM,GAAK,CAAC,CAO1B,EAaaC,EAAgC,CAkE5C,WAAY,CACX,MAAO,CACN,UAAW,WACX,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMD,EAAmB,IAAA,CAE3B,EACA,KAAM,CACL,UAAW,cACX,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMA,EAAmB,IAAA,CAC1B,CAEF,EACA,KAAM,CACL,MAAO,CACN,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMA,EAAmB,IAAA,CAE3B,EACA,KAAM,CACL,QAAS,EACT,WAAY,CACX,SAAU,GACV,KAAMA,EAAmB,IAAA,CAC1B,CACD,CA2BF,ECtKME,EAAcC,MAAI,GAAI,CAC3B,SAAU,CACT,KAAM,CACL,GAAM,CACL,KAAM,UACP,EACA,GAAM,CACL,KAAM,UACP,EACA,GAAM,CACL,KAAM,UACP,EACA,GAAM,CACL,KAAM,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EAEF,EAIWmB,EAAc,CAAC,CAAE,SAAAvC,EAAU,UAAA6B,EAAW,OAAAC,KAEjDV,wBAAC,OAAI,UAAWM,EAAA,GAAG,qFAAsFG,CAAS,EAAG,MAAOC,EAC1H,SAAA9B,CACF,CAAA"}
|
package/dist/modal/index.es.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { j as e } from "../chunks/jsx-runtime-BYq8_R6m.js";
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { c as
|
|
5
|
-
import { B
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
import L from "react-dom";
|
|
3
|
+
import { forwardRef as R, useRef as A, useEffect as f } from "react";
|
|
4
|
+
import { c as n } from "../chunks/utils-DF-FHKXF.js";
|
|
5
|
+
import { B } from "../chunks/button-CT1gzAt1.js";
|
|
6
|
+
import { c as M } from "../chunks/index-BNmRGtA6.js";
|
|
7
|
+
import { A as E, L as z, m as p } from "../chunks/ripple-DV2Gx-M9.js";
|
|
8
|
+
const m = {
|
|
8
9
|
ease: [0.36, 0.66, 0.4, 1]
|
|
9
|
-
},
|
|
10
|
+
}, b = {
|
|
10
11
|
scaleInOut: {
|
|
11
12
|
enter: {
|
|
12
13
|
transform: "scale(1)",
|
|
13
14
|
opacity: 1,
|
|
14
15
|
transition: {
|
|
15
16
|
duration: 0.4,
|
|
16
|
-
ease:
|
|
17
|
+
ease: m.ease
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
exit: {
|
|
@@ -21,7 +22,7 @@ const d = {
|
|
|
21
22
|
opacity: 0,
|
|
22
23
|
transition: {
|
|
23
24
|
duration: 0.3,
|
|
24
|
-
ease:
|
|
25
|
+
ease: m.ease
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
},
|
|
@@ -30,59 +31,143 @@ const d = {
|
|
|
30
31
|
opacity: 1,
|
|
31
32
|
transition: {
|
|
32
33
|
duration: 0.4,
|
|
33
|
-
ease:
|
|
34
|
+
ease: m.ease
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
exit: {
|
|
37
38
|
opacity: 0,
|
|
38
39
|
transition: {
|
|
39
40
|
duration: 0.3,
|
|
40
|
-
ease:
|
|
41
|
+
ease: m.ease
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
},
|
|
45
|
+
}, h = M("", {
|
|
46
|
+
variants: {
|
|
47
|
+
size: {
|
|
48
|
+
xs: {
|
|
49
|
+
base: "max-w-xs"
|
|
50
|
+
},
|
|
51
|
+
sm: {
|
|
52
|
+
base: "max-w-sm"
|
|
53
|
+
},
|
|
54
|
+
md: {
|
|
55
|
+
base: "max-w-md"
|
|
56
|
+
},
|
|
57
|
+
lg: {
|
|
58
|
+
base: "max-w-lg"
|
|
59
|
+
},
|
|
60
|
+
xl: {
|
|
61
|
+
base: "max-w-xl"
|
|
62
|
+
},
|
|
63
|
+
"2xl": {
|
|
64
|
+
base: "max-w-2xl"
|
|
65
|
+
},
|
|
66
|
+
"3xl": {
|
|
67
|
+
base: "max-w-3xl"
|
|
68
|
+
},
|
|
69
|
+
"4xl": {
|
|
70
|
+
base: "max-w-4xl"
|
|
71
|
+
},
|
|
72
|
+
"5xl": {
|
|
73
|
+
base: "max-w-5xl"
|
|
74
|
+
},
|
|
75
|
+
full: {
|
|
76
|
+
base: "my-0 mx-0 sm:mx-0 sm:my-0 max-w-full h-[100dvh] min-h-[100dvh] !rounded-none"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
radius: {
|
|
80
|
+
none: { base: "rounded-none" },
|
|
81
|
+
sm: { base: "rounded-sm" },
|
|
82
|
+
md: { base: "rounded-md" },
|
|
83
|
+
lg: { base: "rounded-lg" }
|
|
84
|
+
},
|
|
85
|
+
shadow: {
|
|
86
|
+
none: {
|
|
87
|
+
base: "shadow-none"
|
|
88
|
+
},
|
|
89
|
+
sm: {
|
|
90
|
+
base: "shadow-sm"
|
|
91
|
+
},
|
|
92
|
+
md: {
|
|
93
|
+
base: "shadow-md"
|
|
94
|
+
},
|
|
95
|
+
lg: {
|
|
96
|
+
base: "shadow-lg"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
backdrop: {
|
|
100
|
+
transparent: {
|
|
101
|
+
backdrop: "bg-transparent"
|
|
102
|
+
},
|
|
103
|
+
opaque: {
|
|
104
|
+
backdrop: "bg-black/50"
|
|
105
|
+
},
|
|
106
|
+
blur: {
|
|
107
|
+
backdrop: "backdrop-blur-md backdrop-saturate-150 bg-overlay/30"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
scrollBehavior: {
|
|
111
|
+
normal: {
|
|
112
|
+
base: "overflow-y-hidden"
|
|
113
|
+
},
|
|
114
|
+
inside: {
|
|
115
|
+
base: "max-h-[calc(100%_-_8rem)]",
|
|
116
|
+
body: "overflow-y-auto"
|
|
117
|
+
},
|
|
118
|
+
outside: {
|
|
119
|
+
wrapper: "items-start sm:items-start overflow-y-auto",
|
|
120
|
+
base: "my-16"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
defaultVariants: {
|
|
125
|
+
size: "md",
|
|
126
|
+
radius: "lg",
|
|
127
|
+
shadow: "sm",
|
|
128
|
+
backdrop: "opaque",
|
|
129
|
+
scrollBehavior: "normal"
|
|
130
|
+
}
|
|
131
|
+
}), V = ({
|
|
45
132
|
modalId: o,
|
|
46
133
|
isShow: a,
|
|
47
134
|
isVisible: t,
|
|
48
|
-
children:
|
|
49
|
-
style:
|
|
135
|
+
children: s,
|
|
136
|
+
style: r,
|
|
50
137
|
classNameOverlay: i = "",
|
|
51
138
|
styleContainer: c,
|
|
52
|
-
|
|
53
|
-
classNameDialog:
|
|
54
|
-
classNameContent:
|
|
55
|
-
backdrop:
|
|
139
|
+
onClickOutside: d,
|
|
140
|
+
classNameDialog: y = "modal-custom-dialog",
|
|
141
|
+
classNameContent: w = "modal-custom-content",
|
|
142
|
+
backdrop: g = "opaque",
|
|
143
|
+
size: v = "md",
|
|
144
|
+
isKeyboardDismissDisabled: x = !1,
|
|
145
|
+
shadow: j = "md",
|
|
146
|
+
radius: N = "lg"
|
|
56
147
|
}) => {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
148
|
+
const k = A(null);
|
|
149
|
+
if (f(() => (typeof window < "u" && t && document.body.classList.add("modal-open"), () => {
|
|
59
150
|
typeof window < "u" && document.body.classList.remove("modal-open");
|
|
60
|
-
}), [t]),
|
|
151
|
+
}), [t]), f(() => {
|
|
152
|
+
const l = (I) => {
|
|
153
|
+
I.key === "Escape" && !x && (d == null || d());
|
|
154
|
+
};
|
|
155
|
+
return a && document.addEventListener("keydown", l), () => {
|
|
156
|
+
document.removeEventListener("keydown", l);
|
|
157
|
+
};
|
|
158
|
+
}, [a, x, d]), typeof window > "u") return null;
|
|
61
159
|
const u = document.getElementById("modal-root");
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
switch (y) {
|
|
65
|
-
case "transparent":
|
|
66
|
-
r = "bg-transparent";
|
|
67
|
-
break;
|
|
68
|
-
case "opaque":
|
|
69
|
-
r = "bg-black/50";
|
|
70
|
-
break;
|
|
71
|
-
case "blur":
|
|
72
|
-
r = "backdrop-blur-md backdrop-saturate-150 bg-overlay/30";
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
return v.createPortal(
|
|
76
|
-
/* @__PURE__ */ e.jsx(I, { children: a && /* @__PURE__ */ e.jsx(R, { features: () => import("../chunks/index-fRQUvivo.js").then((m) => m.domAnimation), children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
160
|
+
return u ? L.createPortal(
|
|
161
|
+
/* @__PURE__ */ e.jsx(E, { children: a && /* @__PURE__ */ e.jsx(z, { features: () => import("../chunks/index-fRQUvivo.js").then((l) => l.domAnimation), children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
77
162
|
/* @__PURE__ */ e.jsx(
|
|
78
|
-
|
|
163
|
+
p.div,
|
|
79
164
|
{
|
|
80
165
|
initial: "exit",
|
|
81
166
|
animate: "enter",
|
|
82
167
|
exit: "exit",
|
|
83
|
-
variants:
|
|
84
|
-
className:
|
|
85
|
-
onClick:
|
|
168
|
+
variants: b.fade,
|
|
169
|
+
className: n("fixed inset-0 z-50", h({ backdrop: g }), i),
|
|
170
|
+
onClick: d,
|
|
86
171
|
"aria-hidden": !a,
|
|
87
172
|
role: "dialog",
|
|
88
173
|
"aria-modal": "true",
|
|
@@ -92,38 +177,39 @@ const d = {
|
|
|
92
177
|
"modal-overlay"
|
|
93
178
|
),
|
|
94
179
|
/* @__PURE__ */ e.jsx(
|
|
95
|
-
|
|
180
|
+
p.div,
|
|
96
181
|
{
|
|
97
182
|
initial: "exit",
|
|
98
183
|
animate: "enter",
|
|
99
184
|
exit: "exit",
|
|
100
|
-
variants:
|
|
101
|
-
ref:
|
|
102
|
-
onClick: (
|
|
103
|
-
className:
|
|
185
|
+
variants: b.scaleInOut,
|
|
186
|
+
ref: k,
|
|
187
|
+
onClick: (l) => l.stopPropagation(),
|
|
188
|
+
className: n(
|
|
104
189
|
"fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50 grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 rounded-lg p-6 shadow-lg bg-content1",
|
|
105
|
-
h
|
|
190
|
+
h({ size: v, radius: N, shadow: j }),
|
|
191
|
+
y
|
|
106
192
|
),
|
|
107
|
-
style:
|
|
108
|
-
children: /* @__PURE__ */ e.jsx("div", { className:
|
|
193
|
+
style: r,
|
|
194
|
+
children: /* @__PURE__ */ e.jsx("div", { className: n("modal-custom-content w-full flex flex-col gap-2", w), style: c, children: s })
|
|
109
195
|
},
|
|
110
196
|
"modal-content"
|
|
111
197
|
)
|
|
112
198
|
] }) }) }),
|
|
113
199
|
u
|
|
114
|
-
);
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
const
|
|
200
|
+
) : null;
|
|
201
|
+
}, _ = R(({ children: o, className: a = "", styled: t, height: s }, r) => /* @__PURE__ */ e.jsx("div", { className: n("modal-custom-body flex-1", a), ref: r, style: { ...t, height: s ? `${s}px` : "auto" }, children: o }));
|
|
202
|
+
_.displayName = "ModalBodyPortalComponent";
|
|
203
|
+
const Z = ({ title: o, showCloseButton: a = !0, disabled: t = !1, onClick: s, className: r, styled: i, children: c }) => /* @__PURE__ */ e.jsxs("div", { className: n("modal-custom-header w-full flex flex-col gap-2 text-center sm:text-left", r), style: i, children: [
|
|
118
204
|
c || /* @__PURE__ */ e.jsx("h4", { className: "modal-custom-title text-lg leading-none font-semibold", children: o }),
|
|
119
205
|
a && /* @__PURE__ */ e.jsx("div", { className: "absolute top-3 right-4 disabled:pointer-events-none", children: /* @__PURE__ */ e.jsxs(
|
|
120
|
-
|
|
206
|
+
B,
|
|
121
207
|
{
|
|
122
208
|
isIconOnly: !0,
|
|
123
209
|
variant: "light",
|
|
124
210
|
radius: "full",
|
|
125
211
|
"aria-label": "Close",
|
|
126
|
-
onClick:
|
|
212
|
+
onClick: s,
|
|
127
213
|
disabled: t,
|
|
128
214
|
className: "p-0 w-[36px] h-[36px] min-w-auto bg-default-100 hover:bg-default-200 text-default-500 hover:text-default-600 dark:bg-default-100 dark:hover:bg-default-200 dark:text-default-500 dark:hover:text-default-600 disabled:opacity-50 disabled:pointer-events-none",
|
|
129
215
|
children: [
|
|
@@ -135,11 +221,11 @@ const E = ({ title: o, showCloseButton: a = !0, disabled: t = !1, onClick: l, cl
|
|
|
135
221
|
]
|
|
136
222
|
}
|
|
137
223
|
) })
|
|
138
|
-
] }),
|
|
224
|
+
] }), $ = ({ children: o, className: a, styled: t }) => /* @__PURE__ */ e.jsx("div", { className: n("modal-custom-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto", a), style: t, children: o });
|
|
139
225
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
226
|
+
V as Modal,
|
|
227
|
+
_ as ModalBody,
|
|
228
|
+
$ as ModalFooter,
|
|
229
|
+
Z as ModalHeader
|
|
144
230
|
};
|
|
145
231
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../src/components/transition/transition-utils.ts","../../src/components/modal/modal.tsx"],"sourcesContent":["import type { Target, TargetAndTransition, Transition } from \"framer-motion\";\n\ntype WithMotionState<P> = Partial<Record<\"enter\" | \"exit\", P>>;\n\nexport type TransitionConfig = WithMotionState<Transition>;\n\nexport type TransitionEndConfig = WithMotionState<Target>;\n\nexport type TransitionProperties = {\n\t/**\n\t * Custom `transition` definition for `enter` and `exit`\n\t */\n\ttransition?: TransitionConfig;\n\t/**\n\t * Custom `transitionEnd` definition for `enter` and `exit`\n\t */\n\ttransitionEnd?: TransitionEndConfig;\n};\n\ntype TargetResolver<P = {}> = (props: P & TransitionProperties) => TargetAndTransition;\n\ntype Variant<P = {}> = TargetAndTransition | TargetResolver<P>;\n\nexport type Variants<P = {}> = Record<\n\tstring,\n\t{\n\t\tenter: Variant<P>;\n\t\texit: Variant<P>;\n\t\tinitial?: Variant<P>;\n\t}\n>;\n\nexport const TRANSITION_EASINGS = {\n\tease: [0.36, 0.66, 0.4, 1],\n\teaseIn: [0.4, 0, 1, 1],\n\teaseOut: [0, 0, 0.2, 1],\n\teaseInOut: [0.4, 0, 0.2, 1],\n\tspring: [0.155, 1.105, 0.295, 1.12],\n\tspringOut: [0.57, -0.15, 0.62, 0.07],\n\tsoftSpring: [0.16, 1.11, 0.3, 1.02],\n} as const;\n\nexport const TRANSITION_DEFAULTS = {\n\tenter: {\n\t\tduration: 0.2,\n\t\tease: TRANSITION_EASINGS.easeOut,\n\t},\n\texit: {\n\t\tduration: 0.1,\n\t\tease: TRANSITION_EASINGS.easeIn,\n\t},\n} as const;\n\nexport const TRANSITION_VARIANTS: Variants = {\n\tscaleSpring: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.85)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscaleSpringOpacity: {\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.8)\",\n\t\t},\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransform: \"scale(1)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.96)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscale: {\n\t\tenter: { scale: 1 },\n\t\texit: { scale: 0.95 },\n\t},\n\tscaleFadeIn: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.25,\n\t\t\t\tease: TRANSITION_EASINGS.easeIn,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.95)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.2,\n\t\t\t\tease: TRANSITION_EASINGS.easeOut,\n\t\t\t},\n\t\t},\n\t},\n\tscaleInOut: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(1.03)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tfade: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tcollapse: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\theight: \"auto\",\n\t\t\ttransition: {\n\t\t\t\theight: {\n\t\t\t\t\ttype: \"spring\",\n\t\t\t\t\tbounce: 0,\n\t\t\t\t\tduration: 0.3,\n\t\t\t\t},\n\t\t\t\topacity: {\n\t\t\t\t\tease: \"ease\" as any,\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\theight: 0,\n\t\t\ttransition: {\n\t\t\t\tease: \"ease\" as any,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t},\n};\n","\"use client\";\n\nimport ReactDOM from \"react-dom\";\nimport { forwardRef, type Ref, useEffect, useRef } from \"react\";\nimport type { ModalBodyType, ModalFooterType, ModalHeaderType, ModalType } from \"./modal.type\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"../button\";\nimport { AnimatePresence } from \"framer-motion\";\nimport { LazyMotion, m } from \"framer-motion\";\nimport { TRANSITION_VARIANTS } from \"../transition/transition-utils\";\n\nexport const Modal = ({\n\tmodalId,\n\tisShow,\n\tisVisible,\n\tchildren,\n\tstyle,\n\tclassNameOverlay = \"\",\n\tstyleContainer,\n\tcloseModalClickOut,\n\tclassNameDialog = \"modal-custom-dialog\",\n\tclassNameContent = \"modal-custom-content\",\n\tbackdrop = \"opaque\",\n}: ModalType) => {\n\tconst modalBodyRef = useRef<HTMLDivElement>(null);\n\tuseEffect(() => {\n\t\tif (typeof window !== \"undefined\" && isVisible) {\n\t\t\tdocument.body.classList.add(\"modal-open\");\n\t\t}\n\t\treturn () => {\n\t\t\tif (typeof window !== \"undefined\") {\n\t\t\t\tdocument.body.classList.remove(\"modal-open\");\n\t\t\t}\n\t\t};\n\t}, [isVisible]);\n\n\tif (typeof window === \"undefined\") return null;\n\n\tconst modalRoot = document.getElementById(\"modal-root\");\n\tif (!modalRoot) return null;\n\n\tlet overlayClass = \"\";\n\n\tswitch (backdrop) {\n\t\tcase \"transparent\":\n\t\t\toverlayClass = \"bg-transparent\";\n\t\t\tbreak;\n\t\tcase \"opaque\":\n\t\t\toverlayClass = \"bg-black/50\";\n\t\t\tbreak;\n\t\tcase \"blur\":\n\t\t\toverlayClass = \"backdrop-blur-md backdrop-saturate-150 bg-overlay/30\";\n\t\t\tbreak;\n\t}\n\n\treturn ReactDOM.createPortal(\n\t\t<AnimatePresence>\n\t\t\t{isShow && (\n\t\t\t\t<LazyMotion features={() => import(\"framer-motion\").then((res) => res.domAnimation)}>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-overlay\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.fade}\n\t\t\t\t\t\t\tclassName={cn(\"fixed inset-0 z-50\", overlayClass, classNameOverlay)}\n\t\t\t\t\t\t\tonClick={closeModalClickOut}\n\t\t\t\t\t\t\taria-hidden={!isShow}\n\t\t\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tid={modalId}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-content\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.scaleInOut}\n\t\t\t\t\t\t\tref={modalBodyRef}\n\t\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50 grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 rounded-lg p-6 shadow-lg bg-content1\",\n\t\t\t\t\t\t\t\tclassNameDialog,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className={cn(\"modal-custom-content w-full flex flex-col gap-2\", classNameContent)} style={styleContainer}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</m.div>\n\t\t\t\t\t</>\n\t\t\t\t</LazyMotion>\n\t\t\t)}\n\t\t</AnimatePresence>,\n\t\tmodalRoot,\n\t);\n};\n\nexport const ModalBody = forwardRef(({ children, className = \"\", styled, height }: ModalBodyType, ref: Ref<HTMLDivElement>) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-body flex-1\", className)} ref={ref} style={{ ...styled, height: height ? `${height}px` : \"auto\" }}>\n\t\t\t{children}\n\t\t</div>\n\t);\n});\nModalBody.displayName = \"ModalBodyPortalComponent\";\n\nexport const ModalHeader = ({ title, showCloseButton = true, disabled = false, onClick, className, styled, children }: ModalHeaderType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-header w-full flex flex-col gap-2 text-center sm:text-left\", className)} style={styled}>\n\t\t\t{children || <h4 className=\"modal-custom-title text-lg leading-none font-semibold\">{title}</h4>}\n\t\t\t{showCloseButton && (\n\t\t\t\t<div className=\"absolute top-3 right-4 disabled:pointer-events-none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tisIconOnly\n\t\t\t\t\t\tvariant=\"light\"\n\t\t\t\t\t\tradius=\"full\"\n\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tclassName=\"p-0 w-[36px] h-[36px] min-w-auto bg-default-100 hover:bg-default-200 text-default-500 hover:text-default-600 dark:bg-default-100 dark:hover:bg-default-200 dark:text-default-500 dark:hover:text-default-600 disabled:opacity-50 disabled:pointer-events-none\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<svg width=\"20\" height=\"20\" fill=\"currentColor\" role=\"img\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t<path fill=\"none\" d=\"M0 0h21v21H0z\"></path>\n\t\t\t\t\t\t\t<path d=\"m12.12 10 4.07-4.06a1.5 1.5 0 1 0-2.11-2.12L10 7.88 5.94 3.81a1.5 1.5 0 1 0-2.12 2.12L7.88 10l-4.07 4.06a1.5 1.5 0 0 0 0 2.12 1.51 1.51 0 0 0 2.13 0L10 12.12l4.06 4.07a1.45 1.45 0 0 0 1.06.44 1.5 1.5 0 0 0 1.06-2.56Z\"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport const ModalFooter = ({ children, className, styled }: ModalFooterType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto\", className)} style={styled}>\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n"],"names":["TRANSITION_EASINGS","TRANSITION_VARIANTS","Modal","modalId","isShow","isVisible","children","style","classNameOverlay","styleContainer","closeModalClickOut","classNameDialog","classNameContent","backdrop","modalBodyRef","useRef","useEffect","modalRoot","overlayClass","ReactDOM","AnimatePresence","jsx","LazyMotion","res","jsxs","Fragment","m","cn","e","ModalBody","forwardRef","className","styled","height","ref","ModalHeader","title","showCloseButton","disabled","onClick","Button","ModalFooter"],"mappings":";;;;;;AAgCO,MAAMA,IAAqB;AAAA,EACjC,MAAM,CAAC,MAAM,MAAM,KAAK,CAAC;AAO1B,GAaaC,IAAgC;AAAA,EAkE5C,YAAY;AAAA,IACX,OAAO;AAAA,MACN,WAAW;AAAA,MACX,SAAS;AAAA,MACT,YAAY;AAAA,QACX,UAAU;AAAA,QACV,MAAMD,EAAmB;AAAA,MAAA;AAAA,IAE3B;AAAA,IACA,MAAM;AAAA,MACL,WAAW;AAAA,MACX,SAAS;AAAA,MACT,YAAY;AAAA,QACX,UAAU;AAAA,QACV,MAAMA,EAAmB;AAAA,MAAA;AAAA,IAC1B;AAAA,EAEF;AAAA,EACA,MAAM;AAAA,IACL,OAAO;AAAA,MACN,SAAS;AAAA,MACT,YAAY;AAAA,QACX,UAAU;AAAA,QACV,MAAMA,EAAmB;AAAA,MAAA;AAAA,IAE3B;AAAA,IACA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,YAAY;AAAA,QACX,UAAU;AAAA,QACV,MAAMA,EAAmB;AAAA,MAAA;AAAA,IAC1B;AAAA,EACD;AA2BF,GCvKaE,IAAQ,CAAC;AAAA,EACrB,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,kBAAAC,IAAmB;AAAA,EACnB,gBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,kBAAAC,IAAmB;AAAA,EACnB,UAAAC,IAAW;AACZ,MAAiB;AACV,QAAAC,IAAeC,EAAuB,IAAI;AAY5C,MAXJC,EAAU,OACL,OAAO,SAAW,OAAeX,KAC3B,SAAA,KAAK,UAAU,IAAI,YAAY,GAElC,MAAM;AACR,IAAA,OAAO,SAAW,OACZ,SAAA,KAAK,UAAU,OAAO,YAAY;AAAA,EAE7C,IACE,CAACA,CAAS,CAAC,GA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AU,WAAU,UAAK,QAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,EAEjC,CAAA;AAAA,GAEF,GAIWoB,IAAc,CAAC,EAAE,UAAAnC,GAAU,WAAAyB,GAAW,QAAAC,QAEjDX,gBAAAA,MAAC,SAAI,WAAWM,EAAG,sFAAsFI,CAAS,GAAG,OAAOC,GAC1H,UAAA1B,EACF,CAAA;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../src/components/transition/transition-utils.ts","../../src/components/modal/modal.tsx"],"sourcesContent":["import type { Target, TargetAndTransition, Transition } from \"framer-motion\";\n\ntype WithMotionState<P> = Partial<Record<\"enter\" | \"exit\", P>>;\n\nexport type TransitionConfig = WithMotionState<Transition>;\n\nexport type TransitionEndConfig = WithMotionState<Target>;\n\nexport type TransitionProperties = {\n\t/**\n\t * Custom `transition` definition for `enter` and `exit`\n\t */\n\ttransition?: TransitionConfig;\n\t/**\n\t * Custom `transitionEnd` definition for `enter` and `exit`\n\t */\n\ttransitionEnd?: TransitionEndConfig;\n};\n\ntype TargetResolver<P = {}> = (props: P & TransitionProperties) => TargetAndTransition;\n\ntype Variant<P = {}> = TargetAndTransition | TargetResolver<P>;\n\nexport type Variants<P = {}> = Record<\n\tstring,\n\t{\n\t\tenter: Variant<P>;\n\t\texit: Variant<P>;\n\t\tinitial?: Variant<P>;\n\t}\n>;\n\nexport const TRANSITION_EASINGS = {\n\tease: [0.36, 0.66, 0.4, 1],\n\teaseIn: [0.4, 0, 1, 1],\n\teaseOut: [0, 0, 0.2, 1],\n\teaseInOut: [0.4, 0, 0.2, 1],\n\tspring: [0.155, 1.105, 0.295, 1.12],\n\tspringOut: [0.57, -0.15, 0.62, 0.07],\n\tsoftSpring: [0.16, 1.11, 0.3, 1.02],\n} as const;\n\nexport const TRANSITION_DEFAULTS = {\n\tenter: {\n\t\tduration: 0.2,\n\t\tease: TRANSITION_EASINGS.easeOut,\n\t},\n\texit: {\n\t\tduration: 0.1,\n\t\tease: TRANSITION_EASINGS.easeIn,\n\t},\n} as const;\n\nexport const TRANSITION_VARIANTS: Variants = {\n\tscaleSpring: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.85)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscaleSpringOpacity: {\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.8)\",\n\t\t},\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransform: \"scale(1)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"spring\",\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransform: \"scale(0.96)\",\n\t\t\ttransition: {\n\t\t\t\ttype: \"easeOut\" as any,\n\t\t\t\tbounce: 0,\n\t\t\t\tduration: 0.15,\n\t\t\t},\n\t\t},\n\t},\n\tscale: {\n\t\tenter: { scale: 1 },\n\t\texit: { scale: 0.95 },\n\t},\n\tscaleFadeIn: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.25,\n\t\t\t\tease: TRANSITION_EASINGS.easeIn,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(0.95)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.2,\n\t\t\t\tease: TRANSITION_EASINGS.easeOut,\n\t\t\t},\n\t\t},\n\t},\n\tscaleInOut: {\n\t\tenter: {\n\t\t\ttransform: \"scale(1)\",\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\ttransform: \"scale(1.03)\",\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tfade: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.4,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tease: TRANSITION_EASINGS.ease,\n\t\t\t},\n\t\t},\n\t},\n\tcollapse: {\n\t\tenter: {\n\t\t\topacity: 1,\n\t\t\theight: \"auto\",\n\t\t\ttransition: {\n\t\t\t\theight: {\n\t\t\t\t\ttype: \"spring\",\n\t\t\t\t\tbounce: 0,\n\t\t\t\t\tduration: 0.3,\n\t\t\t\t},\n\t\t\t\topacity: {\n\t\t\t\t\tease: \"ease\" as any,\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\theight: 0,\n\t\t\ttransition: {\n\t\t\t\tease: \"ease\" as any,\n\t\t\t\tduration: 0.3,\n\t\t\t},\n\t\t},\n\t},\n};\n","\"use client\";\n\nimport ReactDOM from \"react-dom\";\nimport { forwardRef, type Ref, useEffect, useRef } from \"react\";\nimport type { ModalBodyType, ModalFooterType, ModalHeaderType, ModalType } from \"./modal.type\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"../button\";\nimport { AnimatePresence } from \"framer-motion\";\nimport { LazyMotion, m } from \"framer-motion\";\nimport { TRANSITION_VARIANTS } from \"../transition/transition-utils\";\nimport { cva } from \"class-variance-authority\";\n\nconst modalStyles = cva(\"\", {\n\tvariants: {\n\t\tsize: {\n\t\t\t\"xs\": {\n\t\t\t\tbase: \"max-w-xs\",\n\t\t\t},\n\t\t\t\"sm\": {\n\t\t\t\tbase: \"max-w-sm\",\n\t\t\t},\n\t\t\t\"md\": {\n\t\t\t\tbase: \"max-w-md\",\n\t\t\t},\n\t\t\t\"lg\": {\n\t\t\t\tbase: \"max-w-lg\",\n\t\t\t},\n\t\t\t\"xl\": {\n\t\t\t\tbase: \"max-w-xl\",\n\t\t\t},\n\t\t\t\"2xl\": {\n\t\t\t\tbase: \"max-w-2xl\",\n\t\t\t},\n\t\t\t\"3xl\": {\n\t\t\t\tbase: \"max-w-3xl\",\n\t\t\t},\n\t\t\t\"4xl\": {\n\t\t\t\tbase: \"max-w-4xl\",\n\t\t\t},\n\t\t\t\"5xl\": {\n\t\t\t\tbase: \"max-w-5xl\",\n\t\t\t},\n\t\t\t\"full\": {\n\t\t\t\tbase: \"my-0 mx-0 sm:mx-0 sm:my-0 max-w-full h-[100dvh] min-h-[100dvh] !rounded-none\",\n\t\t\t},\n\t\t},\n\t\tradius: {\n\t\t\tnone: { base: \"rounded-none\" },\n\t\t\tsm: { base: \"rounded-sm\" },\n\t\t\tmd: { base: \"rounded-md\" },\n\t\t\tlg: { base: \"rounded-lg\" },\n\t\t},\n\t\tshadow: {\n\t\t\tnone: {\n\t\t\t\tbase: \"shadow-none\",\n\t\t\t},\n\t\t\tsm: {\n\t\t\t\tbase: \"shadow-sm\",\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\tbase: \"shadow-md\",\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\tbase: \"shadow-lg\",\n\t\t\t},\n\t\t},\n\t\tbackdrop: {\n\t\t\ttransparent: {\n\t\t\t\tbackdrop: \"bg-transparent\",\n\t\t\t},\n\t\t\topaque: {\n\t\t\t\tbackdrop: \"bg-black/50\",\n\t\t\t},\n\t\t\tblur: {\n\t\t\t\tbackdrop: \"backdrop-blur-md backdrop-saturate-150 bg-overlay/30\",\n\t\t\t},\n\t\t},\n\t\tscrollBehavior: {\n\t\t\tnormal: {\n\t\t\t\tbase: \"overflow-y-hidden\",\n\t\t\t},\n\t\t\tinside: {\n\t\t\t\tbase: \"max-h-[calc(100%_-_8rem)]\",\n\t\t\t\tbody: \"overflow-y-auto\",\n\t\t\t},\n\t\t\toutside: {\n\t\t\t\twrapper: \"items-start sm:items-start overflow-y-auto\",\n\t\t\t\tbase: \"my-16\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t\tradius: \"lg\",\n\t\tshadow: \"sm\",\n\t\tbackdrop: \"opaque\",\n\t\tscrollBehavior: \"normal\",\n\t},\n});\n\nexport const Modal = ({\n\tmodalId,\n\tisShow,\n\tisVisible,\n\tchildren,\n\tstyle,\n\tclassNameOverlay = \"\",\n\tstyleContainer,\n\tonClickOutside,\n\tclassNameDialog = \"modal-custom-dialog\",\n\tclassNameContent = \"modal-custom-content\",\n\tbackdrop = \"opaque\",\n\tsize = \"md\",\n\tisKeyboardDismissDisabled = false,\n\tshadow = \"md\",\n radius = \"lg\",\n}: ModalType) => {\n\tconst modalBodyRef = useRef<HTMLDivElement>(null);\n\tuseEffect(() => {\n\t\tif (typeof window !== \"undefined\" && isVisible) {\n\t\t\tdocument.body.classList.add(\"modal-open\");\n\t\t}\n\t\treturn () => {\n\t\t\tif (typeof window !== \"undefined\") {\n\t\t\t\tdocument.body.classList.remove(\"modal-open\");\n\t\t\t}\n\t\t};\n\t}, [isVisible]);\n\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (e: KeyboardEvent) => {\n\t\t\tif (e.key === \"Escape\" && !isKeyboardDismissDisabled) {\n\t\t\t\tonClickOutside?.();\n\t\t\t}\n\t\t};\n\n\t\tif (isShow) {\n\t\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\t}\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t};\n\t}, [isShow, isKeyboardDismissDisabled, onClickOutside]);\n\n\tif (typeof window === \"undefined\") return null;\n\n\tconst modalRoot = document.getElementById(\"modal-root\");\n\tif (!modalRoot) return null;\n\n\treturn ReactDOM.createPortal(\n\t\t<AnimatePresence>\n\t\t\t{isShow && (\n\t\t\t\t<LazyMotion features={() => import(\"framer-motion\").then((res) => res.domAnimation)}>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-overlay\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.fade}\n\t\t\t\t\t\t\tclassName={cn(\"fixed inset-0 z-50\", modalStyles({ backdrop }), classNameOverlay)}\n\t\t\t\t\t\t\tonClick={onClickOutside}\n\t\t\t\t\t\t\taria-hidden={!isShow}\n\t\t\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tid={modalId}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<m.div\n\t\t\t\t\t\t\tkey=\"modal-content\"\n\t\t\t\t\t\t\tinitial=\"exit\"\n\t\t\t\t\t\t\tanimate=\"enter\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tvariants={TRANSITION_VARIANTS.scaleInOut}\n\t\t\t\t\t\t\tref={modalBodyRef}\n\t\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50 grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 rounded-lg p-6 shadow-lg bg-content1\",\n\t\t\t\t\t\t\t\tmodalStyles({ size, radius , shadow }),\n\t\t\t\t\t\t\t\tclassNameDialog,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className={cn(\"modal-custom-content w-full flex flex-col gap-2\", classNameContent)} style={styleContainer}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</m.div>\n\t\t\t\t\t</>\n\t\t\t\t</LazyMotion>\n\t\t\t)}\n\t\t</AnimatePresence>,\n\t\tmodalRoot,\n\t);\n};\n\nexport const ModalBody = forwardRef(({ children, className = \"\", styled, height }: ModalBodyType, ref: Ref<HTMLDivElement>) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-body flex-1\", className)} ref={ref} style={{ ...styled, height: height ? `${height}px` : \"auto\" }}>\n\t\t\t{children}\n\t\t</div>\n\t);\n});\nModalBody.displayName = \"ModalBodyPortalComponent\";\n\nexport const ModalHeader = ({ title, showCloseButton = true, disabled = false, onClick, className, styled, children }: ModalHeaderType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-header w-full flex flex-col gap-2 text-center sm:text-left\", className)} style={styled}>\n\t\t\t{children || <h4 className=\"modal-custom-title text-lg leading-none font-semibold\">{title}</h4>}\n\t\t\t{showCloseButton && (\n\t\t\t\t<div className=\"absolute top-3 right-4 disabled:pointer-events-none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tisIconOnly\n\t\t\t\t\t\tvariant=\"light\"\n\t\t\t\t\t\tradius=\"full\"\n\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tclassName=\"p-0 w-[36px] h-[36px] min-w-auto bg-default-100 hover:bg-default-200 text-default-500 hover:text-default-600 dark:bg-default-100 dark:hover:bg-default-200 dark:text-default-500 dark:hover:text-default-600 disabled:opacity-50 disabled:pointer-events-none\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<svg width=\"20\" height=\"20\" fill=\"currentColor\" role=\"img\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t<path fill=\"none\" d=\"M0 0h21v21H0z\"></path>\n\t\t\t\t\t\t\t<path d=\"m12.12 10 4.07-4.06a1.5 1.5 0 1 0-2.11-2.12L10 7.88 5.94 3.81a1.5 1.5 0 1 0-2.12 2.12L7.88 10l-4.07 4.06a1.5 1.5 0 0 0 0 2.12 1.51 1.51 0 0 0 2.13 0L10 12.12l4.06 4.07a1.45 1.45 0 0 0 1.06.44 1.5 1.5 0 0 0 1.06-2.56Z\"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport const ModalFooter = ({ children, className, styled }: ModalFooterType) => {\n\treturn (\n\t\t<div className={cn(\"modal-custom-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto\", className)} style={styled}>\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n"],"names":["TRANSITION_EASINGS","TRANSITION_VARIANTS","modalStyles","cva","Modal","modalId","isShow","isVisible","children","style","classNameOverlay","styleContainer","onClickOutside","classNameDialog","classNameContent","backdrop","size","isKeyboardDismissDisabled","shadow","radius","modalBodyRef","useRef","useEffect","handleKeyDown","e","modalRoot","ReactDOM","AnimatePresence","jsx","LazyMotion","res","jsxs","Fragment","m","cn","ModalBody","forwardRef","className","styled","height","ref","ModalHeader","title","showCloseButton","disabled","onClick","Button","ModalFooter"],"mappings":";;;;;;;AAgCO,MAAMA,IAAqB;AAAA,EACjC,MAAM,CAAC,MAAM,MAAM,KAAK,CAAC;AAO1B,GAaaC,IAAgC;AAAA,EAkE5C,YAAY;AAAA,IACX,OAAO;AAAA,MACN,WAAW;AAAA,MACX,SAAS;AAAA,MACT,YAAY;AAAA,QACX,UAAU;AAAA,QACV,MAAMD,EAAmB;AAAA,MAAA;AAAA,IAE3B;AAAA,IACA,MAAM;AAAA,MACL,WAAW;AAAA,MACX,SAAS;AAAA,MACT,YAAY;AAAA,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EAAA,GAAE,2NAA2N,CAAA;AAAA,QAAA,GACpO;AAAA,QACCA,gBAAAA,EAAA,IAAA,QAAA,EAAK,WAAU,WAAU,UAAK,QAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,EAEjC,CAAA;AAAA,GAEF,GAIWmB,IAAc,CAAC,EAAE,UAAAvC,GAAU,WAAA6B,GAAW,QAAAC,QAEjDV,gBAAAA,MAAC,SAAI,WAAWM,EAAG,sFAAsFG,CAAS,GAAG,OAAOC,GAC1H,UAAA9B,EACF,CAAA;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../chunks/jsx-runtime-DFswc9zO.js"),p=require("../chunks/bundle-mjs-Bta93uUH.js"),b=require("../chunks/index-CeBD7F1N.js"),j=require("react"),g=require("../chunks/clsx-C11secjj.js"),m=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../chunks/jsx-runtime-DFswc9zO.js"),p=require("../chunks/bundle-mjs-Bta93uUH.js"),b=require("../chunks/index-CeBD7F1N.js"),j=require("react"),g=require("../chunks/clsx-C11secjj.js"),m=require("../chunks/index-32mPyHbg.js");require("../chunks/button-BnNW_eev.js");const R=({className:d,color:e="primary",active:r,children:o,text:t,onClick:l})=>{const c=g.clsx({"bg-primary":e==="primary"&&r,"bg-success":e==="success"&&r,"bg-danger":e==="danger"&&r,"bg-warning":e==="warning"&&r,"bg-default":e==="default"&&r,"dark:hover:bg-default-200 dark:hover:text-default-800":!r}),x=p.twMerge(g.clsx("text-sm",{"group-hover:text-primary-500 dark:group-hover:text-default-800":e==="primary"&&!r,"group-hover:text-success-500 dark:group-hover:text-default-800":e==="success"&&!r,"group-hover:text-danger-500 dark:group-hover:text-default-800":e==="danger"&&!r,"group-hover:text-warning-500 dark:group-hover:text-default-800":e==="warning"&&!r,"group-hover:text-default-500 dark:group-hover:text-default-800":e==="default"&&!r,"text-default-foreground":r&&e==="default","text-primary-foreground":r&&e==="primary","text-success-foreground":r&&e==="success","text-danger-foreground":r&&e==="danger","text-warning-foreground":r&&e==="warning"}));return s.jsxRuntimeExports.jsx("div",{className:p.twMerge("w-[33px] h-[32px] flex items-center justify-center group ",c,d),onClick:l,children:o||s.jsxRuntimeExports.jsx("p",{className:x,children:t})})},y=({page:d,total:e,siblings:r=1})=>{if(7+r>=e)return Array.from({length:e},(n,i)=>i+1);const t=Math.max(d-r,1),l=Math.min(d+r,e),c=t>2,x=l<e-2;if(!c&&x){const n=3+2*r;return[...Array.from({length:n},(a,f)=>f+1),"...",e]}else if(c&&!x){const n=3+2*r;return[1,"...",...Array.from({length:n},(a,f)=>e-n+f+1)]}else return[1,"...",...Array.from({length:l-t+1},(i,a)=>t+a),"...",e]},k=d=>d.map(e=>({id:e,name:e})),v=({className:d,color:e="primary",total:r,limit:o=20,page:t=1,siblings:l=1,isLimitSelect:c=!0,dataLimit:x=[10,15,20,50,100,200],onChange:n,translate:i={selectLimit:"Limites",rowPerPage:"Filas por pagina",of:"de"}})=>{const a=Math.ceil(r/o),f=y({page:t,siblings:l,total:a}),w=k(x),E=u=>{u!=="..."&&n&&n({limit:o,page:Number(u)})},P=()=>{t!==1&&n&&n({limit:o,page:t-1})},N=()=>{t===a||a===0||n&&n({limit:o,page:t+1})},S=u=>{n&&n({page:t,limit:u?Number(u):20})};return s.jsxRuntimeExports.jsxs("div",{className:p.twMerge("flex justify-between gap-x-2 items-center",d),children:[c?s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2.5",children:[s.jsxRuntimeExports.jsx("div",{children:s.jsxRuntimeExports.jsxs("span",{className:"text-sm text-default-500",children:[(i==null?void 0:i.rowPerPage)||"Filas por pagina",":"]})}),s.jsxRuntimeExports.jsxs(m.Select,{value:o==null?void 0:o.toString(),onValueChange:S,children:[s.jsxRuntimeExports.jsx(m.SelectTrigger,{className:"min-w-20",children:s.jsxRuntimeExports.jsx(m.SelectValue,{placeholder:"Select a fruit"})}),s.jsxRuntimeExports.jsx(m.SelectContent,{children:s.jsxRuntimeExports.jsxs(m.SelectGroup,{children:[s.jsxRuntimeExports.jsx(m.SelectLabel,{children:(i==null?void 0:i.selectLimit)||"Limites"}),w.map(u=>{var h;return s.jsxRuntimeExports.jsx(m.SelectItem,{value:(h=u.id)==null?void 0:h.toString(),children:u.name},u.id)})]})})]}),s.jsxRuntimeExports.jsxs("div",{className:"text-sm text-default-500",children:[s.jsxRuntimeExports.jsx("span",{className:"text-default-500",children:`${t} - ${o}`})," ",(i==null?void 0:i.of)||"de"," ",s.jsxRuntimeExports.jsx("span",{className:"text-default-500",children:r})]})]}):null,s.jsxRuntimeExports.jsxs("div",{className:"flex flex-nowrap h-fit max-w-fit relative items-center overflow-visible gap-0 border border-divider rounded-lg cursor-pointer dark:bg-default-100",children:[s.jsxRuntimeExports.jsx(R,{className:g.clsx(t===1&&"cursor-no-drop","rounded-tl-lg rounded-bl-lg "),onClick:P,children:s.jsxRuntimeExports.jsx(b.IoIosArrowBack,{className:p.twMerge("fill-default-500",g.clsx(t===1&&"fill-default-300"))})}),f.map((u,h)=>s.jsxRuntimeExports.jsx(R,{text:u,active:t===u,color:e,onClick:()=>E(u),className:"border-l border-divider "},h)),s.jsxRuntimeExports.jsx(R,{className:g.clsx("border-l border-divider rounded-tr-lg rounded-br-lg ",(t===a||a===0)&&"cursor-no-drop"),onClick:N,children:s.jsxRuntimeExports.jsx(b.IoIosArrowBack,{className:p.twMerge("fill-default-500 transform rotate-180 ",g.clsx((t===a||a===0)&&"fill-default-300"))})})]})]})},I=({initialPage:d=1,initialLimit:e=20})=>{const[r,o]=j.useState(d),[t,l]=j.useState(e);return{handleSetPagination:j.useCallback(({page:x,limit:n})=>{x!==r&&o(x),n!==t&&l(n)},[t,r]),page:r,limit:t}};exports.Pagination=v;exports.usePagination=I;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|