@wilow_app/design-system 0.0.7 → 0.0.8

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 CHANGED
@@ -6326,8 +6326,8 @@ const lr = {
6326
6326
  ), Od = () => /* @__PURE__ */ V(
6327
6327
  "svg",
6328
6328
  {
6329
- width: "16",
6330
- height: "16",
6329
+ width: "25",
6330
+ height: "25",
6331
6331
  viewBox: "0 0 24 24",
6332
6332
  fill: "none",
6333
6333
  stroke: "currentColor",
@@ -6341,11 +6341,14 @@ const lr = {
6341
6341
  /* @__PURE__ */ O("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
6342
6342
  ]
6343
6343
  }
6344
- ), ur = (e) => e ? new Date(e).toLocaleTimeString("en-US", {
6345
- hour: "numeric",
6346
- minute: "2-digit",
6347
- hour12: !0
6348
- }) : "--:--", pr = (e) => typeof e == "object" && (e != null && e.name) ? e.name : e, fr = (e) => {
6344
+ ), ur = (e) => {
6345
+ var s;
6346
+ if (!e) return "--:--";
6347
+ const t = (s = e.split("T")[1]) == null ? void 0 : s.slice(0, 5);
6348
+ if (!t) return "--:--";
6349
+ const [n, r] = t.split(":").map(Number), o = n >= 12 ? "PM" : "AM";
6350
+ return `${n % 12 || 12}:${r.toString().padStart(2, "0")} ${o}`;
6351
+ }, pr = (e) => typeof e == "object" && (e != null && e.name) ? e.name : e, fr = (e) => {
6349
6352
  var t, n;
6350
6353
  return typeof e.status == "string" ? e.status.toLowerCase() === "completed" : ((n = (t = e.status) == null ? void 0 : t.code) == null ? void 0 : n.toLowerCase()) === "completed";
6351
6354
  }, Cd = (e) => {
@@ -6672,7 +6675,8 @@ const lr = {
6672
6675
  background: "none",
6673
6676
  border: "none",
6674
6677
  cursor: "pointer",
6675
- color: "#6b7280",
6678
+ color: " #d1d1d1",
6679
+ borderRadius: "5px",
6676
6680
  padding: "4px"
6677
6681
  },
6678
6682
  extraDataContainer: {
package/dist/index.umd.js CHANGED
@@ -181,4 +181,4 @@ ${fn.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
- `)}],od=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?g(!1,"Must provide a clone render function (renderClone) for virtual lists"):g())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?g(!1,"Expected virtual list to not have a placeholder"):g())}];function id(e){Te(()=>{cn(e,nd),e.props.mode==="standard"&&cn(e,rd),e.props.mode==="virtual"&&cn(e,od)})}class sd 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 cd=e=>{const t=D.useContext(Ke);t||(process.env.NODE_ENV!=="production"?g(!1,"Could not find app context"):g());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:f,snapshot:m,useClone:b,updateViewportMaxScroll:h,getContainerForClone:E}=e,v=x(()=>o.current,[]),C=x((L=null)=>{o.current=L},[]),I=x(()=>i.current,[]),N=x((L=null)=>{i.current=L},[]);id({props:e,getDroppableRef:v,getPlaceholderRef:I});const O=x(()=>{r()&&h({maxScroll:Gr()})},[r,h]);Jl({droppableId:c,type:a,mode:d,direction:p,isDropDisabled:u,isCombineEnabled:f,ignoreContainerClipping:l,getDroppableRef:v});const _=S(()=>D.createElement(sd,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:L,data:J,animate:fe})=>D.createElement(td,{placeholder:J,onClose:L,innerRef:N,animate:fe,contextId:n,onTransitionEnd:O})),[n,O,e.placeholder,e.shouldAnimatePlaceholder,N]),T=S(()=>({innerRef:C,placeholder:_,droppableProps:{"data-rfd-droppable-id":c,"data-rfd-droppable-context-id":n}}),[n,c,_,C]),H=b?b.dragging.draggableId:null,V=S(()=>({droppableId:c,type:a,isUsingCloneFor:H}),[c,H,a]);function j(){if(!b)return null;const{dragging:L,render:J}=b,fe=D.createElement(go,{draggableId:L.draggableId,index:L.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Z,tt)=>J(Z,tt,L));return rt.createPortal(fe,E())}return D.createElement(en.Provider,{value:V},s(T,m),j())};function ad(){return document.body||(process.env.NODE_ENV!=="production"?g(!1,"document.body is not ready"):g()),document.body}const Eo={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:ad},Do=e=>{let t={...e},n;for(n in Eo)e[n]===void 0&&(t={...t,[n]:Eo[n]});return t},an=(e,t)=>e===t.droppable.type,No=(e,t)=>t.draggables[e.draggable.id],ld=Un(()=>{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 m=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:m}}if(!s)return t;if(!a)return e;const f={isDraggingOver:c,draggingOverWith:l,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!0,snapshot:f,useClone:null}});return(i,s)=>{const c=Do(s),a=c.droppableId,d=c.type,p=!c.isDropDisabled,l=c.renderClone;if(Be(i)){const u=i.critical;if(!an(d,u))return t;const f=No(u,i.dimensions),m=W(i.impact)===a;return r(a,p,m,m,f,l)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(!an(d,u.critical))return t;const f=No(u.critical,i.dimensions);return r(a,p,po(u.result)===a,W(u.impact)===a,f,l)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const u=i.completed;if(!an(d,u.critical))return t;const f=W(u.impact)===a,m=!!(u.impact.at&&u.impact.at.type==="COMBINE"),b=u.critical.droppable.id===a;return f?m?e:t:b?e:t}return t}},{updateViewportMaxScroll:sc},(e,t,n)=>({...Do(n),...e,...t}),{context:qt,areStatePropsEqual:uo})(cd),dd=()=>y.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:[y.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),y.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),ud=()=>y.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:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("polyline",{points:"12 6 12 12 16 14"})]}),pd=()=>y.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:[y.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),y.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),y.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),fd=()=>y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("polyline",{points:"15 3 21 3 21 9"}),y.jsx("polyline",{points:"9 21 3 21 3 15"}),y.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),y.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),gd=()=>y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("polyline",{points:"4 14 10 14 10 20"}),y.jsx("polyline",{points:"20 10 14 10 14 4"}),y.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),y.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),xo=e=>e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):"--:--",Io=e=>typeof e=="object"&&(e!=null&&e.name)?e.name:e,Oo=e=>{var t,n;return typeof e.status=="string"?e.status.toLowerCase()==="completed":((n=(t=e.status)==null?void 0:t.code)==null?void 0:n.toLowerCase())==="completed"},md=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},hd=({order:e,pathPeriod:t,isFirst:n,isDone:r,renderOrderExtraData:o})=>{var a,d,p,l,u,f;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 y.jsxs("div",{style:{...A.orderBlock,borderTop:n?"none":"1px solid #f3f4f6",backgroundColor:r?"#fafafa":"transparent"},children:[y.jsxs("div",{style:A.orderHeader,children:[y.jsxs("div",{style:A.gridItem,children:[y.jsxs("div",{style:A.gridLabel,children:["ORDER"," ",r&&y.jsx("span",{style:{color:"#16a34a",marginLeft:"4px"},children:"✓ DONE"})]}),y.jsxs("div",{style:A.gridValue,children:["#",e.order_id]})]}),o&&y.jsx("button",{onClick:()=>s(!i),style:A.expandButton,children:i?y.jsx(gd,{}):y.jsx(fd,{})})]}),y.jsxs("div",{style:A.detailsGrid,children:[y.jsxs("div",{style:A.gridItem,children:[y.jsx("div",{style:A.gridLabel,children:"LOCATION"}),y.jsxs("div",{style:A.gridValueWithIcon,children:[y.jsx(dd,{}),y.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:A.addressLink,children:((f=(u=e.customer)==null?void 0:u.address)==null?void 0:f.street_area)||"N/A"})]})]}),y.jsxs("div",{style:A.gridItem,children:[y.jsx("div",{style:A.gridLabel,children:"PERIOD"}),y.jsx("div",{style:A.gridValue,children:t})]}),y.jsxs("div",{style:A.gridItem,children:[y.jsx("div",{style:A.gridLabel,children:"TIME WINDOW"}),y.jsxs("div",{style:A.gridValueWithIcon,children:[y.jsx(ud,{})," ",y.jsxs("span",{children:[xo(e.eta_start)," - ",xo(e.eta_end)]})]})]})]}),i&&o&&y.jsx("div",{style:A.extraDataContainer,children:o(e)})]})},bd=({stopGroup:e,index:t,pathType:n,pathPeriod:r,canEditPath:o,isPathCompleted:i,renderStopActions:s,renderOrderExtraData:c})=>{const a=e.orders.every(Oo),d=!o||i||a;return y.jsx($l,{draggableId:e.stop_id.toString(),index:t,isDragDisabled:d,children:p=>{var l,u;return y.jsxs("div",{ref:p.innerRef,...p.draggableProps,style:{...A.timelineItem,...p.draggableProps.style},children:[y.jsx("div",{style:{...A.bubble,...a?A.bubbleCompleted:A.bubblePending},children:t+1}),y.jsxs("div",{style:A.card,children:[y.jsxs("div",{style:A.cardHeader,children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.jsxs("span",{style:A.title,children:[n," #",e.sequence_rank]}),y.jsx("span",{style:a?A.badgeCompleted:A.badgePending,children:a?"Completed":"Pending"})]}),!d&&y.jsx("div",{...p.dragHandleProps,children:y.jsx(pd,{})})]}),y.jsxs("div",{style:A.customerName,children:["Customer: ",(u=(l=e.orders[0])==null?void 0:l.customer)==null?void 0:u.name]}),y.jsx("div",{style:A.ordersList,children:e.orders.map((f,m)=>y.jsx(hd,{order:f,pathPeriod:r,isFirst:m===0,isDone:Oo(f),renderOrderExtraData:c},f.id))}),s&&y.jsx("div",{style:A.actionsSlot,children:s(e)})]})]})}})},vd=({path:e,onReorder:t,renderStopActions:n,renderOrderExtraData:r,canEditPath:o=!0})=>{var d,p;const[i,s]=D.useState([]);D.useEffect(()=>{e!=null&&e.path_orders&&s(md(e.path_orders))},[e]);const c=l=>{if(!l.destination)return;const u=Array.from(i),[f]=u.splice(l.source.index,1);u.splice(l.destination.index,0,f),s(u),t&&t(e.id,u.map(m=>m.stop_id))};if(!e||!i.length)return y.jsx("div",{children:"No Path Data"});const a=typeof e.status=="string"?e.status.toLowerCase()==="completed":((p=(d=e.status)==null?void 0:d.code)==null?void 0:p.toLowerCase())==="completed";return y.jsx("div",{style:A.container,children:y.jsx(yl,{onDragEnd:c,children:y.jsx(ld,{droppableId:"path-list",children:l=>y.jsxs("div",{ref:l.innerRef,...l.droppableProps,style:A.timelineWrapper,children:[y.jsx("div",{style:A.verticalLine}),y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:i.map((u,f)=>y.jsx(bd,{stopGroup:u,index:f,pathType:Io(e.type),pathPeriod:Io(e.period),canEditPath:o,isPathCompleted:a,renderStopActions:n,renderOrderExtraData:r},u.stop_id))}),l.placeholder]})})})})},A={container:{fontFamily:"sans-serif",maxWidth:"800px",margin:"0 auto"},timelineWrapper:{position:"relative",padding:"20px 0"},verticalLine:{position:"absolute",left:"19px",top:"40px",bottom:"40px",width:"2px",backgroundColor:"#f3f4f6"},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:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",padding:"4px"},extraDataContainer:{marginTop:"12px",padding:"12px",borderTop:"1px dashed #e5e7eb",backgroundColor:"#fff",borderRadius:"4px"},actionsSlot:{marginTop:"16px"}};Q.LogisticsDashboard=vd,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
184
+ `)}],od=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?g(!1,"Must provide a clone render function (renderClone) for virtual lists"):g())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?g(!1,"Expected virtual list to not have a placeholder"):g())}];function id(e){Te(()=>{cn(e,nd),e.props.mode==="standard"&&cn(e,rd),e.props.mode==="virtual"&&cn(e,od)})}class sd 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 cd=e=>{const t=D.useContext(Ke);t||(process.env.NODE_ENV!=="production"?g(!1,"Could not find app context"):g());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:f,snapshot:m,useClone:b,updateViewportMaxScroll:h,getContainerForClone:E}=e,v=x(()=>o.current,[]),C=x((L=null)=>{o.current=L},[]),I=x(()=>i.current,[]),N=x((L=null)=>{i.current=L},[]);id({props:e,getDroppableRef:v,getPlaceholderRef:I});const O=x(()=>{r()&&h({maxScroll:Gr()})},[r,h]);Jl({droppableId:c,type:a,mode:d,direction:p,isDropDisabled:u,isCombineEnabled:f,ignoreContainerClipping:l,getDroppableRef:v});const _=S(()=>D.createElement(sd,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:L,data:J,animate:fe})=>D.createElement(td,{placeholder:J,onClose:L,innerRef:N,animate:fe,contextId:n,onTransitionEnd:O})),[n,O,e.placeholder,e.shouldAnimatePlaceholder,N]),T=S(()=>({innerRef:C,placeholder:_,droppableProps:{"data-rfd-droppable-id":c,"data-rfd-droppable-context-id":n}}),[n,c,_,C]),H=b?b.dragging.draggableId:null,V=S(()=>({droppableId:c,type:a,isUsingCloneFor:H}),[c,H,a]);function j(){if(!b)return null;const{dragging:L,render:J}=b,fe=D.createElement(go,{draggableId:L.draggableId,index:L.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Z,tt)=>J(Z,tt,L));return rt.createPortal(fe,E())}return D.createElement(en.Provider,{value:V},s(T,m),j())};function ad(){return document.body||(process.env.NODE_ENV!=="production"?g(!1,"document.body is not ready"):g()),document.body}const Eo={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:ad},Do=e=>{let t={...e},n;for(n in Eo)e[n]===void 0&&(t={...t,[n]:Eo[n]});return t},an=(e,t)=>e===t.droppable.type,No=(e,t)=>t.draggables[e.draggable.id],ld=Un(()=>{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 m=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:m}}if(!s)return t;if(!a)return e;const f={isDraggingOver:c,draggingOverWith:l,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!0,snapshot:f,useClone:null}});return(i,s)=>{const c=Do(s),a=c.droppableId,d=c.type,p=!c.isDropDisabled,l=c.renderClone;if(Be(i)){const u=i.critical;if(!an(d,u))return t;const f=No(u,i.dimensions),m=W(i.impact)===a;return r(a,p,m,m,f,l)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(!an(d,u.critical))return t;const f=No(u.critical,i.dimensions);return r(a,p,po(u.result)===a,W(u.impact)===a,f,l)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const u=i.completed;if(!an(d,u.critical))return t;const f=W(u.impact)===a,m=!!(u.impact.at&&u.impact.at.type==="COMBINE"),b=u.critical.droppable.id===a;return f?m?e:t:b?e:t}return t}},{updateViewportMaxScroll:sc},(e,t,n)=>({...Do(n),...e,...t}),{context:qt,areStatePropsEqual:uo})(cd),dd=()=>y.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:[y.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),y.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),ud=()=>y.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:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("polyline",{points:"12 6 12 12 16 14"})]}),pd=()=>y.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:[y.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),y.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),y.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),fd=()=>y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("polyline",{points:"15 3 21 3 21 9"}),y.jsx("polyline",{points:"9 21 3 21 3 15"}),y.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),y.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),gd=()=>y.jsxs("svg",{width:"25",height:"25",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("polyline",{points:"4 14 10 14 10 20"}),y.jsx("polyline",{points:"20 10 14 10 14 4"}),y.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),y.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),xo=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}`},Io=e=>typeof e=="object"&&(e!=null&&e.name)?e.name:e,Oo=e=>{var t,n;return typeof e.status=="string"?e.status.toLowerCase()==="completed":((n=(t=e.status)==null?void 0:t.code)==null?void 0:n.toLowerCase())==="completed"},md=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},hd=({order:e,pathPeriod:t,isFirst:n,isDone:r,renderOrderExtraData:o})=>{var a,d,p,l,u,f;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 y.jsxs("div",{style:{...A.orderBlock,borderTop:n?"none":"1px solid #f3f4f6",backgroundColor:r?"#fafafa":"transparent"},children:[y.jsxs("div",{style:A.orderHeader,children:[y.jsxs("div",{style:A.gridItem,children:[y.jsxs("div",{style:A.gridLabel,children:["ORDER"," ",r&&y.jsx("span",{style:{color:"#16a34a",marginLeft:"4px"},children:"✓ DONE"})]}),y.jsxs("div",{style:A.gridValue,children:["#",e.order_id]})]}),o&&y.jsx("button",{onClick:()=>s(!i),style:A.expandButton,children:i?y.jsx(gd,{}):y.jsx(fd,{})})]}),y.jsxs("div",{style:A.detailsGrid,children:[y.jsxs("div",{style:A.gridItem,children:[y.jsx("div",{style:A.gridLabel,children:"LOCATION"}),y.jsxs("div",{style:A.gridValueWithIcon,children:[y.jsx(dd,{}),y.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:A.addressLink,children:((f=(u=e.customer)==null?void 0:u.address)==null?void 0:f.street_area)||"N/A"})]})]}),y.jsxs("div",{style:A.gridItem,children:[y.jsx("div",{style:A.gridLabel,children:"PERIOD"}),y.jsx("div",{style:A.gridValue,children:t})]}),y.jsxs("div",{style:A.gridItem,children:[y.jsx("div",{style:A.gridLabel,children:"TIME WINDOW"}),y.jsxs("div",{style:A.gridValueWithIcon,children:[y.jsx(ud,{})," ",y.jsxs("span",{children:[xo(e.eta_start)," - ",xo(e.eta_end)]})]})]})]}),i&&o&&y.jsx("div",{style:A.extraDataContainer,children:o(e)})]})},bd=({stopGroup:e,index:t,pathType:n,pathPeriod:r,canEditPath:o,isPathCompleted:i,renderStopActions:s,renderOrderExtraData:c})=>{const a=e.orders.every(Oo),d=!o||i||a;return y.jsx($l,{draggableId:e.stop_id.toString(),index:t,isDragDisabled:d,children:p=>{var l,u;return y.jsxs("div",{ref:p.innerRef,...p.draggableProps,style:{...A.timelineItem,...p.draggableProps.style},children:[y.jsx("div",{style:{...A.bubble,...a?A.bubbleCompleted:A.bubblePending},children:t+1}),y.jsxs("div",{style:A.card,children:[y.jsxs("div",{style:A.cardHeader,children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.jsxs("span",{style:A.title,children:[n," #",e.sequence_rank]}),y.jsx("span",{style:a?A.badgeCompleted:A.badgePending,children:a?"Completed":"Pending"})]}),!d&&y.jsx("div",{...p.dragHandleProps,children:y.jsx(pd,{})})]}),y.jsxs("div",{style:A.customerName,children:["Customer: ",(u=(l=e.orders[0])==null?void 0:l.customer)==null?void 0:u.name]}),y.jsx("div",{style:A.ordersList,children:e.orders.map((f,m)=>y.jsx(hd,{order:f,pathPeriod:r,isFirst:m===0,isDone:Oo(f),renderOrderExtraData:c},f.id))}),s&&y.jsx("div",{style:A.actionsSlot,children:s(e)})]})]})}})},vd=({path:e,onReorder:t,renderStopActions:n,renderOrderExtraData:r,canEditPath:o=!0})=>{var d,p;const[i,s]=D.useState([]);D.useEffect(()=>{e!=null&&e.path_orders&&s(md(e.path_orders))},[e]);const c=l=>{if(!l.destination)return;const u=Array.from(i),[f]=u.splice(l.source.index,1);u.splice(l.destination.index,0,f),s(u),t&&t(e.id,u.map(m=>m.stop_id))};if(!e||!i.length)return y.jsx("div",{children:"No Path Data"});const a=typeof e.status=="string"?e.status.toLowerCase()==="completed":((p=(d=e.status)==null?void 0:d.code)==null?void 0:p.toLowerCase())==="completed";return y.jsx("div",{style:A.container,children:y.jsx(yl,{onDragEnd:c,children:y.jsx(ld,{droppableId:"path-list",children:l=>y.jsxs("div",{ref:l.innerRef,...l.droppableProps,style:A.timelineWrapper,children:[y.jsx("div",{style:A.verticalLine}),y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:i.map((u,f)=>y.jsx(bd,{stopGroup:u,index:f,pathType:Io(e.type),pathPeriod:Io(e.period),canEditPath:o,isPathCompleted:a,renderStopActions:n,renderOrderExtraData:r},u.stop_id))}),l.placeholder]})})})})},A={container:{fontFamily:"sans-serif",maxWidth:"800px",margin:"0 auto"},timelineWrapper:{position:"relative",padding:"20px 0"},verticalLine:{position:"absolute",left:"19px",top:"40px",bottom:"40px",width:"2px",backgroundColor:"#f3f4f6"},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:{background:"none",border:"none",cursor:"pointer",color:" #d1d1d1",borderRadius:"5px",padding:"4px"},extraDataContainer:{marginTop:"12px",padding:"12px",borderTop:"1px dashed #e5e7eb",backgroundColor:"#fff",borderRadius:"4px"},actionsSlot:{marginTop:"16px"}};Q.LogisticsDashboard=vd,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wilow_app/design-system",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"