@uniformdev/mesh-sdk-react 15.0.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1 +1,517 @@
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&&r.disabled?"text-gray-500":"text-primary"} ${t||""}`,g=v=>{let h={...v};if(h.onClick){let b=h.onClick;h.onClick=m=>{s.hide(),b(m)}}return h};if(typeof e=="function")return B.createElement(Fe,{...s,...r,className:f},v=>{let h=o?g(v):v,b=e(h);return n?Ke(b,n):b});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&&o.closed&&(clearInterval(n),t())},500)}import{format as $t}from"timeago.js";var Re=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:n})=>{var b;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((b=e.createdDate)!=null?b: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:b,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&&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 C=[...n||[]],[Y]=(k=C==null?void 0:C.splice(a.source.index,1))!=null?k:[];return C==null||C.splice(a.destination.index,0,Y),q==null||q(C.map(T=>T.id)),C}};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),value:M},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"},!b&&Array.isArray(t)?t.map(a=>i.createElement(at,{key:a.id,isSelected:$.includes(a.id),result:a,triggerSelection:()=>Qe(a)})):b?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}),!b&&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"),b&&!(t!=null&&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&&c.id)return i.createElement(Zt,{key:c.id,draggableId:c.id,index:k},(C,Y)=>i.createElement("div",{className:"relative group",ref:C.innerRef,...C.draggableProps,...C.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 y from"react";var _n=({isActive:e,statusMessage:t})=>y.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}},y.createElement("div",{className:"absolute bottom-0 left-0 right-0 top-0 bg-white bg-opacity-50"}),y.createElement("div",{className:"relative"},y.createElement("div",{className:"flex flex-col items-center"},y.createElement(Wt,{height:128,width:128}),t?y.createElement("div",{className:"mt-4 text-gray-500"},t):null))),Wt=({height:e,width:t})=>y.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"},y.createElement("g",{fill:"none",fillRule:"evenodd"},y.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},y.createElement("circle",{strokeOpacity:".25",cx:"18",cy:"18",r:"18"}),y.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18",transform:"rotate(166.645 18 18)"},y.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 rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as V from"react";import{createContext as nr,useContext as ar,useState as ir}from"react";var Ee=nr(void 0),Te=({children:t})=>{let[n,o]=ir(),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=>{await i.setValue(d),o(window.UniformMeshSDK.getCurrentLocation())}}}}return e(Ee.Provider,{value:r},t)},Ie=()=>{let t=ar(Ee);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function vo(){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()}}import{initializeUniformMeshSDK as sr}from"@uniformdev/mesh-sdk";import{useEffect as cr,useState as De}from"react";var wo=({autoResizingDisabled:t}={})=>{let[n,o]=De(),[r,i]=De();return cr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?sr({autoResizingDisabled:t}).then(d=>{i(d)}).catch(d=>{o(d)}):i(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as dr,useContext as lr}from"react";import{Theme as pr}from"@uniformdev/design-system";var Ge=dr(void 0),xo=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e(Ge.Provider,{value:n},e(pr,null),e(Te,null,t))},ze=()=>{let t=lr(Ge);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Eo(){let{sdk:t}=ze();return t}import _e from"react";import fr,{useMemo as ie,useContext as vr}from"react";import{css as ee}from"@emotion/react";import{InputSelect as ur}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 f=(b=i==null?void 0:i.filter(a=>!(r!=null&&r.includes(a.id.toString()))))!=null?b:[],v=(a,h)=>{a.preventDefault(),m(h)};return e("div",null,e(ur,{id:t,name:t,label:n,onChange:a=>d(a.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.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 h;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:(h=i.find(w=>w.id===a))==null?void 0:h.name})),e("button",{css:ee`
16
+ padding: var(--spacing-3);
17
+ border-left: 1px solid var(--gray-300);
18
+ `,title:"remove",onClick:w=>v(w,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 mr=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=mr;var gr=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=gr;import{useAsyncFn as hr,useDebounce as br}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"},Jo=({value:t,setValue:n,brands:o,categories:r,loading:i,categoriesLoading:d,brandsLoading:m,logoIcon:f,onGetProducts:v,sortOptions:b,sortOrderOptions:a,categoryLabel:h="Product Category",brandLabel:w="Brand",disableBrands:Q,restrictToSingleCategory:U=!1})=>{var L,O,Z;let S=async s=>{n({...He,...t||{},...s})},y=ie(()=>({...He,...t||{}}),[t]),[N,F]=hr(async s=>await v(s),[v]);br(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(x=>{let Y=$e(x,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]),_=s=>{let x=(t==null?void 0:t.categories)||[];S({categories:[...x,s]})},B=s=>{var x;S({categories:(x=t==null?void 0:t.categories)==null?void 0:x.filter(Y=>Y!==s)})},G=s=>{S({brand:s.target.value})},u=s=>{S({count:s||1})};return i?e("div",null,"Loading..."):e(Ke.Provider,{value:{categories:r,logoIcon:f}},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:h,disabled:i,value:(O=(L=y.categories)==null?void 0:L[0])!=null?O:"",options:A,onChange:s=>{S({categories:s.target.value===""?[]:[s.target.value]})}}):e(Be,{loading:d||!1,id:"selection-field-product-category",label:h,onAdd:_,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
+ `},Q?null:e("div",{css:P`
36
+ width: 50%;
37
+ `},e(se,{id:"brand",name:"brand",label:w,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=>S({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=>S({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=>S({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=N.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 f=$e(m,i);o.push(...f)}),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=fr.createContext(void 0),Qe=()=>{let t=vr(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 yr}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
+ `,yr]},t==null?void 0:t.map((r,i)=>{var f;let[d]=(r==null?void 0:r.categories)||[],m=typeof d=="undefined"||!n||(f=n.find(v=>v.id===d.id))==null?void 0:f.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 jr,{useContext as eo,useMemo as to,useRef as ro}from"react";import*as T from"react";var fe={};or(fe,{Caution:()=>Ze,Checkmark:()=>de,ChevronDown:()=>le,Close:()=>q,Danger:()=>We,ExclamationPoint:()=>qe,Info:()=>J,Lightbulb:()=>Je,MagnifyingGlass:()=>Xe,MaximizeAlt:()=>Ye,Minus:()=>ae,MoreVerticalAlt:()=>te,Plus:()=>ne});var Sr=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"})),Ze=Sr;var wr=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=wr;var Cr=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=Cr;var Pr=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"}))),q=Pr;var Rr=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"})),We=Rr;var kr=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=kr;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"})),J=Lr;var xr=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=xr;var Mr=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=Mr;var Vr=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=Vr;var Er=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=Er;import{useThrottle as Or}from"react-use";import{v4 as Hr}from"uuid";import Ir,{useState as Dr,useRef as dt,useEffect as Gr}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 zr}from"timeago.js";import{css as E}from"@emotion/react";import{mq as Tr}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
+ position: fixed;
189
+ padding: var(--spacing-base);
190
+ z-index: var(--z-10);
191
+ width: max-content;
192
+ `,$=E`
193
+ font-size: var(--fs-sm);
194
+ `,pe=E`
195
+ font-weight: var(--fw-bold);
196
+ margin-right: var(--spacing-sm);
197
+ `,ct=E`
198
+ display: flex;
199
+ flex-direction: column;
200
+ gap: var(--spacing-sm);
201
+
202
+ ${Tr("md")} {
203
+ flex-direction: row;
204
+ }
205
+ `,ve=E`
206
+ align-items: center;
207
+ background: var(--white);
208
+ border-radius: var(--rounded-base);
209
+ border: 2px solid var(--gray-300);
210
+ display: flex;
211
+ gap: var(--spacing-sm);
212
+ padding: var(--spacing-sm) var(--spacing-base);
213
+ justify-content: space-between;
214
+
215
+ &:hover {
216
+ background: var(--gray-50);
217
+ }
218
+ `;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,f]=Dr(!1);Gr(()=>{let a=w=>{i.current&&!i.current.contains(w.target)&&d.current&&!d.current.contains(w.target)&&f(!1)},h=()=>{f(!1)};return window.addEventListener("resize",h,!0),document.addEventListener("scroll",a,!0),document.addEventListener("mousedown",a),()=>{window.removeEventListener("resize",h,!0),document.removeEventListener("scroll",a,!0),document.removeEventListener("mousedown",a)}},[d]);let v=()=>{var a;if(f(!m),d.current&&i.current){let h=(a=i==null?void 0:i.current)==null?void 0:a.getBoundingClientRect();d.current.style.top=`${h.top+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`
219
+ margin-bottom: var(--spacing-sm);
220
+ `:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(Ir.Fragment,null,e("button",{type:"button",ref:i,css:z`
221
+ margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
222
+ `,"aria-controls":"path-details","aria-expanded":m,onClick:v},e(J,{width:24,height:24,css:z`
223
+ color: var(--gray-400);
224
+ `})),e("div",{id:"path-details","aria-hidden":!m,ref:d,css:[st,m?z`
225
+ visibility: visible;
226
+ `:z`
227
+ visibility: hidden;
228
+ `]},Object.entries(t.popoverData).map(([a,h],w)=>e("div",{css:$,key:w},e("span",{css:pe},a,":"),h)))):null),t.createdDate&&e("div",{css:$},e("span",{css:pe},"Created:"),zr((b=t.createdDate)!=null?b:0)),e("div",{css:z`
229
+ display: flex;
230
+ gap: var(--spacing-base);
231
+ `},t.metadata?Object.entries(t.metadata).filter(([a])=>["type","status"].includes(a.toLocaleLowerCase())).map(([a,h])=>e("span",{css:$,key:a},h)):null),t.metadata?Object.entries(t.metadata).filter(([a])=>!["type","status"].includes(a.toLocaleLowerCase())).map(([a,h])=>e("div",{css:[$,z`
232
+ order: 1;
233
+ `],key:a},e("span",{css:[pe,z`
234
+ order: 1;
235
+ `]},a,":"),h)):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(q,{css:[it,z`
236
+ color: var(--brand-secondary-5);
237
+ `]})))))};import Ur,{useState as Ar,useRef as ft,useEffect as Br}from"react";import{css as X}from"@emotion/react";var pt=X`
238
+ cursor: pointer;
239
+ padding: var(--spacing-sm);
240
+ position: relative;
241
+ transition: background-color var(--duration-fast) var(--timing-ease-out),
242
+ color var(--duration-fast) var(--timing-ease-out);
243
+ `,ut=X`
244
+ background: var(--brand-secondary-3);
245
+ color: var(--white);
246
+ `,he=X`
247
+ font-size: var(--fs-xs);
248
+ `,be=X`
249
+ font-weight: var(--fw-bold);
250
+ margin-right: var(--spacing-sm);
251
+ `,mt=X`
252
+ background: var(--white);
253
+ border-left: 4px solid var(--brand-secondary-3);
254
+ border-radius: var(--rounded-base);
255
+ box-shadow: var(--shadow-base);
256
+ color: var(--brand-secondary-1);
257
+ padding: var(--spacing-base);
258
+ position: absolute;
259
+ top: var(--spacing-base);
260
+ right: var(--spacing-xl);
261
+ z-index: var(--z-10);
262
+ width: max-content;
263
+ `,gt=X`
264
+ position: absolute;
265
+ inset: 0 var(--spacing-sm) 0 auto;
266
+ `;import{css as vt}from"@emotion/react";var ht=({result:t,isSelected:n,triggerSelection:o})=>{let r=ft(null),i=ft(null),[d,m]=Ar(!1);Br(()=>{function v(b){r.current&&!r.current.contains(b.target)&&i.current&&!i.current.contains(b.target)&&m(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[i]);let f=v=>{v.stopPropagation(),m(!d)};return e("div",{key:t.id,css:[pt,n?ut:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(Ur.Fragment,null,e("button",{type:"button",ref:r,css:gt,"aria-controls":"path-details",onClick:v=>f(v),"aria-expanded":d},e(J,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!d,ref:i,css:[mt,d?vt`
267
+ visibility: visible;
268
+ `:vt`
269
+ visibility: hidden;
270
+ `]},t.metadata&&Object.entries(t.metadata).map(([v,b],a)=>e("div",{css:he,key:a},e("span",{css:be},v,":"),b)),Object.entries(t.popoverData).map(([v,b],a)=>e("div",{css:he,key:a},e("span",{css:be},v,":"),b)))):null)};import{Droppable as Fr,DragDropContext as $r,Draggable as Kr}from"react-beautiful-dnd";import{css as C}from"@emotion/react";var bt=C`
271
+ background: var(--white);
272
+ border: 1px solid var(--gray-300);
273
+ border-radius: var(--rounded-base);
274
+ padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
275
+ margin-bottom: var(--spacing-base);
276
+ `,yt=C`
277
+ align-items: center;
278
+ display: flex;
279
+ position: relative;
280
+ font-size: var(--fs-base);
281
+ width: 100%;
282
+ background-color: transparent;
283
+ border: 0;
284
+ `,St=C`
285
+ color: var(--brand-secondary-1);
286
+ display: block;
287
+ font-weight: var(--fw-bold);
288
+ font-size: var(--fs-sm);
289
+ padding: var(--spacing-base);
290
+ width: 100%;
291
+ text-align: center;
292
+ border: none;
293
+ background: none;
294
+
295
+ &:focus,
296
+ &:hover {
297
+ background: var(--gray-100);
298
+ outline: none;
299
+ }
300
+ `,wt=C`
301
+ background: var(--white);
302
+ border: 1px solid var(--gray-300);
303
+ border-radius: var(--rounded-base);
304
+ padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
305
+ display: block;
306
+ `,Ct=C`
307
+ display: none;
308
+ `,Pt=C`
309
+ overflow-y: auto;
310
+ max-height: 16rem;
311
+ margin-bottom: var(--spacing-base);
312
+
313
+ & > :not(:last-child) {
314
+ border-bottom: 1px solid var(--gray-200);
315
+ }
316
+ `,Jn=C`
317
+ background-color: var(--gray-50);
318
+ max-width: 33.33%;
319
+ `,Rt=C`
320
+ align-items: center;
321
+ display: flex;
322
+ position: absolute;
323
+ inset: 0 0 0 auto;
324
+ pointer-events: none;
325
+ padding-right: var(--spacing-sm);
326
+ `,kt=C`
327
+ color: var(--brand-secondary-1);
328
+ width: 1.25rem;
329
+ height: 1.25rem;
330
+ transition: transform var(--duration-fast) var(--timing-ease-out);
331
+ transform: rotate(0);
332
+ `,Xn=C`
333
+ background: var(--white);
334
+ color: var(--brand-secondary-1);
335
+ `,Lt=C`
336
+ position: relative;
337
+ margin-block: var(--spacing-sm) 0;
338
+
339
+ &:hover > span {
340
+ opacity: 0.3;
341
+ }
342
+ `,xt=C`
343
+ align-items: center;
344
+ display: flex;
345
+ position: absolute;
346
+ inset: 0 auto 0 0;
347
+ margin-block: auto;
348
+ opacity: 0;
349
+ `,ye=C`
350
+ color: var(--brand-secondary-1);
351
+ `,Mt=C`
352
+ position: absolute;
353
+ left: 0.375rem;
354
+ `,Se=C`
355
+ width: calc(var(--spacing-lg) + var(--spacing-xs));
356
+ height: calc(var(--spacing-lg) + var(--spacing-xs));
357
+ `;import{css as I}from"@emotion/react";import{InputSelect as Qr,scrollbarStyles as Nr,Button as we,Callout as _r,InputKeywordSearch as Zr,LoadingIndicator as Vt,Menu as Wr,MenuItem as qr}from"@uniformdev/design-system";var Jr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(_r,{type:"info"},o)},Et=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:i,select:d,multiSelect:m,multiSelectId:f,rowComponent:v,selectedItemComponent:b,totalResults:a,resultsLoading:h,requireContentType:w,onAddNew:Q,onEditClosed:U,onCancel:S,noResultsComponent:y,helpComponent:N,onSort:F,typeSelectorLabel:D="Content Type Select",typeSelectorAllTypesOptionText:A="All content types"})=>{var xe,Me,Ve;let _=()=>w?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[B,G]=T.useState(""),[u,L]=T.useState(_),[O,Z]=T.useState(!1),[s,x]=T.useState([]),[Y,Pe]=T.useState(!1),oe=Or(B,750);T.useEffect(()=>{t(oe,{count:5,offset:0,contentType:u==="any"?void 0:u})},[oe,u]);let Nt=c=>{s.some(g=>g.id===c.id)?x(g=>g.filter(W=>W.id!==c.id)):x(m?g=>[...g,c]:[c])},_t=()=>{L(_()),G(""),x(r!=null&&r.length?r:[])},Zt=()=>{Z(c=>!c),O||_t()},Re=c=>{d((r==null?void 0:r.filter(g=>g.id!==c.id))||[],"")},Wt=c=>{c.preventDefault(),d(s,u),Z(!1)},qt=c=>{c.preventDefault(),Z(!1),S&&S()},Jt=c=>{c.preventDefault(),t(oe,{count:5,offset:(n==null?void 0:n.length)||0,contentType:u==="any"?void 0:u}),Pe(!0);let g=setTimeout(()=>{Pe(!1)},750);return()=>clearTimeout(g)},ge=T.useRef(Hr()),Xt=!(r==null?void 0:r.length)||m,Yt=v||ht,ke=b||lt,jt=y||Jr,Le=i&&typeof i!="string"?i:null,er=Le?e(Le,{css:Se}):e("img",{src:i,alt:"Logo",css:Se}),tr=c=>{var g,W;if(c.destination&&c.source.droppableId===((g=c.destination)==null?void 0:g.droppableId)){let M=[...r||[]],[j]=(W=M==null?void 0:M.splice(c.source.index,1))!=null?W:[];return M==null||M.splice(c.destination.index,0,j),F==null||F(M),M}};return e("div",{css:I`
358
+ width: 100%;
359
+ `},e("div",{css:I`
360
+ position: relative;
361
+ margin-block: var(--spacing-base);
362
+ `},Xt&&e(T.Fragment,null,e("div",{css:bt,"data-test-id":"component-search"},e("button",{css:yt,onClick:Zt,type:"button","aria-haspopup":!0,"aria-expanded":O,"aria-controls":`entry-search-config-${ge.current}`},er,e("span",{css:I`
363
+ margin-left: var(--spacing-base);
364
+ `},"Select"),e("span",{css:Rt},e(le,{css:[kt,O?I`
365
+ transform: rotate(180deg);
366
+ `:void 0]})))),e("div",{id:`entry-search-config-${ge.current}`,"aria-hidden":!O,css:[wt,O?void 0:Ct]},N||null,e("div",{css:I`
367
+ display: flex;
368
+ gap: calc(var(--spacing-base) - 0.25rem);
369
+ margin-bottom: var(--spacing-base);
370
+ `},e(Qr,{onChange:c=>L(c.target.value),value:u,label:D,showLabel:!1,options:[...w?[]:[{value:"any",label:A}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),e("div",{css:I`
371
+ flex-grow: 1;
372
+ `},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:G,disabledFieldSubmission:!0,value:B}))),e("div",{css:[Pt,Nr],id:ge.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!h&&Array.isArray(n)?n.map(c=>e(Yt,{key:c.id,isSelected:s.some(g=>g.id===c.id),result:c,triggerSelection:()=>Nt(c)})):h?null:e(jt,{searchText:oe||B,selectedContentType:(Me=(xe=o==null?void 0:o.find(c=>c.id===u))==null?void 0:xe.name)!=null?Me:u}),!h&&typeof a!="undefined"&&n&&(n==null?void 0:n.length)<a&&e("button",{css:St,onClick:Jt},Y?e(Vt,null):"Load More"),h&&!(n!=null&&n.length)?e("div",{css:I`
373
+ padding: var(--spacing-base);
374
+ text-align: center;
375
+ width: 100%;
376
+ `},e(Vt,null)):null),e("div",{css:I`
377
+ display: flex;
378
+ justify-content: space-between;
379
+ `},e("div",null,Q&&((Ve=o==null?void 0:o.length)!=null?Ve:0)>0?e(Wr,{menuLabel:"Add new menu",menuTrigger:e(we,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>e(qr,{key:c.id,css:I`
380
+ background: var(--white);
381
+ color: var(--brand-secondary-1);
382
+ `,onClick:()=>Q(c)},c.name))):null),e("div",{css:I`
383
+ display: flex;
384
+ gap: var(--spacing-base);
385
+ `},e(we,{buttonType:"unimportant",onClick:qt},"Cancel"),e(we,{disabled:!s.length,onClick:Wt,"data-test-id":"entry-accept-button"},"Accept"))))),m?e($r,{onDragEnd:c=>tr(c)},e(Fr,{droppableId:f||"canvas-multi-select"},c=>e("div",{...c.droppableProps,ref:c.innerRef,css:I`
386
+ margin-block: var(--spacing-sm) 0;
387
+ `},r==null?void 0:r.map((g,W)=>{if(g!=null&&g.id)return e(Kr,{key:g.id,draggableId:g.id,index:W},M=>e("div",{css:Lt,ref:M.innerRef,...M.draggableProps,...M.dragHandleProps},e("span",{css:xt},e(te,{css:[ye,Mt],width:24,height:24}),e(te,{css:ye,width:24,height:24})),e(ke,{key:`selected-item-${g.id}`,logoIcon:i,selectedItem:g,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:g=>Re(g),onEditClosed:U?g=>U(g):void 0}))))};import{css as K}from"@emotion/react";var Tt=K`
388
+ cursor: pointer;
389
+ padding: var(--spacing-sm) 0;
390
+ margin-right: var(--spacing-sm);
391
+ position: relative;
392
+ transition: background-color var(--duration-fast) var(--timing-ease-out),
393
+ color var(--duration-fast) var(--timing-ease-out);
394
+ `,It=K`
395
+ border: 2px solid transparent;
396
+ border-radius: var(--rounded-base);
397
+ display: flex;
398
+ align-items: center;
399
+ gap: var(--spacing-base);
400
+ padding: var(--spacing-sm) var(--spacing-xs);
401
+ `,Dt=K`
402
+ background-color: var(--green-50);
403
+ `,Gt=K`
404
+ font-size: var(--fs-sm);
405
+ font-weight: var(--fw-bold);
406
+ width: 50%;
407
+ `,zt=K`
408
+ font-weight: var(--fw-normal);
409
+ display: block;
410
+ `,Ut=K`
411
+ font-size: var(--fs-sm);
412
+ > * {
413
+ display: block;
414
+ }
415
+ `,At=K`
416
+ display: block;
417
+ height: 1.5rem;
418
+ width: 1.5rem;
419
+ color: var(--brand-secondary-3);
420
+ margin-left: auto;
421
+ `;import{css as Bt}from"@emotion/react";function Ot({result:t,isSelected:n,triggerSelection:o}){var f;let{categories:r,logoIcon:i}=ue(),[d]=t.categories||[{id:"",name:""}],m=typeof d=="undefined"||!r||(f=r.find(v=>v.id===d.id))==null?void 0:f.name;return e("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Tt]},e("div",{css:[It,n?Dt:void 0]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Bt`
422
+ background-color: var(--gray-200);
423
+ width: 3rem;
424
+ height: 3rem;
425
+ object-fit: cover;
426
+ `}):e(H,{src:i,alt:"Logo",css:Bt`
427
+ height: 2.25rem;
428
+ width: 2.25rem;
429
+ `}),e("h4",{css:[Gt]},t.title,m?e("span",{css:[zt]},m):null),e("p",{css:[Ut]},"SKU: ",t.sku||t.id,t.price!==void 0?e("span",null,t.price):null),n?e(de,{css:[At]}):null))}import{css as me}from"@emotion/react";import{mq as Xr}from"@uniformdev/design-system";var Ht=me`
430
+ display: flex;
431
+ width: 100%;
432
+ border: 1px solid var(--gray-300);
433
+ border-radius: var(--rounded-base);
434
+ background-color: var(--gray-100);
435
+ margin: var(--spacing-base) 0;
436
+ `,Ft=me`
437
+ padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
438
+ display: flex;
439
+ flex-grow: 1;
440
+ align-items: center;
441
+ margin-right: var(--spacing-sm);
442
+ gap: var(--spacing-base);
443
+ `,$t=me`
444
+ display: flex;
445
+ align-items: center;
446
+ gap: var(--spacing-sm);
447
+ ${Xr("lg")} {
448
+ width: 50%;
449
+ margin-bottom: 0;
450
+ }
451
+ `,Ce=me`
452
+ background-color: var(--gray-200);
453
+ width: 3.5rem;
454
+ height: 3.5rem;
455
+ object-fit: cover;
456
+ `;import{css as k}from"@emotion/react";import{mq as Yr}from"@uniformdev/design-system";function Kt({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(f=>f.id===i.id))==null?void 0:m.name;return e("div",{css:[Ht],key:t.id},e("article",{css:[Ft]},e("div",{css:[$t]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:d,css:[Ce],loading:"lazy"}):e("div",{css:[Ce]}),e("div",{css:k`
457
+ > :not(:last-child) {
458
+ margin-bottom: var(--spacing-xs);
459
+ }
460
+ `},e("h4",{css:k`
461
+ font-weight: var(--fw-bold);
462
+ `},t.title||t.id||"",d&&e("span",{css:k`
463
+ display: block;
464
+ font-weight: var(--fw-regular);
465
+ `},d)),e("ul",{css:k`
466
+ font-size: var(--fs-sm);
467
+ display: flex;
468
+ gap: var(--spacing-base);
469
+ `},e("li",null,e("span",{css:k`
470
+ margin-right: var(--spacing-xs);
471
+ `},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:k`
472
+ margin-right: var(--spacing-xs);
473
+ `},"Price:"),e("span",null,t.price)):null))),e("div",{css:k`
474
+ display: flex;
475
+ flex-wrap: wrap;
476
+ gap: var(--spacing-sm);
477
+ justify-content: flex-end;
478
+ margin-left: auto;
479
+ ${Yr("md")} {
480
+ align-items: center;
481
+ }
482
+ `},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:k`
483
+ display: inline-flex;
484
+ justify-content: space-between;
485
+ align-items: center;
486
+ padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
487
+ background-color: var(--white);
488
+ border-radius: var(--rounded-base);
489
+ border: 2px solid var(--gray-400);
490
+ &:hover {
491
+ background-color: var(--gray-100);
492
+ }
493
+ `},e("span",{css:k`
494
+ margin-right: var(--spacing-sm);
495
+ font-size: var(--fs-sm);
496
+ `},"Edit"),e(H,{src:r,alt:"Logo",css:k`
497
+ width: 1.75rem;
498
+ height: 1.75rem;
499
+ display: block;
500
+ `})):null,e("button",{type:"button",onClick:f=>{f.preventDefault(),n==null||n(t)},css:k`
501
+ display: flex;
502
+ justify-content: space-between;
503
+ align-items: center;
504
+ background-color: var(--white);
505
+ border-radius: var(--rounded-base);
506
+ border: 2px solid var(--gray-400);
507
+ height: 2.5rem;
508
+ padding: 0 var(--spacing-base);
509
+ gap: var(--spacing-sm);
510
+ &:hover {
511
+ background-color: var(--gray-100);
512
+ }
513
+ `},e("span",{css:k`
514
+ font-size: var(--fs-sm);
515
+ `},"Unlink"),e(q,{css:k`
516
+ color: var(--brand-secondary-5);
517
+ `})))))}import{Callout as oo,LoadingIndicator as no}from"@uniformdev/design-system";import{useAsync as ao,useAsyncFn as io}from"react-use";function Oa({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:i,multiSelect:d,multiSelectId:m,selectedItemComponent:f,rowComponent:v,errorComponent:b,helpComponent:a,noResultsComponent:h,onSort:w,typeSelectorAllTypesOptionText:Q="All categories",typeSelectorLabel:U="Select Category"}){var B;let{value:S,loading:y,error:N}=ao(async()=>await o(),[o]),F=to(()=>S?S.map(u=>({id:u.id,name:u.name})):void 0,[S]),D=ro(),[A,re]=io(async(G,u)=>{let L=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(...L.products),L},[r]),_=async G=>{await n(G)};return y?e(no,null):N||A.error?e(b||(({categoriesError:u,searchError:L})=>e(oo,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(L==null?void 0:L.message))),{categoriesError:N,searchError:A.error}):e(Qt.Provider,{value:{categories:S,logoIcon:i}},e(Et,{search:re,results:D.current,logoIcon:i,selectedItems:t,select:_,multiSelectId:m||"product-search-multi-select",multiSelect:d,contentTypes:F,selectedItemComponent:f||Kt,rowComponent:v||Ot,totalResults:(B=A.value)==null?void 0:B.total,resultsLoading:A.loading,helpComponent:a,noResultsComponent:h,onSort:w,typeSelectorAllTypesOptionText:Q,typeSelectorLabel:U}))}var Qt=jr.createContext(void 0),ue=()=>{let t=eo(Qt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Wa,Callout as qa,LoadingIndicator as Ja,LoadingOverlay as Xa,Menu as Ya,MenuItem as ja,Input as ei,InputSelect as ti,InputToggle as ri,Theme as oi,InputKeywordSearch as ni,Heading as ai,ScrollableList as ii,ScrollableListItem as si,Textarea as ci}from"@uniformdev/design-system";export{Wa as Button,qa as Callout,ht as DefaultSearchRow,lt as DefaultSelectedItem,Et as EntrySearch,ai as Heading,fe as Icons,ei as Input,ti as InputSelect,ri as InputToggle,ni as KeywordSearchInput,Ja as LoadingIndicator,Xa as LoadingOverlay,Ya as Menu,ja as MenuItem,Ne as ProductPreviewList,Jo as ProductQuery,Ke as ProductQueryContext,Oa as ProductSearch,Qt as ProductSearchContext,Ot as ProductSearchRow,Kt as ProductSelectedItem,Ae as ResolvableLoadingValue,ii as ScrollableList,si as ScrollableListItem,Be as SelectionField,ci as Textarea,oi as Theme,Ee as UniformMeshLocationContext,Te as UniformMeshLocationContextProvider,Ge as UniformMeshSdkContext,xo as UniformMeshSdkContextProvider,Se as badgeIcon,Lt as draggableContainer,ye as draggableIcon,Mt as draggableIconOffset,xt as draggableIconWrapper,yt as entrySearchBtn,wt as entrySearchConfig,Ct as entrySearchConfigHidden,St as entrySearchLoadMoreBtn,Pt as entrySearchResultList,Rt as entrySearchSelectIcon,kt as entrySearchSelectImg,Jn as entrySearchSelectInput,Xn as entrySearchSelectOption,bt as entrySearchWrapper,At as productSearchRowActiveIcon,zt as productSearchRowCategory,Tt as productSearchRowContainer,It as productSearchRowContent,Dt as productSearchRowContentActive,Ut as productSearchRowDetails,Gt as productSearchRowTitle,Ht as productSelectedItemContainer,$t as productSelectedItemContent,Ft as productSelectedItemDetails,Ce as productSelectedItemImage,gt as searchRowBtn,pt as searchRowContainer,ut as searchRowContainerActive,mt 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,wo as useInitializeUniformMeshSdk,Qe as useProductQueryContext,ue as useProductSearchContext,vo as useUniformMeshLocation,Ie as useUniformMeshLocationContext,Eo as useUniformMeshSdk,ze as useUniformMeshSdkContext};