the-omelet-ui 1.8.66 → 1.8.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-THE2HQGT.js';import {a}from'./chunk-6GLPXMGB.js';import {memo,useId}from'react';import {jsx,jsxs}from'react/jsx-runtime';var b=memo(({label:n,name:p,value:c,checked:e=false,disabled:i=false,onChange:f,className:g="",size:v="md",error:a$2=false,radioClassName:d,required:x,description:m,labelClassName:N,descriptionClassName:h})=>{let l=useId(),r={sm:{radio:"w-4 h-4",dot:"w-1.5 h-1.5",label:"text-sm",description:"text-xs"},md:{radio:"w-5 h-5",dot:"w-2.5 h-2.5",label:"text-base",description:"text-sm"},lg:{radio:"w-6 h-6",dot:"w-3 h-3",label:"text-lg",description:"text-base"}}[v];return jsx("div",{className:`inline-flex flex-col ${g}`,children:jsxs("label",{htmlFor:l,className:a("inline-flex items-center gap-2 cursor-pointer",i&&"opacity-50 cursor-not-allowed"),children:[jsxs("div",{className:"relative flex items-start justify-center shrink-0 mt-0.5",children:[jsx("input",{type:"radio",id:l,name:p,value:c,checked:e,disabled:i,onChange:f,className:"sr-only peer"}),jsx("div",{className:a(r.radio,"rounded-full border-2 transition-all duration-200 flex items-center justify-center",a$2&&"border-red-500",!a$2&&e&&!d&&"border-blue-500 bg-blue-500",!a$2&&!e&&"border-gray-300 bg-white",!a$2&&!i&&!e&&"peer-hover:border-blue-400",i&&"bg-gray-100","peer-focus-visible:ring-2 peer-focus-visible:ring-blue-500 peer-focus-visible:ring-offset-2",e&&d),children:e&&jsx("div",{className:a(r.dot,"rounded-full bg-white transition-all duration-200")})})]}),jsxs("div",{className:"flex flex-col",children:[n&&jsx(a$1,{label:n,required:x,id:l,labelClassName:a(r.label,N)}),m&&jsx("p",{className:a(r.description,h,"text-gray-500"),children:m})]})]})})});b.displayName="RadioButton";var I=b;export{I as a};
1
+ import {a as a$1}from'./chunk-THE2HQGT.js';import {a}from'./chunk-6GLPXMGB.js';import {memo,useId}from'react';import {jsx,jsxs}from'react/jsx-runtime';var b=memo(({label:n,name:p,value:c,checked:e=false,disabled:i=false,onChange:f,className:g="",size:v="md",error:a$2=false,radioClassName:d,required:x,description:m,labelClassName:N,descriptionClassName:h})=>{let l=useId(),r={sm:{radio:"w-4 h-4",dot:"w-1.5 h-1.5",label:"text-sm",description:"text-xs"},md:{radio:"w-5 h-5",dot:"w-2.5 h-2.5",label:"text-base",description:"text-sm"},lg:{radio:"w-6 h-6",dot:"w-3 h-3",label:"text-lg",description:"text-base"}}[v];return jsx("div",{className:`inline-flex flex-col ${g}`,children:jsxs("label",{htmlFor:l,className:a("inline-flex items-center gap-2 cursor-pointer",i&&"opacity-50 cursor-not-allowed"),children:[jsxs("div",{className:"relative flex items-start justify-center shrink-0 mt-0.5",children:[jsx("input",{type:"radio",id:l,name:p,value:c,checked:e,disabled:i,onChange:f,className:"sr-only peer"}),jsx("div",{className:a(r.radio,"rounded-full border-2 transition-all duration-200 flex items-center justify-center",a$2&&"border-red-500",!a$2&&e&&!d&&"border-blue-500 bg-blue-500",!a$2&&!e&&"border-gray-300 bg-white",!a$2&&!i&&!e&&"peer-hover:border-blue-400",i&&"bg-gray-100","peer-focus-visible:ring-2 peer-focus-visible:ring-blue-500 peer-focus-visible:ring-offset-2",e&&d),children:e&&jsx("div",{className:a(r.dot,"rounded-full bg-white transition-all duration-200")})})]}),jsxs("div",{className:"flex flex-col",children:[n&&jsx(a$1,{label:n,required:x,id:l,labelClassName:a(r.label,N)}),m&&jsx("p",{className:a(r.description,"text-gray-500",h),children:m})]})]})})});b.displayName="RadioButton";var I=b;export{I as a};
@@ -31,9 +31,9 @@ interface CarouselProps {
31
31
  */
32
32
  gap?: number;
33
33
  /**
34
- * ความสูงของแบนเนอร์ (px)
34
+ * ความสูงของแบนเนอร์ (px) หรือ 'auto' เพื่อให้สูงตาม content
35
35
  */
36
- itemHeight?: number;
36
+ itemHeight?: number | "auto";
37
37
  /**
38
38
  * สีเมื่อ active (ตัวอักษรในแบนเนอร์ + จุด pagination) รองรับ hex เช่น #E00000
39
39
  */
@@ -1 +1 @@
1
- import {a}from'../chunk-6GLPXMGB.js';import {useRef,useState,useEffect,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';var L="#F9D9D9",_="#FBEBEB",B="#E00000",F="#D9D9D9";function w({items:r,autoplayInterval:h=0,showPagination:R=true,initialSlide:d=0,fullWidth:v=false,itemWidth:u,gap:l=12,itemHeight:A=120,activeColor:E=B,activeBgColor:D=L,className:M}){let y=useRef(null),s=useRef(null),[m,i]=useState(Math.min(Math.max(0,d),r.length-1)),[n,C]=useState(u??280),b=useRef(null);useEffect(()=>{if(!v&&u!=null){C(u);return}let e=y.current;if(!e)return;let t=()=>{let c=e.offsetWidth;C(v?c:Math.max(200,c*.85));},o=new ResizeObserver(t);return o.observe(e),t(),()=>o.disconnect()},[u,v]),useEffect(()=>{let e=s.current;if(!e||r.length===0)return;let t=Math.min(Math.max(0,d),r.length-1),o=t*(n+l);e.scrollTo({left:o,behavior:"auto"}),i(t);},[d,r.length,n,l]);let g=useCallback(()=>{let e=s.current;if(!e||r.length===0)return;let t=e.scrollLeft,o=n+l,c=Math.round(t/o),k=Math.min(Math.max(0,c),r.length-1);i(k);},[r.length,n,l]);useEffect(()=>{let e=s.current;if(e)return e.addEventListener("scroll",g),()=>e.removeEventListener("scroll",g)},[g]);let N=useCallback(e=>{let t=s.current;if(!t)return;let o=e*(n+l);t.scrollTo({left:o,behavior:"smooth"}),i(e);},[n,l]);return useEffect(()=>{if(!(h<=0||r.length<=1))return b.current=setInterval(()=>{i(e=>{let t=e>=r.length-1?0:e+1,o=s.current;if(o){let c=t*(n+l);o.scrollTo({left:c,behavior:"smooth"});}return t});},h*1e3),()=>{b.current&&clearInterval(b.current);}},[h,r.length,n,l]),r.length===0?null:jsxs("div",{ref:y,className:a("w-full",M),children:[jsx("div",{ref:s,className:"overflow-x-auto overflow-y-hidden scroll-smooth scrollbar-hide flex",style:{scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},children:r.map((e,t)=>jsx("div",{className:"shrink-0 flex items-center justify-center text-center rounded-xl font-bold transition-colors duration-200 relative overflow-hidden",style:{width:n,minWidth:n,height:A,marginRight:t<r.length-1?l:0,backgroundColor:t===m?D:_,color:t===m?E:void 0,scrollSnapAlign:"start"},children:typeof e=="string"?jsx("span",{className:"px-4 wrap-break-word relative z-1",children:e}):e},t))}),R&&r.length>0&&jsx("div",{className:"flex justify-center items-center gap-1.5 mt-3",children:r.map((e,t)=>jsx("button",{type:"button","aria-label":`\u0E44\u0E1B\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E19\u0E40\u0E19\u0E2D\u0E23\u0E4C ${t+1}`,className:"w-2 h-2 rounded-full border-0 p-0 cursor-pointer transition-colors duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",style:{backgroundColor:t===m?E:F},onClick:()=>N(t)},t))})]})}export{w as default};
1
+ import {a}from'../chunk-6GLPXMGB.js';import {useRef,useState,useEffect,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';var L="#F9D9D9",_="#FBEBEB",B="#E00000",F="#D9D9D9";function R({items:r,autoplayInterval:h=0,showPagination:A=true,initialSlide:d=0,fullWidth:v=false,itemWidth:u,gap:l=12,itemHeight:E=120,activeColor:y=B,activeBgColor:D=L,className:M}){let C=useRef(null),s=useRef(null),[m,f]=useState(Math.min(Math.max(0,d),r.length-1)),[n,T]=useState(u??280),b=useRef(null);useEffect(()=>{if(!v&&u!=null){T(u);return}let e=C.current;if(!e)return;let t=()=>{let c=e.offsetWidth;T(v?c:Math.max(200,c*.85));},o=new ResizeObserver(t);return o.observe(e),t(),()=>o.disconnect()},[u,v]),useEffect(()=>{let e=s.current;if(!e||r.length===0)return;let t=Math.min(Math.max(0,d),r.length-1),o=t*(n+l);e.scrollTo({left:o,behavior:"auto"}),f(t);},[d,r.length,n,l]);let g=useCallback(()=>{let e=s.current;if(!e||r.length===0)return;let t=e.scrollLeft,o=n+l,c=Math.round(t/o),k=Math.min(Math.max(0,c),r.length-1);f(k);},[r.length,n,l]);useEffect(()=>{let e=s.current;if(e)return e.addEventListener("scroll",g),()=>e.removeEventListener("scroll",g)},[g]);let N=useCallback(e=>{let t=s.current;if(!t)return;let o=e*(n+l);t.scrollTo({left:o,behavior:"smooth"}),f(e);},[n,l]);return useEffect(()=>{if(!(h<=0||r.length<=1))return b.current=setInterval(()=>{f(e=>{let t=e>=r.length-1?0:e+1,o=s.current;if(o){let c=t*(n+l);o.scrollTo({left:c,behavior:"smooth"});}return t});},h*1e3),()=>{b.current&&clearInterval(b.current);}},[h,r.length,n,l]),r.length===0?null:jsxs("div",{ref:C,className:a("w-full",M),children:[jsx("div",{ref:s,className:"flex overflow-x-auto overflow-y-hidden scroll-smooth scrollbar-hide",style:{scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},children:r.map((e,t)=>jsx("div",{className:"relative flex items-center justify-center overflow-hidden font-bold text-center transition-colors duration-200 shrink-0 rounded-xl",style:{width:n,minWidth:n,height:E==="auto"?"auto":E,marginRight:t<r.length-1?l:0,backgroundColor:t===m?D:_,color:t===m?y:void 0,scrollSnapAlign:"start"},children:typeof e=="string"?jsx("span",{className:"relative px-4 wrap-break-word z-1",children:e}):e},t))}),A&&r.length>0&&jsx("div",{className:"flex justify-center items-center gap-1.5 mt-3",children:r.map((e,t)=>jsx("button",{type:"button","aria-label":`\u0E44\u0E1B\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E19\u0E40\u0E19\u0E2D\u0E23\u0E4C ${t+1}`,className:"w-2 h-2 p-0 transition-colors duration-200 border-0 rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",style:{backgroundColor:t===m?y:F},onClick:()=>N(t)},t))})]})}export{R as default};
@@ -1 +1 @@
1
- export{a as default}from'../chunk-QQFUFZNJ.js';import'../chunk-THE2HQGT.js';import'../chunk-6GLPXMGB.js';
1
+ export{a as default}from'../chunk-IZYJOUVH.js';import'../chunk-THE2HQGT.js';import'../chunk-6GLPXMGB.js';
@@ -1 +1 @@
1
- import {a as a$1}from'../chunk-QQFUFZNJ.js';import {a as a$2}from'../chunk-QRYSV225.js';import {a}from'../chunk-THE2HQGT.js';import'../chunk-6GLPXMGB.js';import {memo,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';function p(...r){return r.filter(Boolean).join(" ")}var u=memo(({name:r,options:m,value:f,onChange:o,size:c="md",direction:g="vertical",error:i,label:l,required:t=false,className:v="",disabled:b=false,radioClassName:R})=>{let x=useCallback(e=>{o&&o(e.target.value);},[o]);return jsxs("div",{className:p("flex flex-col gap-2",v),children:[l&&jsx(a,{label:l,required:t}),jsx("div",{className:p("flex gap-4",g==="vertical"?"flex-col":"flex-row flex-wrap"),role:"radiogroup","aria-label":l,"aria-required":t,children:m.map(e=>jsx(a$1,{name:r,label:e.label,value:e.value,description:e.description,checked:f===e.value,disabled:b||e.disabled,onChange:x,size:c,radioClassName:R,error:!!i},e.value))}),i&&jsx(a$2,{message:i})]})});u.displayName="RadioGroup";var C=u;export{C as default};
1
+ import {a as a$1}from'../chunk-IZYJOUVH.js';import {a as a$2}from'../chunk-QRYSV225.js';import {a}from'../chunk-THE2HQGT.js';import'../chunk-6GLPXMGB.js';import {memo,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';function p(...r){return r.filter(Boolean).join(" ")}var u=memo(({name:r,options:m,value:f,onChange:o,size:c="md",direction:g="vertical",error:i,label:l,required:t=false,className:v="",disabled:b=false,radioClassName:R})=>{let x=useCallback(e=>{o&&o(e.target.value);},[o]);return jsxs("div",{className:p("flex flex-col gap-2",v),children:[l&&jsx(a,{label:l,required:t}),jsx("div",{className:p("flex gap-4",g==="vertical"?"flex-col":"flex-row flex-wrap"),role:"radiogroup","aria-label":l,"aria-required":t,children:m.map(e=>jsx(a$1,{name:r,label:e.label,value:e.value,description:e.description,checked:f===e.value,disabled:b||e.disabled,onChange:x,size:c,radioClassName:R,error:!!i},e.value))}),i&&jsx(a$2,{message:i})]})});u.displayName="RadioGroup";var C=u;export{C as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-omelet-ui",
3
- "version": "1.8.66",
3
+ "version": "1.8.68",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",