@synertech/ui 0.46.1 → 0.46.3
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/components/advance-detachable/AdvanceDetachable.cjs +1 -1
- package/dist/components/advance-detachable/AdvanceDetachable.js +1 -1
- package/dist/components/badge/Badge.cjs +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/banner/Banner.cjs +1 -1
- package/dist/components/banner/Banner.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/calendar/Calendar.cjs +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/chart/ChartLegend.cjs +1 -1
- package/dist/components/chart/ChartLegend.js +1 -1
- package/dist/components/checkbox/Checkbox.cjs +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
- package/dist/components/checkbox/CheckboxGroup.js +1 -1
- package/dist/components/chip/Chip.cjs +1 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/circular-progress/CircularProgress.cjs +1 -1
- package/dist/components/circular-progress/CircularProgress.js +1 -1
- package/dist/components/datagrid/DataGrid.cjs +1 -1
- package/dist/components/datagrid/DataGrid.js +1 -1
- package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
- package/dist/components/device-mockup/DeviceMockup.js +1 -1
- package/dist/components/drawer/Drawer.cjs +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/dropdown/DropdownItem.cjs +1 -1
- package/dist/components/dropdown/DropdownItem.js +1 -1
- package/dist/components/dropdown/DropdownRadio.cjs +1 -1
- package/dist/components/dropdown/DropdownRadio.js +1 -1
- package/dist/components/dropdown/DropdownSubMenu.cjs +1 -1
- package/dist/components/dropdown/DropdownSubMenu.js +1 -1
- package/dist/components/dropdown/DropdownTrigger.cjs +1 -1
- package/dist/components/dropdown/DropdownTrigger.js +1 -1
- package/dist/components/file-selector/FileSelector.cjs +1 -1
- package/dist/components/file-selector/FileSelector.js +1 -1
- package/dist/components/form/mention-input/MentionInput.cjs +1 -1
- package/dist/components/form/mention-input/MentionInput.js +1 -1
- package/dist/components/form/shared/inputStyles.cjs +1 -1
- package/dist/components/form/shared/inputStyles.js +1 -1
- package/dist/components/header/Header.cjs +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/help-button/HelpButton.cjs +2 -2
- package/dist/components/help-button/HelpButton.js +3 -3
- package/dist/components/image-uploader/ImageUploader.cjs +1 -1
- package/dist/components/image-uploader/ImageUploader.js +1 -1
- package/dist/components/indicator/Indicator.cjs +1 -1
- package/dist/components/indicator/Indicator.js +1 -1
- package/dist/components/label/Label.cjs +1 -1
- package/dist/components/label/Label.js +1 -1
- package/dist/components/modal/Modal.cjs +1 -1
- package/dist/components/modal/Modal.js +1 -1
- package/dist/components/pagination/Pagination.cjs +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/progress-bar/ProgressBar.cjs +1 -1
- package/dist/components/progress-bar/ProgressBar.js +1 -1
- package/dist/components/radio-button/RadioButton.cjs +1 -1
- package/dist/components/radio-button/RadioButton.js +1 -1
- package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
- package/dist/components/schema-editor/SchemaEditor.js +1 -1
- package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
- package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
- package/dist/components/schema-editor/relations/SchemaRelationRenderer.cjs +1 -1
- package/dist/components/schema-editor/relations/SchemaRelationRenderer.js +1 -1
- package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
- package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
- package/dist/components/schema-editor/utils/foreign-keys.cjs +1 -0
- package/dist/components/schema-editor/utils/foreign-keys.js +1 -0
- package/dist/components/schema-editor/utils/geometry.cjs +1 -1
- package/dist/components/schema-editor/utils/geometry.js +1 -1
- package/dist/components/schema-editor/utils/sql-export.cjs +5 -5
- package/dist/components/schema-editor/utils/sql-export.js +5 -5
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/sidebar/Sidebar.cjs +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/slider/Slider.cjs +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/stat-card/StatCard.cjs +1 -1
- package/dist/components/stat-card/StatCard.js +1 -1
- package/dist/components/table/TableHeader.cjs +1 -1
- package/dist/components/table/TableHeader.js +1 -1
- package/dist/components/tabs/TabsTrigger.cjs +1 -1
- package/dist/components/tabs/TabsTrigger.js +1 -1
- package/dist/components/toast/Toast.cjs +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/tooltip/Tooltip.cjs +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/wizard/Wizard.cjs +1 -1
- package/dist/components/wizard/Wizard.js +1 -1
- package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
- package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/lib/editable-target.cjs +1 -0
- package/dist/lib/editable-target.js +1 -0
- package/dist/styles.css +82 -143
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var W=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ne=Object.prototype.hasOwnProperty;var Se=(t,r)=>{for(var l in r)W(t,l,{get:r[l],enumerable:!0})},Ae=(t,r,l,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ke(r))!Ne.call(t,a)&&a!==l&&W(t,a,{get:()=>r[a],enumerable:!(s=Te(r,a))||s.enumerable});return t};var Me=t=>Ae(W({},"__esModule",{value:!0}),t);var Ue={};Se(Ue,{AdvanceDetachable:()=>ye});module.exports=Me(Ue);var e=require("react"),me=require("react-dom"),v=require("react/jsx-runtime");function Ie(...t){return t.filter(Boolean).join(" ")}var Le="@synertech/ui/AdvanceDetachable",xe=300,Oe="width=800,height=600,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes",fe={clock:0,writer:""};function Pe(t,r){return t.clock>r.clock||t.clock===r.clock&&t.writer>r.writer}var Ve=0;function He(){return`${Date.now()}-${++Ve}-${Math.random().toString(36).slice(2,8)}`}function pe(t){try{return JSON.stringify(t)}catch{return String(t)}}function he(t){try{return JSON.parse(t)}catch{return t}}function ze(t,r){t.querySelectorAll("style").forEach(l=>{let s=r.createElement("style");s.textContent=l.textContent,r.head.appendChild(s)}),t.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{let s=l,a=r.createElement("link");a.rel="stylesheet",a.href=s.href,s.crossOrigin&&(a.crossOrigin=s.crossOrigin),r.head.appendChild(a)}),t.documentElement.className&&(r.documentElement.className=t.documentElement.className),t.body.className&&(r.body.className=t.body.className)}function Be(t,r){let l=new MutationObserver(s=>{for(let a of s)for(let h of Array.from(a.addedNodes))if(h instanceof HTMLStyleElement){let u=r.createElement("style");u.textContent=h.textContent,r.head.appendChild(u)}else if(h instanceof HTMLLinkElement&&h.rel==="stylesheet"){let u=r.createElement("link");u.rel="stylesheet",u.href=h.href,r.head.appendChild(u)}});return l.observe(t.head,{childList:!0}),l}function We(){return typeof BroadcastChannel<"u"}function $e({mode:t,id:r,title:l="",children:s,value:a,defaultValue:h,onValueChange:u,isDetached:$,defaultDetached:ge=!1,onDetachedChange:U,features:F,target:_,autoFocus:q=!0,className:we,detachedBodyClassName:J,disabled:j=!1,readOnly:X=!1,closeOnMainWindowUnload:G=!0,name:K,serialize:Q,deserialize:Y},ve){let i=$!==void 0,[be,E]=(0,e.useState)(ge),m=i?$:be,x=a!==void 0,[Re,De]=(0,e.useState)(h),y=x?a:Re,[Z,ee]=(0,e.useState)(null),o=(0,e.useRef)(null),b=(0,e.useRef)(null),T=(0,e.useRef)(null),k=(0,e.useRef)(null),N=(0,e.useRef)(!1),S=(0,e.useRef)(null),A=(0,e.useRef)(null),g=(0,e.useRef)(null),d=(0,e.useRef)(fe),ne=(0,e.useRef)(null),[R]=(0,e.useState)(()=>`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),f=(0,e.useRef)({title:l,features:F,target:_,autoFocus:q,detachedBodyClassName:J,closeOnMainWindowUnload:G,disabled:j,readOnly:X,mode:t,id:r});f.current={title:l,features:F,target:_,autoFocus:q,detachedBodyClassName:J,closeOnMainWindowUnload:G,disabled:j,readOnly:X,mode:t,id:r};let M=(0,e.useRef)(Q??pe);M.current=Q??pe;let te=(0,e.useRef)(Y??he);te.current=Y??he;let re=(0,e.useRef)(u);re.current=u;let C=(0,e.useRef)(U);C.current=U;let O=(0,e.useRef)(m);O.current=m;let ce=(0,e.useRef)(y);ce.current=y;let p=`${Le}/${r}`,I=(0,e.useCallback)(()=>{T.current&&(clearInterval(T.current),T.current=null),k.current&&(k.current.disconnect(),k.current=null),ee(null)},[]),L=(0,e.useCallback)(()=>{b.current&&(b.current.close(),b.current=null),S.current&&typeof window<"u"&&(window.removeEventListener("message",S.current),S.current=null)},[]),D=(0,e.useCallback)(n=>{let c={channel:p,instanceId:R,messageId:He(),origin:"main",timestamp:Date.now(),...n};b.current?b.current.postMessage(c):o.current&&!o.current.closed&&o.current.postMessage(c,"*")},[p,R]),P=(0,e.useCallback)(n=>{if(!n||n.channel!==p||n.instanceId===R||f.current.readOnly)return;if(n.type==="hello"){if(d.current.clock===0||g.current===null)return;D({type:"value-sync",payload:g.current,...d.current});return}if(n.type!=="value-sync"||typeof n.payload!="string")return;let c=typeof n.clock=="number"?{clock:n.clock,writer:typeof n.writer=="string"?n.writer:n.instanceId}:{clock:d.current.clock+1,writer:n.instanceId};if(!Pe(c,d.current)||(d.current=c,n.payload===g.current)||(g.current=n.payload,n.payload===A.current))return;let w=te.current(n.payload);x||De(w),re.current?.(w)},[p,R,x,D]),oe=(0,e.useCallback)(()=>{if(L(),!(typeof window>"u")){if(ne.current!==p){ne.current=p,d.current=fe,g.current=null;let n=ce.current;A.current=n===void 0?null:M.current(n)}if(We()){let n=new BroadcastChannel(p),c=w=>P(w.data);n.addEventListener("message",c),b.current=n}else{let n=c=>{c.data?.channel===p&&P(c.data)};window.addEventListener("message",n),S.current=n}f.current.readOnly||D({type:"hello"})}},[p,L,P,D]),le=(0,e.useCallback)(n=>{let c=M.current(n);c!==A.current&&(A.current=c,!f.current.readOnly&&c!==g.current&&(g.current=c,d.current={clock:d.current.clock+1,writer:R},D({type:"value-sync",payload:c,...d.current})))},[R,D]),se=(0,e.useCallback)(()=>{if(typeof window>"u"||f.current.disabled||N.current||o.current&&!o.current.closed)return;N.current=!0;let n=f.current,c=window.open("",n.target||"",n.features||Oe);if(!c){N.current=!1;return}o.current=c,c.document.title=n.title||document.title,n.detachedBodyClassName&&(c.document.body.className=n.detachedBodyClassName);let w=c.document.createElement("div");c.document.body.appendChild(w),ee(w),ze(document,c.document),k.current=Be(document,c.document),T.current=setInterval(()=>{c.closed&&(I(),o.current=null,i||E(!1),C.current?.(!1))},xe),n.autoFocus&&c.focus(),N.current=!1},[i,I]),ae=(0,e.useCallback)(()=>{o.current&&!o.current.closed&&o.current.close(),o.current=null,I()},[I]),ue=(0,e.useRef)(se);ue.current=se;let V=(0,e.useRef)(ae);V.current=ae;let ie=(0,e.useRef)(le);ie.current=le;let H=(0,e.useCallback)(()=>{f.current.disabled||(i||E(!0),C.current?.(!0))},[i]),z=(0,e.useCallback)(()=>{i||E(!1),C.current?.(!1)},[i]),B=(0,e.useCallback)(()=>{let n=!O.current;n&&f.current.disabled||(i||E(n),C.current?.(n))},[i]);(0,e.useImperativeHandle)(ve,()=>({open:H,close:z,toggle:B,get isDetached(){return O.current},get window(){return o.current}}),[H,z,B]),(0,e.useEffect)(()=>(oe(),()=>L()),[oe,L]),(0,e.useEffect)(()=>{if(m)return ue.current(),()=>V.current();V.current()},[m]),(0,e.useEffect)(()=>{y!==void 0&&ie.current(y)},[y]),(0,e.useEffect)(()=>{o.current&&!o.current.closed&&l&&(o.current.document.title=l)},[l]),(0,e.useEffect)(()=>{if(typeof window>"u")return;let n=()=>{f.current.closeOnMainWindowUnload&&o.current&&!o.current.closed&&o.current.close()};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n),o.current&&!o.current.closed&&o.current.close(),o.current=null}},[]);let de=typeof s=="function"?s({open:H,close:z,toggle:B,detached:m,windowRef:o.current}):s,Ce=t==="clone"||!m,Ee=m&&Z!==null;return(0,v.jsxs)(v.Fragment,{children:[K&&y!==void 0&&(0,v.jsx)("input",{type:"hidden",name:K,value:M.current(y)}),Ce&&(0,v.jsx)("div",{className:Ie(we),children:de}),Ee&&(0,me.createPortal)(de,Z)]})}var ye=(0,e.forwardRef)($e);ye.displayName="AdvanceDetachable";0&&(module.exports={AdvanceDetachable});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as O,useRef as c,useEffect as E,useCallback as a,useImperativeHandle as Te,forwardRef as ke}from"react";import{createPortal as Ne}from"react-dom";import{Fragment as We,jsx as ye,jsxs as $e}from"react/jsx-runtime";function Se(...t){return t.filter(Boolean).join(" ")}var Ae="@synertech/ui/AdvanceDetachable",Me=300,Ie="width=800,height=600,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes",pe={clock:0,writer:""};function Le(t,o){return t.clock>o.clock||t.clock===o.clock&&t.writer>o.writer}var xe=0;function Oe(){return`${Date.now()}-${++xe}-${Math.random().toString(36).slice(2,8)}`}function he(t){try{return JSON.stringify(t)}catch{return String(t)}}function me(t){try{return JSON.parse(t)}catch{return t}}function Pe(t,o){t.querySelectorAll("style").forEach(l=>{let s=o.createElement("style");s.textContent=l.textContent,o.head.appendChild(s)}),t.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{let s=l,u=o.createElement("link");u.rel="stylesheet",u.href=s.href,s.crossOrigin&&(u.crossOrigin=s.crossOrigin),o.head.appendChild(u)}),t.documentElement.className&&(o.documentElement.className=t.documentElement.className),t.body.className&&(o.body.className=t.body.className)}function Ve(t,o){let l=new MutationObserver(s=>{for(let u of s)for(let m of Array.from(u.addedNodes))if(m instanceof HTMLStyleElement){let i=o.createElement("style");i.textContent=m.textContent,o.head.appendChild(i)}else if(m instanceof HTMLLinkElement&&m.rel==="stylesheet"){let i=o.createElement("link");i.rel="stylesheet",i.href=m.href,o.head.appendChild(i)}});return l.observe(t.head,{childList:!0}),l}function He(){return typeof BroadcastChannel<"u"}function ze({mode:t,id:o,title:l="",children:s,value:u,defaultValue:m,onValueChange:i,isDetached:U,defaultDetached:ge=!1,onDetachedChange:F,features:_,target:q,autoFocus:J=!0,className:we,detachedBodyClassName:j,disabled:X=!1,readOnly:G=!1,closeOnMainWindowUnload:K=!0,name:Q,serialize:Y,deserialize:Z},ve){let d=U!==void 0,[be,T]=O(ge),y=d?U:be,P=u!==void 0,[Re,De]=O(m),g=P?u:Re,[ee,ne]=O(null),r=c(null),b=c(null),k=c(null),N=c(null),S=c(!1),A=c(null),M=c(null),w=c(null),f=c(pe),te=c(null),[R]=O(()=>`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),p=c({title:l,features:_,target:q,autoFocus:J,detachedBodyClassName:j,closeOnMainWindowUnload:K,disabled:X,readOnly:G,mode:t,id:o});p.current={title:l,features:_,target:q,autoFocus:J,detachedBodyClassName:j,closeOnMainWindowUnload:K,disabled:X,readOnly:G,mode:t,id:o};let I=c(Y??he);I.current=Y??he;let re=c(Z??me);re.current=Z??me;let ce=c(i);ce.current=i;let C=c(F);C.current=F;let V=c(y);V.current=y;let oe=c(g);oe.current=g;let h=`${Ae}/${o}`,L=a(()=>{k.current&&(clearInterval(k.current),k.current=null),N.current&&(N.current.disconnect(),N.current=null),ne(null)},[]),x=a(()=>{b.current&&(b.current.close(),b.current=null),A.current&&typeof window<"u"&&(window.removeEventListener("message",A.current),A.current=null)},[]),D=a(e=>{let n={channel:h,instanceId:R,messageId:Oe(),origin:"main",timestamp:Date.now(),...e};b.current?b.current.postMessage(n):r.current&&!r.current.closed&&r.current.postMessage(n,"*")},[h,R]),H=a(e=>{if(!e||e.channel!==h||e.instanceId===R||p.current.readOnly)return;if(e.type==="hello"){if(f.current.clock===0||w.current===null)return;D({type:"value-sync",payload:w.current,...f.current});return}if(e.type!=="value-sync"||typeof e.payload!="string")return;let n=typeof e.clock=="number"?{clock:e.clock,writer:typeof e.writer=="string"?e.writer:e.instanceId}:{clock:f.current.clock+1,writer:e.instanceId};if(!Le(n,f.current)||(f.current=n,e.payload===w.current)||(w.current=e.payload,e.payload===M.current))return;let v=re.current(e.payload);P||De(v),ce.current?.(v)},[h,R,P,D]),le=a(()=>{if(x(),!(typeof window>"u")){if(te.current!==h){te.current=h,f.current=pe,w.current=null;let e=oe.current;M.current=e===void 0?null:I.current(e)}if(He()){let e=new BroadcastChannel(h),n=v=>H(v.data);e.addEventListener("message",n),b.current=e}else{let e=n=>{n.data?.channel===h&&H(n.data)};window.addEventListener("message",e),A.current=e}p.current.readOnly||D({type:"hello"})}},[h,x,H,D]),se=a(e=>{let n=I.current(e);n!==M.current&&(M.current=n,!p.current.readOnly&&n!==w.current&&(w.current=n,f.current={clock:f.current.clock+1,writer:R},D({type:"value-sync",payload:n,...f.current})))},[R,D]),ae=a(()=>{if(typeof window>"u"||p.current.disabled||S.current||r.current&&!r.current.closed)return;S.current=!0;let e=p.current,n=window.open("",e.target||"",e.features||Ie);if(!n){S.current=!1;return}r.current=n,n.document.title=e.title||document.title,e.detachedBodyClassName&&(n.document.body.className=e.detachedBodyClassName);let v=n.document.createElement("div");n.document.body.appendChild(v),ne(v),Pe(document,n.document),N.current=Ve(document,n.document),k.current=setInterval(()=>{n.closed&&(L(),r.current=null,d||T(!1),C.current?.(!1))},Me),e.autoFocus&&n.focus(),S.current=!1},[d,L]),ue=a(()=>{r.current&&!r.current.closed&&r.current.close(),r.current=null,L()},[L]),ie=c(ae);ie.current=ae;let z=c(ue);z.current=ue;let de=c(se);de.current=se;let B=a(()=>{p.current.disabled||(d||T(!0),C.current?.(!0))},[d]),W=a(()=>{d||T(!1),C.current?.(!1)},[d]),$=a(()=>{let e=!V.current;e&&p.current.disabled||(d||T(e),C.current?.(e))},[d]);Te(ve,()=>({open:B,close:W,toggle:$,get isDetached(){return V.current},get window(){return r.current}}),[B,W,$]),E(()=>(le(),()=>x()),[le,x]),E(()=>{if(y)return ie.current(),()=>z.current();z.current()},[y]),E(()=>{g!==void 0&&de.current(g)},[g]),E(()=>{r.current&&!r.current.closed&&l&&(r.current.document.title=l)},[l]),E(()=>{if(typeof window>"u")return;let e=()=>{p.current.closeOnMainWindowUnload&&r.current&&!r.current.closed&&r.current.close()};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e),r.current&&!r.current.closed&&r.current.close(),r.current=null}},[]);let fe=typeof s=="function"?s({open:B,close:W,toggle:$,detached:y,windowRef:r.current}):s,Ce=t==="clone"||!y,Ee=y&&ee!==null;return $e(We,{children:[Q&&g!==void 0&&ye("input",{type:"hidden",name:Q,value:I.current(g)}),Ce&&ye("div",{className:Se(we),children:fe}),Ee&&Ne(fe,ee)]})}var Be=ke(ze);Be.displayName="AdvanceDetachable";export{Be as AdvanceDetachable};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of u(e))!k.call(t,d)&&d!==r&&g(t,d,{get:()=>e[d],enumerable:!(o=p(e,d))||o.enumerable});return t};var w=t=>c(g({},"__esModule",{value:!0}),t);var C={};y(C,{Badge:()=>b});module.exports=w(C);var l=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),f={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-
|
|
1
|
+
"use strict";var g=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of u(e))!k.call(t,d)&&d!==r&&g(t,d,{get:()=>e[d],enumerable:!(o=p(e,d))||o.enumerable});return t};var w=t=>c(g({},"__esModule",{value:!0}),t);var C={};y(C,{Badge:()=>b});module.exports=w(C);var l=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),f={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-700 text-white",soft:"bg-green-100 text-green-800 dark:bg-green-900/50 dark:text-green-300",outlined:"border border-green-500 text-green-700 dark:border-green-400 dark:text-green-400",subtle:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-400"},warning:{solid:"bg-yellow-500 text-gray-900",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",outlined:"border border-yellow-400 text-yellow-700 dark:border-yellow-400 dark:text-yellow-400",subtle:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"},error:{solid:"bg-red-600 text-white",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",outlined:"border border-red-500 text-red-600 dark:border-red-400 dark:text-red-400",subtle:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-400"},info:{solid:"bg-cyan-700 text-white",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",outlined:"border border-cyan-500 text-cyan-700 dark:border-cyan-400 dark:text-cyan-400",subtle:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400"},purple:{solid:"bg-purple-600 text-white",soft:"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300",outlined:"border border-purple-500 text-purple-600 dark:border-purple-400 dark:text-purple-400",subtle:"bg-purple-50 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400"},indigo:{solid:"bg-indigo-600 text-white",soft:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",outlined:"border border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400",subtle:"bg-indigo-50 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-300"},teal:{solid:"bg-teal-700 text-white",soft:"bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300",outlined:"border border-teal-500 text-teal-700 dark:border-teal-400 dark:text-teal-400",subtle:"bg-teal-50 text-teal-700 dark:bg-teal-900/30 dark:text-teal-400"}},m={default:"bg-gray-500",primary:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",purple:"bg-purple-500",indigo:"bg-indigo-500",teal:"bg-teal-500"},h={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-0.5 gap-1",lg:"text-sm px-2.5 py-1 gap-1.5"},B={sm:"w-1.5 h-1.5",md:"w-1.5 h-1.5",lg:"w-2 h-2"},R={sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};function b({children:t,color:e="default",size:r="md",variant:o="soft",dot:d=!1,icon:n,pill:i=!0,className:s,...x}){return(0,a.jsxs)("span",{className:(0,l.cn)("inline-flex items-center font-medium",h[r],i?"rounded-full":"rounded",f[e][o],s),...x,children:[d&&(0,a.jsx)("span",{className:(0,l.cn)("shrink-0 rounded-full",B[r],m[e]),"aria-hidden":"true"}),n&&!d&&(0,a.jsx)("span",{className:(0,l.cn)("shrink-0",R[r]),"aria-hidden":"true",children:n}),t]})}b.displayName="Badge";0&&(module.exports={Badge});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as t}from"../../lib/cn.js";import{jsx as o,jsxs as c}from"react/jsx-runtime";var s={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-
|
|
1
|
+
import{cn as t}from"../../lib/cn.js";import{jsx as o,jsxs as c}from"react/jsx-runtime";var s={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-700 text-white",soft:"bg-green-100 text-green-800 dark:bg-green-900/50 dark:text-green-300",outlined:"border border-green-500 text-green-700 dark:border-green-400 dark:text-green-400",subtle:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-400"},warning:{solid:"bg-yellow-500 text-gray-900",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",outlined:"border border-yellow-400 text-yellow-700 dark:border-yellow-400 dark:text-yellow-400",subtle:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"},error:{solid:"bg-red-600 text-white",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",outlined:"border border-red-500 text-red-600 dark:border-red-400 dark:text-red-400",subtle:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-400"},info:{solid:"bg-cyan-700 text-white",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",outlined:"border border-cyan-500 text-cyan-700 dark:border-cyan-400 dark:text-cyan-400",subtle:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400"},purple:{solid:"bg-purple-600 text-white",soft:"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300",outlined:"border border-purple-500 text-purple-600 dark:border-purple-400 dark:text-purple-400",subtle:"bg-purple-50 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400"},indigo:{solid:"bg-indigo-600 text-white",soft:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",outlined:"border border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400",subtle:"bg-indigo-50 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-300"},teal:{solid:"bg-teal-700 text-white",soft:"bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300",outlined:"border border-teal-500 text-teal-700 dark:border-teal-400 dark:text-teal-400",subtle:"bg-teal-50 text-teal-700 dark:bg-teal-900/30 dark:text-teal-400"}},x={default:"bg-gray-500",primary:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",purple:"bg-purple-500",indigo:"bg-indigo-500",teal:"bg-teal-500"},p={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-0.5 gap-1",lg:"text-sm px-2.5 py-1 gap-1.5"},u={sm:"w-1.5 h-1.5",md:"w-1.5 h-1.5",lg:"w-2 h-2"},k={sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};function y({children:l,color:r="default",size:e="md",variant:g="soft",dot:d=!1,icon:a,pill:n=!0,className:b,...i}){return c("span",{className:t("inline-flex items-center font-medium",p[e],n?"rounded-full":"rounded",s[r][g],b),...i,children:[d&&o("span",{className:t("shrink-0 rounded-full",u[e],x[r]),"aria-hidden":"true"}),a&&!d&&o("span",{className:t("shrink-0",k[e]),"aria-hidden":"true",children:a}),l]})}y.displayName="Badge";export{y as Badge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var k=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var R=(t,r)=>{for(var o in r)k(t,o,{get:r[o],enumerable:!0})},P=(t,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of M(r))!I.call(t,n)&&n!==o&&k(t,n,{get:()=>r[n],enumerable:!(s=L(r,n))||s.enumerable});return t};var W=t=>P(k({},"__esModule",{value:!0}),t);var U={};R(U,{Banner:()=>B});module.exports=W(U);var h=require("react"),a=require("../../lib/cn.cjs"),w=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function y({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function V({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function H({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function T({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function C({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var j={info:y,success:V,warning:H,error:T,default:y},O={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},Z={info:"text-blue-600 dark:text-blue-400",success:"text-green-
|
|
1
|
+
"use strict";"use client";var k=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var R=(t,r)=>{for(var o in r)k(t,o,{get:r[o],enumerable:!0})},P=(t,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of M(r))!I.call(t,n)&&n!==o&&k(t,n,{get:()=>r[n],enumerable:!(s=L(r,n))||s.enumerable});return t};var W=t=>P(k({},"__esModule",{value:!0}),t);var U={};R(U,{Banner:()=>B});module.exports=W(U);var h=require("react"),a=require("../../lib/cn.cjs"),w=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function y({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function V({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function H({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function T({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function C({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var j={info:y,success:V,warning:H,error:T,default:y},O={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},Z={info:"text-blue-600 dark:text-blue-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",default:"text-gray-600 dark:text-gray-400"};function z({type:t="default",title:r,description:o,children:s,icon:n,action:i,closable:d=!1,closeLabel:c,onClose:u,fullWidth:g=!1,className:b,...m}){let[f,p]=(0,h.useState)(!0),v=(0,w.useUILabels)();if(!f)return null;let l=()=>{p(!1),u?.()},x=j[t],N=s??o;return(0,e.jsxs)("div",{role:"alert",className:(0,a.cn)("flex items-start gap-3 border px-4 py-3",g?"w-full":"rounded-lg",O[t],b),...m,children:[(0,e.jsx)("div",{className:(0,a.cn)("shrink-0 mt-0.5",Z[t]),children:n??(0,e.jsx)(x,{className:"w-5 h-5"})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[r&&(0,e.jsx)("div",{className:"font-semibold text-sm",children:r}),N&&(0,e.jsx)("div",{className:(0,a.cn)("text-sm",r?"mt-1 opacity-90":!1),children:N}),i&&(0,e.jsx)("div",{className:"mt-3",children:i})]}),d&&(0,e.jsx)("button",{type:"button",onClick:l,className:(0,a.cn)("shrink-0 rounded-md p-1 transition-colors","hover:bg-black/10 dark:hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-current"),"aria-label":c??v.bannerClose,children:(0,e.jsx)(C,{className:"w-4 h-4"})})]})}function S({title:t,description:r,children:o,action:s,backgroundImage:n,closable:i=!1,closeLabel:d,onClose:c,fullWidth:u=!1,className:g,...b}){let[m,f]=(0,h.useState)(!0),p=(0,w.useUILabels)();if(!m)return null;let v=()=>{f(!1),c?.()},l=o??r;return(0,e.jsxs)("div",{className:(0,a.cn)("relative overflow-hidden bg-gray-900 text-white",u?"w-full":"rounded-xl","py-12 px-6 sm:px-12",g),style:n?{backgroundImage:`url(${n})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,...b,children:[n&&(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"relative z-10 max-w-3xl mx-auto text-center",children:[t&&(0,e.jsx)("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight",children:t}),l&&(0,e.jsx)("div",{className:(0,a.cn)("text-base sm:text-lg opacity-90",t?"mt-4":!1),children:l}),s&&(0,e.jsx)("div",{className:"mt-6",children:s})]}),i&&(0,e.jsx)("button",{type:"button",onClick:v,className:(0,a.cn)("absolute top-4 right-4 z-10 rounded-md p-1.5 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":d??p.bannerClose,children:(0,e.jsx)(C,{className:"w-5 h-5"})})]})}function E({title:t,description:r,children:o,icon:s,action:n,badge:i,closable:d=!1,closeLabel:c,onClose:u,fullWidth:g=!1,className:b,...m}){let[f,p]=(0,h.useState)(!0),v=(0,w.useUILabels)();if(!f)return null;let l=()=>{p(!1),u?.()},x=o??r;return(0,e.jsxs)("div",{className:(0,a.cn)("relative flex items-center gap-4 bg-linear-to-r from-indigo-600 to-purple-600 text-white px-4 py-3",g?"w-full":"rounded-lg",b),...m,children:[s&&(0,e.jsx)("div",{className:"shrink-0",children:s}),i&&(0,e.jsx)("span",{className:"shrink-0 inline-flex items-center rounded-full bg-white/20 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wide",children:i}),(0,e.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-x-4 gap-y-1",children:[t&&(0,e.jsx)("span",{className:"font-semibold text-sm",children:t}),x&&(0,e.jsx)("span",{className:"text-sm opacity-90",children:x})]}),n&&(0,e.jsx)("div",{className:"shrink-0",children:n}),d&&(0,e.jsx)("button",{type:"button",onClick:l,className:(0,a.cn)("shrink-0 rounded-md p-1 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":c??v.bannerClose,children:(0,e.jsx)(C,{className:"w-4 h-4"})})]})}function B({variant:t="notification",...r}){switch(t){case"hero":return(0,e.jsx)(S,{...r});case"promotion":return(0,e.jsx)(E,{...r});default:return(0,e.jsx)(z,{...r})}}B.displayName="Banner";0&&(module.exports={Banner});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as w}from"react";import{cn as n}from"../../lib/cn.js";import{useUILabels as k}from"../../lib/i18n.js";import{jsx as e,jsxs as l}from"react/jsx-runtime";function y({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function B({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function L({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function M({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function C({className:t}){return e("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var I={info:y,success:B,warning:L,error:M,default:y},R={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},P={info:"text-blue-600 dark:text-blue-400",success:"text-green-
|
|
1
|
+
"use client";import{useState as w}from"react";import{cn as n}from"../../lib/cn.js";import{useUILabels as k}from"../../lib/i18n.js";import{jsx as e,jsxs as l}from"react/jsx-runtime";function y({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function B({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function L({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function M({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function C({className:t}){return e("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var I={info:y,success:B,warning:L,error:M,default:y},R={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},P={info:"text-blue-600 dark:text-blue-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",default:"text-gray-600 dark:text-gray-400"};function W({type:t="default",title:r,description:d,children:s,icon:o,action:a,closable:c=!1,closeLabel:u,onClose:g,fullWidth:b=!1,className:m,...f}){let[p,v]=w(!0),x=k();if(!p)return null;let i=()=>{v(!1),g?.()},h=I[t],N=s??d;return l("div",{role:"alert",className:n("flex items-start gap-3 border px-4 py-3",b?"w-full":"rounded-lg",R[t],m),...f,children:[e("div",{className:n("shrink-0 mt-0.5",P[t]),children:o??e(h,{className:"w-5 h-5"})}),l("div",{className:"flex-1 min-w-0",children:[r&&e("div",{className:"font-semibold text-sm",children:r}),N&&e("div",{className:n("text-sm",r?"mt-1 opacity-90":!1),children:N}),a&&e("div",{className:"mt-3",children:a})]}),c&&e("button",{type:"button",onClick:i,className:n("shrink-0 rounded-md p-1 transition-colors","hover:bg-black/10 dark:hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-current"),"aria-label":u??x.bannerClose,children:e(C,{className:"w-4 h-4"})})]})}function V({title:t,description:r,children:d,action:s,backgroundImage:o,closable:a=!1,closeLabel:c,onClose:u,fullWidth:g=!1,className:b,...m}){let[f,p]=w(!0),v=k();if(!f)return null;let x=()=>{p(!1),u?.()},i=d??r;return l("div",{className:n("relative overflow-hidden bg-gray-900 text-white",g?"w-full":"rounded-xl","py-12 px-6 sm:px-12",b),style:o?{backgroundImage:`url(${o})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,...m,children:[o&&e("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),l("div",{className:"relative z-10 max-w-3xl mx-auto text-center",children:[t&&e("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight",children:t}),i&&e("div",{className:n("text-base sm:text-lg opacity-90",t?"mt-4":!1),children:i}),s&&e("div",{className:"mt-6",children:s})]}),a&&e("button",{type:"button",onClick:x,className:n("absolute top-4 right-4 z-10 rounded-md p-1.5 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":c??v.bannerClose,children:e(C,{className:"w-5 h-5"})})]})}function H({title:t,description:r,children:d,icon:s,action:o,badge:a,closable:c=!1,closeLabel:u,onClose:g,fullWidth:b=!1,className:m,...f}){let[p,v]=w(!0),x=k();if(!p)return null;let i=()=>{v(!1),g?.()},h=d??r;return l("div",{className:n("relative flex items-center gap-4 bg-linear-to-r from-indigo-600 to-purple-600 text-white px-4 py-3",b?"w-full":"rounded-lg",m),...f,children:[s&&e("div",{className:"shrink-0",children:s}),a&&e("span",{className:"shrink-0 inline-flex items-center rounded-full bg-white/20 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wide",children:a}),l("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-x-4 gap-y-1",children:[t&&e("span",{className:"font-semibold text-sm",children:t}),h&&e("span",{className:"text-sm opacity-90",children:h})]}),o&&e("div",{className:"shrink-0",children:o}),c&&e("button",{type:"button",onClick:i,className:n("shrink-0 rounded-md p-1 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":u??x.bannerClose,children:e(C,{className:"w-4 h-4"})})]})}function T({variant:t="notification",...r}){switch(t){case"hero":return e(V,{...r});case"promotion":return e(H,{...r});default:return e(W,{...r})}}T.displayName="Banner";export{T as Banner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(n,s)=>{for(var l in s)m(n,l,{get:s[l],enumerable:!0})},C=(n,s,l,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of N(s))!y.call(n,r)&&r!==l&&m(n,r,{get:()=>s[r],enumerable:!(i=h(s,r))||i.enumerable});return n};var v=n=>C(m({},"__esModule",{value:!0}),n);var R={};k(R,{Breadcrumb:()=>I});module.exports=v(R);var t=require("../../lib/cn.cjs"),g=require("../../lib/server-labels.cjs"),e=require("react/jsx-runtime"),B={sm:"text-xs",md:"text-sm",lg:"text-base"};function I({items:n,separator:s="/",size:l="md",maxItems:i,itemColor:r="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:f="text-gray-700 font-medium dark:text-gray-200",separatorColor:p="text-gray-
|
|
1
|
+
"use strict";var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(n,s)=>{for(var l in s)m(n,l,{get:s[l],enumerable:!0})},C=(n,s,l,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of N(s))!y.call(n,r)&&r!==l&&m(n,r,{get:()=>s[r],enumerable:!(i=h(s,r))||i.enumerable});return n};var v=n=>C(m({},"__esModule",{value:!0}),n);var R={};k(R,{Breadcrumb:()=>I});module.exports=v(R);var t=require("../../lib/cn.cjs"),g=require("../../lib/server-labels.cjs"),e=require("react/jsx-runtime"),B={sm:"text-xs",md:"text-sm",lg:"text-base"};function I({items:n,separator:s="/",size:l="md",maxItems:i,itemColor:r="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:f="text-gray-700 font-medium dark:text-gray-200",separatorColor:p="text-gray-500 dark:text-gray-400",className:u,...b}){let d=n,x=!1;if(i&&n.length>i){x=!0;let a=n[0],o=n.slice(-(i-1));d=[a,...o]}return(0,e.jsx)("nav",{"aria-label":g.serverUILabels.breadcrumbLabel,className:(0,t.cn)("inline-flex items-center",B[l],u),...b,children:(0,e.jsx)("ol",{className:"inline-flex items-center space-x-1 md:space-x-2",children:d.map((a,o)=>{let c=o===d.length-1;return(0,e.jsxs)("li",{className:"inline-flex items-center",children:[x&&o===1&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:(0,t.cn)("mx-1 select-none",p),children:"..."}),(0,e.jsx)("span",{className:(0,t.cn)("mx-1 select-none",p),"aria-hidden":"true",children:s})]}),a.href||a.onClick?(0,e.jsxs)("a",{href:a.href,onClick:a.onClick,className:(0,t.cn)("inline-flex items-center gap-1.5 transition-colors",c?f:r),"aria-current":c?"page":void 0,children:[a.icon&&(0,e.jsx)("span",{className:"inline-flex","aria-hidden":"true",children:a.icon}),(0,e.jsx)("span",{children:a.label})]}):(0,e.jsxs)("span",{className:(0,t.cn)("inline-flex items-center gap-1.5",c?f:r),"aria-current":c?"page":void 0,children:[a.icon&&(0,e.jsx)("span",{className:"inline-flex","aria-hidden":"true",children:a.icon}),(0,e.jsx)("span",{children:a.label})]}),!c&&(0,e.jsx)("span",{className:(0,t.cn)("mx-2 select-none",p),"aria-hidden":"true",children:s})]},a.href??a.label)})})})}0&&(module.exports={Breadcrumb});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as n}from"../../lib/cn.js";import{serverUILabels as b}from"../../lib/server-labels.js";import{Fragment as N,jsx as a,jsxs as l}from"react/jsx-runtime";var h={sm:"text-xs",md:"text-sm",lg:"text-base"};function v({items:r,separator:p="/",size:x="md",maxItems:i,itemColor:d="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:m="text-gray-700 font-medium dark:text-gray-200",separatorColor:c="text-gray-
|
|
1
|
+
import{cn as n}from"../../lib/cn.js";import{serverUILabels as b}from"../../lib/server-labels.js";import{Fragment as N,jsx as a,jsxs as l}from"react/jsx-runtime";var h={sm:"text-xs",md:"text-sm",lg:"text-base"};function v({items:r,separator:p="/",size:x="md",maxItems:i,itemColor:d="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:m="text-gray-700 font-medium dark:text-gray-200",separatorColor:c="text-gray-500 dark:text-gray-400",className:g,...u}){let o=r,f=!1;if(i&&r.length>i){f=!0;let e=r[0],t=r.slice(-(i-1));o=[e,...t]}return a("nav",{"aria-label":b.breadcrumbLabel,className:n("inline-flex items-center",h[x],g),...u,children:a("ol",{className:"inline-flex items-center space-x-1 md:space-x-2",children:o.map((e,t)=>{let s=t===o.length-1;return l("li",{className:"inline-flex items-center",children:[f&&t===1&&l(N,{children:[a("span",{className:n("mx-1 select-none",c),children:"..."}),a("span",{className:n("mx-1 select-none",c),"aria-hidden":"true",children:p})]}),e.href||e.onClick?l("a",{href:e.href,onClick:e.onClick,className:n("inline-flex items-center gap-1.5 transition-colors",s?m:d),"aria-current":s?"page":void 0,children:[e.icon&&a("span",{className:"inline-flex","aria-hidden":"true",children:e.icon}),a("span",{children:e.label})]}):l("span",{className:n("inline-flex items-center gap-1.5",s?m:d),"aria-current":s?"page":void 0,children:[e.icon&&a("span",{className:"inline-flex","aria-hidden":"true",children:e.icon}),a("span",{children:e.label})]}),!s&&a("span",{className:n("mx-2 select-none",c),"aria-hidden":"true",children:p})]},e.href??e.label)})})})}export{v as Breadcrumb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var se=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ze=Object.prototype.hasOwnProperty;var et=(e,a)=>{for(var s in a)se(e,s,{get:a[s],enumerable:!0})},tt=(e,a,s,F)=>{if(a&&typeof a=="object"||typeof a=="function")for(let D of Xe(a))!Ze.call(e,D)&&D!==s&&se(e,D,{get:()=>a[D],enumerable:!(F=Qe(a,D))||F.enumerable});return e};var at=e=>tt(se({},"__esModule",{value:!0}),e);var bt={};et(bt,{Calendar:()=>ft});module.exports=at(bt);var l=require("react"),c=require("../../lib/cn.cjs"),we=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime"),rt=10080*60*1e3;function g(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function V(e){return new Date(e.getFullYear(),e.getMonth(),1)}function T(e,a){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+a)}function x(e,a){return new Date(e.getFullYear(),e.getMonth()+a,1)}function de(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function N(e,a){return!e||!a?!1:e.getFullYear()===a.getFullYear()&&e.getMonth()===a.getMonth()&&e.getDate()===a.getDate()}function ie(e,a){return e.getFullYear()===a.getFullYear()&&e.getMonth()===a.getMonth()}function E(e,a){return e.getFullYear()*12+e.getMonth()-(a.getFullYear()*12+a.getMonth())}function J(e){let a=`${e.getMonth()+1}`.padStart(2,"0"),s=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${a}-${s}`}function nt(e){let a=g(e);a.setDate(a.getDate()-(a.getDay()+6)%7+3);let s=new Date(a.getFullYear(),0,4);return s.setDate(s.getDate()-(s.getDay()+6)%7+3),1+Math.round((a.getTime()-s.getTime())/rt)}function xe(e,a,s){return a&&e<g(a)?g(a):s&&e>g(s)?g(s):e}function ot(e,a,s){let F=V(e),D=(F.getDay()-a+7)%7,_=T(F,-D),j=s?6:Math.ceil((D+de(e))/7);return Array.from({length:j},(X,G)=>Array.from({length:7},(ue,L)=>T(_,G*7+L)))}function lt({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function st({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}var it={sm:{day:"h-7 w-7 text-xs",head:"h-7 w-7 text-[10px]",caption:"text-xs",nav:"h-6 w-6",icon:"h-3 w-3",padding:"p-2",gap:"gap-3",footer:"text-xs",select:"text-xs py-0.5 pl-1 pr-5"},md:{day:"h-9 w-9 text-sm",head:"h-9 w-9 text-xs",caption:"text-sm",nav:"h-7 w-7",icon:"h-4 w-4",padding:"p-3",gap:"gap-4",footer:"text-sm",select:"text-sm py-1 pl-1.5 pr-6"},lg:{day:"h-11 w-11 text-base",head:"h-11 w-11 text-sm",caption:"text-base",nav:"h-9 w-9",icon:"h-5 w-5",padding:"p-4",gap:"gap-5",footer:"text-sm",select:"text-base py-1.5 pl-2 pr-7"}},dt={primary:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",success:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600",warning:"bg-yellow-500 text-gray-900 hover:bg-yellow-600 dark:bg-yellow-400 dark:hover:bg-yellow-500",error:"bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600",info:"bg-cyan-600 text-white hover:bg-cyan-700 dark:bg-cyan-500 dark:hover:bg-cyan-600",neutral:"bg-gray-700 text-white hover:bg-gray-800 dark:bg-gray-500 dark:hover:bg-gray-400"},ut={primary:"bg-blue-50 dark:bg-blue-900/30",success:"bg-green-50 dark:bg-green-900/30",warning:"bg-yellow-50 dark:bg-yellow-900/30",error:"bg-red-50 dark:bg-red-900/30",info:"bg-cyan-50 dark:bg-cyan-900/30",neutral:"bg-gray-100 dark:bg-gray-700/40"},ct={primary:"text-blue-900 dark:text-blue-100",success:"text-green-900 dark:text-green-100",warning:"text-yellow-900 dark:text-yellow-100",error:"text-red-900 dark:text-red-100",info:"text-cyan-900 dark:text-cyan-100",neutral:"text-gray-900 dark:text-gray-100"},gt={primary:"font-semibold text-blue-600 dark:text-blue-400",success:"font-semibold text-green-600 dark:text-green-400",warning:"font-semibold text-yellow-600 dark:text-yellow-400",error:"font-semibold text-red-600 dark:text-red-400",info:"font-semibold text-cyan-600 dark:text-cyan-400",neutral:"font-semibold text-gray-900 dark:text-gray-100"},z={primary:"focus-visible:ring-blue-500",success:"focus-visible:ring-green-500",warning:"focus-visible:ring-yellow-500",error:"focus-visible:ring-red-500",info:"focus-visible:ring-cyan-500",neutral:"focus-visible:ring-gray-500"};function Q(e,a){if(e==="multiple")return Array.isArray(a)?a.map(g):[];if(e==="range"){let s=a??null;return{from:s?.from?g(s.from):null,to:s?.to?g(s.to):null}}return a instanceof Date?g(a):null}function ke(e){return e?e instanceof Date?e:Array.isArray(e)?e[0]??null:e.from??e.to??null:null}function ft(e){let{mode:a="single",value:s,defaultValue:F,onChange:D,max:_,month:j,defaultMonth:X,onMonthChange:G,numberOfMonths:ue=1,weekStartsOn:L=0,locale:R,size:Ce="md",color:v="primary",minDate:k,maxDate:w,disabledDates:O,disabled:y=!1,showOutsideDays:Me=!0,showWeekNumbers:ce=!1,fixedWeeks:Se=!1,captionLayout:Z="label",fromYear:ge,toYear:fe,todayButton:ee=!1,clearButton:te=!1,footer:be,bordered:Ne=!0,renderDay:ye,labels:B,className:Fe,...Re}=e,I=(0,we.useUILabels)(),h=it[Ce],C=Math.max(1,ue),Y=(0,l.useMemo)(()=>g(new Date),[]),ae=s!==void 0,[Ye,Pe]=(0,l.useState)(()=>Q(a,F)),A=ae?Q(a,s):Ye,re=j!==void 0,[Te,Le]=(0,l.useState)(()=>V(X??ke(Q(a,F??s))??new Date)),f=re?V(j):Te,p=(0,l.useCallback)(t=>{let r=V(t);re||Le(r),G?.(r)},[re,G]),me=(0,l.useRef)(null),ne=(0,l.useRef)(!1),[W,U]=(0,l.useState)(()=>{let t=ke(Q(a,F??s)),r=V(X??j??t??new Date),u=t&&ie(t,r)?t:ie(g(new Date),r)?g(new Date):r;return xe(u,k,w)}),Ae=x(f,C-1),Ee=E(W,f)>=0&&E(W,Ae)<=0?W:f;(0,l.useEffect)(()=>{if(!ne.current)return;ne.current=!1,me.current?.querySelector(`[data-day="${J(W)}"]:not([data-outside])`)?.focus()},[W,f]);let P=(0,l.useCallback)(t=>{let r=xe(g(t),k,w);ne.current=!0,U(r);let u=x(f,C-1);E(r,f)<0?p(r):E(r,u)>0&&p(x(r,-(C-1)))},[f,C,k,w,p]),K=(0,l.useCallback)(t=>y||k&&t<g(k)||w&&t>g(w)?!0:typeof O=="function"?O(t):Array.isArray(O)?O.some(r=>N(r,t)):!1,[y,k,w,O]),[oe,he]=(0,l.useState)(null),M=(0,l.useCallback)(t=>{ae||Pe(t),D?.(t)},[ae,D]),q=(0,l.useCallback)(t=>{let r=g(t);if(K(r))return;if(a==="multiple"){let i=A??[];if(i.some(o=>N(o,r))){M(i.filter(o=>!N(o,r)));return}if(_!==void 0&&i.length>=_)return;M([...i,r].sort((o,b)=>o.getTime()-b.getTime()));return}if(a==="range"){let i=A??{from:null,to:null};if(!i.from||i.to){M({from:r,to:null});return}M(r<i.from?{from:r,to:i.from}:{from:i.from,to:r});return}M(N(A,r)?null:r)},[a,A,_,M,K]),Be=(0,l.useCallback)(t=>{q(t),U(g(t)),E(t,f)<0?p(t):E(t,x(f,C-1))>0&&p(x(t,-(C-1)))},[q,f,C,p]),pe=!y&&(!k||E(f,V(k))>0),De=!y&&(!w||E(x(f,C-1),V(w))<0),Ie=(0,l.useCallback)(()=>{p(x(f,-1))},[f,p]),We=(0,l.useCallback)(()=>{p(x(f,1))},[f,p]),ze=(0,l.useCallback)(t=>{if(y)return;let r=W;switch(t.key){case"ArrowLeft":t.preventDefault(),P(T(r,-1));break;case"ArrowRight":t.preventDefault(),P(T(r,1));break;case"ArrowUp":t.preventDefault(),P(T(r,-7));break;case"ArrowDown":t.preventDefault(),P(T(r,7));break;case"Home":t.preventDefault(),P(T(r,-((r.getDay()-L+7)%7)));break;case"End":t.preventDefault(),P(T(r,6-(r.getDay()-L+7)%7));break;case"PageUp":{t.preventDefault();let u=t.shiftKey?-12:-1,i=x(r,u),m=Math.min(r.getDate(),de(i));P(new Date(i.getFullYear(),i.getMonth(),m));break}case"PageDown":{t.preventDefault();let u=t.shiftKey?12:1,i=x(r,u),m=Math.min(r.getDate(),de(i));P(new Date(i.getFullYear(),i.getMonth(),m));break}default:break}},[y,W,P,L]),Ve=(0,l.useMemo)(()=>{let t=new Intl.DateTimeFormat(R,{weekday:"short"}),r=new Intl.DateTimeFormat(R,{weekday:"long"}),u=new Date(2024,0,7);return Array.from({length:7},(i,m)=>{let o=T(u,(L+m)%7);return{short:t.format(o),long:r.format(o)}})},[R,L]),Ke=(0,l.useMemo)(()=>{let t=new Intl.DateTimeFormat(R,{month:"long"});return Array.from({length:12},(r,u)=>t.format(new Date(2024,u,1)))},[R]),ve=(0,l.useMemo)(()=>new Intl.DateTimeFormat(R,{month:"long",year:"numeric"}),[R]),_e=(0,l.useMemo)(()=>new Intl.DateTimeFormat(R,{dateStyle:"full"}),[R]),je=(0,l.useMemo)(()=>{if(Z!=="dropdown")return[];let t=Y.getFullYear(),r=ge??k?.getFullYear()??t-100,u=fe??w?.getFullYear()??t+10;return u<r?[r]:Array.from({length:u-r+1},(i,m)=>r+m)},[Z,ge,fe,k,w,Y]),S=a==="range"?A:null,Oe=S&&S.from&&!S.to&&oe&&oe>S.from?oe:null,$=S?.to??Oe,$e=(0,l.useCallback)((t,r)=>{let u=!ie(t,r),i=K(t),m=!1,o=!1,b=!1,d=!1;return a==="multiple"?m=(A??[]).some(H=>N(H,t)):a==="range"?(o=N(S?.from,t),b=N($,t),m=o||b,d=!!(S?.from&&$&&t>S.from&&t<$)):m=N(A,t),{selected:m,today:N(t,Y),outside:u,disabled:i,rangeStart:o,rangeEnd:b,inRange:d}},[a,A,S,$,K,Y]),He=t=>{let r=x(f,t),u=ot(r,L,Se),i=t===0,m=t===C-1;return(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,n.jsx)("button",{type:"button",onClick:Ie,disabled:!pe,"aria-label":B?.previousMonth??I.calendarPreviousMonth,className:(0,c.cn)("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",z[v],h.nav,!pe&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!i&&"invisible"),children:(0,n.jsx)(lt,{className:h.icon})}),Z==="dropdown"?(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("select",{"aria-label":B?.monthSelect??I.calendarMonth,value:r.getMonth(),disabled:y,onChange:o=>p(new Date(r.getFullYear(),Number(o.target.value)-t,1)),className:(0,c.cn)("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",z[v],h.select,y&&"cursor-not-allowed opacity-50"),children:Ke.map((o,b)=>(0,n.jsx)("option",{value:b,children:o},o))}),(0,n.jsx)("select",{"aria-label":B?.yearSelect??I.calendarYear,value:r.getFullYear(),disabled:y,onChange:o=>p(new Date(Number(o.target.value),r.getMonth()-t,1)),className:(0,c.cn)("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",z[v],h.select,y&&"cursor-not-allowed opacity-50"),children:je.map(o=>(0,n.jsx)("option",{value:o,children:o},o))})]}):(0,n.jsx)("div",{"aria-live":"polite",className:(0,c.cn)("font-semibold text-gray-900 dark:text-gray-100",h.caption),children:ve.format(r)}),(0,n.jsx)("button",{type:"button",onClick:We,disabled:!De,"aria-label":B?.nextMonth??I.calendarNextMonth,className:(0,c.cn)("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",z[v],h.nav,!De&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!m&&"invisible"),children:(0,n.jsx)(st,{className:h.icon})})]}),(0,n.jsxs)("table",{role:"grid","aria-label":ve.format(r),onKeyDown:ze,className:"border-collapse",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[ce&&(0,n.jsxs)("th",{scope:"col",className:(0,c.cn)("font-normal text-gray-400 dark:text-gray-500",h.head),children:[(0,n.jsx)("span",{className:"sr-only",children:B?.weekNumber??I.calendarWeekNumber}),(0,n.jsx)("span",{"aria-hidden":"true",children:"#"})]}),Ve.map(o=>(0,n.jsx)("th",{scope:"col",abbr:o.long,className:(0,c.cn)("font-medium uppercase text-gray-500 dark:text-gray-400",h.head),children:o.short},o.long))]})}),(0,n.jsx)("tbody",{children:u.map(o=>(0,n.jsxs)("tr",{children:[ce&&(0,n.jsx)("td",{className:(0,c.cn)("text-center align-middle text-gray-400 dark:text-gray-500",h.head),children:nt(o[0])}),o.map(b=>{let d=$e(b,r),H=J(b);if(d.outside&&!Me)return(0,n.jsx)("td",{className:"p-0"},H);let Je=N(b,Ee)&&!d.outside,le=d.inRange||d.rangeStart&&!!$||d.rangeEnd&&!!S?.from;return(0,n.jsx)("td",{role:"presentation",className:(0,c.cn)("p-0",le&&ut[v],le&&d.rangeStart&&"rounded-l-full",le&&d.rangeEnd&&"rounded-r-full"),children:(0,n.jsx)("button",{type:"button","data-day":H,"data-selected":d.selected||void 0,"data-today":d.today||void 0,"data-outside":d.outside||void 0,role:"gridcell",tabIndex:Je?0:-1,disabled:y,"aria-selected":d.selected,"aria-disabled":d.disabled||void 0,"aria-current":d.today?"date":void 0,"aria-label":_e.format(b),onClick:()=>{d.disabled||Be(b)},onMouseEnter:()=>a==="range"&&he(g(b)),onMouseLeave:()=>a==="range"&&he(null),onFocus:()=>U(g(b)),className:(0,c.cn)("inline-flex items-center justify-center rounded-full transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",z[v],h.day,d.selected?dt[v]:d.inRange?(0,c.cn)(ct[v],"hover:bg-gray-200/60 dark:hover:bg-gray-600/60"):d.today?(0,c.cn)(gt[v],"hover:bg-gray-100 dark:hover:bg-gray-700"):(0,c.cn)("text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),d.outside&&!d.selected&&"text-gray-400 dark:text-gray-500",d.disabled&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent"),children:ye?ye(b,d):b.getDate()})},H)})]},J(o[0])))})]})]},J(r))},Ge=(0,l.useCallback)(()=>{p(Y),U(Y),K(Y)||q(Y)},[Y,p,K,q]),Ue=(0,l.useCallback)(()=>{M(a==="multiple"?[]:a==="range"?{from:null,to:null}:null)},[a,M]),qe=!!be||ee||te;return(0,n.jsxs)("div",{ref:me,className:(0,c.cn)("inline-block bg-white dark:bg-gray-900",Ne&&"rounded-lg border border-gray-200 shadow-sm dark:border-gray-700",h.padding,y&&"opacity-60",Fe),...Re,children:[(0,n.jsx)("div",{className:(0,c.cn)("flex flex-wrap",h.gap),children:Array.from({length:C},(t,r)=>He(r))}),qe&&(0,n.jsxs)("div",{className:(0,c.cn)("mt-3 flex items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700",h.footer),children:[(0,n.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:be}),(ee||te)&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[ee&&(0,n.jsx)("button",{type:"button",onClick:Ge,disabled:y,className:(0,c.cn)("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",z[v],y&&"cursor-not-allowed opacity-50"),children:B?.today??I.calendarToday}),te&&(0,n.jsx)("button",{type:"button",onClick:Ue,disabled:y,className:(0,c.cn)("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",z[v],y&&"cursor-not-allowed opacity-50"),children:B?.clear??I.calendarClear})]})]})]})}0&&(module.exports={Calendar});
|
|
1
|
+
"use strict";"use client";var se=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ze=Object.prototype.hasOwnProperty;var et=(e,a)=>{for(var s in a)se(e,s,{get:a[s],enumerable:!0})},tt=(e,a,s,F)=>{if(a&&typeof a=="object"||typeof a=="function")for(let D of Xe(a))!Ze.call(e,D)&&D!==s&&se(e,D,{get:()=>a[D],enumerable:!(F=Qe(a,D))||F.enumerable});return e};var at=e=>tt(se({},"__esModule",{value:!0}),e);var bt={};et(bt,{Calendar:()=>ft});module.exports=at(bt);var l=require("react"),c=require("../../lib/cn.cjs"),we=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime"),rt=10080*60*1e3;function g(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function V(e){return new Date(e.getFullYear(),e.getMonth(),1)}function T(e,a){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+a)}function v(e,a){return new Date(e.getFullYear(),e.getMonth()+a,1)}function de(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function N(e,a){return!e||!a?!1:e.getFullYear()===a.getFullYear()&&e.getMonth()===a.getMonth()&&e.getDate()===a.getDate()}function ie(e,a){return e.getFullYear()===a.getFullYear()&&e.getMonth()===a.getMonth()}function E(e,a){return e.getFullYear()*12+e.getMonth()-(a.getFullYear()*12+a.getMonth())}function J(e){let a=`${e.getMonth()+1}`.padStart(2,"0"),s=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${a}-${s}`}function nt(e){let a=g(e);a.setDate(a.getDate()-(a.getDay()+6)%7+3);let s=new Date(a.getFullYear(),0,4);return s.setDate(s.getDate()-(s.getDay()+6)%7+3),1+Math.round((a.getTime()-s.getTime())/rt)}function ve(e,a,s){return a&&e<g(a)?g(a):s&&e>g(s)?g(s):e}function ot(e,a,s){let F=V(e),D=(F.getDay()-a+7)%7,_=T(F,-D),j=s?6:Math.ceil((D+de(e))/7);return Array.from({length:j},(X,G)=>Array.from({length:7},(ue,L)=>T(_,G*7+L)))}function lt({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function st({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}var it={sm:{day:"h-7 w-7 text-xs",head:"h-7 w-7 text-[10px]",caption:"text-xs",nav:"h-6 w-6",icon:"h-3 w-3",padding:"p-2",gap:"gap-3",footer:"text-xs",select:"text-xs py-0.5 pl-1 pr-5"},md:{day:"h-9 w-9 text-sm",head:"h-9 w-9 text-xs",caption:"text-sm",nav:"h-7 w-7",icon:"h-4 w-4",padding:"p-3",gap:"gap-4",footer:"text-sm",select:"text-sm py-1 pl-1.5 pr-6"},lg:{day:"h-11 w-11 text-base",head:"h-11 w-11 text-sm",caption:"text-base",nav:"h-9 w-9",icon:"h-5 w-5",padding:"p-4",gap:"gap-5",footer:"text-sm",select:"text-base py-1.5 pl-2 pr-7"}},dt={primary:"bg-blue-600 text-white hover:bg-blue-700",success:"bg-green-700 text-white hover:bg-green-800",warning:"bg-yellow-500 text-gray-900 hover:bg-yellow-600 dark:bg-yellow-400 dark:hover:bg-yellow-500",error:"bg-red-600 text-white hover:bg-red-700",info:"bg-cyan-700 text-white hover:bg-cyan-800",neutral:"bg-gray-700 text-white hover:bg-gray-800 dark:bg-gray-500 dark:hover:bg-gray-400"},ut={primary:"bg-blue-50 dark:bg-blue-900/30",success:"bg-green-50 dark:bg-green-900/30",warning:"bg-yellow-50 dark:bg-yellow-900/30",error:"bg-red-50 dark:bg-red-900/30",info:"bg-cyan-50 dark:bg-cyan-900/30",neutral:"bg-gray-100 dark:bg-gray-700/40"},ct={primary:"text-blue-900 dark:text-blue-100",success:"text-green-900 dark:text-green-100",warning:"text-yellow-900 dark:text-yellow-100",error:"text-red-900 dark:text-red-100",info:"text-cyan-900 dark:text-cyan-100",neutral:"text-gray-900 dark:text-gray-100"},gt={primary:"font-semibold text-blue-600 dark:text-blue-400",success:"font-semibold text-green-700 dark:text-green-400",warning:"font-semibold text-yellow-700 dark:text-yellow-400",error:"font-semibold text-red-600 dark:text-red-400",info:"font-semibold text-cyan-700 dark:text-cyan-400",neutral:"font-semibold text-gray-900 dark:text-gray-100"},z={primary:"focus-visible:ring-blue-500",success:"focus-visible:ring-green-500",warning:"focus-visible:ring-yellow-500",error:"focus-visible:ring-red-500",info:"focus-visible:ring-cyan-500",neutral:"focus-visible:ring-gray-500"};function Q(e,a){if(e==="multiple")return Array.isArray(a)?a.map(g):[];if(e==="range"){let s=a??null;return{from:s?.from?g(s.from):null,to:s?.to?g(s.to):null}}return a instanceof Date?g(a):null}function ke(e){return e?e instanceof Date?e:Array.isArray(e)?e[0]??null:e.from??e.to??null:null}function ft(e){let{mode:a="single",value:s,defaultValue:F,onChange:D,max:_,month:j,defaultMonth:X,onMonthChange:G,numberOfMonths:ue=1,weekStartsOn:L=0,locale:R,size:Ce="md",color:x="primary",minDate:k,maxDate:w,disabledDates:O,disabled:y=!1,showOutsideDays:Me=!0,showWeekNumbers:ce=!1,fixedWeeks:Se=!1,captionLayout:Z="label",fromYear:ge,toYear:fe,todayButton:ee=!1,clearButton:te=!1,footer:be,bordered:Ne=!0,renderDay:ye,labels:B,className:Fe,...Re}=e,I=(0,we.useUILabels)(),p=it[Ce],C=Math.max(1,ue),Y=(0,l.useMemo)(()=>g(new Date),[]),ae=s!==void 0,[Ye,Pe]=(0,l.useState)(()=>Q(a,F)),A=ae?Q(a,s):Ye,re=j!==void 0,[Te,Le]=(0,l.useState)(()=>V(X??ke(Q(a,F??s))??new Date)),f=re?V(j):Te,h=(0,l.useCallback)(t=>{let r=V(t);re||Le(r),G?.(r)},[re,G]),me=(0,l.useRef)(null),ne=(0,l.useRef)(!1),[W,U]=(0,l.useState)(()=>{let t=ke(Q(a,F??s)),r=V(X??j??t??new Date),u=t&&ie(t,r)?t:ie(g(new Date),r)?g(new Date):r;return ve(u,k,w)}),Ae=v(f,C-1),Ee=E(W,f)>=0&&E(W,Ae)<=0?W:f;(0,l.useEffect)(()=>{if(!ne.current)return;ne.current=!1,me.current?.querySelector(`[data-day="${J(W)}"]:not([data-outside])`)?.focus()},[W,f]);let P=(0,l.useCallback)(t=>{let r=ve(g(t),k,w);ne.current=!0,U(r);let u=v(f,C-1);E(r,f)<0?h(r):E(r,u)>0&&h(v(r,-(C-1)))},[f,C,k,w,h]),K=(0,l.useCallback)(t=>y||k&&t<g(k)||w&&t>g(w)?!0:typeof O=="function"?O(t):Array.isArray(O)?O.some(r=>N(r,t)):!1,[y,k,w,O]),[oe,pe]=(0,l.useState)(null),M=(0,l.useCallback)(t=>{ae||Pe(t),D?.(t)},[ae,D]),q=(0,l.useCallback)(t=>{let r=g(t);if(K(r))return;if(a==="multiple"){let i=A??[];if(i.some(o=>N(o,r))){M(i.filter(o=>!N(o,r)));return}if(_!==void 0&&i.length>=_)return;M([...i,r].sort((o,b)=>o.getTime()-b.getTime()));return}if(a==="range"){let i=A??{from:null,to:null};if(!i.from||i.to){M({from:r,to:null});return}M(r<i.from?{from:r,to:i.from}:{from:i.from,to:r});return}M(N(A,r)?null:r)},[a,A,_,M,K]),Be=(0,l.useCallback)(t=>{q(t),U(g(t)),E(t,f)<0?h(t):E(t,v(f,C-1))>0&&h(v(t,-(C-1)))},[q,f,C,h]),he=!y&&(!k||E(f,V(k))>0),De=!y&&(!w||E(v(f,C-1),V(w))<0),Ie=(0,l.useCallback)(()=>{h(v(f,-1))},[f,h]),We=(0,l.useCallback)(()=>{h(v(f,1))},[f,h]),ze=(0,l.useCallback)(t=>{if(y)return;let r=W;switch(t.key){case"ArrowLeft":t.preventDefault(),P(T(r,-1));break;case"ArrowRight":t.preventDefault(),P(T(r,1));break;case"ArrowUp":t.preventDefault(),P(T(r,-7));break;case"ArrowDown":t.preventDefault(),P(T(r,7));break;case"Home":t.preventDefault(),P(T(r,-((r.getDay()-L+7)%7)));break;case"End":t.preventDefault(),P(T(r,6-(r.getDay()-L+7)%7));break;case"PageUp":{t.preventDefault();let u=t.shiftKey?-12:-1,i=v(r,u),m=Math.min(r.getDate(),de(i));P(new Date(i.getFullYear(),i.getMonth(),m));break}case"PageDown":{t.preventDefault();let u=t.shiftKey?12:1,i=v(r,u),m=Math.min(r.getDate(),de(i));P(new Date(i.getFullYear(),i.getMonth(),m));break}default:break}},[y,W,P,L]),Ve=(0,l.useMemo)(()=>{let t=new Intl.DateTimeFormat(R,{weekday:"short"}),r=new Intl.DateTimeFormat(R,{weekday:"long"}),u=new Date(2024,0,7);return Array.from({length:7},(i,m)=>{let o=T(u,(L+m)%7);return{short:t.format(o),long:r.format(o)}})},[R,L]),Ke=(0,l.useMemo)(()=>{let t=new Intl.DateTimeFormat(R,{month:"long"});return Array.from({length:12},(r,u)=>t.format(new Date(2024,u,1)))},[R]),xe=(0,l.useMemo)(()=>new Intl.DateTimeFormat(R,{month:"long",year:"numeric"}),[R]),_e=(0,l.useMemo)(()=>new Intl.DateTimeFormat(R,{dateStyle:"full"}),[R]),je=(0,l.useMemo)(()=>{if(Z!=="dropdown")return[];let t=Y.getFullYear(),r=ge??k?.getFullYear()??t-100,u=fe??w?.getFullYear()??t+10;return u<r?[r]:Array.from({length:u-r+1},(i,m)=>r+m)},[Z,ge,fe,k,w,Y]),S=a==="range"?A:null,Oe=S&&S.from&&!S.to&&oe&&oe>S.from?oe:null,$=S?.to??Oe,$e=(0,l.useCallback)((t,r)=>{let u=!ie(t,r),i=K(t),m=!1,o=!1,b=!1,d=!1;return a==="multiple"?m=(A??[]).some(H=>N(H,t)):a==="range"?(o=N(S?.from,t),b=N($,t),m=o||b,d=!!(S?.from&&$&&t>S.from&&t<$)):m=N(A,t),{selected:m,today:N(t,Y),outside:u,disabled:i,rangeStart:o,rangeEnd:b,inRange:d}},[a,A,S,$,K,Y]),He=t=>{let r=v(f,t),u=ot(r,L,Se),i=t===0,m=t===C-1;return(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,n.jsx)("button",{type:"button",onClick:Ie,disabled:!he,"aria-label":B?.previousMonth??I.calendarPreviousMonth,className:(0,c.cn)("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",z[x],p.nav,!he&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!i&&"invisible"),children:(0,n.jsx)(lt,{className:p.icon})}),Z==="dropdown"?(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("select",{"aria-label":B?.monthSelect??I.calendarMonth,value:r.getMonth(),disabled:y,onChange:o=>h(new Date(r.getFullYear(),Number(o.target.value)-t,1)),className:(0,c.cn)("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",z[x],p.select,y&&"cursor-not-allowed opacity-50"),children:Ke.map((o,b)=>(0,n.jsx)("option",{value:b,children:o},o))}),(0,n.jsx)("select",{"aria-label":B?.yearSelect??I.calendarYear,value:r.getFullYear(),disabled:y,onChange:o=>h(new Date(Number(o.target.value),r.getMonth()-t,1)),className:(0,c.cn)("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",z[x],p.select,y&&"cursor-not-allowed opacity-50"),children:je.map(o=>(0,n.jsx)("option",{value:o,children:o},o))})]}):(0,n.jsx)("div",{"aria-live":"polite",className:(0,c.cn)("font-semibold text-gray-900 dark:text-gray-100",p.caption),children:xe.format(r)}),(0,n.jsx)("button",{type:"button",onClick:We,disabled:!De,"aria-label":B?.nextMonth??I.calendarNextMonth,className:(0,c.cn)("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",z[x],p.nav,!De&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!m&&"invisible"),children:(0,n.jsx)(st,{className:p.icon})})]}),(0,n.jsxs)("table",{role:"grid","aria-label":xe.format(r),onKeyDown:ze,className:"border-collapse",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[ce&&(0,n.jsxs)("th",{scope:"col",className:(0,c.cn)("font-normal text-gray-500 dark:text-gray-400",p.head),children:[(0,n.jsx)("span",{className:"sr-only",children:B?.weekNumber??I.calendarWeekNumber}),(0,n.jsx)("span",{"aria-hidden":"true",children:"#"})]}),Ve.map(o=>(0,n.jsx)("th",{scope:"col",abbr:o.long,className:(0,c.cn)("font-medium uppercase text-gray-500 dark:text-gray-400",p.head),children:o.short},o.long))]})}),(0,n.jsx)("tbody",{children:u.map(o=>(0,n.jsxs)("tr",{children:[ce&&(0,n.jsx)("td",{className:(0,c.cn)("text-center align-middle text-gray-500 dark:text-gray-400",p.head),children:nt(o[0])}),o.map(b=>{let d=$e(b,r),H=J(b);if(d.outside&&!Me)return(0,n.jsx)("td",{className:"p-0"},H);let Je=N(b,Ee)&&!d.outside,le=d.inRange||d.rangeStart&&!!$||d.rangeEnd&&!!S?.from;return(0,n.jsx)("td",{role:"presentation",className:(0,c.cn)("p-0",le&&ut[x],le&&d.rangeStart&&"rounded-l-full",le&&d.rangeEnd&&"rounded-r-full"),children:(0,n.jsx)("button",{type:"button","data-day":H,"data-selected":d.selected||void 0,"data-today":d.today||void 0,"data-outside":d.outside||void 0,role:"gridcell",tabIndex:Je?0:-1,disabled:y,"aria-selected":d.selected,"aria-disabled":d.disabled||void 0,"aria-current":d.today?"date":void 0,"aria-label":_e.format(b),onClick:()=>{d.disabled||Be(b)},onMouseEnter:()=>a==="range"&&pe(g(b)),onMouseLeave:()=>a==="range"&&pe(null),onFocus:()=>U(g(b)),className:(0,c.cn)("inline-flex items-center justify-center rounded-full transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",z[x],p.day,d.selected?dt[x]:d.inRange?(0,c.cn)(ct[x],"hover:bg-gray-200/60 dark:hover:bg-gray-600/60"):d.today?(0,c.cn)(gt[x],"hover:bg-gray-100 dark:hover:bg-gray-700"):(0,c.cn)("text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),d.outside&&!d.selected&&"text-gray-500 dark:text-gray-400",d.disabled&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent"),children:ye?ye(b,d):b.getDate()})},H)})]},J(o[0])))})]})]},J(r))},Ge=(0,l.useCallback)(()=>{h(Y),U(Y),K(Y)||q(Y)},[Y,h,K,q]),Ue=(0,l.useCallback)(()=>{M(a==="multiple"?[]:a==="range"?{from:null,to:null}:null)},[a,M]),qe=!!be||ee||te;return(0,n.jsxs)("div",{ref:me,className:(0,c.cn)("inline-block bg-white dark:bg-gray-900",Ne&&"rounded-lg border border-gray-200 shadow-sm dark:border-gray-700",p.padding,y&&"opacity-60",Fe),...Re,children:[(0,n.jsx)("div",{className:(0,c.cn)("flex flex-wrap",p.gap),children:Array.from({length:C},(t,r)=>He(r))}),qe&&(0,n.jsxs)("div",{className:(0,c.cn)("mt-3 flex items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700",p.footer),children:[(0,n.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:be}),(ee||te)&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[ee&&(0,n.jsx)("button",{type:"button",onClick:Ge,disabled:y,className:(0,c.cn)("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",z[x],y&&"cursor-not-allowed opacity-50"),children:B?.today??I.calendarToday}),te&&(0,n.jsx)("button",{type:"button",onClick:Ue,disabled:y,className:(0,c.cn)("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",z[x],y&&"cursor-not-allowed opacity-50"),children:B?.clear??I.calendarClear})]})]})]})}0&&(module.exports={Calendar});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as p,useEffect as Ze,useMemo as _,useRef as we,useState as X}from"react";import{cn as c}from"../../lib/cn.js";import{useUILabels as et}from"../../lib/i18n.js";import{jsx as o,jsxs as N}from"react/jsx-runtime";var tt=10080*60*1e3;function u(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())}function z(a){return new Date(a.getFullYear(),a.getMonth(),1)}function P(a,r){return new Date(a.getFullYear(),a.getMonth(),a.getDate()+r)}function v(a,r){return new Date(a.getFullYear(),a.getMonth()+r,1)}function ce(a){return new Date(a.getFullYear(),a.getMonth()+1,0).getDate()}function S(a,r){return!a||!r?!1:a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()&&a.getDate()===r.getDate()}function ue(a,r){return a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()}function A(a,r){return a.getFullYear()*12+a.getMonth()-(r.getFullYear()*12+r.getMonth())}function Z(a){let r=`${a.getMonth()+1}`.padStart(2,"0"),i=`${a.getDate()}`.padStart(2,"0");return`${a.getFullYear()}-${r}-${i}`}function at(a){let r=u(a);r.setDate(r.getDate()-(r.getDay()+6)%7+3);let i=new Date(r.getFullYear(),0,4);return i.setDate(i.getDate()-(i.getDay()+6)%7+3),1+Math.round((r.getTime()-i.getTime())/tt)}function Ce(a,r,i){return r&&a<u(r)?u(r):i&&a>u(i)?u(i):a}function rt(a,r,i){let V=z(a),j=(V.getDay()-r+7)%7,O=P(V,-j),$=i?6:Math.ceil((j+ce(a))/7);return Array.from({length:$},(te,q)=>Array.from({length:7},(ge,T)=>P(O,q*7+T)))}function nt({className:a}){return o("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function ot({className:a}){return o("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}var lt={sm:{day:"h-7 w-7 text-xs",head:"h-7 w-7 text-[10px]",caption:"text-xs",nav:"h-6 w-6",icon:"h-3 w-3",padding:"p-2",gap:"gap-3",footer:"text-xs",select:"text-xs py-0.5 pl-1 pr-5"},md:{day:"h-9 w-9 text-sm",head:"h-9 w-9 text-xs",caption:"text-sm",nav:"h-7 w-7",icon:"h-4 w-4",padding:"p-3",gap:"gap-4",footer:"text-sm",select:"text-sm py-1 pl-1.5 pr-6"},lg:{day:"h-11 w-11 text-base",head:"h-11 w-11 text-sm",caption:"text-base",nav:"h-9 w-9",icon:"h-5 w-5",padding:"p-4",gap:"gap-5",footer:"text-sm",select:"text-base py-1.5 pl-2 pr-7"}},st={primary:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",success:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600",warning:"bg-yellow-500 text-gray-900 hover:bg-yellow-600 dark:bg-yellow-400 dark:hover:bg-yellow-500",error:"bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600",info:"bg-cyan-600 text-white hover:bg-cyan-700 dark:bg-cyan-500 dark:hover:bg-cyan-600",neutral:"bg-gray-700 text-white hover:bg-gray-800 dark:bg-gray-500 dark:hover:bg-gray-400"},it={primary:"bg-blue-50 dark:bg-blue-900/30",success:"bg-green-50 dark:bg-green-900/30",warning:"bg-yellow-50 dark:bg-yellow-900/30",error:"bg-red-50 dark:bg-red-900/30",info:"bg-cyan-50 dark:bg-cyan-900/30",neutral:"bg-gray-100 dark:bg-gray-700/40"},dt={primary:"text-blue-900 dark:text-blue-100",success:"text-green-900 dark:text-green-100",warning:"text-yellow-900 dark:text-yellow-100",error:"text-red-900 dark:text-red-100",info:"text-cyan-900 dark:text-cyan-100",neutral:"text-gray-900 dark:text-gray-100"},ut={primary:"font-semibold text-blue-600 dark:text-blue-400",success:"font-semibold text-green-600 dark:text-green-400",warning:"font-semibold text-yellow-600 dark:text-yellow-400",error:"font-semibold text-red-600 dark:text-red-400",info:"font-semibold text-cyan-600 dark:text-cyan-400",neutral:"font-semibold text-gray-900 dark:text-gray-100"},W={primary:"focus-visible:ring-blue-500",success:"focus-visible:ring-green-500",warning:"focus-visible:ring-yellow-500",error:"focus-visible:ring-red-500",info:"focus-visible:ring-cyan-500",neutral:"focus-visible:ring-gray-500"};function ee(a,r){if(a==="multiple")return Array.isArray(r)?r.map(u):[];if(a==="range"){let i=r??null;return{from:i?.from?u(i.from):null,to:i?.to?u(i.to):null}}return r instanceof Date?u(r):null}function Me(a){return a?a instanceof Date?a:Array.isArray(a)?a[0]??null:a.from??a.to??null:null}function yt(a){let{mode:r="single",value:i,defaultValue:V,onChange:j,max:O,month:$,defaultMonth:te,onMonthChange:q,numberOfMonths:ge=1,weekStartsOn:T=0,locale:F,size:Se="md",color:D="primary",minDate:x,maxDate:k,disabledDates:H,disabled:b=!1,showOutsideDays:Ne=!0,showWeekNumbers:fe=!1,fixedWeeks:Fe=!1,captionLayout:ae="label",fromYear:be,toYear:ye,todayButton:re=!1,clearButton:ne=!1,footer:me,bordered:Re=!0,renderDay:he,labels:E,className:Ye,...Pe}=a,B=et(),m=lt[Se],w=Math.max(1,ge),R=_(()=>u(new Date),[]),oe=i!==void 0,[Te,Le]=X(()=>ee(r,V)),L=oe?ee(r,i):Te,le=$!==void 0,[Ae,Ee]=X(()=>z(te??Me(ee(r,V??i))??new Date)),g=le?z($):Ae,h=p(e=>{let t=z(e);le||Ee(t),q?.(t)},[le,q]),pe=we(null),se=we(!1),[I,J]=X(()=>{let e=Me(ee(r,V??i)),t=z(te??$??e??new Date),d=e&&ue(e,t)?e:ue(u(new Date),t)?u(new Date):t;return Ce(d,x,k)}),Be=v(g,w-1),Ie=A(I,g)>=0&&A(I,Be)<=0?I:g;Ze(()=>{if(!se.current)return;se.current=!1,pe.current?.querySelector(`[data-day="${Z(I)}"]:not([data-outside])`)?.focus()},[I,g]);let Y=p(e=>{let t=Ce(u(e),x,k);se.current=!0,J(t);let d=v(g,w-1);A(t,g)<0?h(t):A(t,d)>0&&h(v(t,-(w-1)))},[g,w,x,k,h]),K=p(e=>b||x&&e<u(x)||k&&e>u(k)?!0:typeof H=="function"?H(e):Array.isArray(H)?H.some(t=>S(t,e)):!1,[b,x,k,H]),[ie,De]=X(null),C=p(e=>{oe||Le(e),j?.(e)},[oe,j]),Q=p(e=>{let t=u(e);if(K(t))return;if(r==="multiple"){let l=L??[];if(l.some(n=>S(n,t))){C(l.filter(n=>!S(n,t)));return}if(O!==void 0&&l.length>=O)return;C([...l,t].sort((n,f)=>n.getTime()-f.getTime()));return}if(r==="range"){let l=L??{from:null,to:null};if(!l.from||l.to){C({from:t,to:null});return}C(t<l.from?{from:t,to:l.from}:{from:l.from,to:t});return}C(S(L,t)?null:t)},[r,L,O,C,K]),We=p(e=>{Q(e),J(u(e)),A(e,g)<0?h(e):A(e,v(g,w-1))>0&&h(v(e,-(w-1)))},[Q,g,w,h]),ve=!b&&(!x||A(g,z(x))>0),xe=!b&&(!k||A(v(g,w-1),z(k))<0),ze=p(()=>{h(v(g,-1))},[g,h]),Ve=p(()=>{h(v(g,1))},[g,h]),Ke=p(e=>{if(b)return;let t=I;switch(e.key){case"ArrowLeft":e.preventDefault(),Y(P(t,-1));break;case"ArrowRight":e.preventDefault(),Y(P(t,1));break;case"ArrowUp":e.preventDefault(),Y(P(t,-7));break;case"ArrowDown":e.preventDefault(),Y(P(t,7));break;case"Home":e.preventDefault(),Y(P(t,-((t.getDay()-T+7)%7)));break;case"End":e.preventDefault(),Y(P(t,6-(t.getDay()-T+7)%7));break;case"PageUp":{e.preventDefault();let d=e.shiftKey?-12:-1,l=v(t,d),y=Math.min(t.getDate(),ce(l));Y(new Date(l.getFullYear(),l.getMonth(),y));break}case"PageDown":{e.preventDefault();let d=e.shiftKey?12:1,l=v(t,d),y=Math.min(t.getDate(),ce(l));Y(new Date(l.getFullYear(),l.getMonth(),y));break}default:break}},[b,I,Y,T]),_e=_(()=>{let e=new Intl.DateTimeFormat(F,{weekday:"short"}),t=new Intl.DateTimeFormat(F,{weekday:"long"}),d=new Date(2024,0,7);return Array.from({length:7},(l,y)=>{let n=P(d,(T+y)%7);return{short:e.format(n),long:t.format(n)}})},[F,T]),je=_(()=>{let e=new Intl.DateTimeFormat(F,{month:"long"});return Array.from({length:12},(t,d)=>e.format(new Date(2024,d,1)))},[F]),ke=_(()=>new Intl.DateTimeFormat(F,{month:"long",year:"numeric"}),[F]),Oe=_(()=>new Intl.DateTimeFormat(F,{dateStyle:"full"}),[F]),$e=_(()=>{if(ae!=="dropdown")return[];let e=R.getFullYear(),t=be??x?.getFullYear()??e-100,d=ye??k?.getFullYear()??e+10;return d<t?[t]:Array.from({length:d-t+1},(l,y)=>t+y)},[ae,be,ye,x,k,R]),M=r==="range"?L:null,He=M&&M.from&&!M.to&&ie&&ie>M.from?ie:null,G=M?.to??He,Ge=p((e,t)=>{let d=!ue(e,t),l=K(e),y=!1,n=!1,f=!1,s=!1;return r==="multiple"?y=(L??[]).some(U=>S(U,e)):r==="range"?(n=S(M?.from,e),f=S(G,e),y=n||f,s=!!(M?.from&&G&&e>M.from&&e<G)):y=S(L,e),{selected:y,today:S(e,R),outside:d,disabled:l,rangeStart:n,rangeEnd:f,inRange:s}},[r,L,M,G,K,R]),Ue=e=>{let t=v(g,e),d=rt(t,T,Fe),l=e===0,y=e===w-1;return N("div",{className:"flex flex-col",children:[N("div",{className:"mb-2 flex items-center justify-between",children:[o("button",{type:"button",onClick:ze,disabled:!ve,"aria-label":E?.previousMonth??B.calendarPreviousMonth,className:c("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",W[D],m.nav,!ve&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!l&&"invisible"),children:o(nt,{className:m.icon})}),ae==="dropdown"?N("div",{className:"flex items-center gap-1",children:[o("select",{"aria-label":E?.monthSelect??B.calendarMonth,value:t.getMonth(),disabled:b,onChange:n=>h(new Date(t.getFullYear(),Number(n.target.value)-e,1)),className:c("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",W[D],m.select,b&&"cursor-not-allowed opacity-50"),children:je.map((n,f)=>o("option",{value:f,children:n},n))}),o("select",{"aria-label":E?.yearSelect??B.calendarYear,value:t.getFullYear(),disabled:b,onChange:n=>h(new Date(Number(n.target.value),t.getMonth()-e,1)),className:c("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",W[D],m.select,b&&"cursor-not-allowed opacity-50"),children:$e.map(n=>o("option",{value:n,children:n},n))})]}):o("div",{"aria-live":"polite",className:c("font-semibold text-gray-900 dark:text-gray-100",m.caption),children:ke.format(t)}),o("button",{type:"button",onClick:Ve,disabled:!xe,"aria-label":E?.nextMonth??B.calendarNextMonth,className:c("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",W[D],m.nav,!xe&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!y&&"invisible"),children:o(ot,{className:m.icon})})]}),N("table",{role:"grid","aria-label":ke.format(t),onKeyDown:Ke,className:"border-collapse",children:[o("thead",{children:N("tr",{children:[fe&&N("th",{scope:"col",className:c("font-normal text-gray-400 dark:text-gray-500",m.head),children:[o("span",{className:"sr-only",children:E?.weekNumber??B.calendarWeekNumber}),o("span",{"aria-hidden":"true",children:"#"})]}),_e.map(n=>o("th",{scope:"col",abbr:n.long,className:c("font-medium uppercase text-gray-500 dark:text-gray-400",m.head),children:n.short},n.long))]})}),o("tbody",{children:d.map(n=>N("tr",{children:[fe&&o("td",{className:c("text-center align-middle text-gray-400 dark:text-gray-500",m.head),children:at(n[0])}),n.map(f=>{let s=Ge(f,t),U=Z(f);if(s.outside&&!Ne)return o("td",{className:"p-0"},U);let Xe=S(f,Ie)&&!s.outside,de=s.inRange||s.rangeStart&&!!G||s.rangeEnd&&!!M?.from;return o("td",{role:"presentation",className:c("p-0",de&&it[D],de&&s.rangeStart&&"rounded-l-full",de&&s.rangeEnd&&"rounded-r-full"),children:o("button",{type:"button","data-day":U,"data-selected":s.selected||void 0,"data-today":s.today||void 0,"data-outside":s.outside||void 0,role:"gridcell",tabIndex:Xe?0:-1,disabled:b,"aria-selected":s.selected,"aria-disabled":s.disabled||void 0,"aria-current":s.today?"date":void 0,"aria-label":Oe.format(f),onClick:()=>{s.disabled||We(f)},onMouseEnter:()=>r==="range"&&De(u(f)),onMouseLeave:()=>r==="range"&&De(null),onFocus:()=>J(u(f)),className:c("inline-flex items-center justify-center rounded-full transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",W[D],m.day,s.selected?st[D]:s.inRange?c(dt[D],"hover:bg-gray-200/60 dark:hover:bg-gray-600/60"):s.today?c(ut[D],"hover:bg-gray-100 dark:hover:bg-gray-700"):c("text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),s.outside&&!s.selected&&"text-gray-400 dark:text-gray-500",s.disabled&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent"),children:he?he(f,s):f.getDate()})},U)})]},Z(n[0])))})]})]},Z(t))},qe=p(()=>{h(R),J(R),K(R)||Q(R)},[R,h,K,Q]),Je=p(()=>{C(r==="multiple"?[]:r==="range"?{from:null,to:null}:null)},[r,C]),Qe=!!me||re||ne;return N("div",{ref:pe,className:c("inline-block bg-white dark:bg-gray-900",Re&&"rounded-lg border border-gray-200 shadow-sm dark:border-gray-700",m.padding,b&&"opacity-60",Ye),...Pe,children:[o("div",{className:c("flex flex-wrap",m.gap),children:Array.from({length:w},(e,t)=>Ue(t))}),Qe&&N("div",{className:c("mt-3 flex items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700",m.footer),children:[o("div",{className:"text-gray-600 dark:text-gray-400",children:me}),(re||ne)&&N("div",{className:"flex items-center gap-2",children:[re&&o("button",{type:"button",onClick:qe,disabled:b,className:c("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",W[D],b&&"cursor-not-allowed opacity-50"),children:E?.today??B.calendarToday}),ne&&o("button",{type:"button",onClick:Je,disabled:b,className:c("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",W[D],b&&"cursor-not-allowed opacity-50"),children:E?.clear??B.calendarClear})]})]})]})}export{yt as Calendar};
|
|
1
|
+
"use client";import{useCallback as h,useEffect as Ze,useMemo as _,useRef as we,useState as X}from"react";import{cn as c}from"../../lib/cn.js";import{useUILabels as et}from"../../lib/i18n.js";import{jsx as o,jsxs as N}from"react/jsx-runtime";var tt=10080*60*1e3;function u(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())}function z(a){return new Date(a.getFullYear(),a.getMonth(),1)}function P(a,r){return new Date(a.getFullYear(),a.getMonth(),a.getDate()+r)}function x(a,r){return new Date(a.getFullYear(),a.getMonth()+r,1)}function ce(a){return new Date(a.getFullYear(),a.getMonth()+1,0).getDate()}function S(a,r){return!a||!r?!1:a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()&&a.getDate()===r.getDate()}function ue(a,r){return a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()}function A(a,r){return a.getFullYear()*12+a.getMonth()-(r.getFullYear()*12+r.getMonth())}function Z(a){let r=`${a.getMonth()+1}`.padStart(2,"0"),i=`${a.getDate()}`.padStart(2,"0");return`${a.getFullYear()}-${r}-${i}`}function at(a){let r=u(a);r.setDate(r.getDate()-(r.getDay()+6)%7+3);let i=new Date(r.getFullYear(),0,4);return i.setDate(i.getDate()-(i.getDay()+6)%7+3),1+Math.round((r.getTime()-i.getTime())/tt)}function Ce(a,r,i){return r&&a<u(r)?u(r):i&&a>u(i)?u(i):a}function rt(a,r,i){let V=z(a),j=(V.getDay()-r+7)%7,O=P(V,-j),$=i?6:Math.ceil((j+ce(a))/7);return Array.from({length:$},(te,q)=>Array.from({length:7},(ge,T)=>P(O,q*7+T)))}function nt({className:a}){return o("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function ot({className:a}){return o("svg",{className:a,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}var lt={sm:{day:"h-7 w-7 text-xs",head:"h-7 w-7 text-[10px]",caption:"text-xs",nav:"h-6 w-6",icon:"h-3 w-3",padding:"p-2",gap:"gap-3",footer:"text-xs",select:"text-xs py-0.5 pl-1 pr-5"},md:{day:"h-9 w-9 text-sm",head:"h-9 w-9 text-xs",caption:"text-sm",nav:"h-7 w-7",icon:"h-4 w-4",padding:"p-3",gap:"gap-4",footer:"text-sm",select:"text-sm py-1 pl-1.5 pr-6"},lg:{day:"h-11 w-11 text-base",head:"h-11 w-11 text-sm",caption:"text-base",nav:"h-9 w-9",icon:"h-5 w-5",padding:"p-4",gap:"gap-5",footer:"text-sm",select:"text-base py-1.5 pl-2 pr-7"}},st={primary:"bg-blue-600 text-white hover:bg-blue-700",success:"bg-green-700 text-white hover:bg-green-800",warning:"bg-yellow-500 text-gray-900 hover:bg-yellow-600 dark:bg-yellow-400 dark:hover:bg-yellow-500",error:"bg-red-600 text-white hover:bg-red-700",info:"bg-cyan-700 text-white hover:bg-cyan-800",neutral:"bg-gray-700 text-white hover:bg-gray-800 dark:bg-gray-500 dark:hover:bg-gray-400"},it={primary:"bg-blue-50 dark:bg-blue-900/30",success:"bg-green-50 dark:bg-green-900/30",warning:"bg-yellow-50 dark:bg-yellow-900/30",error:"bg-red-50 dark:bg-red-900/30",info:"bg-cyan-50 dark:bg-cyan-900/30",neutral:"bg-gray-100 dark:bg-gray-700/40"},dt={primary:"text-blue-900 dark:text-blue-100",success:"text-green-900 dark:text-green-100",warning:"text-yellow-900 dark:text-yellow-100",error:"text-red-900 dark:text-red-100",info:"text-cyan-900 dark:text-cyan-100",neutral:"text-gray-900 dark:text-gray-100"},ut={primary:"font-semibold text-blue-600 dark:text-blue-400",success:"font-semibold text-green-700 dark:text-green-400",warning:"font-semibold text-yellow-700 dark:text-yellow-400",error:"font-semibold text-red-600 dark:text-red-400",info:"font-semibold text-cyan-700 dark:text-cyan-400",neutral:"font-semibold text-gray-900 dark:text-gray-100"},W={primary:"focus-visible:ring-blue-500",success:"focus-visible:ring-green-500",warning:"focus-visible:ring-yellow-500",error:"focus-visible:ring-red-500",info:"focus-visible:ring-cyan-500",neutral:"focus-visible:ring-gray-500"};function ee(a,r){if(a==="multiple")return Array.isArray(r)?r.map(u):[];if(a==="range"){let i=r??null;return{from:i?.from?u(i.from):null,to:i?.to?u(i.to):null}}return r instanceof Date?u(r):null}function Me(a){return a?a instanceof Date?a:Array.isArray(a)?a[0]??null:a.from??a.to??null:null}function yt(a){let{mode:r="single",value:i,defaultValue:V,onChange:j,max:O,month:$,defaultMonth:te,onMonthChange:q,numberOfMonths:ge=1,weekStartsOn:T=0,locale:F,size:Se="md",color:D="primary",minDate:v,maxDate:k,disabledDates:H,disabled:b=!1,showOutsideDays:Ne=!0,showWeekNumbers:fe=!1,fixedWeeks:Fe=!1,captionLayout:ae="label",fromYear:be,toYear:ye,todayButton:re=!1,clearButton:ne=!1,footer:me,bordered:Re=!0,renderDay:pe,labels:E,className:Ye,...Pe}=a,B=et(),m=lt[Se],w=Math.max(1,ge),R=_(()=>u(new Date),[]),oe=i!==void 0,[Te,Le]=X(()=>ee(r,V)),L=oe?ee(r,i):Te,le=$!==void 0,[Ae,Ee]=X(()=>z(te??Me(ee(r,V??i))??new Date)),g=le?z($):Ae,p=h(e=>{let t=z(e);le||Ee(t),q?.(t)},[le,q]),he=we(null),se=we(!1),[I,J]=X(()=>{let e=Me(ee(r,V??i)),t=z(te??$??e??new Date),d=e&&ue(e,t)?e:ue(u(new Date),t)?u(new Date):t;return Ce(d,v,k)}),Be=x(g,w-1),Ie=A(I,g)>=0&&A(I,Be)<=0?I:g;Ze(()=>{if(!se.current)return;se.current=!1,he.current?.querySelector(`[data-day="${Z(I)}"]:not([data-outside])`)?.focus()},[I,g]);let Y=h(e=>{let t=Ce(u(e),v,k);se.current=!0,J(t);let d=x(g,w-1);A(t,g)<0?p(t):A(t,d)>0&&p(x(t,-(w-1)))},[g,w,v,k,p]),K=h(e=>b||v&&e<u(v)||k&&e>u(k)?!0:typeof H=="function"?H(e):Array.isArray(H)?H.some(t=>S(t,e)):!1,[b,v,k,H]),[ie,De]=X(null),C=h(e=>{oe||Le(e),j?.(e)},[oe,j]),Q=h(e=>{let t=u(e);if(K(t))return;if(r==="multiple"){let l=L??[];if(l.some(n=>S(n,t))){C(l.filter(n=>!S(n,t)));return}if(O!==void 0&&l.length>=O)return;C([...l,t].sort((n,f)=>n.getTime()-f.getTime()));return}if(r==="range"){let l=L??{from:null,to:null};if(!l.from||l.to){C({from:t,to:null});return}C(t<l.from?{from:t,to:l.from}:{from:l.from,to:t});return}C(S(L,t)?null:t)},[r,L,O,C,K]),We=h(e=>{Q(e),J(u(e)),A(e,g)<0?p(e):A(e,x(g,w-1))>0&&p(x(e,-(w-1)))},[Q,g,w,p]),xe=!b&&(!v||A(g,z(v))>0),ve=!b&&(!k||A(x(g,w-1),z(k))<0),ze=h(()=>{p(x(g,-1))},[g,p]),Ve=h(()=>{p(x(g,1))},[g,p]),Ke=h(e=>{if(b)return;let t=I;switch(e.key){case"ArrowLeft":e.preventDefault(),Y(P(t,-1));break;case"ArrowRight":e.preventDefault(),Y(P(t,1));break;case"ArrowUp":e.preventDefault(),Y(P(t,-7));break;case"ArrowDown":e.preventDefault(),Y(P(t,7));break;case"Home":e.preventDefault(),Y(P(t,-((t.getDay()-T+7)%7)));break;case"End":e.preventDefault(),Y(P(t,6-(t.getDay()-T+7)%7));break;case"PageUp":{e.preventDefault();let d=e.shiftKey?-12:-1,l=x(t,d),y=Math.min(t.getDate(),ce(l));Y(new Date(l.getFullYear(),l.getMonth(),y));break}case"PageDown":{e.preventDefault();let d=e.shiftKey?12:1,l=x(t,d),y=Math.min(t.getDate(),ce(l));Y(new Date(l.getFullYear(),l.getMonth(),y));break}default:break}},[b,I,Y,T]),_e=_(()=>{let e=new Intl.DateTimeFormat(F,{weekday:"short"}),t=new Intl.DateTimeFormat(F,{weekday:"long"}),d=new Date(2024,0,7);return Array.from({length:7},(l,y)=>{let n=P(d,(T+y)%7);return{short:e.format(n),long:t.format(n)}})},[F,T]),je=_(()=>{let e=new Intl.DateTimeFormat(F,{month:"long"});return Array.from({length:12},(t,d)=>e.format(new Date(2024,d,1)))},[F]),ke=_(()=>new Intl.DateTimeFormat(F,{month:"long",year:"numeric"}),[F]),Oe=_(()=>new Intl.DateTimeFormat(F,{dateStyle:"full"}),[F]),$e=_(()=>{if(ae!=="dropdown")return[];let e=R.getFullYear(),t=be??v?.getFullYear()??e-100,d=ye??k?.getFullYear()??e+10;return d<t?[t]:Array.from({length:d-t+1},(l,y)=>t+y)},[ae,be,ye,v,k,R]),M=r==="range"?L:null,He=M&&M.from&&!M.to&&ie&&ie>M.from?ie:null,G=M?.to??He,Ge=h((e,t)=>{let d=!ue(e,t),l=K(e),y=!1,n=!1,f=!1,s=!1;return r==="multiple"?y=(L??[]).some(U=>S(U,e)):r==="range"?(n=S(M?.from,e),f=S(G,e),y=n||f,s=!!(M?.from&&G&&e>M.from&&e<G)):y=S(L,e),{selected:y,today:S(e,R),outside:d,disabled:l,rangeStart:n,rangeEnd:f,inRange:s}},[r,L,M,G,K,R]),Ue=e=>{let t=x(g,e),d=rt(t,T,Fe),l=e===0,y=e===w-1;return N("div",{className:"flex flex-col",children:[N("div",{className:"mb-2 flex items-center justify-between",children:[o("button",{type:"button",onClick:ze,disabled:!xe,"aria-label":E?.previousMonth??B.calendarPreviousMonth,className:c("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",W[D],m.nav,!xe&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!l&&"invisible"),children:o(nt,{className:m.icon})}),ae==="dropdown"?N("div",{className:"flex items-center gap-1",children:[o("select",{"aria-label":E?.monthSelect??B.calendarMonth,value:t.getMonth(),disabled:b,onChange:n=>p(new Date(t.getFullYear(),Number(n.target.value)-e,1)),className:c("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",W[D],m.select,b&&"cursor-not-allowed opacity-50"),children:je.map((n,f)=>o("option",{value:f,children:n},n))}),o("select",{"aria-label":E?.yearSelect??B.calendarYear,value:t.getFullYear(),disabled:b,onChange:n=>p(new Date(Number(n.target.value),t.getMonth()-e,1)),className:c("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",W[D],m.select,b&&"cursor-not-allowed opacity-50"),children:$e.map(n=>o("option",{value:n,children:n},n))})]}):o("div",{"aria-live":"polite",className:c("font-semibold text-gray-900 dark:text-gray-100",m.caption),children:ke.format(t)}),o("button",{type:"button",onClick:Ve,disabled:!ve,"aria-label":E?.nextMonth??B.calendarNextMonth,className:c("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",W[D],m.nav,!ve&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!y&&"invisible"),children:o(ot,{className:m.icon})})]}),N("table",{role:"grid","aria-label":ke.format(t),onKeyDown:Ke,className:"border-collapse",children:[o("thead",{children:N("tr",{children:[fe&&N("th",{scope:"col",className:c("font-normal text-gray-500 dark:text-gray-400",m.head),children:[o("span",{className:"sr-only",children:E?.weekNumber??B.calendarWeekNumber}),o("span",{"aria-hidden":"true",children:"#"})]}),_e.map(n=>o("th",{scope:"col",abbr:n.long,className:c("font-medium uppercase text-gray-500 dark:text-gray-400",m.head),children:n.short},n.long))]})}),o("tbody",{children:d.map(n=>N("tr",{children:[fe&&o("td",{className:c("text-center align-middle text-gray-500 dark:text-gray-400",m.head),children:at(n[0])}),n.map(f=>{let s=Ge(f,t),U=Z(f);if(s.outside&&!Ne)return o("td",{className:"p-0"},U);let Xe=S(f,Ie)&&!s.outside,de=s.inRange||s.rangeStart&&!!G||s.rangeEnd&&!!M?.from;return o("td",{role:"presentation",className:c("p-0",de&&it[D],de&&s.rangeStart&&"rounded-l-full",de&&s.rangeEnd&&"rounded-r-full"),children:o("button",{type:"button","data-day":U,"data-selected":s.selected||void 0,"data-today":s.today||void 0,"data-outside":s.outside||void 0,role:"gridcell",tabIndex:Xe?0:-1,disabled:b,"aria-selected":s.selected,"aria-disabled":s.disabled||void 0,"aria-current":s.today?"date":void 0,"aria-label":Oe.format(f),onClick:()=>{s.disabled||We(f)},onMouseEnter:()=>r==="range"&&De(u(f)),onMouseLeave:()=>r==="range"&&De(null),onFocus:()=>J(u(f)),className:c("inline-flex items-center justify-center rounded-full transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",W[D],m.day,s.selected?st[D]:s.inRange?c(dt[D],"hover:bg-gray-200/60 dark:hover:bg-gray-600/60"):s.today?c(ut[D],"hover:bg-gray-100 dark:hover:bg-gray-700"):c("text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),s.outside&&!s.selected&&"text-gray-500 dark:text-gray-400",s.disabled&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent"),children:pe?pe(f,s):f.getDate()})},U)})]},Z(n[0])))})]})]},Z(t))},qe=h(()=>{p(R),J(R),K(R)||Q(R)},[R,p,K,Q]),Je=h(()=>{C(r==="multiple"?[]:r==="range"?{from:null,to:null}:null)},[r,C]),Qe=!!me||re||ne;return N("div",{ref:he,className:c("inline-block bg-white dark:bg-gray-900",Re&&"rounded-lg border border-gray-200 shadow-sm dark:border-gray-700",m.padding,b&&"opacity-60",Ye),...Pe,children:[o("div",{className:c("flex flex-wrap",m.gap),children:Array.from({length:w},(e,t)=>Ue(t))}),Qe&&N("div",{className:c("mt-3 flex items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700",m.footer),children:[o("div",{className:"text-gray-600 dark:text-gray-400",children:me}),(re||ne)&&N("div",{className:"flex items-center gap-2",children:[re&&o("button",{type:"button",onClick:qe,disabled:b,className:c("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",W[D],b&&"cursor-not-allowed opacity-50"),children:E?.today??B.calendarToday}),ne&&o("button",{type:"button",onClick:Je,disabled:b,className:c("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",W[D],b&&"cursor-not-allowed opacity-50"),children:E?.clear??B.calendarClear})]})]})]})}export{yt as Calendar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var o in e)d(n,o,{get:e[o],enumerable:!0})},b=(n,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of C(e))!k.call(n,a)&&a!==o&&d(n,a,{get:()=>e[a],enumerable:!(l=x(e,a))||l.enumerable});return n};var L=n=>b(d({},"__esModule",{value:!0}),n);var N={};y(N,{ChartLegend:()=>P});module.exports=L(N);var s=require("../../lib/cn.cjs"),u=require("./ChartPatterns.cjs"),r=require("react/jsx-runtime"),w={line:"h-0.5 w-3 rounded-full",rect:"h-2.5 w-2.5 rounded-sm",dot:"h-2 w-2 rounded-full"},v={sm:"text-[11px]",md:"text-xs",lg:"text-sm"};function P({items:n,position:e="bottom",marker:o="line",onToggle:l,size:a="md",className:h,...g}){return n.length===0?null:(0,r.jsx)("ul",{className:(0,s.cn)("flex list-none flex-wrap gap-x-4 gap-y-1 p-0",e==="right"?"flex-col":"flex-row",e==="top"||e==="bottom"?"justify-center":"",v[a],h),...g,children:n.map(t=>{let i=t.pattern!==void 0&&(t.marker??o)==="rect",f=(0,r.jsx)("span",{className:(0,s.cn)("shrink-0",i?"h-3 w-3.5 rounded-sm":w[t.marker??o]),style:i?(0,u.patternBackground)(t.pattern,t.color):{backgroundColor:t.color},"aria-hidden":"true"}),m=(0,r.jsx)("span",{className:(0,s.cn)(t.hidden&&"line-through"),children:t.label}),c=(0,r.jsxs)(r.Fragment,{children:[f,m]}),p=(0,s.cn)("flex items-center gap-1.5 text-gray-600 dark:text-gray-300",t.hidden&&"text-gray-
|
|
1
|
+
"use strict";var d=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var o in e)d(n,o,{get:e[o],enumerable:!0})},b=(n,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of C(e))!k.call(n,a)&&a!==o&&d(n,a,{get:()=>e[a],enumerable:!(l=x(e,a))||l.enumerable});return n};var L=n=>b(d({},"__esModule",{value:!0}),n);var N={};y(N,{ChartLegend:()=>P});module.exports=L(N);var s=require("../../lib/cn.cjs"),u=require("./ChartPatterns.cjs"),r=require("react/jsx-runtime"),w={line:"h-0.5 w-3 rounded-full",rect:"h-2.5 w-2.5 rounded-sm",dot:"h-2 w-2 rounded-full"},v={sm:"text-[11px]",md:"text-xs",lg:"text-sm"};function P({items:n,position:e="bottom",marker:o="line",onToggle:l,size:a="md",className:h,...g}){return n.length===0?null:(0,r.jsx)("ul",{className:(0,s.cn)("flex list-none flex-wrap gap-x-4 gap-y-1 p-0",e==="right"?"flex-col":"flex-row",e==="top"||e==="bottom"?"justify-center":"",v[a],h),...g,children:n.map(t=>{let i=t.pattern!==void 0&&(t.marker??o)==="rect",f=(0,r.jsx)("span",{className:(0,s.cn)("shrink-0",i?"h-3 w-3.5 rounded-sm":w[t.marker??o]),style:i?(0,u.patternBackground)(t.pattern,t.color):{backgroundColor:t.color},"aria-hidden":"true"}),m=(0,r.jsx)("span",{className:(0,s.cn)(t.hidden&&"line-through"),children:t.label}),c=(0,r.jsxs)(r.Fragment,{children:[f,m]}),p=(0,s.cn)("flex items-center gap-1.5 text-gray-600 dark:text-gray-300",t.hidden&&"text-gray-500 dark:text-gray-400");return(0,r.jsx)("li",{children:l?(0,r.jsx)("button",{type:"button",onClick:()=>l(t.key),"aria-pressed":!t.hidden,className:(0,s.cn)(p,"cursor-pointer rounded-sm hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 dark:hover:text-white"),children:c}):(0,r.jsx)("span",{className:p,children:c})},t.key)})})}0&&(module.exports={ChartLegend});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as r}from"../../lib/cn.js";import{patternBackground as f}from"./ChartPatterns.js";import{Fragment as C,jsx as t,jsxs as k}from"react/jsx-runtime";var m={line:"h-0.5 w-3 rounded-full",rect:"h-2.5 w-2.5 rounded-sm",dot:"h-2 w-2 rounded-full"},x={sm:"text-[11px]",md:"text-xs",lg:"text-sm"};function L({items:o,position:n="bottom",marker:a="line",onToggle:s,size:c="md",className:p,...u}){return o.length===0?null:t("ul",{className:r("flex list-none flex-wrap gap-x-4 gap-y-1 p-0",n==="right"?"flex-col":"flex-row",n==="top"||n==="bottom"?"justify-center":"",x[c],p),...u,children:o.map(e=>{let l=e.pattern!==void 0&&(e.marker??a)==="rect",h=t("span",{className:r("shrink-0",l?"h-3 w-3.5 rounded-sm":m[e.marker??a]),style:l?f(e.pattern,e.color):{backgroundColor:e.color},"aria-hidden":"true"}),g=t("span",{className:r(e.hidden&&"line-through"),children:e.label}),d=k(C,{children:[h,g]}),i=r("flex items-center gap-1.5 text-gray-600 dark:text-gray-300",e.hidden&&"text-gray-
|
|
1
|
+
import{cn as r}from"../../lib/cn.js";import{patternBackground as f}from"./ChartPatterns.js";import{Fragment as C,jsx as t,jsxs as k}from"react/jsx-runtime";var m={line:"h-0.5 w-3 rounded-full",rect:"h-2.5 w-2.5 rounded-sm",dot:"h-2 w-2 rounded-full"},x={sm:"text-[11px]",md:"text-xs",lg:"text-sm"};function L({items:o,position:n="bottom",marker:a="line",onToggle:s,size:c="md",className:p,...u}){return o.length===0?null:t("ul",{className:r("flex list-none flex-wrap gap-x-4 gap-y-1 p-0",n==="right"?"flex-col":"flex-row",n==="top"||n==="bottom"?"justify-center":"",x[c],p),...u,children:o.map(e=>{let l=e.pattern!==void 0&&(e.marker??a)==="rect",h=t("span",{className:r("shrink-0",l?"h-3 w-3.5 rounded-sm":m[e.marker??a]),style:l?f(e.pattern,e.color):{backgroundColor:e.color},"aria-hidden":"true"}),g=t("span",{className:r(e.hidden&&"line-through"),children:e.label}),d=k(C,{children:[h,g]}),i=r("flex items-center gap-1.5 text-gray-600 dark:text-gray-300",e.hidden&&"text-gray-500 dark:text-gray-400");return t("li",{children:s?t("button",{type:"button",onClick:()=>s(e.key),"aria-pressed":!e.hidden,className:r(i,"cursor-pointer rounded-sm hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 dark:hover:text-white"),children:d}):t("span",{className:i,children:d})},e.key)})})}export{L as ChartLegend};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var y=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";"use client";var y=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.prototype.hasOwnProperty;var ne=(e,n)=>{for(var u in n)y(e,u,{get:n[u],enumerable:!0})},ae=(e,n,u,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of te(n))!re.call(e,r)&&r!==u&&y(e,r,{get:()=>n[r],enumerable:!(c=se(n,r))||c.enumerable});return e};var oe=e=>ae(y({},"__esModule",{value:!0}),e);var de={};ne(de,{Checkbox:()=>T});module.exports=oe(de);var l=require("react"),t=require("../../lib/cn.cjs"),s=require("react/jsx-runtime"),le=e=>{switch(e){case"sm":return{checkbox:"w-4 h-4",label:"text-xs",description:"text-xs"};case"lg":return{checkbox:"w-6 h-6",label:"text-base",description:"text-sm"};default:return{checkbox:"w-5 h-5",label:"text-sm",description:"text-xs"}}},ce=e=>{switch(e){case"circle":return"rounded-full";case"rounded":return"rounded-md";default:return"rounded"}},ie=({className:e})=>(0,s.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),ue=({className:e})=>(0,s.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M3 8H13",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})}),T=(0,l.forwardRef)(({checked:e,defaultChecked:n=!1,onChange:u,disabled:c=!1,readOnly:r=!1,required:I=!1,name:q,value:W,id:j,label:R,description:m,error:x=!1,size:S="md",labelPosition:B="right",checkedColor:p="bg-blue-600",uncheckedColor:k="bg-white dark:bg-gray-800",borderColor:f="border-gray-300 dark:border-gray-600",labelColor:F,errorColor:E="text-red-600 dark:text-red-400",checkmarkColor:_="text-white",hoverColor:d,focusRingColor:A="ring-blue-500",indeterminate:o=!1,icon:L,variant:M="default",shape:D="square",animation:w=!0,showFocusRing:G=!0,className:pe,containerClassName:J,style:K,tabIndex:Q,...U},g)=>{let V=(0,l.useId)(),h=j||V,$=`${h}-error`,H=`${h}-description`,[X,Y]=(0,l.useState)(n),z=e!==void 0,i=z?e:X,b=(0,l.useRef)(null);(0,l.useEffect)(()=>{b.current&&(b.current.indeterminate=o)},[o]);let Z=a=>{if(c||r)return;let P=a.target.checked;z||Y(P),u?.(P,a)},N=le(S),O=ce(D),ee=()=>{let a=(0,t.cn)("relative flex items-center justify-center border-2 transition-all",N.checkbox,O,w&&"duration-200 ease-in-out");return c?(0,t.cn)(a,"opacity-50 cursor-not-allowed",i||o?p:k,f):M==="filled"?(0,t.cn)(a,i||o?p:"bg-gray-100 dark:bg-gray-700",i||o?"border-transparent":f,d&&!r&&`hover:${d}`,"cursor-pointer"):M==="outlined"?(0,t.cn)(a,k,i||o?`border-current ${p.replace("bg-","text-")}`:f,"border-2",d&&!r&&`hover:${d}`,"cursor-pointer"):(0,t.cn)(a,i||o?p:k,i||o?"border-transparent":f,d&&!r&&`hover:${d}`,"cursor-pointer")},C=x!==!1,v=typeof x=="string"?x:void 0;return(0,s.jsxs)("div",{className:(0,t.cn)("inline-flex flex-col",J),children:[(0,s.jsxs)("label",{htmlFor:h,className:(0,t.cn)("inline-flex items-start gap-2",c?"cursor-not-allowed":"cursor-pointer",B==="left"&&"flex-row-reverse justify-end"),children:[(0,s.jsx)("input",{ref:a=>{b&&(b.current=a),typeof g=="function"?g(a):g&&(g.current=a)},type:"checkbox",id:h,name:q,value:W,checked:i,onChange:Z,disabled:c,readOnly:r,required:I,tabIndex:r?-1:Q,"aria-invalid":C,"aria-describedby":(0,t.cn)(v&&$,m&&H),className:"sr-only peer",style:K,...U}),(0,s.jsx)("span",{className:(0,t.cn)(ee(),G&&`peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 peer-focus-visible:${A}`,w&&i&&"scale-100",C&&"border-red-500"),"aria-hidden":"true",children:(i||o)&&(0,s.jsx)("span",{className:(0,t.cn)(_,w&&"animate-in zoom-in-50 duration-200"),children:o?L||(0,s.jsx)(ue,{className:"w-full h-full"}):L||(0,s.jsx)(ie,{className:"w-full h-full"})})}),R&&(0,s.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("span",{className:(0,t.cn)(N.label,c&&"opacity-50",F,C&&E),children:[R,I&&(0,s.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-1",children:"*"})]}),m&&(0,s.jsx)("span",{id:H,className:(0,t.cn)(N.description,"text-gray-500 dark:text-gray-400",c&&"opacity-50"),children:m})]})]}),v&&(0,s.jsx)("p",{id:$,className:(0,t.cn)("mt-1 text-xs",E),children:v})]})});T.displayName="Checkbox";0&&(module.exports={Checkbox});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{forwardRef as O,useId as ee,useState as se,useEffect as te,useRef as
|
|
1
|
+
"use client";import{forwardRef as O,useId as ee,useState as se,useEffect as te,useRef as re}from"react";import{cn as e}from"../../lib/cn.js";import{jsx as s,jsxs as g}from"react/jsx-runtime";var ne=r=>{switch(r){case"sm":return{checkbox:"w-4 h-4",label:"text-xs",description:"text-xs"};case"lg":return{checkbox:"w-6 h-6",label:"text-base",description:"text-sm"};default:return{checkbox:"w-5 h-5",label:"text-sm",description:"text-xs"}}},ae=r=>{switch(r){case"circle":return"rounded-full";case"rounded":return"rounded-md";default:return"rounded"}},oe=({className:r})=>s("svg",{className:r,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),le=({className:r})=>s("svg",{className:r,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s("path",{d:"M3 8H13",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})}),ce=O(({checked:r,defaultChecked:H=!1,onChange:z,disabled:o=!1,readOnly:l=!1,required:C=!1,name:P,value:T,id:q,label:v,description:h,error:b=!1,size:W="md",labelPosition:j="right",checkedColor:i="bg-blue-600",uncheckedColor:m="bg-white dark:bg-gray-800",borderColor:u="border-gray-300 dark:border-gray-600",labelColor:S,errorColor:y="text-red-600 dark:text-red-400",checkmarkColor:B="text-white",hoverColor:c,focusRingColor:F="ring-blue-500",indeterminate:n=!1,icon:I,variant:R="default",shape:_="square",animation:x=!0,showFocusRing:A=!0,className:ie,containerClassName:D,style:G,tabIndex:J,...K},d)=>{let Q=ee(),p=q||Q,E=`${p}-error`,L=`${p}-description`,[U,V]=se(H),M=r!==void 0,a=M?r:U,f=re(null);te(()=>{f.current&&(f.current.indeterminate=n)},[n]);let X=t=>{if(o||l)return;let $=t.target.checked;M||V($),z?.($,t)},k=ne(W),Y=ae(_),Z=()=>{let t=e("relative flex items-center justify-center border-2 transition-all",k.checkbox,Y,x&&"duration-200 ease-in-out");return o?e(t,"opacity-50 cursor-not-allowed",a||n?i:m,u):R==="filled"?e(t,a||n?i:"bg-gray-100 dark:bg-gray-700",a||n?"border-transparent":u,c&&!l&&`hover:${c}`,"cursor-pointer"):R==="outlined"?e(t,m,a||n?`border-current ${i.replace("bg-","text-")}`:u,"border-2",c&&!l&&`hover:${c}`,"cursor-pointer"):e(t,a||n?i:m,a||n?"border-transparent":u,c&&!l&&`hover:${c}`,"cursor-pointer")},w=b!==!1,N=typeof b=="string"?b:void 0;return g("div",{className:e("inline-flex flex-col",D),children:[g("label",{htmlFor:p,className:e("inline-flex items-start gap-2",o?"cursor-not-allowed":"cursor-pointer",j==="left"&&"flex-row-reverse justify-end"),children:[s("input",{ref:t=>{f&&(f.current=t),typeof d=="function"?d(t):d&&(d.current=t)},type:"checkbox",id:p,name:P,value:T,checked:a,onChange:X,disabled:o,readOnly:l,required:C,tabIndex:l?-1:J,"aria-invalid":w,"aria-describedby":e(N&&E,h&&L),className:"sr-only peer",style:G,...K}),s("span",{className:e(Z(),A&&`peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 peer-focus-visible:${F}`,x&&a&&"scale-100",w&&"border-red-500"),"aria-hidden":"true",children:(a||n)&&s("span",{className:e(B,x&&"animate-in zoom-in-50 duration-200"),children:n?I||s(le,{className:"w-full h-full"}):I||s(oe,{className:"w-full h-full"})})}),v&&g("span",{className:"flex flex-col gap-1",children:[g("span",{className:e(k.label,o&&"opacity-50",S,w&&y),children:[v,C&&s("span",{className:"text-red-600 dark:text-red-400 ml-1",children:"*"})]}),h&&s("span",{id:L,className:e(k.description,"text-gray-500 dark:text-gray-400",o&&"opacity-50"),children:h})]})]}),N&&s("p",{id:E,className:e("mt-1 text-xs",y),children:N})]})});ce.displayName="Checkbox";export{ce as Checkbox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var S=Object.create;var x=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var J=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},N=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of B(t))!H.call(e,s)&&s!==o&&x(e,s,{get:()=>t[s],enumerable:!(r=A(t,s))||r.enumerable});return e};var K=(e,t,o)=>(o=e!=null?S(F(e)):{},N(t||!e||!e.__esModule?x(o,"default",{value:e,enumerable:!0}):o,e)),L=e=>N(x({},"__esModule",{value:!0}),e);var Q={};J(Q,{CheckboxGroup:()=>P,CheckboxGroupItem:()=>R});module.exports=L(Q);var g=require("react"),
|
|
1
|
+
"use strict";"use client";var S=Object.create;var x=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var J=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},N=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of B(t))!H.call(e,s)&&s!==o&&x(e,s,{get:()=>t[s],enumerable:!(r=A(t,s))||r.enumerable});return e};var K=(e,t,o)=>(o=e!=null?S(F(e)):{},N(t||!e||!e.__esModule?x(o,"default",{value:e,enumerable:!0}):o,e)),L=e=>N(x({},"__esModule",{value:!0}),e);var Q={};J(Q,{CheckboxGroup:()=>P,CheckboxGroupItem:()=>R});module.exports=L(Q);var g=require("react"),p=require("../../lib/cn.cjs"),f=require("./Checkbox.cjs"),i=K(require("react"),1),a=require("react/jsx-runtime"),y=(0,g.createContext)(null),P=({label:e,description:t,value:o,defaultValue:r=[],onChange:s,orientation:n="vertical",spacing:m="md",disabled:l=!1,size:u="md",error:d=!1,required:b=!1,children:z,className:I,labelClassName:V,...w})=>{let[D,M]=i.useState(r),C=o!==void 0,c=C?o:D,v=i.useCallback(h=>{let G=c.includes(h)?c.filter(E=>E!==h):[...c,h];C||M(G),s?.(G)},[c,C,s]),O=i.useMemo(()=>({value:c,onChange:v,disabled:l,size:u}),[c,v,l,u]),W={sm:n==="vertical"?"gap-2":"gap-3",md:n==="vertical"?"gap-3":"gap-4",lg:n==="vertical"?"gap-4":"gap-6"},q=d!==!1,k=typeof d=="string"?d:void 0;return(0,a.jsxs)("div",{className:(0,p.cn)("flex flex-col gap-2",I),...w,children:[(e||t)&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[e&&(0,a.jsxs)("label",{className:(0,p.cn)("text-sm font-medium text-gray-900 dark:text-gray-100",l&&"opacity-50",q&&"text-red-600 dark:text-red-400",V),children:[e,b&&(0,a.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-1",children:"*"})]}),t&&(0,a.jsx)("p",{className:(0,p.cn)("text-xs text-gray-500 dark:text-gray-400",l&&"opacity-50"),children:t})]}),(0,a.jsx)(y.Provider,{value:O,children:(0,a.jsx)("div",{className:(0,p.cn)("flex",n==="vertical"?"flex-col":"flex-row flex-wrap",W[m]),role:"group",children:z})}),k&&(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:k})]})};P.displayName="CheckboxGroup";var R=({value:e,disabled:t,size:o,...r})=>{let s=(0,g.useContext)(y);if(!s)return console.warn("CheckboxGroupItem doit \xEAtre utilis\xE9 dans un CheckboxGroup"),(0,a.jsx)(f.Checkbox,{...r,disabled:t,size:o});let{value:n,onChange:m,disabled:l,size:u}=s,d=n.includes(e);return(0,a.jsx)(f.Checkbox,{...r,checked:d,onChange:()=>m(e),disabled:l||t,size:o||u})};R.displayName="CheckboxGroupItem";0&&(module.exports={CheckboxGroup,CheckboxGroupItem});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createContext as O,useContext as W}from"react";import{cn as
|
|
1
|
+
"use client";import{createContext as O,useContext as W}from"react";import{cn as u}from"../../lib/cn.js";import{Checkbox as k}from"./Checkbox.js";import*as n from"react";import{jsx as e,jsxs as C}from"react/jsx-runtime";var G=O(null),q=({label:t,description:o,value:l,defaultValue:d=[],onChange:c,orientation:a="vertical",spacing:x="md",disabled:s=!1,size:p="md",error:i=!1,required:h=!1,children:N,className:y,labelClassName:P,...R})=>{let[z,I]=n.useState(d),g=l!==void 0,r=g?l:z,f=n.useCallback(m=>{let v=r.includes(m)?r.filter(M=>M!==m):[...r,m];g||I(v),c?.(v)},[r,g,c]),V=n.useMemo(()=>({value:r,onChange:f,disabled:s,size:p}),[r,f,s,p]),w={sm:a==="vertical"?"gap-2":"gap-3",md:a==="vertical"?"gap-3":"gap-4",lg:a==="vertical"?"gap-4":"gap-6"},D=i!==!1,b=typeof i=="string"?i:void 0;return C("div",{className:u("flex flex-col gap-2",y),...R,children:[(t||o)&&C("div",{className:"flex flex-col gap-1",children:[t&&C("label",{className:u("text-sm font-medium text-gray-900 dark:text-gray-100",s&&"opacity-50",D&&"text-red-600 dark:text-red-400",P),children:[t,h&&e("span",{className:"text-red-600 dark:text-red-400 ml-1",children:"*"})]}),o&&e("p",{className:u("text-xs text-gray-500 dark:text-gray-400",s&&"opacity-50"),children:o})]}),e(G.Provider,{value:V,children:e("div",{className:u("flex",a==="vertical"?"flex-col":"flex-row flex-wrap",w[x]),role:"group",children:N})}),b&&e("p",{className:"text-xs text-red-600 dark:text-red-400",children:b})]})};q.displayName="CheckboxGroup";var E=({value:t,disabled:o,size:l,...d})=>{let c=W(G);if(!c)return console.warn("CheckboxGroupItem doit \xEAtre utilis\xE9 dans un CheckboxGroup"),e(k,{...d,disabled:o,size:l});let{value:a,onChange:x,disabled:s,size:p}=c,i=a.includes(t);return e(k,{...d,checked:i,onChange:()=>x(t),disabled:s||o,size:l||p})};E.displayName="CheckboxGroupItem";export{q as CheckboxGroup,E as CheckboxGroupItem};
|