@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.
Files changed (98) hide show
  1. package/dist/components/advance-detachable/AdvanceDetachable.cjs +1 -1
  2. package/dist/components/advance-detachable/AdvanceDetachable.js +1 -1
  3. package/dist/components/badge/Badge.cjs +1 -1
  4. package/dist/components/badge/Badge.js +1 -1
  5. package/dist/components/banner/Banner.cjs +1 -1
  6. package/dist/components/banner/Banner.js +1 -1
  7. package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
  8. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  9. package/dist/components/calendar/Calendar.cjs +1 -1
  10. package/dist/components/calendar/Calendar.js +1 -1
  11. package/dist/components/chart/ChartLegend.cjs +1 -1
  12. package/dist/components/chart/ChartLegend.js +1 -1
  13. package/dist/components/checkbox/Checkbox.cjs +1 -1
  14. package/dist/components/checkbox/Checkbox.js +1 -1
  15. package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
  16. package/dist/components/checkbox/CheckboxGroup.js +1 -1
  17. package/dist/components/chip/Chip.cjs +1 -1
  18. package/dist/components/chip/Chip.js +1 -1
  19. package/dist/components/circular-progress/CircularProgress.cjs +1 -1
  20. package/dist/components/circular-progress/CircularProgress.js +1 -1
  21. package/dist/components/datagrid/DataGrid.cjs +1 -1
  22. package/dist/components/datagrid/DataGrid.js +1 -1
  23. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  24. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  25. package/dist/components/drawer/Drawer.cjs +1 -1
  26. package/dist/components/drawer/Drawer.js +1 -1
  27. package/dist/components/dropdown/DropdownItem.cjs +1 -1
  28. package/dist/components/dropdown/DropdownItem.js +1 -1
  29. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  30. package/dist/components/dropdown/DropdownRadio.js +1 -1
  31. package/dist/components/dropdown/DropdownSubMenu.cjs +1 -1
  32. package/dist/components/dropdown/DropdownSubMenu.js +1 -1
  33. package/dist/components/dropdown/DropdownTrigger.cjs +1 -1
  34. package/dist/components/dropdown/DropdownTrigger.js +1 -1
  35. package/dist/components/file-selector/FileSelector.cjs +1 -1
  36. package/dist/components/file-selector/FileSelector.js +1 -1
  37. package/dist/components/form/mention-input/MentionInput.cjs +1 -1
  38. package/dist/components/form/mention-input/MentionInput.js +1 -1
  39. package/dist/components/form/shared/inputStyles.cjs +1 -1
  40. package/dist/components/form/shared/inputStyles.js +1 -1
  41. package/dist/components/header/Header.cjs +1 -1
  42. package/dist/components/header/Header.js +1 -1
  43. package/dist/components/help-button/HelpButton.cjs +2 -2
  44. package/dist/components/help-button/HelpButton.js +3 -3
  45. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  46. package/dist/components/image-uploader/ImageUploader.js +1 -1
  47. package/dist/components/indicator/Indicator.cjs +1 -1
  48. package/dist/components/indicator/Indicator.js +1 -1
  49. package/dist/components/label/Label.cjs +1 -1
  50. package/dist/components/label/Label.js +1 -1
  51. package/dist/components/modal/Modal.cjs +1 -1
  52. package/dist/components/modal/Modal.js +1 -1
  53. package/dist/components/pagination/Pagination.cjs +1 -1
  54. package/dist/components/pagination/Pagination.js +1 -1
  55. package/dist/components/progress-bar/ProgressBar.cjs +1 -1
  56. package/dist/components/progress-bar/ProgressBar.js +1 -1
  57. package/dist/components/radio-button/RadioButton.cjs +1 -1
  58. package/dist/components/radio-button/RadioButton.js +1 -1
  59. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  60. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  61. package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
  62. package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
  63. package/dist/components/schema-editor/relations/SchemaRelationRenderer.cjs +1 -1
  64. package/dist/components/schema-editor/relations/SchemaRelationRenderer.js +1 -1
  65. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  66. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  67. package/dist/components/schema-editor/utils/foreign-keys.cjs +1 -0
  68. package/dist/components/schema-editor/utils/foreign-keys.js +1 -0
  69. package/dist/components/schema-editor/utils/geometry.cjs +1 -1
  70. package/dist/components/schema-editor/utils/geometry.js +1 -1
  71. package/dist/components/schema-editor/utils/sql-export.cjs +5 -5
  72. package/dist/components/schema-editor/utils/sql-export.js +5 -5
  73. package/dist/components/select/Select.cjs +1 -1
  74. package/dist/components/select/Select.js +1 -1
  75. package/dist/components/sidebar/Sidebar.cjs +1 -1
  76. package/dist/components/sidebar/Sidebar.js +1 -1
  77. package/dist/components/slider/Slider.cjs +1 -1
  78. package/dist/components/slider/Slider.js +1 -1
  79. package/dist/components/stat-card/StatCard.cjs +1 -1
  80. package/dist/components/stat-card/StatCard.js +1 -1
  81. package/dist/components/table/TableHeader.cjs +1 -1
  82. package/dist/components/table/TableHeader.js +1 -1
  83. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  84. package/dist/components/tabs/TabsTrigger.js +1 -1
  85. package/dist/components/toast/Toast.cjs +1 -1
  86. package/dist/components/toast/Toast.js +1 -1
  87. package/dist/components/tooltip/Tooltip.cjs +1 -1
  88. package/dist/components/tooltip/Tooltip.js +1 -1
  89. package/dist/components/wizard/Wizard.cjs +1 -1
  90. package/dist/components/wizard/Wizard.js +1 -1
  91. package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
  92. package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
  93. package/dist/index.d.cts +12 -0
  94. package/dist/index.d.ts +12 -0
  95. package/dist/lib/editable-target.cjs +1 -0
  96. package/dist/lib/editable-target.js +1 -0
  97. package/dist/styles.css +82 -143
  98. package/package.json +2 -2
