@uniformdev/mesh-sdk-react 14.2.1-alpha.34 → 16.0.1-alpha.164

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.esm.js CHANGED
@@ -1 +1,521 @@
1
- var dt=Object.defineProperty;var mt=(e,t)=>{for(var o in t)dt(e,o,{get:t[o],enumerable:!0})};import ut,{createContext as ct,useContext as pt,useState as ft}from"react";var Ee=ct(void 0),Pe=({children:e})=>{let[t,o]=ft(),n;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let r=t||window.UniformMeshSDK.getCurrentLocation();n={location:{getValue:r.getValue,getMetadata:r.getMetadata,setValue:async s=>{await r.setValue(s),o(window.UniformMeshSDK.getCurrentLocation())}}}}return ut.createElement(Ee.Provider,{value:n},e)},ke=()=>{let e=pt(Ee);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function oo(){let{location:e}=ke();return{value:e==null?void 0:e.getValue(),setValue:e==null?void 0:e.setValue,metadata:e==null?void 0:e.getMetadata()}}import{initializeUniformMeshSDK as gt}from"@uniformdev/mesh-sdk";import{useEffect as vt,useState as Ve}from"react";var so=({autoResizingDisabled:e}={})=>{let[t,o]=Ve(),[n,r]=Ve();return vt(()=>{typeof window=="undefined"||n||(typeof window.UniformMeshSDK=="undefined"?gt({autoResizingDisabled:e}).then(s=>{r(s)}).catch(s=>{o(s)}):r(window.UniformMeshSDK))},[e]),{initializing:!n&&!t,error:t,sdk:n}};import Te,{createContext as ht,useContext as xt}from"react";var De=ht(void 0),co=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),Te.createElement(De.Provider,{value:t},Te.createElement(Pe,null,e))},Be=()=>{let e=xt(De);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function go(){let{sdk:e}=Be();return e}import Ge from"react";import{Button as bt}from"reakit";var ee={primary:{default:"bg-primary text-white hover:bg-opacity-75 border focus:border-gray-700 active:bg-opacity-75 focus:ring",disabled:"bg-gray-500 text-white"},secondary:{default:"bg-secondary text-white hover:bg-opacity-75 border focus:border-gray-700 active:bg-opacity-75 focus:ring",disabled:"bg-gray-500 text-white"},tertiary:{default:"bg-tertiary text-white hover:bg-opacity-75 border focus:border-gray-700 active:bg-opacity-75 focus:ring",disabled:"bg-gray-500 text-white"},quaternary:{default:"bg-primary text-white hover:bg-opacity-75 border-2 border-gray-500 active:bg-opacity-75 focus:ring",disabled:"bg-gray-500 text-white"},unimportant:{default:"bg-brand-secondary-2 text-primary hover:bg-opacity-75 border focus:border-gray-700 active:bg-opacity-75 focus:ring",disabled:"bg-brand-secondary-2 text-gray-600 cursor-not-allowed"}},te={base:"inline-flex items-center border-transparent font-medium focus:outline-none focus:ring",size:(e,t)=>({xs:`${t?"px-2.5 py-1.5 ":""}text-xs leading-4 ${e?"rounded":""}`,sm:`${t?"px-3 py-2 ":""}text-sm leading-4 ${e?"rounded-md":""}`,md:`${t?"px-4 py-2 ":""}text-sm leading-5 tracking-wider ${e?"rounded-md":""}`,lg:`${t?"px-4 py-2 ":""}text-base leading-6 tracking-wider ${e?"rounded-md":""}`,xl:`${t?"px-6 py-3 ":""}text-base leading-6 tracking-wider ${e?"rounded-md":""}`}),buttonType:(e,t)=>{if(!(!e||!ee[e]))return t?ee[e].disabled:ee[e].default}},K=Ge.forwardRef(({size:e="md",buttonType:t="primary",children:o,className:n,rounded:r=!1,disablePadding:s=!1,...f},g)=>{let p=[te.base,te.size(r,!s)[e],te.buttonType(t,f.disabled),n].join(" ");return Ge.createElement(bt,{className:p,ref:g,...f},o)});import E from"react";import*as oe from"react";var Ct=e=>oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e},oe.createElement("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),O=Ct;import*as ne from"react";var yt=e=>ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e},ne.createElement("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),A=yt;import*as _ from"react";var wt=e=>_.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},_.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),_.createElement("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),N=wt;import*as re from"react";var St=e=>re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e},re.createElement("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),j=St;import*as ae from"react";var Mt=e=>ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e},ae.createElement("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),D=Mt;import*as ie from"react";var Nt=e=>ie.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},ie.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),R=Nt;var Lt={caution:{icon:D,descriptionColor:"text-yellow-700",iconColor:"text-yellow-400",titleColor:"text-yellow-800",containerColor:"bg-yellow-50"},danger:{icon:A,descriptionColor:"text-red-700",iconColor:"text-red-400",titleColor:"text-red-800",containerColor:"bg-red-50"},error:{icon:D,descriptionColor:"text-red-700",iconColor:"text-red-400",titleColor:"text-red-800",containerColor:"bg-red-50"},info:{icon:O,descriptionColor:"text-blue-700",iconColor:"text-blue-400",titleColor:"text-blue-800",containerColor:"bg-blue-50"},note:{icon:N,descriptionColor:"text-gray-700",iconColor:"text-gray-400",titleColor:"text-gray-800",containerColor:"bg-gray-50"},success:{icon:R,descriptionColor:"text-green-700",iconColor:"text-green-400",titleColor:"text-green-800",containerColor:"bg-green-50"},tip:{icon:j,descriptionColor:"text-green-700",iconColor:"text-green-400",titleColor:"text-green-800",containerColor:"bg-green-50"}},Ue=({type:e="info",title:t,children:o,className:n})=>{let r=Lt[e];if(!r)return null;let s=r.icon;return E.createElement("div",{"data-testid":"sdk-ui-callout",className:`rounded-md p-4 ${r.containerColor} ${n||""}`},E.createElement("div",{className:"flex"},E.createElement("div",{className:"flex-shrink-0"},E.createElement(s,{className:`h-5 w-5 ${r.iconColor}`})),E.createElement("div",{className:"ml-3"},t?E.createElement("h3",{className:`text-sm font-medium mb-2 ${r.titleColor}`},t):null,o?E.createElement("div",{className:`text-sm ${r.descriptionColor}`},o):null)))};import P from"react";import{Input as Et}from"reakit";var se=({classNameContainer:e,classNameControl:t,classNameLabel:o,label:n,icon:r,id:s,disabled:f,...g})=>{let p={container:`uniform-input-container ${e||""}`,control:`uniform-input uniform-input-text${f?" uniform-input-disabled":""}${r?" pr-10":""} ${t||""}`,label:`uniform-input-label ${o||""}`};return P.createElement(P.Fragment,null,n?P.createElement("label",{htmlFor:s,className:p.label},n):null,P.createElement("div",{className:p.container},P.createElement(Et,{className:p.control,id:s,disabled:f,...g},v=>P.createElement("input",{...v,style:g.style})),r?P.createElement("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"},r):null))};se.displayName="Input";import le from"react";import*as L from"react";var Pt=e=>L.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},L.createElement("g",{clipPath:"url(#magnifying-glass_svg__a)"},L.createElement("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),L.createElement("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),L.createElement("defs",null,L.createElement("clipPath",{id:"magnifying-glass_svg__a"},L.createElement("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),Z=Pt;function ze({onSearchTextChanged:e,disabled:t=!1,placeholder:o="Keyword search",inputFieldName:n="keywordSearch",disabledFieldSubmission:r=!1}){return le.createElement(se,{type:"text",name:n,placeholder:o,icon:le.createElement("div",{className:"pr-1"},le.createElement(Z,{className:"w-5 h-5 text-primary"})),onChange:g=>{e==null||e(g.currentTarget.value)},onKeyPress:g=>{g.key==="Enter"&&r&&g.preventDefault()},className:"uniform-input uniform-input-text pr-12 bg-gray-100",disabled:t,"aria-label":o})}import J from"react";var de=()=>J.createElement("span",{className:"loader",role:"presentation"},J.createElement("i",{className:"loader__dot"}),J.createElement("i",{className:"loader__dot"}),J.createElement("i",{className:"loader__dot"}));import V from"react";import{useMenuState as kt,Menu as Vt,MenuButton as Tt}from"reakit/Menu";var Ie=V.createContext({}),$e=()=>V.useContext(Ie),He=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:n="auto",children:r})=>{let s=kt();return V.createElement(Ie.Provider,{value:s},V.createElement(Tt,{...s,ref:t.ref,...t.props},f=>V.cloneElement(t,f)),V.createElement(Vt,{...s,placement:n,"aria-label":e,className:`uniform-menu divide-y divide-gray-500 shadow-xl z-50 ${o}`},r))};import B from"react";import{MenuItem as Fe}from"reakit";var Oe=({children:e,className:t,hideMenuOnClick:o=!0,icon:n,...r})=>{let s=$e(),f=`uniform-menu-item bg-white ${(r==null?void 0:r.disabled)?"text-gray-500":"text-primary"} ${t||""}`,g=v=>{let h={...v};if(h.onClick){let y=h.onClick;h.onClick=m=>{s.hide(),y(m)}}return h};if(typeof e=="function")return B.createElement(Fe,{...s,...r,className:f},v=>{let h=o?g(v):v,y=e(h);return n?Ke(y,n):y});let p=o?g(r):r;return B.createElement(Fe,{...s,...p,className:f},n?Ke(e,n):e)};function Ke(e,t){return B.createElement("div",{className:"flex items-center justify-between"},B.createElement("div",null,e),B.createElement("div",{className:"ml-4"},t))}import i,{useState as z,useEffect as Kt,useRef as Ot}from"react";var pe={};mt(pe,{Caution:()=>D,Checkmark:()=>R,ChevronDown:()=>W,Close:()=>X,Danger:()=>A,ExclamationPoint:()=>O,Info:()=>N,Lightbulb:()=>j,MagnifyingGlass:()=>Z,MaximizeAlt:()=>Ae,MoreVerticalAlt:()=>U});import*as me from"react";var Dt=e=>me.createElement("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e},me.createElement("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),W=Dt;import*as G from"react";var Bt=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e},G.createElement("g",{fillRule:"evenodd"},G.createElement("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),G.createElement("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),X=Bt;import*as ue from"react";var Gt=e=>ue.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},ue.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),Ae=Gt;import*as ce from"react";var Ut=e=>ce.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},ce.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),U=Ut;import{useThrottle as At}from"react-use";import{v4 as _t}from"uuid";import u,{useState as zt,useRef as je,useEffect as It}from"react";function _e(e,t){let o=window.open(e,"_blank"),n=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(n),t())},500)}import{format as $t}from"timeago.js";var Re=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:n})=>{var y;let r=je(null),s=je(null),[f,g]=zt(!1);It(()=>{let m=S=>{r.current&&!r.current.contains(S.target)&&s.current&&!s.current.contains(S.target)&&g(!1)},x=()=>{g(!1)};return window.addEventListener("resize",x,!0),document.addEventListener("scroll",m,!0),document.addEventListener("mousedown",m),()=>{window.removeEventListener("resize",x,!0),document.removeEventListener("scroll",m,!0),document.removeEventListener("mousedown",m)}},[s]);let p=()=>{var m;if(g(!f),s.current&&r.current){let x=(m=r==null?void 0:r.current)==null?void 0:m.getBoundingClientRect();s.current.style.top=`${x.top+30}px`}},v=t&&typeof t!="string"?t:null,h=v?u.createElement(v,{className:"h-7 w-7"}):u.createElement("img",{src:t,alt:"CMS logo",className:"h-7 w-7"});return u.createElement("div",{className:"flex w-full border border-gray-300 rounded-md bg-gray-100",key:e.id},u.createElement("div",{className:"p-4 pl-8 flex flex-grow mr-2 gap-2 items-center relative"},u.createElement("div",{className:"flex-grow"},u.createElement("div",{className:"inline-flex relative items-start"},u.createElement("h4",{className:"text-primary font-bold leading-none mb-2",title:`ID: ${e.id}`,"data-test-id":"entry-id"},e.title||e.id||""),e.popoverData&&u.createElement(u.Fragment,null,u.createElement("button",{type:"button",ref:r,className:"ml-2 -my-1","aria-controls":"path-details",onClick:p},u.createElement(N,{className:"text-gray-700"})),u.createElement("div",{ref:s,className:`fixed bg-white p-4 rounded shadow-md border-l-4 border-green-500 w-max z-10 ${f?"visible":"invisible"}`},Object.entries(e.popoverData).map(([m,x],S)=>u.createElement("div",{className:"text-xs",key:S},u.createElement("span",{className:"font-bold mr-2"},m,":"),x))))),e.createdDate&&u.createElement("div",{className:"text-xs"},u.createElement("span",{className:"font-bold mr-2"},"Created:"),$t((y=e.createdDate)!=null?y:0)),u.createElement("div",{className:"flex gap-4"},e.metadata?Object.entries(e.metadata).filter(([m])=>["type","status"].includes(m.toLocaleLowerCase())).map(([m,x])=>u.createElement("span",{className:"text-sm",key:m},x)):null),e.metadata?Object.entries(e.metadata).filter(([m])=>!["type","status"].includes(m.toLocaleLowerCase())).map(([m,x])=>u.createElement("div",{className:"text-xs order-1",key:m},u.createElement("span",{className:"font-bold mr-2 order-1"},m,":"),x)):null),u.createElement("div",{className:"flex md:flex-row flex-col gap-2"},e.editLink?u.createElement("a",{href:e.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:m=>{n&&(_e(m.currentTarget.href,()=>n(e)),m.preventDefault())},className:"flex justify-between items-center pl-4 pr-2 bg-white rounded border-2 border-gray-400 hover:bg-gray-100"},u.createElement("span",{className:"mr-2 text-sm"},"Edit"),h):null,u.createElement("button",{type:"button",onClick:m=>{m.preventDefault(),o(e)},className:"flex justify-between items-center px-4 bg-white rounded border-2 border-gray-400 h-10 hover:bg-gray-100"},u.createElement("span",{className:"mr-2 text-sm"},"Unlink"),u.createElement(X,{className:"w-4 h-4 text-red-600"})))))};import w,{useState as Ht,useRef as Ze,useEffect as Ft}from"react";var Je=({result:e,isSelected:t,triggerSelection:o})=>{let n=Ze(null),r=Ze(null),[s,f]=Ht(!1);Ft(()=>{function p(v){n.current&&!n.current.contains(v.target)&&r.current&&!r.current.contains(v.target)&&f(!1)}return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[r]);let g=p=>{p.stopPropagation(),f(!s)};return w.createElement("div",{key:e.id,className:`p-2 cursor-pointer relative ${t?"bg-green-400 text-white":""}`,"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o()},e.title,e.popoverData&&t?w.createElement(w.Fragment,null,w.createElement("button",{type:"button",ref:n,className:"absolute top-0 bottom-0 right-2","aria-controls":"path-details",onClick:p=>g(p)},w.createElement(N,null)),w.createElement("div",{ref:r,className:`absolute top-4 right-10 bg-white p-4 rounded shadow-md border-l-4 border-green-500 w-max z-10 text-black ${s?"visible":"invisible"}`},e.metadata&&Object.entries(e.metadata).map(([p,v],h)=>w.createElement("div",{className:"text-xs",key:h},w.createElement("span",{className:"font-bold mr-2"},p,":"),v)),Object.entries(e.popoverData).map(([p,v],h)=>w.createElement("div",{className:"text-xs",key:h},w.createElement("span",{className:"font-bold mr-2"},p,":"),v)))):null)};import{Droppable as jt,DragDropContext as Rt,Draggable as Zt}from"react-beautiful-dnd";var Jt=({searchText:e,selectedContentType:t})=>{let o="No content found";return t&&(o=`No ${t} content was found`),e&&(o=`${o} for keyword '${e}'.`),i.createElement(Ue,{type:"info"},o)},Kn=({search:e,results:t,contentTypes:o,selectedItems:n,logoIcon:r,select:s,multiSelect:f,multiSelectId:g,rowComponent:p,selectedItemComponent:v,totalResults:h,resultsLoading:y,requireContentType:m,onAddNew:x,onEditClosed:S,onCancel:fe,noResultsComponent:We,helpComponent:Xe,onSort:q})=>{var Me,Ne,Le;let ge=()=>m?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[ve,he]=z(""),[M,xe]=z(ge),[I,Q]=z(!1),[$,H]=z([]),[qe,be]=z(!1),F=At(ve,750);Kt(()=>{e(F,{count:5,offset:0,contentType:M==="any"?void 0:M})},[F,M]);let Qe=a=>{$.includes(a.id)?H(c=>c.filter(k=>k!==a.id)):H(f?c=>[...c,a==null?void 0:a.id]:[a.id])},Ye=()=>{xe(ge()),he(""),H((n==null?void 0:n.length)?n.map(a=>a.id):[])},et=()=>{Q(a=>!a),I||Ye()},Ce=a=>{s((n==null?void 0:n.filter(c=>c.id!==a.id).map(c=>c.id))||[],"")},tt=a=>{a.preventDefault(),s($,M),Q(!1)},ot=a=>{a.preventDefault(),Q(!1),fe&&fe()},nt=a=>{a.preventDefault(),e(F,{count:5,offset:(t==null?void 0:t.length)||0,contentType:M==="any"?void 0:M}),be(!0);let c=setTimeout(()=>{be(!1)},750);return()=>clearTimeout(c)},ye=Ot(_t()),rt=!(n==null?void 0:n.length)||f,at=p||Je,we=v||Re,it=We||Jt,Se=r&&typeof r!="string"?r:null,st=Se?i.createElement(Se,{className:"h-9 w-9"}):i.createElement("img",{src:r,alt:"CMS logo",className:"h-9 w-9"}),lt=a=>{var c,k;if(a.destination&&a.source.droppableId===((c=a.destination)==null?void 0:c.droppableId)){let b=[...n||[]],[Y]=(k=b==null?void 0:b.splice(a.source.index,1))!=null?k:[];return b==null||b.splice(a.destination.index,0,Y),q==null||q(b.map(T=>T.id)),b}};return i.createElement("div",{className:"w-full"},i.createElement("div",{className:"relative my-4"},rt&&i.createElement("div",{className:"space-y-2"},i.createElement("div",{className:"py-3 px-2 bg-white rounded-lg border border-gray-300 mb-4","data-test-id":"component-search"},i.createElement("button",{className:"flex items-center w-full text-base relative",onClick:et,type:"button","aria-haspopup":!0,"aria-expanded":I,"aria-controls":ye.current},st,i.createElement("span",{className:"ml-4"},"Select"),i.createElement("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},i.createElement(W,{className:`w-5 h-5 text-standard transform transition-transform ${I?"rotate-180":"rotate-0"}`})))),i.createElement("div",{className:`${I?"block":"hidden"} py-3 px-4 space-y-4 bg-white rounded-lg border border-gray-300`},Xe||null,i.createElement("div",{className:"flex space-x-3"},i.createElement("select",{className:"uniform-input uniform-input-select w-1/3 bg-gray-100",onChange:a=>xe(a.target.value)},m?null:i.createElement("option",{value:"any",className:"bg-white text-primary"},"All content types"),o==null?void 0:o.map(a=>i.createElement("option",{value:a.id,key:a.id,className:"bg-white text-primary"},a.name))),i.createElement("div",{className:"flex-grow"},i.createElement(ze,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:he,disabledFieldSubmission:!0}))),i.createElement("div",{className:"overflow-y-scroll max-h-64 divide-y divide-gray-200 scrollbar",id:ye.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(t==null?void 0:t.length)?t.map(a=>i.createElement(at,{key:a.id,isSelected:$.includes(a.id),result:a,triggerSelection:()=>Qe(a)})):y?null:i.createElement(it,{searchText:F||ve,selectedContentType:(Ne=(Me=o==null?void 0:o.find(a=>a.id===M))==null?void 0:Me.name)!=null?Ne:M}),!y&&typeof h!="undefined"&&t&&(t==null?void 0:t.length)<h&&i.createElement("button",{className:"block p-4 text-center w-full hover:bg-gray-100 focus:bg-gray-100 font-bold text-primary text-sm focus:outline-none",onClick:nt},qe?i.createElement(de,null):"Load More"),y&&!(t==null?void 0:t.length)?i.createElement("div",{className:"p-4 text-center w-full"},i.createElement(de,null)):null),i.createElement("div",{className:"flex justify-between"},i.createElement("div",null,x&&((Le=o==null?void 0:o.length)!=null?Le:0)>0?i.createElement(He,{menuLabel:"Add new menu",menuTrigger:i.createElement(K,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(a=>i.createElement(Oe,{key:a.id,className:"bg-white text-primary",onClick:()=>x(a)},a.name))):null),i.createElement("div",null,i.createElement(K,{buttonType:"unimportant",onClick:ot},"Cancel"),i.createElement(K,{className:"ml-5",disabled:!$.length,onClick:tt,"data-test-id":"entry-accept-button"},"Accept"))))),f?i.createElement(Rt,{onDragEnd:a=>lt(a)},i.createElement(jt,{droppableId:g||"canvas-multi-select"},a=>i.createElement("div",{...a.droppableProps,ref:a.innerRef,className:"space-y-1"},n==null?void 0:n.map((c,k)=>{if(c==null?void 0:c.id)return i.createElement(Zt,{key:c.id,draggableId:c.id,index:k},(b,Y)=>i.createElement("div",{className:"relative group",ref:b.innerRef,...b.draggableProps,...b.dragHandleProps},i.createElement("span",{className:`absolute left-0 top-0 bottom-0 my-auto flex items-center ${Y.isDragging?"":"opacity-0 group-hover:opacity-30"}`},i.createElement(U,{className:"text-brand-secondary-1 absolute left-1.5",width:24,height:24}),i.createElement(U,{className:"text-brand-secondary-1",width:24,height:24})),i.createElement(we,{key:`selected-item-${c.id}`,logoIcon:r,selectedItem:c,onDeselect:T=>Ce(T),onEditClosed:S?T=>S(T):void 0})))}),a.placeholder))):n==null?void 0:n.map(a=>i.createElement(we,{key:`selected-item-${a.id}`,logoIcon:r,selectedItem:a,onDeselect:c=>Ce(c),onEditClosed:S?c=>S(c):void 0}))))};import C from"react";var _n=({isActive:e,statusMessage:t})=>C.createElement("div",{className:`${e?"flex":"hidden"} absolute bottom-0 left-0 right-0 top-0 items-center justify-center overflow-hidden z-50`,style:{zIndex:9999}},C.createElement("div",{className:"absolute bottom-0 left-0 right-0 top-0 bg-white bg-opacity-50"}),C.createElement("div",{className:"relative"},C.createElement("div",{className:"flex flex-col items-center"},C.createElement(Wt,{height:128,width:128}),t?C.createElement("div",{className:"mt-4 text-gray-500"},t):null))),Wt=({height:e,width:t})=>C.createElement("svg",{"data-testid":"svg",viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",width:t!=null?t:40,height:e!=null?e:40,className:"stroke-current"},C.createElement("g",{fill:"none",fillRule:"evenodd"},C.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},C.createElement("circle",{strokeOpacity:".25",cx:"18",cy:"18",r:"18"}),C.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18",transform:"rotate(166.645 18 18)"},C.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 18 18",to:"360 18 18",dur:"0.8s",repeatCount:"indefinite"})))));export*from"@uniformdev/mesh-sdk";export{K as Button,Ue as Callout,Kn as CmsEntrySearch,Je as DefaultSearchRow,Re as DefaultSelectedItem,pe as Icons,se as Input,ze as KeywordSearchInput,Wt as LoadingIcon,de as LoadingIndicator,_n as LoadingOverlay,He as Menu,Ie as MenuContext,Oe as MenuItem,Ee as UniformMeshLocationContext,Pe as UniformMeshLocationContextProvider,De as UniformMeshSdkContext,co as UniformMeshSdkContextProvider,so as useInitializeUniformMeshSdk,$e as useMenuContext,oo as useUniformMeshLocation,ke as useUniformMeshLocationContext,go as useUniformMeshSdk,Be as useUniformMeshSdkContext};
1
+ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as V from"react";import{createContext as ar,useContext as ir,useState as sr}from"react";var Ee=ar(void 0),Te=({children:t})=>{let[n,o]=sr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let i=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:i.getValue,getMetadata:i.getMetadata,setValue:async(d,m)=>{await i.setValue(d,m),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async d=>{await i.setValidationResult(d)}}}}return e(Ee.Provider,{value:r},t)},Ie=()=>{let t=ir(Ee);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function ho(){let{location:t}=Ie();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}import{initializeUniformMeshSDK as cr}from"@uniformdev/mesh-sdk";import{useEffect as dr,useState as De}from"react";var Co=({autoResizingDisabled:t}={})=>{let[n,o]=De(),[r,i]=De();return dr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?cr({autoResizingDisabled:t}).then(d=>{i(d)}).catch(d=>{o(d)}):i(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as lr,useContext as pr}from"react";import{Theme as ur}from"@uniformdev/design-system";var Ge=lr(void 0),Mo=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e(Ge.Provider,{value:n},e(ur,null),e(Te,null,t))},ze=()=>{let t=pr(Ge);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function To(){let{sdk:t}=ze();return t}import _e from"react";import vr,{useMemo as ie,useContext as hr}from"react";import{css as ee}from"@emotion/react";import{InputSelect as mr}from"@uniformdev/design-system";import Ue from"react";var Ae=({value:t,text:n,loading:o})=>e(Ue.Fragment,null,!!n&&n,!n&&e(Ue.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Be=({id:t,label:n,loading:o,selectedValues:r,values:i,onAdd:d,onRemove:m})=>{var b;let v=(b=i==null?void 0:i.filter(a=>!(r!=null&&r.includes(a.id.toString()))))!=null?b:[],h=(a,g)=>{a.preventDefault(),m(g)};return e("div",null,e(mr,{id:t,name:t,label:n,onChange:a=>d(a.target.value),disabled:o,options:[{value:"",label:"Add..."},...v.map(a=>({value:a.id,label:a.name||a.id}))],css:Array.isArray(r)&&r.length>0?ee`
2
+ margin-bottom: var(--spacing-base);
3
+ `:""}),r==null?void 0:r.map(a=>{var g;return e("div",{css:ee`
4
+ font-size: var(--fs-sm);
5
+ display: inline-flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ background-color: var(--gray-100);
9
+ border: 1px solid var(--gray-300);
10
+ margin-bottom: var(--spacing-sm);
11
+ margin-right: var(--spacing-sm);
12
+ `,key:a},e("span",{css:ee`
13
+ padding: var(--spacing-3);
14
+ color: var(--gray-800);
15
+ `},e(Ae,{value:a,loading:o,text:(g=i.find(S=>S.id===a))==null?void 0:g.name})),e("button",{css:ee`
16
+ padding: var(--spacing-3);
17
+ border-left: 1px solid var(--gray-300);
18
+ `,title:"remove",onClick:S=>h(S,a)},e("svg",{xmlns:"http://www.w3.org/2000/svg",css:ee`
19
+ height: 1.25rem;
20
+ width: 1.25rem;
21
+ pointer-events: none;
22
+ display: block;
23
+ `,viewBox:"0 0 20 20",fill:"currentColor"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var gr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ne=gr;var fr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),ae=fr;import{useAsyncFn as br,useDebounce as yr}from"react-use";import{Input as Oe,InputSelect as se,mq as ce}from"@uniformdev/design-system";import{css as P}from"@emotion/react";var He={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Xo=({value:t,setValue:n,brands:o,categories:r,loading:i,categoriesLoading:d,brandsLoading:m,logoIcon:v,onGetProducts:h,sortOptions:b,sortOrderOptions:a,categoryLabel:g="Product Category",brandLabel:S="Brand",disableBrands:N,restrictToSingleCategory:U=!1})=>{var x,O,Z;let w=async s=>{n({...He,...t||{},...s})},y=ie(()=>({...He,...t||{}}),[t]),[_,F]=br(async s=>await h(s),[h]);yr(async()=>{await F({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let D=ie(()=>{let s=[];return r==null||r.forEach(L=>{let Y=$e(L,void 0);s.push(...Y)}),s},[r]),A=ie(()=>[{value:"",label:"All categories"},...D.map(s=>({label:s.name,value:s.id}))],[D]),re=ie(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),W=s=>{let L=(t==null?void 0:t.categories)||[];w({categories:[...L,s]})},B=s=>{var L;w({categories:(L=t==null?void 0:t.categories)==null?void 0:L.filter(Y=>Y!==s)})},G=s=>{w({brand:s.target.value})},u=s=>{w({count:s||1})};return i?e("div",null,"Loading..."):e(Ke.Provider,{value:{categories:r,logoIcon:v}},e("div",{css:P`
24
+ > :not(:last-child) {
25
+ margin-bottom: var(--spacing-md);
26
+ }
27
+ `},U?e(se,{id:"selection-field-product-category",label:g,disabled:i,value:(O=(x=y.categories)==null?void 0:x[0])!=null?O:"",options:A,onChange:s=>{w({categories:s.target.value===""?[]:[s.target.value]})}}):e(Be,{loading:d||!1,id:"selection-field-product-category",label:g,onAdd:W,onRemove:B,selectedValues:y.categories,values:D}),e("div",{css:P`
28
+ display: flex;
29
+ flex-wrap: wrap;
30
+ column-gap: var(--spacing-lg);
31
+ row-gap: var(--spacing-md);
32
+ ${ce("md")} {
33
+ flex-wrap: nowrap;
34
+ }
35
+ `},N?null:e("div",{css:P`
36
+ width: 50%;
37
+ `},e(se,{id:"brand",name:"brand",label:S,disabled:m,value:y.brand,onChange:G,options:[{value:"",label:"Choose..."},...re.map(s=>({value:s.id,label:s.name}))]})),e("div",{css:P`
38
+ flex-grow: 1;
39
+ position: relative;
40
+ `},e(Oe,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:s=>w({keyword:s.target.value})}))),e("div",{css:P`
41
+ display: flex;
42
+ flex-wrap: wrap;
43
+ column-gap: var(--spacing-lg);
44
+ row-gap: var(--spacing-md);
45
+ ${ce("md")} {
46
+ flex-wrap: nowrap;
47
+ }
48
+ `},e("div",{css:P`
49
+ width: 100%;
50
+ ${ce("md")} {
51
+ width: 33.333333%;
52
+ }
53
+ position: relative;
54
+ `},e(Oe,{id:"count",name:"count",type:"number",min:1,step:1,value:y.count,onChange:s=>u(s.target.valueAsNumber),label:"Count"}),e("div",{css:P`
55
+ position: absolute;
56
+ bottom: var(--spacing-sm);
57
+ right: var(--spacing-sm);
58
+ display: flex;
59
+ gap: var(--spacing-sm);
60
+ `},e(Fe,{onCountChange:()=>u(y.count-1),countIcon:"decrement",disabled:y.count===1}),e(Fe,{onCountChange:()=>u(y.count+1),countIcon:"increment"}))),Array.isArray(b)&&b.length>0?e("div",{css:P`
61
+ flex-grow: 1;
62
+ ${ce("md")} {
63
+ width: 33.333333%;
64
+ }
65
+ `},e(se,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:s=>w({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...b.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(a)&&a.length>0?e("div",{css:P`
66
+ flex-grow: 1;
67
+ `},e(se,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:s=>w({sortOrder:s.target.value}),options:a.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),e("div",null,e("h3",{css:P`
68
+ font-size: var(--fs-md);
69
+ line-height: var(--spacing-md);
70
+ font-weight: var(--fw-bold);
71
+ margin-bottom: var(--spacing-xs);
72
+ `},"Result Preview"),e(Ne,{products:(Z=_.value)==null?void 0:Z.products}))))};function $e(t,n){var d;let o=[],r=n?`${n.name} > `:"",i={id:t.id.toString(),name:`${r}${t.name}`};return o.push(i),(d=t.children)==null||d.forEach(m=>{let v=$e(m,i);o.push(...v)}),o}function Fe({onCountChange:t,countIcon:n,disabled:o}){return e("button",{css:P`
73
+ width: 2.25rem;
74
+ height: 2.25rem;
75
+ border: 1px solid var(--gray-300);
76
+ border-radius: var(--rounded-base);
77
+ background-color: var(--gray-100);
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ &:hover {
82
+ background-color: var(--gray-200);
83
+ }
84
+ ${o?P`
85
+ cursor: not-allowed;
86
+ opacity: 0.3;
87
+ `:""}
88
+ `,onClick:t,disabled:o},n==="increment"?e(ne,{css:P`
89
+ width: 1rem;
90
+ height: 1rem;
91
+ `}):e(ae,{css:P`
92
+ width: 1rem;
93
+ height: 1rem;
94
+ `}))}var Ke=vr.createContext(void 0),Qe=()=>{let t=hr(Ke);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function H({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?e(r,{className:o}):e("img",{src:t,alt:n,className:o})}import{css as R}from"@emotion/react";import{scrollbarStyles as Sr}from"@uniformdev/design-system";var Ne=({products:t})=>{let{categories:n,logoIcon:o}=Qe();return e(_e.Fragment,null,e("p",{css:R`
95
+ margin-bottom: var(--spacing-base);
96
+ `},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[R`
97
+ max-height: 24rem;
98
+ overflow-x: auto;
99
+ `,Sr]},t==null?void 0:t.map((r,i)=>{var v;let[d]=(r==null?void 0:r.categories)||[],m=typeof d=="undefined"||!n||(v=n.find(h=>h.id===d.id))==null?void 0:v.name;return e("li",{key:`product-${r.id}`,css:R`
100
+ border: 1px solid var(--gray-300);
101
+ border-radius: var(--rounded-md);
102
+ background-color: var(--gray-100);
103
+ margin: var(--spacing-base) 0;
104
+ `},e("div",{css:R`
105
+ padding: var(--spacing-sm);
106
+ display: flex;
107
+ flex-grow: 1;
108
+ margin-right: var(--spacing-sm);
109
+ gap: var(--spacing-base);
110
+ align-items: center;
111
+ `},r.thumbnailUrl?e("img",{src:r.thumbnailUrl,alt:r.name||`Product ${i}`,css:R`
112
+ background-color: var(--gray-200);
113
+ width: 3.5rem;
114
+ height: 3.5rem;
115
+ object-fit: cover;
116
+ `}):e("div",{css:R`
117
+ height: 3.5rem;
118
+ width: 3.5rem;
119
+ background-color: var(--gray-100);
120
+ `}),e("h4",{css:R`
121
+ font-weight: var(--fw-bold);
122
+ width: 33.333333%;
123
+ font-size: var(--fs-sm);
124
+ `},r.name,m&&e("span",{css:R`
125
+ display: block;
126
+ font-weight: var(--fw-regular);
127
+ `},m)),r&&e(_e.Fragment,null,e("p",{css:R`
128
+ margin-right: var(--spacing-lg);
129
+ font-size: var(--fs-sm);
130
+ `},"SKU: ",r.sku||r.id,e("br",null)),r.price!==void 0?e("p",{css:R`
131
+ margin-right: var(--spacing-lg);
132
+ font-size: var(--fs-sm);
133
+ `},e("span",{css:R`
134
+ display: block;
135
+ `},"Price: ",r.price)):null,e("a",{css:R`
136
+ display: inline-flex;
137
+ justify-content: space-between;
138
+ align-items: center;
139
+ padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
140
+ background-color: var(--white);
141
+ border-radius: var(--rounded-base);
142
+ border: 2px solid var(--gray-400);
143
+ margin-left: auto;
144
+ &:hover {
145
+ background-color: var(--gray-100);
146
+ }
147
+ `,href:r.url,title:`Goto ${r.name}`,target:"__blank",rel:"noopener"},e("span",{css:R`
148
+ font-size: var(--fs-sm);
149
+ margin-right: var(--spacing-sm);
150
+ `},"Edit"),o?e(H,{src:o,alt:"Logo",css:R`
151
+ width: 2.25rem;
152
+ height: 2.25rem;
153
+ `}):null))))})))};import eo,{useContext as to,useMemo as ro,useRef as oo}from"react";import*as T from"react";var fe={};nr(fe,{Caution:()=>We,Checkmark:()=>de,ChevronDown:()=>le,Close:()=>J,Danger:()=>Ze,ExclamationPoint:()=>qe,Info:()=>X,Lightbulb:()=>Je,MagnifyingGlass:()=>Xe,MaximizeAlt:()=>Ye,Minus:()=>ae,MoreVerticalAlt:()=>te,Plus:()=>ne});var wr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),We=wr;var Cr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),de=Cr;var Pr=t=>e("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},e("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),le=Pr;var Rr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},e("g",{fillRule:"evenodd"},e("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),e("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),J=Rr;var kr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),Ze=kr;var xr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),qe=xr;var Lr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),e("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),X=Lr;var Mr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),Je=Mr;var Vr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),e("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),Xe=Vr;var Er=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),Ye=Er;var Tr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),te=Tr;import{useThrottle as Hr}from"react-use";import{v4 as Fr}from"uuid";import Dr,{useState as Gr,useRef as dt,useEffect as zr}from"react";function je(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as Ur}from"timeago.js";import{css as E}from"@emotion/react";import{mq as Ir}from"@uniformdev/design-system";var et=E`
154
+ border: 1px solid var(--gray-200);
155
+ background: var(--gray-50);
156
+ border-radius: var(--rounded-base);
157
+ display: flex;
158
+ width: 100%;
159
+ `,tt=E`
160
+ align-items: center;
161
+ display: flex;
162
+ flex-grow: 1;
163
+ gap: var(--spacing-sm);
164
+ margin-inline: 0 var(--spacing-sm);
165
+ padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
166
+ position: relative;
167
+ `,rt=E`
168
+ flex-grow: 1;
169
+ `,ot=E`
170
+ align-items: start;
171
+ display: inline-flex;
172
+ position: relative;
173
+ `,nt=E`
174
+ color: var(--brand-secondary-1);
175
+ font-size: var(--fs-base);
176
+ font-weight: var(--fw-bold);
177
+ line-height: 1;
178
+ `,at=E`
179
+ width: 1.5rem;
180
+ height: 1.5rem;
181
+ `,it=E`
182
+ width: 1rem;
183
+ height: 1rem;
184
+ `,st=E`
185
+ background: var(--white);
186
+ border-radius: var(--rounded-base);
187
+ border-left: 4px solid var(--brand-secondary-3);
188
+ box-shadow: var(--shadow-base);
189
+ position: fixed;
190
+ padding: var(--spacing-base);
191
+ z-index: var(--z-10);
192
+ width: max-content;
193
+ `,$=E`
194
+ font-size: var(--fs-sm);
195
+ `,pe=E`
196
+ font-weight: var(--fw-bold);
197
+ margin-right: var(--spacing-sm);
198
+ `,ct=E`
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: var(--spacing-sm);
202
+
203
+ ${Ir("md")} {
204
+ flex-direction: row;
205
+ min-width: 200px;
206
+ }
207
+ `,ve=E`
208
+ align-items: center;
209
+ background: var(--white);
210
+ border-radius: var(--rounded-base);
211
+ border: 2px solid var(--gray-300);
212
+ display: flex;
213
+ gap: var(--spacing-sm);
214
+ padding: var(--spacing-sm) var(--spacing-base);
215
+ justify-content: space-between;
216
+
217
+ &:hover {
218
+ background: var(--gray-50);
219
+ }
220
+ `;import{css as z}from"@emotion/react";var lt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var b;let i=dt(null),d=dt(null),[m,v]=Gr(!1);zr(()=>{let a=S=>{i.current&&!i.current.contains(S.target)&&d.current&&!d.current.contains(S.target)&&v(!1)},g=()=>{v(!1)};return window.addEventListener("resize",g,!0),document.addEventListener("scroll",a,!0),document.addEventListener("mousedown",a),()=>{window.removeEventListener("resize",g,!0),document.removeEventListener("scroll",a,!0),document.removeEventListener("mousedown",a)}},[d]);let h=()=>{var a;if(v(!m),d.current&&i.current){let g=(a=i==null?void 0:i.current)==null?void 0:a.getBoundingClientRect(),S=d.current.offsetWidth;d.current.style.top=`${g.top+30}px`,d.current.style.left=`${g.left-S+30}px`}};return e("div",{css:et,key:t.id},e("div",{css:tt},e("div",{css:rt},e("div",{css:ot},e("h4",{css:[nt,t.popoverData?z`
221
+ margin-bottom: var(--spacing-sm);
222
+ `:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(Dr.Fragment,null,e("button",{type:"button",ref:i,css:z`
223
+ margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
224
+ `,"aria-controls":"path-details","aria-expanded":m,onClick:h},e(X,{width:24,height:24,css:z`
225
+ color: var(--gray-400);
226
+ `})),e("div",{id:"path-details","aria-hidden":!m,ref:d,css:[st,m?z`
227
+ visibility: visible;
228
+ `:z`
229
+ visibility: hidden;
230
+ `]},Object.entries(t.popoverData).map(([a,g],S)=>e("div",{css:$,key:S},e("span",{css:pe},a,":"),g)))):null),t.createdDate&&e("div",{css:$},e("span",{css:pe},"Created:"),Ur((b=t.createdDate)!=null?b:0)),e("div",{css:z`
231
+ display: flex;
232
+ gap: var(--spacing-base);
233
+ `},t.metadata?Object.entries(t.metadata).filter(([a])=>["type","status"].includes(a.toLocaleLowerCase())).map(([a,g])=>e("span",{css:$,key:a},g)):null),t.metadata?Object.entries(t.metadata).filter(([a])=>!["type","status"].includes(a.toLocaleLowerCase())).map(([a,g])=>e("div",{css:[$,z`
234
+ order: 1;
235
+ `],key:a},e("span",{css:[pe,z`
236
+ order: 1;
237
+ `]},a,":"),g)):null),e("div",{css:ct},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:a=>{r&&(je(a.currentTarget.href,()=>r(t)),a.preventDefault())},css:ve},e("span",{css:$},"Edit"),e(H,{src:n,css:at,alt:"Logo"})):null,e("button",{type:"button",onClick:a=>{a.preventDefault(),o(t)},css:ve},e("span",{css:$},"Unlink"),e(J,{css:[it,z`
238
+ color: var(--brand-secondary-5);
239
+ `]})))))};import Ar,{useState as Br,useRef as vt,useEffect as Or}from"react";import{css as K}from"@emotion/react";var pt=K`
240
+ cursor: pointer;
241
+ padding: var(--spacing-sm);
242
+ position: relative;
243
+ transition: background-color var(--duration-fast) var(--timing-ease-out),
244
+ color var(--duration-fast) var(--timing-ease-out);
245
+ `,ut=K`
246
+ padding-right: var(--spacing-lg);
247
+ `,mt=K`
248
+ background: var(--brand-secondary-3);
249
+ color: var(--white);
250
+ `,he=K`
251
+ font-size: var(--fs-xs);
252
+ `,be=K`
253
+ font-weight: var(--fw-bold);
254
+ margin-right: var(--spacing-sm);
255
+ `,gt=K`
256
+ background: var(--white);
257
+ border-left: 4px solid var(--brand-secondary-3);
258
+ border-radius: var(--rounded-base);
259
+ box-shadow: var(--shadow-base);
260
+ color: var(--brand-secondary-1);
261
+ padding: var(--spacing-base);
262
+ position: absolute;
263
+ top: var(--spacing-base);
264
+ right: var(--spacing-xl);
265
+ z-index: var(--z-10);
266
+ width: max-content;
267
+ `,ft=K`
268
+ position: absolute;
269
+ inset: 0 var(--spacing-sm) 0 auto;
270
+ `;import{css as ht}from"@emotion/react";var bt=({result:t,isSelected:n,triggerSelection:o})=>{let r=vt(null),i=vt(null),[d,m]=Br(!1);Or(()=>{function h(b){r.current&&!r.current.contains(b.target)&&i.current&&!i.current.contains(b.target)&&m(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[i]);let v=h=>{h.stopPropagation(),m(!d)};return e("div",{key:t.id,css:[pt,n?mt:void 0,t.popoverData?ut:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(Ar.Fragment,null,e("button",{type:"button",ref:r,css:ft,"aria-controls":"path-details",onClick:h=>v(h),"aria-expanded":d},e(X,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!d,ref:i,css:[gt,d?ht`
271
+ visibility: visible;
272
+ `:ht`
273
+ visibility: hidden;
274
+ `]},t.metadata&&Object.entries(t.metadata).map(([h,b],a)=>e("div",{css:he,key:a},e("span",{css:be},h,":"),b)),Object.entries(t.popoverData).map(([h,b],a)=>e("div",{css:he,key:a},e("span",{css:be},h,":"),b)))):null)};import{Droppable as $r,DragDropContext as Kr,Draggable as Qr}from"react-beautiful-dnd";import{css as C}from"@emotion/react";var yt=C`
275
+ background: var(--white);
276
+ border: 1px solid var(--gray-300);
277
+ border-radius: var(--rounded-base);
278
+ padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
279
+ margin-bottom: var(--spacing-base);
280
+ `,St=C`
281
+ align-items: center;
282
+ display: flex;
283
+ position: relative;
284
+ font-size: var(--fs-base);
285
+ width: 100%;
286
+ background-color: transparent;
287
+ border: 0;
288
+ `,wt=C`
289
+ color: var(--brand-secondary-1);
290
+ display: block;
291
+ font-weight: var(--fw-bold);
292
+ font-size: var(--fs-sm);
293
+ padding: var(--spacing-base);
294
+ width: 100%;
295
+ text-align: center;
296
+ border: none;
297
+ background: none;
298
+
299
+ &:focus,
300
+ &:hover {
301
+ background: var(--gray-100);
302
+ outline: none;
303
+ }
304
+ `,Ct=C`
305
+ background: var(--white);
306
+ border: 1px solid var(--gray-300);
307
+ border-radius: var(--rounded-base);
308
+ padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
309
+ display: block;
310
+ `,Pt=C`
311
+ display: none;
312
+ `,Rt=C`
313
+ overflow-y: auto;
314
+ max-height: 16rem;
315
+ margin-bottom: var(--spacing-base);
316
+
317
+ & > :not(:last-child) {
318
+ border-bottom: 1px solid var(--gray-200);
319
+ }
320
+ `,Xn=C`
321
+ background-color: var(--gray-50);
322
+ max-width: 33.33%;
323
+ `,kt=C`
324
+ align-items: center;
325
+ display: flex;
326
+ position: absolute;
327
+ inset: 0 0 0 auto;
328
+ pointer-events: none;
329
+ padding-right: var(--spacing-sm);
330
+ `,xt=C`
331
+ color: var(--brand-secondary-1);
332
+ width: 1.25rem;
333
+ height: 1.25rem;
334
+ transition: transform var(--duration-fast) var(--timing-ease-out);
335
+ transform: rotate(0);
336
+ `,Yn=C`
337
+ background: var(--white);
338
+ color: var(--brand-secondary-1);
339
+ `,Lt=C`
340
+ position: relative;
341
+ margin-block: var(--spacing-sm) 0;
342
+
343
+ &:hover > span {
344
+ opacity: 0.3;
345
+ }
346
+ `,Mt=C`
347
+ align-items: center;
348
+ display: flex;
349
+ position: absolute;
350
+ inset: 0 auto 0 0;
351
+ margin-block: auto;
352
+ opacity: 0;
353
+ `,ye=C`
354
+ color: var(--brand-secondary-1);
355
+ `,Vt=C`
356
+ position: absolute;
357
+ left: 0.375rem;
358
+ `,Se=C`
359
+ width: calc(var(--spacing-lg) + var(--spacing-xs));
360
+ height: calc(var(--spacing-lg) + var(--spacing-xs));
361
+ `;import{css as I}from"@emotion/react";import{InputSelect as Nr,scrollbarStyles as _r,Button as we,Callout as Wr,InputKeywordSearch as Zr,LoadingIndicator as Et,Menu as qr,MenuItem as Jr}from"@uniformdev/design-system";var Xr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Wr,{type:"info"},o)},Tt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:i,select:d,multiSelect:m,multiSelectId:v,rowComponent:h,selectedItemComponent:b,totalResults:a,resultsLoading:g,requireContentType:S,onAddNew:N,onEditClosed:U,onCancel:w,noResultsComponent:y,helpComponent:_,onSort:F,typeSelectorLabel:D="Content Type Select",typeSelectorAllTypesOptionText:A="All content types"})=>{var Le,Me,Ve;let W=()=>S?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[B,G]=T.useState(""),[u,x]=T.useState(W),[O,Z]=T.useState(!1),[s,L]=T.useState([]),[Y,Pe]=T.useState(!1),oe=Hr(B,750);T.useEffect(()=>{t(oe,{count:5,offset:0,contentType:u==="any"?void 0:u})},[oe,u]);let _t=c=>{s.some(f=>f.id===c.id)?L(f=>f.filter(q=>q.id!==c.id)):L(m?f=>[...f,c]:[c])},Wt=()=>{x(W()),G(""),L(r!=null&&r.length?r:[])},Zt=()=>{Z(c=>!c),O||Wt()},Re=c=>{d((r==null?void 0:r.filter(f=>f.id!==c.id))||[],"")},qt=c=>{c.preventDefault(),d(s,u),Z(!1)},Jt=c=>{c.preventDefault(),Z(!1),w&&w()},Xt=c=>{c.preventDefault(),t(oe,{count:5,offset:(n==null?void 0:n.length)||0,contentType:u==="any"?void 0:u}),Pe(!0);let f=setTimeout(()=>{Pe(!1)},750);return()=>clearTimeout(f)},ge=T.useRef(Fr()),Yt=!(r==null?void 0:r.length)||m,jt=h||bt,ke=b||lt,er=y||Xr,xe=i&&typeof i!="string"?i:null,tr=xe?e(xe,{css:Se}):e("img",{src:i,alt:"Logo",css:Se}),rr=c=>{var f,q;if(c.destination&&c.source.droppableId===((f=c.destination)==null?void 0:f.droppableId)){let M=[...r||[]],[j]=(q=M==null?void 0:M.splice(c.source.index,1))!=null?q:[];return M==null||M.splice(c.destination.index,0,j),F==null||F(M),M}};return e("div",{css:I`
362
+ width: 100%;
363
+ `},e("div",{css:I`
364
+ position: relative;
365
+ margin-block: var(--spacing-base);
366
+ `},Yt&&e(T.Fragment,null,e("div",{css:yt,"data-test-id":"component-search"},e("button",{css:St,onClick:Zt,type:"button","aria-haspopup":!0,"aria-expanded":O,"aria-controls":`entry-search-config-${ge.current}`},tr,e("span",{css:I`
367
+ margin-left: var(--spacing-base);
368
+ `},"Select"),e("span",{css:kt},e(le,{css:[xt,O?I`
369
+ transform: rotate(180deg);
370
+ `:void 0]})))),e("div",{id:`entry-search-config-${ge.current}`,"aria-hidden":!O,css:[Ct,O?void 0:Pt]},_||null,e("div",{css:I`
371
+ display: flex;
372
+ gap: calc(var(--spacing-base) - 0.25rem);
373
+ margin-bottom: var(--spacing-base);
374
+ `},e(Nr,{onChange:c=>x(c.target.value),value:u,label:D,showLabel:!1,options:[...S?[]:[{value:"any",label:A}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),e("div",{css:I`
375
+ flex-grow: 1;
376
+ `},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:G,disabledFieldSubmission:!0,value:B}))),e("div",{css:[Rt,_r],id:ge.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(c=>e(jt,{key:c.id,isSelected:s.some(f=>f.id===c.id),result:c,triggerSelection:()=>_t(c)})):g?null:e(er,{searchText:oe||B,selectedContentType:(Me=(Le=o==null?void 0:o.find(c=>c.id===u))==null?void 0:Le.name)!=null?Me:u}),!g&&typeof a!="undefined"&&n&&(n==null?void 0:n.length)<a&&e("button",{css:wt,onClick:Xt},Y?e(Et,null):"Load More"),g&&!(n!=null&&n.length)?e("div",{css:I`
377
+ padding: var(--spacing-base);
378
+ text-align: center;
379
+ width: 100%;
380
+ `},e(Et,null)):null),e("div",{css:I`
381
+ display: flex;
382
+ justify-content: space-between;
383
+ `},e("div",null,N&&((Ve=o==null?void 0:o.length)!=null?Ve:0)>0?e(qr,{menuLabel:"Add new menu",menuTrigger:e(we,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>e(Jr,{key:c.id,css:I`
384
+ background: var(--white);
385
+ color: var(--brand-secondary-1);
386
+ `,onClick:()=>N(c)},c.name))):null),e("div",{css:I`
387
+ display: flex;
388
+ gap: var(--spacing-base);
389
+ `},e(we,{buttonType:"unimportant",onClick:Jt},"Cancel"),e(we,{disabled:!s.length,onClick:qt,"data-test-id":"entry-accept-button"},"Accept"))))),m?e(Kr,{onDragEnd:c=>rr(c)},e($r,{droppableId:v||"canvas-multi-select"},c=>e("div",{...c.droppableProps,ref:c.innerRef,css:I`
390
+ margin-block: var(--spacing-sm) 0;
391
+ `},r==null?void 0:r.map((f,q)=>{if(f!=null&&f.id)return e(Qr,{key:f.id,draggableId:f.id,index:q},M=>e("div",{css:Lt,ref:M.innerRef,...M.draggableProps,...M.dragHandleProps},e("span",{css:Mt},e(te,{css:[ye,Vt],width:24,height:24}),e(te,{css:ye,width:24,height:24})),e(ke,{key:`selected-item-${f.id}`,logoIcon:i,selectedItem:f,onDeselect:j=>Re(j),onEditClosed:U?j=>U(j):void 0})))}),c.placeholder))):r==null?void 0:r.map(c=>e(ke,{key:`selected-item-${c.id}`,logoIcon:i,selectedItem:c,onDeselect:f=>Re(f),onEditClosed:U?f=>U(f):void 0}))))};import{css as Q}from"@emotion/react";var It=Q`
392
+ cursor: pointer;
393
+ padding: var(--spacing-sm) 0;
394
+ margin-right: var(--spacing-sm);
395
+ position: relative;
396
+ transition: background-color var(--duration-fast) var(--timing-ease-out),
397
+ color var(--duration-fast) var(--timing-ease-out);
398
+ `,Dt=Q`
399
+ border: 2px solid transparent;
400
+ border-radius: var(--rounded-base);
401
+ display: flex;
402
+ align-items: center;
403
+ gap: var(--spacing-base);
404
+ padding: var(--spacing-sm) var(--spacing-xs);
405
+ `,Gt=Q`
406
+ background-color: var(--green-50);
407
+ `,zt=Q`
408
+ font-size: var(--fs-sm);
409
+ font-weight: var(--fw-bold);
410
+ width: 50%;
411
+ `,Ut=Q`
412
+ font-weight: var(--fw-normal);
413
+ display: block;
414
+ `,At=Q`
415
+ font-size: var(--fs-sm);
416
+ > * {
417
+ display: block;
418
+ }
419
+ `,Bt=Q`
420
+ display: block;
421
+ height: 1.5rem;
422
+ width: 1.5rem;
423
+ color: var(--brand-secondary-3);
424
+ margin-left: auto;
425
+ `;import{css as Ot}from"@emotion/react";function Ht({result:t,isSelected:n,triggerSelection:o}){var v;let{categories:r,logoIcon:i}=ue(),[d]=t.categories||[{id:"",name:""}],m=typeof d=="undefined"||!r||(v=r.find(h=>h.id===d.id))==null?void 0:v.name;return e("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[It]},e("div",{css:[Dt,n?Gt:void 0]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Ot`
426
+ background-color: var(--gray-200);
427
+ width: 3rem;
428
+ height: 3rem;
429
+ object-fit: cover;
430
+ `}):e(H,{src:i,alt:"Logo",css:Ot`
431
+ height: 2.25rem;
432
+ width: 2.25rem;
433
+ `}),e("h4",{css:[zt]},t.title,m?e("span",{css:[Ut]},m):null),e("p",{css:[At]},"SKU: ",t.sku||t.id,t.price!==void 0?e("span",null,t.price):null),n?e(de,{css:[Bt]}):null))}import{css as me}from"@emotion/react";import{mq as Yr}from"@uniformdev/design-system";var Ft=me`
434
+ display: flex;
435
+ width: 100%;
436
+ border: 1px solid var(--gray-300);
437
+ border-radius: var(--rounded-base);
438
+ background-color: var(--gray-100);
439
+ margin: var(--spacing-base) 0;
440
+ `,$t=me`
441
+ padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
442
+ display: flex;
443
+ flex-grow: 1;
444
+ align-items: center;
445
+ margin-right: var(--spacing-sm);
446
+ gap: var(--spacing-base);
447
+ `,Kt=me`
448
+ display: flex;
449
+ align-items: center;
450
+ gap: var(--spacing-sm);
451
+ ${Yr("lg")} {
452
+ width: 50%;
453
+ margin-bottom: 0;
454
+ }
455
+ `,Ce=me`
456
+ background-color: var(--gray-200);
457
+ width: 3.5rem;
458
+ height: 3.5rem;
459
+ object-fit: cover;
460
+ `;import{css as k}from"@emotion/react";import{mq as jr}from"@uniformdev/design-system";function Qt({selectedItem:t,onDeselect:n}){var m;let{categories:o,logoIcon:r}=ue(),[i]=t.categories||[{id:"",name:""}],d=typeof i=="undefined"||!o||(m=o.find(v=>v.id===i.id))==null?void 0:m.name;return e("div",{css:[Ft],key:t.id},e("article",{css:[$t]},e("div",{css:[Kt]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:d,css:[Ce],loading:"lazy"}):e("div",{css:[Ce]}),e("div",{css:k`
461
+ > :not(:last-child) {
462
+ margin-bottom: var(--spacing-xs);
463
+ }
464
+ `},e("h4",{css:k`
465
+ font-weight: var(--fw-bold);
466
+ `},t.title||t.id||"",d&&e("span",{css:k`
467
+ display: block;
468
+ font-weight: var(--fw-regular);
469
+ `},d)),e("ul",{css:k`
470
+ font-size: var(--fs-sm);
471
+ display: flex;
472
+ gap: var(--spacing-base);
473
+ `},e("li",null,e("span",{css:k`
474
+ margin-right: var(--spacing-xs);
475
+ `},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:k`
476
+ margin-right: var(--spacing-xs);
477
+ `},"Price:"),e("span",null,t.price)):null))),e("div",{css:k`
478
+ display: flex;
479
+ flex-wrap: wrap;
480
+ gap: var(--spacing-sm);
481
+ justify-content: flex-end;
482
+ margin-left: auto;
483
+ ${jr("md")} {
484
+ align-items: center;
485
+ }
486
+ `},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:k`
487
+ display: inline-flex;
488
+ justify-content: space-between;
489
+ align-items: center;
490
+ padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
491
+ background-color: var(--white);
492
+ border-radius: var(--rounded-base);
493
+ border: 2px solid var(--gray-400);
494
+ &:hover {
495
+ background-color: var(--gray-100);
496
+ }
497
+ `},e("span",{css:k`
498
+ margin-right: var(--spacing-sm);
499
+ font-size: var(--fs-sm);
500
+ `},"Edit"),e(H,{src:r,alt:"Logo",css:k`
501
+ width: 1.75rem;
502
+ height: 1.75rem;
503
+ display: block;
504
+ `})):null,e("button",{type:"button",onClick:v=>{v.preventDefault(),n==null||n(t)},css:k`
505
+ display: flex;
506
+ justify-content: space-between;
507
+ align-items: center;
508
+ background-color: var(--white);
509
+ border-radius: var(--rounded-base);
510
+ border: 2px solid var(--gray-400);
511
+ height: 2.5rem;
512
+ padding: 0 var(--spacing-base);
513
+ gap: var(--spacing-sm);
514
+ &:hover {
515
+ background-color: var(--gray-100);
516
+ }
517
+ `},e("span",{css:k`
518
+ font-size: var(--fs-sm);
519
+ `},"Unlink"),e(J,{css:k`
520
+ color: var(--brand-secondary-5);
521
+ `})))))}import{Callout as no,LoadingIndicator as ao}from"@uniformdev/design-system";import{useAsync as io,useAsyncFn as so}from"react-use";function Ha({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:i,multiSelect:d,multiSelectId:m,selectedItemComponent:v,rowComponent:h,errorComponent:b,helpComponent:a,noResultsComponent:g,onSort:S,typeSelectorAllTypesOptionText:N="All categories",typeSelectorLabel:U="Select Category"}){var B;let{value:w,loading:y,error:_}=io(async()=>await o(),[o]),F=ro(()=>w?w.map(u=>({id:u.id,name:u.name})):void 0,[w]),D=oo(),[A,re]=so(async(G,u)=>{let x=await r({text:G,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType}});return(u==null?void 0:u.offset)===0&&(D.current=[]),(D.current=D.current||[]).push(...x.products),x},[r]),W=async G=>{await n(G)};return y?e(ao,null):_||A.error?e(b||(({categoriesError:u,searchError:x})=>e(no,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(x==null?void 0:x.message))),{categoriesError:_,searchError:A.error}):e(Nt.Provider,{value:{categories:w,logoIcon:i}},e(Tt,{search:re,results:D.current,logoIcon:i,selectedItems:t,select:W,multiSelectId:m||"product-search-multi-select",multiSelect:d,contentTypes:F,selectedItemComponent:v||Qt,rowComponent:h||Ht,totalResults:(B=A.value)==null?void 0:B.total,resultsLoading:A.loading,helpComponent:a,noResultsComponent:g,onSort:S,typeSelectorAllTypesOptionText:N,typeSelectorLabel:U}))}var Nt=eo.createContext(void 0),ue=()=>{let t=to(Nt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as qa,Callout as Ja,LoadingIndicator as Xa,LoadingOverlay as Ya,Menu as ja,MenuItem as ei,Input as ti,InputSelect as ri,InputToggle as oi,Theme as ni,InputKeywordSearch as ai,Heading as ii,ScrollableList as si,ScrollableListItem as ci,Textarea as di,Switch as li,Label as pi}from"@uniformdev/design-system";export{qa as Button,Ja as Callout,bt as DefaultSearchRow,lt as DefaultSelectedItem,Tt as EntrySearch,ii as Heading,fe as Icons,ti as Input,ri as InputSelect,oi as InputToggle,ai as KeywordSearchInput,pi as Label,Xa as LoadingIndicator,Ya as LoadingOverlay,ja as Menu,ei as MenuItem,Ne as ProductPreviewList,Xo as ProductQuery,Ke as ProductQueryContext,Ha as ProductSearch,Nt as ProductSearchContext,Ht as ProductSearchRow,Qt as ProductSelectedItem,Ae as ResolvableLoadingValue,si as ScrollableList,ci as ScrollableListItem,Be as SelectionField,li as Switch,di as Textarea,ni as Theme,Ee as UniformMeshLocationContext,Te as UniformMeshLocationContextProvider,Ge as UniformMeshSdkContext,Mo as UniformMeshSdkContextProvider,Se as badgeIcon,Lt as draggableContainer,ye as draggableIcon,Vt as draggableIconOffset,Mt as draggableIconWrapper,St as entrySearchBtn,Ct as entrySearchConfig,Pt as entrySearchConfigHidden,wt as entrySearchLoadMoreBtn,Rt as entrySearchResultList,kt as entrySearchSelectIcon,xt as entrySearchSelectImg,Xn as entrySearchSelectInput,Yn as entrySearchSelectOption,yt as entrySearchWrapper,Bt as productSearchRowActiveIcon,Ut as productSearchRowCategory,It as productSearchRowContainer,Dt as productSearchRowContent,Gt as productSearchRowContentActive,At as productSearchRowDetails,zt as productSearchRowTitle,Ft as productSelectedItemContainer,Kt as productSelectedItemContent,$t as productSelectedItemDetails,Ce as productSelectedItemImage,ft as searchRowBtn,pt as searchRowContainer,mt as searchRowContainerActive,ut as searchRowContainerWithPopover,gt as searchRowPopover,be as searchRowText,he as searchRowTextSmall,ve as selectItemLinkBtn,ct as selectItemLinkContainer,st as selectItemPopover,pe as selectItemPopoverLabel,$ as selectItemSmallText,it as selectedItemCloseIcon,et as selectedItemContainer,ot as selectedItemCopy,rt as selectedItemDetails,at as selectedItemIcon,tt as selectedItemInner,nt as selectedItemTitle,Co as useInitializeUniformMeshSdk,Qe as useProductQueryContext,ue as useProductSearchContext,ho as useUniformMeshLocation,Ie as useUniformMeshLocationContext,To as useUniformMeshSdk,ze as useUniformMeshSdkContext};