@wilow_app/design-system 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +5 -6
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6368,12 +6368,9 @@ const pr = {
|
|
|
6368
6368
|
]
|
|
6369
6369
|
}
|
|
6370
6370
|
), qe = (e) => {
|
|
6371
|
-
var s;
|
|
6372
6371
|
if (!e) return "--:--";
|
|
6373
|
-
const t =
|
|
6374
|
-
|
|
6375
|
-
const [n, r] = t.split(":").map(Number), o = n >= 12 ? "PM" : "AM";
|
|
6376
|
-
return `${n % 12 || 12}:${r.toString().padStart(2, "0")} ${o}`;
|
|
6372
|
+
const t = e.split("T")[1], [n, r] = t.split(":"), o = Number(n), i = o >= 12 ? "PM" : "AM";
|
|
6373
|
+
return `${o % 12 || 12}:${r} ${i}`;
|
|
6377
6374
|
}, Ut = (e) => typeof e == "object" && (e != null && e.name) ? e.name : e, je = (e) => {
|
|
6378
6375
|
var t;
|
|
6379
6376
|
return e ? typeof e == "string" ? e.toLowerCase() === "completed" : ((t = e == null ? void 0 : e.code) == null ? void 0 : t.toLowerCase()) === "completed" : !1;
|
|
@@ -6540,6 +6537,7 @@ const pr = {
|
|
|
6540
6537
|
onClick: () => {
|
|
6541
6538
|
a && p((m) => !m);
|
|
6542
6539
|
},
|
|
6540
|
+
style: O.expandButton,
|
|
6543
6541
|
children: a && /* @__PURE__ */ C(Cd, {})
|
|
6544
6542
|
}
|
|
6545
6543
|
),
|
|
@@ -6684,7 +6682,8 @@ const pr = {
|
|
|
6684
6682
|
border: "1px solid #f3f4f6",
|
|
6685
6683
|
borderRadius: "12px",
|
|
6686
6684
|
padding: "16px",
|
|
6687
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.1)"
|
|
6685
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
|
|
6686
|
+
position: "relative"
|
|
6688
6687
|
},
|
|
6689
6688
|
cardHeader: {
|
|
6690
6689
|
display: "flex",
|
package/dist/index.umd.js
CHANGED
|
@@ -181,4 +181,4 @@ ${hn.current.stack}
|
|
|
181
181
|
|
|
182
182
|
Please be sure to add the {provided.placeholder} React Node as a child of your Droppable.
|
|
183
183
|
More information: https://github.com/hello-pangea/dnd/blob/main/docs/api/droppable.md
|
|
184
|
-
`)}],id=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?f(!1,"Must provide a clone render function (renderClone) for virtual lists"):f())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?f(!1,"Expected virtual list to not have a placeholder"):f())}];function sd(e){Te(()=>{ln(e,rd),e.props.mode==="standard"&&ln(e,od),e.props.mode==="virtual"&&ln(e,id)})}class cd extends D.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const ad=e=>{const t=D.useContext(Ke);t||(process.env.NODE_ENV!=="production"?f(!1,"Could not find app context"):f());const{contextId:n,isMovementAllowed:r}=t,o=D.useRef(null),i=D.useRef(null),{children:s,droppableId:c,type:a,mode:d,direction:p,ignoreContainerClipping:l,isDropDisabled:u,isCombineEnabled:g,snapshot:h,useClone:b,updateViewportMaxScroll:m,getContainerForClone:E}=e,y=x(()=>o.current,[]),S=x((L=null)=>{o.current=L},[]),I=x(()=>i.current,[]),N=x((L=null)=>{i.current=L},[]);sd({props:e,getDroppableRef:y,getPlaceholderRef:I});const C=x(()=>{r()&&m({maxScroll:Wr()})},[r,m]);Zl({droppableId:c,type:a,mode:d,direction:p,isDropDisabled:u,isCombineEnabled:g,ignoreContainerClipping:l,getDroppableRef:y});const A=w(()=>D.createElement(cd,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:L,data:J,animate:fe})=>D.createElement(nd,{placeholder:J,onClose:L,innerRef:N,animate:fe,contextId:n,onTransitionEnd:C})),[n,C,e.placeholder,e.shouldAnimatePlaceholder,N]),T=w(()=>({innerRef:S,placeholder:A,droppableProps:{"data-rfd-droppable-id":c,"data-rfd-droppable-context-id":n}}),[n,c,A,S]),H=b?b.dragging.draggableId:null,V=w(()=>({droppableId:c,type:a,isUsingCloneFor:H}),[c,H,a]);function z(){if(!b)return null;const{dragging:L,render:J}=b,fe=D.createElement(bo,{draggableId:L.draggableId,index:L.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Z,rt)=>J(Z,rt,L));return it.createPortal(fe,E())}return D.createElement(nn.Provider,{value:V},s(T,h),z())};function ld(){return document.body||(process.env.NODE_ENV!=="production"?f(!1,"document.body is not ready"):f()),document.body}const xo={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:ld},Io=e=>{let t={...e},n;for(n in xo)e[n]===void 0&&(t={...t,[n]:xo[n]});return t},dn=(e,t)=>e===t.droppable.type,Co=(e,t)=>t.draggables[e.draggable.id],dd=qn(()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=M(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=M((i,s,c,a,d,p)=>{const l=d.descriptor.id;if(d.descriptor.droppableId===i){const h=p?{render:p,dragging:n(d.descriptor)}:null,b={isDraggingOver:c,draggingOverWith:c?l:null,draggingFromThisWith:l,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!1,snapshot:b,useClone:h}}if(!s)return t;if(!a)return e;const g={isDraggingOver:c,draggingOverWith:l,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!0,snapshot:g,useClone:null}});return(i,s)=>{const c=Io(s),a=c.droppableId,d=c.type,p=!c.isDropDisabled,l=c.renderClone;if(Be(i)){const u=i.critical;if(!dn(d,u))return t;const g=Co(u,i.dimensions),h=W(i.impact)===a;return r(a,p,h,h,g,l)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(!dn(d,u.critical))return t;const g=Co(u.critical,i.dimensions);return r(a,p,mo(u.result)===a,W(u.impact)===a,g,l)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const u=i.completed;if(!dn(d,u.critical))return t;const g=W(u.impact)===a,h=!!(u.impact.at&&u.impact.at.type==="COMBINE"),b=u.critical.droppable.id===a;return g?h?e:t:b?e:t}return t}},{updateViewportMaxScroll:cc},(e,t,n)=>({...Io(n),...e,...t}),{context:Xt,areStatePropsEqual:go})(ad),ud=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[v.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),v.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),So=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[v.jsx("circle",{cx:"12",cy:"12",r:"10"}),v.jsx("polyline",{points:"12 6 12 12 16 14"})]}),pd=()=>v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{cursor:"grab"},children:[v.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),v.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),v.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),fd=()=>v.jsx("svg",{width:"25",height:"25",viewBox:"0 0 90 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsxs("g",{children:[v.jsx("polygon",{points:"37.95,64.44 23.78,50.27 30.85,43.2 37.95,50.3 59.15,29.1 66.22,36.17",fill:"#009E04"}),v.jsx("path",{d:"M45 90C20.187 90 0 69.813 0 45C0 20.187 20.187 0 45 0C69.813 0 90 20.187 90 45C90 69.813 69.813 90 45 90ZM45 10C25.701 10 10 25.701 10 45C10 64.299 25.701 80 45 80C64.299 80 80 64.299 80 45C80 25.701 64.299 10 45 10Z",fill:"#009E04",strokeLinecap:"round"})]})}),gd=()=>v.jsxs("svg",{width:"25",height:"25",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("polyline",{points:"15 3 21 3 21 9"}),v.jsx("polyline",{points:"9 21 3 21 3 15"}),v.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),v.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),md=()=>v.jsxs("svg",{width:"25",height:"25",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("polyline",{points:"4 14 10 14 10 20"}),v.jsx("polyline",{points:"20 10 14 10 14 4"}),v.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),v.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),tt=e=>{var s;if(!e)return"--:--";const t=(s=e.split("T")[1])==null?void 0:s.slice(0,5);if(!t)return"--:--";const[n,r]=t.split(":").map(Number),o=n>=12?"PM":"AM";return`${n%12||12}:${r.toString().padStart(2,"0")} ${o}`},un=e=>typeof e=="object"&&(e!=null&&e.name)?e.name:e,nt=e=>{var t;return e?typeof e=="string"?e.toLowerCase()==="completed":((t=e==null?void 0:e.code)==null?void 0:t.toLowerCase())==="completed":!1},hd=e=>{const t=[];return[...e].sort((r,o)=>r.sequence_rank-o.sequence_rank).forEach(r=>{const o=t[t.length-1];o&&o.stop_id===r.stop_id?o.orders.push(r):t.push({stop_id:r.stop_id,sequence_rank:r.sequence_rank,orders:[r]})}),t},bd=({order:e,pathPeriod:t,isFirst:n,isDone:r,renderOrderExtraData:o})=>{var a,d,p,l,u,g;const[i,s]=D.useState(!1),c=(d=(a=e.customer)==null?void 0:a.address)!=null&&d.lat&&((l=(p=e.customer)==null?void 0:p.address)!=null&&l.long)?`https://maps.google.com/?q=${e.customer.address.lat},${e.customer.address.long}`:"#";return v.jsxs("div",{style:{...O.orderBlock,borderTop:n?"none":"1px solid #f3f4f6",backgroundColor:r?"#fafafa":"transparent"},children:[v.jsxs("div",{style:O.orderHeader,children:[v.jsxs("div",{style:O.gridItem,children:[v.jsxs("div",{style:O.gridLabel,children:["ORDER"," ",r&&v.jsx("span",{style:{color:"#16a34a",marginLeft:"4px"},children:"✓ DONE"})]}),v.jsxs("div",{style:O.gridValue,children:["#",e.order_id]})]}),o&&v.jsx("button",{onClick:()=>s(!i),style:O.expandButton,children:i?v.jsx(md,{}):v.jsx(gd,{})})]}),v.jsxs("div",{style:O.detailsGrid,children:[v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"LOCATION"}),v.jsxs("div",{style:O.gridValueWithIcon,children:[v.jsx(ud,{}),v.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:O.addressLink,children:((g=(u=e.customer)==null?void 0:u.address)==null?void 0:g.street_area)||"N/A"})]})]}),v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"PERIOD"}),v.jsx("div",{style:O.gridValue,children:t})]}),v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"TIME WINDOW"}),v.jsxs("div",{style:O.gridValueWithIcon,children:[v.jsx(So,{})," ",v.jsxs("span",{style:O.direction,children:[tt(e.eta_start)," - ",tt(e.eta_end)]})]})]}),e.completed_at&&v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"COMPLETED AT"}),v.jsxs("div",{style:O.gridValueWithIcon,children:[v.jsx(So,{})," ",v.jsx("span",{style:O.direction,children:tt(e.completed_at)})]})]})]}),i&&o&&v.jsx("div",{style:O.extraDataContainer,children:o(e)})]})},vd=({stopGroup:e,index:t,pathType:n,pathPeriod:r,canEditPath:o,isPathCompleted:i,renderStopActions:s,renderOrderExtraData:c})=>{const a=e.status?nt(e.status):e.orders.every(g=>nt(g.status)),[d,p]=D.useState(!a),l=e.status?un(e.status):a?"Completed":"Pending",u=!o||i||a;return v.jsx(Gl,{draggableId:e.stop_id.toString(),index:t,isDragDisabled:u,children:g=>{var h,b;return v.jsxs("div",{ref:g.innerRef,...g.draggableProps,style:{...O.timelineItem,...g.draggableProps.style},children:[v.jsx("div",{style:{...O.bubble,...a?O.bubbleCompleted:O.bubblePending},children:t+1}),v.jsxs("div",{style:O.card,children:[v.jsxs("div",{style:O.cardHeader,children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[v.jsxs("span",{style:O.title,children:[n," #",e.sequence_rank]}),v.jsx("span",{style:a?O.badgeCompleted:O.badgePending,children:l}),e.completed_at&&v.jsxs("span",{style:{fontSize:"12px",color:"#6b7280"},children:["(",tt(e.completed_at),")"]})]}),v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[v.jsx("button",{onClick:()=>{a&&p(m=>!m)},children:a&&v.jsx(fd,{})}),!u&&v.jsx("div",{...g.dragHandleProps,children:v.jsx(pd,{})})]})]}),d&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{style:O.customerName,children:["Customer: ",(b=(h=e.orders[0])==null?void 0:h.customer)==null?void 0:b.name]}),v.jsx("div",{style:O.ordersList,children:e.orders.map((m,E)=>v.jsx(bd,{order:m,pathPeriod:r,isFirst:E===0,isDone:nt(m.status),renderOrderExtraData:c},m.id))}),s&&v.jsx("div",{style:O.actionsSlot,children:s(e)})]})]})]})}})},yd=({path:e,onReorder:t,renderStopActions:n,renderOrderExtraData:r,canEditPath:o=!0})=>{const[i,s]=D.useState([]);D.useEffect(()=>{if(e)if(e.stops&&e.stops.length>0){const d=e.stops.map(p=>({stop_id:p.id,sequence_rank:p.sequence_rank,status:p.status,completed_at:p.completed_at,orders:(e.path_orders||[]).filter(l=>l.stop_id===p.id).sort((l,u)=>l.sequence_rank-u.sequence_rank)})).sort((p,l)=>p.sequence_rank-l.sequence_rank);s(d)}else e.path_orders&&s(hd(e.path_orders))},[e]);const c=d=>{if(!d.destination)return;const p=Array.from(i),[l]=p.splice(d.source.index,1);p.splice(d.destination.index,0,l),s(p),t&&t(e.id,p.map(u=>u.stop_id))};if(!e||!i.length)return v.jsx("div",{children:"No Path Data"});const a=nt(e.status);return v.jsx("div",{style:O.container,children:v.jsx(El,{onDragEnd:c,children:v.jsx(dd,{droppableId:"path-list",children:d=>v.jsxs("div",{ref:d.innerRef,...d.droppableProps,style:O.timelineWrapper,children:[v.jsx("div",{style:O.verticalLine}),v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:i.map((p,l)=>v.jsx(vd,{stopGroup:p,index:l,pathType:un(e.type),pathPeriod:un(e.period),canEditPath:o,isPathCompleted:a,renderStopActions:n,renderOrderExtraData:r},p.stop_id))}),d.placeholder]})})})})},O={container:{fontFamily:"sans-serif",maxWidth:"800px",margin:"0 auto"},timelineWrapper:{position:"relative",padding:"20px 0"},verticalLine:{position:"absolute",right:"19px",top:"40px",bottom:"40px",width:"2px",backgroundColor:"#f3f4f6"},direction:{direction:"ltr"},timelineItem:{display:"flex",gap:"16px",marginBottom:"24px",position:"relative",zIndex:1},bubble:{width:"40px",height:"40px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",backgroundColor:"#fff",border:"2px solid",flexShrink:0},bubblePending:{borderColor:"#f3f4f6",color:"#9ca3af"},bubbleCompleted:{borderColor:"#dcfce7",color:"#16a34a",backgroundColor:"#f0fdf4"},card:{flex:1,backgroundColor:"#fff",border:"1px solid #f3f4f6",borderRadius:"12px",padding:"16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},cardHeader:{display:"flex",justifyContent:"space-between",marginBottom:"8px",alignItems:"center"},title:{fontSize:"16px",fontWeight:"bold"},badgePending:{fontSize:"11px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#f3f4f6",color:"#4b5563",fontWeight:"600"},badgeCompleted:{fontSize:"11px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#dcfce7",color:"#16a34a",fontWeight:"600"},customerName:{fontSize:"14px",color:"#6b7280",marginBottom:"12px"},ordersList:{backgroundColor:"#f9fafb",borderRadius:"8px",overflow:"hidden"},orderBlock:{padding:"12px",transition:"background-color 0.2s"},orderHeader:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},detailsGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},gridItem:{display:"flex",flexDirection:"column"},gridLabel:{fontSize:"10px",color:"#9ca3af",fontWeight:"bold"},gridValue:{fontSize:"13px",fontWeight:"600"},gridValueWithIcon:{fontSize:"13px",display:"flex",alignItems:"flex-start",gap:"4px",color:"#374151"},addressLink:{color:"#3b82f6",textDecoration:"underline",wordBreak:"break-word",lineHeight:"1.4"},expandButton:{color:"#fff",border:"none",cursor:"pointer",backgroundColor:"#d1d1d1",borderRadius:"5px",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center"},extraDataContainer:{marginTop:"12px",padding:"12px",borderTop:"1px dashed #e5e7eb",backgroundColor:"#fff",borderRadius:"4px"},actionsSlot:{marginTop:"16px"}};Q.LogisticsDashboard=yd,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
|
|
184
|
+
`)}],id=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?f(!1,"Must provide a clone render function (renderClone) for virtual lists"):f())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?f(!1,"Expected virtual list to not have a placeholder"):f())}];function sd(e){Te(()=>{ln(e,rd),e.props.mode==="standard"&&ln(e,od),e.props.mode==="virtual"&&ln(e,id)})}class cd extends D.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const ad=e=>{const t=D.useContext(Ke);t||(process.env.NODE_ENV!=="production"?f(!1,"Could not find app context"):f());const{contextId:n,isMovementAllowed:r}=t,o=D.useRef(null),i=D.useRef(null),{children:s,droppableId:c,type:a,mode:d,direction:p,ignoreContainerClipping:l,isDropDisabled:u,isCombineEnabled:g,snapshot:h,useClone:b,updateViewportMaxScroll:m,getContainerForClone:E}=e,y=x(()=>o.current,[]),S=x((L=null)=>{o.current=L},[]),I=x(()=>i.current,[]),N=x((L=null)=>{i.current=L},[]);sd({props:e,getDroppableRef:y,getPlaceholderRef:I});const C=x(()=>{r()&&m({maxScroll:Wr()})},[r,m]);Zl({droppableId:c,type:a,mode:d,direction:p,isDropDisabled:u,isCombineEnabled:g,ignoreContainerClipping:l,getDroppableRef:y});const A=w(()=>D.createElement(cd,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:L,data:J,animate:fe})=>D.createElement(nd,{placeholder:J,onClose:L,innerRef:N,animate:fe,contextId:n,onTransitionEnd:C})),[n,C,e.placeholder,e.shouldAnimatePlaceholder,N]),T=w(()=>({innerRef:S,placeholder:A,droppableProps:{"data-rfd-droppable-id":c,"data-rfd-droppable-context-id":n}}),[n,c,A,S]),H=b?b.dragging.draggableId:null,V=w(()=>({droppableId:c,type:a,isUsingCloneFor:H}),[c,H,a]);function z(){if(!b)return null;const{dragging:L,render:J}=b,fe=D.createElement(bo,{draggableId:L.draggableId,index:L.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Z,rt)=>J(Z,rt,L));return it.createPortal(fe,E())}return D.createElement(nn.Provider,{value:V},s(T,h),z())};function ld(){return document.body||(process.env.NODE_ENV!=="production"?f(!1,"document.body is not ready"):f()),document.body}const xo={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:ld},Io=e=>{let t={...e},n;for(n in xo)e[n]===void 0&&(t={...t,[n]:xo[n]});return t},dn=(e,t)=>e===t.droppable.type,Co=(e,t)=>t.draggables[e.draggable.id],dd=qn(()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=M(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=M((i,s,c,a,d,p)=>{const l=d.descriptor.id;if(d.descriptor.droppableId===i){const h=p?{render:p,dragging:n(d.descriptor)}:null,b={isDraggingOver:c,draggingOverWith:c?l:null,draggingFromThisWith:l,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!1,snapshot:b,useClone:h}}if(!s)return t;if(!a)return e;const g={isDraggingOver:c,draggingOverWith:l,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!0,snapshot:g,useClone:null}});return(i,s)=>{const c=Io(s),a=c.droppableId,d=c.type,p=!c.isDropDisabled,l=c.renderClone;if(Be(i)){const u=i.critical;if(!dn(d,u))return t;const g=Co(u,i.dimensions),h=W(i.impact)===a;return r(a,p,h,h,g,l)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(!dn(d,u.critical))return t;const g=Co(u.critical,i.dimensions);return r(a,p,mo(u.result)===a,W(u.impact)===a,g,l)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const u=i.completed;if(!dn(d,u.critical))return t;const g=W(u.impact)===a,h=!!(u.impact.at&&u.impact.at.type==="COMBINE"),b=u.critical.droppable.id===a;return g?h?e:t:b?e:t}return t}},{updateViewportMaxScroll:cc},(e,t,n)=>({...Io(n),...e,...t}),{context:Xt,areStatePropsEqual:go})(ad),ud=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[v.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),v.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),So=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[v.jsx("circle",{cx:"12",cy:"12",r:"10"}),v.jsx("polyline",{points:"12 6 12 12 16 14"})]}),pd=()=>v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{cursor:"grab"},children:[v.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),v.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),v.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),fd=()=>v.jsx("svg",{width:"25",height:"25",viewBox:"0 0 90 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsxs("g",{children:[v.jsx("polygon",{points:"37.95,64.44 23.78,50.27 30.85,43.2 37.95,50.3 59.15,29.1 66.22,36.17",fill:"#009E04"}),v.jsx("path",{d:"M45 90C20.187 90 0 69.813 0 45C0 20.187 20.187 0 45 0C69.813 0 90 20.187 90 45C90 69.813 69.813 90 45 90ZM45 10C25.701 10 10 25.701 10 45C10 64.299 25.701 80 45 80C64.299 80 80 64.299 80 45C80 25.701 64.299 10 45 10Z",fill:"#009E04",strokeLinecap:"round"})]})}),gd=()=>v.jsxs("svg",{width:"25",height:"25",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("polyline",{points:"15 3 21 3 21 9"}),v.jsx("polyline",{points:"9 21 3 21 3 15"}),v.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),v.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),md=()=>v.jsxs("svg",{width:"25",height:"25",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("polyline",{points:"4 14 10 14 10 20"}),v.jsx("polyline",{points:"20 10 14 10 14 4"}),v.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),v.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),tt=e=>{if(!e)return"--:--";const t=e.split("T")[1],[n,r]=t.split(":"),o=Number(n),i=o>=12?"PM":"AM";return`${o%12||12}:${r} ${i}`},un=e=>typeof e=="object"&&(e!=null&&e.name)?e.name:e,nt=e=>{var t;return e?typeof e=="string"?e.toLowerCase()==="completed":((t=e==null?void 0:e.code)==null?void 0:t.toLowerCase())==="completed":!1},hd=e=>{const t=[];return[...e].sort((r,o)=>r.sequence_rank-o.sequence_rank).forEach(r=>{const o=t[t.length-1];o&&o.stop_id===r.stop_id?o.orders.push(r):t.push({stop_id:r.stop_id,sequence_rank:r.sequence_rank,orders:[r]})}),t},bd=({order:e,pathPeriod:t,isFirst:n,isDone:r,renderOrderExtraData:o})=>{var a,d,p,l,u,g;const[i,s]=D.useState(!1),c=(d=(a=e.customer)==null?void 0:a.address)!=null&&d.lat&&((l=(p=e.customer)==null?void 0:p.address)!=null&&l.long)?`https://maps.google.com/?q=${e.customer.address.lat},${e.customer.address.long}`:"#";return v.jsxs("div",{style:{...O.orderBlock,borderTop:n?"none":"1px solid #f3f4f6",backgroundColor:r?"#fafafa":"transparent"},children:[v.jsxs("div",{style:O.orderHeader,children:[v.jsxs("div",{style:O.gridItem,children:[v.jsxs("div",{style:O.gridLabel,children:["ORDER"," ",r&&v.jsx("span",{style:{color:"#16a34a",marginLeft:"4px"},children:"✓ DONE"})]}),v.jsxs("div",{style:O.gridValue,children:["#",e.order_id]})]}),o&&v.jsx("button",{onClick:()=>s(!i),style:O.expandButton,children:i?v.jsx(md,{}):v.jsx(gd,{})})]}),v.jsxs("div",{style:O.detailsGrid,children:[v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"LOCATION"}),v.jsxs("div",{style:O.gridValueWithIcon,children:[v.jsx(ud,{}),v.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:O.addressLink,children:((g=(u=e.customer)==null?void 0:u.address)==null?void 0:g.street_area)||"N/A"})]})]}),v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"PERIOD"}),v.jsx("div",{style:O.gridValue,children:t})]}),v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"TIME WINDOW"}),v.jsxs("div",{style:O.gridValueWithIcon,children:[v.jsx(So,{})," ",v.jsxs("span",{style:O.direction,children:[tt(e.eta_start)," - ",tt(e.eta_end)]})]})]}),e.completed_at&&v.jsxs("div",{style:O.gridItem,children:[v.jsx("div",{style:O.gridLabel,children:"COMPLETED AT"}),v.jsxs("div",{style:O.gridValueWithIcon,children:[v.jsx(So,{})," ",v.jsx("span",{style:O.direction,children:tt(e.completed_at)})]})]})]}),i&&o&&v.jsx("div",{style:O.extraDataContainer,children:o(e)})]})},vd=({stopGroup:e,index:t,pathType:n,pathPeriod:r,canEditPath:o,isPathCompleted:i,renderStopActions:s,renderOrderExtraData:c})=>{const a=e.status?nt(e.status):e.orders.every(g=>nt(g.status)),[d,p]=D.useState(!a),l=e.status?un(e.status):a?"Completed":"Pending",u=!o||i||a;return v.jsx(Gl,{draggableId:e.stop_id.toString(),index:t,isDragDisabled:u,children:g=>{var h,b;return v.jsxs("div",{ref:g.innerRef,...g.draggableProps,style:{...O.timelineItem,...g.draggableProps.style},children:[v.jsx("div",{style:{...O.bubble,...a?O.bubbleCompleted:O.bubblePending},children:t+1}),v.jsxs("div",{style:O.card,children:[v.jsxs("div",{style:O.cardHeader,children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[v.jsxs("span",{style:O.title,children:[n," #",e.sequence_rank]}),v.jsx("span",{style:a?O.badgeCompleted:O.badgePending,children:l}),e.completed_at&&v.jsxs("span",{style:{fontSize:"12px",color:"#6b7280"},children:["(",tt(e.completed_at),")"]})]}),v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[v.jsx("button",{onClick:()=>{a&&p(m=>!m)},style:O.expandButton,children:a&&v.jsx(fd,{})}),!u&&v.jsx("div",{...g.dragHandleProps,children:v.jsx(pd,{})})]})]}),d&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{style:O.customerName,children:["Customer: ",(b=(h=e.orders[0])==null?void 0:h.customer)==null?void 0:b.name]}),v.jsx("div",{style:O.ordersList,children:e.orders.map((m,E)=>v.jsx(bd,{order:m,pathPeriod:r,isFirst:E===0,isDone:nt(m.status),renderOrderExtraData:c},m.id))}),s&&v.jsx("div",{style:O.actionsSlot,children:s(e)})]})]})]})}})},yd=({path:e,onReorder:t,renderStopActions:n,renderOrderExtraData:r,canEditPath:o=!0})=>{const[i,s]=D.useState([]);D.useEffect(()=>{if(e)if(e.stops&&e.stops.length>0){const d=e.stops.map(p=>({stop_id:p.id,sequence_rank:p.sequence_rank,status:p.status,completed_at:p.completed_at,orders:(e.path_orders||[]).filter(l=>l.stop_id===p.id).sort((l,u)=>l.sequence_rank-u.sequence_rank)})).sort((p,l)=>p.sequence_rank-l.sequence_rank);s(d)}else e.path_orders&&s(hd(e.path_orders))},[e]);const c=d=>{if(!d.destination)return;const p=Array.from(i),[l]=p.splice(d.source.index,1);p.splice(d.destination.index,0,l),s(p),t&&t(e.id,p.map(u=>u.stop_id))};if(!e||!i.length)return v.jsx("div",{children:"No Path Data"});const a=nt(e.status);return v.jsx("div",{style:O.container,children:v.jsx(El,{onDragEnd:c,children:v.jsx(dd,{droppableId:"path-list",children:d=>v.jsxs("div",{ref:d.innerRef,...d.droppableProps,style:O.timelineWrapper,children:[v.jsx("div",{style:O.verticalLine}),v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:i.map((p,l)=>v.jsx(vd,{stopGroup:p,index:l,pathType:un(e.type),pathPeriod:un(e.period),canEditPath:o,isPathCompleted:a,renderStopActions:n,renderOrderExtraData:r},p.stop_id))}),d.placeholder]})})})})},O={container:{fontFamily:"sans-serif",maxWidth:"800px",margin:"0 auto"},timelineWrapper:{position:"relative",padding:"20px 0"},verticalLine:{position:"absolute",right:"19px",top:"40px",bottom:"40px",width:"2px",backgroundColor:"#f3f4f6"},direction:{direction:"ltr"},timelineItem:{display:"flex",gap:"16px",marginBottom:"24px",position:"relative",zIndex:1},bubble:{width:"40px",height:"40px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",backgroundColor:"#fff",border:"2px solid",flexShrink:0},bubblePending:{borderColor:"#f3f4f6",color:"#9ca3af"},bubbleCompleted:{borderColor:"#dcfce7",color:"#16a34a",backgroundColor:"#f0fdf4"},card:{flex:1,backgroundColor:"#fff",border:"1px solid #f3f4f6",borderRadius:"12px",padding:"16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",position:"relative"},cardHeader:{display:"flex",justifyContent:"space-between",marginBottom:"8px",alignItems:"center"},title:{fontSize:"16px",fontWeight:"bold"},badgePending:{fontSize:"11px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#f3f4f6",color:"#4b5563",fontWeight:"600"},badgeCompleted:{fontSize:"11px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#dcfce7",color:"#16a34a",fontWeight:"600"},customerName:{fontSize:"14px",color:"#6b7280",marginBottom:"12px"},ordersList:{backgroundColor:"#f9fafb",borderRadius:"8px",overflow:"hidden"},orderBlock:{padding:"12px",transition:"background-color 0.2s"},orderHeader:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},detailsGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},gridItem:{display:"flex",flexDirection:"column"},gridLabel:{fontSize:"10px",color:"#9ca3af",fontWeight:"bold"},gridValue:{fontSize:"13px",fontWeight:"600"},gridValueWithIcon:{fontSize:"13px",display:"flex",alignItems:"flex-start",gap:"4px",color:"#374151"},addressLink:{color:"#3b82f6",textDecoration:"underline",wordBreak:"break-word",lineHeight:"1.4"},expandButton:{color:"#fff",border:"none",cursor:"pointer",backgroundColor:"#d1d1d1",borderRadius:"5px",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center"},extraDataContainer:{marginTop:"12px",padding:"12px",borderTop:"1px dashed #e5e7eb",backgroundColor:"#fff",borderRadius:"4px"},actionsSlot:{marginTop:"16px"}};Q.LogisticsDashboard=yd,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
|