@@ -1 +1 @@
1
- "use client";import{createContext as ee,useContext as te,useState as y,useCallback as O,useEffect as E,useRef as C}from"react";import{useDialogA11y as re}from"../../hooks/useDialogA11y.js";import{cn as o}from"../../lib/cn.js";import{useUILabels as F}from"../../lib/i18n.js";import{Fragment as G,jsx as e,jsxs as m}from"react/jsx-runtime";var D=ee(null);function N(){let t=te(D);if(!t)throw new Error("Sidebar sub-components must be used within <Sidebar>");return t}function ce(){return N()}var ae=({className:t})=>e("svg",{className:o("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})}),oe=({className:t})=>e("svg",{className:o("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),ne=({className:t})=>e("svg",{className:o("w-5 h-5",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})});function q({text:t,position:a,children:r}){let[n,b]=y(!1),[l,p]=y({top:0,left:0}),d=C(null);return m("div",{ref:d,onMouseEnter:()=>{if(d.current){let s=d.current.getBoundingClientRect();p({top:s.top+s.height/2,left:a==="left"?s.right+8:s.left-8})}b(!0)},onMouseLeave:()=>b(!1),className:"relative",children:[r,n&&e("div",{className:o("fixed z-[9999] px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900 dark:bg-gray-700 rounded-md shadow-lg whitespace-nowrap pointer-events-none",a==="right"&&"-translate-x-full"),style:{top:l.top,left:l.left,transform:`translateY(-50%)${a==="right"?" translateX(-100%)":""}`},role:"tooltip",children:t})]})}function ue({collapsed:t,defaultCollapsed:a=!1,onCollapsedChange:r,expandedWidth:n=260,collapsedWidth:b=64,position:l="left",variant:p="default",mobileBreakpoint:d=768,mobileOpen:x,onMobileOpenChange:s,className:g,"aria-label":c,closeLabel:S,trapFocus:f=!0,initialFocus:w,returnFocus:M,lockScroll:R=!0,children:Q}){let W=F(),H=C(null),V=C(null),[$,U]=y(a),[X,L]=y(!1),[u,Y]=y(!1),P=t!==void 0,k=P?t:$,v=x!==void 0,h=v?x:X;E(()=>{let i=window.matchMedia(`(max-width: ${d}px)`),T=B=>{Y(B.matches),B.matches||(v||L(!1),s?.(!1))};return T(i),i.addEventListener("change",T),()=>i.removeEventListener("change",T)},[d,v,s]);let J=O(()=>{if(u){let i=!h;v||L(i),s?.(i)}else{let i=!k;P||U(i),r?.(i)}},[u,h,k,v,P,s,r]),I=O(()=>{v||L(!1),s?.(!1)},[v,s]);E(()=>{let i=V.current;i&&(u&&!h?(i.setAttribute("inert",""),i.setAttribute("aria-hidden","true")):(i.removeAttribute("inert"),i.removeAttribute("aria-hidden")))},[u,h]);let{dialogRef:K,dialogProps:Z}=re({open:u&&h,onClose:I,trapFocus:f,initialFocus:w,returnFocus:M,lockScroll:R,keepInteractive:[H]}),_={default:"bg-white dark:bg-gray-900",bordered:o("bg-white dark:bg-gray-900",l==="left"?"border-r border-gray-200 dark:border-gray-700":"border-l border-gray-200 dark:border-gray-700"),floating:"bg-white dark:bg-gray-900 m-3 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700"},z=k&&!u?b:n,A=e("aside",{className:o("flex flex-col h-full overflow-hidden transition-[width] duration-200 ease-in-out",_[p],g),style:{width:u?n:z,minWidth:u?n:z},"data-testid":"sidebar","data-collapsed":k&&!u,"data-mobile":u,"data-position":l,children:Q}),j={collapsed:k&&!u,isMobile:u,mobileOpen:h,position:l,variant:p,expandedWidth:n,collapsedWidth:b,toggle:J,closeMobile:I,closeLabel:S};return u?m(D.Provider,{value:j,children:[h&&e("div",{ref:H,className:"fixed inset-0 z-40 bg-black/50 transition-opacity",onClick:I,"aria-hidden":"true","data-testid":"sidebar-overlay"}),e("div",{ref:i=>{V.current=i,K.current=i},...Z,"aria-label":c??W.sidebar,className:o("fixed top-0 z-50 h-full transition-transform duration-200 ease-in-out focus:outline-none",l==="left"?"left-0":"right-0",h?"translate-x-0":l==="left"?"-translate-x-full":"translate-x-full"),children:A})]}):e(D.Provider,{value:j,children:A})}function be({className:t,children:a}){let r=N(),n=F();return m("div",{className:o("flex items-center shrink-0 px-4 h-14 overflow-hidden",r.collapsed&&"justify-center px-2",t),"data-testid":"sidebar-header",children:[a,r.isMobile&&r.mobileOpen&&e("button",{type:"button",onClick:r.closeMobile,className:"ml-auto p-1 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer","aria-label":r.closeLabel??n.closeSidebar,children:e(ne,{})})]})}function pe({className:t,children:a}){return e("div",{className:o("flex-1 overflow-y-auto overflow-x-hidden py-2",t),"data-testid":"sidebar-content",children:a})}function fe({className:t,children:a}){let r=N();return e("div",{className:o("shrink-0 border-t border-gray-200 dark:border-gray-700 px-4 py-3 overflow-hidden",r.collapsed&&"px-2 flex justify-center",t),"data-testid":"sidebar-footer",children:a})}function ge({label:t,className:a,children:r}){let n=N();return m("div",{className:o("py-2",a),"data-testid":"sidebar-group",children:[t&&!n.collapsed&&e("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500",children:t}),t&&n.collapsed&&e("div",{className:"mx-auto my-1 w-6 border-t border-gray-200 dark:border-gray-700"}),e("div",{className:"space-y-0.5 px-2",children:r})]})}function me({icon:t,label:a,badge:r,badgeColor:n="bg-blue-600 text-white",active:b=!1,disabled:l=!1,href:p,onClick:d,tooltip:x,className:s}){let g=N(),c=g.collapsed,S=x??a,f=m(G,{children:[t&&e("span",{className:o("shrink-0 w-5 h-5",c&&"w-5 h-5"),children:t}),!c&&m(G,{children:[e("span",{className:"flex-1 truncate",children:a}),r!=null&&e("span",{className:o("shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1",n),children:r})]}),c&&r!==void 0&&r!==null&&e("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-600"})]}),w=o("relative flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full",c?"justify-center px-2 py-2.5":"px-3 py-2",b?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",l&&"opacity-50 pointer-events-none",!l&&"cursor-pointer",s),M=()=>{l||(d?.(),g.isMobile&&g.closeMobile())},R=p?e("a",{href:l?void 0:p,className:w,onClick:M,"aria-current":b?"page":void 0,"data-testid":"sidebar-item",children:f}):e("button",{type:"button",className:w,onClick:M,disabled:l,"aria-current":b?"page":void 0,"data-testid":"sidebar-item",children:f});return c?e(q,{text:S,position:g.position,children:R}):R}function xe({icon:t,label:a,badge:r,defaultOpen:n=!1,className:b,children:l}){let p=N(),[d,x]=y(n),s=C(null),[g,c]=y(n?void 0:0),S=C(!0);return E(()=>{if(S.current){S.current=!1,c(d?void 0:0);return}if(d){let f=s.current;if(f){c(f.scrollHeight);let w=setTimeout(()=>c(void 0),200);return()=>clearTimeout(w)}}else{let f=s.current;f&&(c(f.scrollHeight),requestAnimationFrame(()=>c(0)))}},[d]),p.collapsed?e(q,{text:a,position:p.position,children:m("button",{type:"button",className:o("relative flex items-center justify-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-2 py-2.5","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer",b),onClick:()=>{p.toggle(),x(!0)},"data-testid":"sidebar-submenu-trigger",children:[t&&e("span",{className:"shrink-0 w-5 h-5",children:t}),r!=null&&e("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-600"})]})}):m("div",{className:b,"data-testid":"sidebar-submenu",children:[m("button",{type:"button",className:o("flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-3 py-2","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"),onClick:()=>x(!d),"aria-expanded":d,"data-testid":"sidebar-submenu-trigger",children:[t&&e("span",{className:"shrink-0 w-5 h-5",children:t}),e("span",{className:"flex-1 truncate text-left",children:a}),r!=null&&e("span",{className:"shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1 bg-blue-600 text-white",children:r}),e(oe,{className:o("shrink-0 text-gray-400 transition-transform duration-200",d&&"rotate-180")})]}),e("div",{className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:g===void 0?"auto":g},children:e("div",{ref:s,className:"pl-4 py-0.5",children:l})})]})}function he({className:t}){let a=N(),r=F(),n=a.isMobile?a.mobileOpen?a.closeLabel??r.closeSidebar:r.openSidebar:a.collapsed?r.expandSidebar:r.collapseSidebar;return e("button",{type:"button",onClick:a.toggle,className:o("p-1.5 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer",t),"aria-label":n,"data-testid":"sidebar-toggle",children:e(ae,{className:o("transition-transform duration-200",a.collapsed&&"rotate-180",a.position==="right"&&!a.collapsed&&"rotate-180",a.position==="right"&&a.collapsed&&"rotate-0")})})}export{ue as Sidebar,pe as SidebarContent,fe as SidebarFooter,ge as SidebarGroup,be as SidebarHeader,me as SidebarItem,xe as SidebarSubMenu,he as SidebarToggle,ce as useSidebar};
1
+ "use client";import{createContext as ee,useContext as te,useState as y,useCallback as O,useEffect as E,useRef as C}from"react";import{useDialogA11y as re}from"../../hooks/useDialogA11y.js";import{cn as o}from"../../lib/cn.js";import{useUILabels as F}from"../../lib/i18n.js";import{Fragment as G,jsx as e,jsxs as m}from"react/jsx-runtime";var D=ee(null);function N(){let t=te(D);if(!t)throw new Error("Sidebar sub-components must be used within <Sidebar>");return t}function ce(){return N()}var ae=({className:t})=>e("svg",{className:o("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})}),oe=({className:t})=>e("svg",{className:o("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),ne=({className:t})=>e("svg",{className:o("w-5 h-5",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})});function q({text:t,position:a,children:r}){let[n,b]=y(!1),[l,p]=y({top:0,left:0}),d=C(null);return m("div",{ref:d,onMouseEnter:()=>{if(d.current){let s=d.current.getBoundingClientRect();p({top:s.top+s.height/2,left:a==="left"?s.right+8:s.left-8})}b(!0)},onMouseLeave:()=>b(!1),className:"relative",children:[r,n&&e("div",{className:o("fixed z-[9999] px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900 dark:bg-gray-700 rounded-md shadow-lg whitespace-nowrap pointer-events-none",a==="right"&&"-translate-x-full"),style:{top:l.top,left:l.left,transform:`translateY(-50%)${a==="right"?" translateX(-100%)":""}`},role:"tooltip",children:t})]})}function ue({collapsed:t,defaultCollapsed:a=!1,onCollapsedChange:r,expandedWidth:n=260,collapsedWidth:b=64,position:l="left",variant:p="default",mobileBreakpoint:d=768,mobileOpen:x,onMobileOpenChange:s,className:g,"aria-label":c,closeLabel:S,trapFocus:f=!0,initialFocus:k,returnFocus:M,lockScroll:R=!0,children:Q}){let W=F(),H=C(null),V=C(null),[$,U]=y(a),[X,L]=y(!1),[u,Y]=y(!1),P=t!==void 0,w=P?t:$,v=x!==void 0,h=v?x:X;E(()=>{let i=window.matchMedia(`(max-width: ${d}px)`),T=B=>{Y(B.matches),B.matches||(v||L(!1),s?.(!1))};return T(i),i.addEventListener("change",T),()=>i.removeEventListener("change",T)},[d,v,s]);let J=O(()=>{if(u){let i=!h;v||L(i),s?.(i)}else{let i=!w;P||U(i),r?.(i)}},[u,h,w,v,P,s,r]),I=O(()=>{v||L(!1),s?.(!1)},[v,s]);E(()=>{let i=V.current;i&&(u&&!h?(i.setAttribute("inert",""),i.setAttribute("aria-hidden","true")):(i.removeAttribute("inert"),i.removeAttribute("aria-hidden")))},[u,h]);let{dialogRef:K,dialogProps:Z}=re({open:u&&h,onClose:I,trapFocus:f,initialFocus:k,returnFocus:M,lockScroll:R,keepInteractive:[H]}),_={default:"bg-white dark:bg-gray-900",bordered:o("bg-white dark:bg-gray-900",l==="left"?"border-r border-gray-200 dark:border-gray-700":"border-l border-gray-200 dark:border-gray-700"),floating:"bg-white dark:bg-gray-900 m-3 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700"},z=w&&!u?b:n,A=e("aside",{className:o("flex flex-col h-full overflow-hidden transition-[width] duration-200 ease-in-out",_[p],g),style:{width:u?n:z,minWidth:u?n:z},"data-testid":"sidebar","data-collapsed":w&&!u,"data-mobile":u,"data-position":l,children:Q}),j={collapsed:w&&!u,isMobile:u,mobileOpen:h,position:l,variant:p,expandedWidth:n,collapsedWidth:b,toggle:J,closeMobile:I,closeLabel:S};return u?m(D.Provider,{value:j,children:[h&&e("div",{ref:H,className:"fixed inset-0 z-40 bg-black/50 transition-opacity",onClick:I,"aria-hidden":"true","data-testid":"sidebar-overlay"}),e("div",{ref:i=>{V.current=i,K.current=i},...Z,"aria-label":c??W.sidebar,className:o("fixed top-0 z-50 h-full transition-transform duration-200 ease-in-out focus:outline-none",l==="left"?"left-0":"right-0",h?"translate-x-0":l==="left"?"-translate-x-full":"translate-x-full"),children:A})]}):e(D.Provider,{value:j,children:A})}function be({className:t,children:a}){let r=N(),n=F();return m("div",{className:o("flex items-center shrink-0 px-4 h-14 overflow-hidden",r.collapsed&&"justify-center px-2",t),"data-testid":"sidebar-header",children:[a,r.isMobile&&r.mobileOpen&&e("button",{type:"button",onClick:r.closeMobile,className:"ml-auto p-1 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer","aria-label":r.closeLabel??n.closeSidebar,children:e(ne,{})})]})}function pe({className:t,children:a}){return e("div",{className:o("flex-1 overflow-y-auto overflow-x-hidden py-2",t),"data-testid":"sidebar-content",children:a})}function fe({className:t,children:a}){let r=N();return e("div",{className:o("shrink-0 border-t border-gray-200 dark:border-gray-700 px-4 py-3 overflow-hidden",r.collapsed&&"px-2 flex justify-center",t),"data-testid":"sidebar-footer",children:a})}function ge({label:t,className:a,children:r}){let n=N();return m("div",{className:o("py-2",a),"data-testid":"sidebar-group",children:[t&&!n.collapsed&&e("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:t}),t&&n.collapsed&&e("div",{className:"mx-auto my-1 w-6 border-t border-gray-200 dark:border-gray-700"}),e("div",{className:"space-y-0.5 px-2",children:r})]})}function me({icon:t,label:a,badge:r,badgeColor:n="bg-blue-600 text-white",active:b=!1,disabled:l=!1,href:p,onClick:d,tooltip:x,className:s}){let g=N(),c=g.collapsed,S=x??a,f=m(G,{children:[t&&e("span",{className:o("shrink-0 w-5 h-5",c&&"w-5 h-5"),children:t}),!c&&m(G,{children:[e("span",{className:"flex-1 truncate",children:a}),r!=null&&e("span",{className:o("shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1",n),children:r})]}),c&&r!==void 0&&r!==null&&e("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-600"})]}),k=o("relative flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full",c?"justify-center px-2 py-2.5":"px-3 py-2",b?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",l&&"opacity-50 pointer-events-none",!l&&"cursor-pointer",s),M=()=>{l||(d?.(),g.isMobile&&g.closeMobile())},R=p?e("a",{href:l?void 0:p,className:k,onClick:M,"aria-current":b?"page":void 0,"data-testid":"sidebar-item",children:f}):e("button",{type:"button",className:k,onClick:M,disabled:l,"aria-current":b?"page":void 0,"data-testid":"sidebar-item",children:f});return c?e(q,{text:S,position:g.position,children:R}):R}function xe({icon:t,label:a,badge:r,defaultOpen:n=!1,className:b,children:l}){let p=N(),[d,x]=y(n),s=C(null),[g,c]=y(n?void 0:0),S=C(!0);return E(()=>{if(S.current){S.current=!1,c(d?void 0:0);return}if(d){let f=s.current;if(f){c(f.scrollHeight);let k=setTimeout(()=>c(void 0),200);return()=>clearTimeout(k)}}else{let f=s.current;f&&(c(f.scrollHeight),requestAnimationFrame(()=>c(0)))}},[d]),p.collapsed?e(q,{text:a,position:p.position,children:m("button",{type:"button",className:o("relative flex items-center justify-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-2 py-2.5","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer",b),onClick:()=>{p.toggle(),x(!0)},"data-testid":"sidebar-submenu-trigger",children:[t&&e("span",{className:"shrink-0 w-5 h-5",children:t}),r!=null&&e("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-600"})]})}):m("div",{className:b,"data-testid":"sidebar-submenu",children:[m("button",{type:"button",className:o("flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-3 py-2","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"),onClick:()=>x(!d),"aria-expanded":d,"data-testid":"sidebar-submenu-trigger",children:[t&&e("span",{className:"shrink-0 w-5 h-5",children:t}),e("span",{className:"flex-1 truncate text-left",children:a}),r!=null&&e("span",{className:"shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1 bg-blue-600 text-white",children:r}),e(oe,{className:o("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",d&&"rotate-180")})]}),e("div",{className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:g===void 0?"auto":g},children:e("div",{ref:s,className:"pl-4 py-0.5",children:l})})]})}function he({className:t}){let a=N(),r=F(),n=a.isMobile?a.mobileOpen?a.closeLabel??r.closeSidebar:r.openSidebar:a.collapsed?r.expandSidebar:r.collapseSidebar;return e("button",{type:"button",onClick:a.toggle,className:o("p-1.5 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer",t),"aria-label":n,"data-testid":"sidebar-toggle",children:e(ae,{className:o("transition-transform duration-200",a.collapsed&&"rotate-180",a.position==="right"&&!a.collapsed&&"rotate-180",a.position==="right"&&a.collapsed&&"rotate-0")})})}export{ue as Sidebar,pe as SidebarContent,fe as SidebarFooter,ge as SidebarGroup,be as SidebarHeader,me as SidebarItem,xe as SidebarSubMenu,he as SidebarToggle,ce as useSidebar};
@@ -1 +1 @@
1
- "use strict";"use client";var R=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var oe=(r,e)=>{for(var t in e)R(r,t,{get:e[t],enumerable:!0})},se=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!ne.call(r,o)&&o!==t&&R(r,o,{get:()=>e[o],enumerable:!(n=te(e,o))||n.enumerable});return r};var le=r=>se(R({},"__esModule",{value:!0}),r);var ve={};oe(ve,{Slider:()=>O});module.exports=le(ve);var i=require("react"),l=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),ie={sm:"h-1",md:"h-1.5",lg:"h-2"},de={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ue={sm:14,md:16,lg:20},be="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",ce={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},ge={sm:"h-4",md:"h-5",lg:"h-6"},me={primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500",neutral:"bg-gray-600 dark:bg-gray-400"},pe={primary:"border-blue-600 dark:border-blue-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},fe={primary:"peer-focus-visible:ring-blue-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},ye={primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400",neutral:"text-gray-700 dark:text-gray-300"},B=(r,e,t)=>Math.min(t,Math.max(e,r)),P=(r,e,t)=>t>e?(B(r,e,t)-e)/(t-e)*100:0,w=(r,e)=>{let t=(.5-r/100)*e,n=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${n}px)`},he=(r,e,t,n)=>{if(!r)return[];if(Array.isArray(r))return r;let o=n>0?n:1,d=Math.floor((t-e)/o);return d<=0||d>20?[{value:e},{value:t}]:Array.from({length:d+1},(u,k)=>({value:e+k*o}))},O=(0,i.forwardRef)(({value:r,defaultValue:e,onValueChange:t,min:n=0,max:o=100,step:d=1,size:u="md",color:k="primary",disabled:g=!1,readOnly:S=!1,label:x,description:$,error:C=!1,showValue:V=!1,showTooltip:_=!1,valueFormat:I,marks:T,trackColor:E,fillColor:N,thumbColor:m,className:j,containerClassName:q,id:D,...G},J)=>{let[K,Q]=(0,i.useState)(e??n),A=r!==void 0,c=B(A?r:K,n,o),U=(0,i.useId)(),p=D??U,f=typeof C=="string"?C:void 0,H=!!C,y=!g&&!S,h=H?"error":k,L=P(c,n,o),v=ue[u],X=s=>{if(!y)return;let b=Number(s.target.value);A||Q(b),t?.(b)},z=(0,i.useMemo)(()=>he(T,n,o,d),[T,n,o,d]),Y=z.some(s=>s.label!=null),W=I?I(c):`${c}`,F={width:w(L,v)};N&&(F.backgroundColor=N);let M={left:w(L,v)};m&&(M.backgroundColor=m,M.borderColor=m);let Z=E?{backgroundColor:E}:{};return(0,a.jsxs)("div",{className:(0,l.cn)("w-full",q),children:[(x||V)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[x?(0,a.jsx)("label",{htmlFor:p,className:(0,l.cn)("text-sm font-medium text-gray-700 dark:text-gray-200",g&&"opacity-50"),children:x}):(0,a.jsx)("span",{}),V&&(0,a.jsx)("span",{className:(0,l.cn)("text-sm font-semibold tabular-nums",ye[h]),children:W})]}),(0,a.jsxs)("div",{className:(0,l.cn)("relative flex items-center",ge[u],g&&"opacity-50"),children:[(0,a.jsx)("input",{ref:J,type:"range",id:p,min:n,max:o,step:d,value:c,onChange:X,disabled:g,readOnly:S,"aria-invalid":H,"aria-readonly":S||void 0,"aria-describedby":f?`${p}-error`:void 0,tabIndex:y?void 0:-1,className:(0,l.cn)("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",be,ce[u],!y&&"pointer-events-none cursor-default",j),...G}),(0,a.jsxs)("div",{className:(0,l.cn)("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ie[u]),style:Z,children:[(0,a.jsx)("div",{className:(0,l.cn)("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",N?"":me[h]),style:F}),z.map((s,b)=>{let ee=P(s.value,n,o),re=s.value<=c;return(0,a.jsx)("span",{"data-slider-mark":"",className:(0,l.cn)("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",re?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:w(ee,v)}},`mark-${s.value}-${b}`)})]}),(0,a.jsx)("div",{"data-slider-thumb":"",className:(0,l.cn)("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",de[u],m?"":pe[h],y&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",fe[h]),style:M,children:_&&(0,a.jsx)("span",{"data-slider-tooltip":"",className:(0,l.cn)("pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700","peer-hover:opacity-100 peer-focus-visible:opacity-100 peer-active:opacity-100"),children:W})})]}),Y&&(0,a.jsx)("div",{className:"relative mt-1.5 h-4",children:z.map((s,b)=>s.label!=null?(0,a.jsx)("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:w(P(s.value,n,o),v)},children:s.label},`mark-label-${s.value}-${b}`):null)}),$&&!f&&(0,a.jsx)("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:$}),f&&(0,a.jsx)("p",{id:`${p}-error`,className:"mt-1.5 text-sm text-red-500 dark:text-red-400",children:f})]})});O.displayName="Slider";0&&(module.exports={Slider});
1
+ "use strict";"use client";var R=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var oe=(r,e)=>{for(var t in e)R(r,t,{get:e[t],enumerable:!0})},se=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!ne.call(r,o)&&o!==t&&R(r,o,{get:()=>e[o],enumerable:!(n=te(e,o))||n.enumerable});return r};var le=r=>se(R({},"__esModule",{value:!0}),r);var ve={};oe(ve,{Slider:()=>O});module.exports=le(ve);var i=require("react"),l=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),ie={sm:"h-1",md:"h-1.5",lg:"h-2"},de={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ue={sm:14,md:16,lg:20},be="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",ce={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},ge={sm:"h-4",md:"h-5",lg:"h-6"},me={primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500",neutral:"bg-gray-600 dark:bg-gray-400"},pe={primary:"border-blue-600 dark:border-blue-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},fe={primary:"peer-focus-visible:ring-blue-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},ye={primary:"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",info:"text-cyan-700 dark:text-cyan-400",neutral:"text-gray-700 dark:text-gray-300"},B=(r,e,t)=>Math.min(t,Math.max(e,r)),P=(r,e,t)=>t>e?(B(r,e,t)-e)/(t-e)*100:0,w=(r,e)=>{let t=(.5-r/100)*e,n=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${n}px)`},he=(r,e,t,n)=>{if(!r)return[];if(Array.isArray(r))return r;let o=n>0?n:1,d=Math.floor((t-e)/o);return d<=0||d>20?[{value:e},{value:t}]:Array.from({length:d+1},(u,k)=>({value:e+k*o}))},O=(0,i.forwardRef)(({value:r,defaultValue:e,onValueChange:t,min:n=0,max:o=100,step:d=1,size:u="md",color:k="primary",disabled:g=!1,readOnly:S=!1,label:x,description:$,error:C=!1,showValue:V=!1,showTooltip:_=!1,valueFormat:I,marks:T,trackColor:E,fillColor:N,thumbColor:m,className:j,containerClassName:q,id:D,...G},J)=>{let[K,Q]=(0,i.useState)(e??n),A=r!==void 0,c=B(A?r:K,n,o),U=(0,i.useId)(),p=D??U,f=typeof C=="string"?C:void 0,H=!!C,y=!g&&!S,h=H?"error":k,L=P(c,n,o),v=ue[u],X=s=>{if(!y)return;let b=Number(s.target.value);A||Q(b),t?.(b)},z=(0,i.useMemo)(()=>he(T,n,o,d),[T,n,o,d]),Y=z.some(s=>s.label!=null),W=I?I(c):`${c}`,F={width:w(L,v)};N&&(F.backgroundColor=N);let M={left:w(L,v)};m&&(M.backgroundColor=m,M.borderColor=m);let Z=E?{backgroundColor:E}:{};return(0,a.jsxs)("div",{className:(0,l.cn)("w-full",q),children:[(x||V)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[x?(0,a.jsx)("label",{htmlFor:p,className:(0,l.cn)("text-sm font-medium text-gray-700 dark:text-gray-200",g&&"opacity-50"),children:x}):(0,a.jsx)("span",{}),V&&(0,a.jsx)("span",{className:(0,l.cn)("text-sm font-semibold tabular-nums",ye[h]),children:W})]}),(0,a.jsxs)("div",{className:(0,l.cn)("relative flex items-center",ge[u],g&&"opacity-50"),children:[(0,a.jsx)("input",{ref:J,type:"range",id:p,min:n,max:o,step:d,value:c,onChange:X,disabled:g,readOnly:S,"aria-invalid":H,"aria-readonly":S||void 0,"aria-describedby":f?`${p}-error`:void 0,tabIndex:y?void 0:-1,className:(0,l.cn)("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",be,ce[u],!y&&"pointer-events-none cursor-default",j),...G}),(0,a.jsxs)("div",{className:(0,l.cn)("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ie[u]),style:Z,children:[(0,a.jsx)("div",{className:(0,l.cn)("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",N?"":me[h]),style:F}),z.map((s,b)=>{let ee=P(s.value,n,o),re=s.value<=c;return(0,a.jsx)("span",{"data-slider-mark":"",className:(0,l.cn)("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",re?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:w(ee,v)}},`mark-${s.value}-${b}`)})]}),(0,a.jsx)("div",{"data-slider-thumb":"",className:(0,l.cn)("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",de[u],m?"":pe[h],y&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",fe[h]),style:M,children:_&&(0,a.jsx)("span",{"data-slider-tooltip":"",className:(0,l.cn)("pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700","peer-hover:opacity-100 peer-focus-visible:opacity-100 peer-active:opacity-100"),children:W})})]}),Y&&(0,a.jsx)("div",{className:"relative mt-1.5 h-4",children:z.map((s,b)=>s.label!=null?(0,a.jsx)("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:w(P(s.value,n,o),v)},children:s.label},`mark-label-${s.value}-${b}`):null)}),$&&!f&&(0,a.jsx)("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:$}),f&&(0,a.jsx)("p",{id:`${p}-error`,className:"mt-1.5 text-sm text-red-600 dark:text-red-400",children:f})]})});O.displayName="Slider";0&&(module.exports={Slider});
@@ -1 +1 @@
1
- "use client";import{useState as ee,useId as re,useMemo as te,forwardRef as ae}from"react";import{cn as l}from"../../lib/cn.js";import{jsx as o,jsxs as w}from"react/jsx-runtime";var ne={sm:"h-1",md:"h-1.5",lg:"h-2"},oe={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},se={sm:14,md:16,lg:20},le="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",ie={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},de={sm:"h-4",md:"h-5",lg:"h-6"},ue={primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500",neutral:"bg-gray-600 dark:bg-gray-400"},be={primary:"border-blue-600 dark:border-blue-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},ce={primary:"peer-focus-visible:ring-blue-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},ge={primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400",neutral:"text-gray-700 dark:text-gray-300"},F=(r,e,t)=>Math.min(t,Math.max(e,r)),R=(r,e,t)=>t>e?(F(r,e,t)-e)/(t-e)*100:0,v=(r,e)=>{let t=(.5-r/100)*e,a=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${a}px)`},me=(r,e,t,a)=>{if(!r)return[];if(Array.isArray(r))return r;let s=a>0?a:1,i=Math.floor((t-e)/s);return i<=0||i>20?[{value:e},{value:t}]:Array.from({length:i+1},(d,k)=>({value:e+k*s}))},pe=ae(({value:r,defaultValue:e,onValueChange:t,min:a=0,max:s=100,step:i=1,size:d="md",color:k="primary",disabled:c=!1,readOnly:S=!1,label:x,description:P,error:C=!1,showValue:$=!1,showTooltip:B=!1,valueFormat:V,marks:I,trackColor:T,fillColor:N,thumbColor:g,className:O,containerClassName:_,id:j,...q},D)=>{let[G,J]=ee(e??a),E=r!==void 0,b=F(E?r:G,a,s),K=re(),m=j??K,p=typeof C=="string"?C:void 0,A=!!C,f=!c&&!S,y=A?"error":k,H=R(b,a,s),h=se[d],Q=n=>{if(!f)return;let u=Number(n.target.value);E||J(u),t?.(u)},z=te(()=>me(I,a,s,i),[I,a,s,i]),U=z.some(n=>n.label!=null),L=V?V(b):`${b}`,W={width:v(H,h)};N&&(W.backgroundColor=N);let M={left:v(H,h)};g&&(M.backgroundColor=g,M.borderColor=g);let X=T?{backgroundColor:T}:{};return w("div",{className:l("w-full",_),children:[(x||$)&&w("div",{className:"flex items-center justify-between mb-1.5",children:[x?o("label",{htmlFor:m,className:l("text-sm font-medium text-gray-700 dark:text-gray-200",c&&"opacity-50"),children:x}):o("span",{}),$&&o("span",{className:l("text-sm font-semibold tabular-nums",ge[y]),children:L})]}),w("div",{className:l("relative flex items-center",de[d],c&&"opacity-50"),children:[o("input",{ref:D,type:"range",id:m,min:a,max:s,step:i,value:b,onChange:Q,disabled:c,readOnly:S,"aria-invalid":A,"aria-readonly":S||void 0,"aria-describedby":p?`${m}-error`:void 0,tabIndex:f?void 0:-1,className:l("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",le,ie[d],!f&&"pointer-events-none cursor-default",O),...q}),w("div",{className:l("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ne[d]),style:X,children:[o("div",{className:l("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",N?"":ue[y]),style:W}),z.map((n,u)=>{let Y=R(n.value,a,s),Z=n.value<=b;return o("span",{"data-slider-mark":"",className:l("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",Z?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:v(Y,h)}},`mark-${n.value}-${u}`)})]}),o("div",{"data-slider-thumb":"",className:l("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",oe[d],g?"":be[y],f&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",ce[y]),style:M,children:B&&o("span",{"data-slider-tooltip":"",className:l("pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700","peer-hover:opacity-100 peer-focus-visible:opacity-100 peer-active:opacity-100"),children:L})})]}),U&&o("div",{className:"relative mt-1.5 h-4",children:z.map((n,u)=>n.label!=null?o("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:v(R(n.value,a,s),h)},children:n.label},`mark-label-${n.value}-${u}`):null)}),P&&!p&&o("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:P}),p&&o("p",{id:`${m}-error`,className:"mt-1.5 text-sm text-red-500 dark:text-red-400",children:p})]})});pe.displayName="Slider";export{pe as Slider};
1
+ "use client";import{useState as ee,useId as re,useMemo as te,forwardRef as ae}from"react";import{cn as l}from"../../lib/cn.js";import{jsx as o,jsxs as w}from"react/jsx-runtime";var ne={sm:"h-1",md:"h-1.5",lg:"h-2"},oe={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},se={sm:14,md:16,lg:20},le="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",ie={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},de={sm:"h-4",md:"h-5",lg:"h-6"},ue={primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500",neutral:"bg-gray-600 dark:bg-gray-400"},be={primary:"border-blue-600 dark:border-blue-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},ce={primary:"peer-focus-visible:ring-blue-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},ge={primary:"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",info:"text-cyan-700 dark:text-cyan-400",neutral:"text-gray-700 dark:text-gray-300"},F=(r,e,t)=>Math.min(t,Math.max(e,r)),R=(r,e,t)=>t>e?(F(r,e,t)-e)/(t-e)*100:0,v=(r,e)=>{let t=(.5-r/100)*e,a=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${a}px)`},me=(r,e,t,a)=>{if(!r)return[];if(Array.isArray(r))return r;let s=a>0?a:1,i=Math.floor((t-e)/s);return i<=0||i>20?[{value:e},{value:t}]:Array.from({length:i+1},(d,k)=>({value:e+k*s}))},pe=ae(({value:r,defaultValue:e,onValueChange:t,min:a=0,max:s=100,step:i=1,size:d="md",color:k="primary",disabled:c=!1,readOnly:S=!1,label:x,description:P,error:C=!1,showValue:$=!1,showTooltip:B=!1,valueFormat:V,marks:I,trackColor:T,fillColor:N,thumbColor:g,className:O,containerClassName:_,id:j,...q},D)=>{let[G,J]=ee(e??a),E=r!==void 0,b=F(E?r:G,a,s),K=re(),m=j??K,p=typeof C=="string"?C:void 0,A=!!C,f=!c&&!S,y=A?"error":k,H=R(b,a,s),h=se[d],Q=n=>{if(!f)return;let u=Number(n.target.value);E||J(u),t?.(u)},z=te(()=>me(I,a,s,i),[I,a,s,i]),U=z.some(n=>n.label!=null),L=V?V(b):`${b}`,W={width:v(H,h)};N&&(W.backgroundColor=N);let M={left:v(H,h)};g&&(M.backgroundColor=g,M.borderColor=g);let X=T?{backgroundColor:T}:{};return w("div",{className:l("w-full",_),children:[(x||$)&&w("div",{className:"flex items-center justify-between mb-1.5",children:[x?o("label",{htmlFor:m,className:l("text-sm font-medium text-gray-700 dark:text-gray-200",c&&"opacity-50"),children:x}):o("span",{}),$&&o("span",{className:l("text-sm font-semibold tabular-nums",ge[y]),children:L})]}),w("div",{className:l("relative flex items-center",de[d],c&&"opacity-50"),children:[o("input",{ref:D,type:"range",id:m,min:a,max:s,step:i,value:b,onChange:Q,disabled:c,readOnly:S,"aria-invalid":A,"aria-readonly":S||void 0,"aria-describedby":p?`${m}-error`:void 0,tabIndex:f?void 0:-1,className:l("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",le,ie[d],!f&&"pointer-events-none cursor-default",O),...q}),w("div",{className:l("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ne[d]),style:X,children:[o("div",{className:l("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",N?"":ue[y]),style:W}),z.map((n,u)=>{let Y=R(n.value,a,s),Z=n.value<=b;return o("span",{"data-slider-mark":"",className:l("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",Z?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:v(Y,h)}},`mark-${n.value}-${u}`)})]}),o("div",{"data-slider-thumb":"",className:l("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",oe[d],g?"":be[y],f&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",ce[y]),style:M,children:B&&o("span",{"data-slider-tooltip":"",className:l("pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700","peer-hover:opacity-100 peer-focus-visible:opacity-100 peer-active:opacity-100"),children:L})})]}),U&&o("div",{className:"relative mt-1.5 h-4",children:z.map((n,u)=>n.label!=null?o("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:v(R(n.value,a,s),h)},children:n.label},`mark-label-${n.value}-${u}`):null)}),P&&!p&&o("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:P}),p&&o("p",{id:`${m}-error`,className:"mt-1.5 text-sm text-red-600 dark:text-red-400",children:p})]})});pe.displayName="Slider";export{pe as Slider};
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var R=(t,r)=>{for(var o in r)m(t,o,{get:r[o],enumerable:!0})},P=(t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of N(r))!k.call(t,i)&&i!==o&&m(t,i,{get:()=>r[i],enumerable:!(a=D(r,i))||a.enumerable});return t};var L=t=>P(m({},"__esModule",{value:!0}),t);var j={};R(j,{StatCard:()=>Z});module.exports=L(j);var s=require("../../lib/cn.cjs"),l=require("../chart/utils/format.cjs"),h=require("../circular-progress/CircularProgress.cjs"),f=require("../sparkline/Sparkline.cjs"),e=require("react/jsx-runtime"),z={sm:"p-3",md:"p-4",lg:"p-5"},T={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},W={sm:"text-xl",md:"text-2xl",lg:"text-3xl"},g={sm:{width:72,height:22},md:{width:96,height:28},lg:{width:120,height:34}};function A(t){return t.direction?t.direction:t.value>0?"up":t.value<0?"down":"flat"}function B(t,r){return t==="flat"||r==="neutral"?"text-gray-500 dark:text-gray-400":t===r?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}function M({direction:t}){return t==="flat"?(0,e.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("rect",{x:"1",y:"4.25",width:"8",height:"1.5",rx:"0.75"})}):(0,e.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{d:t==="up"?"M5 1 L9.5 8 L0.5 8 Z":"M5 9 L0.5 2 L9.5 2 Z"})})}function Z({label:t,value:r,format:o,delta:a,trend:i,trendColor:x,icon:c,size:n="md",loading:d=!1,variant:C="card",footer:u,className:v,...y}){let S=typeof r=="number"?(o??l.formatAuto)(r):r,p=a?A(a):"flat",b=a?(a.format??(w=>(0,l.formatPercent)(w,{signed:!0})))(a.value):null;return(0,e.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-2",C==="card"&&(0,s.cn)("rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",z[n]),v),...y,children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsx)("span",{className:(0,s.cn)("font-medium text-gray-500 dark:text-gray-400",T[n]),children:t}),c?(0,e.jsx)("span",{className:"shrink-0 text-gray-400",children:c}):null]}),(0,e.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[d?(0,e.jsx)("div",{className:"flex items-center",style:{height:n==="lg"?30:24},"aria-busy":"true","aria-live":"polite",children:(0,e.jsx)(h.CircularProgress,{indeterminate:!0,size:n==="lg"?"sm":"xs",thickness:"thin","aria-hidden":"true"})}):(0,e.jsx)("span",{className:(0,s.cn)("leading-none font-semibold text-gray-900 dark:text-gray-100",W[n]),children:S}),a&&!d?(0,e.jsxs)("span",{className:(0,s.cn)("flex items-center gap-1 text-xs font-medium",B(p,a.goodWhen??"up")),children:[(0,e.jsx)(M,{direction:p}),b,a.period?(0,e.jsx)("span",{className:"font-normal text-gray-500 dark:text-gray-400",children:a.period}):null]}):null]}),i&&i.length>0&&!d?(0,e.jsx)(f.Sparkline,{data:i,color:x,emphasizeLast:!0,area:!0,width:g[n].width,height:g[n].height,className:"shrink-0"}):null]}),u?(0,e.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:u}):null]})}0&&(module.exports={StatCard});
1
+ "use strict";var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var R=(t,r)=>{for(var o in r)m(t,o,{get:r[o],enumerable:!0})},P=(t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of N(r))!k.call(t,i)&&i!==o&&m(t,i,{get:()=>r[i],enumerable:!(a=D(r,i))||a.enumerable});return t};var L=t=>P(m({},"__esModule",{value:!0}),t);var j={};R(j,{StatCard:()=>Z});module.exports=L(j);var s=require("../../lib/cn.cjs"),d=require("../chart/utils/format.cjs"),h=require("../circular-progress/CircularProgress.cjs"),f=require("../sparkline/Sparkline.cjs"),e=require("react/jsx-runtime"),z={sm:"p-3",md:"p-4",lg:"p-5"},T={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},W={sm:"text-xl",md:"text-2xl",lg:"text-3xl"},p={sm:{width:72,height:22},md:{width:96,height:28},lg:{width:120,height:34}};function A(t){return t.direction?t.direction:t.value>0?"up":t.value<0?"down":"flat"}function B(t,r){return t==="flat"||r==="neutral"?"text-gray-500 dark:text-gray-400":t===r?"text-green-700 dark:text-green-400":"text-red-600 dark:text-red-400"}function M({direction:t}){return t==="flat"?(0,e.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("rect",{x:"1",y:"4.25",width:"8",height:"1.5",rx:"0.75"})}):(0,e.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{d:t==="up"?"M5 1 L9.5 8 L0.5 8 Z":"M5 9 L0.5 2 L9.5 2 Z"})})}function Z({label:t,value:r,format:o,delta:a,trend:i,trendColor:x,icon:c,size:n="md",loading:l=!1,variant:C="card",footer:u,className:v,...y}){let S=typeof r=="number"?(o??d.formatAuto)(r):r,g=a?A(a):"flat",b=a?(a.format??(w=>(0,d.formatPercent)(w,{signed:!0})))(a.value):null;return(0,e.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-2",C==="card"&&(0,s.cn)("rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",z[n]),v),...y,children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsx)("span",{className:(0,s.cn)("font-medium text-gray-500 dark:text-gray-400",T[n]),children:t}),c?(0,e.jsx)("span",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:c}):null]}),(0,e.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[l?(0,e.jsx)("div",{className:"flex items-center",style:{height:n==="lg"?30:24},"aria-busy":"true","aria-live":"polite",children:(0,e.jsx)(h.CircularProgress,{indeterminate:!0,size:n==="lg"?"sm":"xs",thickness:"thin","aria-hidden":"true"})}):(0,e.jsx)("span",{className:(0,s.cn)("leading-none font-semibold text-gray-900 dark:text-gray-100",W[n]),children:S}),a&&!l?(0,e.jsxs)("span",{className:(0,s.cn)("flex items-center gap-1 text-xs font-medium",B(g,a.goodWhen??"up")),children:[(0,e.jsx)(M,{direction:g}),b,a.period?(0,e.jsx)("span",{className:"font-normal text-gray-500 dark:text-gray-400",children:a.period}):null]}):null]}),i&&i.length>0&&!l?(0,e.jsx)(f.Sparkline,{data:i,color:x,emphasizeLast:!0,area:!0,width:p[n].width,height:p[n].height,className:"shrink-0"}):null]}),u?(0,e.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:u}):null]})}0&&(module.exports={StatCard});
@@ -1 +1 @@
1
- import{cn as n}from"../../lib/cn.js";import{formatAuto as S,formatPercent as b}from"../chart/utils/format.js";import{CircularProgress as w}from"../circular-progress/CircularProgress.js";import{Sparkline as D}from"../sparkline/Sparkline.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";var N={sm:"p-3",md:"p-4",lg:"p-5"},k={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},R={sm:"text-xl",md:"text-2xl",lg:"text-3xl"},u={sm:{width:72,height:22},md:{width:96,height:28},lg:{width:120,height:34}};function P(e){return e.direction?e.direction:e.value>0?"up":e.value<0?"down":"flat"}function L(e,i){return e==="flat"||i==="neutral"?"text-gray-500 dark:text-gray-400":e===i?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}function z({direction:e}){return e==="flat"?t("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:t("rect",{x:"1",y:"4.25",width:"8",height:"1.5",rx:"0.75"})}):t("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:t("path",{d:e==="up"?"M5 1 L9.5 8 L0.5 8 Z":"M5 9 L0.5 2 L9.5 2 Z"})})}function M({label:e,value:i,format:p,delta:r,trend:s,trendColor:g,icon:d,size:a="md",loading:l=!1,variant:h="card",footer:m,className:f,...x}){let C=typeof i=="number"?(p??S)(i):i,c=r?P(r):"flat",v=r?(r.format??(y=>b(y,{signed:!0})))(r.value):null;return o("div",{className:n("flex flex-col gap-2",h==="card"&&n("rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",N[a]),f),...x,children:[o("div",{className:"flex items-start justify-between gap-2",children:[t("span",{className:n("font-medium text-gray-500 dark:text-gray-400",k[a]),children:e}),d?t("span",{className:"shrink-0 text-gray-400",children:d}):null]}),o("div",{className:"flex items-end justify-between gap-3",children:[o("div",{className:"flex min-w-0 flex-col gap-1",children:[l?t("div",{className:"flex items-center",style:{height:a==="lg"?30:24},"aria-busy":"true","aria-live":"polite",children:t(w,{indeterminate:!0,size:a==="lg"?"sm":"xs",thickness:"thin","aria-hidden":"true"})}):t("span",{className:n("leading-none font-semibold text-gray-900 dark:text-gray-100",R[a]),children:C}),r&&!l?o("span",{className:n("flex items-center gap-1 text-xs font-medium",L(c,r.goodWhen??"up")),children:[t(z,{direction:c}),v,r.period?t("span",{className:"font-normal text-gray-500 dark:text-gray-400",children:r.period}):null]}):null]}),s&&s.length>0&&!l?t(D,{data:s,color:g,emphasizeLast:!0,area:!0,width:u[a].width,height:u[a].height,className:"shrink-0"}):null]}),m?t("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:m}):null]})}export{M as StatCard};
1
+ import{cn as n}from"../../lib/cn.js";import{formatAuto as S,formatPercent as b}from"../chart/utils/format.js";import{CircularProgress as w}from"../circular-progress/CircularProgress.js";import{Sparkline as D}from"../sparkline/Sparkline.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";var N={sm:"p-3",md:"p-4",lg:"p-5"},k={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},R={sm:"text-xl",md:"text-2xl",lg:"text-3xl"},u={sm:{width:72,height:22},md:{width:96,height:28},lg:{width:120,height:34}};function P(e){return e.direction?e.direction:e.value>0?"up":e.value<0?"down":"flat"}function L(e,i){return e==="flat"||i==="neutral"?"text-gray-500 dark:text-gray-400":e===i?"text-green-700 dark:text-green-400":"text-red-600 dark:text-red-400"}function z({direction:e}){return e==="flat"?t("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:t("rect",{x:"1",y:"4.25",width:"8",height:"1.5",rx:"0.75"})}):t("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor","aria-hidden":"true",children:t("path",{d:e==="up"?"M5 1 L9.5 8 L0.5 8 Z":"M5 9 L0.5 2 L9.5 2 Z"})})}function M({label:e,value:i,format:g,delta:r,trend:s,trendColor:p,icon:l,size:a="md",loading:d=!1,variant:h="card",footer:m,className:f,...x}){let C=typeof i=="number"?(g??S)(i):i,c=r?P(r):"flat",v=r?(r.format??(y=>b(y,{signed:!0})))(r.value):null;return o("div",{className:n("flex flex-col gap-2",h==="card"&&n("rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",N[a]),f),...x,children:[o("div",{className:"flex items-start justify-between gap-2",children:[t("span",{className:n("font-medium text-gray-500 dark:text-gray-400",k[a]),children:e}),l?t("span",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:l}):null]}),o("div",{className:"flex items-end justify-between gap-3",children:[o("div",{className:"flex min-w-0 flex-col gap-1",children:[d?t("div",{className:"flex items-center",style:{height:a==="lg"?30:24},"aria-busy":"true","aria-live":"polite",children:t(w,{indeterminate:!0,size:a==="lg"?"sm":"xs",thickness:"thin","aria-hidden":"true"})}):t("span",{className:n("leading-none font-semibold text-gray-900 dark:text-gray-100",R[a]),children:C}),r&&!d?o("span",{className:n("flex items-center gap-1 text-xs font-medium",L(c,r.goodWhen??"up")),children:[t(z,{direction:c}),v,r.period?t("span",{className:"font-normal text-gray-500 dark:text-gray-400",children:r.period}):null]}):null]}),s&&s.length>0&&!d?t(D,{data:s,color:p,emphasizeLast:!0,area:!0,width:u[a].width,height:u[a].height,className:"shrink-0"}):null]}),m?t("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:m}):null]})}export{M as StatCard};
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var i=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of n(e))!s.call(t,a)&&a!==r&&o(t,a,{get:()=>e[a],enumerable:!(c=b(e,a))||c.enumerable});return t};var T=t=>l(o({},"__esModule",{value:!0}),t);var x={};i(x,{TableHeader:()=>g});module.exports=T(x);var p=require("../../lib/cn.cjs"),d=require("react/jsx-runtime");function g({children:t,className:e,...r}){return(0,d.jsx)("thead",{className:(0,p.cn)("text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",e),...r,children:(0,d.jsx)("tr",{children:t})})}0&&(module.exports={TableHeader});
1
+ "use strict";var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var i=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of n(e))!s.call(t,a)&&a!==r&&o(t,a,{get:()=>e[a],enumerable:!(c=b(e,a))||c.enumerable});return t};var T=t=>l(o({},"__esModule",{value:!0}),t);var x={};i(x,{TableHeader:()=>g});module.exports=T(x);var p=require("../../lib/cn.cjs"),d=require("react/jsx-runtime");function g({children:t,className:e,...r}){return(0,d.jsx)("thead",{className:(0,p.cn)("text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-300",e),...r,children:(0,d.jsx)("tr",{children:t})})}0&&(module.exports={TableHeader});
@@ -1 +1 @@
1
- import{cn as o}from"../../lib/cn.js";import{jsx as e}from"react/jsx-runtime";function c({children:t,className:r,...a}){return e("thead",{className:o("text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",r),...a,children:e("tr",{children:t})})}export{c as TableHeader};
1
+ import{cn as o}from"../../lib/cn.js";import{jsx as e}from"react/jsx-runtime";function c({children:t,className:r,...a}){return e("thead",{className:o("text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-300",r),...a,children:e("tr",{children:t})})}export{c as TableHeader};
@@ -1 +1 @@
1
- "use strict";"use client";var s=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var P=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},A=(e,r,t,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of B(r))!L.call(e,a)&&a!==t&&s(e,a,{get:()=>r[a],enumerable:!(l=D(r,a))||l.enumerable});return e};var H=e=>A(s({},"__esModule",{value:!0}),e);var W={};P(W,{TabsTrigger:()=>w});module.exports=H(W);var h=require("react"),d=require("../../lib/cn.cjs"),o=require("./TabsContext.cjs"),n=require("react/jsx-runtime"),M={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-5 py-2.5 text-base gap-2"},k={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},u={default:{underline:{active:"text-gray-900 dark:text-white border-gray-900 dark:border-white",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-gray-700 dark:hover:text-gray-300"},pills:{active:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"},enclosed:{active:"bg-white dark:bg-gray-800 text-gray-900 dark:text-white border-gray-200 dark:border-gray-700 border-b-white dark:border-b-gray-800",inactive:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 border-transparent"},soft:{active:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700/50"}},primary:{underline:{active:"text-blue-600 dark:text-blue-400 border-blue-600 dark:border-blue-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-blue-600 dark:hover:text-blue-400"},pills:{active:"bg-blue-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"},enclosed:{active:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 border-b-blue-50 dark:border-b-blue-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 border-transparent"},soft:{active:"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"}},secondary:{underline:{active:"text-purple-600 dark:text-purple-400 border-purple-600 dark:border-purple-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-purple-600 dark:hover:text-purple-400"},pills:{active:"bg-purple-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400"},enclosed:{active:"bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 border-b-purple-50 dark:border-b-purple-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 border-transparent"},soft:{active:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20"}},success:{underline:{active:"text-green-600 dark:text-green-400 border-green-600 dark:border-green-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-green-600 dark:hover:text-green-400"},pills:{active:"bg-green-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400"},enclosed:{active:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 border-b-green-50 dark:border-b-green-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 border-transparent"},soft:{active:"bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"}},warning:{underline:{active:"text-yellow-600 dark:text-yellow-400 border-yellow-600 dark:border-yellow-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-yellow-600 dark:hover:text-yellow-400"},pills:{active:"bg-yellow-500 text-gray-900",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400"},enclosed:{active:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 border-b-yellow-50 dark:border-b-yellow-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400 border-transparent"},soft:{active:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400 hover:bg-yellow-50 dark:hover:bg-yellow-900/20"}},error:{underline:{active:"text-red-600 dark:text-red-400 border-red-600 dark:border-red-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-red-600 dark:hover:text-red-400"},pills:{active:"bg-red-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400"},enclosed:{active:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800 border-b-red-50 dark:border-b-red-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 border-transparent"},soft:{active:"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20"}}},O={underline:"border-b-2 -mb-px",pills:"rounded-md",enclosed:"border border-b-0 rounded-t-md -mb-px",soft:"rounded-md"};function w({value:e,children:r,disabled:t=!1,icon:l,endIcon:a,className:f,activeClassName:m,inactiveClassName:T}){let{value:C,onValueChange:N,variant:b,size:g,color:v,fullWidth:R,baseId:y}=(0,o.useTabsContext)(),{fallbackTabStopId:S}=(0,h.useContext)(o.TabsListContext),i=C===e,c=(0,o.getTabsId)(y,"tab",e),z=!t&&(i||S===c),p=()=>{t||N(e)},I=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),p())},E=(0,d.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500",M[g],R&&"flex-1"),K=i?(0,d.cn)(u[v][b].active,m):(0,d.cn)(u[v][b].inactive,T),V=t?"opacity-50 cursor-not-allowed":"cursor-pointer";return(0,n.jsxs)("button",{type:"button",role:"tab",id:c,"aria-selected":i,"aria-controls":i?(0,o.getTabsId)(y,"panel",e):void 0,"aria-disabled":t,tabIndex:z?0:-1,onClick:p,onKeyDown:I,disabled:t,className:(0,d.cn)(E,O[b],K,V,f),children:[l&&(0,n.jsx)("span",{className:(0,d.cn)("shrink-0",k[g]),children:l}),(0,n.jsx)("span",{children:r}),a&&(0,n.jsx)("span",{className:(0,d.cn)("shrink-0",k[g]),children:a})]})}w.displayName="TabsTrigger";0&&(module.exports={TabsTrigger});
1
+ "use strict";"use client";var s=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var P=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},A=(e,r,t,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of B(r))!L.call(e,a)&&a!==t&&s(e,a,{get:()=>r[a],enumerable:!(l=D(r,a))||l.enumerable});return e};var H=e=>A(s({},"__esModule",{value:!0}),e);var W={};P(W,{TabsTrigger:()=>w});module.exports=H(W);var h=require("react"),d=require("../../lib/cn.cjs"),o=require("./TabsContext.cjs"),n=require("react/jsx-runtime"),M={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-5 py-2.5 text-base gap-2"},k={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},u={default:{underline:{active:"text-gray-900 dark:text-white border-gray-900 dark:border-white",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-gray-700 dark:hover:text-gray-300"},pills:{active:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"},enclosed:{active:"bg-white dark:bg-gray-800 text-gray-900 dark:text-white border-gray-200 dark:border-gray-700 border-b-white dark:border-b-gray-800",inactive:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 border-transparent"},soft:{active:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700/50"}},primary:{underline:{active:"text-blue-600 dark:text-blue-400 border-blue-600 dark:border-blue-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-blue-600 dark:hover:text-blue-400"},pills:{active:"bg-blue-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"},enclosed:{active:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 border-b-blue-50 dark:border-b-blue-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 border-transparent"},soft:{active:"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"}},secondary:{underline:{active:"text-purple-600 dark:text-purple-400 border-purple-600 dark:border-purple-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-purple-600 dark:hover:text-purple-400"},pills:{active:"bg-purple-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400"},enclosed:{active:"bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 border-b-purple-50 dark:border-b-purple-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 border-transparent"},soft:{active:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20"}},success:{underline:{active:"text-green-700 dark:text-green-400 border-green-600 dark:border-green-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-green-700 dark:hover:text-green-400"},pills:{active:"bg-green-700 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-700 dark:hover:text-green-400"},enclosed:{active:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800 border-b-green-50 dark:border-b-green-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-green-700 dark:hover:text-green-400 border-transparent"},soft:{active:"bg-green-100 dark:bg-green-900/50 text-green-800 dark:text-green-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-700 dark:hover:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"}},warning:{underline:{active:"text-yellow-700 dark:text-yellow-400 border-yellow-600 dark:border-yellow-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-yellow-700 dark:hover:text-yellow-400"},pills:{active:"bg-yellow-500 text-gray-900",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-700 dark:hover:text-yellow-400"},enclosed:{active:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 border-b-yellow-50 dark:border-b-yellow-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-yellow-700 dark:hover:text-yellow-400 border-transparent"},soft:{active:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-700 dark:hover:text-yellow-400 hover:bg-yellow-50 dark:hover:bg-yellow-900/20"}},error:{underline:{active:"text-red-600 dark:text-red-400 border-red-600 dark:border-red-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-red-600 dark:hover:text-red-400"},pills:{active:"bg-red-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400"},enclosed:{active:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800 border-b-red-50 dark:border-b-red-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 border-transparent"},soft:{active:"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20"}}},O={underline:"border-b-2 -mb-px",pills:"rounded-md",enclosed:"border border-b-0 rounded-t-md -mb-px",soft:"rounded-md"};function w({value:e,children:r,disabled:t=!1,icon:l,endIcon:a,className:f,activeClassName:m,inactiveClassName:T}){let{value:C,onValueChange:N,variant:b,size:g,color:v,fullWidth:R,baseId:y}=(0,o.useTabsContext)(),{fallbackTabStopId:S}=(0,h.useContext)(o.TabsListContext),i=C===e,c=(0,o.getTabsId)(y,"tab",e),z=!t&&(i||S===c),p=()=>{t||N(e)},I=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),p())},E=(0,d.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500",M[g],R&&"flex-1"),K=i?(0,d.cn)(u[v][b].active,m):(0,d.cn)(u[v][b].inactive,T),V=t?"opacity-50 cursor-not-allowed":"cursor-pointer";return(0,n.jsxs)("button",{type:"button",role:"tab",id:c,"aria-selected":i,"aria-controls":i?(0,o.getTabsId)(y,"panel",e):void 0,"aria-disabled":t,tabIndex:z?0:-1,onClick:p,onKeyDown:I,disabled:t,className:(0,d.cn)(E,O[b],K,V,f),children:[l&&(0,n.jsx)("span",{className:(0,d.cn)("shrink-0",k[g]),children:l}),(0,n.jsx)("span",{children:r}),a&&(0,n.jsx)("span",{className:(0,d.cn)("shrink-0",k[g]),children:a})]})}w.displayName="TabsTrigger";0&&(module.exports={TabsTrigger});
@@ -1 +1 @@
1
- "use client";import{useContext as E}from"react";import{cn as e}from"../../lib/cn.js";import{getTabsId as y,TabsListContext as K,useTabsContext as V}from"./TabsContext.js";import{jsx as l,jsxs as P}from"react/jsx-runtime";var D={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-5 py-2.5 text-base gap-2"},c={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},p={default:{underline:{active:"text-gray-900 dark:text-white border-gray-900 dark:border-white",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-gray-700 dark:hover:text-gray-300"},pills:{active:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"},enclosed:{active:"bg-white dark:bg-gray-800 text-gray-900 dark:text-white border-gray-200 dark:border-gray-700 border-b-white dark:border-b-gray-800",inactive:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 border-transparent"},soft:{active:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700/50"}},primary:{underline:{active:"text-blue-600 dark:text-blue-400 border-blue-600 dark:border-blue-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-blue-600 dark:hover:text-blue-400"},pills:{active:"bg-blue-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"},enclosed:{active:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 border-b-blue-50 dark:border-b-blue-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 border-transparent"},soft:{active:"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"}},secondary:{underline:{active:"text-purple-600 dark:text-purple-400 border-purple-600 dark:border-purple-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-purple-600 dark:hover:text-purple-400"},pills:{active:"bg-purple-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400"},enclosed:{active:"bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 border-b-purple-50 dark:border-b-purple-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 border-transparent"},soft:{active:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20"}},success:{underline:{active:"text-green-600 dark:text-green-400 border-green-600 dark:border-green-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-green-600 dark:hover:text-green-400"},pills:{active:"bg-green-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400"},enclosed:{active:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 border-b-green-50 dark:border-b-green-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 border-transparent"},soft:{active:"bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"}},warning:{underline:{active:"text-yellow-600 dark:text-yellow-400 border-yellow-600 dark:border-yellow-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-yellow-600 dark:hover:text-yellow-400"},pills:{active:"bg-yellow-500 text-gray-900",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400"},enclosed:{active:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 border-b-yellow-50 dark:border-b-yellow-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400 border-transparent"},soft:{active:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400 hover:bg-yellow-50 dark:hover:bg-yellow-900/20"}},error:{underline:{active:"text-red-600 dark:text-red-400 border-red-600 dark:border-red-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-red-600 dark:hover:text-red-400"},pills:{active:"bg-red-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400"},enclosed:{active:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800 border-b-red-50 dark:border-b-red-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 border-transparent"},soft:{active:"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20"}}},B={underline:"border-b-2 -mb-px",pills:"rounded-md",enclosed:"border border-b-0 rounded-t-md -mb-px",soft:"rounded-md"};function L({value:t,children:k,disabled:r=!1,icon:i,endIcon:b,className:u,activeClassName:h,inactiveClassName:w}){let{value:f,onValueChange:m,variant:d,size:o,color:g,fullWidth:T,baseId:x}=V(),{fallbackTabStopId:C}=E(K),a=f===t,s=y(x,"tab",t),N=!r&&(a||C===s),v=()=>{r||m(t)},R=n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),v())},S=e("inline-flex items-center justify-center font-medium transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500",D[o],T&&"flex-1"),z=a?e(p[g][d].active,h):e(p[g][d].inactive,w),I=r?"opacity-50 cursor-not-allowed":"cursor-pointer";return P("button",{type:"button",role:"tab",id:s,"aria-selected":a,"aria-controls":a?y(x,"panel",t):void 0,"aria-disabled":r,tabIndex:N?0:-1,onClick:v,onKeyDown:R,disabled:r,className:e(S,B[d],z,I,u),children:[i&&l("span",{className:e("shrink-0",c[o]),children:i}),l("span",{children:k}),b&&l("span",{className:e("shrink-0",c[o]),children:b})]})}L.displayName="TabsTrigger";export{L as TabsTrigger};
1
+ "use client";import{useContext as E}from"react";import{cn as e}from"../../lib/cn.js";import{getTabsId as y,TabsListContext as K,useTabsContext as V}from"./TabsContext.js";import{jsx as l,jsxs as P}from"react/jsx-runtime";var D={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-5 py-2.5 text-base gap-2"},c={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},p={default:{underline:{active:"text-gray-900 dark:text-white border-gray-900 dark:border-white",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-gray-700 dark:hover:text-gray-300"},pills:{active:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"},enclosed:{active:"bg-white dark:bg-gray-800 text-gray-900 dark:text-white border-gray-200 dark:border-gray-700 border-b-white dark:border-b-gray-800",inactive:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 border-transparent"},soft:{active:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700/50"}},primary:{underline:{active:"text-blue-600 dark:text-blue-400 border-blue-600 dark:border-blue-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-blue-600 dark:hover:text-blue-400"},pills:{active:"bg-blue-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"},enclosed:{active:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 border-b-blue-50 dark:border-b-blue-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 border-transparent"},soft:{active:"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"}},secondary:{underline:{active:"text-purple-600 dark:text-purple-400 border-purple-600 dark:border-purple-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-purple-600 dark:hover:text-purple-400"},pills:{active:"bg-purple-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400"},enclosed:{active:"bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 border-b-purple-50 dark:border-b-purple-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 border-transparent"},soft:{active:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20"}},success:{underline:{active:"text-green-700 dark:text-green-400 border-green-600 dark:border-green-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-green-700 dark:hover:text-green-400"},pills:{active:"bg-green-700 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-700 dark:hover:text-green-400"},enclosed:{active:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800 border-b-green-50 dark:border-b-green-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-green-700 dark:hover:text-green-400 border-transparent"},soft:{active:"bg-green-100 dark:bg-green-900/50 text-green-800 dark:text-green-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-700 dark:hover:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"}},warning:{underline:{active:"text-yellow-700 dark:text-yellow-400 border-yellow-600 dark:border-yellow-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-yellow-700 dark:hover:text-yellow-400"},pills:{active:"bg-yellow-500 text-gray-900",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-700 dark:hover:text-yellow-400"},enclosed:{active:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 border-b-yellow-50 dark:border-b-yellow-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-yellow-700 dark:hover:text-yellow-400 border-transparent"},soft:{active:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-700 dark:hover:text-yellow-400 hover:bg-yellow-50 dark:hover:bg-yellow-900/20"}},error:{underline:{active:"text-red-600 dark:text-red-400 border-red-600 dark:border-red-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-red-600 dark:hover:text-red-400"},pills:{active:"bg-red-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400"},enclosed:{active:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800 border-b-red-50 dark:border-b-red-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 border-transparent"},soft:{active:"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20"}}},B={underline:"border-b-2 -mb-px",pills:"rounded-md",enclosed:"border border-b-0 rounded-t-md -mb-px",soft:"rounded-md"};function L({value:t,children:k,disabled:r=!1,icon:i,endIcon:b,className:u,activeClassName:h,inactiveClassName:w}){let{value:f,onValueChange:m,variant:d,size:o,color:g,fullWidth:T,baseId:x}=V(),{fallbackTabStopId:C}=E(K),a=f===t,s=y(x,"tab",t),N=!r&&(a||C===s),v=()=>{r||m(t)},R=n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),v())},S=e("inline-flex items-center justify-center font-medium transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500",D[o],T&&"flex-1"),z=a?e(p[g][d].active,h):e(p[g][d].inactive,w),I=r?"opacity-50 cursor-not-allowed":"cursor-pointer";return P("button",{type:"button",role:"tab",id:s,"aria-selected":a,"aria-controls":a?y(x,"panel",t):void 0,"aria-disabled":r,tabIndex:N?0:-1,onClick:v,onKeyDown:R,disabled:r,className:e(S,B[d],z,I,u),children:[i&&l("span",{className:e("shrink-0",c[o]),children:i}),l("span",{children:k}),b&&l("span",{className:e("shrink-0",c[o]),children:b})]})}L.displayName="TabsTrigger";export{L as TabsTrigger};
@@ -1 +1 @@
1
- "use strict";"use client";var i=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var n in r)i(t,n,{get:r[n],enumerable:!0})},L=(t,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of v(r))!N.call(t,o)&&o!==n&&i(t,o,{get:()=>r[o],enumerable:!(s=C(r,o))||s.enumerable});return t};var M=t=>L(i({},"__esModule",{value:!0}),t);var j={};T(j,{Toast:()=>b});module.exports=M(j);var a=require("../../lib/cn.cjs"),c=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function R({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 I({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 W({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 g({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 H({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 P={success:R,error:I,warning:W,info:g,default:g},V={success:{solid:"bg-green-600 text-white border-green-600",outlined:"bg-white text-green-700 border-green-600 dark:bg-gray-900 dark:text-green-400",soft:"bg-green-50 text-green-700 border-green-200 dark:bg-green-900/20 dark:text-green-400 dark:border-green-800"},error:{solid:"bg-red-600 text-white border-red-600",outlined:"bg-white text-red-700 border-red-600 dark:bg-gray-900 dark:text-red-400",soft:"bg-red-50 text-red-700 border-red-200 dark:bg-red-900/20 dark:text-red-400 dark:border-red-800"},warning:{solid:"bg-yellow-500 text-gray-900 border-yellow-500",outlined:"bg-white text-yellow-700 border-yellow-500 dark:bg-gray-900 dark:text-yellow-400",soft:"bg-yellow-50 text-yellow-700 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-400 dark:border-yellow-800"},info:{solid:"bg-blue-600 text-white border-blue-600",outlined:"bg-white text-blue-700 border-blue-600 dark:bg-gray-900 dark:text-blue-400",soft:"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800"},default:{solid:"bg-gray-700 text-white border-gray-700",outlined:"bg-white text-gray-700 border-gray-300 dark:bg-gray-900 dark:text-gray-300",soft:"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"}},B={success:"text-green-600 dark:text-green-400",error:"text-red-600 dark:text-red-400",warning:"text-yellow-600 dark:text-yellow-400",info:"text-blue-600 dark:text-blue-400",default:"text-gray-600 dark:text-gray-400"};function b({children:t,title:r,description:n,type:s="default",variant:o="soft",icon:u,action:d,onClose:w,closable:x=!0,closeLabel:k,className:m,...p}){let f=(0,c.useUILabels)(),h=P[s],y=(0,e.jsx)(h,{className:"w-5 h-5"}),l=t??n;return(0,e.jsxs)("div",{role:"alert",className:(0,a.cn)("flex items-start gap-3 p-4 rounded-lg border shadow-lg min-w-[320px] max-w-md","animate-in slide-in-from-top-2 fade-in duration-300",V[s][o],m),...p,children:[(0,e.jsx)("div",{className:(0,a.cn)("flex-shrink-0 mt-0.5",o!=="solid"&&B[s]),children:u??y}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[r&&(0,e.jsx)("div",{className:"font-semibold text-sm mb-1",children:r}),l&&(0,e.jsx)("div",{className:"text-sm opacity-90",children:l}),d&&(0,e.jsx)("div",{className:"mt-3",children:d})]}),x&&(0,e.jsx)("button",{type:"button",onClick:w,className:(0,a.cn)("flex-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":k??f.toastClose,children:(0,e.jsx)(H,{className:"w-4 h-4"})})]})}b.displayName="Toast";0&&(module.exports={Toast});
1
+ "use strict";"use client";var i=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var n in r)i(t,n,{get:r[n],enumerable:!0})},L=(t,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of v(r))!N.call(t,o)&&o!==n&&i(t,o,{get:()=>r[o],enumerable:!(s=C(r,o))||s.enumerable});return t};var M=t=>L(i({},"__esModule",{value:!0}),t);var j={};T(j,{Toast:()=>b});module.exports=M(j);var a=require("../../lib/cn.cjs"),c=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function R({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 I({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 W({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 g({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 H({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 P={success:R,error:I,warning:W,info:g,default:g},V={success:{solid:"bg-green-700 text-white border-green-700",outlined:"bg-white text-green-700 border-green-600 dark:bg-gray-900 dark:text-green-400",soft:"bg-green-50 text-green-700 border-green-200 dark:bg-green-900/20 dark:text-green-400 dark:border-green-800"},error:{solid:"bg-red-600 text-white border-red-600",outlined:"bg-white text-red-700 border-red-600 dark:bg-gray-900 dark:text-red-400",soft:"bg-red-50 text-red-700 border-red-200 dark:bg-red-900/20 dark:text-red-400 dark:border-red-800"},warning:{solid:"bg-yellow-500 text-gray-900 border-yellow-500",outlined:"bg-white text-yellow-700 border-yellow-500 dark:bg-gray-900 dark:text-yellow-400",soft:"bg-yellow-50 text-yellow-700 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-400 dark:border-yellow-800"},info:{solid:"bg-blue-600 text-white border-blue-600",outlined:"bg-white text-blue-700 border-blue-600 dark:bg-gray-900 dark:text-blue-400",soft:"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800"},default:{solid:"bg-gray-700 text-white border-gray-700",outlined:"bg-white text-gray-700 border-gray-300 dark:bg-gray-900 dark:text-gray-300",soft:"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"}},B={success:"text-green-700 dark:text-green-400",error:"text-red-600 dark:text-red-400",warning:"text-yellow-700 dark:text-yellow-400",info:"text-blue-600 dark:text-blue-400",default:"text-gray-600 dark:text-gray-400"};function b({children:t,title:r,description:n,type:s="default",variant:o="soft",icon:u,action:d,onClose:w,closable:x=!0,closeLabel:k,className:m,...p}){let f=(0,c.useUILabels)(),h=P[s],y=(0,e.jsx)(h,{className:"w-5 h-5"}),l=t??n;return(0,e.jsxs)("div",{role:"alert",className:(0,a.cn)("flex items-start gap-3 p-4 rounded-lg border shadow-lg min-w-[320px] max-w-md","animate-in slide-in-from-top-2 fade-in duration-300",V[s][o],m),...p,children:[(0,e.jsx)("div",{className:(0,a.cn)("flex-shrink-0 mt-0.5",o!=="solid"&&B[s]),children:u??y}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[r&&(0,e.jsx)("div",{className:"font-semibold text-sm mb-1",children:r}),l&&(0,e.jsx)("div",{className:"text-sm",children:l}),d&&(0,e.jsx)("div",{className:"mt-3",children:d})]}),x&&(0,e.jsx)("button",{type:"button",onClick:w,className:(0,a.cn)("flex-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":k??f.toastClose,children:(0,e.jsx)(H,{className:"w-4 h-4"})})]})}b.displayName="Toast";0&&(module.exports={Toast});
@@ -1 +1 @@
1
- "use client";import{cn as o}from"../../lib/cn.js";import{useUILabels as h}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:"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 C({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 v({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 d({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 N({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 T={success:y,error:C,warning:v,info:d,default:d},L={success:{solid:"bg-green-600 text-white border-green-600",outlined:"bg-white text-green-700 border-green-600 dark:bg-gray-900 dark:text-green-400",soft:"bg-green-50 text-green-700 border-green-200 dark:bg-green-900/20 dark:text-green-400 dark:border-green-800"},error:{solid:"bg-red-600 text-white border-red-600",outlined:"bg-white text-red-700 border-red-600 dark:bg-gray-900 dark:text-red-400",soft:"bg-red-50 text-red-700 border-red-200 dark:bg-red-900/20 dark:text-red-400 dark:border-red-800"},warning:{solid:"bg-yellow-500 text-gray-900 border-yellow-500",outlined:"bg-white text-yellow-700 border-yellow-500 dark:bg-gray-900 dark:text-yellow-400",soft:"bg-yellow-50 text-yellow-700 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-400 dark:border-yellow-800"},info:{solid:"bg-blue-600 text-white border-blue-600",outlined:"bg-white text-blue-700 border-blue-600 dark:bg-gray-900 dark:text-blue-400",soft:"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800"},default:{solid:"bg-gray-700 text-white border-gray-700",outlined:"bg-white text-gray-700 border-gray-300 dark:bg-gray-900 dark:text-gray-300",soft:"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"}},M={success:"text-green-600 dark:text-green-400",error:"text-red-600 dark:text-red-400",warning:"text-yellow-600 dark:text-yellow-400",info:"text-blue-600 dark:text-blue-400",default:"text-gray-600 dark:text-gray-400"};function R({children:t,title:n,description:g,type:r="default",variant:s="soft",icon:c,action:a,onClose:b,closable:u=!0,closeLabel:w,className:x,...k}){let m=h(),p=T[r],f=e(p,{className:"w-5 h-5"}),i=t??g;return l("div",{role:"alert",className:o("flex items-start gap-3 p-4 rounded-lg border shadow-lg min-w-[320px] max-w-md","animate-in slide-in-from-top-2 fade-in duration-300",L[r][s],x),...k,children:[e("div",{className:o("flex-shrink-0 mt-0.5",s!=="solid"&&M[r]),children:c??f}),l("div",{className:"flex-1 min-w-0",children:[n&&e("div",{className:"font-semibold text-sm mb-1",children:n}),i&&e("div",{className:"text-sm opacity-90",children:i}),a&&e("div",{className:"mt-3",children:a})]}),u&&e("button",{type:"button",onClick:b,className:o("flex-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":w??m.toastClose,children:e(N,{className:"w-4 h-4"})})]})}R.displayName="Toast";export{R as Toast};
1
+ "use client";import{cn as o}from"../../lib/cn.js";import{useUILabels as h}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:"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 C({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 v({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 d({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 N({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 T={success:y,error:C,warning:v,info:d,default:d},L={success:{solid:"bg-green-700 text-white border-green-700",outlined:"bg-white text-green-700 border-green-600 dark:bg-gray-900 dark:text-green-400",soft:"bg-green-50 text-green-700 border-green-200 dark:bg-green-900/20 dark:text-green-400 dark:border-green-800"},error:{solid:"bg-red-600 text-white border-red-600",outlined:"bg-white text-red-700 border-red-600 dark:bg-gray-900 dark:text-red-400",soft:"bg-red-50 text-red-700 border-red-200 dark:bg-red-900/20 dark:text-red-400 dark:border-red-800"},warning:{solid:"bg-yellow-500 text-gray-900 border-yellow-500",outlined:"bg-white text-yellow-700 border-yellow-500 dark:bg-gray-900 dark:text-yellow-400",soft:"bg-yellow-50 text-yellow-700 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-400 dark:border-yellow-800"},info:{solid:"bg-blue-600 text-white border-blue-600",outlined:"bg-white text-blue-700 border-blue-600 dark:bg-gray-900 dark:text-blue-400",soft:"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800"},default:{solid:"bg-gray-700 text-white border-gray-700",outlined:"bg-white text-gray-700 border-gray-300 dark:bg-gray-900 dark:text-gray-300",soft:"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"}},M={success:"text-green-700 dark:text-green-400",error:"text-red-600 dark:text-red-400",warning:"text-yellow-700 dark:text-yellow-400",info:"text-blue-600 dark:text-blue-400",default:"text-gray-600 dark:text-gray-400"};function R({children:t,title:n,description:g,type:r="default",variant:s="soft",icon:c,action:a,onClose:b,closable:u=!0,closeLabel:w,className:x,...k}){let m=h(),p=T[r],f=e(p,{className:"w-5 h-5"}),i=t??g;return l("div",{role:"alert",className:o("flex items-start gap-3 p-4 rounded-lg border shadow-lg min-w-[320px] max-w-md","animate-in slide-in-from-top-2 fade-in duration-300",L[r][s],x),...k,children:[e("div",{className:o("flex-shrink-0 mt-0.5",s!=="solid"&&M[r]),children:c??f}),l("div",{className:"flex-1 min-w-0",children:[n&&e("div",{className:"font-semibold text-sm mb-1",children:n}),i&&e("div",{className:"text-sm",children:i}),a&&e("div",{className:"mt-3",children:a})]}),u&&e("button",{type:"button",onClick:b,className:o("flex-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":w??m.toastClose,children:e(N,{className:"w-4 h-4"})})]})}R.displayName="Toast";export{R as Toast};
@@ -1 +1 @@
1
- "use strict";"use client";var g=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var M=(t,r)=>{for(var e in r)g(t,e,{get:r[e],enumerable:!0})},L=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of V(r))!S.call(t,o)&&o!==e&&g(t,o,{get:()=>r[o],enumerable:!(a=z(r,o))||a.enumerable});return t};var A=t=>L(g({},"__esModule",{value:!0}),t);var O={};M(O,{Tooltip:()=>m});module.exports=A(O);var l=require("react"),d=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),H={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-600 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},E={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-600",bottom:"border-b-green-600",left:"border-l-green-600",right:"border-r-green-600"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},B={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},D={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},F={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},I={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function m({children:t,content:r,position:e="top",variant:a="default",size:o="md",trigger:u="hover",open:y,delay:p=0,showArrow:h=!0,maxWidth:T="max-w-xs",className:w,contentClassName:x,disabled:i=!1,...k}){let[R,s]=(0,l.useState)(!1),b=(0,l.useRef)(null),c=(0,l.useCallback)(()=>{i||(p>0?b.current=setTimeout(()=>s(!0),p):s(!0))},[p,i]),f=(0,l.useCallback)(()=>{b.current&&(clearTimeout(b.current),b.current=null),s(!1)},[]),v=(0,l.useCallback)(()=>{i||s(N=>!N)},[i]),C=u==="manual"?y:R,P={hover:{onMouseEnter:c,onMouseLeave:f,onFocus:c,onBlur:f},click:{onClick:v},manual:{}}[u];return(0,n.jsxs)("div",{className:(0,d.cn)("relative inline-flex",w),...P,...k,children:[t,C&&!i&&(0,n.jsxs)("div",{role:"tooltip",className:(0,d.cn)("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",F[e],H[a],B[o],T,x),children:[r,h&&(0,n.jsx)("span",{className:(0,d.cn)("absolute w-0 h-0 border-solid",D[o],I[e],E[a][e]),"aria-hidden":"true"})]})]})}m.displayName="Tooltip";0&&(module.exports={Tooltip});
1
+ "use strict";"use client";var g=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var M=(t,r)=>{for(var e in r)g(t,e,{get:r[e],enumerable:!0})},L=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of V(r))!S.call(t,o)&&o!==e&&g(t,o,{get:()=>r[o],enumerable:!(a=z(r,o))||a.enumerable});return t};var A=t=>L(g({},"__esModule",{value:!0}),t);var O={};M(O,{Tooltip:()=>m});module.exports=A(O);var l=require("react"),d=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),H={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},E={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-700",bottom:"border-b-green-700",left:"border-l-green-700",right:"border-r-green-700"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},B={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},D={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},F={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},I={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function m({children:t,content:r,position:e="top",variant:a="default",size:o="md",trigger:u="hover",open:y,delay:p=0,showArrow:h=!0,maxWidth:T="max-w-xs",className:w,contentClassName:x,disabled:i=!1,...k}){let[R,s]=(0,l.useState)(!1),b=(0,l.useRef)(null),c=(0,l.useCallback)(()=>{i||(p>0?b.current=setTimeout(()=>s(!0),p):s(!0))},[p,i]),f=(0,l.useCallback)(()=>{b.current&&(clearTimeout(b.current),b.current=null),s(!1)},[]),v=(0,l.useCallback)(()=>{i||s(N=>!N)},[i]),C=u==="manual"?y:R,P={hover:{onMouseEnter:c,onMouseLeave:f,onFocus:c,onBlur:f},click:{onClick:v},manual:{}}[u];return(0,n.jsxs)("div",{className:(0,d.cn)("relative inline-flex",w),...P,...k,children:[t,C&&!i&&(0,n.jsxs)("div",{role:"tooltip",className:(0,d.cn)("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",F[e],H[a],B[o],T,x),children:[r,h&&(0,n.jsx)("span",{className:(0,d.cn)("absolute w-0 h-0 border-solid",D[o],I[e],E[a][e]),"aria-hidden":"true"})]})]})}m.displayName="Tooltip";0&&(module.exports={Tooltip});
@@ -1 +1 @@
1
- "use client";import{useState as P,useRef as N,useCallback as a}from"react";import{cn as i}from"../../lib/cn.js";import{jsx as E,jsxs as g}from"react/jsx-runtime";var z={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-600 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},V={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-600",bottom:"border-b-green-600",left:"border-l-green-600",right:"border-r-green-600"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},S={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},M={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},L={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},A={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function H({children:u,content:c,position:o="top",variant:n="default",size:s="md",trigger:b="hover",open:f,delay:l=0,showArrow:m=!0,maxWidth:y="max-w-xs",className:h,contentClassName:T,disabled:r=!1,...w}){let[x,t]=P(!1),e=N(null),d=a(()=>{r||(l>0?e.current=setTimeout(()=>t(!0),l):t(!0))},[l,r]),p=a(()=>{e.current&&(clearTimeout(e.current),e.current=null),t(!1)},[]),k=a(()=>{r||t(C=>!C)},[r]),R=b==="manual"?f:x,v={hover:{onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p},click:{onClick:k},manual:{}}[b];return g("div",{className:i("relative inline-flex",h),...v,...w,children:[u,R&&!r&&g("div",{role:"tooltip",className:i("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",L[o],z[n],S[s],y,T),children:[c,m&&E("span",{className:i("absolute w-0 h-0 border-solid",M[s],A[o],V[n][o]),"aria-hidden":"true"})]})]})}H.displayName="Tooltip";export{H as Tooltip};
1
+ "use client";import{useState as P,useRef as N,useCallback as a}from"react";import{cn as i}from"../../lib/cn.js";import{jsx as E,jsxs as g}from"react/jsx-runtime";var z={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},V={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-700",bottom:"border-b-green-700",left:"border-l-green-700",right:"border-r-green-700"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},S={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},M={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},L={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},A={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function H({children:u,content:c,position:o="top",variant:n="default",size:s="md",trigger:b="hover",open:f,delay:l=0,showArrow:m=!0,maxWidth:y="max-w-xs",className:h,contentClassName:T,disabled:r=!1,...w}){let[x,t]=P(!1),e=N(null),d=a(()=>{r||(l>0?e.current=setTimeout(()=>t(!0),l):t(!0))},[l,r]),p=a(()=>{e.current&&(clearTimeout(e.current),e.current=null),t(!1)},[]),k=a(()=>{r||t(C=>!C)},[r]),R=b==="manual"?f:x,v={hover:{onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p},click:{onClick:k},manual:{}}[b];return g("div",{className:i("relative inline-flex",h),...v,...w,children:[u,R&&!r&&g("div",{role:"tooltip",className:i("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",L[o],z[n],S[s],y,T),children:[c,m&&E("span",{className:i("absolute w-0 h-0 border-solid",M[s],A[o],V[n][o]),"aria-hidden":"true"})]})]})}H.displayName="Tooltip";export{H as Tooltip};
@@ -1 +1 @@
1
- "use strict";"use client";var V=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var n in e)V(t,n,{get:e[n],enumerable:!0})},ae=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ee(e))!te.call(t,i)&&i!==n&&V(t,i,{get:()=>e[i],enumerable:!(s=$(e,i))||s.enumerable});return t};var ie=t=>ae(V({},"__esModule",{value:!0}),t);var oe={};re(oe,{Wizard:()=>I,WizardActions:()=>J,WizardContent:()=>q,WizardNext:()=>D,WizardPanel:()=>U,WizardPrevious:()=>E,WizardSteps:()=>H,useWizard:()=>W});module.exports=ie(oe);var u=require("react"),o=require("../../lib/cn.cjs"),A=require("../../lib/i18n.cjs"),r=require("react/jsx-runtime"),F=(0,u.createContext)(null);function W(){let t=(0,u.useContext)(F);if(!t)throw new Error("useWizard and Wizard sub-components must be used within <Wizard>");return t}var B=(t,e,n)=>Math.max(e,Math.min(t,n)),j={sm:{circle:"h-7 w-7 text-xs",dot:"h-2.5 w-2.5",icon:"h-3.5 w-3.5",title:"text-xs",desc:"text-[11px]",connector:"h-0.5"},md:{circle:"h-9 w-9 text-sm",dot:"h-3 w-3",icon:"h-4 w-4",title:"text-sm",desc:"text-xs",connector:"h-0.5"},lg:{circle:"h-11 w-11 text-base",dot:"h-3.5 w-3.5",icon:"h-5 w-5",title:"text-base",desc:"text-sm",connector:"h-1"}},x={primary:{solid:"bg-blue-600 text-white",bg:"bg-blue-600",text:"text-blue-600 dark:text-blue-400",ring:"focus-visible:ring-blue-500",ringSoft:"ring-blue-500/20"},secondary:{solid:"bg-gray-700 text-white",bg:"bg-gray-700",text:"text-gray-700 dark:text-gray-300",ring:"focus-visible:ring-gray-500",ringSoft:"ring-gray-500/20"},success:{solid:"bg-green-600 text-white",bg:"bg-green-600",text:"text-green-600 dark:text-green-400",ring:"focus-visible:ring-green-500",ringSoft:"ring-green-500/20"},warning:{solid:"bg-amber-500 text-gray-900",bg:"bg-amber-500",text:"text-amber-600 dark:text-amber-400",ring:"focus-visible:ring-amber-500",ringSoft:"ring-amber-500/20"},error:{solid:"bg-red-600 text-white",bg:"bg-red-600",text:"text-red-600 dark:text-red-400",ring:"focus-visible:ring-red-500",ringSoft:"ring-red-500/20"}};function ne({className:t}){return(0,r.jsx)("svg",{className:t,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}function I({steps:t,step:e,defaultStep:n=0,onStepChange:s,onComplete:i,orientation:c="horizontal",variant:l="default",size:p="md",color:d="primary",linear:g=!0,className:m,children:z}){let C=t.length,h=Math.max(0,C-1),N=e!==void 0,[P,R]=(0,u.useState)(()=>B(n,0,h)),a=B(N?e:P,0,h),[f,w]=(0,u.useState)(a);f<a&&w(a);let v=a<=0,y=a>=h,S=(0,u.useCallback)((b,M)=>{let L=B(b,0,h);L!==a&&(N||R(L),w(_=>Math.max(_,L)),s?.(L,{previous:a,direction:M}))},[a,N,h,s]),k=(0,u.useCallback)(b=>{let M=t[b];return!M||M.disabled?!1:g?b<=f:!0},[t,g,f]),K=(0,u.useCallback)(b=>{k(b)&&S(b,b>a?"jump":"backward")},[k,S,a]),Q=(0,u.useCallback)(()=>{if(y){i?.();return}S(a+1,"forward")},[y,i,S,a]),X=(0,u.useCallback)(()=>{v||S(a-1,"backward")},[v,S,a]),Y=(0,u.useCallback)(b=>t[b]?.error?"error":b===a?"active":b<a?"completed":"upcoming",[t,a]),Z={steps:t,activeStep:a,totalSteps:C,isFirstStep:v,isLastStep:y,orientation:c,variant:l,size:p,color:d,linear:g,goToStep:K,goNext:Q,goBack:X,getStepStatus:Y,isStepAccessible:k};return(0,r.jsx)(F.Provider,{value:Z,children:(0,r.jsx)("div",{className:(0,o.cn)("flex w-full flex-col gap-6",m),"data-testid":"wizard","data-orientation":c,children:z})})}function O({index:t,status:e}){let{variant:n,size:s,color:i,steps:c}=W(),l=j[s],p=c[t];if(n==="dots"){let m=e==="upcoming"?"bg-gray-300 dark:bg-gray-600":e==="error"?"bg-red-600":x[i].bg;return(0,r.jsx)("span",{className:(0,o.cn)("shrink-0 rounded-full transition-colors",l.dot,m),"aria-hidden":"true"})}let d=e==="completed"?(0,o.cn)(x[i].solid,"border-transparent"):e==="active"?(0,o.cn)(x[i].solid,"border-transparent ring-4",x[i].ringSoft):e==="error"?"border-transparent bg-red-600 text-white":"border-2 border-gray-300 bg-white text-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400",g=e==="completed"?(0,r.jsx)(ne,{className:l.icon}):e==="error"?(0,r.jsx)("span",{className:"font-semibold leading-none",children:"!"}):p.icon??(0,r.jsx)("span",{className:"font-medium leading-none",children:t+1});return(0,r.jsx)("span",{className:(0,o.cn)("flex shrink-0 items-center justify-center rounded-full transition-all",l.circle,d),"aria-hidden":"true",children:g})}function T({index:t,status:e,optionalLabel:n}){let{steps:s,size:i,color:c,variant:l}=W(),p=j[i],d=s[t],m=e==="active"?x[c].text:e==="completed"?"text-gray-900 dark:text-gray-100":e==="error"?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400";return(0,r.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,r.jsxs)("span",{className:(0,o.cn)("font-medium leading-tight",p.title,m),children:[l==="simple"&&(0,r.jsxs)("span",{className:"mr-1 tabular-nums",children:[t+1,"."]}),d.title,d.optional&&(0,r.jsx)("span",{className:"ml-1 text-xs font-normal text-gray-400 dark:text-gray-500",children:n})]}),d.description&&(0,r.jsx)("span",{className:(0,o.cn)("mt-0.5 text-gray-400 dark:text-gray-500",p.desc),children:d.description})]})}function H({className:t,hideConnector:e=!1,hideLabels:n=!1,optionalLabel:s}){let i=W(),c=(0,A.useUILabels)(),l=s??c.wizardOptional,{steps:p,orientation:d,size:g,variant:m,color:z,activeStep:C}=i,h=j[g],N=d==="vertical",P=m!=="simple";return(0,r.jsx)("ol",{className:(0,o.cn)("flex w-full",N?"flex-col":"items-start",t),"data-testid":"wizard-steps","data-orientation":d,children:p.map((R,a)=>{let f=i.getStepStatus(a),w=a===C,v=i.isStepAccessible(a)&&!w,y=a===p.length-1,k=a<C?x[z].bg:"bg-gray-200 dark:bg-gray-700";return N?(0,r.jsx)("li",{className:"flex","aria-current":w?"step":void 0,"data-status":f,"data-testid":"wizard-step",children:(0,r.jsxs)("button",{type:"button",disabled:!v,onClick:()=>i.goToStep(a),className:(0,o.cn)("flex items-stretch gap-3 rounded-md text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",x[z].ring,v?"cursor-pointer":"cursor-default"),children:[(0,r.jsxs)("span",{className:"flex flex-col items-center",children:[P&&(0,r.jsx)(O,{index:a,status:f}),!e&&!y&&(0,r.jsx)("span",{className:(0,o.cn)("my-1 w-0.5 flex-1 rounded",k),"aria-hidden":"true"})]}),!n&&(0,r.jsx)("span",{className:(0,o.cn)(y?"pb-0":"pb-6"),children:(0,r.jsx)(T,{index:a,status:f,optionalLabel:l})})]})},R.id??a):(0,r.jsxs)("li",{className:(0,o.cn)("flex items-center",!y&&"flex-1"),"aria-current":w?"step":void 0,"data-status":f,"data-testid":"wizard-step",children:[(0,r.jsxs)("button",{type:"button",disabled:!v,onClick:()=>i.goToStep(a),className:(0,o.cn)("flex items-center gap-2.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",x[z].ring,v?"cursor-pointer":"cursor-default"),children:[P&&(0,r.jsx)(O,{index:a,status:f}),!n&&(0,r.jsx)(T,{index:a,status:f,optionalLabel:l})]}),!e&&!y&&(0,r.jsx)("span",{className:(0,o.cn)("mx-2 flex-1 rounded",h.connector,k),"aria-hidden":"true"})]},R.id??a)})})}function U({index:t,keepMounted:e=!1,className:n,children:s}){let{activeStep:i}=W(),c=t===i;return!c&&!e?null:(0,r.jsx)("div",{role:"tabpanel",hidden:!c,"data-testid":"wizard-panel","data-active":c,"data-step":t,className:(0,o.cn)("w-full",n),children:s})}function q({className:t,children:e}){let n=W();return(0,r.jsx)("div",{className:(0,o.cn)("w-full",t),"data-testid":"wizard-content",children:typeof e=="function"?e(n):e})}var G="inline-flex cursor-pointer items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";function E({children:t,label:e,className:n,onClick:s,disabled:i,...c}){let{goBack:l,isFirstStep:p}=W(),d=(0,A.useUILabels)();return(0,r.jsx)("button",{type:"button",onClick:m=>{s?.(m),m.defaultPrevented||l()},disabled:i??p,"data-testid":"wizard-previous",className:(0,o.cn)(G,"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus-visible:ring-gray-400 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",n),...c,children:t??e??d.wizardPrevious})}function D({children:t,label:e,finishLabel:n,className:s,onClick:i,...c}){let{goNext:l,isLastStep:p,color:d}=W(),g=(0,A.useUILabels)();return(0,r.jsx)("button",{type:"button",onClick:z=>{i?.(z),z.defaultPrevented||l()},"data-testid":"wizard-next",className:(0,o.cn)(G,x[d].solid,x[d].ring,"hover:opacity-90",s),...c,children:t??(p?n??g.wizardFinish:e??g.wizardNext)})}function J({className:t,children:e,align:n="between"}){let s={between:"justify-between",start:"justify-start",center:"justify-center",end:"justify-end"}[n];return(0,r.jsx)("div",{className:(0,o.cn)("flex items-center gap-3",s,t),"data-testid":"wizard-actions",children:e??(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(E,{}),(0,r.jsx)(D,{})]})})}I.displayName="Wizard";H.displayName="WizardSteps";U.displayName="WizardPanel";q.displayName="WizardContent";J.displayName="WizardActions";E.displayName="WizardPrevious";D.displayName="WizardNext";0&&(module.exports={Wizard,WizardActions,WizardContent,WizardNext,WizardPanel,WizardPrevious,WizardSteps,useWizard});
1
+ "use strict";"use client";var V=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var n in e)V(t,n,{get:e[n],enumerable:!0})},ae=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ee(e))!te.call(t,i)&&i!==n&&V(t,i,{get:()=>e[i],enumerable:!(s=$(e,i))||s.enumerable});return t};var ie=t=>ae(V({},"__esModule",{value:!0}),t);var oe={};re(oe,{Wizard:()=>I,WizardActions:()=>J,WizardContent:()=>q,WizardNext:()=>D,WizardPanel:()=>U,WizardPrevious:()=>E,WizardSteps:()=>H,useWizard:()=>W});module.exports=ie(oe);var u=require("react"),o=require("../../lib/cn.cjs"),A=require("../../lib/i18n.cjs"),r=require("react/jsx-runtime"),F=(0,u.createContext)(null);function W(){let t=(0,u.useContext)(F);if(!t)throw new Error("useWizard and Wizard sub-components must be used within <Wizard>");return t}var B=(t,e,n)=>Math.max(e,Math.min(t,n)),j={sm:{circle:"h-7 w-7 text-xs",dot:"h-2.5 w-2.5",icon:"h-3.5 w-3.5",title:"text-xs",desc:"text-[11px]",connector:"h-0.5"},md:{circle:"h-9 w-9 text-sm",dot:"h-3 w-3",icon:"h-4 w-4",title:"text-sm",desc:"text-xs",connector:"h-0.5"},lg:{circle:"h-11 w-11 text-base",dot:"h-3.5 w-3.5",icon:"h-5 w-5",title:"text-base",desc:"text-sm",connector:"h-1"}},x={primary:{solid:"bg-blue-600 text-white",bg:"bg-blue-600",text:"text-blue-600 dark:text-blue-400",ring:"focus-visible:ring-blue-500",ringSoft:"ring-blue-500/20"},secondary:{solid:"bg-gray-700 text-white",bg:"bg-gray-700",text:"text-gray-700 dark:text-gray-300",ring:"focus-visible:ring-gray-500",ringSoft:"ring-gray-500/20"},success:{solid:"bg-green-700 text-white",bg:"bg-green-700",text:"text-green-700 dark:text-green-400",ring:"focus-visible:ring-green-500",ringSoft:"ring-green-500/20"},warning:{solid:"bg-amber-500 text-gray-900",bg:"bg-amber-500",text:"text-amber-700 dark:text-amber-400",ring:"focus-visible:ring-amber-500",ringSoft:"ring-amber-500/20"},error:{solid:"bg-red-600 text-white",bg:"bg-red-600",text:"text-red-600 dark:text-red-400",ring:"focus-visible:ring-red-500",ringSoft:"ring-red-500/20"}};function ne({className:t}){return(0,r.jsx)("svg",{className:t,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}function I({steps:t,step:e,defaultStep:n=0,onStepChange:s,onComplete:i,orientation:c="horizontal",variant:l="default",size:p="md",color:d="primary",linear:g=!0,className:m,children:z}){let C=t.length,h=Math.max(0,C-1),N=e!==void 0,[P,R]=(0,u.useState)(()=>B(n,0,h)),a=B(N?e:P,0,h),[f,w]=(0,u.useState)(a);f<a&&w(a);let v=a<=0,y=a>=h,S=(0,u.useCallback)((b,M)=>{let L=B(b,0,h);L!==a&&(N||R(L),w(_=>Math.max(_,L)),s?.(L,{previous:a,direction:M}))},[a,N,h,s]),k=(0,u.useCallback)(b=>{let M=t[b];return!M||M.disabled?!1:g?b<=f:!0},[t,g,f]),K=(0,u.useCallback)(b=>{k(b)&&S(b,b>a?"jump":"backward")},[k,S,a]),Q=(0,u.useCallback)(()=>{if(y){i?.();return}S(a+1,"forward")},[y,i,S,a]),X=(0,u.useCallback)(()=>{v||S(a-1,"backward")},[v,S,a]),Y=(0,u.useCallback)(b=>t[b]?.error?"error":b===a?"active":b<a?"completed":"upcoming",[t,a]),Z={steps:t,activeStep:a,totalSteps:C,isFirstStep:v,isLastStep:y,orientation:c,variant:l,size:p,color:d,linear:g,goToStep:K,goNext:Q,goBack:X,getStepStatus:Y,isStepAccessible:k};return(0,r.jsx)(F.Provider,{value:Z,children:(0,r.jsx)("div",{className:(0,o.cn)("flex w-full flex-col gap-6",m),"data-testid":"wizard","data-orientation":c,children:z})})}function O({index:t,status:e}){let{variant:n,size:s,color:i,steps:c}=W(),l=j[s],p=c[t];if(n==="dots"){let m=e==="upcoming"?"bg-gray-300 dark:bg-gray-600":e==="error"?"bg-red-600":x[i].bg;return(0,r.jsx)("span",{className:(0,o.cn)("shrink-0 rounded-full transition-colors",l.dot,m),"aria-hidden":"true"})}let d=e==="completed"?(0,o.cn)(x[i].solid,"border-transparent"):e==="active"?(0,o.cn)(x[i].solid,"border-transparent ring-4",x[i].ringSoft):e==="error"?"border-transparent bg-red-600 text-white":"border-2 border-gray-300 bg-white text-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400",g=e==="completed"?(0,r.jsx)(ne,{className:l.icon}):e==="error"?(0,r.jsx)("span",{className:"font-semibold leading-none",children:"!"}):p.icon??(0,r.jsx)("span",{className:"font-medium leading-none",children:t+1});return(0,r.jsx)("span",{className:(0,o.cn)("flex shrink-0 items-center justify-center rounded-full transition-all",l.circle,d),"aria-hidden":"true",children:g})}function T({index:t,status:e,optionalLabel:n}){let{steps:s,size:i,color:c,variant:l}=W(),p=j[i],d=s[t],m=e==="active"?x[c].text:e==="completed"?"text-gray-900 dark:text-gray-100":e==="error"?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400";return(0,r.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,r.jsxs)("span",{className:(0,o.cn)("font-medium leading-tight",p.title,m),children:[l==="simple"&&(0,r.jsxs)("span",{className:"mr-1 tabular-nums",children:[t+1,"."]}),d.title,d.optional&&(0,r.jsx)("span",{className:"ml-1 text-xs font-normal text-gray-500 dark:text-gray-400",children:n})]}),d.description&&(0,r.jsx)("span",{className:(0,o.cn)("mt-0.5 text-gray-500 dark:text-gray-400",p.desc),children:d.description})]})}function H({className:t,hideConnector:e=!1,hideLabels:n=!1,optionalLabel:s}){let i=W(),c=(0,A.useUILabels)(),l=s??c.wizardOptional,{steps:p,orientation:d,size:g,variant:m,color:z,activeStep:C}=i,h=j[g],N=d==="vertical",P=m!=="simple";return(0,r.jsx)("ol",{className:(0,o.cn)("flex w-full",N?"flex-col":"items-start",t),"data-testid":"wizard-steps","data-orientation":d,children:p.map((R,a)=>{let f=i.getStepStatus(a),w=a===C,v=i.isStepAccessible(a)&&!w,y=a===p.length-1,k=a<C?x[z].bg:"bg-gray-200 dark:bg-gray-700";return N?(0,r.jsx)("li",{className:"flex","aria-current":w?"step":void 0,"data-status":f,"data-testid":"wizard-step",children:(0,r.jsxs)("button",{type:"button",disabled:!v,onClick:()=>i.goToStep(a),className:(0,o.cn)("flex items-stretch gap-3 rounded-md text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",x[z].ring,v?"cursor-pointer":"cursor-default"),children:[(0,r.jsxs)("span",{className:"flex flex-col items-center",children:[P&&(0,r.jsx)(O,{index:a,status:f}),!e&&!y&&(0,r.jsx)("span",{className:(0,o.cn)("my-1 w-0.5 flex-1 rounded",k),"aria-hidden":"true"})]}),!n&&(0,r.jsx)("span",{className:(0,o.cn)(y?"pb-0":"pb-6"),children:(0,r.jsx)(T,{index:a,status:f,optionalLabel:l})})]})},R.id??a):(0,r.jsxs)("li",{className:(0,o.cn)("flex items-center",!y&&"flex-1"),"aria-current":w?"step":void 0,"data-status":f,"data-testid":"wizard-step",children:[(0,r.jsxs)("button",{type:"button",disabled:!v,onClick:()=>i.goToStep(a),className:(0,o.cn)("flex items-center gap-2.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",x[z].ring,v?"cursor-pointer":"cursor-default"),children:[P&&(0,r.jsx)(O,{index:a,status:f}),!n&&(0,r.jsx)(T,{index:a,status:f,optionalLabel:l})]}),!e&&!y&&(0,r.jsx)("span",{className:(0,o.cn)("mx-2 flex-1 rounded",h.connector,k),"aria-hidden":"true"})]},R.id??a)})})}function U({index:t,keepMounted:e=!1,className:n,children:s}){let{activeStep:i}=W(),c=t===i;return!c&&!e?null:(0,r.jsx)("div",{role:"tabpanel",hidden:!c,"data-testid":"wizard-panel","data-active":c,"data-step":t,className:(0,o.cn)("w-full",n),children:s})}function q({className:t,children:e}){let n=W();return(0,r.jsx)("div",{className:(0,o.cn)("w-full",t),"data-testid":"wizard-content",children:typeof e=="function"?e(n):e})}var G="inline-flex cursor-pointer items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";function E({children:t,label:e,className:n,onClick:s,disabled:i,...c}){let{goBack:l,isFirstStep:p}=W(),d=(0,A.useUILabels)();return(0,r.jsx)("button",{type:"button",onClick:m=>{s?.(m),m.defaultPrevented||l()},disabled:i??p,"data-testid":"wizard-previous",className:(0,o.cn)(G,"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus-visible:ring-gray-400 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",n),...c,children:t??e??d.wizardPrevious})}function D({children:t,label:e,finishLabel:n,className:s,onClick:i,...c}){let{goNext:l,isLastStep:p,color:d}=W(),g=(0,A.useUILabels)();return(0,r.jsx)("button",{type:"button",onClick:z=>{i?.(z),z.defaultPrevented||l()},"data-testid":"wizard-next",className:(0,o.cn)(G,x[d].solid,x[d].ring,"hover:opacity-90",s),...c,children:t??(p?n??g.wizardFinish:e??g.wizardNext)})}function J({className:t,children:e,align:n="between"}){let s={between:"justify-between",start:"justify-start",center:"justify-center",end:"justify-end"}[n];return(0,r.jsx)("div",{className:(0,o.cn)("flex items-center gap-3",s,t),"data-testid":"wizard-actions",children:e??(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(E,{}),(0,r.jsx)(D,{})]})})}I.displayName="Wizard";H.displayName="WizardSteps";U.displayName="WizardPanel";q.displayName="WizardContent";J.displayName="WizardActions";E.displayName="WizardPrevious";D.displayName="WizardNext";0&&(module.exports={Wizard,WizardActions,WizardContent,WizardNext,WizardPanel,WizardPrevious,WizardSteps,useWizard});
@@ -1 +1 @@
1
- "use client";import{createContext as X,useCallback as C,useContext as Y,useState as E}from"react";import{cn as o}from"../../lib/cn.js";import{useUILabels as B}from"../../lib/i18n.js";import{Fragment as ae,jsx as a,jsxs as y}from"react/jsx-runtime";var T=X(null);function S(){let e=Y(T);if(!e)throw new Error("useWizard and Wizard sub-components must be used within <Wizard>");return e}var V=(e,r,n)=>Math.max(r,Math.min(e,n)),j={sm:{circle:"h-7 w-7 text-xs",dot:"h-2.5 w-2.5",icon:"h-3.5 w-3.5",title:"text-xs",desc:"text-[11px]",connector:"h-0.5"},md:{circle:"h-9 w-9 text-sm",dot:"h-3 w-3",icon:"h-4 w-4",title:"text-sm",desc:"text-xs",connector:"h-0.5"},lg:{circle:"h-11 w-11 text-base",dot:"h-3.5 w-3.5",icon:"h-5 w-5",title:"text-base",desc:"text-sm",connector:"h-1"}},f={primary:{solid:"bg-blue-600 text-white",bg:"bg-blue-600",text:"text-blue-600 dark:text-blue-400",ring:"focus-visible:ring-blue-500",ringSoft:"ring-blue-500/20"},secondary:{solid:"bg-gray-700 text-white",bg:"bg-gray-700",text:"text-gray-700 dark:text-gray-300",ring:"focus-visible:ring-gray-500",ringSoft:"ring-gray-500/20"},success:{solid:"bg-green-600 text-white",bg:"bg-green-600",text:"text-green-600 dark:text-green-400",ring:"focus-visible:ring-green-500",ringSoft:"ring-green-500/20"},warning:{solid:"bg-amber-500 text-gray-900",bg:"bg-amber-500",text:"text-amber-600 dark:text-amber-400",ring:"focus-visible:ring-amber-500",ringSoft:"ring-amber-500/20"},error:{solid:"bg-red-600 text-white",bg:"bg-red-600",text:"text-red-600 dark:text-red-400",ring:"focus-visible:ring-red-500",ringSoft:"ring-red-500/20"}};function Z({className:e}){return a("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}function _({steps:e,step:r,defaultStep:n=0,onStepChange:s,onComplete:i,orientation:c="horizontal",variant:l="default",size:u="md",color:d="primary",linear:p=!0,className:b,children:x}){let P=e.length,W=Math.max(0,P-1),N=r!==void 0,[R,M]=E(()=>V(n,0,W)),t=V(N?r:R,0,W),[m,w]=E(t);m<t&&w(t);let z=t<=0,v=t>=W,h=C((g,L)=>{let A=V(g,0,W);A!==t&&(N||M(A),w(Q=>Math.max(Q,A)),s?.(A,{previous:t,direction:L}))},[t,N,W,s]),k=C(g=>{let L=e[g];return!L||L.disabled?!1:p?g<=m:!0},[e,p,m]),U=C(g=>{k(g)&&h(g,g>t?"jump":"backward")},[k,h,t]),q=C(()=>{if(v){i?.();return}h(t+1,"forward")},[v,i,h,t]),G=C(()=>{z||h(t-1,"backward")},[z,h,t]),J=C(g=>e[g]?.error?"error":g===t?"active":g<t?"completed":"upcoming",[e,t]),K={steps:e,activeStep:t,totalSteps:P,isFirstStep:z,isLastStep:v,orientation:c,variant:l,size:u,color:d,linear:p,goToStep:U,goNext:q,goBack:G,getStepStatus:J,isStepAccessible:k};return a(T.Provider,{value:K,children:a("div",{className:o("flex w-full flex-col gap-6",b),"data-testid":"wizard","data-orientation":c,children:x})})}function D({index:e,status:r}){let{variant:n,size:s,color:i,steps:c}=S(),l=j[s],u=c[e];if(n==="dots"){let b=r==="upcoming"?"bg-gray-300 dark:bg-gray-600":r==="error"?"bg-red-600":f[i].bg;return a("span",{className:o("shrink-0 rounded-full transition-colors",l.dot,b),"aria-hidden":"true"})}let d=r==="completed"?o(f[i].solid,"border-transparent"):r==="active"?o(f[i].solid,"border-transparent ring-4",f[i].ringSoft):r==="error"?"border-transparent bg-red-600 text-white":"border-2 border-gray-300 bg-white text-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400",p=r==="completed"?a(Z,{className:l.icon}):r==="error"?a("span",{className:"font-semibold leading-none",children:"!"}):u.icon??a("span",{className:"font-medium leading-none",children:e+1});return a("span",{className:o("flex shrink-0 items-center justify-center rounded-full transition-all",l.circle,d),"aria-hidden":"true",children:p})}function O({index:e,status:r,optionalLabel:n}){let{steps:s,size:i,color:c,variant:l}=S(),u=j[i],d=s[e],b=r==="active"?f[c].text:r==="completed"?"text-gray-900 dark:text-gray-100":r==="error"?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400";return y("span",{className:"flex min-w-0 flex-col",children:[y("span",{className:o("font-medium leading-tight",u.title,b),children:[l==="simple"&&y("span",{className:"mr-1 tabular-nums",children:[e+1,"."]}),d.title,d.optional&&a("span",{className:"ml-1 text-xs font-normal text-gray-400 dark:text-gray-500",children:n})]}),d.description&&a("span",{className:o("mt-0.5 text-gray-400 dark:text-gray-500",u.desc),children:d.description})]})}function $({className:e,hideConnector:r=!1,hideLabels:n=!1,optionalLabel:s}){let i=S(),c=B(),l=s??c.wizardOptional,{steps:u,orientation:d,size:p,variant:b,color:x,activeStep:P}=i,W=j[p],N=d==="vertical",R=b!=="simple";return a("ol",{className:o("flex w-full",N?"flex-col":"items-start",e),"data-testid":"wizard-steps","data-orientation":d,children:u.map((M,t)=>{let m=i.getStepStatus(t),w=t===P,z=i.isStepAccessible(t)&&!w,v=t===u.length-1,k=t<P?f[x].bg:"bg-gray-200 dark:bg-gray-700";return N?a("li",{className:"flex","aria-current":w?"step":void 0,"data-status":m,"data-testid":"wizard-step",children:y("button",{type:"button",disabled:!z,onClick:()=>i.goToStep(t),className:o("flex items-stretch gap-3 rounded-md text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",f[x].ring,z?"cursor-pointer":"cursor-default"),children:[y("span",{className:"flex flex-col items-center",children:[R&&a(D,{index:t,status:m}),!r&&!v&&a("span",{className:o("my-1 w-0.5 flex-1 rounded",k),"aria-hidden":"true"})]}),!n&&a("span",{className:o(v?"pb-0":"pb-6"),children:a(O,{index:t,status:m,optionalLabel:l})})]})},M.id??t):y("li",{className:o("flex items-center",!v&&"flex-1"),"aria-current":w?"step":void 0,"data-status":m,"data-testid":"wizard-step",children:[y("button",{type:"button",disabled:!z,onClick:()=>i.goToStep(t),className:o("flex items-center gap-2.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",f[x].ring,z?"cursor-pointer":"cursor-default"),children:[R&&a(D,{index:t,status:m}),!n&&a(O,{index:t,status:m,optionalLabel:l})]}),!r&&!v&&a("span",{className:o("mx-2 flex-1 rounded",W.connector,k),"aria-hidden":"true"})]},M.id??t)})})}function ee({index:e,keepMounted:r=!1,className:n,children:s}){let{activeStep:i}=S(),c=e===i;return!c&&!r?null:a("div",{role:"tabpanel",hidden:!c,"data-testid":"wizard-panel","data-active":c,"data-step":e,className:o("w-full",n),children:s})}function te({className:e,children:r}){let n=S();return a("div",{className:o("w-full",e),"data-testid":"wizard-content",children:typeof r=="function"?r(n):r})}var F="inline-flex cursor-pointer items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";function I({children:e,label:r,className:n,onClick:s,disabled:i,...c}){let{goBack:l,isFirstStep:u}=S(),d=B();return a("button",{type:"button",onClick:b=>{s?.(b),b.defaultPrevented||l()},disabled:i??u,"data-testid":"wizard-previous",className:o(F,"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus-visible:ring-gray-400 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",n),...c,children:e??r??d.wizardPrevious})}function H({children:e,label:r,finishLabel:n,className:s,onClick:i,...c}){let{goNext:l,isLastStep:u,color:d}=S(),p=B();return a("button",{type:"button",onClick:x=>{i?.(x),x.defaultPrevented||l()},"data-testid":"wizard-next",className:o(F,f[d].solid,f[d].ring,"hover:opacity-90",s),...c,children:e??(u?n??p.wizardFinish:r??p.wizardNext)})}function re({className:e,children:r,align:n="between"}){let s={between:"justify-between",start:"justify-start",center:"justify-center",end:"justify-end"}[n];return a("div",{className:o("flex items-center gap-3",s,e),"data-testid":"wizard-actions",children:r??y(ae,{children:[a(I,{}),a(H,{})]})})}_.displayName="Wizard";$.displayName="WizardSteps";ee.displayName="WizardPanel";te.displayName="WizardContent";re.displayName="WizardActions";I.displayName="WizardPrevious";H.displayName="WizardNext";export{_ as Wizard,re as WizardActions,te as WizardContent,H as WizardNext,ee as WizardPanel,I as WizardPrevious,$ as WizardSteps,S as useWizard};
1
+ "use client";import{createContext as X,useCallback as C,useContext as Y,useState as E}from"react";import{cn as o}from"../../lib/cn.js";import{useUILabels as B}from"../../lib/i18n.js";import{Fragment as ae,jsx as a,jsxs as y}from"react/jsx-runtime";var T=X(null);function S(){let e=Y(T);if(!e)throw new Error("useWizard and Wizard sub-components must be used within <Wizard>");return e}var V=(e,r,n)=>Math.max(r,Math.min(e,n)),j={sm:{circle:"h-7 w-7 text-xs",dot:"h-2.5 w-2.5",icon:"h-3.5 w-3.5",title:"text-xs",desc:"text-[11px]",connector:"h-0.5"},md:{circle:"h-9 w-9 text-sm",dot:"h-3 w-3",icon:"h-4 w-4",title:"text-sm",desc:"text-xs",connector:"h-0.5"},lg:{circle:"h-11 w-11 text-base",dot:"h-3.5 w-3.5",icon:"h-5 w-5",title:"text-base",desc:"text-sm",connector:"h-1"}},f={primary:{solid:"bg-blue-600 text-white",bg:"bg-blue-600",text:"text-blue-600 dark:text-blue-400",ring:"focus-visible:ring-blue-500",ringSoft:"ring-blue-500/20"},secondary:{solid:"bg-gray-700 text-white",bg:"bg-gray-700",text:"text-gray-700 dark:text-gray-300",ring:"focus-visible:ring-gray-500",ringSoft:"ring-gray-500/20"},success:{solid:"bg-green-700 text-white",bg:"bg-green-700",text:"text-green-700 dark:text-green-400",ring:"focus-visible:ring-green-500",ringSoft:"ring-green-500/20"},warning:{solid:"bg-amber-500 text-gray-900",bg:"bg-amber-500",text:"text-amber-700 dark:text-amber-400",ring:"focus-visible:ring-amber-500",ringSoft:"ring-amber-500/20"},error:{solid:"bg-red-600 text-white",bg:"bg-red-600",text:"text-red-600 dark:text-red-400",ring:"focus-visible:ring-red-500",ringSoft:"ring-red-500/20"}};function Z({className:e}){return a("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}function _({steps:e,step:r,defaultStep:n=0,onStepChange:s,onComplete:i,orientation:c="horizontal",variant:l="default",size:u="md",color:d="primary",linear:p=!0,className:b,children:x}){let P=e.length,W=Math.max(0,P-1),N=r!==void 0,[R,M]=E(()=>V(n,0,W)),t=V(N?r:R,0,W),[m,w]=E(t);m<t&&w(t);let z=t<=0,v=t>=W,h=C((g,L)=>{let A=V(g,0,W);A!==t&&(N||M(A),w(Q=>Math.max(Q,A)),s?.(A,{previous:t,direction:L}))},[t,N,W,s]),k=C(g=>{let L=e[g];return!L||L.disabled?!1:p?g<=m:!0},[e,p,m]),U=C(g=>{k(g)&&h(g,g>t?"jump":"backward")},[k,h,t]),q=C(()=>{if(v){i?.();return}h(t+1,"forward")},[v,i,h,t]),G=C(()=>{z||h(t-1,"backward")},[z,h,t]),J=C(g=>e[g]?.error?"error":g===t?"active":g<t?"completed":"upcoming",[e,t]),K={steps:e,activeStep:t,totalSteps:P,isFirstStep:z,isLastStep:v,orientation:c,variant:l,size:u,color:d,linear:p,goToStep:U,goNext:q,goBack:G,getStepStatus:J,isStepAccessible:k};return a(T.Provider,{value:K,children:a("div",{className:o("flex w-full flex-col gap-6",b),"data-testid":"wizard","data-orientation":c,children:x})})}function D({index:e,status:r}){let{variant:n,size:s,color:i,steps:c}=S(),l=j[s],u=c[e];if(n==="dots"){let b=r==="upcoming"?"bg-gray-300 dark:bg-gray-600":r==="error"?"bg-red-600":f[i].bg;return a("span",{className:o("shrink-0 rounded-full transition-colors",l.dot,b),"aria-hidden":"true"})}let d=r==="completed"?o(f[i].solid,"border-transparent"):r==="active"?o(f[i].solid,"border-transparent ring-4",f[i].ringSoft):r==="error"?"border-transparent bg-red-600 text-white":"border-2 border-gray-300 bg-white text-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400",p=r==="completed"?a(Z,{className:l.icon}):r==="error"?a("span",{className:"font-semibold leading-none",children:"!"}):u.icon??a("span",{className:"font-medium leading-none",children:e+1});return a("span",{className:o("flex shrink-0 items-center justify-center rounded-full transition-all",l.circle,d),"aria-hidden":"true",children:p})}function O({index:e,status:r,optionalLabel:n}){let{steps:s,size:i,color:c,variant:l}=S(),u=j[i],d=s[e],b=r==="active"?f[c].text:r==="completed"?"text-gray-900 dark:text-gray-100":r==="error"?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400";return y("span",{className:"flex min-w-0 flex-col",children:[y("span",{className:o("font-medium leading-tight",u.title,b),children:[l==="simple"&&y("span",{className:"mr-1 tabular-nums",children:[e+1,"."]}),d.title,d.optional&&a("span",{className:"ml-1 text-xs font-normal text-gray-500 dark:text-gray-400",children:n})]}),d.description&&a("span",{className:o("mt-0.5 text-gray-500 dark:text-gray-400",u.desc),children:d.description})]})}function $({className:e,hideConnector:r=!1,hideLabels:n=!1,optionalLabel:s}){let i=S(),c=B(),l=s??c.wizardOptional,{steps:u,orientation:d,size:p,variant:b,color:x,activeStep:P}=i,W=j[p],N=d==="vertical",R=b!=="simple";return a("ol",{className:o("flex w-full",N?"flex-col":"items-start",e),"data-testid":"wizard-steps","data-orientation":d,children:u.map((M,t)=>{let m=i.getStepStatus(t),w=t===P,z=i.isStepAccessible(t)&&!w,v=t===u.length-1,k=t<P?f[x].bg:"bg-gray-200 dark:bg-gray-700";return N?a("li",{className:"flex","aria-current":w?"step":void 0,"data-status":m,"data-testid":"wizard-step",children:y("button",{type:"button",disabled:!z,onClick:()=>i.goToStep(t),className:o("flex items-stretch gap-3 rounded-md text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",f[x].ring,z?"cursor-pointer":"cursor-default"),children:[y("span",{className:"flex flex-col items-center",children:[R&&a(D,{index:t,status:m}),!r&&!v&&a("span",{className:o("my-1 w-0.5 flex-1 rounded",k),"aria-hidden":"true"})]}),!n&&a("span",{className:o(v?"pb-0":"pb-6"),children:a(O,{index:t,status:m,optionalLabel:l})})]})},M.id??t):y("li",{className:o("flex items-center",!v&&"flex-1"),"aria-current":w?"step":void 0,"data-status":m,"data-testid":"wizard-step",children:[y("button",{type:"button",disabled:!z,onClick:()=>i.goToStep(t),className:o("flex items-center gap-2.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",f[x].ring,z?"cursor-pointer":"cursor-default"),children:[R&&a(D,{index:t,status:m}),!n&&a(O,{index:t,status:m,optionalLabel:l})]}),!r&&!v&&a("span",{className:o("mx-2 flex-1 rounded",W.connector,k),"aria-hidden":"true"})]},M.id??t)})})}function ee({index:e,keepMounted:r=!1,className:n,children:s}){let{activeStep:i}=S(),c=e===i;return!c&&!r?null:a("div",{role:"tabpanel",hidden:!c,"data-testid":"wizard-panel","data-active":c,"data-step":e,className:o("w-full",n),children:s})}function te({className:e,children:r}){let n=S();return a("div",{className:o("w-full",e),"data-testid":"wizard-content",children:typeof r=="function"?r(n):r})}var F="inline-flex cursor-pointer items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";function I({children:e,label:r,className:n,onClick:s,disabled:i,...c}){let{goBack:l,isFirstStep:u}=S(),d=B();return a("button",{type:"button",onClick:b=>{s?.(b),b.defaultPrevented||l()},disabled:i??u,"data-testid":"wizard-previous",className:o(F,"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus-visible:ring-gray-400 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",n),...c,children:e??r??d.wizardPrevious})}function H({children:e,label:r,finishLabel:n,className:s,onClick:i,...c}){let{goNext:l,isLastStep:u,color:d}=S(),p=B();return a("button",{type:"button",onClick:x=>{i?.(x),x.defaultPrevented||l()},"data-testid":"wizard-next",className:o(F,f[d].solid,f[d].ring,"hover:opacity-90",s),...c,children:e??(u?n??p.wizardFinish:r??p.wizardNext)})}function re({className:e,children:r,align:n="between"}){let s={between:"justify-between",start:"justify-start",center:"justify-center",end:"justify-end"}[n];return a("div",{className:o("flex items-center gap-3",s,e),"data-testid":"wizard-actions",children:r??y(ae,{children:[a(I,{}),a(H,{})]})})}_.displayName="Wizard";$.displayName="WizardSteps";ee.displayName="WizardPanel";te.displayName="WizardContent";re.displayName="WizardActions";I.displayName="WizardPrevious";H.displayName="WizardNext";export{_ as Wizard,re as WizardActions,te as WizardContent,H as WizardNext,ee as WizardPanel,I as WizardPrevious,$ as WizardSteps,S as useWizard};
@@ -1 +1 @@
1
- "use strict";"use client";var lt=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var ce=(v,R)=>{for(var N in R)lt(v,N,{get:R[N],enumerable:!0})},ie=(v,R,N,P)=>{if(R&&typeof R=="object"||typeof R=="function")for(let k of re(R))!se.call(v,k)&&k!==N&&lt(v,k,{get:()=>R[k],enumerable:!(P=ne(R,k))||P.enumerable});return v};var de=v=>ie(lt({},"__esModule",{value:!0}),v);var pe={};ce(pe,{WorkflowEditor:()=>Lt});module.exports=de(pe);var o=require("react"),Xt=require("../../lib/cn.cjs"),Yt=require("../../lib/i18n.cjs"),xt=require("./canvas/GridLayer.cjs"),zt=require("./nodes/WorkflowNodeRenderer.cjs"),St=require("./edges/WorkflowEdgeRenderer.cjs"),Vt=require("./toolbar/WorkflowToolbar.cjs"),l=require("./utils/geometry.cjs"),W=require("react/jsx-runtime"),at={x:0,y:0,zoom:1},pt=.1,fe=.1,ue=3,le=20;function Pt(){return`edge-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function ae({value:v,defaultValue:R,onValueChange:N,nodeRegistry:P,direction:k="horizontal",onDirectionChange:Ct,onNodeClick:$,onNodeDoubleClick:q,onNodeContextMenu:G,onNodeAction:U,readOnly:M=!1,disabled:a=!1,draggableNodes:Q=!0,connectable:mt=!0,selectable:C=!0,multiSelect:gt=!1,panOnDrag:wt=!0,zoomOnWheel:Et=!0,minZoom:X=fe,maxZoom:Y=ue,snapToGrid:yt=!1,gridSize:j=le,showGrid:At=!0,toolbar:bt=!0,autoFit:vt=!1,labels:_t,className:Ht},Ot){let Ut=(0,Yt.useUILabels)(_t),Z=v!==void 0,[Bt,Ft]=(0,o.useState)(()=>R??{nodes:[],edges:[],viewport:{...at}}),A=Z?v:Bt,E=A.nodes,b=A.edges,r=A.viewport??at,x=(0,o.useRef)(null),T=(0,o.useRef)(null),[S,V]=(0,o.useState)(new Set),[B,_]=(0,o.useState)(null),[h,H]=(0,o.useState)(null),tt=(0,o.useRef)(r);tt.current=r;let et=(0,o.useRef)(E);et.current=E;let kt=(0,o.useRef)(b);kt.current=b;let It=(0,o.useRef)(yt);It.current=yt;let ot=(0,o.useRef)(j);ot.current=j;let Dt=(0,o.useRef)(P);Dt.current=P;let F=(0,o.useRef)(k);F.current=k;let y=(0,o.useCallback)(t=>{Z?N?.(t(v)):Ft(e=>{let n=t(e);return N?.(n),n})},[Z,v,N]),nt=(0,o.useRef)(y);nt.current=y;let I=(0,o.useCallback)(t=>{y(e=>({...e,viewport:t}))},[y]),Wt=(0,o.useRef)(I);Wt.current=I;let z=(0,o.useCallback)(t=>{let e=P[t.type];return e?.getPorts?e.getPorts(t):t.ports??[]},[P]),J=(0,o.useRef)(z);J.current=z;let K=(0,o.useCallback)((t,e,n)=>{let s=et.current,p=kt.current,i=s.find(w=>w.id===t.fromNodeId),c=s.find(w=>w.id===e);if(!i||!c)return;let d=J.current(i),u=J.current(c),m=d.find(w=>w.id===t.fromPortId),g=u.find(w=>w.id===n);if(!m||!g||g.kind!=="in"||t.fromNodeId===e)return;let f=Dt.current[i.type];if(f?.canConnect&&!f.canConnect({fromNode:i,toNode:c,fromPort:m,toPort:g}))return;p.some(w=>w.from.nodeId===t.fromNodeId&&w.from.portId===t.fromPortId&&w.to.nodeId===e&&w.to.portId===n)||nt.current(w=>({...w,edges:[...w.edges,{id:Pt(),from:{nodeId:t.fromNodeId,portId:t.fromPortId},to:{nodeId:e,portId:n}}]}))},[]);(0,o.useEffect)(()=>{function t(n){let s=T.current;if(!s)return;let p=x.current?.getBoundingClientRect();if(!p)return;let i=tt.current;if(s.type==="pan"){let c=n.clientX-s.startX,d=n.clientY-s.startY;Wt.current({...i,x:s.startViewportX+c,y:s.startViewportY+d})}if(s.type==="node"){let c=(0,l.screenToCanvas)(n.clientX,n.clientY,i,p),d=c.x-s.offsetX,u=c.y-s.offsetY;It.current&&(d=(0,l.snapValue)(d,ot.current),u=(0,l.snapValue)(u,ot.current)),nt.current(m=>({...m,nodes:m.nodes.map(g=>g.id===s.nodeId?{...g,x:d,y:u}:g)}))}if(s.type==="edge"){let c=(0,l.screenToCanvas)(n.clientX,n.clientY,i,p);T.current={...s,currentX:c.x,currentY:c.y},H({fromX:s.fromX,fromY:s.fromY,currentX:c.x,currentY:c.y})}}function e(n){let s=T.current;if(s){if(s.type==="edge"){let p=x.current?.getBoundingClientRect();if(p){let i=tt.current,c=(0,l.screenToCanvas)(n.clientX,n.clientY,i,p),d=25,u=et.current,m=1/0,g=null,f=null;for(let D of u){let w=J.current(D);for(let ft of w){if(ft.kind!=="in")continue;let Nt=(0,l.getPortAbsolutePosition)(D,ft,w,F.current),ut=Math.sqrt((c.x-Nt.x)**2+(c.y-Nt.y)**2);ut<d&&ut<m&&(m=ut,g=D.id,f=ft.id)}}g&&f&&K(s,g,f)}H(null)}T.current=null}}return document.addEventListener("mousemove",t),document.addEventListener("mouseup",e),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e)}},[K]);let Jt=(0,o.useCallback)(t=>{if(!Et||a)return;t.preventDefault();let e=x.current?.getBoundingClientRect();if(!e)return;let n=t.clientX-e.left,s=t.clientY-e.top,p=t.deltaY<0?1:-1,i=(0,l.clampZoom)(r.zoom+p*pt,X,Y),c=i/r.zoom;I({x:n-(n-r.x)*c,y:s-(s-r.y)*c,zoom:i})},[Et,a,r,X,Y,I]),Kt=(0,o.useCallback)(t=>{if(a)return;let e=t.target;if(e.closest("[data-action-id]"))return;let s=e.closest("[data-port-id]");if(s){if(!mt||M)return;t.preventDefault();let i=s.getAttribute("data-node-id"),c=s.getAttribute("data-port-id"),d=s.getAttribute("data-port-kind");if(!i||!c||d!=="out")return;let u=E.find(D=>D.id===i);if(!u)return;let m=z(u),g=m.find(D=>D.id===c);if(!g)return;let f=(0,l.getPortAbsolutePosition)(u,g,m,F.current);T.current={type:"edge",fromNodeId:i,fromPortId:c,fromX:f.x,fromY:f.y,currentX:f.x,currentY:f.y},H({fromX:f.x,fromY:f.y,currentX:f.x,currentY:f.y});return}let p=e.closest("[data-node-id]");if(p){if(M)return;let i=p.getAttribute("data-node-id");if(C&&(_(null),gt&&t.shiftKey?V(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d}):V(new Set([i]))),Q){let c=x.current?.getBoundingClientRect();if(!c)return;let d=E.find(m=>m.id===i);if(!d||d.locked)return;let u=(0,l.screenToCanvas)(t.clientX,t.clientY,r,c);T.current={type:"node",nodeId:i,startX:u.x,startY:u.y,offsetX:u.x-d.x,offsetY:u.y-d.y}}return}C&&(V(new Set),_(null)),wt&&t.button===0&&(T.current={type:"pan",startX:t.clientX,startY:t.clientY,startViewportX:r.x,startViewportY:r.y})},[a,mt,M,C,gt,Q,wt,r,E,z]),$t=(0,o.useCallback)(t=>{let e=T.current;if(!e||e.type!=="edge")return;let n=x.current?.getBoundingClientRect();if(n){let s=(0,l.screenToCanvas)(t.clientX,t.clientY,r,n),p=30,i=1/0,c=null,d=null;for(let u of E){let m=z(u);for(let g of m){if(g.kind!=="in")continue;let f=(0,l.getPortAbsolutePosition)(u,g,m,F.current),D=Math.sqrt((s.x-f.x)**2+(s.y-f.y)**2);D<p&&D<i&&(i=D,c=u.id,d=g.id)}}if(c&&d){let u=e.fromNodeId,m=e.fromPortId;u!==c&&(b.some(f=>f.from.nodeId===u&&f.from.portId===m&&f.to.nodeId===c&&f.to.portId===d)||y(f=>({...f,edges:[...f.edges,{id:Pt(),from:{nodeId:u,portId:m},to:{nodeId:c,portId:d}}]})))}}T.current=null,H(null)},[r,E,b,z,y]),qt=(0,o.useCallback)((t,e)=>{let n=T.current;!n||n.type!=="edge"||(K(n,t,e),T.current=null,H(null))},[K]),L=(0,o.useCallback)(t=>{let e=t.target;if(e.closest("[data-port-id]")||e.closest("[data-action-id]"))return null;let p=e.closest("[data-node-id]");if(!p)return null;let i=p.getAttribute("data-node-id");return E.find(c=>c.id===i)??null},[E]),Gt=(0,o.useCallback)(t=>{if(!$||a)return;let e=L(t);e&&$({node:e,nativeEvent:t.nativeEvent})},[$,a,L]),Qt=(0,o.useCallback)(t=>{if(!q||a)return;let e=L(t);e&&q({node:e,nativeEvent:t.nativeEvent})},[q,a,L]),jt=(0,o.useCallback)(t=>{if(!G||a)return;let e=L(t);e&&(t.preventDefault(),G({node:e,nativeEvent:t.nativeEvent}))},[G,a,L]),Zt=(0,o.useCallback)((t,e,n)=>{if(!U||a)return;let s=E.find(p=>p.id===t);s&&U({node:s,actionId:e,nativeEvent:n})},[U,a,E]),te=(0,o.useCallback)((t,e)=>{!C||a||(e.stopPropagation(),V(new Set),_(t))},[C,a]),ee=(0,o.useCallback)(t=>{M||a||((t.key==="Delete"||t.key==="Backspace")&&(S.size>0&&(y(e=>({...e,nodes:e.nodes.filter(n=>!S.has(n.id)),edges:e.edges.filter(n=>!S.has(n.from.nodeId)&&!S.has(n.to.nodeId))})),V(new Set)),B&&(y(e=>({...e,edges:e.edges.filter(n=>n.id!==B)})),_(null))),t.key==="Escape"&&(V(new Set),_(null)))},[M,a,S,B,y]),rt=(0,o.useCallback)(()=>{let t=(0,l.clampZoom)(r.zoom+pt,X,Y);I({...r,zoom:t})},[r,X,Y,I]),st=(0,o.useCallback)(()=>{let t=(0,l.clampZoom)(r.zoom-pt,X,Y);I({...r,zoom:t})},[r,X,Y,I]),ct=(0,o.useCallback)(()=>{I({...at})},[I]),O=(0,o.useCallback)(()=>{let t=x.current?.getBoundingClientRect();if(!t)return;let e=(0,l.fitViewport)(E,t.width,t.height),n=(0,l.clampZoom)(e.zoom,X,Y);I({...e,zoom:n})},[E,X,Y,I]),Rt=(0,o.useCallback)(t=>{y(e=>({...e,nodes:[...e.nodes,t]}))},[y]),Tt=(0,o.useCallback)(t=>{y(e=>({...e,nodes:e.nodes.filter(n=>n.id!==t),edges:e.edges.filter(n=>n.from.nodeId!==t&&n.to.nodeId!==t)}))},[y]),it=(0,o.useCallback)(()=>JSON.stringify(A,null,2),[A]),dt=(0,o.useCallback)(t=>{try{let e=JSON.parse(t);e&&Array.isArray(e.nodes)&&Array.isArray(e.edges)&&y(()=>e)}catch{}},[y]);(0,o.useImperativeHandle)(Ot,()=>({zoomIn:rt,zoomOut:st,resetView:ct,fitToContent:O,addNode:Rt,removeNode:Tt,toJSON:it,loadJSON:dt}),[rt,st,ct,O,Rt,Tt,it,dt]);let Mt=(0,o.useRef)(!1);(0,o.useEffect)(()=>{vt&&!Mt.current&&x.current&&(Mt.current=!0,O())},[vt,O]);let ht=(0,o.useMemo)(()=>{let t=new Map;for(let e of E)t.set(e.id,z(e));return t},[E,z]),oe=(0,o.useMemo)(()=>({transform:`translate(${r.x}px, ${r.y}px) scale(${r.zoom})`,transformOrigin:"0 0"}),[r.x,r.y,r.zoom]);return(0,W.jsxs)("div",{ref:x,"data-testid":"workflow-editor",className:(0,Xt.cn)("relative w-full overflow-hidden bg-gray-50 dark:bg-gray-900 select-none",a&&"opacity-60 pointer-events-none",Ht),tabIndex:0,onWheel:Jt,onMouseDown:Kt,onMouseUp:$t,onClick:Gt,onDoubleClick:Qt,onContextMenu:jt,onKeyDown:ee,children:[At&&(0,W.jsx)(xt.GridLayer,{gridSize:j,zoom:r.zoom}),bt&&!M&&(0,W.jsx)(Vt.WorkflowToolbar,{zoom:r.zoom,direction:k,onDirectionChange:Ct,onZoomIn:rt,onZoomOut:st,onResetView:ct,onFitToContent:O,onExportJSON:it,onImportJSON:dt,disabled:a,labels:Ut}),(0,W.jsxs)("div",{style:oe,children:[(0,W.jsx)(St.WorkflowEdgeRenderer,{edges:b,nodes:E,selectedEdgeId:B,disabled:a||M,direction:k,onEdgeClick:te,getNodePorts:t=>ht.get(t.id)??[]}),E.map(t=>{let e=P[t.type];if(!e)return null;let n=ht.get(t.id)??[];return(0,W.jsx)(zt.WorkflowNodeRenderer,{node:t,registry:e,ports:n,selected:S.has(t.id),disabled:a||M,draggable:Q&&!M,direction:k,onPortMouseUp:qt,onActionClick:U?Zt:void 0},t.id)})]}),h&&(0,W.jsxs)("svg",{"data-testid":"drag-edge-overlay",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1e3,overflow:"visible"},children:[(0,W.jsx)("path",{d:(0,l.computeBezierPath)(h.fromX*r.zoom+r.x,h.fromY*r.zoom+r.y,h.currentX*r.zoom+r.x,h.currentY*r.zoom+r.y,k),fill:"none",stroke:"#3b82f6",strokeWidth:2.5,strokeDasharray:"8 4"}),(0,W.jsx)("circle",{cx:h.fromX*r.zoom+r.x,cy:h.fromY*r.zoom+r.y,r:5,fill:"#3b82f6"}),(0,W.jsx)("circle",{cx:h.currentX*r.zoom+r.x,cy:h.currentY*r.zoom+r.y,r:4,fill:"#3b82f6",opacity:.6})]})]})}var Lt=(0,o.forwardRef)(ae);Lt.displayName="WorkflowEditor";0&&(module.exports={WorkflowEditor});
1
+ "use strict";"use client";var lt=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ce=Object.prototype.hasOwnProperty;var ie=(v,T)=>{for(var N in T)lt(v,N,{get:T[N],enumerable:!0})},de=(v,T,N,P)=>{if(T&&typeof T=="object"||typeof T=="function")for(let k of se(T))!ce.call(v,k)&&k!==N&&lt(v,k,{get:()=>T[k],enumerable:!(P=re(T,k))||P.enumerable});return v};var fe=v=>de(lt({},"__esModule",{value:!0}),v);var me={};ie(me,{WorkflowEditor:()=>Ct});module.exports=fe(me);var o=require("react"),Yt=require("../../lib/cn.cjs"),mt=require("../../lib/editable-target.cjs"),xt=require("../../lib/i18n.cjs"),zt=require("./canvas/GridLayer.cjs"),St=require("./nodes/WorkflowNodeRenderer.cjs"),Vt=require("./edges/WorkflowEdgeRenderer.cjs"),Lt=require("./toolbar/WorkflowToolbar.cjs"),l=require("./utils/geometry.cjs"),W=require("react/jsx-runtime"),at={x:0,y:0,zoom:1},pt=.1,ue=.1,le=3,ae=20;function Xt(){return`edge-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function pe({value:v,defaultValue:T,onValueChange:N,nodeRegistry:P,direction:k="horizontal",onDirectionChange:At,onNodeClick:$,onNodeDoubleClick:q,onNodeContextMenu:G,onNodeAction:U,readOnly:M=!1,disabled:a=!1,draggableNodes:Q=!0,connectable:gt=!0,selectable:C=!0,multiSelect:wt=!1,panOnDrag:Et=!0,zoomOnWheel:yt=!0,minZoom:X=ue,maxZoom:Y=le,snapToGrid:vt=!1,gridSize:j=ae,showGrid:bt=!0,toolbar:_t=!0,autoFit:kt=!1,labels:Ht,className:Ot},Ut){let Bt=(0,xt.useUILabels)(Ht),Z=v!==void 0,[Ft,Jt]=(0,o.useState)(()=>T??{nodes:[],edges:[],viewport:{...at}}),A=Z?v:Ft,E=A.nodes,b=A.edges,r=A.viewport??at,x=(0,o.useRef)(null),R=(0,o.useRef)(null),[S,V]=(0,o.useState)(new Set),[B,_]=(0,o.useState)(null),[h,H]=(0,o.useState)(null),tt=(0,o.useRef)(r);tt.current=r;let et=(0,o.useRef)(E);et.current=E;let It=(0,o.useRef)(b);It.current=b;let Dt=(0,o.useRef)(vt);Dt.current=vt;let ot=(0,o.useRef)(j);ot.current=j;let Wt=(0,o.useRef)(P);Wt.current=P;let F=(0,o.useRef)(k);F.current=k;let y=(0,o.useCallback)(t=>{Z?N?.(t(v)):Jt(e=>{let n=t(e);return N?.(n),n})},[Z,v,N]),nt=(0,o.useRef)(y);nt.current=y;let I=(0,o.useCallback)(t=>{y(e=>({...e,viewport:t}))},[y]),Tt=(0,o.useRef)(I);Tt.current=I;let z=(0,o.useCallback)(t=>{let e=P[t.type];return e?.getPorts?e.getPorts(t):t.ports??[]},[P]),J=(0,o.useRef)(z);J.current=z;let K=(0,o.useCallback)((t,e,n)=>{let s=et.current,p=It.current,i=s.find(w=>w.id===t.fromNodeId),c=s.find(w=>w.id===e);if(!i||!c)return;let d=J.current(i),u=J.current(c),m=d.find(w=>w.id===t.fromPortId),g=u.find(w=>w.id===n);if(!m||!g||g.kind!=="in"||t.fromNodeId===e)return;let f=Wt.current[i.type];if(f?.canConnect&&!f.canConnect({fromNode:i,toNode:c,fromPort:m,toPort:g}))return;p.some(w=>w.from.nodeId===t.fromNodeId&&w.from.portId===t.fromPortId&&w.to.nodeId===e&&w.to.portId===n)||nt.current(w=>({...w,edges:[...w.edges,{id:Xt(),from:{nodeId:t.fromNodeId,portId:t.fromPortId},to:{nodeId:e,portId:n}}]}))},[]);(0,o.useEffect)(()=>{function t(n){let s=R.current;if(!s)return;let p=x.current?.getBoundingClientRect();if(!p)return;let i=tt.current;if(s.type==="pan"){let c=n.clientX-s.startX,d=n.clientY-s.startY;Tt.current({...i,x:s.startViewportX+c,y:s.startViewportY+d})}if(s.type==="node"){let c=(0,l.screenToCanvas)(n.clientX,n.clientY,i,p),d=c.x-s.offsetX,u=c.y-s.offsetY;Dt.current&&(d=(0,l.snapValue)(d,ot.current),u=(0,l.snapValue)(u,ot.current)),nt.current(m=>({...m,nodes:m.nodes.map(g=>g.id===s.nodeId?{...g,x:d,y:u}:g)}))}if(s.type==="edge"){let c=(0,l.screenToCanvas)(n.clientX,n.clientY,i,p);R.current={...s,currentX:c.x,currentY:c.y},H({fromX:s.fromX,fromY:s.fromY,currentX:c.x,currentY:c.y})}}function e(n){let s=R.current;if(s){if(s.type==="edge"){let p=x.current?.getBoundingClientRect();if(p){let i=tt.current,c=(0,l.screenToCanvas)(n.clientX,n.clientY,i,p),d=25,u=et.current,m=1/0,g=null,f=null;for(let D of u){let w=J.current(D);for(let ft of w){if(ft.kind!=="in")continue;let Pt=(0,l.getPortAbsolutePosition)(D,ft,w,F.current),ut=Math.sqrt((c.x-Pt.x)**2+(c.y-Pt.y)**2);ut<d&&ut<m&&(m=ut,g=D.id,f=ft.id)}}g&&f&&K(s,g,f)}H(null)}R.current=null}}return document.addEventListener("mousemove",t),document.addEventListener("mouseup",e),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e)}},[K]);let Kt=(0,o.useCallback)(t=>{if(!yt||a)return;t.preventDefault();let e=x.current?.getBoundingClientRect();if(!e)return;let n=t.clientX-e.left,s=t.clientY-e.top,p=t.deltaY<0?1:-1,i=(0,l.clampZoom)(r.zoom+p*pt,X,Y),c=i/r.zoom;I({x:n-(n-r.x)*c,y:s-(s-r.y)*c,zoom:i})},[yt,a,r,X,Y,I]),$t=(0,o.useCallback)(t=>{if(a)return;let e=t.target;if(e.closest("[data-action-id]"))return;let s=e.closest("[data-port-id]");if(s){if(!gt||M)return;t.preventDefault();let i=s.getAttribute("data-node-id"),c=s.getAttribute("data-port-id"),d=s.getAttribute("data-port-kind");if(!i||!c||d!=="out")return;let u=E.find(D=>D.id===i);if(!u)return;let m=z(u),g=m.find(D=>D.id===c);if(!g)return;let f=(0,l.getPortAbsolutePosition)(u,g,m,F.current);R.current={type:"edge",fromNodeId:i,fromPortId:c,fromX:f.x,fromY:f.y,currentX:f.x,currentY:f.y},H({fromX:f.x,fromY:f.y,currentX:f.x,currentY:f.y});return}let p=e.closest("[data-node-id]");if(p){if(M)return;let i=p.getAttribute("data-node-id");if(C&&(_(null),wt&&t.shiftKey?V(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d}):V(new Set([i]))),Q&&!(0,mt.isEditableTarget)(e)){let c=x.current?.getBoundingClientRect();if(!c)return;let d=E.find(m=>m.id===i);if(!d||d.locked)return;let u=(0,l.screenToCanvas)(t.clientX,t.clientY,r,c);R.current={type:"node",nodeId:i,startX:u.x,startY:u.y,offsetX:u.x-d.x,offsetY:u.y-d.y}}return}C&&(V(new Set),_(null)),Et&&t.button===0&&(R.current={type:"pan",startX:t.clientX,startY:t.clientY,startViewportX:r.x,startViewportY:r.y})},[a,gt,M,C,wt,Q,Et,r,E,z]),qt=(0,o.useCallback)(t=>{let e=R.current;if(!e||e.type!=="edge")return;let n=x.current?.getBoundingClientRect();if(n){let s=(0,l.screenToCanvas)(t.clientX,t.clientY,r,n),p=30,i=1/0,c=null,d=null;for(let u of E){let m=z(u);for(let g of m){if(g.kind!=="in")continue;let f=(0,l.getPortAbsolutePosition)(u,g,m,F.current),D=Math.sqrt((s.x-f.x)**2+(s.y-f.y)**2);D<p&&D<i&&(i=D,c=u.id,d=g.id)}}if(c&&d){let u=e.fromNodeId,m=e.fromPortId;u!==c&&(b.some(f=>f.from.nodeId===u&&f.from.portId===m&&f.to.nodeId===c&&f.to.portId===d)||y(f=>({...f,edges:[...f.edges,{id:Xt(),from:{nodeId:u,portId:m},to:{nodeId:c,portId:d}}]})))}}R.current=null,H(null)},[r,E,b,z,y]),Gt=(0,o.useCallback)((t,e)=>{let n=R.current;!n||n.type!=="edge"||(K(n,t,e),R.current=null,H(null))},[K]),L=(0,o.useCallback)(t=>{let e=t.target;if(e.closest("[data-port-id]")||e.closest("[data-action-id]"))return null;let p=e.closest("[data-node-id]");if(!p)return null;let i=p.getAttribute("data-node-id");return E.find(c=>c.id===i)??null},[E]),Qt=(0,o.useCallback)(t=>{if(!$||a)return;let e=L(t);e&&$({node:e,nativeEvent:t.nativeEvent})},[$,a,L]),jt=(0,o.useCallback)(t=>{if(!q||a)return;let e=L(t);e&&q({node:e,nativeEvent:t.nativeEvent})},[q,a,L]),Zt=(0,o.useCallback)(t=>{if(!G||a)return;let e=L(t);e&&(t.preventDefault(),G({node:e,nativeEvent:t.nativeEvent}))},[G,a,L]),te=(0,o.useCallback)((t,e,n)=>{if(!U||a)return;let s=E.find(p=>p.id===t);s&&U({node:s,actionId:e,nativeEvent:n})},[U,a,E]),ee=(0,o.useCallback)((t,e)=>{!C||a||(e.stopPropagation(),V(new Set),_(t))},[C,a]),oe=(0,o.useCallback)(t=>{if(!(M||a)){if(t.key==="Delete"||t.key==="Backspace"){if((0,mt.isEditableTarget)(t.target))return;S.size>0&&(y(e=>({...e,nodes:e.nodes.filter(n=>!S.has(n.id)),edges:e.edges.filter(n=>!S.has(n.from.nodeId)&&!S.has(n.to.nodeId))})),V(new Set)),B&&(y(e=>({...e,edges:e.edges.filter(n=>n.id!==B)})),_(null))}t.key==="Escape"&&(V(new Set),_(null))}},[M,a,S,B,y]),rt=(0,o.useCallback)(()=>{let t=(0,l.clampZoom)(r.zoom+pt,X,Y);I({...r,zoom:t})},[r,X,Y,I]),st=(0,o.useCallback)(()=>{let t=(0,l.clampZoom)(r.zoom-pt,X,Y);I({...r,zoom:t})},[r,X,Y,I]),ct=(0,o.useCallback)(()=>{I({...at})},[I]),O=(0,o.useCallback)(()=>{let t=x.current?.getBoundingClientRect();if(!t)return;let e=(0,l.fitViewport)(E,t.width,t.height),n=(0,l.clampZoom)(e.zoom,X,Y);I({...e,zoom:n})},[E,X,Y,I]),Rt=(0,o.useCallback)(t=>{y(e=>({...e,nodes:[...e.nodes,t]}))},[y]),Mt=(0,o.useCallback)(t=>{y(e=>({...e,nodes:e.nodes.filter(n=>n.id!==t),edges:e.edges.filter(n=>n.from.nodeId!==t&&n.to.nodeId!==t)}))},[y]),it=(0,o.useCallback)(()=>JSON.stringify(A,null,2),[A]),dt=(0,o.useCallback)(t=>{try{let e=JSON.parse(t);e&&Array.isArray(e.nodes)&&Array.isArray(e.edges)&&y(()=>e)}catch{}},[y]);(0,o.useImperativeHandle)(Ut,()=>({zoomIn:rt,zoomOut:st,resetView:ct,fitToContent:O,addNode:Rt,removeNode:Mt,toJSON:it,loadJSON:dt}),[rt,st,ct,O,Rt,Mt,it,dt]);let ht=(0,o.useRef)(!1);(0,o.useEffect)(()=>{kt&&!ht.current&&x.current&&(ht.current=!0,O())},[kt,O]);let Nt=(0,o.useMemo)(()=>{let t=new Map;for(let e of E)t.set(e.id,z(e));return t},[E,z]),ne=(0,o.useMemo)(()=>({transform:`translate(${r.x}px, ${r.y}px) scale(${r.zoom})`,transformOrigin:"0 0"}),[r.x,r.y,r.zoom]);return(0,W.jsxs)("div",{ref:x,"data-testid":"workflow-editor",className:(0,Yt.cn)("relative w-full overflow-hidden bg-gray-50 dark:bg-gray-900 select-none",a&&"opacity-60 pointer-events-none",Ot),tabIndex:0,onWheel:Kt,onMouseDown:$t,onMouseUp:qt,onClick:Qt,onDoubleClick:jt,onContextMenu:Zt,onKeyDown:oe,children:[bt&&(0,W.jsx)(zt.GridLayer,{gridSize:j,zoom:r.zoom}),_t&&!M&&(0,W.jsx)(Lt.WorkflowToolbar,{zoom:r.zoom,direction:k,onDirectionChange:At,onZoomIn:rt,onZoomOut:st,onResetView:ct,onFitToContent:O,onExportJSON:it,onImportJSON:dt,disabled:a,labels:Bt}),(0,W.jsxs)("div",{style:ne,children:[(0,W.jsx)(Vt.WorkflowEdgeRenderer,{edges:b,nodes:E,selectedEdgeId:B,disabled:a||M,direction:k,onEdgeClick:ee,getNodePorts:t=>Nt.get(t.id)??[]}),E.map(t=>{let e=P[t.type];if(!e)return null;let n=Nt.get(t.id)??[];return(0,W.jsx)(St.WorkflowNodeRenderer,{node:t,registry:e,ports:n,selected:S.has(t.id),disabled:a||M,draggable:Q&&!M,direction:k,onPortMouseUp:Gt,onActionClick:U?te:void 0},t.id)})]}),h&&(0,W.jsxs)("svg",{"data-testid":"drag-edge-overlay",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1e3,overflow:"visible"},children:[(0,W.jsx)("path",{d:(0,l.computeBezierPath)(h.fromX*r.zoom+r.x,h.fromY*r.zoom+r.y,h.currentX*r.zoom+r.x,h.currentY*r.zoom+r.y,k),fill:"none",stroke:"#3b82f6",strokeWidth:2.5,strokeDasharray:"8 4"}),(0,W.jsx)("circle",{cx:h.fromX*r.zoom+r.x,cy:h.fromY*r.zoom+r.y,r:5,fill:"#3b82f6"}),(0,W.jsx)("circle",{cx:h.currentX*r.zoom+r.x,cy:h.currentY*r.zoom+r.y,r:4,fill:"#3b82f6",opacity:.6})]})]})}var Ct=(0,o.forwardRef)(pe);Ct.displayName="WorkflowEditor";0&&(module.exports={WorkflowEditor});