@uniformdev/mesh-sdk-react 14.1.2-alpha.94 → 14.2.1-alpha.34
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/tailwind/plugin.js +4 -4
- package/dist/tailwind/plugin.mjs +4 -4
- package/package.json +9 -19
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var mt=Object.defineProperty;var ut=(e,t)=>{for(var o in t)mt(e,o,{get:t[o],enumerable:!0})};import ct,{createContext as pt,useContext as ft,useState as gt}from"react";var Pe=pt(void 0),ke=({children:e})=>{let[t,o]=gt(),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 ct.createElement(Pe.Provider,{value:n},e)},Ve=()=>{let e=ft(Pe);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function oo(){let{location:e}=Ve();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 vt}from"@uniformdev/mesh-sdk";import{useEffect as ht,useState as Te}from"react";var so=({autoResizingDisabled:e}={})=>{let[t,o]=Te(),[n,r]=Te();return ht(()=>{typeof window=="undefined"||n||(typeof window.UniformMeshSDK=="undefined"?vt({autoResizingDisabled:e}).then(s=>{r(s)}).catch(s=>{o(s)}):r(window.UniformMeshSDK))},[e]),{initializing:!n&&!t,error:t,sdk:n}};import De,{createContext as xt,useContext as bt}from"react";var Be=xt(void 0),co=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),De.createElement(Be.Provider,{value:t},De.createElement(ke,null,e))},Ge=()=>{let e=bt(Be);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function go(){let{sdk:e}=Ge();return e}import Ue from"react";import{Button as Ct}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=Ue.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 Ue.createElement(Ct,{className:p,ref:g,...f},o)});import E from"react";import*as oe from"react";var yt=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=yt;import*as ne from"react";var wt=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=wt;import*as _ from"react";var St=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=St;import*as re from"react";var Mt=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=Mt;import*as ae from"react";var Nt=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=Nt;import*as ie from"react";var Lt=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=Lt;var Et={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"}},ze=({type:e="info",title:t,children:o,className:n})=>{let r=Et[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 Pt}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(Pt,{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 kt=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=kt;function Ie({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 Vt,Menu as Tt,MenuButton as Dt}from"reakit/Menu";var $e=V.createContext({}),He=()=>V.useContext($e),Fe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:n="auto",children:r})=>{let s=Vt();return V.createElement($e.Provider,{value:s},V.createElement(Dt,{...s,ref:t.ref,...t.props},f=>V.cloneElement(t,f)),V.createElement(Tt,{...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 Ke}from"reakit";var Oe=({children:e,className:t,hideMenuOnClick:o=!0,icon:n,...r})=>{let s=He(),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(Ke,{...s,...r,className:f},v=>{let h=o?g(v):v,y=e(h);return n?Ae(y,n):y});let p=o?g(r):r;return B.createElement(Ke,{...s,...p,className:f},n?Ae(e,n):e)};function Ae(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 Ot,useRef as At}from"react";var pe={};ut(pe,{Caution:()=>D,Checkmark:()=>R,ChevronDown:()=>W,Close:()=>X,Danger:()=>A,ExclamationPoint:()=>O,Info:()=>N,Lightbulb:()=>j,MagnifyingGlass:()=>Z,MaximizeAlt:()=>_e,MoreVerticalAlt:()=>U});import*as me from"react";var Bt=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=Bt;import*as G from"react";var Gt=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=Gt;import*as ue from"react";var Ut=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"})),_e=Ut;import*as ce from"react";var zt=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=zt;import{useThrottle as _t}from"react-use";import{v4 as jt}from"uuid";import u,{useState as It,useRef as Re,useEffect as $t}from"react";function je(e,t){let o=window.open(e,"_blank"),n=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(n),t())},500)}import{format as Ht}from"timeago.js";var Ze=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:n})=>{var y;let r=Re(null),s=Re(null),[f,g]=It(!1);$t(()=>{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:"),Ht((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&&(je(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 Ft,useRef as Je,useEffect as Kt}from"react";var We=({result:e,isSelected:t,triggerSelection:o})=>{let n=Je(null),r=Je(null),[s,f]=Ft(!1);Kt(()=>{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 Rt,DragDropContext as Zt,Draggable as Jt}from"react-beautiful-dnd";var Wt=({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(ze,{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:Xe,helpComponent:qe,onSort:q})=>{var Ne,Le,Ee;let ge=5,ve=()=>m?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[he,xe]=z(""),[M,be]=z(ve),[I,Q]=z(!1),[$,H]=z([]),[Qe,Ce]=z(!1),F=_t(he,750);Ot(()=>{e(F,{count:ge,offset:0,contentType:M==="any"?void 0:M})},[F,M]);let Ye=a=>{$.includes(a.id)?H(c=>c.filter(k=>k!==a.id)):H(f?c=>[...c,a==null?void 0:a.id]:[a.id])},et=()=>{be(ve()),xe(""),H((n==null?void 0:n.length)?n.map(a=>a.id):[])},tt=()=>{Q(a=>!a),I||et()},ye=a=>{s((n==null?void 0:n.filter(c=>c.id!==a.id).map(c=>c.id))||[],"")},ot=a=>{a.preventDefault(),s($,M),Q(!1)},nt=a=>{a.preventDefault(),Q(!1),fe&&fe()},rt=a=>{a.preventDefault(),e(F,{count:ge,offset:(t==null?void 0:t.length)||0,contentType:M==="any"?void 0:M}),Ce(!0);let c=setTimeout(()=>{Ce(!1)},750);return()=>clearTimeout(c)},we=At(jt()),at=!(n==null?void 0:n.length)||f,it=p||We,Se=v||Ze,st=Xe||Wt,Me=r&&typeof r!="string"?r:null,lt=Me?i.createElement(Me,{className:"h-9 w-9"}):i.createElement("img",{src:r,alt:"CMS logo",className:"h-9 w-9"}),dt=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"},at&&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:tt,type:"button","aria-haspopup":!0,"aria-expanded":I,"aria-controls":we.current},lt,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`},qe||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=>be(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(Ie,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:xe,disabledFieldSubmission:!0}))),i.createElement("div",{className:"overflow-y-scroll max-h-64 divide-y divide-gray-200 scrollbar",id:we.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(t==null?void 0:t.length)?t.map(a=>i.createElement(it,{key:a.id,isSelected:$.includes(a.id),result:a,triggerSelection:()=>Ye(a)})):y?null:i.createElement(st,{searchText:F||he,selectedContentType:(Le=(Ne=o==null?void 0:o.find(a=>a.id===M))==null?void 0:Ne.name)!=null?Le: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:rt},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&&((Ee=o==null?void 0:o.length)!=null?Ee:0)>0?i.createElement(Fe,{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:nt},"Cancel"),i.createElement(K,{className:"ml-5",disabled:!$.length,onClick:ot,"data-test-id":"entry-accept-button"},"Accept"))))),f?i.createElement(Zt,{onDragEnd:a=>dt(a)},i.createElement(Rt,{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(Jt,{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(Se,{key:`selected-item-${c.id}`,logoIcon:r,selectedItem:c,onDeselect:T=>ye(T),onEditClosed:S?T=>S(T):void 0})))}),a.placeholder))):n==null?void 0:n.map(a=>i.createElement(Se,{key:`selected-item-${a.id}`,logoIcon:r,selectedItem:a,onDeselect:c=>ye(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(Xt,{height:128,width:128}),t?C.createElement("div",{className:"mt-4 text-gray-500"},t):null))),Xt=({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,ze as Callout,Kn as CmsEntrySearch,We as DefaultSearchRow,Ze as DefaultSelectedItem,pe as Icons,se as Input,Ie as KeywordSearchInput,Xt as LoadingIcon,de as LoadingIndicator,_n as LoadingOverlay,Fe as Menu,$e as MenuContext,Oe as MenuItem,Pe as UniformMeshLocationContext,ke as UniformMeshLocationContextProvider,Be as UniformMeshSdkContext,co as UniformMeshSdkContextProvider,so as useInitializeUniformMeshSdk,He as useMenuContext,oo as useUniformMeshLocation,Ve as useUniformMeshLocationContext,go as useUniformMeshSdk,Ge as useUniformMeshSdkContext};
|
|
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};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var wt=Object.create;var W=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var Xe=e=>W(e,"__esModule",{value:!0});var qe=(e,t)=>{for(var o in t)W(e,o,{get:t[o],enumerable:!0})},S=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Mt(t))!Lt.call(e,n)&&(o||n!=="default")&&W(e,n,{get:()=>t[n],enumerable:!(a=St(t,n))||a.enumerable});return e},c=(e,t)=>S(Xe(W(e!=null?wt(Nt(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Et=(e=>(t,o)=>e&&e.get(t)||(o=S(Xe({}),t,1),e&&e.set(t,o),o))(typeof WeakMap!="undefined"?new WeakMap:0);var M={};qe(M,{Button:()=>F,Callout:()=>Me,CmsEntrySearch:()=>jt,DefaultSearchRow:()=>Ue,DefaultSelectedItem:()=>Ge,Icons:()=>se,Input:()=>te,KeywordSearchInput:()=>Ne,LoadingIcon:()=>st,LoadingIndicator:()=>re,LoadingOverlay:()=>Rt,Menu:()=>Pe,MenuContext:()=>Le,MenuItem:()=>Ve,UniformMeshLocationContext:()=>ue,UniformMeshLocationContextProvider:()=>ce,UniformMeshSdkContext:()=>fe,UniformMeshSdkContextProvider:()=>Vt,useInitializeUniformMeshSdk:()=>kt,useMenuContext:()=>Ee,useUniformMeshLocation:()=>Pt,useUniformMeshLocationContext:()=>pe,useUniformMeshSdk:()=>Tt,useUniformMeshSdkContext:()=>ge});var E=c(require("react")),ue=(0,E.createContext)(void 0),ce=({children:e})=>{let[t,o]=(0,E.useState)(),a;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let n=t||window.UniformMeshSDK.getCurrentLocation();a={location:{getValue:n.getValue,getMetadata:n.getMetadata,setValue:async s=>{await n.setValue(s),o(window.UniformMeshSDK.getCurrentLocation())}}}}return E.default.createElement(ue.Provider,{value:a},e)},pe=()=>{let e=(0,E.useContext)(ue);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Pt(){let{location:e}=pe();return{value:e==null?void 0:e.getValue(),setValue:e==null?void 0:e.setValue,metadata:e==null?void 0:e.getMetadata()}}var Qe=require("@uniformdev/mesh-sdk"),H=require("react"),kt=({autoResizingDisabled:e}={})=>{let[t,o]=(0,H.useState)(),[a,n]=(0,H.useState)();return(0,H.useEffect)(()=>{typeof window=="undefined"||a||(typeof window.UniformMeshSDK=="undefined"?(0,Qe.initializeUniformMeshSDK)({autoResizingDisabled:e}).then(s=>{n(s)}).catch(s=>{o(s)}):n(window.UniformMeshSDK))},[e]),{initializing:!a&&!t,error:t,sdk:a}};var D=c(require("react"));var fe=(0,D.createContext)(void 0),Vt=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),D.default.createElement(fe.Provider,{value:t},D.default.createElement(ce,null,e))},ge=()=>{let e=(0,D.useContext)(fe);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function Tt(){let{sdk:e}=ge();return e}var ve=c(require("react")),Ye=require("reakit"),he={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"}},xe={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||!he[e]))return t?he[e].disabled:he[e].default}},F=ve.default.forwardRef(({size:e="md",buttonType:t="primary",children:o,className:a,rounded:n=!1,disablePadding:s=!1,...f},g)=>{let p=[xe.base,xe.size(n,!s)[e],xe.buttonType(t,f.disabled),a].join(" ");return ve.default.createElement(Ye.Button,{className:p,ref:g,...f},o)});var k=c(require("react"));var be=c(require("react")),Dt=e=>be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e},be.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"})),X=Dt;var Ce=c(require("react")),Bt=e=>Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e},Ce.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"})),q=Bt;var Q=c(require("react")),Gt=e=>Q.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},Q.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"}),Q.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"})),P=Gt;var ye=c(require("react")),Ut=e=>ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e},ye.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"})),Y=Ut;var we=c(require("react")),zt=e=>we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e},we.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"})),K=zt;var Se=c(require("react")),It=e=>Se.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},Se.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"})),ee=It;var $t={caution:{icon:K,descriptionColor:"text-yellow-700",iconColor:"text-yellow-400",titleColor:"text-yellow-800",containerColor:"bg-yellow-50"},danger:{icon:q,descriptionColor:"text-red-700",iconColor:"text-red-400",titleColor:"text-red-800",containerColor:"bg-red-50"},error:{icon:K,descriptionColor:"text-red-700",iconColor:"text-red-400",titleColor:"text-red-800",containerColor:"bg-red-50"},info:{icon:X,descriptionColor:"text-blue-700",iconColor:"text-blue-400",titleColor:"text-blue-800",containerColor:"bg-blue-50"},note:{icon:P,descriptionColor:"text-gray-700",iconColor:"text-gray-400",titleColor:"text-gray-800",containerColor:"bg-gray-50"},success:{icon:ee,descriptionColor:"text-green-700",iconColor:"text-green-400",titleColor:"text-green-800",containerColor:"bg-green-50"},tip:{icon:Y,descriptionColor:"text-green-700",iconColor:"text-green-400",titleColor:"text-green-800",containerColor:"bg-green-50"}},Me=({type:e="info",title:t,children:o,className:a})=>{let n=$t[e];if(!n)return null;let s=n.icon;return k.default.createElement("div",{"data-testid":"sdk-ui-callout",className:`rounded-md p-4 ${n.containerColor} ${a||""}`},k.default.createElement("div",{className:"flex"},k.default.createElement("div",{className:"flex-shrink-0"},k.default.createElement(s,{className:`h-5 w-5 ${n.iconColor}`})),k.default.createElement("div",{className:"ml-3"},t?k.default.createElement("h3",{className:`text-sm font-medium mb-2 ${n.titleColor}`},t):null,o?k.default.createElement("div",{className:`text-sm ${n.descriptionColor}`},o):null)))};var V=c(require("react")),et=require("reakit"),te=({classNameContainer:e,classNameControl:t,classNameLabel:o,label:a,icon:n,id:s,disabled:f,...g})=>{let p={container:`uniform-input-container ${e||""}`,control:`uniform-input uniform-input-text${f?" uniform-input-disabled":""}${n?" pr-10":""} ${t||""}`,label:`uniform-input-label ${o||""}`};return V.default.createElement(V.default.Fragment,null,a?V.default.createElement("label",{htmlFor:s,className:p.label},a):null,V.default.createElement("div",{className:p.container},V.default.createElement(et.Input,{className:p.control,id:s,disabled:f,...g},v=>V.default.createElement("input",{...v,style:g.style})),n?V.default.createElement("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"},n):null))};te.displayName="Input";var ne=c(require("react"));var T=c(require("react")),Ht=e=>T.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("g",{clipPath:"url(#magnifying-glass_svg__a)"},T.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"}),T.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"})),T.createElement("defs",null,T.createElement("clipPath",{id:"magnifying-glass_svg__a"},T.createElement("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),oe=Ht;function Ne({onSearchTextChanged:e,disabled:t=!1,placeholder:o="Keyword search",inputFieldName:a="keywordSearch",disabledFieldSubmission:n=!1}){return ne.default.createElement(te,{type:"text",name:a,placeholder:o,icon:ne.default.createElement("div",{className:"pr-1"},ne.default.createElement(oe,{className:"w-5 h-5 text-primary"})),onChange:g=>{e==null||e(g.currentTarget.value)},onKeyPress:g=>{g.key==="Enter"&&n&&g.preventDefault()},className:"uniform-input uniform-input-text pr-12 bg-gray-100",disabled:t,"aria-label":o})}var O=c(require("react")),re=()=>O.default.createElement("span",{className:"loader",role:"presentation"},O.default.createElement("i",{className:"loader__dot"}),O.default.createElement("i",{className:"loader__dot"}),O.default.createElement("i",{className:"loader__dot"}));var B=c(require("react")),U=require("reakit/Menu"),Le=B.default.createContext({}),Ee=()=>B.default.useContext(Le),Pe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:a="auto",children:n})=>{let s=(0,U.useMenuState)();return B.default.createElement(Le.Provider,{value:s},B.default.createElement(U.MenuButton,{...s,ref:t.ref,...t.props},f=>B.default.cloneElement(t,f)),B.default.createElement(U.Menu,{...s,placement:a,"aria-label":e,className:`uniform-menu divide-y divide-gray-500 shadow-xl z-50 ${o}`},n))};var z=c(require("react")),ke=require("reakit");var Ve=({children:e,className:t,hideMenuOnClick:o=!0,icon:a,...n})=>{let s=Ee(),f=`uniform-menu-item bg-white ${(n==null?void 0:n.disabled)?"text-gray-500":"text-primary"} ${t||""}`,g=v=>{let x={...v};if(x.onClick){let w=x.onClick;x.onClick=m=>{s.hide(),w(m)}}return x};if(typeof e=="function")return z.default.createElement(ke.MenuItem,{...s,...n,className:f},v=>{let x=o?g(v):v,w=e(x);return a?tt(w,a):w});let p=o?g(n):n;return z.default.createElement(ke.MenuItem,{...s,...p,className:f},a?tt(e,a):e)};function tt(e,t){return z.default.createElement("div",{className:"flex items-center justify-between"},z.default.createElement("div",null,e),z.default.createElement("div",{className:"ml-4"},t))}var r=c(require("react"));var se={};qe(se,{Caution:()=>K,Checkmark:()=>ee,ChevronDown:()=>ae,Close:()=>ie,Danger:()=>q,ExclamationPoint:()=>X,Info:()=>P,Lightbulb:()=>Y,MagnifyingGlass:()=>oe,MaximizeAlt:()=>ot,MoreVerticalAlt:()=>_});var Te=c(require("react")),Ft=e=>Te.createElement("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e},Te.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"})),ae=Ft;var A=c(require("react")),Kt=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e},A.createElement("g",{fillRule:"evenodd"},A.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"}),A.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"}))),ie=Kt;var De=c(require("react")),Ot=e=>De.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},De.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"})),ot=Ot;var Be=c(require("react")),At=e=>Be.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},Be.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"})),_=At;var at=require("react-use"),it=require("uuid");var l=c(require("react"));function nt(e,t){let o=window.open(e,"_blank"),a=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(a),t())},500)}var rt=require("timeago.js"),Ge=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:a})=>{var w;let n=(0,l.useRef)(null),s=(0,l.useRef)(null),[f,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let m=N=>{n.current&&!n.current.contains(N.target)&&s.current&&!s.current.contains(N.target)&&g(!1)},b=()=>{g(!1)};return window.addEventListener("resize",b,!0),document.addEventListener("scroll",m,!0),document.addEventListener("mousedown",m),()=>{window.removeEventListener("resize",b,!0),document.removeEventListener("scroll",m,!0),document.removeEventListener("mousedown",m)}},[s]);let p=()=>{var m;if(g(!f),s.current&&n.current){let b=(m=n==null?void 0:n.current)==null?void 0:m.getBoundingClientRect();s.current.style.top=`${b.top+30}px`}},v=t&&typeof t!="string"?t:null,x=v?l.default.createElement(v,{className:"h-7 w-7"}):l.default.createElement("img",{src:t,alt:"CMS logo",className:"h-7 w-7"});return l.default.createElement("div",{className:"flex w-full border border-gray-300 rounded-md bg-gray-100",key:e.id},l.default.createElement("div",{className:"p-4 pl-8 flex flex-grow mr-2 gap-2 items-center relative"},l.default.createElement("div",{className:"flex-grow"},l.default.createElement("div",{className:"inline-flex relative items-start"},l.default.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&&l.default.createElement(l.default.Fragment,null,l.default.createElement("button",{type:"button",ref:n,className:"ml-2 -my-1","aria-controls":"path-details",onClick:p},l.default.createElement(P,{className:"text-gray-700"})),l.default.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,b],N)=>l.default.createElement("div",{className:"text-xs",key:N},l.default.createElement("span",{className:"font-bold mr-2"},m,":"),b))))),e.createdDate&&l.default.createElement("div",{className:"text-xs"},l.default.createElement("span",{className:"font-bold mr-2"},"Created:"),(0,rt.format)((w=e.createdDate)!=null?w:0)),l.default.createElement("div",{className:"flex gap-4"},e.metadata?Object.entries(e.metadata).filter(([m])=>["type","status"].includes(m.toLocaleLowerCase())).map(([m,b])=>l.default.createElement("span",{className:"text-sm",key:m},b)):null),e.metadata?Object.entries(e.metadata).filter(([m])=>!["type","status"].includes(m.toLocaleLowerCase())).map(([m,b])=>l.default.createElement("div",{className:"text-xs order-1",key:m},l.default.createElement("span",{className:"font-bold mr-2 order-1"},m,":"),b)):null),l.default.createElement("div",{className:"flex md:flex-row flex-col gap-2"},e.editLink?l.default.createElement("a",{href:e.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:m=>{a&&(nt(m.currentTarget.href,()=>a(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"},l.default.createElement("span",{className:"mr-2 text-sm"},"Edit"),x):null,l.default.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"},l.default.createElement("span",{className:"mr-2 text-sm"},"Unlink"),l.default.createElement(ie,{className:"w-4 h-4 text-red-600"})))))};var h=c(require("react"));var Ue=({result:e,isSelected:t,triggerSelection:o})=>{let a=(0,h.useRef)(null),n=(0,h.useRef)(null),[s,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{function p(v){a.current&&!a.current.contains(v.target)&&n.current&&!n.current.contains(v.target)&&f(!1)}return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[n]);let g=p=>{p.stopPropagation(),f(!s)};return h.default.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?h.default.createElement(h.default.Fragment,null,h.default.createElement("button",{type:"button",ref:a,className:"absolute top-0 bottom-0 right-2","aria-controls":"path-details",onClick:p=>g(p)},h.default.createElement(P,null)),h.default.createElement("div",{ref:n,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],x)=>h.default.createElement("div",{className:"text-xs",key:x},h.default.createElement("span",{className:"font-bold mr-2"},p,":"),v)),Object.entries(e.popoverData).map(([p,v],x)=>h.default.createElement("div",{className:"text-xs",key:x},h.default.createElement("span",{className:"font-bold mr-2"},p,":"),v)))):null)};var I=require("react-beautiful-dnd"),_t=({searchText:e,selectedContentType:t})=>{let o="No content found";return t&&(o=`No ${t} content was found`),e&&(o=`${o} for keyword '${e}'.`),r.default.createElement(Me,{type:"info"},o)},jt=({search:e,results:t,contentTypes:o,selectedItems:a,logoIcon:n,select:s,multiSelect:f,multiSelectId:g,rowComponent:p,selectedItemComponent:v,totalResults:x,resultsLoading:w,requireContentType:m,onAddNew:b,onEditClosed:N,onCancel:ze,noResultsComponent:lt,helpComponent:dt,onSort:le})=>{var Ze,Je,We;let Ie=5,$e=()=>m?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[He,Fe]=(0,r.useState)(""),[L,Ke]=(0,r.useState)($e),[j,de]=(0,r.useState)(!1),[R,Z]=(0,r.useState)([]),[mt,Oe]=(0,r.useState)(!1),J=(0,at.useThrottle)(He,750);(0,r.useEffect)(()=>{e(J,{count:Ie,offset:0,contentType:L==="any"?void 0:L})},[J,L]);let ut=i=>{R.includes(i.id)?Z(u=>u.filter(G=>G!==i.id)):Z(f?u=>[...u,i==null?void 0:i.id]:[i.id])},ct=()=>{Ke($e()),Fe(""),Z((a==null?void 0:a.length)?a.map(i=>i.id):[])},pt=()=>{de(i=>!i),j||ct()},Ae=i=>{s((a==null?void 0:a.filter(u=>u.id!==i.id).map(u=>u.id))||[],"")},ft=i=>{i.preventDefault(),s(R,L),de(!1)},gt=i=>{i.preventDefault(),de(!1),ze&&ze()},vt=i=>{i.preventDefault(),e(J,{count:Ie,offset:(t==null?void 0:t.length)||0,contentType:L==="any"?void 0:L}),Oe(!0);let u=setTimeout(()=>{Oe(!1)},750);return()=>clearTimeout(u)},_e=(0,r.useRef)((0,it.v4)()),ht=!(a==null?void 0:a.length)||f,xt=p||Ue,je=v||Ge,bt=lt||_t,Re=n&&typeof n!="string"?n:null,Ct=Re?r.default.createElement(Re,{className:"h-9 w-9"}):r.default.createElement("img",{src:n,alt:"CMS logo",className:"h-9 w-9"}),yt=i=>{var u,G;if(i.destination&&i.source.droppableId===((u=i.destination)==null?void 0:u.droppableId)){let y=[...a||[]],[me]=(G=y==null?void 0:y.splice(i.source.index,1))!=null?G:[];return y==null||y.splice(i.destination.index,0,me),le==null||le(y.map($=>$.id)),y}};return r.default.createElement("div",{className:"w-full"},r.default.createElement("div",{className:"relative my-4"},ht&&r.default.createElement("div",{className:"space-y-2"},r.default.createElement("div",{className:"py-3 px-2 bg-white rounded-lg border border-gray-300 mb-4","data-test-id":"component-search"},r.default.createElement("button",{className:"flex items-center w-full text-base relative",onClick:pt,type:"button","aria-haspopup":!0,"aria-expanded":j,"aria-controls":_e.current},Ct,r.default.createElement("span",{className:"ml-4"},"Select"),r.default.createElement("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},r.default.createElement(ae,{className:`w-5 h-5 text-standard transform transition-transform ${j?"rotate-180":"rotate-0"}`})))),r.default.createElement("div",{className:`${j?"block":"hidden"} py-3 px-4 space-y-4 bg-white rounded-lg border border-gray-300`},dt||null,r.default.createElement("div",{className:"flex space-x-3"},r.default.createElement("select",{className:"uniform-input uniform-input-select w-1/3 bg-gray-100",onChange:i=>Ke(i.target.value)},m?null:r.default.createElement("option",{value:"any",className:"bg-white text-primary"},"All content types"),o==null?void 0:o.map(i=>r.default.createElement("option",{value:i.id,key:i.id,className:"bg-white text-primary"},i.name))),r.default.createElement("div",{className:"flex-grow"},r.default.createElement(Ne,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:Fe,disabledFieldSubmission:!0}))),r.default.createElement("div",{className:"overflow-y-scroll max-h-64 divide-y divide-gray-200 scrollbar",id:_e.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(t==null?void 0:t.length)?t.map(i=>r.default.createElement(xt,{key:i.id,isSelected:R.includes(i.id),result:i,triggerSelection:()=>ut(i)})):w?null:r.default.createElement(bt,{searchText:J||He,selectedContentType:(Je=(Ze=o==null?void 0:o.find(i=>i.id===L))==null?void 0:Ze.name)!=null?Je:L}),!w&&typeof x!="undefined"&&t&&(t==null?void 0:t.length)<x&&r.default.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:vt},mt?r.default.createElement(re,null):"Load More"),w&&!(t==null?void 0:t.length)?r.default.createElement("div",{className:"p-4 text-center w-full"},r.default.createElement(re,null)):null),r.default.createElement("div",{className:"flex justify-between"},r.default.createElement("div",null,b&&((We=o==null?void 0:o.length)!=null?We:0)>0?r.default.createElement(Pe,{menuLabel:"Add new menu",menuTrigger:r.default.createElement(F,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(i=>r.default.createElement(Ve,{key:i.id,className:"bg-white text-primary",onClick:()=>b(i)},i.name))):null),r.default.createElement("div",null,r.default.createElement(F,{buttonType:"unimportant",onClick:gt},"Cancel"),r.default.createElement(F,{className:"ml-5",disabled:!R.length,onClick:ft,"data-test-id":"entry-accept-button"},"Accept"))))),f?r.default.createElement(I.DragDropContext,{onDragEnd:i=>yt(i)},r.default.createElement(I.Droppable,{droppableId:g||"canvas-multi-select"},i=>r.default.createElement("div",{...i.droppableProps,ref:i.innerRef,className:"space-y-1"},a==null?void 0:a.map((u,G)=>{if(u==null?void 0:u.id)return r.default.createElement(I.Draggable,{key:u.id,draggableId:u.id,index:G},(y,me)=>r.default.createElement("div",{className:"relative group",ref:y.innerRef,...y.draggableProps,...y.dragHandleProps},r.default.createElement("span",{className:`absolute left-0 top-0 bottom-0 my-auto flex items-center ${me.isDragging?"":"opacity-0 group-hover:opacity-30"}`},r.default.createElement(_,{className:"text-brand-secondary-1 absolute left-1.5",width:24,height:24}),r.default.createElement(_,{className:"text-brand-secondary-1",width:24,height:24})),r.default.createElement(je,{key:`selected-item-${u.id}`,logoIcon:n,selectedItem:u,onDeselect:$=>Ae($),onEditClosed:N?$=>N($):void 0})))}),i.placeholder))):a==null?void 0:a.map(i=>r.default.createElement(je,{key:`selected-item-${i.id}`,logoIcon:n,selectedItem:i,onDeselect:u=>Ae(u),onEditClosed:N?u=>N(u):void 0}))))};var C=c(require("react")),Rt=({isActive:e,statusMessage:t})=>C.default.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.default.createElement("div",{className:"absolute bottom-0 left-0 right-0 top-0 bg-white bg-opacity-50"}),C.default.createElement("div",{className:"relative"},C.default.createElement("div",{className:"flex flex-col items-center"},C.default.createElement(st,{height:128,width:128}),t?C.default.createElement("div",{className:"mt-4 text-gray-500"},t):null))),st=({height:e,width:t})=>C.default.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.default.createElement("g",{fill:"none",fillRule:"evenodd"},C.default.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},C.default.createElement("circle",{strokeOpacity:".25",cx:"18",cy:"18",r:"18"}),C.default.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18",transform:"rotate(166.645 18 18)"},C.default.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 18 18",to:"360 18 18",dur:"0.8s",repeatCount:"indefinite"})))));S(M,require("@uniformdev/mesh-sdk"));module.exports=Et(M);0&&(module.exports={Button,Callout,CmsEntrySearch,DefaultSearchRow,DefaultSelectedItem,Icons,Input,KeywordSearchInput,LoadingIcon,LoadingIndicator,LoadingOverlay,Menu,MenuContext,MenuItem,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,useInitializeUniformMeshSdk,useMenuContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|
|
1
|
+
var yt=Object.create;var W=Object.defineProperty;var wt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Mt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var We=e=>W(e,"__esModule",{value:!0});var Xe=(e,t)=>{for(var o in t)W(e,o,{get:t[o],enumerable:!0})},S=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of St(t))!Nt.call(e,n)&&(o||n!=="default")&&W(e,n,{get:()=>t[n],enumerable:!(a=wt(t,n))||a.enumerable});return e},c=(e,t)=>S(We(W(e!=null?yt(Mt(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Lt=(e=>(t,o)=>e&&e.get(t)||(o=S(We({}),t,1),e&&e.set(t,o),o))(typeof WeakMap!="undefined"?new WeakMap:0);var M={};Xe(M,{Button:()=>F,Callout:()=>Me,CmsEntrySearch:()=>_t,DefaultSearchRow:()=>Ue,DefaultSelectedItem:()=>Ge,Icons:()=>se,Input:()=>te,KeywordSearchInput:()=>Ne,LoadingIcon:()=>it,LoadingIndicator:()=>re,LoadingOverlay:()=>jt,Menu:()=>Pe,MenuContext:()=>Le,MenuItem:()=>Ve,UniformMeshLocationContext:()=>ue,UniformMeshLocationContextProvider:()=>ce,UniformMeshSdkContext:()=>fe,UniformMeshSdkContextProvider:()=>kt,useInitializeUniformMeshSdk:()=>Pt,useMenuContext:()=>Ee,useUniformMeshLocation:()=>Et,useUniformMeshLocationContext:()=>pe,useUniformMeshSdk:()=>Vt,useUniformMeshSdkContext:()=>ge});var E=c(require("react")),ue=(0,E.createContext)(void 0),ce=({children:e})=>{let[t,o]=(0,E.useState)(),a;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let n=t||window.UniformMeshSDK.getCurrentLocation();a={location:{getValue:n.getValue,getMetadata:n.getMetadata,setValue:async s=>{await n.setValue(s),o(window.UniformMeshSDK.getCurrentLocation())}}}}return E.default.createElement(ue.Provider,{value:a},e)},pe=()=>{let e=(0,E.useContext)(ue);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Et(){let{location:e}=pe();return{value:e==null?void 0:e.getValue(),setValue:e==null?void 0:e.setValue,metadata:e==null?void 0:e.getMetadata()}}var qe=require("@uniformdev/mesh-sdk"),H=require("react"),Pt=({autoResizingDisabled:e}={})=>{let[t,o]=(0,H.useState)(),[a,n]=(0,H.useState)();return(0,H.useEffect)(()=>{typeof window=="undefined"||a||(typeof window.UniformMeshSDK=="undefined"?(0,qe.initializeUniformMeshSDK)({autoResizingDisabled:e}).then(s=>{n(s)}).catch(s=>{o(s)}):n(window.UniformMeshSDK))},[e]),{initializing:!a&&!t,error:t,sdk:a}};var D=c(require("react"));var fe=(0,D.createContext)(void 0),kt=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),D.default.createElement(fe.Provider,{value:t},D.default.createElement(ce,null,e))},ge=()=>{let e=(0,D.useContext)(fe);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function Vt(){let{sdk:e}=ge();return e}var xe=c(require("react")),Qe=require("reakit"),ve={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"}},he={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||!ve[e]))return t?ve[e].disabled:ve[e].default}},F=xe.default.forwardRef(({size:e="md",buttonType:t="primary",children:o,className:a,rounded:n=!1,disablePadding:s=!1,...f},g)=>{let p=[he.base,he.size(n,!s)[e],he.buttonType(t,f.disabled),a].join(" ");return xe.default.createElement(Qe.Button,{className:p,ref:g,...f},o)});var k=c(require("react"));var be=c(require("react")),Tt=e=>be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e},be.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"})),X=Tt;var Ce=c(require("react")),Dt=e=>Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e},Ce.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"})),q=Dt;var Q=c(require("react")),Bt=e=>Q.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},Q.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"}),Q.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"})),P=Bt;var ye=c(require("react")),Gt=e=>ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e},ye.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"})),Y=Gt;var we=c(require("react")),Ut=e=>we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e},we.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"})),K=Ut;var Se=c(require("react")),zt=e=>Se.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},Se.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"})),ee=zt;var It={caution:{icon:K,descriptionColor:"text-yellow-700",iconColor:"text-yellow-400",titleColor:"text-yellow-800",containerColor:"bg-yellow-50"},danger:{icon:q,descriptionColor:"text-red-700",iconColor:"text-red-400",titleColor:"text-red-800",containerColor:"bg-red-50"},error:{icon:K,descriptionColor:"text-red-700",iconColor:"text-red-400",titleColor:"text-red-800",containerColor:"bg-red-50"},info:{icon:X,descriptionColor:"text-blue-700",iconColor:"text-blue-400",titleColor:"text-blue-800",containerColor:"bg-blue-50"},note:{icon:P,descriptionColor:"text-gray-700",iconColor:"text-gray-400",titleColor:"text-gray-800",containerColor:"bg-gray-50"},success:{icon:ee,descriptionColor:"text-green-700",iconColor:"text-green-400",titleColor:"text-green-800",containerColor:"bg-green-50"},tip:{icon:Y,descriptionColor:"text-green-700",iconColor:"text-green-400",titleColor:"text-green-800",containerColor:"bg-green-50"}},Me=({type:e="info",title:t,children:o,className:a})=>{let n=It[e];if(!n)return null;let s=n.icon;return k.default.createElement("div",{"data-testid":"sdk-ui-callout",className:`rounded-md p-4 ${n.containerColor} ${a||""}`},k.default.createElement("div",{className:"flex"},k.default.createElement("div",{className:"flex-shrink-0"},k.default.createElement(s,{className:`h-5 w-5 ${n.iconColor}`})),k.default.createElement("div",{className:"ml-3"},t?k.default.createElement("h3",{className:`text-sm font-medium mb-2 ${n.titleColor}`},t):null,o?k.default.createElement("div",{className:`text-sm ${n.descriptionColor}`},o):null)))};var V=c(require("react")),Ye=require("reakit"),te=({classNameContainer:e,classNameControl:t,classNameLabel:o,label:a,icon:n,id:s,disabled:f,...g})=>{let p={container:`uniform-input-container ${e||""}`,control:`uniform-input uniform-input-text${f?" uniform-input-disabled":""}${n?" pr-10":""} ${t||""}`,label:`uniform-input-label ${o||""}`};return V.default.createElement(V.default.Fragment,null,a?V.default.createElement("label",{htmlFor:s,className:p.label},a):null,V.default.createElement("div",{className:p.container},V.default.createElement(Ye.Input,{className:p.control,id:s,disabled:f,...g},v=>V.default.createElement("input",{...v,style:g.style})),n?V.default.createElement("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"},n):null))};te.displayName="Input";var ne=c(require("react"));var T=c(require("react")),$t=e=>T.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("g",{clipPath:"url(#magnifying-glass_svg__a)"},T.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"}),T.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"})),T.createElement("defs",null,T.createElement("clipPath",{id:"magnifying-glass_svg__a"},T.createElement("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),oe=$t;function Ne({onSearchTextChanged:e,disabled:t=!1,placeholder:o="Keyword search",inputFieldName:a="keywordSearch",disabledFieldSubmission:n=!1}){return ne.default.createElement(te,{type:"text",name:a,placeholder:o,icon:ne.default.createElement("div",{className:"pr-1"},ne.default.createElement(oe,{className:"w-5 h-5 text-primary"})),onChange:g=>{e==null||e(g.currentTarget.value)},onKeyPress:g=>{g.key==="Enter"&&n&&g.preventDefault()},className:"uniform-input uniform-input-text pr-12 bg-gray-100",disabled:t,"aria-label":o})}var O=c(require("react")),re=()=>O.default.createElement("span",{className:"loader",role:"presentation"},O.default.createElement("i",{className:"loader__dot"}),O.default.createElement("i",{className:"loader__dot"}),O.default.createElement("i",{className:"loader__dot"}));var B=c(require("react")),U=require("reakit/Menu"),Le=B.default.createContext({}),Ee=()=>B.default.useContext(Le),Pe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:a="auto",children:n})=>{let s=(0,U.useMenuState)();return B.default.createElement(Le.Provider,{value:s},B.default.createElement(U.MenuButton,{...s,ref:t.ref,...t.props},f=>B.default.cloneElement(t,f)),B.default.createElement(U.Menu,{...s,placement:a,"aria-label":e,className:`uniform-menu divide-y divide-gray-500 shadow-xl z-50 ${o}`},n))};var z=c(require("react")),ke=require("reakit");var Ve=({children:e,className:t,hideMenuOnClick:o=!0,icon:a,...n})=>{let s=Ee(),f=`uniform-menu-item bg-white ${(n==null?void 0:n.disabled)?"text-gray-500":"text-primary"} ${t||""}`,g=v=>{let x={...v};if(x.onClick){let w=x.onClick;x.onClick=m=>{s.hide(),w(m)}}return x};if(typeof e=="function")return z.default.createElement(ke.MenuItem,{...s,...n,className:f},v=>{let x=o?g(v):v,w=e(x);return a?et(w,a):w});let p=o?g(n):n;return z.default.createElement(ke.MenuItem,{...s,...p,className:f},a?et(e,a):e)};function et(e,t){return z.default.createElement("div",{className:"flex items-center justify-between"},z.default.createElement("div",null,e),z.default.createElement("div",{className:"ml-4"},t))}var r=c(require("react"));var se={};Xe(se,{Caution:()=>K,Checkmark:()=>ee,ChevronDown:()=>ae,Close:()=>ie,Danger:()=>q,ExclamationPoint:()=>X,Info:()=>P,Lightbulb:()=>Y,MagnifyingGlass:()=>oe,MaximizeAlt:()=>tt,MoreVerticalAlt:()=>_});var Te=c(require("react")),Ht=e=>Te.createElement("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e},Te.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"})),ae=Ht;var A=c(require("react")),Ft=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e},A.createElement("g",{fillRule:"evenodd"},A.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"}),A.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"}))),ie=Ft;var De=c(require("react")),Kt=e=>De.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},De.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"})),tt=Kt;var Be=c(require("react")),Ot=e=>Be.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},Be.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"})),_=Ot;var rt=require("react-use"),at=require("uuid");var l=c(require("react"));function ot(e,t){let o=window.open(e,"_blank"),a=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(a),t())},500)}var nt=require("timeago.js"),Ge=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:a})=>{var w;let n=(0,l.useRef)(null),s=(0,l.useRef)(null),[f,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let m=N=>{n.current&&!n.current.contains(N.target)&&s.current&&!s.current.contains(N.target)&&g(!1)},b=()=>{g(!1)};return window.addEventListener("resize",b,!0),document.addEventListener("scroll",m,!0),document.addEventListener("mousedown",m),()=>{window.removeEventListener("resize",b,!0),document.removeEventListener("scroll",m,!0),document.removeEventListener("mousedown",m)}},[s]);let p=()=>{var m;if(g(!f),s.current&&n.current){let b=(m=n==null?void 0:n.current)==null?void 0:m.getBoundingClientRect();s.current.style.top=`${b.top+30}px`}},v=t&&typeof t!="string"?t:null,x=v?l.default.createElement(v,{className:"h-7 w-7"}):l.default.createElement("img",{src:t,alt:"CMS logo",className:"h-7 w-7"});return l.default.createElement("div",{className:"flex w-full border border-gray-300 rounded-md bg-gray-100",key:e.id},l.default.createElement("div",{className:"p-4 pl-8 flex flex-grow mr-2 gap-2 items-center relative"},l.default.createElement("div",{className:"flex-grow"},l.default.createElement("div",{className:"inline-flex relative items-start"},l.default.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&&l.default.createElement(l.default.Fragment,null,l.default.createElement("button",{type:"button",ref:n,className:"ml-2 -my-1","aria-controls":"path-details",onClick:p},l.default.createElement(P,{className:"text-gray-700"})),l.default.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,b],N)=>l.default.createElement("div",{className:"text-xs",key:N},l.default.createElement("span",{className:"font-bold mr-2"},m,":"),b))))),e.createdDate&&l.default.createElement("div",{className:"text-xs"},l.default.createElement("span",{className:"font-bold mr-2"},"Created:"),(0,nt.format)((w=e.createdDate)!=null?w:0)),l.default.createElement("div",{className:"flex gap-4"},e.metadata?Object.entries(e.metadata).filter(([m])=>["type","status"].includes(m.toLocaleLowerCase())).map(([m,b])=>l.default.createElement("span",{className:"text-sm",key:m},b)):null),e.metadata?Object.entries(e.metadata).filter(([m])=>!["type","status"].includes(m.toLocaleLowerCase())).map(([m,b])=>l.default.createElement("div",{className:"text-xs order-1",key:m},l.default.createElement("span",{className:"font-bold mr-2 order-1"},m,":"),b)):null),l.default.createElement("div",{className:"flex md:flex-row flex-col gap-2"},e.editLink?l.default.createElement("a",{href:e.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:m=>{a&&(ot(m.currentTarget.href,()=>a(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"},l.default.createElement("span",{className:"mr-2 text-sm"},"Edit"),x):null,l.default.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"},l.default.createElement("span",{className:"mr-2 text-sm"},"Unlink"),l.default.createElement(ie,{className:"w-4 h-4 text-red-600"})))))};var h=c(require("react"));var Ue=({result:e,isSelected:t,triggerSelection:o})=>{let a=(0,h.useRef)(null),n=(0,h.useRef)(null),[s,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{function p(v){a.current&&!a.current.contains(v.target)&&n.current&&!n.current.contains(v.target)&&f(!1)}return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[n]);let g=p=>{p.stopPropagation(),f(!s)};return h.default.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?h.default.createElement(h.default.Fragment,null,h.default.createElement("button",{type:"button",ref:a,className:"absolute top-0 bottom-0 right-2","aria-controls":"path-details",onClick:p=>g(p)},h.default.createElement(P,null)),h.default.createElement("div",{ref:n,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],x)=>h.default.createElement("div",{className:"text-xs",key:x},h.default.createElement("span",{className:"font-bold mr-2"},p,":"),v)),Object.entries(e.popoverData).map(([p,v],x)=>h.default.createElement("div",{className:"text-xs",key:x},h.default.createElement("span",{className:"font-bold mr-2"},p,":"),v)))):null)};var I=require("react-beautiful-dnd"),At=({searchText:e,selectedContentType:t})=>{let o="No content found";return t&&(o=`No ${t} content was found`),e&&(o=`${o} for keyword '${e}'.`),r.default.createElement(Me,{type:"info"},o)},_t=({search:e,results:t,contentTypes:o,selectedItems:a,logoIcon:n,select:s,multiSelect:f,multiSelectId:g,rowComponent:p,selectedItemComponent:v,totalResults:x,resultsLoading:w,requireContentType:m,onAddNew:b,onEditClosed:N,onCancel:ze,noResultsComponent:st,helpComponent:lt,onSort:le})=>{var Re,Ze,Je;let Ie=()=>m?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[$e,He]=(0,r.useState)(""),[L,Fe]=(0,r.useState)(Ie),[j,de]=(0,r.useState)(!1),[R,Z]=(0,r.useState)([]),[dt,Ke]=(0,r.useState)(!1),J=(0,rt.useThrottle)($e,750);(0,r.useEffect)(()=>{e(J,{count:5,offset:0,contentType:L==="any"?void 0:L})},[J,L]);let mt=i=>{R.includes(i.id)?Z(u=>u.filter(G=>G!==i.id)):Z(f?u=>[...u,i==null?void 0:i.id]:[i.id])},ut=()=>{Fe(Ie()),He(""),Z((a==null?void 0:a.length)?a.map(i=>i.id):[])},ct=()=>{de(i=>!i),j||ut()},Oe=i=>{s((a==null?void 0:a.filter(u=>u.id!==i.id).map(u=>u.id))||[],"")},pt=i=>{i.preventDefault(),s(R,L),de(!1)},ft=i=>{i.preventDefault(),de(!1),ze&&ze()},gt=i=>{i.preventDefault(),e(J,{count:5,offset:(t==null?void 0:t.length)||0,contentType:L==="any"?void 0:L}),Ke(!0);let u=setTimeout(()=>{Ke(!1)},750);return()=>clearTimeout(u)},Ae=(0,r.useRef)((0,at.v4)()),vt=!(a==null?void 0:a.length)||f,ht=p||Ue,_e=v||Ge,xt=st||At,je=n&&typeof n!="string"?n:null,bt=je?r.default.createElement(je,{className:"h-9 w-9"}):r.default.createElement("img",{src:n,alt:"CMS logo",className:"h-9 w-9"}),Ct=i=>{var u,G;if(i.destination&&i.source.droppableId===((u=i.destination)==null?void 0:u.droppableId)){let y=[...a||[]],[me]=(G=y==null?void 0:y.splice(i.source.index,1))!=null?G:[];return y==null||y.splice(i.destination.index,0,me),le==null||le(y.map($=>$.id)),y}};return r.default.createElement("div",{className:"w-full"},r.default.createElement("div",{className:"relative my-4"},vt&&r.default.createElement("div",{className:"space-y-2"},r.default.createElement("div",{className:"py-3 px-2 bg-white rounded-lg border border-gray-300 mb-4","data-test-id":"component-search"},r.default.createElement("button",{className:"flex items-center w-full text-base relative",onClick:ct,type:"button","aria-haspopup":!0,"aria-expanded":j,"aria-controls":Ae.current},bt,r.default.createElement("span",{className:"ml-4"},"Select"),r.default.createElement("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},r.default.createElement(ae,{className:`w-5 h-5 text-standard transform transition-transform ${j?"rotate-180":"rotate-0"}`})))),r.default.createElement("div",{className:`${j?"block":"hidden"} py-3 px-4 space-y-4 bg-white rounded-lg border border-gray-300`},lt||null,r.default.createElement("div",{className:"flex space-x-3"},r.default.createElement("select",{className:"uniform-input uniform-input-select w-1/3 bg-gray-100",onChange:i=>Fe(i.target.value)},m?null:r.default.createElement("option",{value:"any",className:"bg-white text-primary"},"All content types"),o==null?void 0:o.map(i=>r.default.createElement("option",{value:i.id,key:i.id,className:"bg-white text-primary"},i.name))),r.default.createElement("div",{className:"flex-grow"},r.default.createElement(Ne,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:He,disabledFieldSubmission:!0}))),r.default.createElement("div",{className:"overflow-y-scroll max-h-64 divide-y divide-gray-200 scrollbar",id:Ae.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(t==null?void 0:t.length)?t.map(i=>r.default.createElement(ht,{key:i.id,isSelected:R.includes(i.id),result:i,triggerSelection:()=>mt(i)})):w?null:r.default.createElement(xt,{searchText:J||$e,selectedContentType:(Ze=(Re=o==null?void 0:o.find(i=>i.id===L))==null?void 0:Re.name)!=null?Ze:L}),!w&&typeof x!="undefined"&&t&&(t==null?void 0:t.length)<x&&r.default.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:gt},dt?r.default.createElement(re,null):"Load More"),w&&!(t==null?void 0:t.length)?r.default.createElement("div",{className:"p-4 text-center w-full"},r.default.createElement(re,null)):null),r.default.createElement("div",{className:"flex justify-between"},r.default.createElement("div",null,b&&((Je=o==null?void 0:o.length)!=null?Je:0)>0?r.default.createElement(Pe,{menuLabel:"Add new menu",menuTrigger:r.default.createElement(F,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(i=>r.default.createElement(Ve,{key:i.id,className:"bg-white text-primary",onClick:()=>b(i)},i.name))):null),r.default.createElement("div",null,r.default.createElement(F,{buttonType:"unimportant",onClick:ft},"Cancel"),r.default.createElement(F,{className:"ml-5",disabled:!R.length,onClick:pt,"data-test-id":"entry-accept-button"},"Accept"))))),f?r.default.createElement(I.DragDropContext,{onDragEnd:i=>Ct(i)},r.default.createElement(I.Droppable,{droppableId:g||"canvas-multi-select"},i=>r.default.createElement("div",{...i.droppableProps,ref:i.innerRef,className:"space-y-1"},a==null?void 0:a.map((u,G)=>{if(u==null?void 0:u.id)return r.default.createElement(I.Draggable,{key:u.id,draggableId:u.id,index:G},(y,me)=>r.default.createElement("div",{className:"relative group",ref:y.innerRef,...y.draggableProps,...y.dragHandleProps},r.default.createElement("span",{className:`absolute left-0 top-0 bottom-0 my-auto flex items-center ${me.isDragging?"":"opacity-0 group-hover:opacity-30"}`},r.default.createElement(_,{className:"text-brand-secondary-1 absolute left-1.5",width:24,height:24}),r.default.createElement(_,{className:"text-brand-secondary-1",width:24,height:24})),r.default.createElement(_e,{key:`selected-item-${u.id}`,logoIcon:n,selectedItem:u,onDeselect:$=>Oe($),onEditClosed:N?$=>N($):void 0})))}),i.placeholder))):a==null?void 0:a.map(i=>r.default.createElement(_e,{key:`selected-item-${i.id}`,logoIcon:n,selectedItem:i,onDeselect:u=>Oe(u),onEditClosed:N?u=>N(u):void 0}))))};var C=c(require("react")),jt=({isActive:e,statusMessage:t})=>C.default.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.default.createElement("div",{className:"absolute bottom-0 left-0 right-0 top-0 bg-white bg-opacity-50"}),C.default.createElement("div",{className:"relative"},C.default.createElement("div",{className:"flex flex-col items-center"},C.default.createElement(it,{height:128,width:128}),t?C.default.createElement("div",{className:"mt-4 text-gray-500"},t):null))),it=({height:e,width:t})=>C.default.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.default.createElement("g",{fill:"none",fillRule:"evenodd"},C.default.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},C.default.createElement("circle",{strokeOpacity:".25",cx:"18",cy:"18",r:"18"}),C.default.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18",transform:"rotate(166.645 18 18)"},C.default.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 18 18",to:"360 18 18",dur:"0.8s",repeatCount:"indefinite"})))));S(M,require("@uniformdev/mesh-sdk"));module.exports=Lt(M);0&&(module.exports={Button,Callout,CmsEntrySearch,DefaultSearchRow,DefaultSelectedItem,Icons,Input,KeywordSearchInput,LoadingIcon,LoadingIndicator,LoadingOverlay,Menu,MenuContext,MenuItem,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,useInitializeUniformMeshSdk,useMenuContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var mt=Object.defineProperty;var ut=(e,t)=>{for(var o in t)mt(e,o,{get:t[o],enumerable:!0})};import ct,{createContext as pt,useContext as ft,useState as gt}from"react";var Pe=pt(void 0),ke=({children:e})=>{let[t,o]=gt(),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 ct.createElement(Pe.Provider,{value:n},e)},Ve=()=>{let e=ft(Pe);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function oo(){let{location:e}=Ve();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 vt}from"@uniformdev/mesh-sdk";import{useEffect as ht,useState as Te}from"react";var so=({autoResizingDisabled:e}={})=>{let[t,o]=Te(),[n,r]=Te();return ht(()=>{typeof window=="undefined"||n||(typeof window.UniformMeshSDK=="undefined"?vt({autoResizingDisabled:e}).then(s=>{r(s)}).catch(s=>{o(s)}):r(window.UniformMeshSDK))},[e]),{initializing:!n&&!t,error:t,sdk:n}};import De,{createContext as xt,useContext as bt}from"react";var Be=xt(void 0),co=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),De.createElement(Be.Provider,{value:t},De.createElement(ke,null,e))},Ge=()=>{let e=bt(Be);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function go(){let{sdk:e}=Ge();return e}import Ue from"react";import{Button as Ct}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=Ue.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 Ue.createElement(Ct,{className:p,ref:g,...f},o)});import E from"react";import*as oe from"react";var yt=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=yt;import*as ne from"react";var wt=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=wt;import*as _ from"react";var St=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=St;import*as re from"react";var Mt=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=Mt;import*as ae from"react";var Nt=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=Nt;import*as ie from"react";var Lt=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=Lt;var Et={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"}},ze=({type:e="info",title:t,children:o,className:n})=>{let r=Et[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 Pt}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(Pt,{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 kt=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=kt;function Ie({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 Vt,Menu as Tt,MenuButton as Dt}from"reakit/Menu";var $e=V.createContext({}),He=()=>V.useContext($e),Fe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:n="auto",children:r})=>{let s=Vt();return V.createElement($e.Provider,{value:s},V.createElement(Dt,{...s,ref:t.ref,...t.props},f=>V.cloneElement(t,f)),V.createElement(Tt,{...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 Ke}from"reakit";var Oe=({children:e,className:t,hideMenuOnClick:o=!0,icon:n,...r})=>{let s=He(),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(Ke,{...s,...r,className:f},v=>{let h=o?g(v):v,y=e(h);return n?Ae(y,n):y});let p=o?g(r):r;return B.createElement(Ke,{...s,...p,className:f},n?Ae(e,n):e)};function Ae(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 Ot,useRef as At}from"react";var pe={};ut(pe,{Caution:()=>D,Checkmark:()=>R,ChevronDown:()=>W,Close:()=>X,Danger:()=>A,ExclamationPoint:()=>O,Info:()=>N,Lightbulb:()=>j,MagnifyingGlass:()=>Z,MaximizeAlt:()=>_e,MoreVerticalAlt:()=>U});import*as me from"react";var Bt=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=Bt;import*as G from"react";var Gt=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=Gt;import*as ue from"react";var Ut=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"})),_e=Ut;import*as ce from"react";var zt=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=zt;import{useThrottle as _t}from"react-use";import{v4 as jt}from"uuid";import u,{useState as It,useRef as Re,useEffect as $t}from"react";function je(e,t){let o=window.open(e,"_blank"),n=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(n),t())},500)}import{format as Ht}from"timeago.js";var Ze=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:n})=>{var y;let r=Re(null),s=Re(null),[f,g]=It(!1);$t(()=>{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:"),Ht((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&&(je(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 Ft,useRef as Je,useEffect as Kt}from"react";var We=({result:e,isSelected:t,triggerSelection:o})=>{let n=Je(null),r=Je(null),[s,f]=Ft(!1);Kt(()=>{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 Rt,DragDropContext as Zt,Draggable as Jt}from"react-beautiful-dnd";var Wt=({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(ze,{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:Xe,helpComponent:qe,onSort:q})=>{var Ne,Le,Ee;let ge=5,ve=()=>m?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[he,xe]=z(""),[M,be]=z(ve),[I,Q]=z(!1),[$,H]=z([]),[Qe,Ce]=z(!1),F=_t(he,750);Ot(()=>{e(F,{count:ge,offset:0,contentType:M==="any"?void 0:M})},[F,M]);let Ye=a=>{$.includes(a.id)?H(c=>c.filter(k=>k!==a.id)):H(f?c=>[...c,a==null?void 0:a.id]:[a.id])},et=()=>{be(ve()),xe(""),H((n==null?void 0:n.length)?n.map(a=>a.id):[])},tt=()=>{Q(a=>!a),I||et()},ye=a=>{s((n==null?void 0:n.filter(c=>c.id!==a.id).map(c=>c.id))||[],"")},ot=a=>{a.preventDefault(),s($,M),Q(!1)},nt=a=>{a.preventDefault(),Q(!1),fe&&fe()},rt=a=>{a.preventDefault(),e(F,{count:ge,offset:(t==null?void 0:t.length)||0,contentType:M==="any"?void 0:M}),Ce(!0);let c=setTimeout(()=>{Ce(!1)},750);return()=>clearTimeout(c)},we=At(jt()),at=!(n==null?void 0:n.length)||f,it=p||We,Se=v||Ze,st=Xe||Wt,Me=r&&typeof r!="string"?r:null,lt=Me?i.createElement(Me,{className:"h-9 w-9"}):i.createElement("img",{src:r,alt:"CMS logo",className:"h-9 w-9"}),dt=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"},at&&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:tt,type:"button","aria-haspopup":!0,"aria-expanded":I,"aria-controls":we.current},lt,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`},qe||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=>be(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(Ie,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:xe,disabledFieldSubmission:!0}))),i.createElement("div",{className:"overflow-y-scroll max-h-64 divide-y divide-gray-200 scrollbar",id:we.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(t==null?void 0:t.length)?t.map(a=>i.createElement(it,{key:a.id,isSelected:$.includes(a.id),result:a,triggerSelection:()=>Ye(a)})):y?null:i.createElement(st,{searchText:F||he,selectedContentType:(Le=(Ne=o==null?void 0:o.find(a=>a.id===M))==null?void 0:Ne.name)!=null?Le: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:rt},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&&((Ee=o==null?void 0:o.length)!=null?Ee:0)>0?i.createElement(Fe,{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:nt},"Cancel"),i.createElement(K,{className:"ml-5",disabled:!$.length,onClick:ot,"data-test-id":"entry-accept-button"},"Accept"))))),f?i.createElement(Zt,{onDragEnd:a=>dt(a)},i.createElement(Rt,{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(Jt,{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(Se,{key:`selected-item-${c.id}`,logoIcon:r,selectedItem:c,onDeselect:T=>ye(T),onEditClosed:S?T=>S(T):void 0})))}),a.placeholder))):n==null?void 0:n.map(a=>i.createElement(Se,{key:`selected-item-${a.id}`,logoIcon:r,selectedItem:a,onDeselect:c=>ye(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(Xt,{height:128,width:128}),t?C.createElement("div",{className:"mt-4 text-gray-500"},t):null))),Xt=({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,ze as Callout,Kn as CmsEntrySearch,We as DefaultSearchRow,Ze as DefaultSelectedItem,pe as Icons,se as Input,Ie as KeywordSearchInput,Xt as LoadingIcon,de as LoadingIndicator,_n as LoadingOverlay,Fe as Menu,$e as MenuContext,Oe as MenuItem,Pe as UniformMeshLocationContext,ke as UniformMeshLocationContextProvider,Be as UniformMeshSdkContext,co as UniformMeshSdkContextProvider,so as useInitializeUniformMeshSdk,He as useMenuContext,oo as useUniformMeshLocation,Ve as useUniformMeshLocationContext,go as useUniformMeshSdk,Ge as useUniformMeshSdkContext};
|
|
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};
|