@uniformdev/mesh-sdk-react 14.0.1-alpha.95 → 14.1.2-alpha.87

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.d.ts CHANGED
@@ -2,19 +2,17 @@ import * as _uniformdev_mesh_sdk from '@uniformdev/mesh-sdk';
2
2
  import { UniformMeshSDK, MeshLocation } from '@uniformdev/mesh-sdk';
3
3
  export * from '@uniformdev/mesh-sdk';
4
4
  import React, { ReactNode, SVGProps } from 'react';
5
- import { ButtonProps as ButtonProps$1 } from 'reakit/Button';
5
+ import { ButtonProps as ButtonProps$1, MenuItemHTMLProps, InputProps as InputProps$1 } from 'reakit';
6
6
  import { MenuHTMLProps, MenuProps as MenuProps$1, MenuStateReturn } from 'reakit/Menu';
7
- import { MenuItemHTMLProps } from 'reakit';
8
- import { InputProps as InputProps$1 } from 'reakit/Input';
9
7
  import { TDate } from 'timeago.js';
10
8
 
11
9
  /**
12
10
  * Provides convenient access to the current Uniform Mesh location via React hook.
13
11
  * Intended to be used within a UniformMeshLocationContextProvider.
14
12
  */
15
- declare function useUniformMeshLocation<TLocationMethodsValue = unknown, TLocationMethodsMetadata = unknown>(): {
13
+ declare function useUniformMeshLocation<TLocationMethodsValue = unknown, TLocationMethodsMetadata = unknown, TLocationSetValue = TLocationMethodsValue>(): {
16
14
  value: TLocationMethodsValue;
17
- setValue: (value: TLocationMethodsValue) => Promise<void>;
15
+ setValue: (value: TLocationSetValue) => Promise<void>;
18
16
  metadata: TLocationMethodsMetadata;
19
17
  };
20
18
 
@@ -160,15 +158,15 @@ interface NoResultsProps {
160
158
  }
161
159
  declare const CmsEntrySearch: <TResult extends CmsEntrySearchResult>({ search, results, contentTypes, selectedItems, logoIcon, select, multiSelect, multiSelectId, rowComponent, selectedItemComponent, totalResults, resultsLoading, requireContentType, onAddNew, onEditClosed, onCancel, noResultsComponent, helpComponent, onSort, }: CmsEntrySearchProps<TResult>) => JSX.Element;
162
160
 
163
- interface UniformMeshLocationContextValue<TLocationValue = unknown, TLocationMetadata = unknown> {
164
- location: MeshLocation<TLocationValue, TLocationMetadata>;
161
+ interface UniformMeshLocationContextValue<TLocationValue = unknown, TLocationMetadata = unknown, TLocationSetValue = TLocationValue> {
162
+ location: MeshLocation<TLocationValue, TLocationMetadata, TLocationSetValue>;
165
163
  }
166
- declare const UniformMeshLocationContext: React.Context<UniformMeshLocationContextValue<unknown, unknown> | undefined>;
164
+ declare const UniformMeshLocationContext: React.Context<UniformMeshLocationContextValue<unknown, unknown, unknown> | undefined>;
167
165
  declare const UniformMeshLocationContextProvider: React.FC;
168
166
  /**
169
167
  * Provides access to the current UniformMeshLocationContext value.
170
168
  */
171
- declare const useUniformMeshLocationContext: <TLocationValue, TLocationMetadata>() => UniformMeshLocationContextValue<TLocationValue, TLocationMetadata>;
169
+ declare const useUniformMeshLocationContext: <TLocationValue, TLocationMetadata, TLocationSetValue = TLocationValue>() => UniformMeshLocationContextValue<TLocationValue, TLocationMetadata, TLocationSetValue>;
172
170
 
173
171
  interface UniformMeshSdkContextValue {
174
172
  sdk: UniformMeshSDK;
@@ -209,6 +207,8 @@ declare const SvgLightbulb: (props: SVGProps<SVGSVGElement>) => JSX.Element;
209
207
 
210
208
  declare const SvgMagnifyingGlass: (props: SVGProps<SVGSVGElement>) => JSX.Element;
211
209
 
210
+ declare const SvgMaximizeAlt: (props: SVGProps<SVGSVGElement>) => JSX.Element;
211
+
212
212
  declare const SvgMoreVerticalAlt: (props: SVGProps<SVGSVGElement>) => JSX.Element;
213
213
 
214
214
  declare namespace index {
@@ -222,6 +222,7 @@ declare namespace index {
222
222
  SvgInfo as Info,
223
223
  SvgLightbulb as Lightbulb,
224
224
  SvgMagnifyingGlass as MagnifyingGlass,
225
+ SvgMaximizeAlt as MaximizeAlt,
225
226
  SvgMoreVerticalAlt as MoreVerticalAlt,
226
227
  };
227
228
  }
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- var lt=Object.defineProperty;var dt=(e,t)=>{for(var o in t)lt(e,o,{get:t[o],enumerable:!0})};import mt,{createContext as ut,useContext as ct,useState as pt}from"react";var Le=ut(void 0),Pe=({children:e})=>{let[t,o]=pt(),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 mt.createElement(Le.Provider,{value:n},e)},ke=()=>{let e=ct(Le);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Yt(){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 ft}from"@uniformdev/mesh-sdk";import{useEffect as gt,useState as De}from"react";var ro=({autoResizingDisabled:e}={})=>{let[t,o]=De(),[n,r]=De();return gt(()=>{typeof window=="undefined"||n||(typeof window.UniformMeshSDK=="undefined"?ft({autoResizingDisabled:e}).then(s=>{r(s)}).catch(s=>{o(s)}):r(window.UniformMeshSDK))},[e]),{initializing:!n&&!t,error:t,sdk:n}};import Ve,{createContext as vt,useContext as ht}from"react";var Te=vt(void 0),lo=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),Ve.createElement(Te.Provider,{value:t},Ve.createElement(Pe,null,e))},Be=()=>{let e=ht(Te);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function co(){let{sdk:e}=Be();return e}import Ue from"react";import{Button as xt}from"reakit/Button";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(xt,{className:p,ref:g,...f},o)});import L from"react";import*as oe from"react";var bt=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=bt;import*as ne from"react";var Ct=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=Ct;import*as _ from"react";var yt=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=yt;import*as re from"react";var wt=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=wt;import*as ae from"react";var St=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"})),T=St;import*as ie from"react";var Mt=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"})),Z=Mt;var Nt={caution:{icon:T,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:T,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:Z,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"}},Ge=({type:e="info",title:t,children:o,className:n})=>{let r=Nt[e];if(!r)return null;let s=r.icon;return L.createElement("div",{"data-testid":"sdk-ui-callout",className:`rounded-md p-4 ${r.containerColor} ${n||""}`},L.createElement("div",{className:"flex"},L.createElement("div",{className:"flex-shrink-0"},L.createElement(s,{className:`h-5 w-5 ${r.iconColor}`})),L.createElement("div",{className:"ml-3"},t?L.createElement("h3",{className:`text-sm font-medium mb-2 ${r.titleColor}`},t):null,o?L.createElement("div",{className:`text-sm ${r.descriptionColor}`},o):null)))};import P from"react";import{Input as Et}from"reakit/Input";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 E from"react";var Lt=e=>E.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},E.createElement("g",{clipPath:"url(#magnifying-glass_svg__a)"},E.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"}),E.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"})),E.createElement("defs",null,E.createElement("clipPath",{id:"magnifying-glass_svg__a"},E.createElement("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),R=Lt;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(R,{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 D from"react";import{useMenuState as Pt,Menu as kt,MenuButton as Dt}from"reakit/Menu";var $e=D.createContext({}),ze=()=>D.useContext($e),Fe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:n="auto",children:r})=>{let s=Pt();return D.createElement($e.Provider,{value:s},D.createElement(Dt,{...s,ref:t.ref,...t.props},f=>D.cloneElement(t,f)),D.createElement(kt,{...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 He}from"reakit";var Ke=({children:e,className:t,hideMenuOnClick:o=!0,icon:n,...r})=>{let s=ze(),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=l=>{s.hide(),y(l)}}return h};if(typeof e=="function")return B.createElement(He,{...s,...r,className:f},v=>{let h=o?g(v):v,y=e(h);return n?Oe(y,n):y});let p=o?g(r):r;return B.createElement(He,{...s,...p,className:f},n?Oe(e,n):e)};function Oe(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 I,useEffect as Ft,useRef as Ht}from"react";var ce={};dt(ce,{Caution:()=>T,Checkmark:()=>Z,ChevronDown:()=>W,Close:()=>X,Danger:()=>A,ExclamationPoint:()=>O,Info:()=>N,Lightbulb:()=>j,MagnifyingGlass:()=>R,MoreVerticalAlt:()=>G});import*as me from"react";var Vt=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=Vt;import*as U from"react";var Tt=e=>U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e},U.createElement("g",{fillRule:"evenodd"},U.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"}),U.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=Tt;import*as ue from"react";var Bt=e=>ue.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},ue.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"})),G=Bt;import{useThrottle as Kt}from"react-use";import{v4 as Ot}from"uuid";import u,{useState as Ut,useRef as _e,useEffect as Gt}from"react";function Ae(e,t){let o=window.open(e,"_blank"),n=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(n),t())},500)}import{format as It}from"timeago.js";var je=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:n})=>{var y;let r=_e(null),s=_e(null),[f,g]=Ut(!1);Gt(()=>{let l=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",l,!0),document.addEventListener("mousedown",l),()=>{window.removeEventListener("resize",x,!0),document.removeEventListener("scroll",l,!0),document.removeEventListener("mousedown",l)}},[s]);let p=()=>{var l;if(g(!f),s.current&&r.current){let x=(l=r==null?void 0:r.current)==null?void 0:l.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(([l,x],S)=>u.createElement("div",{className:"text-xs",key:S},u.createElement("span",{className:"font-bold mr-2"},l,":"),x))))),e.createdDate&&u.createElement("div",{className:"text-xs"},u.createElement("span",{className:"font-bold mr-2"},"Created:"),It((y=e.createdDate)!=null?y:0)),u.createElement("div",{className:"flex gap-4"},e.metadata?Object.entries(e.metadata).filter(([l])=>["type","status"].includes(l.toLocaleLowerCase())).map(([l,x])=>u.createElement("span",{className:"text-sm",key:l},x)):null),e.metadata?Object.entries(e.metadata).filter(([l])=>!["type","status"].includes(l.toLocaleLowerCase())).map(([l,x])=>u.createElement("div",{className:"text-xs order-1",key:l},u.createElement("span",{className:"font-bold mr-2 order-1"},l,":"),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:l=>{n&&(Ae(l.currentTarget.href,()=>n(e)),l.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:l=>{l.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 $t,useRef as Ze,useEffect as zt}from"react";var Re=({result:e,isSelected:t,triggerSelection:o})=>{let n=Ze(null),r=Ze(null),[s,f]=$t(!1);zt(()=>{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 At,DragDropContext as _t,Draggable as jt}from"react-beautiful-dnd";var Zt=({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(Ge,{type:"info"},o)},In=({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:l,onAddNew:x,onEditClosed:S,onCancel:pe,noResultsComponent:Je,helpComponent:We,onSort:q})=>{var Me,Ne,Ee;let fe=5,ge=()=>l?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[ve,he]=I(""),[M,xe]=I(ge),[$,Q]=I(!1),[z,F]=I([]),[Xe,be]=I(!1),H=Kt(ve,750);Ft(()=>{e(H,{count:fe,offset:0,contentType:M==="any"?void 0:M})},[H,M]);let qe=a=>{z.includes(a.id)?F(c=>c.filter(k=>k!==a.id)):F(f?c=>[...c,a==null?void 0:a.id]:[a.id])},Qe=()=>{xe(ge()),he(""),F((n==null?void 0:n.length)?n.map(a=>a.id):[])},Ye=()=>{Q(a=>!a),$||Qe()},Ce=a=>{s((n==null?void 0:n.filter(c=>c.id!==a.id).map(c=>c.id))||[],"")},et=a=>{a.preventDefault(),s(z,M),Q(!1)},tt=a=>{a.preventDefault(),Q(!1),pe&&pe()},ot=a=>{a.preventDefault(),e(H,{count:fe,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=Ht(Ot()),nt=!(n==null?void 0:n.length)||f,rt=p||Re,we=v||je,at=Je||Zt,Se=r&&typeof r!="string"?r:null,it=Se?i.createElement(Se,{className:"h-9 w-9"}):i.createElement("img",{src:r,alt:"CMS logo",className:"h-9 w-9"}),st=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(V=>V.id)),b}};return i.createElement("div",{className:"w-full"},i.createElement("div",{className:"relative my-4"},nt&&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:Ye,type:"button","aria-haspopup":!0,"aria-expanded":$,"aria-controls":ye.current},it,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 ${$?"rotate-180":"rotate-0"}`})))),i.createElement("div",{className:`${$?"block":"hidden"} py-3 px-4 space-y-4 bg-white rounded-lg border border-gray-300`},We||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)},l?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: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(rt,{key:a.id,isSelected:z.includes(a.id),result:a,triggerSelection:()=>qe(a)})):y?null:i.createElement(at,{searchText:H||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:ot},Xe?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(Ke,{key:a.id,className:"bg-white text-primary",onClick:()=>x(a)},a.name))):null),i.createElement("div",null,i.createElement(K,{buttonType:"unimportant",onClick:tt},"Cancel"),i.createElement(K,{className:"ml-5",disabled:!z.length,onClick:et,"data-test-id":"entry-accept-button"},"Accept"))))),f?i.createElement(_t,{onDragEnd:a=>st(a)},i.createElement(At,{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(G,{className:"text-brand-secondary-1 absolute left-1.5",width:24,height:24}),i.createElement(G,{className:"text-brand-secondary-1",width:24,height:24})),i.createElement(we,{key:`selected-item-${c.id}`,logoIcon:r,selectedItem:c,onDeselect:V=>Ce(V),onEditClosed:S?V=>S(V):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 Fn=({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(Rt,{height:128,width:128}),t?C.createElement("div",{className:"mt-4 text-gray-500"},t):null))),Rt=({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,Ge as Callout,In as CmsEntrySearch,Re as DefaultSearchRow,je as DefaultSelectedItem,ce as Icons,se as Input,Ie as KeywordSearchInput,Rt as LoadingIcon,de as LoadingIndicator,Fn as LoadingOverlay,Fe as Menu,$e as MenuContext,Ke as MenuItem,Le as UniformMeshLocationContext,Pe as UniformMeshLocationContextProvider,Te as UniformMeshSdkContext,lo as UniformMeshSdkContextProvider,ro as useInitializeUniformMeshSdk,ze as useMenuContext,Yt as useUniformMeshLocation,ke as useUniformMeshLocationContext,co as useUniformMeshSdk,Be as useUniformMeshSdkContext};
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};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var Ct=Object.create;var W=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var St=Object.getPrototypeOf,Mt=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 wt(t))!Mt.call(e,n)&&(o||n!=="default")&&W(e,n,{get:()=>t[n],enumerable:!(a=yt(t,n))||a.enumerable});return e},c=(e,t)=>S(We(W(e!=null?Ct(St(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Nt=(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:()=>H,Callout:()=>Me,CmsEntrySearch:()=>Ot,DefaultSearchRow:()=>Ue,DefaultSelectedItem:()=>Be,Icons:()=>se,Input:()=>te,KeywordSearchInput:()=>Ne,LoadingIcon:()=>at,LoadingIndicator:()=>re,LoadingOverlay:()=>At,Menu:()=>Pe,MenuContext:()=>Ee,MenuItem:()=>De,UniformMeshLocationContext:()=>ue,UniformMeshLocationContextProvider:()=>ce,UniformMeshSdkContext:()=>fe,UniformMeshSdkContextProvider:()=>Pt,useInitializeUniformMeshSdk:()=>Lt,useMenuContext:()=>Le,useUniformMeshLocation:()=>Et,useUniformMeshLocationContext:()=>pe,useUniformMeshSdk:()=>kt,useUniformMeshSdkContext:()=>ge});var L=c(require("react")),ue=(0,L.createContext)(void 0),ce=({children:e})=>{let[t,o]=(0,L.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 L.default.createElement(ue.Provider,{value:a},e)},pe=()=>{let e=(0,L.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"),F=require("react"),Lt=({autoResizingDisabled:e}={})=>{let[t,o]=(0,F.useState)(),[a,n]=(0,F.useState)();return(0,F.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 T=c(require("react"));var fe=(0,T.createContext)(void 0),Pt=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),T.default.createElement(fe.Provider,{value:t},T.default.createElement(ce,null,e))},ge=()=>{let e=(0,T.useContext)(fe);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function kt(){let{sdk:e}=ge();return e}var ve=c(require("react")),Qe=require("reakit/Button"),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}},H=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(Qe.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")),Vt=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=Vt;var Q=c(require("react")),Tt=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=Tt;var ye=c(require("react")),Bt=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=Bt;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")),Gt=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=Gt;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 D=c(require("react")),Ye=require("reakit/Input"),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 D.default.createElement(D.default.Fragment,null,a?D.default.createElement("label",{htmlFor:s,className:p.label},a):null,D.default.createElement("div",{className:p.container},D.default.createElement(Ye.Input,{className:p.control,id:s,disabled:f,...g},v=>D.default.createElement("input",{...v,style:g.style})),n?D.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 V=c(require("react")),$t=e=>V.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("g",{clipPath:"url(#magnifying-glass_svg__a)"},V.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"}),V.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"})),V.createElement("defs",null,V.createElement("clipPath",{id:"magnifying-glass_svg__a"},V.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")),G=require("reakit/Menu"),Ee=B.default.createContext({}),Le=()=>B.default.useContext(Ee),Pe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:a="auto",children:n})=>{let s=(0,G.useMenuState)();return B.default.createElement(Ee.Provider,{value:s},B.default.createElement(G.MenuButton,{...s,ref:t.ref,...t.props},f=>B.default.cloneElement(t,f)),B.default.createElement(G.Menu,{...s,placement:a,"aria-label":e,className:`uniform-menu divide-y divide-gray-500 shadow-xl z-50 ${o}`},n))};var I=c(require("react")),ke=require("reakit");var De=({children:e,className:t,hideMenuOnClick:o=!0,icon:a,...n})=>{let s=Le(),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=d=>{s.hide(),w(d)}}return x};if(typeof e=="function")return I.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 I.default.createElement(ke.MenuItem,{...s,...p,className:f},a?et(e,a):e)};function et(e,t){return I.default.createElement("div",{className:"flex items-center justify-between"},I.default.createElement("div",null,e),I.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,MoreVerticalAlt:()=>_});var Ve=c(require("react")),zt=e=>Ve.createElement("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e},Ve.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=zt;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 Te=c(require("react")),Ht=e=>Te.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},Te.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"})),_=Ht;var nt=require("react-use"),rt=require("uuid");var l=c(require("react"));function tt(e,t){let o=window.open(e,"_blank"),a=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(a),t())},500)}var ot=require("timeago.js"),Be=({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 d=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",d,!0),document.addEventListener("mousedown",d),()=>{window.removeEventListener("resize",b,!0),document.removeEventListener("scroll",d,!0),document.removeEventListener("mousedown",d)}},[s]);let p=()=>{var d;if(g(!f),s.current&&n.current){let b=(d=n==null?void 0:n.current)==null?void 0:d.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(([d,b],N)=>l.default.createElement("div",{className:"text-xs",key:N},l.default.createElement("span",{className:"font-bold mr-2"},d,":"),b))))),e.createdDate&&l.default.createElement("div",{className:"text-xs"},l.default.createElement("span",{className:"font-bold mr-2"},"Created:"),(0,ot.format)((w=e.createdDate)!=null?w:0)),l.default.createElement("div",{className:"flex gap-4"},e.metadata?Object.entries(e.metadata).filter(([d])=>["type","status"].includes(d.toLocaleLowerCase())).map(([d,b])=>l.default.createElement("span",{className:"text-sm",key:d},b)):null),e.metadata?Object.entries(e.metadata).filter(([d])=>!["type","status"].includes(d.toLocaleLowerCase())).map(([d,b])=>l.default.createElement("div",{className:"text-xs order-1",key:d},l.default.createElement("span",{className:"font-bold mr-2 order-1"},d,":"),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:d=>{a&&(tt(d.currentTarget.href,()=>a(e)),d.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:d=>{d.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 $=require("react-beautiful-dnd"),Kt=({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)},Ot=({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:d,onAddNew:b,onEditClosed:N,onCancel:Ge,noResultsComponent:it,helpComponent:st,onSort:le})=>{var Ze,Re,Je;let Ie=5,$e=()=>d?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[ze,Fe]=(0,r.useState)(""),[E,He]=(0,r.useState)($e),[j,de]=(0,r.useState)(!1),[Z,R]=(0,r.useState)([]),[lt,Ke]=(0,r.useState)(!1),J=(0,nt.useThrottle)(ze,750);(0,r.useEffect)(()=>{e(J,{count:Ie,offset:0,contentType:E==="any"?void 0:E})},[J,E]);let dt=i=>{Z.includes(i.id)?R(u=>u.filter(U=>U!==i.id)):R(f?u=>[...u,i==null?void 0:i.id]:[i.id])},mt=()=>{He($e()),Fe(""),R((a==null?void 0:a.length)?a.map(i=>i.id):[])},ut=()=>{de(i=>!i),j||mt()},Oe=i=>{s((a==null?void 0:a.filter(u=>u.id!==i.id).map(u=>u.id))||[],"")},ct=i=>{i.preventDefault(),s(Z,E),de(!1)},pt=i=>{i.preventDefault(),de(!1),Ge&&Ge()},ft=i=>{i.preventDefault(),e(J,{count:Ie,offset:(t==null?void 0:t.length)||0,contentType:E==="any"?void 0:E}),Ke(!0);let u=setTimeout(()=>{Ke(!1)},750);return()=>clearTimeout(u)},Ae=(0,r.useRef)((0,rt.v4)()),gt=!(a==null?void 0:a.length)||f,vt=p||Ue,_e=v||Be,ht=it||Kt,je=n&&typeof n!="string"?n:null,xt=je?r.default.createElement(je,{className:"h-9 w-9"}):r.default.createElement("img",{src:n,alt:"CMS logo",className:"h-9 w-9"}),bt=i=>{var u,U;if(i.destination&&i.source.droppableId===((u=i.destination)==null?void 0:u.droppableId)){let y=[...a||[]],[me]=(U=y==null?void 0:y.splice(i.source.index,1))!=null?U:[];return y==null||y.splice(i.destination.index,0,me),le==null||le(y.map(z=>z.id)),y}};return r.default.createElement("div",{className:"w-full"},r.default.createElement("div",{className:"relative my-4"},gt&&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:ut,type:"button","aria-haspopup":!0,"aria-expanded":j,"aria-controls":Ae.current},xt,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`},st||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=>He(i.target.value)},d?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:Ae.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(t==null?void 0:t.length)?t.map(i=>r.default.createElement(vt,{key:i.id,isSelected:Z.includes(i.id),result:i,triggerSelection:()=>dt(i)})):w?null:r.default.createElement(ht,{searchText:J||ze,selectedContentType:(Re=(Ze=o==null?void 0:o.find(i=>i.id===E))==null?void 0:Ze.name)!=null?Re:E}),!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:ft},lt?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(H,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(i=>r.default.createElement(De,{key:i.id,className:"bg-white text-primary",onClick:()=>b(i)},i.name))):null),r.default.createElement("div",null,r.default.createElement(H,{buttonType:"unimportant",onClick:pt},"Cancel"),r.default.createElement(H,{className:"ml-5",disabled:!Z.length,onClick:ct,"data-test-id":"entry-accept-button"},"Accept"))))),f?r.default.createElement($.DragDropContext,{onDragEnd:i=>bt(i)},r.default.createElement($.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,U)=>{if(u==null?void 0:u.id)return r.default.createElement($.Draggable,{key:u.id,draggableId:u.id,index:U},(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:z=>Oe(z),onEditClosed:N?z=>N(z):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")),At=({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(at,{height:128,width:128}),t?C.default.createElement("div",{className:"mt-4 text-gray-500"},t):null))),at=({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=Nt(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 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});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var lt=Object.defineProperty;var dt=(e,t)=>{for(var o in t)lt(e,o,{get:t[o],enumerable:!0})};import mt,{createContext as ut,useContext as ct,useState as pt}from"react";var Le=ut(void 0),Pe=({children:e})=>{let[t,o]=pt(),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 mt.createElement(Le.Provider,{value:n},e)},ke=()=>{let e=ct(Le);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Yt(){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 ft}from"@uniformdev/mesh-sdk";import{useEffect as gt,useState as De}from"react";var ro=({autoResizingDisabled:e}={})=>{let[t,o]=De(),[n,r]=De();return gt(()=>{typeof window=="undefined"||n||(typeof window.UniformMeshSDK=="undefined"?ft({autoResizingDisabled:e}).then(s=>{r(s)}).catch(s=>{o(s)}):r(window.UniformMeshSDK))},[e]),{initializing:!n&&!t,error:t,sdk:n}};import Ve,{createContext as vt,useContext as ht}from"react";var Te=vt(void 0),lo=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),Ve.createElement(Te.Provider,{value:t},Ve.createElement(Pe,null,e))},Be=()=>{let e=ht(Te);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function co(){let{sdk:e}=Be();return e}import Ue from"react";import{Button as xt}from"reakit/Button";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(xt,{className:p,ref:g,...f},o)});import L from"react";import*as oe from"react";var bt=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=bt;import*as ne from"react";var Ct=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=Ct;import*as _ from"react";var yt=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=yt;import*as re from"react";var wt=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=wt;import*as ae from"react";var St=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"})),T=St;import*as ie from"react";var Mt=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"})),Z=Mt;var Nt={caution:{icon:T,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:T,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:Z,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"}},Ge=({type:e="info",title:t,children:o,className:n})=>{let r=Nt[e];if(!r)return null;let s=r.icon;return L.createElement("div",{"data-testid":"sdk-ui-callout",className:`rounded-md p-4 ${r.containerColor} ${n||""}`},L.createElement("div",{className:"flex"},L.createElement("div",{className:"flex-shrink-0"},L.createElement(s,{className:`h-5 w-5 ${r.iconColor}`})),L.createElement("div",{className:"ml-3"},t?L.createElement("h3",{className:`text-sm font-medium mb-2 ${r.titleColor}`},t):null,o?L.createElement("div",{className:`text-sm ${r.descriptionColor}`},o):null)))};import P from"react";import{Input as Et}from"reakit/Input";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 E from"react";var Lt=e=>E.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},E.createElement("g",{clipPath:"url(#magnifying-glass_svg__a)"},E.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"}),E.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"})),E.createElement("defs",null,E.createElement("clipPath",{id:"magnifying-glass_svg__a"},E.createElement("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),R=Lt;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(R,{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 D from"react";import{useMenuState as Pt,Menu as kt,MenuButton as Dt}from"reakit/Menu";var $e=D.createContext({}),ze=()=>D.useContext($e),Fe=({menuLabel:e,menuTrigger:t,menuItemsContainerCssClasses:o,placement:n="auto",children:r})=>{let s=Pt();return D.createElement($e.Provider,{value:s},D.createElement(Dt,{...s,ref:t.ref,...t.props},f=>D.cloneElement(t,f)),D.createElement(kt,{...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 He}from"reakit";var Ke=({children:e,className:t,hideMenuOnClick:o=!0,icon:n,...r})=>{let s=ze(),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=l=>{s.hide(),y(l)}}return h};if(typeof e=="function")return B.createElement(He,{...s,...r,className:f},v=>{let h=o?g(v):v,y=e(h);return n?Oe(y,n):y});let p=o?g(r):r;return B.createElement(He,{...s,...p,className:f},n?Oe(e,n):e)};function Oe(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 I,useEffect as Ft,useRef as Ht}from"react";var ce={};dt(ce,{Caution:()=>T,Checkmark:()=>Z,ChevronDown:()=>W,Close:()=>X,Danger:()=>A,ExclamationPoint:()=>O,Info:()=>N,Lightbulb:()=>j,MagnifyingGlass:()=>R,MoreVerticalAlt:()=>G});import*as me from"react";var Vt=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=Vt;import*as U from"react";var Tt=e=>U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e},U.createElement("g",{fillRule:"evenodd"},U.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"}),U.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=Tt;import*as ue from"react";var Bt=e=>ue.createElement("svg",{width:"1em",height:"1em",fill:"currentColor",...e},ue.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"})),G=Bt;import{useThrottle as Kt}from"react-use";import{v4 as Ot}from"uuid";import u,{useState as Ut,useRef as _e,useEffect as Gt}from"react";function Ae(e,t){let o=window.open(e,"_blank"),n=setInterval(()=>{(o==null?void 0:o.closed)&&(clearInterval(n),t())},500)}import{format as It}from"timeago.js";var je=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:n})=>{var y;let r=_e(null),s=_e(null),[f,g]=Ut(!1);Gt(()=>{let l=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",l,!0),document.addEventListener("mousedown",l),()=>{window.removeEventListener("resize",x,!0),document.removeEventListener("scroll",l,!0),document.removeEventListener("mousedown",l)}},[s]);let p=()=>{var l;if(g(!f),s.current&&r.current){let x=(l=r==null?void 0:r.current)==null?void 0:l.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(([l,x],S)=>u.createElement("div",{className:"text-xs",key:S},u.createElement("span",{className:"font-bold mr-2"},l,":"),x))))),e.createdDate&&u.createElement("div",{className:"text-xs"},u.createElement("span",{className:"font-bold mr-2"},"Created:"),It((y=e.createdDate)!=null?y:0)),u.createElement("div",{className:"flex gap-4"},e.metadata?Object.entries(e.metadata).filter(([l])=>["type","status"].includes(l.toLocaleLowerCase())).map(([l,x])=>u.createElement("span",{className:"text-sm",key:l},x)):null),e.metadata?Object.entries(e.metadata).filter(([l])=>!["type","status"].includes(l.toLocaleLowerCase())).map(([l,x])=>u.createElement("div",{className:"text-xs order-1",key:l},u.createElement("span",{className:"font-bold mr-2 order-1"},l,":"),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:l=>{n&&(Ae(l.currentTarget.href,()=>n(e)),l.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:l=>{l.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 $t,useRef as Ze,useEffect as zt}from"react";var Re=({result:e,isSelected:t,triggerSelection:o})=>{let n=Ze(null),r=Ze(null),[s,f]=$t(!1);zt(()=>{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 At,DragDropContext as _t,Draggable as jt}from"react-beautiful-dnd";var Zt=({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(Ge,{type:"info"},o)},In=({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:l,onAddNew:x,onEditClosed:S,onCancel:pe,noResultsComponent:Je,helpComponent:We,onSort:q})=>{var Me,Ne,Ee;let fe=5,ge=()=>l?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[ve,he]=I(""),[M,xe]=I(ge),[$,Q]=I(!1),[z,F]=I([]),[Xe,be]=I(!1),H=Kt(ve,750);Ft(()=>{e(H,{count:fe,offset:0,contentType:M==="any"?void 0:M})},[H,M]);let qe=a=>{z.includes(a.id)?F(c=>c.filter(k=>k!==a.id)):F(f?c=>[...c,a==null?void 0:a.id]:[a.id])},Qe=()=>{xe(ge()),he(""),F((n==null?void 0:n.length)?n.map(a=>a.id):[])},Ye=()=>{Q(a=>!a),$||Qe()},Ce=a=>{s((n==null?void 0:n.filter(c=>c.id!==a.id).map(c=>c.id))||[],"")},et=a=>{a.preventDefault(),s(z,M),Q(!1)},tt=a=>{a.preventDefault(),Q(!1),pe&&pe()},ot=a=>{a.preventDefault(),e(H,{count:fe,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=Ht(Ot()),nt=!(n==null?void 0:n.length)||f,rt=p||Re,we=v||je,at=Je||Zt,Se=r&&typeof r!="string"?r:null,it=Se?i.createElement(Se,{className:"h-9 w-9"}):i.createElement("img",{src:r,alt:"CMS logo",className:"h-9 w-9"}),st=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(V=>V.id)),b}};return i.createElement("div",{className:"w-full"},i.createElement("div",{className:"relative my-4"},nt&&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:Ye,type:"button","aria-haspopup":!0,"aria-expanded":$,"aria-controls":ye.current},it,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 ${$?"rotate-180":"rotate-0"}`})))),i.createElement("div",{className:`${$?"block":"hidden"} py-3 px-4 space-y-4 bg-white rounded-lg border border-gray-300`},We||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)},l?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: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(rt,{key:a.id,isSelected:z.includes(a.id),result:a,triggerSelection:()=>qe(a)})):y?null:i.createElement(at,{searchText:H||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:ot},Xe?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(Ke,{key:a.id,className:"bg-white text-primary",onClick:()=>x(a)},a.name))):null),i.createElement("div",null,i.createElement(K,{buttonType:"unimportant",onClick:tt},"Cancel"),i.createElement(K,{className:"ml-5",disabled:!z.length,onClick:et,"data-test-id":"entry-accept-button"},"Accept"))))),f?i.createElement(_t,{onDragEnd:a=>st(a)},i.createElement(At,{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(G,{className:"text-brand-secondary-1 absolute left-1.5",width:24,height:24}),i.createElement(G,{className:"text-brand-secondary-1",width:24,height:24})),i.createElement(we,{key:`selected-item-${c.id}`,logoIcon:r,selectedItem:c,onDeselect:V=>Ce(V),onEditClosed:S?V=>S(V):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 Fn=({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(Rt,{height:128,width:128}),t?C.createElement("div",{className:"mt-4 text-gray-500"},t):null))),Rt=({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,Ge as Callout,In as CmsEntrySearch,Re as DefaultSearchRow,je as DefaultSelectedItem,ce as Icons,se as Input,Ie as KeywordSearchInput,Rt as LoadingIcon,de as LoadingIndicator,Fn as LoadingOverlay,Fe as Menu,$e as MenuContext,Ke as MenuItem,Le as UniformMeshLocationContext,Pe as UniformMeshLocationContextProvider,Te as UniformMeshSdkContext,lo as UniformMeshSdkContextProvider,ro as useInitializeUniformMeshSdk,ze as useMenuContext,Yt as useUniformMeshLocation,ke as useUniformMeshLocationContext,co as useUniformMeshSdk,Be as useUniformMeshSdkContext};
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};