the-omelet-ui 1.7.7 → 1.7.9

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.
@@ -0,0 +1,2 @@
1
+ import {forwardRef,memo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var m=({title:e,titleId:l,...r},t)=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em",ref:t,"aria-labelledby":l,...r,children:[e?jsx("title",{id:l,children:e}):null,jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M.26.26a.89.89 0 0 1 1.257 0L8 6.743 14.483.26a.889.889 0 0 1 1.257 1.257L9.257 8l6.483 6.483a.889.889 0 1 1-1.257 1.257L8 9.257 1.517 15.74A.889.889 0 0 1 .26 14.483L6.743 8 .26 1.517A.89.89 0 0 1 .26.26",clipRule:"evenodd"})]}),n=forwardRef(m),f=memo(n),w=f;
2
+ export{w as a};
@@ -82,6 +82,27 @@ 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
+ maxFullHeight?: number | string;
91
+ /**
92
+ * กำหนดความกว้างสูงสุดของ Sheet เมื่อ side เป็น left/right
93
+ * @default undefined (ใช้ค่าจาก variants)
94
+ */
95
+ maxWidth?: string;
96
+ /**
97
+ * ปิด Sheet เมื่อคลิก overlay
98
+ * @default true
99
+ */
100
+ closeOnOverlayClick?: boolean;
101
+ /**
102
+ * ปิด Sheet เมื่อกด Escape
103
+ * @default true
104
+ */
105
+ closeOnEscape?: boolean;
85
106
  }
