dhx-react-suite 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ (function(z,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","recharts"],e):(z=typeof globalThis<"u"?globalThis:z||self,e(z.DhxReactSuite={},z.ReactJSXRuntime,z.React,z.Recharts))})(this,function(z,e,x,W){"use strict";const t={primary:"#0288d1",primaryDk:"#01579b",primaryLt:"#e1f5fe",success:"#43a047",danger:"#e53935",warning:"#fb8c00",bg:"#f5f7fa",surface:"#ffffff",border:"#dde3ea",borderDk:"#b0bec5",text:"#3d4a5c",textSec:"#6b7a8d",textMut:"#9aa5b1",shadow:"0 2px 8px rgba(0,0,0,.10)",shadowLg:"0 8px 28px rgba(0,0,0,.14)",r:"4px",rMd:"8px",font:"'Segoe UI', system-ui, -apple-system, sans-serif"},F="dhx-react-styles";function L(){if(typeof document>"u"||document.getElementById(F))return;const r=document.createElement("style");r.id=F,r.textContent=`
2
+ *,*::before,*::after{box-sizing:border-box}
3
+ .dhx{font-family:${t.font};font-size:14px;color:${t.text}}
4
+ .dhx *{box-sizing:border-box}
5
+ .dhx-scroll::-webkit-scrollbar{width:6px;height:6px}
6
+ .dhx-scroll::-webkit-scrollbar-track{background:${t.bg}}
7
+ .dhx-scroll::-webkit-scrollbar-thumb{background:${t.borderDk};border-radius:3px}
8
+ .dhx-scroll::-webkit-scrollbar-thumb:hover{background:${t.textMut}}
9
+ @keyframes dhx-fade{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
10
+ @keyframes dhx-spin{to{transform:rotate(360deg)}}
11
+ @keyframes dhx-toast{from{opacity:0;transform:translateX(110%)}to{opacity:1;transform:translateX(0)}}
12
+ @keyframes dhx-pulse{0%,100%{opacity:1}50%{opacity:.5}}
13
+ .dhx-anim-fade{animation:dhx-fade .15s ease}
14
+ .dhx-btn{display:inline-flex;align-items:center;gap:5px;padding:0 12px;height:32px;border-radius:${t.r};border:1px solid transparent;cursor:pointer;font-size:13px;font-family:inherit;font-weight:500;transition:all .15s ease;outline:none;white-space:nowrap;user-select:none}
15
+ .dhx-btn:focus-visible{box-shadow:0 0 0 3px ${t.primary}33}
16
+ .dhx-btn-primary{background:${t.primary};color:#fff;border-color:${t.primary}}
17
+ .dhx-btn-primary:hover{background:${t.primaryDk};border-color:${t.primaryDk}}
18
+ .dhx-btn-secondary{background:${t.surface};color:${t.text};border-color:${t.border}}
19
+ .dhx-btn-secondary:hover{background:${t.bg};border-color:${t.borderDk}}
20
+ .dhx-btn-ghost{background:transparent;color:${t.textSec};border-color:transparent}
21
+ .dhx-btn-ghost:hover{background:${t.bg};color:${t.text}}
22
+ .dhx-btn-danger{background:${t.danger};color:#fff;border-color:${t.danger}}
23
+ .dhx-btn-danger:hover{background:#c62828;border-color:#c62828}
24
+ .dhx-btn:disabled{opacity:.45;cursor:not-allowed}
25
+ .dhx-input{width:100%;height:32px;padding:0 10px;border:1px solid ${t.border};border-radius:${t.r};font-size:13px;font-family:inherit;color:${t.text};background:${t.surface};outline:none;transition:border-color .15s}
26
+ .dhx-input:focus{border-color:${t.primary};box-shadow:0 0 0 3px ${t.primary}22}
27
+ .dhx-input:disabled{background:${t.bg};color:${t.textMut};cursor:not-allowed}
28
+ .dhx-input-wrap{position:relative;width:100%}
29
+ .dhx-input-wrap .dhx-input-icon{position:absolute;left:9px;top:50%;transform:translateY(-50%);color:${t.textMut};pointer-events:none}
30
+ .dhx-input-wrap .dhx-input--with-icon{padding-left:30px}
31
+ .dhx-label{display:block;font-size:12px;font-weight:600;color:${t.textSec};margin-bottom:5px;letter-spacing:.02em}
32
+ .dhx-form-group{margin-bottom:14px}
33
+ .dhx-card{background:${t.surface};border:1px solid ${t.border};border-radius:${t.rMd};box-shadow:${t.shadow}}
34
+ .dhx-card-padded{padding:16px}
35
+ .dhx-divider{border:none;border-top:1px solid ${t.border};margin:0}
36
+ .dhx-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:20px;font-size:11px;font-weight:600}
37
+ .dhx-tag-primary{background:${t.primaryLt};color:${t.primaryDk}}
38
+ .dhx-tag-success{background:#e8f5e9;color:#1b5e20}
39
+ .dhx-tag-danger{background:#ffebee;color:#b71c1c}
40
+ .dhx-tag-warning{background:#fff3e0;color:#e65100}
41
+ `,document.head.appendChild(r)}const U={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function Q({children:r,variant:l="primary",size:g="md",icon:o,disabled:d,onClick:a,style:c,className:n=""}){return x.useEffect(L,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${l} ${n}`,style:{...U[g],...c},disabled:d,onClick:a,children:[o&&e.jsx("span",{style:{fontSize:16},children:o}),r]})}function Z({items:r=[],style:l}){x.useEffect(L,[]);const g=(o,d)=>{var c;if(o.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},d);if(o.type==="spacer")return e.jsx("div",{style:{flex:1}},d);if(o.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[o.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:o.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:o.width||140,height:28},placeholder:o.placeholder,defaultValue:o.value,onChange:n=>{var p;return(p=o.onChange)==null?void 0:p.call(o,n.target.value)}})]},d);if(o.type==="select")return e.jsx("select",{className:"dhx dhx-input",style:{width:o.width||100,height:28,cursor:"pointer"},defaultValue:o.value,onChange:n=>{var p;return(p=o.onChange)==null?void 0:p.call(o,n.target.value)},children:(c=o.options)==null?void 0:c.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))},d);const a=o.active;return e.jsxs("button",{className:`dhx dhx-btn ${a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:32,gap:4,...o.twoState&&a?{background:t.primaryLt,color:t.primary,borderColor:`${t.primary}66`}:{}},disabled:o.disabled,onClick:()=>{var n;return(n=o.onClick)==null?void 0:n.call(o,o)},children:[o.icon&&e.jsx("span",{style:{fontSize:16},children:o.icon}),o.text&&e.jsx("span",{children:o.text})]},d)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...l},children:r.map(g)})}function R({items:r=[],width:l=240,collapsed:g,onSelect:o,header:d,footer:a,style:c}){const[n,p]=x.useState(g??!1),[v,i]=x.useState(null),[u,s]=x.useState({});x.useEffect(L,[]);const y=n?56:l,m=S=>{i(S.id),o==null||o(S)},M=(S,C=0)=>{var $;if(S.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},S.id);if(S.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:S.html||""}},S.id);const k=((($=S.items)==null?void 0:$.length)??0)>0,h=u[S.id],f=v===S.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{k&&s(D=>({...D,[S.id]:!D[S.id]})),m(S)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${n?"0px":`${12+C*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:n?"center":"flex-start",transition:"all .15s",background:f?t.primaryLt:"transparent",color:f?t.primary:t.text,userSelect:"none"},onMouseEnter:D=>!f&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>!f&&(D.currentTarget.style.background="transparent"),children:[S.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:S.icon}),!n&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:f?600:400},children:S.value}),!n&&S.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:S.count}),!n&&k&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:h?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),k&&h&&!n&&S.items.map(D=>M(D,C+1))]},S.id)};return e.jsxs("div",{className:"dhx",style:{width:y,minWidth:y,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...c},children:[d&&!n&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:d}),e.jsx("button",{onClick:()=>p(S=>!S),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:n?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:n?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(S=>M(S))}),a&&!n&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:a})]})}function ee({config:r}){const[l,g]=x.useState(!1),o={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...l?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:o,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>g(d=>!d),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:l?"▼":"▲"})]}),!l&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(K,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function K({rows:r,cols:l,type:g="line",style:o,children:d}){x.useEffect(L,[]);const a=g==="space"?12:g==="wide"?8:1,c=r||l,n=!!r;return c?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:n?"column":"row",gap:a,width:"100%",height:"100%",...o},children:c.map((p,v)=>e.jsx(ee,{config:p},p.id||v))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...o},children:d})}function te({views:r=[],mode:l="top",tabAlign:g="left",closable:o=[],disabled:d=[],defaultActive:a,onBeforeChange:c,onChange:n,style:p}){var f;const[v,i]=x.useState(a||((f=r[0])==null?void 0:f.id)),[u,s]=x.useState(r.map($=>$.id));x.useEffect(L,[]);const y=($,D)=>{$.stopPropagation(),s(b=>b.filter(N=>N!==D)),v===D&&i(u.find(b=>b!==D)??"")},m=$=>{d.includes($)||c&&c($)===!1||(i($),n==null||n($))},M=l==="left"||l==="right",S=r.filter($=>u.includes($.id)),C=e.jsx("div",{style:{display:"flex",flexDirection:M?"column":"row",justifyContent:g==="center"?"center":g==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!M&&l!=="bottom"?`2px solid ${t.border}`:"none",borderTop:l==="bottom"?`2px solid ${t.border}`:"none",borderRight:l==="left"?`2px solid ${t.border}`:"none",borderLeft:l==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:S.map($=>{const D=v===$.id,b=d.includes($.id),N=l==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:M?{color:t.primary,fontWeight:600,background:t.primaryLt,[l==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>m($.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:b?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:M?120:"auto",...D?N:{color:b?t.textMut:t.textSec}},children:[$.icon&&e.jsx("span",{style:{fontSize:16},children:$.icon}),e.jsx("span",{children:$.tab}),o.includes($.id)&&e.jsx("span",{onClick:w=>y(w,$.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},$.id)})}),k=S.find($=>$.id===v),h=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[k==null?void 0:k.content,(k==null?void 0:k.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:k.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:l==="top"?"column":l==="bottom"?"column-reverse":l==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...p},children:[C,h]})}function re({columns:r,data:l=[],height:g=400,rowHeight:o=40,sortable:d=!0,resizable:a=!0,selection:c,multiselect:n,onSelect:p,style:v}){const[i,u]=x.useState(null),[s,y]=x.useState("asc"),[m,M]=x.useState({}),[S,C]=x.useState(new Set),[k,h]=x.useState(r.map(w=>w.width||w.minWidth||140));x.useEffect(L,[]);const f=x.useMemo(()=>{let w=l.filter(T=>Object.entries(m).every(([A,E])=>!E||String(T[A]??"").toLowerCase().includes(E.toLowerCase())));return i&&(w=[...w].sort((T,A)=>{const E=T[i],I=A[i];return E==null?1:I==null?-1:s==="asc"?E<I?-1:E>I?1:0:E>I?-1:E<I?1:0})),w},[l,i,s,m]),$=w=>{!d||w.sortable===!1||(y(T=>i===w.id&&T==="asc"?"desc":"asc"),u(w.id))},D=(w,T)=>{if(!c)return;const A=w.id??T;C(E=>{const I=n?new Set(E):new Set;return I.has(A)?I.delete(A):I.add(A),I}),p==null||p(w)},b=(w,T)=>{const A=w.clientX,E=k[T],I=$e=>h(me=>{const J=[...me];return J[T]=Math.max(60,E+$e.clientX-A),J}),P=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",P)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",P),w.preventDefault()},N=r.some(w=>w.filterable!==!1);return e.jsx("div",{className:"dhx",style:{width:"100%",height:g,display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...v},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column"},children:e.jsxs("div",{style:{minWidth:k.reduce((w,T)=>w+T,0)+"px",display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:`1px solid ${t.border}`,position:"sticky",top:0,zIndex:2},children:r.map((w,T)=>{var A;return e.jsxs("div",{style:{width:k[T],minWidth:k[T],position:"relative",padding:"0 10px",height:40,display:"flex",alignItems:"center",fontSize:12,fontWeight:600,color:t.textSec,cursor:d&&w.sortable!==!1?"pointer":"default",userSelect:"none",gap:4},onClick:()=>$(w),children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(w.header)?(A=w.header[0])==null?void 0:A.text:w.header||w.id}),d&&w.sortable!==!1&&e.jsx("span",{style:{opacity:i===w.id?1:.25,fontSize:10},children:i===w.id?s==="asc"?"▲":"▼":"⇅"}),a&&T<r.length-1&&e.jsx("div",{onMouseDown:E=>b(E,T),style:{position:"absolute",right:0,top:4,bottom:4,width:4,cursor:"col-resize",background:"transparent"},onMouseEnter:E=>E.currentTarget.style.background=t.border,onMouseLeave:E=>E.currentTarget.style.background="transparent"})]},w.id)})}),N&&e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${t.border}`,background:t.surface},children:r.map((w,T)=>e.jsx("div",{style:{width:k[T],minWidth:k[T],padding:"4px 6px"},children:w.filterable!==!1&&e.jsx("input",{className:"dhx dhx-input",style:{height:24,fontSize:12},placeholder:"🔍",value:m[w.id]||"",onChange:A=>M(E=>({...E,[w.id]:A.target.value}))})},w.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto"},children:[f.map((w,T)=>{const A=w.id??T,E=S.has(A);return e.jsx("div",{onClick:()=>D(w,T),style:{display:"flex",height:o,alignItems:"center",borderBottom:`1px solid ${t.border}`,cursor:c?"pointer":"default",background:E?t.primaryLt:T%2===0?t.surface:t.bg,transition:"background .1s"},onMouseEnter:I=>!E&&(I.currentTarget.style.background="#f0f8ff"),onMouseLeave:I=>!E&&(I.currentTarget.style.background=T%2===0?t.surface:t.bg),children:r.map((I,P)=>e.jsx("div",{style:{width:k[P],minWidth:k[P],padding:"0 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:I.align||"left"},children:I.template?I.template(w[I.id],w):String(w[I.id]??"")},I.id))},String(A))}),f.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut},children:"No data"})]})]})})})}const B=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function ne({type:r="bar",data:l=[],series:g=[],scales:o={},legend:d,height:a=280,style:c}){var M,S,C,k,h;x.useEffect(L,[]);const n=((M=o.bottom)==null?void 0:M.text)||l[0]&&Object.keys(l[0])[0]||"x",p=e.jsx(W.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),v=d?e.jsx(W.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:d.valign,align:d.halign}):null,i=e.jsx(W.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),u=e.jsx(W.XAxis,{dataKey:n,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),s=e.jsx(W.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((S=o.left)==null?void 0:S.min)??"auto",((C=o.left)==null?void 0:C.max)??"auto"]}),y={data:l,margin:{top:10,right:20,left:0,bottom:0}};let m;if(r==="bar")m=e.jsxs(W.BarChart,{...y,children:[i,u,s,p,v,g.map((f,$)=>e.jsx(W.Bar,{dataKey:f.value||f.id,name:f.label||f.id,fill:f.fill||B[$%B.length],radius:[3,3,0,0]},f.id))]});else if(r==="line")m=e.jsxs(W.LineChart,{...y,children:[i,u,s,p,v,g.map((f,$)=>e.jsx(W.Line,{type:"monotone",dataKey:f.value||f.id,name:f.label||f.id,stroke:f.color||B[$%B.length],strokeWidth:2,dot:{r:3,fill:f.color||B[$%B.length]}},f.id))]});else if(r==="area")m=e.jsxs(W.AreaChart,{...y,children:[i,u,s,p,v,g.map((f,$)=>e.jsx(W.Area,{type:"monotone",dataKey:f.value||f.id,name:f.label||f.id,stroke:f.color||B[$%B.length],fill:(f.fill||B[$%B.length])+"33",strokeWidth:2},f.id))]});else if(r==="pie"||r==="donut"){const f=l[0]||{},$=Object.keys(f).find(b=>typeof f[b]=="number")||"value",D=Object.keys(f).find(b=>typeof f[b]=="string")||"x";m=e.jsxs(W.PieChart,{children:[e.jsx(W.Pie,{data:l,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:$,nameKey:D,label:({name:b,percent:N})=>`${b??""} ${((N??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:l.map((b,N)=>e.jsx(W.Cell,{fill:B[N%B.length]},N))}),p,v]})}else r==="radar"?m=e.jsxs(W.RadarChart,{...y,cx:"50%",cy:"50%",children:[e.jsx(W.PolarGrid,{}),e.jsx(W.PolarAngleAxis,{dataKey:n,tick:{fontSize:11}}),g.map((f,$)=>e.jsx(W.Radar,{dataKey:f.value||f.id,name:f.label||f.id,stroke:f.color||B[$],fill:(f.fill||B[$])+"44"},f.id)),p,v]}):r==="scatter"&&(m=e.jsxs(W.ScatterChart,{...y,children:[i,e.jsx(W.XAxis,{dataKey:((k=g[0])==null?void 0:k.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(W.YAxis,{dataKey:((h=g[0])==null?void 0:h.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),p,g.map((f,$)=>e.jsx(W.Scatter,{data:f.data||l,name:f.label||f.id,fill:f.color||B[$]},f.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...c},children:e.jsx(W.ResponsiveContainer,{width:"100%",height:"100%",children:m})})}const oe=["January","February","March","April","May","June","July","August","September","October","November","December"],se=["Su","Mo","Tu","We","Th","Fr","Sa"];function le({value:r,range:l=!1,timepicker:g=!1,onChange:o,style:d}){const a=new Date,c=r?new Date(Array.isArray(r)?r[0]:r):a,[n,p]=x.useState(c),[v,i]=x.useState(r??(l?[null,null]:null)),[u,s]=x.useState(null),[y,m]=x.useState({h:0,m:0});x.useEffect(L,[]);const M=n.getFullYear(),S=n.getMonth(),C=new Date(M,S,1).getDay(),k=new Date(M,S+1,0).getDate(),h=[];for(let b=0;b<C;b++)h.push(null);for(let b=1;b<=k;b++)h.push(new Date(M,S,b));const f=b=>b.toDateString()===a.toDateString(),$=b=>{if(!v)return!1;if(l&&Array.isArray(v)){const[N,w]=v;if(!N)return!1;const T=b.getTime();return w?T>=N.getTime()&&T<=w.getTime():b.toDateString()===N.toDateString()}return b.toDateString()===v.toDateString()},D=b=>{if(l){const[N,w]=Array.isArray(v)?v:[null,null];if(!N||w)i([b,null]);else{const T=b<N?[b,N]:[N,b];i(T),o==null||o(T)}}else i(b),o==null||o(b)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...d},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>p(b=>new Date(b.getFullYear(),b.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[oe[S]," ",M]}),e.jsx("button",{onClick:()=>p(b=>new Date(b.getFullYear(),b.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[se.map(b=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:b},b)),h.map((b,N)=>{const w=b?$(b):!1,T=b&&u&&b.toDateString()===u.toDateString();return e.jsx("div",{onClick:()=>b&&D(b),onMouseEnter:()=>b&&s(b),onMouseLeave:()=>s(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:b?"pointer":"default",fontSize:12,fontWeight:b&&f(b)?700:400,background:w?t.primary:T?t.bg:"transparent",color:w?"#fff":b&&f(b)?t.primary:b?t.text:"transparent",border:b&&f(b)&&!w?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:b==null?void 0:b.getDate()},N)})]}),g&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:y.h,onChange:b=>m(N=>({...N,h:+b.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:y.m,onChange:b=>m(N=>({...N,m:+b.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function ae({value:r,onChange:l,style:g}){const[o,d]=x.useState((r==null?void 0:r.h)??12),[a,c]=x.useState((r==null?void 0:r.m)??0),[n,p]=x.useState((r==null?void 0:r.ampm)??"AM");x.useEffect(L,[]);const v=Array.from({length:12},(u,s)=>s+1),i=Array.from({length:12},(u,s)=>s*5);return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...g},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[[{label:"Hours",values:v,val:o,setFn:d},{label:"Minutes",values:i,val:a,setFn:c}].map(({label:u,values:s,val:y,setFn:m})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:u}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:s.map(M=>e.jsx("div",{onClick:()=>{m(M),l==null||l({h:u==="Hours"?M:o,m:u==="Minutes"?M:a,ampm:n})},style:{height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:y===M?700:400,background:y===M?t.primaryLt:"transparent",color:y===M?t.primary:t.text},onMouseEnter:S=>y!==M&&(S.currentTarget.style.background=t.bg),onMouseLeave:S=>y!==M&&(S.currentTarget.style.background="transparent"),children:String(M).padStart(2,"0")},M))})]},u)),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(u=>e.jsx("div",{onClick:()=>{p(u),l==null||l({h:o,m:a,ampm:u})},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===u?700:400,background:n===u?t.primary:t.surface,color:n===u?"#fff":t.text},children:u},u))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(o).padStart(2,"0"),":",String(a).padStart(2,"0")," ",n]})]})}function H(r,l){x.useEffect(()=>{const g=o=>{r.current&&!r.current.contains(o.target)&&l(o)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r,l])}function X(r){const l=x.useRef(!1),g=x.useRef({x:0,y:0,ox:0,oy:0});return x.useCallback((o,d=0,a=0)=>{l.current=!0,g.current={x:o.clientX,y:o.clientY,ox:d,oy:a};const c=p=>{if(!l.current)return;const{x:v,y:i,ox:u,oy:s}=g.current;r(u+p.clientX-v,s+p.clientY-i)},n=()=>{l.current=!1,document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",n),o.preventDefault()},[r])}function _({data:r=[],value:l,placeholder:g="Select or type...",multiselection:o=!1,label:d,onChange:a,style:c}){var k;const[n,p]=x.useState(!1),[v,i]=x.useState(""),[u,s]=x.useState(o?l?[].concat(l):[]:l||null),y=x.useRef(null);x.useEffect(L,[]),H(y,x.useCallback(()=>p(!1),[]));const m=x.useMemo(()=>r.filter(h=>!v||h.value.toLowerCase().includes(v.toLowerCase())),[r,v]),M=h=>o?(u||[]).includes(h):u===h,S=h=>{const f=h.id||h.value;if(o){const $=M(f)?u.filter(D=>D!==f):[...u||[],f];s($),a==null||a($)}else s(f),i(""),p(!1),a==null||a(f)},C=o?u!=null&&u.length?`${u.length} selected`:"":((k=r.find(h=>(h.id||h.value)===u))==null?void 0:k.value)||"";return e.jsxs("div",{ref:y,className:"dhx",style:{position:"relative",...c},children:[d&&e.jsx("label",{className:"dhx dhx-label",children:d}),e.jsxs("div",{onClick:()=>p(h=>!h),style:{display:"flex",alignItems:"center",border:`1px solid ${n?t.primary:t.border}`,borderRadius:t.r,height:32,padding:"0 10px",cursor:"pointer",background:t.surface,gap:6,transition:"border-color .15s",boxShadow:n?`0 0 0 3px ${t.primary}22`:"none"},children:[o&&(u==null?void 0:u.length)>0&&e.jsxs("div",{style:{display:"flex",gap:3,flex:1,flexWrap:"wrap",overflow:"hidden"},children:[u.slice(0,3).map(h=>{var f;return e.jsxs("span",{className:"dhx dhx-tag dhx-tag-primary",style:{fontSize:10,padding:"0 5px"},children:[((f=r.find($=>($.id||$.value)===h))==null?void 0:f.value)||h,e.jsx("span",{onClick:$=>{$.stopPropagation(),S({value:h})},style:{cursor:"pointer",marginLeft:3},children:"×"})]},h)}),u.length>3&&e.jsxs("span",{className:"dhx dhx-tag dhx-tag-primary",style:{fontSize:10,padding:"0 5px"},children:["+",u.length-3]})]}),!o&&e.jsx("input",{value:n?v:C,onChange:h=>{i(h.target.value),p(!0)},onFocus:()=>p(!0),onClick:h=>h.stopPropagation(),placeholder:g,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text}}),o&&!(u!=null&&u.length)&&e.jsx("span",{style:{flex:1,color:t.textMut,fontSize:13},children:g}),e.jsx("span",{style:{color:t.textMut,fontSize:12,marginLeft:"auto"},children:n?"▲":"▼"})]}),n&&e.jsxs("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100,maxHeight:220},children:[o&&e.jsx("div",{style:{padding:"6px 10px",borderBottom:`1px solid ${t.border}`},children:e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Search...",value:v,onChange:h=>i(h.target.value)})}),e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:180,overflowY:"auto"},children:[m.map(h=>e.jsxs("div",{onClick:()=>S(h),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:M(h.id||h.value)?t.primaryLt:"transparent",color:M(h.id||h.value)?t.primary:t.text},onMouseEnter:f=>!M(h.id||h.value)&&(f.currentTarget.style.background=t.bg),onMouseLeave:f=>!M(h.id||h.value)&&(f.currentTarget.style.background="transparent"),children:[o&&e.jsx("span",{style:{width:14,height:14,border:`2px solid ${M(h.id||h.value)?t.primary:t.borderDk}`,borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",background:M(h.id||h.value)?t.primary:"transparent"},children:M(h.id||h.value)&&e.jsx("span",{style:{color:"#fff",fontSize:9},children:"✓"})}),h.value,h.count!==void 0&&e.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:t.textMut},children:["(",h.count,")"]})]},h.id||h.value)),m.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})]})]})}function V({min:r=0,max:l=100,step:g=1,value:o,range:d=!1,label:a,tick:c,onChange:n,style:p}){const[v,i]=x.useState(o??(d?[r,l]:r));x.useEffect(L,[]);const u=(M,S)=>{if(d){const C=[...v];C[M]=S,i(C),n==null||n(C)}else i(S),n==null||n(S)},s=M=>(M-r)/(l-r)*100,y=d?v:[v],m=d?{left:`${s(y[0])}%`,width:`${s(y[1])-s(y[0])}%`}:{left:0,width:`${s(y[0])}%`};return e.jsxs("div",{className:"dhx",style:{width:"100%",...p},children:[a&&e.jsx("label",{className:"dhx dhx-label",children:a}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...m,height:"100%",background:t.primary,borderRadius:2}}),y.map((M,S)=>e.jsx("input",{type:"range",min:r,max:l,step:g,value:M,onChange:C=>{const k=+C.target.value;d&&S===0&&k>=v[1]||d&&S===1&&k<=v[0]||u(S,k)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:"pointer",top:0,left:0,margin:0}},S)),y.map((M,S)=>e.jsx("div",{style:{position:"absolute",left:`${s(M)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${t.primary}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:M})},S))]})}),c&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((l+r)/2),l].map(M=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:M},M))})]})}const de=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function O(r){const l=parseInt(r.slice(1,3),16)/255,g=parseInt(r.slice(3,5),16)/255,o=parseInt(r.slice(5,7),16)/255,d=Math.max(l,g,o),a=Math.min(l,g,o);let c=0,n=0;const p=(d+a)/2;if(d!==a){const v=d-a;n=p>.5?v/(2-d-a):v/(d+a),c=d===l?((g-o)/v+(g<o?6:0))/6:d===g?((o-l)/v+2)/6:((l-g)/v+4)/6}return[Math.round(c*360),Math.round(n*100),Math.round(p*100)]}function q(r,l,g){l/=100,g/=100;const o=l*Math.min(g,1-g),d=a=>{const c=(a+r/30)%12,n=g-o*Math.max(Math.min(c-3,9-c,1),-1);return Math.round(255*n).toString(16).padStart(2,"0")};return"#"+d(0)+d(8)+d(4)}function ie({value:r="#0288d1",onChange:l,style:g}){const[o,d]=x.useState(()=>O(r)),a=q(...o);x.useEffect(L,[]);const c=n=>{d(n),l==null||l(q(...n))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...g},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${o[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,o[0]],["Saturation",0,100,o[1]],["Lightness",0,100,o[2]]].map(([n,p,v,i],u)=>e.jsxs("div",{style:{marginBottom:u<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[n,u>0?` (${i}%)`:""]}),e.jsx("input",{type:"range",min:p,max:v,value:i,onChange:s=>{const y=[...o];y[u]=+s.target.value,c(y)},style:{width:"100%",accentColor:t.primary}})]},n)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:a,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:a,onChange:n=>{try{c(O(n.target.value)),l==null||l(n.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:de.map(n=>e.jsx("div",{onClick:()=>{d(O(n)),l==null||l(n)},style:{width:14,height:14,borderRadius:2,background:n,cursor:"pointer",border:a===n?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:p=>p.currentTarget.style.transform="scale(1.3)",onMouseLeave:p=>p.currentTarget.style.transform="scale(1)"},n))})]})}function j({items:r,onSelect:l,style:g}){const[o,d]=x.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...g},children:r.map((a,c)=>{var p,v;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},c);const n=o===c;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>d(c),onMouseLeave:()=>d(null),children:[e.jsxs("div",{onClick:()=>{var i;return!a.disabled&&!((i=a.items)!=null&&i.length)&&l(a)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:a.disabled?"not-allowed":"pointer",fontSize:13,color:a.disabled?t.textMut:t.text,background:n&&!a.disabled?t.bg:"transparent",opacity:a.disabled?.5:1},children:[a.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:a.icon}),e.jsx("span",{style:{flex:1},children:a.value||a.id}),a.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:a.hotkey}),(p=a.items)!=null&&p.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),n&&((v=a.items)!=null&&v.length)?e.jsx(j,{items:a.items,onSelect:l,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||c)})})}function ce({items:r=[],label:l="Menu",onSelect:g,style:o}){const[d,a]=x.useState(!1),c=x.useRef(null);return x.useEffect(L,[]),H(c,x.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:c,className:"dhx",style:{position:"relative",display:"inline-block",...o},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(n=>!n),children:[l," ",e.jsx("span",{style:{fontSize:10},children:d?"▲":"▼"})]}),d&&e.jsx(j,{items:r,onSelect:n=>{g==null||g(n),a(!1)}})]})}function pe({items:r=[],onSelect:l,children:g}){const[o,d]=x.useState(null),a=x.useRef(null);x.useEffect(L,[]),H(a,x.useCallback(()=>d(null),[]));const c=n=>{n.preventDefault(),d({x:n.clientX,y:n.clientY})};return e.jsxs("div",{ref:a,onContextMenu:c,style:{position:"relative",display:"contents"},children:[g,o&&e.jsx("div",{style:{position:"fixed",left:o.x,top:o.y,zIndex:9999},children:e.jsx(j,{items:r,onSelect:n=>{l==null||l(n),d(null)}})})]})}function he({trigger:r,children:l,placement:g="bottom-start",style:o}){const[d,a]=x.useState(!1),[c,n]=x.useState({top:"100%",left:0}),p=x.useRef(null),v=x.useRef(null);x.useEffect(L,[]),H(p,x.useCallback(()=>a(!1),[]));const i=()=>{a(u=>{if(!u&&v.current){const s=v.current.getBoundingClientRect(),y={"bottom-start":{top:s.height+4,left:0},"bottom-end":{top:s.height+4,right:0,left:"auto"},"top-start":{bottom:s.height+4,top:"auto",left:0}};n(y[g]||y["bottom-start"])}return!u})};return e.jsxs("div",{ref:p,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:v,onClick:i,children:r}),d&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...c,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...o},children:l})]})}function ue({title:r,children:l,width:g=480,height:o,closable:d=!0,movable:a=!0,modal:c=!1,defaultOpen:n=!0,footer:p,onClose:v,style:i}){const[u,s]=x.useState(n),[y,m]=x.useState({x:0,y:0});x.useEffect(L,[]);const M=X(x.useCallback((C,k)=>a&&m({x:C,y:k}),[a])),S=()=>{s(!1),v==null||v()};return u?e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:d?S:void 0}),e.jsxs("div",{className:"dhx",style:{position:c?"fixed":"absolute",left:c?"50%":`calc(50% + ${y.x}px)`,top:c?"50%":`calc(50% + ${y.y}px)`,transform:`translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`,width:g,...o?{height:o}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...i},children:[e.jsxs("div",{onMouseDown:C=>M(C,y.x,y.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:a?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),d&&e.jsx("button",{onClick:S,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:C=>C.currentTarget.style.background=t.border,onMouseLeave:C=>C.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,padding:20,overflowY:"auto"},children:l}),p&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:p})]})]}):null}const Y=x.createContext(null),fe={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},G={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function xe({children:r}){const[l,g]=x.useState([]);x.useEffect(L,[]);const o=x.useCallback(c=>g(n=>n.filter(p=>p.id!==c)),[]),d=x.useCallback(c=>{const n=Date.now();return g(p=>[...p,{id:n,...c}]),c.duration!==0&&setTimeout(()=>o(n),c.duration||4e3),n},[o]),a={message:d,alert:(c,n)=>d({type:"info",title:c,...n}),confirm:(c,n,p)=>d({type:"warning",title:c,confirm:n,...p})};return e.jsxs(Y.Provider,{value:a,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:l.map(c=>{const n=c.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${G[n]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:G[n],lineHeight:1},children:fe[n]}),e.jsxs("div",{style:{flex:1},children:[c.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:c.text?3:0},children:c.title}),c.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:c.text}),c.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{c.confirm(!0),o(c.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{c.confirm(!1),o(c.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>o(c.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},c.id)})})]})}function ge(){const r=x.useContext(Y);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function ye({data:r=[],template:l,keyNavigation:g=!0,multiselection:o=!1,editable:d=!1,height:a=400,onSelect:c,onEdit:n,style:p}){const[v,i]=x.useState(new Set),[u,s]=x.useState(null),[y,m]=x.useState(""),[M,S]=x.useState(null);x.useEffect(L,[]);const C=(h,f)=>{const $=h.id??f;i(D=>{const b=o?new Set(D):new Set;return b.has($)?b.delete($):b.add($),b}),S(f),c==null||c(h)},k=(h,f)=>{n==null||n({...h,value:y},f),s(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:a,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...p},tabIndex:0,onKeyDown:h=>{g&&(h.key==="ArrowDown"&&S(f=>Math.min((f??-1)+1,r.length-1)),h.key==="ArrowUp"&&S(f=>Math.max((f??1)-1,0)))},children:[r.map((h,f)=>{const $=h.id??f,D=v.has($),b=M===f;return e.jsx("div",{onClick:()=>C(h,f),onDoubleClick:()=>d&&(s(f),m(String(h.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:D?t.primaryLt:b?t.bg:t.surface,color:D?t.primary:t.text,outline:b?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:u===f?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:y,onChange:N=>m(N.target.value),onBlur:()=>k(h,f),onKeyDown:N=>{N.key==="Enter"&&k(h,f),N.key==="Escape"&&s(null)},onClick:N=>N.stopPropagation()}):l?e.jsx("div",{dangerouslySetInnerHTML:{__html:l(h)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(h.value??"")})},String($))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function be({data:r=[],template:l,itemsInRow:g=3,gap:o=12,multiselection:d=!1,onSelect:a,style:c}){const[n,p]=x.useState(new Set);x.useEffect(L,[]);const v=i=>{const u=i.id??String(i.title);p(s=>{const y=d?new Set(s):new Set;return y.has(u)?y.delete(u):y.add(u),y}),a==null||a(i)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${g}, 1fr)`,gap:o,padding:o,...c},children:r.map((i,u)=>{const s=i.id??u,y=n.has(s);return e.jsx("div",{onClick:()=>v(i),style:{background:t.surface,border:`2px solid ${y?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:y?`0 0 0 3px ${t.primary}33`:t.shadow,transform:y?"translateY(-2px)":"none"},onMouseEnter:m=>{m.currentTarget.style.boxShadow=t.shadowLg,m.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:m=>{m.currentTarget.style.boxShadow=y?`0 0 0 3px ${t.primary}33`:t.shadow,m.currentTarget.style.transform=y?"translateY(-2px)":"none"},children:l?e.jsx("div",{dangerouslySetInnerHTML:{__html:l(i)}}):e.jsxs("div",{style:{padding:16},children:[i.img&&e.jsx("img",{src:i.img,alt:i.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:i.title||i.value}),i.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:i.subtitle})]})},String(s))})})}function ve({data:r=[],checkbox:l=!1,editable:g=!1,onSelect:o,onCheck:d,style:a}){const[c,n]=x.useState({}),[p,v]=x.useState(null),[i,u]=x.useState({}),[s,y]=x.useState(null),[m,M]=x.useState("");x.useEffect(L,[]);const S=h=>n(f=>({...f,[h]:!f[h]})),C=(h,f)=>{u($=>({...$,[h]:f})),d==null||d(h,f)},k=(h,f=0)=>{var N;const $=(((N=h.items)==null?void 0:N.length)??0)>0,D=c[h.id],b=p===h.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{v(h.id),o==null||o(h),$&&S(h.id)},onDoubleClick:()=>{g&&(y(h.id),M(h.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+f*18}px`,cursor:"pointer",borderRadius:t.r,margin:"1px 4px",background:b?t.primaryLt:"transparent",color:b?t.primary:t.text,userSelect:"none",fontSize:13},onMouseEnter:w=>!b&&(w.currentTarget.style.background=t.bg),onMouseLeave:w=>!b&&(w.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},children:$?D?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:$?D?"📂":"📁":"📄"}),l&&e.jsx("input",{type:"checkbox",checked:!!i[h.id],onChange:w=>{w.stopPropagation(),C(h.id,w.target.checked)},style:{cursor:"pointer",accentColor:t.primary},onClick:w=>w.stopPropagation()}),s===h.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:m,onChange:w=>M(w.target.value),onBlur:()=>y(null),onKeyDown:w=>w.key==="Enter"&&y(null),onClick:w=>w.stopPropagation()}):e.jsx("span",{style:{flex:1},children:h.value}),h.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",h.count,")"]})]}),$&&D&&e.jsx("div",{children:h.items.map(w=>k(w,f+1))})]},h.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...a},children:r.map(h=>k(h))})}function Se({total:r,pageSize:l=10,page:g,onChange:o,style:d}){const[a,c]=x.useState(g||1),n=Math.ceil(r/l);x.useEffect(L,[]);const p=i=>{const u=Math.min(Math.max(1,i),n);c(u),o==null||o(u)},v=x.useMemo(()=>{const i=[];for(let s=Math.max(1,a-2);s<=Math.min(n,a+2);s++)i.push(s);return i[0]>1&&(i[0]>2&&i.unshift("..."),i.unshift(1)),i[i.length-1]<n&&(i[i.length-1]<n-1&&i.push("..."),i.push(n)),i},[a,n]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...d},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(a-1)*l+1,"–",Math.min(a*l,r)," of ",r]}),[["«",1],["‹",a-1]].map(([i,u])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===1,onClick:()=>p(u),children:i},i)),v.map((i,u)=>e.jsx("button",{onClick:()=>typeof i=="number"&&p(i),className:`dhx dhx-btn ${i===a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:i==="...",children:i},u)),[["›",a+1],["»",n]].map(([i,u])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===n,onClick:()=>p(u),children:i},i))]})}function ke({config:r={},defaultValues:l={},onSubmit:g,style:o}){const[d,a]=x.useState(l),[c,n]=x.useState({});x.useEffect(L,[]);const p=(s,y)=>{a(m=>({...m,[s]:y})),n(m=>({...m,[s]:null}))},v=()=>{const s={};return(r.rows||[]).flat().forEach(y=>{y&&typeof y=="object"&&"name"in y&&y.required&&!d[y.name]&&(s[y.name]=`${y.label||y.name} is required`)}),n(s),Object.keys(s).length===0},i=s=>{const y=d[s.name]??s.value??"",m=c[s.name];if(s.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:s.label}),(s.rows||[]).map(k=>i(k))]},s.name);const M={key:s.name,className:"dhx-form-group"},S=s.label&&e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4},children:[s.label,s.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]}),C=m&&e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:m});return!s.type||s.type==="input"?e.jsxs("div",{...M,children:[S,e.jsxs("div",{className:"dhx-input-wrap",children:[s.icon&&e.jsx("span",{className:"dhx-input-icon",children:s.icon}),e.jsx("input",{className:`dhx dhx-input${s.icon?" dhx-input--with-icon":""}`,style:{borderColor:m?t.danger:void 0},type:s.inputType||"text",placeholder:s.placeholder,value:y,onChange:k=>p(s.name,k.target.value),disabled:s.disabled})]}),s.helpMessage&&e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",s.helpMessage]}),C]}):s.type==="textarea"?e.jsxs("div",{...M,children:[S,e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:s.placeholder,value:y,onChange:k=>p(s.name,k.target.value)}),C]}):s.type==="select"?e.jsxs("div",{...M,children:[S,e.jsxs("select",{className:"dhx dhx-input",value:y,onChange:k=>p(s.name,k.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(s.options||[]).map(k=>e.jsx("option",{value:k.value,children:k.label||k.value},k.value))]}),C]}):s.type==="checkbox"?e.jsx("div",{...M,children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!y,onChange:k=>p(s.name,k.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:s.label})]})}):s.type==="radio"?e.jsxs("div",{...M,children:[S,e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap"},children:(s.options||[]).map(k=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:s.name,value:k.value,checked:y===k.value,onChange:()=>p(s.name,k.value),style:{accentColor:t.primary,cursor:"pointer"}}),k.label||k.value]},k.value))})]}):s.type==="slider"?e.jsx("div",{...M,children:e.jsx(V,{label:s.label,min:s.min,max:s.max,step:s.step,value:y||s.min,range:s.range,onChange:k=>p(s.name,k)})}):s.type==="combo"?e.jsxs("div",{...M,children:[e.jsx(_,{label:s.label,data:s.data||[],multiselection:s.multiselection,placeholder:s.placeholder||"Select...",value:y||(s.multiselection?[]:null),onChange:k=>p(s.name,k)}),C]}):s.type==="datepicker"?e.jsxs("div",{...M,children:[S,e.jsx("input",{type:"date",className:"dhx dhx-input",value:y,onChange:k=>p(s.name,k.target.value)}),C]}):s.type==="timepicker"?e.jsxs("div",{...M,children:[S,e.jsx("input",{type:"time",className:"dhx dhx-input",value:y,onChange:k=>p(s.name,k.target.value)})]}):s.type==="spacer"?e.jsx("div",{style:{height:s.height||16}},s.name):null},u=s=>s.map((y,m)=>Array.isArray(y)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:y.map(i)},m):i(y));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...o},children:[u(r.rows||[]),(r.buttons||g)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>v()&&(g==null?void 0:g(d)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{a(l),n({})},children:r.resetText||"Reset"})]})]})}function we({items:r=[],onAction:l,style:g}){x.useEffect(L,[]);const o=(d,a)=>{var p,v;if("type"in d&&(d.type==="separator"||d.type==="sep"))return e.jsx("div",{style:{width:1,background:t.border,margin:"8px 4px",alignSelf:"stretch"}},a);if("type"in d&&d.type==="input")return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"4px 6px",gap:4},children:[d.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:d.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:d.width||110,height:26,fontSize:12},placeholder:d.placeholder,defaultValue:d.value,onChange:i=>{var u;return(u=d.onChange)==null?void 0:u.call(d,i.target.value)}})]},a);if("type"in d&&d.type==="block"){const i=d;return e.jsxs("div",{style:{display:"flex",flexDirection:i.direction==="col"?"column":"row",alignItems:"center",gap:4,padding:"4px 8px",borderRight:`1px solid ${t.border}`,minHeight:64},children:[e.jsx("div",{style:{display:"flex",gap:2},children:(p=i.items)==null?void 0:p.map((u,s)=>o(u,s))}),i.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut,marginTop:2},children:i.label})]},a)}if("type"in d&&d.type==="selectButton"){const i=d;return e.jsx("select",{className:"dhx dhx-input",style:{height:28,fontSize:12,cursor:"pointer",margin:2},defaultValue:i.value,onChange:u=>{var s;return(s=i.onChange)==null?void 0:s.call(i,u.target.value)},children:(v=i.items)==null?void 0:v.map(u=>e.jsx("option",{value:u.value,children:u.value},u.value))},a)}const c=d,n=c.active;return e.jsxs("button",{title:c.tooltip,className:`dhx dhx-btn ${n?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{flexDirection:"column",minHeight:48,padding:"4px 8px",gap:4,fontSize:12},disabled:c.disabled,onClick:()=>{var i;(i=c.onClick)==null||i.call(c,c),c.id&&(l==null||l(c.id,c))},children:[c.icon&&e.jsx("span",{style:{fontSize:c.size==="large"?24:18},children:c.icon}),c.text&&e.jsx("span",{style:{fontSize:10,maxWidth:60,textAlign:"center",lineHeight:1.2,whiteSpace:"normal"},children:c.text})]},a)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"4px 0",overflowX:"auto",gap:0,...g},children:r.map(o)})}function Me({logo:r,items:l=[],vertical:g=!1,style:o}){const[d,a]=x.useState(null),c=x.useRef(null);x.useEffect(L,[]),H(c,x.useCallback(()=>a(null),[]));const n=(p,v)=>{var i;return p.type==="separator"?e.jsx("div",{style:{[g?"height":"width"]:1,background:"rgba(255,255,255,.25)",margin:g?"4px 8px":"0 6px",alignSelf:"stretch"}},v):p.type==="spacer"?e.jsx("div",{style:{flex:1}},v):p.type==="input"?e.jsx("input",{className:"dhx dhx-input",style:{width:p.width||200,height:28,margin:"0 4px"},placeholder:p.placeholder},v):p.type==="menuItem"&&((i=p.items)!=null&&i.length)?e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,color:"#fff"},onClick:()=>a(d===v?null:v),children:[p.icon&&e.jsx("span",{children:p.icon}),p.value," ",e.jsx("span",{style:{fontSize:9},children:"▼"})]}),d===v&&e.jsx(j,{items:p.items,onSelect:()=>a(null),style:{top:"100%"}})]},v):e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,gap:6,color:"#fff"},onClick:()=>{var u;return(u=p.onClick)==null?void 0:u.call(p)},children:[p.icon&&e.jsx("span",{style:{fontSize:16},children:p.icon}),p.value&&e.jsx("span",{style:{fontSize:13},children:p.value})]},v)};return e.jsxs("nav",{ref:c,className:"dhx",style:{display:"flex",flexDirection:g?"column":"row",alignItems:g?"stretch":"center",background:t.primary,padding:g?"12px 0":"0 12px",minHeight:g?void 0:48,gap:2,...o},children:[r&&e.jsx("div",{style:{color:"#fff",fontWeight:800,fontSize:16,padding:g?"8px 16px":"0 12px 0 4px",borderRight:g?"none":"1px solid rgba(255,255,255,.25)",marginRight:g?0:8},children:r}),l.map(n)]})}z.Button=Q,z.Calendar=le,z.Chart=ne,z.Colorpicker=ie,z.Combobox=_,z.ContextMenu=pe,z.DataView=be,z.Form=ke,z.Grid=re,z.Layout=K,z.List=ye,z.Menu=ce,z.MenuDropdown=j,z.MessageContext=Y,z.MessageProvider=xe,z.Navbar=Me,z.Pagination=Se,z.Popup=he,z.Ribbon=we,z.Sidebar=R,z.Slider=V,z.Tabbar=te,z.Timepicker=ae,z.Toolbar=Z,z.Tree=ve,z.Window=ue,z.tokens=t,z.useClickOutside=H,z.useDrag=X,z.useMessage=ge,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
42
+ //# sourceMappingURL=dhx-react-suite.umd.cjs.map