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

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.mjs 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 tr=Object.defineProperty;var rr=(t,n)=>{for(var o in n)tr(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as L from"react";import{createContext as or,useContext as nr,useState as ar}from"react";var Me=or(void 0),Ve=({children:t})=>{let[n,o]=ar(),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,p)=>{await i.setValue(d,p),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async d=>{await i.setValidationResult(d)}}}}return e(Me.Provider,{value:r},t)},Ee=()=>{let t=nr(Me);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function fo(){let{location:t}=Ee();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 ir}from"@uniformdev/mesh-sdk";import{useEffect as sr,useState as Te}from"react";var So=({autoResizingDisabled:t}={})=>{let[n,o]=Te(),[r,i]=Te();return sr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?ir({autoResizingDisabled:t}).then(d=>{i(d)}).catch(d=>{o(d)}):i(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as cr,useContext as dr}from"react";import{Theme as lr}from"@uniformdev/design-system";var Ie=cr(void 0),xo=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e(Ie.Provider,{value:n},e(lr,null),e(Ve,null,t))},De=()=>{let t=dr(Ie);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Vo(){let{sdk:t}=De();return t}import Qe from"react";import gr,{useMemo as ne,useContext as fr}from"react";import{css as Y}from"@emotion/react";import{InputSelect as pr}from"@uniformdev/design-system";import Ge from"react";var ze=({value:t,text:n,loading:o})=>e(Ge.Fragment,null,!!n&&n,!n&&e(Ge.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Ue=({id:t,label:n,loading:o,selectedValues:r,values:i,onAdd:d,onRemove:p})=>{var v;let g=(v=i==null?void 0:i.filter(a=>!(r!=null&&r.includes(a.id.toString()))))!=null?v:[],f=(a,u)=>{a.preventDefault(),p(u)};return e("div",null,e(pr,{id:t,name:t,label:n,onChange:a=>d(a.target.value),disabled:o,options:[{value:"",label:"Add..."},...g.map(a=>({value:a.id,label:a.name||a.id}))],css:Array.isArray(r)&&r.length>0?Y`
2
+ margin-bottom: var(--spacing-base);
3
+ `:""}),r==null?void 0:r.map(a=>{var u;return e("div",{css:Y`
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:Y`
13
+ padding: var(--spacing-3);
14
+ color: var(--gray-800);
15
+ `},e(ze,{value:a,loading:o,text:(u=i.find(b=>b.id===a))==null?void 0:u.name})),e("button",{css:Y`
16
+ padding: var(--spacing-3);
17
+ border-left: 1px solid var(--gray-300);
18
+ `,title:"remove",onClick:b=>f(b,a)},e("svg",{xmlns:"http://www.w3.org/2000/svg",css:Y`
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 ur=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"})),re=ur;var mr=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"})),oe=mr;import{useAsyncFn as vr,useDebounce as hr}from"react-use";import{Input as Ae,InputSelect as ae,mq as ie}from"@uniformdev/design-system";import{css as w}from"@emotion/react";var Be={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},qo=({value:t,setValue:n,brands:o,categories:r,loading:i,categoriesLoading:d,brandsLoading:p,logoIcon:g,onGetProducts:f,sortOptions:v,sortOrderOptions:a,categoryLabel:u="Product Category",brandLabel:b="Brand",disableBrands:K,restrictToSingleCategory:G=!1})=>{var R,A,_;let y=async s=>{n({...Be,...t||{},...s})},h=ne(()=>({...Be,...t||{}}),[t]),[Q,O]=vr(async s=>await f(s),[f]);hr(async()=>{await O({brand:h.brand,categories:h.categories,keyword:h.keyword,sort:h.sort,sortOrder:h.sortOrder,count:h.count})},250,[h]);let T=ne(()=>{let s=[];return r==null||r.forEach(k=>{let J=He(k,void 0);s.push(...J)}),s},[r]),z=ne(()=>[{value:"",label:"All categories"},...T.map(s=>({label:s.name,value:s.id}))],[T]),ee=ne(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),N=s=>{let k=(t==null?void 0:t.categories)||[];y({categories:[...k,s]})},U=s=>{var k;y({categories:(k=t==null?void 0:t.categories)==null?void 0:k.filter(J=>J!==s)})},I=s=>{y({brand:s.target.value})},l=s=>{y({count:s||1})};return i?e("div",null,"Loading..."):e(Fe.Provider,{value:{categories:r,logoIcon:g}},e("div",{css:w`
24
+ > :not(:last-child) {
25
+ margin-bottom: var(--spacing-md);
26
+ }
27
+ `},G?e(ae,{id:"selection-field-product-category",label:u,disabled:i,value:(A=(R=h.categories)==null?void 0:R[0])!=null?A:"",options:z,onChange:s=>{y({categories:s.target.value===""?[]:[s.target.value]})}}):e(Ue,{loading:d||!1,id:"selection-field-product-category",label:u,onAdd:N,onRemove:U,selectedValues:h.categories,values:T}),e("div",{css:w`
28
+ display: flex;
29
+ flex-wrap: wrap;
30
+ column-gap: var(--spacing-lg);
31
+ row-gap: var(--spacing-md);
32
+ ${ie("md")} {
33
+ flex-wrap: nowrap;
34
+ }
35
+ `},K?null:e("div",{css:w`
36
+ width: 50%;
37
+ `},e(ae,{id:"brand",name:"brand",label:b,disabled:p,value:h.brand,onChange:I,options:[{value:"",label:"Choose..."},...ee.map(s=>({value:s.id,label:s.name}))]})),e("div",{css:w`
38
+ flex-grow: 1;
39
+ position: relative;
40
+ `},e(Ae,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:h.keyword,placeholder:"Enter keyword",onChange:s=>y({keyword:s.target.value})}))),e("div",{css:w`
41
+ display: flex;
42
+ flex-wrap: wrap;
43
+ column-gap: var(--spacing-lg);
44
+ row-gap: var(--spacing-md);
45
+ ${ie("md")} {
46
+ flex-wrap: nowrap;
47
+ }
48
+ `},e("div",{css:w`
49
+ width: 100%;
50
+ ${ie("md")} {
51
+ width: 33.333333%;
52
+ }
53
+ position: relative;
54
+ `},e(Ae,{id:"count",name:"count",type:"number",min:1,step:1,value:h.count,onChange:s=>l(s.target.valueAsNumber),label:"Count"}),e("div",{css:w`
55
+ position: absolute;
56
+ bottom: var(--spacing-sm);
57
+ right: var(--spacing-sm);
58
+ display: flex;
59
+ gap: var(--spacing-sm);
60
+ `},e(Oe,{onCountChange:()=>l(h.count-1),countIcon:"decrement",disabled:h.count===1}),e(Oe,{onCountChange:()=>l(h.count+1),countIcon:"increment"}))),Array.isArray(v)&&v.length>0?e("div",{css:w`
61
+ flex-grow: 1;
62
+ ${ie("md")} {
63
+ width: 33.333333%;
64
+ }
65
+ `},e(ae,{id:"sort",name:"sort",label:"Sort",value:h.sort,onChange:s=>y({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...v.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(a)&&a.length>0?e("div",{css:w`
66
+ flex-grow: 1;
67
+ `},e(ae,{id:"sort-order",name:"sort-order",label:"Sort Order",value:h.sortOrder,onChange:s=>y({sortOrder:s.target.value}),options:a.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),e("div",null,e("h3",{css:w`
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(Ke,{products:(_=Q.value)==null?void 0:_.products}))))};function He(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(p=>{let g=He(p,i);o.push(...g)}),o}function Oe({onCountChange:t,countIcon:n,disabled:o}){return e("button",{css:w`
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?w`
85
+ cursor: not-allowed;
86
+ opacity: 0.3;
87
+ `:""}
88
+ `,onClick:t,disabled:o},n==="increment"?e(re,{css:w`
89
+ width: 1rem;
90
+ height: 1rem;
91
+ `}):e(oe,{css:w`
92
+ width: 1rem;
93
+ height: 1rem;
94
+ `}))}var Fe=gr.createContext(void 0),$e=()=>{let t=fr(Fe);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function B({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 C}from"@emotion/react";import{scrollbarStyles as br}from"@uniformdev/design-system";var Ke=({products:t})=>{let{categories:n,logoIcon:o}=$e();return e(Qe.Fragment,null,e("p",{css:C`
95
+ margin-bottom: var(--spacing-base);
96
+ `},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[C`
97
+ max-height: 24rem;
98
+ overflow-x: auto;
99
+ `,br]},t==null?void 0:t.map((r,i)=>{var g;let[d]=(r==null?void 0:r.categories)||[],p=typeof d=="undefined"||!n||(g=n.find(f=>f.id===d.id))==null?void 0:g.name;return e("li",{key:`product-${r.id}`,css:C`
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:C`
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:C`
112
+ background-color: var(--gray-200);
113
+ width: 3.5rem;
114
+ height: 3.5rem;
115
+ object-fit: cover;
116
+ `}):e("div",{css:C`
117
+ height: 3.5rem;
118
+ width: 3.5rem;
119
+ background-color: var(--gray-100);
120
+ `}),e("h4",{css:C`
121
+ font-weight: var(--fw-bold);
122
+ width: 33.333333%;
123
+ font-size: var(--fs-sm);
124
+ `},r.name,p&&e("span",{css:C`
125
+ display: block;
126
+ font-weight: var(--fw-regular);
127
+ `},p)),r&&e(Qe.Fragment,null,e("p",{css:C`
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:C`
131
+ margin-right: var(--spacing-lg);
132
+ font-size: var(--fs-sm);
133
+ `},e("span",{css:C`
134
+ display: block;
135
+ `},"Price: ",r.price)):null,e("a",{css:C`
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:C`
148
+ font-size: var(--fs-sm);
149
+ margin-right: var(--spacing-sm);
150
+ `},"Edit"),o?e(B,{src:o,alt:"Logo",css:C`
151
+ width: 2.25rem;
152
+ height: 2.25rem;
153
+ `}):null))))})))};import Yr,{useContext as jr,useMemo as eo,useRef as to}from"react";import*as V from"react";var me={};rr(me,{Caution:()=>Ne,Checkmark:()=>se,ChevronDown:()=>ce,Close:()=>Z,Danger:()=>_e,ExclamationPoint:()=>We,Info:()=>q,Lightbulb:()=>Ze,MagnifyingGlass:()=>qe,MaximizeAlt:()=>Je,Minus:()=>oe,MoreVerticalAlt:()=>j,Plus:()=>re});var yr=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"})),Ne=yr;var Sr=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"})),se=Sr;var wr=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"})),ce=wr;var Cr=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"}))),Z=Cr;var Pr=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"})),_e=Pr;var Rr=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"})),We=Rr;var kr=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"})),q=kr;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"})),Ze=xr;var Lr=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"})))),qe=Lr;var Mr=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"})),Je=Mr;var Vr=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"})),j=Vr;import{useThrottle as Br}from"react-use";import{v4 as Or}from"uuid";import Tr,{useState as Ir,useRef as st,useEffect as Dr}from"react";function Xe(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as Gr}from"timeago.js";import{css as M}from"@emotion/react";import{mq as Er}from"@uniformdev/design-system";var Ye=M`
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
+ `,je=M`
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
+ `,et=M`
168
+ flex-grow: 1;
169
+ `,tt=M`
170
+ align-items: start;
171
+ display: inline-flex;
172
+ position: relative;
173
+ `,rt=M`
174
+ color: var(--brand-secondary-1);
175
+ font-size: var(--fs-base);
176
+ font-weight: var(--fw-bold);
177
+ line-height: 1;
178
+ `,ot=M`
179
+ width: 1.5rem;
180
+ height: 1.5rem;
181
+ `,nt=M`
182
+ width: 1rem;
183
+ height: 1rem;
184
+ `,at=M`
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
+ `,H=M`
194
+ font-size: var(--fs-sm);
195
+ `,de=M`
196
+ font-weight: var(--fw-bold);
197
+ margin-right: var(--spacing-sm);
198
+ `,it=M`
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: var(--spacing-sm);
202
+
203
+ ${Er("md")} {
204
+ flex-direction: row;
205
+ min-width: 200px;
206
+ }
207
+ `,ge=M`
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 D}from"@emotion/react";var ct=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var v;let i=st(null),d=st(null),[p,g]=Ir(!1);Dr(()=>{let a=b=>{i.current&&!i.current.contains(b.target)&&d.current&&!d.current.contains(b.target)&&g(!1)},u=()=>{g(!1)};return window.addEventListener("resize",u,!0),document.addEventListener("scroll",a,!0),document.addEventListener("mousedown",a),()=>{window.removeEventListener("resize",u,!0),document.removeEventListener("scroll",a,!0),document.removeEventListener("mousedown",a)}},[d]);let f=()=>{var a;if(g(!p),d.current&&i.current){let u=(a=i==null?void 0:i.current)==null?void 0:a.getBoundingClientRect(),b=d.current.offsetWidth;d.current.style.top=`${u.top+30}px`,d.current.style.left=`${u.left-b+30}px`}};return e("div",{css:Ye,key:t.id},e("div",{css:je},e("div",{css:et},e("div",{css:tt},e("h4",{css:[rt,t.popoverData?D`
221
+ margin-bottom: var(--spacing-sm);
222
+ `:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(Tr.Fragment,null,e("button",{type:"button",ref:i,css:D`
223
+ margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
224
+ `,"aria-controls":"path-details","aria-expanded":p,onClick:f},e(q,{width:24,height:24,css:D`
225
+ color: var(--gray-400);
226
+ `})),e("div",{id:"path-details","aria-hidden":!p,ref:d,css:[at,p?D`
227
+ visibility: visible;
228
+ `:D`
229
+ visibility: hidden;
230
+ `]},Object.entries(t.popoverData).map(([a,u],b)=>e("div",{css:H,key:b},e("span",{css:de},a,":"),u)))):null),t.createdDate&&e("div",{css:H},e("span",{css:de},"Created:"),Gr((v=t.createdDate)!=null?v:0)),e("div",{css:D`
231
+ display: flex;
232
+ gap: var(--spacing-base);
233
+ `},t.metadata?Object.entries(t.metadata).filter(([a])=>["type","status"].includes(a.toLocaleLowerCase())).map(([a,u])=>e("span",{css:H,key:a},u)):null),t.metadata?Object.entries(t.metadata).filter(([a])=>!["type","status"].includes(a.toLocaleLowerCase())).map(([a,u])=>e("div",{css:[H,D`
234
+ order: 1;
235
+ `],key:a},e("span",{css:[de,D`
236
+ order: 1;
237
+ `]},a,":"),u)):null),e("div",{css:it},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:a=>{r&&(Xe(a.currentTarget.href,()=>r(t)),a.preventDefault())},css:ge},e("span",{css:H},"Edit"),e(B,{src:n,css:ot,alt:"Logo"})):null,e("button",{type:"button",onClick:a=>{a.preventDefault(),o(t)},css:ge},e("span",{css:H},"Unlink"),e(Z,{css:[nt,D`
238
+ color: var(--brand-secondary-5);
239
+ `]})))))};import zr,{useState as Ur,useRef as gt,useEffect as Ar}from"react";import{css as F}from"@emotion/react";var dt=F`
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
+ `,lt=F`
246
+ padding-right: var(--spacing-lg);
247
+ `,pt=F`
248
+ background: var(--brand-secondary-3);
249
+ color: var(--white);
250
+ `,fe=F`
251
+ font-size: var(--fs-xs);
252
+ `,ve=F`
253
+ font-weight: var(--fw-bold);
254
+ margin-right: var(--spacing-sm);
255
+ `,ut=F`
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
+ `,mt=F`
268
+ position: absolute;
269
+ inset: 0 var(--spacing-sm) 0 auto;
270
+ `;import{css as ft}from"@emotion/react";var vt=({result:t,isSelected:n,triggerSelection:o})=>{let r=gt(null),i=gt(null),[d,p]=Ur(!1);Ar(()=>{function f(v){r.current&&!r.current.contains(v.target)&&i.current&&!i.current.contains(v.target)&&p(!1)}return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[i]);let g=f=>{f.stopPropagation(),p(!d)};return e("div",{key:t.id,css:[dt,n?pt:void 0,t.popoverData?lt:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(zr.Fragment,null,e("button",{type:"button",ref:r,css:mt,"aria-controls":"path-details",onClick:f=>g(f),"aria-expanded":d},e(q,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!d,ref:i,css:[ut,d?ft`
271
+ visibility: visible;
272
+ `:ft`
273
+ visibility: hidden;
274
+ `]},t.metadata&&Object.entries(t.metadata).map(([f,v],a)=>e("div",{css:fe,key:a},e("span",{css:ve},f,":"),v)),Object.entries(t.popoverData).map(([f,v],a)=>e("div",{css:fe,key:a},e("span",{css:ve},f,":"),v)))):null)};import{Droppable as Hr,DragDropContext as Fr,Draggable as $r}from"react-beautiful-dnd";import{css as S}from"@emotion/react";var ht=S`
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
+ `,bt=S`
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
+ `,yt=S`
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
+ `,St=S`
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
+ `,wt=S`
311
+ display: none;
312
+ `,Ct=S`
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
+ `,qn=S`
321
+ background-color: var(--gray-50);
322
+ max-width: 33.33%;
323
+ `,Pt=S`
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
+ `,Rt=S`
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
+ `,Jn=S`
337
+ background: var(--white);
338
+ color: var(--brand-secondary-1);
339
+ `,kt=S`
340
+ position: relative;
341
+ margin-block: var(--spacing-sm) 0;
342
+
343
+ &:hover > span {
344
+ opacity: 0.3;
345
+ }
346
+ `,xt=S`
347
+ align-items: center;
348
+ display: flex;
349
+ position: absolute;
350
+ inset: 0 auto 0 0;
351
+ margin-block: auto;
352
+ opacity: 0;
353
+ `,he=S`
354
+ color: var(--brand-secondary-1);
355
+ `,Lt=S`
356
+ position: absolute;
357
+ left: 0.375rem;
358
+ `,be=S`
359
+ width: calc(var(--spacing-lg) + var(--spacing-xs));
360
+ height: calc(var(--spacing-lg) + var(--spacing-xs));
361
+ `;import{css as E}from"@emotion/react";import{InputSelect as Kr,scrollbarStyles as Qr,Button as ye,Callout as Nr,InputKeywordSearch as _r,LoadingIndicator as Mt,Menu as Wr,MenuItem as Zr}from"@uniformdev/design-system";var qr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Nr,{type:"info"},o)},Vt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:i,select:d,multiSelect:p,multiSelectId:g,rowComponent:f,selectedItemComponent:v,totalResults:a,resultsLoading:u,requireContentType:b,onAddNew:K,onEditClosed:G,onCancel:y,noResultsComponent:h,helpComponent:Q,onSort:O,typeSelectorLabel:T="Content Type Select",typeSelectorAllTypesOptionText:z="All content types"})=>{var ke,xe,Le;let N=()=>b?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[U,I]=V.useState(""),[l,R]=V.useState(N),[A,_]=V.useState(!1),[s,k]=V.useState([]),[J,we]=V.useState(!1),te=Br(U,750);V.useEffect(()=>{t(te,{count:5,offset:0,contentType:l==="any"?void 0:l})},[te,l]);let Qt=c=>{s.some(m=>m.id===c.id)?k(m=>m.filter(W=>W.id!==c.id)):k(p?m=>[...m,c]:[c])},Nt=()=>{R(N()),I(""),k(r!=null&&r.length?r:[])},_t=()=>{_(c=>!c),A||Nt()},Ce=c=>{d((r==null?void 0:r.filter(m=>m.id!==c.id))||[],"")},Wt=c=>{c.preventDefault(),d(s,l),_(!1)},Zt=c=>{c.preventDefault(),_(!1),y&&y()},qt=c=>{c.preventDefault(),t(te,{count:5,offset:(n==null?void 0:n.length)||0,contentType:l==="any"?void 0:l}),we(!0);let m=setTimeout(()=>{we(!1)},750);return()=>clearTimeout(m)},ue=V.useRef(Or()),Jt=!(r==null?void 0:r.length)||p,Xt=f||vt,Pe=v||ct,Yt=h||qr,Re=i&&typeof i!="string"?i:null,jt=Re?e(Re,{css:be}):e("img",{src:i,alt:"Logo",css:be}),er=c=>{var m,W;if(c.destination&&c.source.droppableId===((m=c.destination)==null?void 0:m.droppableId)){let x=[...r||[]],[X]=(W=x==null?void 0:x.splice(c.source.index,1))!=null?W:[];return x==null||x.splice(c.destination.index,0,X),O==null||O(x),x}};return e("div",{css:E`
362
+ width: 100%;
363
+ `},e("div",{css:E`
364
+ position: relative;
365
+ margin-block: var(--spacing-base);
366
+ `},Jt&&e(V.Fragment,null,e("div",{css:ht,"data-test-id":"component-search"},e("button",{css:bt,onClick:_t,type:"button","aria-haspopup":!0,"aria-expanded":A,"aria-controls":`entry-search-config-${ue.current}`},jt,e("span",{css:E`
367
+ margin-left: var(--spacing-base);
368
+ `},"Select"),e("span",{css:Pt},e(ce,{css:[Rt,A?E`
369
+ transform: rotate(180deg);
370
+ `:void 0]})))),e("div",{id:`entry-search-config-${ue.current}`,"aria-hidden":!A,css:[St,A?void 0:wt]},Q||null,e("div",{css:E`
371
+ display: flex;
372
+ gap: calc(var(--spacing-base) - 0.25rem);
373
+ margin-bottom: var(--spacing-base);
374
+ `},e(Kr,{onChange:c=>R(c.target.value),value:l,label:T,showLabel:!1,options:[...b?[]:[{value:"any",label:z}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),e("div",{css:E`
375
+ flex-grow: 1;
376
+ `},e(_r,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:I,disabledFieldSubmission:!0,value:U}))),e("div",{css:[Ct,Qr],id:ue.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!u&&Array.isArray(n)?n.map(c=>e(Xt,{key:c.id,isSelected:s.some(m=>m.id===c.id),result:c,triggerSelection:()=>Qt(c)})):u?null:e(Yt,{searchText:te||U,selectedContentType:(xe=(ke=o==null?void 0:o.find(c=>c.id===l))==null?void 0:ke.name)!=null?xe:l}),!u&&typeof a!="undefined"&&n&&(n==null?void 0:n.length)<a&&e("button",{css:yt,onClick:qt},J?e(Mt,null):"Load More"),u&&!(n!=null&&n.length)?e("div",{css:E`
377
+ padding: var(--spacing-base);
378
+ text-align: center;
379
+ width: 100%;
380
+ `},e(Mt,null)):null),e("div",{css:E`
381
+ display: flex;
382
+ justify-content: space-between;
383
+ `},e("div",null,K&&((Le=o==null?void 0:o.length)!=null?Le:0)>0?e(Wr,{menuLabel:"Add new menu",menuTrigger:e(ye,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>e(Zr,{key:c.id,css:E`
384
+ background: var(--white);
385
+ color: var(--brand-secondary-1);
386
+ `,onClick:()=>K(c)},c.name))):null),e("div",{css:E`
387
+ display: flex;
388
+ gap: var(--spacing-base);
389
+ `},e(ye,{buttonType:"unimportant",onClick:Zt},"Cancel"),e(ye,{disabled:!s.length,onClick:Wt,"data-test-id":"entry-accept-button"},"Accept"))))),p?e(Fr,{onDragEnd:c=>er(c)},e(Hr,{droppableId:g||"canvas-multi-select"},c=>e("div",{...c.droppableProps,ref:c.innerRef,css:E`
390
+ margin-block: var(--spacing-sm) 0;
391
+ `},r==null?void 0:r.map((m,W)=>{if(m!=null&&m.id)return e($r,{key:m.id,draggableId:m.id,index:W},x=>e("div",{css:kt,ref:x.innerRef,...x.draggableProps,...x.dragHandleProps},e("span",{css:xt},e(j,{css:[he,Lt],width:24,height:24}),e(j,{css:he,width:24,height:24})),e(Pe,{key:`selected-item-${m.id}`,logoIcon:i,selectedItem:m,onDeselect:X=>Ce(X),onEditClosed:G?X=>G(X):void 0})))}),c.placeholder))):r==null?void 0:r.map(c=>e(Pe,{key:`selected-item-${c.id}`,logoIcon:i,selectedItem:c,onDeselect:m=>Ce(m),onEditClosed:G?m=>G(m):void 0}))))};import{css as $}from"@emotion/react";var Et=$`
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
+ `,Tt=$`
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
+ `,It=$`
406
+ background-color: var(--green-50);
407
+ `,Dt=$`
408
+ font-size: var(--fs-sm);
409
+ font-weight: var(--fw-bold);
410
+ width: 50%;
411
+ `,Gt=$`
412
+ font-weight: var(--fw-normal);
413
+ display: block;
414
+ `,zt=$`
415
+ font-size: var(--fs-sm);
416
+ > * {
417
+ display: block;
418
+ }
419
+ `,Ut=$`
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 At}from"@emotion/react";function Bt({result:t,isSelected:n,triggerSelection:o}){var g;let{categories:r,logoIcon:i}=le(),[d]=t.categories||[{id:"",name:""}],p=typeof d=="undefined"||!r||(g=r.find(f=>f.id===d.id))==null?void 0:g.name;return e("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Et]},e("div",{css:[Tt,n?It:void 0]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:At`
426
+ background-color: var(--gray-200);
427
+ width: 3rem;
428
+ height: 3rem;
429
+ object-fit: cover;
430
+ `}):e(B,{src:i,alt:"Logo",css:At`
431
+ height: 2.25rem;
432
+ width: 2.25rem;
433
+ `}),e("h4",{css:[Dt]},t.title,p?e("span",{css:[Gt]},p):null),e("p",{css:[zt]},"SKU: ",t.sku||t.id,t.price!==void 0?e("span",null,t.price):null),n?e(se,{css:[Ut]}):null))}import{css as pe}from"@emotion/react";import{mq as Jr}from"@uniformdev/design-system";var Ot=pe`
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
+ `,Ht=pe`
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
+ `,Ft=pe`
448
+ display: flex;
449
+ align-items: center;
450
+ gap: var(--spacing-sm);
451
+ ${Jr("lg")} {
452
+ width: 50%;
453
+ margin-bottom: 0;
454
+ }
455
+ `,Se=pe`
456
+ background-color: var(--gray-200);
457
+ width: 3.5rem;
458
+ height: 3.5rem;
459
+ object-fit: cover;
460
+ `;import{css as P}from"@emotion/react";import{mq as Xr}from"@uniformdev/design-system";function $t({selectedItem:t,onDeselect:n}){var p;let{categories:o,logoIcon:r}=le(),[i]=t.categories||[{id:"",name:""}],d=typeof i=="undefined"||!o||(p=o.find(g=>g.id===i.id))==null?void 0:p.name;return e("div",{css:[Ot],key:t.id},e("article",{css:[Ht]},e("div",{css:[Ft]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:d,css:[Se],loading:"lazy"}):e("div",{css:[Se]}),e("div",{css:P`
461
+ > :not(:last-child) {
462
+ margin-bottom: var(--spacing-xs);
463
+ }
464
+ `},e("h4",{css:P`
465
+ font-weight: var(--fw-bold);
466
+ `},t.title||t.id||"",d&&e("span",{css:P`
467
+ display: block;
468
+ font-weight: var(--fw-regular);
469
+ `},d)),e("ul",{css:P`
470
+ font-size: var(--fs-sm);
471
+ display: flex;
472
+ gap: var(--spacing-base);
473
+ `},e("li",null,e("span",{css:P`
474
+ margin-right: var(--spacing-xs);
475
+ `},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:P`
476
+ margin-right: var(--spacing-xs);
477
+ `},"Price:"),e("span",null,t.price)):null))),e("div",{css:P`
478
+ display: flex;
479
+ flex-wrap: wrap;
480
+ gap: var(--spacing-sm);
481
+ justify-content: flex-end;
482
+ margin-left: auto;
483
+ ${Xr("md")} {
484
+ align-items: center;
485
+ }
486
+ `},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:P`
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:P`
498
+ margin-right: var(--spacing-sm);
499
+ font-size: var(--fs-sm);
500
+ `},"Edit"),e(B,{src:r,alt:"Logo",css:P`
501
+ width: 1.75rem;
502
+ height: 1.75rem;
503
+ display: block;
504
+ `})):null,e("button",{type:"button",onClick:g=>{g.preventDefault(),n==null||n(t)},css:P`
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:P`
518
+ font-size: var(--fs-sm);
519
+ `},"Unlink"),e(Z,{css:P`
520
+ color: var(--brand-secondary-5);
521
+ `})))))}import{Callout as ro,LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as no,useAsyncFn as ao}from"react-use";function Ba({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:i,multiSelect:d,multiSelectId:p,selectedItemComponent:g,rowComponent:f,errorComponent:v,helpComponent:a,noResultsComponent:u,onSort:b,typeSelectorAllTypesOptionText:K="All categories",typeSelectorLabel:G="Select Category"}){var U;let{value:y,loading:h,error:Q}=no(async()=>await o(),[o]),O=eo(()=>y?y.map(l=>({id:l.id,name:l.name})):void 0,[y]),T=to(),[z,ee]=ao(async(I,l)=>{let R=await r({text:I,options:{limit:l==null?void 0:l.count,offset:l==null?void 0:l.offset,categoryId:l==null?void 0:l.contentType}});return(l==null?void 0:l.offset)===0&&(T.current=[]),(T.current=T.current||[]).push(...R.products),R},[r]),N=async I=>{await n(I)};return h?e(oo,null):Q||z.error?e(v||(({categoriesError:l,searchError:R})=>e(ro,{type:"error"},"There was an error: ",(l==null?void 0:l.message)||(R==null?void 0:R.message))),{categoriesError:Q,searchError:z.error}):e(Kt.Provider,{value:{categories:y,logoIcon:i}},e(Vt,{search:ee,results:T.current,logoIcon:i,selectedItems:t,select:N,multiSelectId:p||"product-search-multi-select",multiSelect:d,contentTypes:O,selectedItemComponent:g||$t,rowComponent:f||Bt,totalResults:(U=z.value)==null?void 0:U.total,resultsLoading:z.loading,helpComponent:a,noResultsComponent:u,onSort:b,typeSelectorAllTypesOptionText:K,typeSelectorLabel:G}))}var Kt=Yr.createContext(void 0),le=()=>{let t=jr(Kt);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 Za,LoadingIndicator as qa,LoadingOverlay as Ja,Menu as Xa,MenuItem as Ya,Input as ja,InputSelect as ei,InputToggle as ti,Theme as ri,InputKeywordSearch as oi,Heading as ni,ScrollableList as ai,ScrollableListItem as ii,Textarea as si,Switch as ci,Label as di}from"@uniformdev/design-system";export{Wa as Button,Za as Callout,vt as DefaultSearchRow,ct as DefaultSelectedItem,Vt as EntrySearch,ni as Heading,me as Icons,ja as Input,ei as InputSelect,ti as InputToggle,oi as KeywordSearchInput,di as Label,qa as LoadingIndicator,Ja as LoadingOverlay,Xa as Menu,Ya as MenuItem,Ke as ProductPreviewList,qo as ProductQuery,Fe as ProductQueryContext,Ba as ProductSearch,Kt as ProductSearchContext,Bt as ProductSearchRow,$t as ProductSelectedItem,ze as ResolvableLoadingValue,ai as ScrollableList,ii as ScrollableListItem,Ue as SelectionField,ci as Switch,si as Textarea,ri as Theme,Me as UniformMeshLocationContext,Ve as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,xo as UniformMeshSdkContextProvider,be as badgeIcon,kt as draggableContainer,he as draggableIcon,Lt as draggableIconOffset,xt as draggableIconWrapper,bt as entrySearchBtn,St as entrySearchConfig,wt as entrySearchConfigHidden,yt as entrySearchLoadMoreBtn,Ct as entrySearchResultList,Pt as entrySearchSelectIcon,Rt as entrySearchSelectImg,qn as entrySearchSelectInput,Jn as entrySearchSelectOption,ht as entrySearchWrapper,Ut as productSearchRowActiveIcon,Gt as productSearchRowCategory,Et as productSearchRowContainer,Tt as productSearchRowContent,It as productSearchRowContentActive,zt as productSearchRowDetails,Dt as productSearchRowTitle,Ot as productSelectedItemContainer,Ft as productSelectedItemContent,Ht as productSelectedItemDetails,Se as productSelectedItemImage,mt as searchRowBtn,dt as searchRowContainer,pt as searchRowContainerActive,lt as searchRowContainerWithPopover,ut as searchRowPopover,ve as searchRowText,fe as searchRowTextSmall,ge as selectItemLinkBtn,it as selectItemLinkContainer,at as selectItemPopover,de as selectItemPopoverLabel,H as selectItemSmallText,nt as selectedItemCloseIcon,Ye as selectedItemContainer,tt as selectedItemCopy,et as selectedItemDetails,ot as selectedItemIcon,je as selectedItemInner,rt as selectedItemTitle,So as useInitializeUniformMeshSdk,$e as useProductQueryContext,le as useProductSearchContext,fo as useUniformMeshLocation,Ee as useUniformMeshLocationContext,Vo as useUniformMeshSdk,De as useUniformMeshSdkContext};