86
107
  /**
87
108
  * Sheet Content - เนื้อหาของ Sheet
@@ -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 f=createContext(void 0),u=()=>{let e=useContext(f);if(!e)throw new Error("Sheet components must be used within Sheet");return e},y=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:e=false,onOpenChange:t,children:o})=>{let[n,i]=useState(e);useEffect(()=>{i(e);},[e]);let s=c=>{i(c),t?.(c);};return useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[n]),jsx(f.Provider,{value:{open:n,onOpenChange:s},children:o})},v=({children:e,className:t,disabled:o})=>{let{onOpenChange:n}=u();return jsx("div",{onClick:()=>!o&&n(true),className:a(t,o&&"opacity-50 cursor-not-allowed"),children:e})},N=({children:e})=>{let[t,o]=useState(false);return useEffect(()=>(o(true),()=>o(false)),[]),t?jsx(Fragment,{children:e}):null},R=({className:e,duration:t=200})=>{let{open:o,onOpenChange:n}=u(),[i,s]=useState(false);return useEffect(()=>{o?setTimeout(()=>s(true),10):s(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",e),style:{transitionDuration:`${t}ms`},onClick:()=>n(false)}):null},w=({children:e,side:t="left",className:o,showClose:n=true,duration:i=300})=>{let{open:s,onOpenChange:c}=u(),[m,d]=useState(false);if(useEffect(()=>{s?setTimeout(()=>d(true),10):d(false);},[s]),!s)return null;let S=()=>{if(m)return "translate-x-0 translate-y-0";switch(t){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(N,{children:[jsx(R,{duration:i}),jsxs("div",{className:a(y({side:t}),"transition-all ease-in-out",S(),o),style:{transitionDuration:`${i}ms`},children:[n&&jsxs("button",{onClick:()=>c(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:"h-full overflow-auto",children:e})]})]})},F=({children:e,className:t})=>jsx("div",{className:a("flex flex-col space-y-2 px-6 py-4 border-b",t),children:e}),T=({children:e,className:t})=>jsx("div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t",t),children:e}),V=({children:e,className:t})=>jsx("h2",{className:a("text-lg font-semibold text-gray-900",t),children:e}),O=({children:e,className:t})=>jsx("p",{className:a("text-sm text-gray-500",t),children:e});export{P as Sheet,w as SheetContent,O as SheetDescription,T as SheetFooter,F as SheetHeader,V as SheetTitle,v as SheetTrigger};
1
+ import {a as a$1}from'../chunk-R66UNAK2.js';import {a}from'../chunk-6GLPXMGB.js';import {createContext,useState,useEffect,useContext}from'react';import {cva}from'class-variance-authority';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var y=createContext(void 0),d=()=>{let e=useContext(y);if(!e)throw new Error("Sheet components must be used within Sheet");return e},F=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-full sm:w-3/4 border-r sm:max-w-sm",right:"inset-y-0 right-0 h-full w-full sm:w-3/4 border-l sm:max-w-sm"}},defaultVariants:{side:"left"}}),O=({open:e=false,onOpenChange:t,children:o})=>{let[n,i]=useState(e);useEffect(()=>{i(e);},[e]);let s=p=>{i(p),t?.(p);};return useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[n]),jsx(y.Provider,{value:{open:n,onOpenChange:s},children:o})},T=({children:e,className:t,disabled:o})=>{let{onOpenChange:n}=d();return jsx("div",{onClick:()=>!o&&n(true),className:a(t,o&&"opacity-50 cursor-not-allowed"),children:e})},V=({children:e})=>{let[t,o]=useState(false);return useEffect(()=>(o(true),()=>o(false)),[]),t?jsx(Fragment,{children:e}):null},k=({className:e,duration:t=200})=>{let{open:o,onOpenChange:n}=d(),[i,s]=useState(false);return useEffect(()=>{o?setTimeout(()=>s(true),10):s(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",e),style:{transitionDuration:`${t}ms`},onClick:()=>n(false)}):null},D=({children:e,side:t="left",className:o,showClose:n=true,duration:i=300,maxFullHeight:s="50vh",maxWidth:p,closeOnOverlayClick:L=true,closeOnEscape:f=true})=>{let{open:l,onOpenChange:h}=d(),[C,m]=useState(false);if(useEffect(()=>{l?setTimeout(()=>m(true),10):m(false);},[l]),useEffect(()=>{if(!f)return;let x=P=>{P.key==="Escape"&&l&&h(false);};return l&&document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x);}},[l,h,f]),!l)return null;let v=()=>{if(C)return "translate-x-0 translate-y-0";switch(t){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 ""}},b=t==="top"||t==="bottom";return jsxs(V,{children:[jsx(k,{duration:i}),jsxs("div",{className:a(F({side:t}),"transition-all ease-in-out","flex flex-col",v(),o),style:{transitionDuration:`${i}ms`,...b?{maxHeight:typeof s=="number"?`${s}vh`:s}:{},...p&&!b?{maxWidth:p}:{}},children:[n&&jsx("button",{onClick:()=>h(false),className:"border bg-white p-1 absolute right-4 top-4 z-10 rounded-sm hover:bg-gray-200 cursor-pointer 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","aria-label":"Close",children:jsx(a$1,{fontSize:16})}),jsx("div",{className:"flex-1 overflow-auto min-h-0",children:e})]})]})},E=({children:e,className:t})=>jsx("div",{className:a("flex flex-col space-y-2 px-6 py-4 border-b",t),children:e}),H=({children:e,className:t})=>jsx("div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t mt-auto",t),children:e}),z=({children:e,className:t})=>jsx("h2",{className:a("text-lg font-semibold text-gray-900",t),children:e}),I=({children:e,className:t})=>jsx("p",{className:a("text-sm text-gray-500",t),children:e});export{O as Sheet,D as SheetContent,I as SheetDescription,H as SheetFooter,E as SheetHeader,z as SheetTitle,T as SheetTrigger};
@@ -1,2 +1 @@
1
- import {a}from'../chunk-6GLPXMGB.js';import {cva}from'class-variance-authority';import {forwardRef,memo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var m=({title:t,titleId:e,...a},l)=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em",ref:l,"aria-labelledby":e,...a,children:[t?jsx("title",{id:e,children:t}):null,jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M.26.26a.89.89 0 0 1 1.257 0L8 6.743 14.483.26a.889.889 0 0 1 1.257 1.257L9.257 8l6.483 6.483a.889.889 0 1 1-1.257 1.257L8 9.257 1.517 15.74A.889.889 0 0 1 .26 14.483L6.743 8 .26 1.517A.89.89 0 0 1 .26.26",clipRule:"evenodd"})]}),v=forwardRef(m),c=memo(v),s=c;var f=cva("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors",{variants:{type:{blue:"",gray:"",green:"",yellow:"",red:""},variant:{filled:"",outlined:"bg-white border"}},compoundVariants:[{type:"blue",variant:"filled",className:"bg-blue-500 text-white hover:bg-blue-600"},{type:"blue",variant:"outlined",className:"border-blue-500 text-blue-600 hover:bg-blue-50"},{type:"gray",variant:"filled",className:"bg-gray-500 text-white hover:bg-gray-600"},{type:"gray",variant:"outlined",className:"border-gray-400 text-gray-600 hover:bg-gray-50"},{type:"green",variant:"filled",className:"bg-green-500 text-white hover:bg-green-600"},{type:"green",variant:"outlined",className:"border-green-500 text-green-600 hover:bg-green-50"},{type:"yellow",variant:"filled",className:"bg-yellow-500 text-white hover:bg-yellow-600"},{type:"yellow",variant:"outlined",className:"border-yellow-500 text-yellow-600 hover:bg-yellow-50"},{type:"red",variant:"filled",className:"bg-red-500 text-white hover:bg-red-600"},{type:"red",variant:"outlined",className:"border-red-500 text-red-600 hover:bg-red-50"}],defaultVariants:{type:"blue",variant:"filled"}}),x=cva("inline-flex items-center justify-center rounded hover:bg-black/10 transition-colors",{variants:{type:{blue:"",gray:"",green:"",yellow:"",red:""},variant:{filled:"text-white/80 hover:text-white",outlined:""}},compoundVariants:[{type:"blue",variant:"outlined",className:"text-blue-500 hover:text-blue-700"},{type:"gray",variant:"outlined",className:"text-gray-500 hover:text-gray-700"},{type:"green",variant:"outlined",className:"text-green-500 hover:text-green-700"},{type:"yellow",variant:"outlined",className:"text-yellow-500 hover:text-yellow-700"},{type:"red",variant:"outlined",className:"text-red-500 hover:text-red-700"}],defaultVariants:{type:"blue",variant:"filled"}}),h=({children:t,type:e="blue",variant:a$1="filled",closable:l=false,onClose:g,className:p,icon:n})=>jsxs("span",{className:a(f({type:e,variant:a$1}),p),children:[n&&jsx("span",{className:"inline-flex",children:n}),jsx("span",{children:t}),l&&jsx("button",{type:"button",onClick:g,className:a(x({type:e,variant:a$1}),"p-0.5"),"aria-label":"Remove",children:jsx(s,{fontSize:10})})]}),w=h;
2
- export{h as Tag,w as default};
1
+ import {a as a$1}from'../chunk-R66UNAK2.js';import {a}from'../chunk-6GLPXMGB.js';import {cva}from'class-variance-authority';import {jsxs,jsx}from'react/jsx-runtime';var y=cva("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors",{variants:{type:{blue:"",gray:"",green:"",yellow:"",red:""},variant:{filled:"",outlined:"bg-white border"}},compoundVariants:[{type:"blue",variant:"filled",className:"bg-blue-500 text-white hover:bg-blue-600"},{type:"blue",variant:"outlined",className:"border-blue-500 text-blue-600 hover:bg-blue-50"},{type:"gray",variant:"filled",className:"bg-gray-500 text-white hover:bg-gray-600"},{type:"gray",variant:"outlined",className:"border-gray-400 text-gray-600 hover:bg-gray-50"},{type:"green",variant:"filled",className:"bg-green-500 text-white hover:bg-green-600"},{type:"green",variant:"outlined",className:"border-green-500 text-green-600 hover:bg-green-50"},{type:"yellow",variant:"filled",className:"bg-yellow-500 text-white hover:bg-yellow-600"},{type:"yellow",variant:"outlined",className:"border-yellow-500 text-yellow-600 hover:bg-yellow-50"},{type:"red",variant:"filled",className:"bg-red-500 text-white hover:bg-red-600"},{type:"red",variant:"outlined",className:"border-red-500 text-red-600 hover:bg-red-50"}],defaultVariants:{type:"blue",variant:"filled"}}),p=cva("inline-flex items-center justify-center rounded hover:bg-black/10 transition-colors",{variants:{type:{blue:"",gray:"",green:"",yellow:"",red:""},variant:{filled:"text-white/80 hover:text-white",outlined:""}},compoundVariants:[{type:"blue",variant:"outlined",className:"text-blue-500 hover:text-blue-700"},{type:"gray",variant:"outlined",className:"text-gray-500 hover:text-gray-700"},{type:"green",variant:"outlined",className:"text-green-500 hover:text-green-700"},{type:"yellow",variant:"outlined",className:"text-yellow-500 hover:text-yellow-700"},{type:"red",variant:"outlined",className:"text-red-500 hover:text-red-700"}],defaultVariants:{type:"blue",variant:"filled"}}),b=({children:i,type:a$2="blue",variant:r="filled",closable:s=false,onClose:d,className:g,icon:l})=>jsxs("span",{className:a(y({type:a$2,variant:r}),g),children:[l&&jsx("span",{className:"inline-flex",children:l}),jsx("span",{children:i}),s&&jsx("button",{type:"button",onClick:d,className:a(p({type:a$2,variant:r}),"p-0.5"),"aria-label":"Remove",children:jsx(a$1,{fontSize:10})})]}),u=b;export{b as Tag,u as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-omelet-ui",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",