the-omelet-ui 1.7.7 → 1.7.8
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/entries/sheet.d.ts +6 -0
- package/dist/entries/sheet.js +1 -1
- package/package.json +1 -1
package/dist/entries/sheet.d.ts
CHANGED
|
@@ -82,6 +82,12 @@ interface SheetContentProps extends VariantProps<typeof sheetContentVariants> {
|
|
|
82
82
|
* @example duration={500} // 500ms (0.5 วินาที)
|
|
83
83
|
*/
|
|
84
84
|
duration?: number;
|
|
85
|
+
/**
|
|
86
|
+
* กำหนดความสูงสูงสุดของ Sheet เมื่อ side เป็น top/bottom
|
|
87
|
+
* ค่าที่เป็น number จะถูกตีความเป็น vh (เช่น 50 => 50vh)
|
|
88
|
+
* @default "50vh"
|
|
89
|
+
*/
|
|
90
|
+
maxFullhieght?: number | string;
|
|
85
91
|
}
|
|
86
92
|
/**
|
|
87
93
|
* Sheet Content - เนื้อหาของ Sheet
|
package/dist/entries/sheet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-6GLPXMGB.js';import {createContext,useState,useEffect,useContext}from'react';import {cva}from'class-variance-authority';import {X}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var
|
|
1
|
+
import {a}from'../chunk-6GLPXMGB.js';import {createContext,useState,useEffect,useContext}from'react';import {cva}from'class-variance-authority';import {X}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var d=createContext(void 0),u=()=>{let t=useContext(d);if(!t)throw new Error("Sheet components must be used within Sheet");return t},v=cva("fixed z-50 bg-white shadow-lg transition-all duration-300 ease-in-out",{variants:{side:{top:"inset-x-0 top-0 border-b",bottom:"inset-x-0 bottom-0 border-t",left:"inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"}},defaultVariants:{side:"left"}}),P=({open:t=false,onOpenChange:e,children:o})=>{let[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let a=l=>{i(l),e?.(l);};return useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[n]),jsx(d.Provider,{value:{open:n,onOpenChange:a},children:o})},N=({children:t,className:e,disabled:o})=>{let{onOpenChange:n}=u();return jsx("div",{onClick:()=>!o&&n(true),className:a(e,o&&"opacity-50 cursor-not-allowed"),children:t})},R=({children:t})=>{let[e,o]=useState(false);return useEffect(()=>(o(true),()=>o(false)),[]),e?jsx(Fragment,{children:t}):null},w=({className:t,duration:e=200})=>{let{open:o,onOpenChange:n}=u(),[i,a$1]=useState(false);return useEffect(()=>{o?setTimeout(()=>a$1(true),10):a$1(false);},[o]),o?jsx("div",{className:a("fixed inset-0 z-40 bg-black/50 backdrop-blur-sm transition-opacity",i?"opacity-100":"opacity-0",t),style:{transitionDuration:`${e}ms`},onClick:()=>n(false)}):null},F=({children:t,side:e="left",className:o,showClose:n=true,duration:i=300,maxFullhieght:a$1="50vh"})=>{let{open:l,onOpenChange:m}=u(),[x,f]=useState(false);if(useEffect(()=>{l?setTimeout(()=>f(true),10):f(false);},[l]),!l)return null;let S=()=>{if(x)return "translate-x-0 translate-y-0";switch(e){case "left":return "-translate-x-full";case "right":return "translate-x-full";case "top":return "-translate-y-full";case "bottom":return "translate-y-full";default:return ""}};return jsxs(R,{children:[jsx(w,{duration:i}),jsxs("div",{className:a(v({side:e}),"transition-all ease-in-out",S(),(e==="top"||e==="bottom")&&"overflow-hidden",o),style:{transitionDuration:`${i}ms`,...e==="top"||e==="bottom"?{maxHeight:typeof a$1=="number"?`${a$1}vh`:a$1}:{}},children:[n&&jsxs("button",{onClick:()=>m(false),className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none",children:[jsx(X,{className:"h-4 w-4"}),jsx("span",{className:"sr-only",children:"Close"})]}),jsx("div",{className:a(e==="top"||e==="bottom"?"max-h-full":"h-full","overflow-auto"),children:t})]})]})},T=({children:t,className:e})=>jsx("div",{className:a("flex flex-col space-y-2 px-6 py-4 border-b",e),children:t}),V=({children:t,className:e})=>jsx("div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t",e),children:t}),O=({children:t,className:e})=>jsx("h2",{className:a("text-lg font-semibold text-gray-900",e),children:t}),D=({children:t,className:e})=>jsx("p",{className:a("text-sm text-gray-500",e),children:t});export{P as Sheet,F as SheetContent,D as SheetDescription,V as SheetFooter,T as SheetHeader,O as SheetTitle,N as SheetTrigger};
|