the-omelet-ui 1.8.63 → 1.8.64

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$2}from'../chunk-H7BTHYKO.js';import {a as a$1}from'../chunk-THE2HQGT.js';import {a}from'../chunk-6GLPXMGB.js';import*as s from'react';import*as l from'@radix-ui/react-popover';import {CalendarDays,ChevronUp,ChevronDown,ChevronLeft,ChevronRight}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var ke=["\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21","\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C","\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21","\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19","\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21","\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19","\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21","\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21","\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19","\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21","\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19","\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"],W=["\u0E2D\u0E32","\u0E08","\u0E2D","\u0E1E","\u0E1E\u0E24","\u0E28","\u0E2A"],xe=["January","February","March","April","May","June","July","August","September","October","November","December"],$=["Su","Mo","Tu","We","Th","Fr","Sa"],z=o=>new Date(o.getFullYear(),o.getMonth(),1),q=(o,e)=>new Date(o.getFullYear(),o.getMonth()+e,1),U=(o,e)=>{let r=new Date(o);return r.setDate(r.getDate()+e),r},Z=(o,e)=>!!o&&!!e&&o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate(),Pe=(o,e,r)=>e&&o<e?e:r&&o>r?r:o,C=18,we=s.memo(function({d:e,inMonth:r,disabled:i,selected:g,isToday:u,onPick:n,dayClassName:d,outsideDayClassName:m,selectedDayClassName:R,todayClassName:k}){let S=s.useCallback(()=>{i||n(e);},[i,n,e]);return jsx("button",{type:"button",onClick:S,disabled:i,className:a("h-9 w-9 place-self-center text-sm transition-colors rounded-full","outline-none focus-visible:ring-2 ring-black/20",r?"text-black":m??"text-black/30",i&&"opacity-30 pointer-events-none ",u&&!g&&(k??"bg-[#EDF6FF] text-[#004499] font-bold"),d,g?a("bg-blue-600 text-white hover:bg-blue-600",R):"hover:bg-black/5"),children:e.getDate()})},(o,e)=>o.inMonth===e.inMonth&&o.disabled===e.disabled&&o.selected===e.selected&&o.isToday===e.isToday&&o.d.getTime()===e.d.getTime()&&o.dayClassName===e.dayClassName&&o.outsideDayClassName===e.outsideDayClassName&&o.selectedDayClassName===e.selectedDayClassName&&o.todayClassName===e.todayClassName),Me=s.memo(function({months:e,activeMonth:r,onSelect:i}){let g=s.useCallback(u=>i(u),[i]);return jsx("div",{className:"grid grid-cols-3 gap-1",style:{gridTemplateColumns:"repeat(3, minmax(0,1fr))"},children:e.map((u,n)=>jsx("button",{type:"button",onClick:()=>g(n),className:a("rounded-md px-2 py-2 text-sm hover:bg-black/5",n===r&&"bg-black/10"),children:u},u))})}),Re=s.memo(function({years:e,activeYear:r,labelFromYear:i,onSelect:g}){let u=s.useCallback(n=>g(n),[g]);return jsx("div",{className:"p-1 overflow-y-auto bg-white border rounded-md shadow-lg max-h-72 w-28 border-black/10",children:e.map(n=>jsx("button",{type:"button",onClick:()=>u(n),className:a("block w-full rounded-md px-2 py-2 text-left text-sm hover:bg-black/5",n===r&&"bg-black/10"),children:i(n)},n))})}),Se=s.forwardRef(function({label:e,required:r,value:i,defaultValue:g=null,onChange:u,minDate:n,maxDate:d,locale:m="th",useBuddhistEra:R,format:k,className:S,inputClassName:j,contentClassName:Q,dayClassName:X,todayClassName:ee,selectedDayClassName:te,outsideDayClassName:ae="text-black/30",placeholderText:oe="dd/mm/yyyy",calendarIcon:se,disabled:Y=false,error:T,closeOnSelect:I=true,yearRange:F,size:ne="md",iconClassName:D},le){let [re,L]=s.useState(false),[B,O]=s.useState(false),[_,E]=s.useState(false),[ce,ie]=s.useState(g),A=i!==void 0,h=(A?i:ce)??null,M=R??m==="th",H=m==="th"?ke:xe,ue=h??new Date,[N,x]=s.useState(z(ue));s.useEffect(()=>{h&&x(z(h));},[h?.getFullYear(),h?.getMonth()]);let P=N.getFullYear(),w=N.getMonth(),de=s.useMemo(()=>k||(m==="th"?t=>{let b=M?t.getFullYear()+543:t.getFullYear(),f=String(t.getDate()).padStart(2,"0"),v=String(t.getMonth()+1).padStart(2,"0");return `${f}/${v}/${b}`}:t=>t.toLocaleDateString("en-GB")),[k,m,M]),me=s.useMemo(()=>{let t=z(N),b=t.getDay(),f=U(t,-b);return Array.from({length:42},(v,y)=>U(f,y))},[N]),be=s.useMemo(()=>{let t=new Date().getFullYear(),b=F?.[0]??n?.getFullYear()??t-60,f=F?.[1]??d?.getFullYear()??t+40,v=[];for(let y=b;y<=f;y++)v.push(y);return v},[F,n,d]),pe=M?P+543:P,ge=s.useCallback(t=>{let b=Pe(t,n,d);u?.(b),A||ie(b),I&&L(false);},[A,n,d,u,I]),he=s.useCallback(t=>{L(t),t||(O(false),E(false));},[]),fe=s.useCallback(t=>{x(new Date(P,t,1)),O(false);},[P]),ve=s.useCallback(t=>{x(new Date(t,w,1)),E(false);},[w]);return jsxs("fieldset",{ref:le,className:a("w-full",S),children:[e&&jsx(a$1,{required:r,label:e}),jsxs(l.Root,{open:re,onOpenChange:he,children:[jsxs("div",{className:a("relative",e?"mt-2":""),children:[jsx(l.Trigger,{asChild:true,children:jsx("button",{type:"button",disabled:Y,className:a("flex w-full items-center rounded-md border bg-white px-3 py-2 text-left","outline-none focus-visible:ring-2",T?"border-red-500 ring-red-200":"border-black/15 ring-black/20",Y&&"bg-[#f4f4f4] pointer-events-none text-[#BDC2BE] border-none",a$2[ne??"md"],"pr-10",j),children:jsx("span",{className:a("truncate text-black",!h&&"text-black/40",Y&&"text-[#BDC2BE]"),children:h?de(h):oe})})}),jsx("span",{className:"absolute -translate-y-1/2 pointer-events-none right-2 top-1/2 text-black/50",children:se??jsx(CalendarDays,{})})]}),T&&jsx("small",{className:"text-xs text-red-500",children:T}),jsx(l.Portal,{children:jsxs(l.Content,{sideOffset:8,className:a("w-[300px] sm:w-[320px] rounded-md border border-black/10 bg-white p-3 shadow-xl",Q),children:[jsxs("div",{className:"flex items-center justify-between px-1 py-1",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs(l.Root,{modal:false,open:B,onOpenChange:O,children:[jsx(l.Trigger,{asChild:true,children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-2 py-1 text-base font-semibold text-black rounded-md hover:bg-black/5","aria-label":"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E14\u0E37\u0E2D\u0E19",children:[H[w],B?jsx(ChevronUp,{size:C,className:D??"text-blue-500"}):jsx(ChevronDown,{size:C,className:D??"text-blue-500"})]})}),jsx(l.Portal,{children:jsxs(l.Content,{sideOffset:6,align:"start",className:"p-2 bg-white border rounded-md shadow-lg border-black/10",children:[jsx(Me,{months:H,activeMonth:w,onSelect:fe}),jsx(l.Arrow,{className:"fill-white stroke-black/10"})]})})]}),jsxs(l.Root,{modal:false,open:_,onOpenChange:E,children:[jsx(l.Trigger,{asChild:true,children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-2 py-1 text-base font-semibold text-black rounded-md hover:bg-black/5","aria-label":"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E1B\u0E35",children:[pe,_?jsx(ChevronUp,{size:C,className:D??"text-blue-500"}):jsx(ChevronDown,{size:C,className:D??"text-blue-500"})]})}),jsx(l.Portal,{children:jsxs(l.Content,{sideOffset:6,align:"start",children:[jsx(Re,{years:be,activeYear:P,labelFromYear:t=>M?t+543:t,onSelect:ve}),jsx(l.Arrow,{className:"fill-white stroke-black/10"})]})})]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",className:"p-2 rounded-md text-black/70 hover:bg-black/5",onClick:()=>x(q(N,-1)),"aria-label":m==="th"?"\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32":"Previous month",children:jsx(ChevronLeft,{size:C,className:D??"text-blue-500"})}),jsx("button",{type:"button",className:"p-2 rounded-md text-black/70 hover:bg-black/5",onClick:()=>x(q(N,1)),"aria-label":m==="th"?"\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E16\u0E31\u0E14\u0E44\u0E1B":"Next month",children:jsx(ChevronRight,{size:C,className:D??"text-blue-500"})})]})]}),jsx("div",{className:"grid grid-cols-7 px-1 mt-1 text-xs text-center gap-y-1 text-black/50",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:(m==="th"?W:$).map(t=>jsx("div",{className:"leading-7 h-7 whitespace-nowrap",children:t},t))}),jsx("div",{className:"grid grid-cols-7 gap-1 px-1 pt-1 pb-1",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:me.map((t,b)=>{let f=t.getMonth()===w,v=n&&t<new Date(n.getFullYear(),n.getMonth(),n.getDate())||d&&t>new Date(d.getFullYear(),d.getMonth(),d.getDate()),y=Z(t,h),ye=Z(t,new Date);return jsx(we,{d:t,inMonth:f,disabled:!!v,selected:y,isToday:ye,onPick:ge,dayClassName:X,outsideDayClassName:ae,selectedDayClassName:te,todayClassName:ee},b)})}),jsx(l.Arrow,{className:"fill-white stroke-black/10"})]})})]})]})}),Ye=s.memo(Se);export{Ye as default};
1
+ import {a as a$2}from'../chunk-H7BTHYKO.js';import {a as a$1}from'../chunk-THE2HQGT.js';import {a}from'../chunk-6GLPXMGB.js';import*as s from'react';import*as l from'@radix-ui/react-popover';import {CalendarDays,ChevronUp,ChevronDown,ChevronLeft,ChevronRight}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var ke=["\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21","\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C","\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21","\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19","\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21","\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19","\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21","\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21","\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19","\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21","\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19","\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"],W=["\u0E2D\u0E32","\u0E08","\u0E2D","\u0E1E","\u0E1E\u0E24","\u0E28","\u0E2A"],xe=["January","February","March","April","May","June","July","August","September","October","November","December"],$=["Su","Mo","Tu","We","Th","Fr","Sa"],z=o=>new Date(o.getFullYear(),o.getMonth(),1),q=(o,e)=>new Date(o.getFullYear(),o.getMonth()+e,1),U=(o,e)=>{let r=new Date(o);return r.setDate(r.getDate()+e),r},Z=(o,e)=>!!o&&!!e&&o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate(),Pe=(o,e,r)=>e&&o<e?e:r&&o>r?r:o,C=18,we=s.memo(function({d:e,inMonth:r,disabled:i,selected:g,isToday:u,onPick:n,dayClassName:d,outsideDayClassName:m,selectedDayClassName:R,todayClassName:k}){let S=s.useCallback(()=>{i||n(e);},[i,n,e]);return jsx("button",{type:"button",onClick:S,disabled:i,className:a("h-9 w-9 place-self-center text-sm transition-colors rounded-full","outline-none focus-visible:ring-2 ring-black/20",r?"text-black":m??"text-black/30",i&&"opacity-30 pointer-events-none ",u&&!g&&(k??"bg-[#EDF6FF] text-[#004499] font-bold"),d,g?a("bg-blue-600 text-white hover:bg-blue-600",R):"hover:bg-black/5"),children:e.getDate()})},(o,e)=>o.inMonth===e.inMonth&&o.disabled===e.disabled&&o.selected===e.selected&&o.isToday===e.isToday&&o.d.getTime()===e.d.getTime()&&o.dayClassName===e.dayClassName&&o.outsideDayClassName===e.outsideDayClassName&&o.selectedDayClassName===e.selectedDayClassName&&o.todayClassName===e.todayClassName),Me=s.memo(function({months:e,activeMonth:r,onSelect:i}){let g=s.useCallback(u=>i(u),[i]);return jsx("div",{className:"grid grid-cols-3 gap-1",style:{gridTemplateColumns:"repeat(3, minmax(0,1fr))"},children:e.map((u,n)=>jsx("button",{type:"button",onClick:()=>g(n),className:a("rounded-md px-2 py-2 text-sm hover:bg-black/5",n===r&&"bg-black/10"),children:u},u))})}),Re=s.memo(function({years:e,activeYear:r,labelFromYear:i,onSelect:g}){let u=s.useCallback(n=>g(n),[g]);return jsx("div",{className:"p-1 overflow-y-auto bg-white border rounded-md shadow-lg max-h-72 w-28 border-black/10",children:e.map(n=>jsx("button",{type:"button",onClick:()=>u(n),className:a("block w-full rounded-md px-2 py-2 text-left text-sm hover:bg-black/5",n===r&&"bg-black/10"),children:i(n)},n))})}),Se=s.forwardRef(function({label:e,required:r,value:i,defaultValue:g=null,onChange:u,minDate:n,maxDate:d,locale:m="th",useBuddhistEra:R,format:k,className:S,inputClassName:j,contentClassName:Q,dayClassName:X,todayClassName:ee,selectedDayClassName:te,outsideDayClassName:ae="text-black/30",placeholderText:oe="dd/mm/yyyy",calendarIcon:se,disabled:Y=false,error:T,closeOnSelect:I=true,yearRange:F,size:ne="md",iconClassName:D},le){let [re,L]=s.useState(false),[B,O]=s.useState(false),[_,E]=s.useState(false),[ce,ie]=s.useState(g),A=i!==void 0,h=(A?i:ce)??null,M=R??m==="th",H=m==="th"?ke:xe,ue=h??new Date,[N,x]=s.useState(z(ue));s.useEffect(()=>{h&&x(z(h));},[h?.getFullYear(),h?.getMonth()]);let P=N.getFullYear(),w=N.getMonth(),de=s.useMemo(()=>k||(m==="th"?t=>{let b=M?t.getFullYear()+543:t.getFullYear(),f=String(t.getDate()).padStart(2,"0"),v=String(t.getMonth()+1).padStart(2,"0");return `${f}/${v}/${b}`}:t=>t.toLocaleDateString("en-GB")),[k,m,M]),me=s.useMemo(()=>{let t=z(N),b=t.getDay(),f=U(t,-b);return Array.from({length:42},(v,y)=>U(f,y))},[N]),be=s.useMemo(()=>{let t=new Date().getFullYear(),b=F?.[0]??n?.getFullYear()??t-60,f=F?.[1]??d?.getFullYear()??t+40,v=[];for(let y=f;y>=b;y--)v.push(y);return v},[F,n,d]),pe=M?P+543:P,ge=s.useCallback(t=>{let b=Pe(t,n,d);u?.(b),A||ie(b),I&&L(false);},[A,n,d,u,I]),he=s.useCallback(t=>{L(t),t||(O(false),E(false));},[]),fe=s.useCallback(t=>{x(new Date(P,t,1)),O(false);},[P]),ve=s.useCallback(t=>{x(new Date(t,w,1)),E(false);},[w]);return jsxs("fieldset",{ref:le,className:a("w-full",S),children:[e&&jsx(a$1,{required:r,label:e}),jsxs(l.Root,{open:re,onOpenChange:he,children:[jsxs("div",{className:a("relative",e?"mt-2":""),children:[jsx(l.Trigger,{asChild:true,children:jsx("button",{type:"button",disabled:Y,className:a("flex w-full items-center rounded-md border bg-white px-3 py-2 text-left","outline-none focus-visible:ring-2",T?"border-red-500 ring-red-200":"border-black/15 ring-black/20",Y&&"bg-[#f4f4f4] pointer-events-none text-[#BDC2BE] border-none",a$2[ne??"md"],"pr-10",j),children:jsx("span",{className:a("truncate text-black",!h&&"text-black/40",Y&&"text-[#BDC2BE]"),children:h?de(h):oe})})}),jsx("span",{className:"absolute -translate-y-1/2 pointer-events-none right-2 top-1/2 text-black/50",children:se??jsx(CalendarDays,{})})]}),T&&jsx("small",{className:"text-xs text-red-500",children:T}),jsx(l.Portal,{children:jsxs(l.Content,{sideOffset:8,className:a("w-[300px] sm:w-[320px] rounded-md border border-black/10 bg-white p-3 shadow-xl",Q),children:[jsxs("div",{className:"flex items-center justify-between px-1 py-1",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs(l.Root,{modal:false,open:B,onOpenChange:O,children:[jsx(l.Trigger,{asChild:true,children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-2 py-1 text-base font-semibold text-black rounded-md hover:bg-black/5","aria-label":"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E14\u0E37\u0E2D\u0E19",children:[H[w],B?jsx(ChevronUp,{size:C,className:D??"text-blue-500"}):jsx(ChevronDown,{size:C,className:D??"text-blue-500"})]})}),jsx(l.Portal,{children:jsxs(l.Content,{sideOffset:6,align:"start",className:"p-2 bg-white border rounded-md shadow-lg border-black/10",children:[jsx(Me,{months:H,activeMonth:w,onSelect:fe}),jsx(l.Arrow,{className:"fill-white stroke-black/10"})]})})]}),jsxs(l.Root,{modal:false,open:_,onOpenChange:E,children:[jsx(l.Trigger,{asChild:true,children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-2 py-1 text-base font-semibold text-black rounded-md hover:bg-black/5","aria-label":"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E1B\u0E35",children:[pe,_?jsx(ChevronUp,{size:C,className:D??"text-blue-500"}):jsx(ChevronDown,{size:C,className:D??"text-blue-500"})]})}),jsx(l.Portal,{children:jsxs(l.Content,{sideOffset:6,align:"start",children:[jsx(Re,{years:be,activeYear:P,labelFromYear:t=>M?t+543:t,onSelect:ve}),jsx(l.Arrow,{className:"fill-white stroke-black/10"})]})})]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",className:"p-2 rounded-md text-black/70 hover:bg-black/5",onClick:()=>x(q(N,-1)),"aria-label":m==="th"?"\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32":"Previous month",children:jsx(ChevronLeft,{size:C,className:D??"text-blue-500"})}),jsx("button",{type:"button",className:"p-2 rounded-md text-black/70 hover:bg-black/5",onClick:()=>x(q(N,1)),"aria-label":m==="th"?"\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E16\u0E31\u0E14\u0E44\u0E1B":"Next month",children:jsx(ChevronRight,{size:C,className:D??"text-blue-500"})})]})]}),jsx("div",{className:"grid grid-cols-7 px-1 mt-1 text-xs text-center gap-y-1 text-black/50",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:(m==="th"?W:$).map(t=>jsx("div",{className:"leading-7 h-7 whitespace-nowrap",children:t},t))}),jsx("div",{className:"grid grid-cols-7 gap-1 px-1 pt-1 pb-1",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:me.map((t,b)=>{let f=t.getMonth()===w,v=n&&t<new Date(n.getFullYear(),n.getMonth(),n.getDate())||d&&t>new Date(d.getFullYear(),d.getMonth(),d.getDate()),y=Z(t,h),ye=Z(t,new Date);return jsx(we,{d:t,inMonth:f,disabled:!!v,selected:y,isToday:ye,onPick:ge,dayClassName:X,outsideDayClassName:ae,selectedDayClassName:te,todayClassName:ee},b)})}),jsx(l.Arrow,{className:"fill-white stroke-black/10"})]})})]})]})}),Ye=s.memo(Se);export{Ye as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-omelet-ui",
3
- "version": "1.8.63",
3
+ "version": "1.8.64",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",