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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty;var Qt=(t,n)=>{for(var o in n)Se(t,o,{get:n[o],enumerable:!0})},ye=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Rr(n))!Lr.call(t,a)&&a!==o&&Se(t,a,{get:()=>n[a],enumerable:!(r=Pr(n,a))||r.enumerable});return t},U=(t,n,o)=>(ye(t,n,"default"),o&&ye(o,n,"default")),Z=(t,n,o)=>(o=t!=null?Cr(kr(t)):{},ye(n||!t||!t.__esModule?Se(o,"default",{value:t,enumerable:!0}):o,t)),xr=t=>ye(Se({},"__esModule",{value:!0}),t);var z={};Qt(z,{Button:()=>u.Button,Callout:()=>u.Callout,DefaultSearchRow:()=>lt,DefaultSelectedItem:()=>nt,EntrySearch:()=>Ct,Heading:()=>u.Heading,Icons:()=>xe,Input:()=>u.Input,InputSelect:()=>u.InputSelect,InputToggle:()=>u.InputToggle,KeywordSearchInput:()=>u.InputKeywordSearch,LoadingIndicator:()=>u.LoadingIndicator,LoadingOverlay:()=>u.LoadingOverlay,Menu:()=>u.Menu,MenuItem:()=>u.MenuItem,ProductPreviewList:()=>Ze,ProductQuery:()=>Gr,ProductQueryContext:()=>Ne,ProductSearch:()=>qr,ProductSearchContext:()=>Ut,ProductSearchRow:()=>Tt,ProductSelectedItem:()=>zt,ResolvableLoadingValue:()=>Ke,ScrollableList:()=>u.ScrollableList,ScrollableListItem:()=>u.ScrollableListItem,SelectionField:()=>Qe,Textarea:()=>u.Textarea,Theme:()=>u.Theme,UniformMeshLocationContext:()=>Ae,UniformMeshLocationContextProvider:()=>Be,UniformMeshSdkContext:()=>He,UniformMeshSdkContextProvider:()=>Er,badgeIcon:()=>Ie,draggableContainer:()=>yt,draggableIcon:()=>Te,draggableIconOffset:()=>wt,draggableIconWrapper:()=>St,entrySearchBtn:()=>ut,entrySearchConfig:()=>gt,entrySearchConfigHidden:()=>ft,entrySearchLoadMoreBtn:()=>mt,entrySearchResultList:()=>vt,entrySearchSelectIcon:()=>ht,entrySearchSelectImg:()=>bt,entrySearchSelectInput:()=>_r,entrySearchSelectOption:()=>Zr,entrySearchWrapper:()=>pt,productSearchRowActiveIcon:()=>Vt,productSearchRowCategory:()=>xt,productSearchRowContainer:()=>Pt,productSearchRowContent:()=>Rt,productSearchRowContentActive:()=>kt,productSearchRowDetails:()=>Mt,productSearchRowTitle:()=>Lt,productSelectedItemContainer:()=>It,productSelectedItemContent:()=>Gt,productSelectedItemDetails:()=>Dt,productSelectedItemImage:()=>De,searchRowBtn:()=>ct,searchRowContainer:()=>at,searchRowContainerActive:()=>it,searchRowPopover:()=>st,searchRowText:()=>Ee,searchRowTextSmall:()=>Ve,selectItemLinkBtn:()=>Me,selectItemLinkContainer:()=>ot,selectItemPopover:()=>rt,selectItemPopoverLabel:()=>ge,selectItemSmallText:()=>q,selectedItemCloseIcon:()=>tt,selectedItemContainer:()=>qe,selectedItemCopy:()=>Ye,selectedItemDetails:()=>Xe,selectedItemIcon:()=>et,selectedItemInner:()=>Je,selectedItemTitle:()=>je,useInitializeUniformMeshSdk:()=>Vr,useProductQueryContext:()=>_e,useProductSearchContext:()=>fe,useUniformMeshLocation:()=>Mr,useUniformMeshLocationContext:()=>Oe,useUniformMeshSdk:()=>Tr,useUniformMeshSdkContext:()=>Fe});module.exports=xr(z);var e=require("@emotion/react"),I=Z(require("react"));var ae=require("react"),Ae=(0,ae.createContext)(void 0),Be=({children:t})=>{let[n,o]=(0,ae.useState)(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async d=>{await a.setValue(d),o(window.UniformMeshSDK.getCurrentLocation())}}}}return(0,e.jsx)(Ae.Provider,{value:r},t)},Oe=()=>{let t=(0,ae.useContext)(Ae);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Mr(){let{location:t}=Oe();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata()}}var Nt=require("@uniformdev/mesh-sdk"),ue=require("react"),Vr=({autoResizingDisabled:t}={})=>{let[n,o]=(0,ue.useState)(),[r,a]=(0,ue.useState)();return(0,ue.useEffect)(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?(0,Nt.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(d=>{a(d)}).catch(d=>{o(d)}):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};var we=require("react");var _t=require("@uniformdev/design-system"),He=(0,we.createContext)(void 0),Er=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(He.Provider,{value:n},(0,e.jsx)(_t.Theme,null),(0,e.jsx)(Be,null,t))},Fe=()=>{let t=(0,we.useContext)(He);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Tr(){let{sdk:t}=Fe();return t}var We=Z(require("react"));var H=Z(require("react"));var ie=require("@emotion/react"),Zt=require("@uniformdev/design-system");var $e=Z(require("react")),Ke=({value:t,text:n,loading:o})=>(0,e.jsx)($e.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)($e.default.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Qe=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:d,onRemove:m})=>{var b;let f=(b=a==null?void 0:a.filter(i=>!(r!=null&&r.includes(i.id.toString()))))!=null?b:[],v=(i,h)=>{i.preventDefault(),m(h)};return(0,e.jsx)("div",null,(0,e.jsx)(Zt.InputSelect,{id:t,name:t,label:n,onChange:i=>d(i.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.map(i=>({value:i.id,label:i.name||i.id}))],css:Array.isArray(r)&&r.length>0?ie.css`
1
+ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var kr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty;var Nt=(t,n)=>{for(var o in n)Se(t,o,{get:n[o],enumerable:!0})},ye=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of kr(n))!Lr.call(t,a)&&a!==o&&Se(t,a,{get:()=>n[a],enumerable:!(r=Rr(n,a))||r.enumerable});return t},U=(t,n,o)=>(ye(t,n,"default"),o&&ye(o,n,"default")),W=(t,n,o)=>(o=t!=null?Pr(xr(t)):{},ye(n||!t||!t.__esModule?Se(o,"default",{value:t,enumerable:!0}):o,t)),Mr=t=>ye(Se({},"__esModule",{value:!0}),t);var z={};Nt(z,{Button:()=>p.Button,Callout:()=>p.Callout,DefaultSearchRow:()=>pt,DefaultSelectedItem:()=>nt,EntrySearch:()=>Pt,Heading:()=>p.Heading,Icons:()=>Le,Input:()=>p.Input,InputSelect:()=>p.InputSelect,InputToggle:()=>p.InputToggle,KeywordSearchInput:()=>p.InputKeywordSearch,Label:()=>p.Label,LoadingIndicator:()=>p.LoadingIndicator,LoadingOverlay:()=>p.LoadingOverlay,Menu:()=>p.Menu,MenuItem:()=>p.MenuItem,ProductPreviewList:()=>We,ProductQuery:()=>zr,ProductQueryContext:()=>Ne,ProductSearch:()=>Jr,ProductSearchContext:()=>At,ProductSearchRow:()=>It,ProductSelectedItem:()=>Ut,ResolvableLoadingValue:()=>Ke,ScrollableList:()=>p.ScrollableList,ScrollableListItem:()=>p.ScrollableListItem,SelectionField:()=>Qe,Switch:()=>p.Switch,Textarea:()=>p.Textarea,Theme:()=>p.Theme,UniformMeshLocationContext:()=>Ae,UniformMeshLocationContextProvider:()=>Be,UniformMeshSdkContext:()=>He,UniformMeshSdkContextProvider:()=>Tr,badgeIcon:()=>Ie,draggableContainer:()=>St,draggableIcon:()=>Te,draggableIconOffset:()=>Ct,draggableIconWrapper:()=>wt,entrySearchBtn:()=>mt,entrySearchConfig:()=>ft,entrySearchConfigHidden:()=>vt,entrySearchLoadMoreBtn:()=>gt,entrySearchResultList:()=>ht,entrySearchSelectIcon:()=>bt,entrySearchSelectImg:()=>yt,entrySearchSelectInput:()=>Wr,entrySearchSelectOption:()=>Zr,entrySearchWrapper:()=>ut,productSearchRowActiveIcon:()=>Et,productSearchRowCategory:()=>Mt,productSearchRowContainer:()=>Rt,productSearchRowContent:()=>kt,productSearchRowContentActive:()=>xt,productSearchRowDetails:()=>Vt,productSearchRowTitle:()=>Lt,productSelectedItemContainer:()=>Dt,productSelectedItemContent:()=>zt,productSelectedItemDetails:()=>Gt,productSelectedItemImage:()=>De,searchRowBtn:()=>dt,searchRowContainer:()=>at,searchRowContainerActive:()=>st,searchRowContainerWithPopover:()=>it,searchRowPopover:()=>ct,searchRowText:()=>Ee,searchRowTextSmall:()=>Ve,selectItemLinkBtn:()=>Me,selectItemLinkContainer:()=>ot,selectItemPopover:()=>rt,selectItemPopoverLabel:()=>ge,selectItemSmallText:()=>q,selectedItemCloseIcon:()=>tt,selectedItemContainer:()=>qe,selectedItemCopy:()=>Ye,selectedItemDetails:()=>Xe,selectedItemIcon:()=>et,selectedItemInner:()=>Je,selectedItemTitle:()=>je,useInitializeUniformMeshSdk:()=>Er,useProductQueryContext:()=>_e,useProductSearchContext:()=>fe,useUniformMeshLocation:()=>Vr,useUniformMeshLocationContext:()=>Oe,useUniformMeshSdk:()=>Ir,useUniformMeshSdkContext:()=>Fe});module.exports=Mr(z);var e=require("@emotion/react"),I=W(require("react"));var ae=require("react"),Ae=(0,ae.createContext)(void 0),Be=({children:t})=>{let[n,o]=(0,ae.useState)(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(d,m)=>{await a.setValue(d,m),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async d=>{await a.setValidationResult(d)}}}}return(0,e.jsx)(Ae.Provider,{value:r},t)},Oe=()=>{let t=(0,ae.useContext)(Ae);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Vr(){let{location:t}=Oe();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}var _t=require("@uniformdev/mesh-sdk"),ue=require("react"),Er=({autoResizingDisabled:t}={})=>{let[n,o]=(0,ue.useState)(),[r,a]=(0,ue.useState)();return(0,ue.useEffect)(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?(0,_t.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(d=>{a(d)}).catch(d=>{o(d)}):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};var we=require("react");var Wt=require("@uniformdev/design-system"),He=(0,we.createContext)(void 0),Tr=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(He.Provider,{value:n},(0,e.jsx)(Wt.Theme,null),(0,e.jsx)(Be,null,t))},Fe=()=>{let t=(0,we.useContext)(He);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Ir(){let{sdk:t}=Fe();return t}var Ze=W(require("react"));var H=W(require("react"));var ie=require("@emotion/react"),Zt=require("@uniformdev/design-system");var $e=W(require("react")),Ke=({value:t,text:n,loading:o})=>(0,e.jsx)($e.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)($e.default.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Qe=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:d,onRemove:m})=>{var b;let v=(b=a==null?void 0:a.filter(i=>!(r!=null&&r.includes(i.id.toString()))))!=null?b:[],h=(i,g)=>{i.preventDefault(),m(g)};return(0,e.jsx)("div",null,(0,e.jsx)(Zt.InputSelect,{id:t,name:t,label:n,onChange:i=>d(i.target.value),disabled:o,options:[{value:"",label:"Add..."},...v.map(i=>({value:i.id,label:i.name||i.id}))],css:Array.isArray(r)&&r.length>0?ie.css`
2
2
  margin-bottom: var(--spacing-base);
3
- `:""}),r==null?void 0:r.map(i=>{var h;return(0,e.jsx)("div",{css:ie.css`
3
+ `:""}),r==null?void 0:r.map(i=>{var g;return(0,e.jsx)("div",{css:ie.css`
4
4
  font-size: var(--fs-sm);
5
5
  display: inline-flex;
6
6
  align-items: center;
@@ -12,64 +12,64 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
12
12
  `,key:i},(0,e.jsx)("span",{css:ie.css`
13
13
  padding: var(--spacing-3);
14
14
  color: var(--gray-800);
15
- `},(0,e.jsx)(Ke,{value:i,loading:o,text:(h=a.find(P=>P.id===i))==null?void 0:h.name})),(0,e.jsx)("button",{css:ie.css`
15
+ `},(0,e.jsx)(Ke,{value:i,loading:o,text:(g=a.find(w=>w.id===i))==null?void 0:g.name})),(0,e.jsx)("button",{css:ie.css`
16
16
  padding: var(--spacing-3);
17
17
  border-left: 1px solid var(--gray-300);
18
- `,title:"remove",onClick:P=>v(P,i)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:ie.css`
18
+ `,title:"remove",onClick:w=>h(w,i)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:ie.css`
19
19
  height: 1.25rem;
20
20
  width: 1.25rem;
21
21
  pointer-events: none;
22
22
  display: block;
23
- `,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Ir=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),Ce=Ir;var Dr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),Pe=Dr;var Re=require("react-use"),x=require("@uniformdev/design-system"),R=require("@emotion/react"),Wt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Gr=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:d,brandsLoading:m,logoIcon:f,onGetProducts:v,sortOptions:b,sortOrderOptions:i,categoryLabel:h="Product Category",brandLabel:P="Brand",disableBrands:ee,restrictToSingleCategory:K=!1})=>{var V,_,oe;let w=async s=>{n({...Wt,...t||{},...s})},y=(0,H.useMemo)(()=>({...Wt,...t||{}}),[t]),[te,Y]=(0,Re.useAsyncFn)(async s=>await v(s),[v]);(0,Re.useDebounce)(async()=>{await Y({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let A=(0,H.useMemo)(()=>{let s=[];return r==null||r.forEach(E=>{let le=Jt(E,void 0);s.push(...le)}),s},[r]),Q=(0,H.useMemo)(()=>[{value:"",label:"All categories"},...A.map(s=>({label:s.name,value:s.id}))],[A]),he=(0,H.useMemo)(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),re=s=>{let E=(t==null?void 0:t.categories)||[];w({categories:[...E,s]})},N=s=>{var E;w({categories:(E=t==null?void 0:t.categories)==null?void 0:E.filter(le=>le!==s)})},B=s=>{w({brand:s.target.value})},p=s=>{w({count:s||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(Ne.Provider,{value:{categories:r,logoIcon:f}},(0,e.jsx)("div",{css:R.css`
23
+ `,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Dr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),Ce=Dr;var Gr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),Pe=Gr;var Re=require("react-use"),L=require("@uniformdev/design-system"),R=require("@emotion/react"),qt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},zr=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:d,brandsLoading:m,logoIcon:v,onGetProducts:h,sortOptions:b,sortOrderOptions:i,categoryLabel:g="Product Category",brandLabel:w="Brand",disableBrands:ee,restrictToSingleCategory:K=!1})=>{var V,_,oe;let C=async s=>{n({...qt,...t||{},...s})},y=(0,H.useMemo)(()=>({...qt,...t||{}}),[t]),[te,j]=(0,Re.useAsyncFn)(async s=>await h(s),[h]);(0,Re.useDebounce)(async()=>{await j({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let A=(0,H.useMemo)(()=>{let s=[];return r==null||r.forEach(E=>{let le=Xt(E,void 0);s.push(...le)}),s},[r]),Q=(0,H.useMemo)(()=>[{value:"",label:"All categories"},...A.map(s=>({label:s.name,value:s.id}))],[A]),he=(0,H.useMemo)(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),re=s=>{let E=(t==null?void 0:t.categories)||[];C({categories:[...E,s]})},N=s=>{var E;C({categories:(E=t==null?void 0:t.categories)==null?void 0:E.filter(le=>le!==s)})},B=s=>{C({brand:s.target.value})},u=s=>{C({count:s||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(Ne.Provider,{value:{categories:r,logoIcon:v}},(0,e.jsx)("div",{css:R.css`
24
24
  > :not(:last-child) {
25
25
  margin-bottom: var(--spacing-md);
26
26
  }
27
- `},K?(0,e.jsx)(x.InputSelect,{id:"selection-field-product-category",label:h,disabled:a,value:(_=(V=y.categories)==null?void 0:V[0])!=null?_:"",options:Q,onChange:s=>{w({categories:s.target.value===""?[]:[s.target.value]})}}):(0,e.jsx)(Qe,{loading:d||!1,id:"selection-field-product-category",label:h,onAdd:re,onRemove:N,selectedValues:y.categories,values:A}),(0,e.jsx)("div",{css:R.css`
27
+ `},K?(0,e.jsx)(L.InputSelect,{id:"selection-field-product-category",label:g,disabled:a,value:(_=(V=y.categories)==null?void 0:V[0])!=null?_:"",options:Q,onChange:s=>{C({categories:s.target.value===""?[]:[s.target.value]})}}):(0,e.jsx)(Qe,{loading:d||!1,id:"selection-field-product-category",label:g,onAdd:re,onRemove:N,selectedValues:y.categories,values:A}),(0,e.jsx)("div",{css:R.css`
28
28
  display: flex;
29
29
  flex-wrap: wrap;
30
30
  column-gap: var(--spacing-lg);
31
31
  row-gap: var(--spacing-md);
32
- ${(0,x.mq)("md")} {
32
+ ${(0,L.mq)("md")} {
33
33
  flex-wrap: nowrap;
34
34
  }
35
35
  `},ee?null:(0,e.jsx)("div",{css:R.css`
36
36
  width: 50%;
37
- `},(0,e.jsx)(x.InputSelect,{id:"brand",name:"brand",label:P,disabled:m,value:y.brand,onChange:B,options:[{value:"",label:"Choose..."},...he.map(s=>({value:s.id,label:s.name}))]})),(0,e.jsx)("div",{css:R.css`
37
+ `},(0,e.jsx)(L.InputSelect,{id:"brand",name:"brand",label:w,disabled:m,value:y.brand,onChange:B,options:[{value:"",label:"Choose..."},...he.map(s=>({value:s.id,label:s.name}))]})),(0,e.jsx)("div",{css:R.css`
38
38
  flex-grow: 1;
39
39
  position: relative;
40
- `},(0,e.jsx)(x.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:s=>w({keyword:s.target.value})}))),(0,e.jsx)("div",{css:R.css`
40
+ `},(0,e.jsx)(L.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:s=>C({keyword:s.target.value})}))),(0,e.jsx)("div",{css:R.css`
41
41
  display: flex;
42
42
  flex-wrap: wrap;
43
43
  column-gap: var(--spacing-lg);
44
44
  row-gap: var(--spacing-md);
45
- ${(0,x.mq)("md")} {
45
+ ${(0,L.mq)("md")} {
46
46
  flex-wrap: nowrap;
47
47
  }
48
48
  `},(0,e.jsx)("div",{css:R.css`
49
49
  width: 100%;
50
- ${(0,x.mq)("md")} {
50
+ ${(0,L.mq)("md")} {
51
51
  width: 33.333333%;
52
52
  }
53
53
  position: relative;
54
- `},(0,e.jsx)(x.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:y.count,onChange:s=>p(s.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:R.css`
54
+ `},(0,e.jsx)(L.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:y.count,onChange:s=>u(s.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:R.css`
55
55
  position: absolute;
56
56
  bottom: var(--spacing-sm);
57
57
  right: var(--spacing-sm);
58
58
  display: flex;
59
59
  gap: var(--spacing-sm);
60
- `},(0,e.jsx)(qt,{onCountChange:()=>p(y.count-1),countIcon:"decrement",disabled:y.count===1}),(0,e.jsx)(qt,{onCountChange:()=>p(y.count+1),countIcon:"increment"}))),Array.isArray(b)&&b.length>0?(0,e.jsx)("div",{css:R.css`
60
+ `},(0,e.jsx)(Jt,{onCountChange:()=>u(y.count-1),countIcon:"decrement",disabled:y.count===1}),(0,e.jsx)(Jt,{onCountChange:()=>u(y.count+1),countIcon:"increment"}))),Array.isArray(b)&&b.length>0?(0,e.jsx)("div",{css:R.css`
61
61
  flex-grow: 1;
62
- ${(0,x.mq)("md")} {
62
+ ${(0,L.mq)("md")} {
63
63
  width: 33.333333%;
64
64
  }
65
- `},(0,e.jsx)(x.InputSelect,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:s=>w({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...b.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(i)&&i.length>0?(0,e.jsx)("div",{css:R.css`
65
+ `},(0,e.jsx)(L.InputSelect,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:s=>C({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...b.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(i)&&i.length>0?(0,e.jsx)("div",{css:R.css`
66
66
  flex-grow: 1;
67
- `},(0,e.jsx)(x.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:s=>w({sortOrder:s.target.value}),options:i.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),(0,e.jsx)("div",null,(0,e.jsx)("h3",{css:R.css`
67
+ `},(0,e.jsx)(L.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:s=>C({sortOrder:s.target.value}),options:i.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),(0,e.jsx)("div",null,(0,e.jsx)("h3",{css:R.css`
68
68
  font-size: var(--fs-md);
69
69
  line-height: var(--spacing-md);
70
70
  font-weight: var(--fw-bold);
71
71
  margin-bottom: var(--spacing-xs);
72
- `},"Result Preview"),(0,e.jsx)(Ze,{products:(oe=te.value)==null?void 0:oe.products}))))};function Jt(t,n){var d;let o=[],r=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${r}${t.name}`};return o.push(a),(d=t.children)==null||d.forEach(m=>{let f=Jt(m,a);o.push(...f)}),o}function qt({onCountChange:t,countIcon:n,disabled:o}){return(0,e.jsx)("button",{css:R.css`
72
+ `},"Result Preview"),(0,e.jsx)(We,{products:(oe=te.value)==null?void 0:oe.products}))))};function Xt(t,n){var d;let o=[],r=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${r}${t.name}`};return o.push(a),(d=t.children)==null||d.forEach(m=>{let v=Xt(m,a);o.push(...v)}),o}function Jt({onCountChange:t,countIcon:n,disabled:o}){return(0,e.jsx)("button",{css:R.css`
73
73
  width: 2.25rem;
74
74
  height: 2.25rem;
75
75
  border: 1px solid var(--gray-300);
@@ -91,12 +91,12 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
91
91
  `}):(0,e.jsx)(Pe,{css:R.css`
92
92
  width: 1rem;
93
93
  height: 1rem;
94
- `}))}var Ne=H.default.createContext(void 0),_e=()=>{let t=(0,H.useContext)(Ne);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function W({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?(0,e.jsx)(r,{className:o}):(0,e.jsx)("img",{src:t,alt:n,className:o})}var k=require("@emotion/react"),Xt=require("@uniformdev/design-system"),Ze=({products:t})=>{let{categories:n,logoIcon:o}=_e();return(0,e.jsx)(We.default.Fragment,null,(0,e.jsx)("p",{css:k.css`
94
+ `}))}var Ne=H.default.createContext(void 0),_e=()=>{let t=(0,H.useContext)(Ne);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function Z({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?(0,e.jsx)(r,{className:o}):(0,e.jsx)("img",{src:t,alt:n,className:o})}var k=require("@emotion/react"),Yt=require("@uniformdev/design-system"),We=({products:t})=>{let{categories:n,logoIcon:o}=_e();return(0,e.jsx)(Ze.default.Fragment,null,(0,e.jsx)("p",{css:k.css`
95
95
  margin-bottom: var(--spacing-base);
96
96
  `},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[k.css`
97
97
  max-height: 24rem;
98
98
  overflow-x: auto;
99
- `,Xt.scrollbarStyles]},t==null?void 0:t.map((r,a)=>{var f;let[d]=(r==null?void 0:r.categories)||[],m=typeof d=="undefined"||!n||(f=n.find(v=>v.id===d.id))==null?void 0:f.name;return(0,e.jsx)("li",{key:`product-${r.id}`,css:k.css`
99
+ `,Yt.scrollbarStyles]},t==null?void 0:t.map((r,a)=>{var v;let[d]=(r==null?void 0:r.categories)||[],m=typeof d=="undefined"||!n||(v=n.find(h=>h.id===d.id))==null?void 0:v.name;return(0,e.jsx)("li",{key:`product-${r.id}`,css:k.css`
100
100
  border: 1px solid var(--gray-300);
101
101
  border-radius: var(--rounded-md);
102
102
  background-color: var(--gray-100);
@@ -124,7 +124,7 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
124
124
  `},r.name,m&&(0,e.jsx)("span",{css:k.css`
125
125
  display: block;
126
126
  font-weight: var(--fw-regular);
127
- `},m)),r&&(0,e.jsx)(We.default.Fragment,null,(0,e.jsx)("p",{css:k.css`
127
+ `},m)),r&&(0,e.jsx)(Ze.default.Fragment,null,(0,e.jsx)("p",{css:k.css`
128
128
  margin-right: var(--spacing-lg);
129
129
  font-size: var(--fs-sm);
130
130
  `},"SKU: ",r.sku||r.id,(0,e.jsx)("br",null)),r.price!==void 0?(0,e.jsx)("p",{css:k.css`
@@ -147,10 +147,10 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
147
147
  `,href:r.url,title:`Goto ${r.name}`,target:"__blank",rel:"noopener"},(0,e.jsx)("span",{css:k.css`
148
148
  font-size: var(--fs-sm);
149
149
  margin-right: var(--spacing-sm);
150
- `},"Edit"),o?(0,e.jsx)(W,{src:o,alt:"Logo",css:k.css`
150
+ `},"Edit"),o?(0,e.jsx)(Z,{src:o,alt:"Logo",css:k.css`
151
151
  width: 2.25rem;
152
152
  height: 2.25rem;
153
- `}):null))))})))};var X=Z(require("react"));var G=Z(require("react"));var xe={};Qt(xe,{Caution:()=>Yt,Checkmark:()=>ke,ChevronDown:()=>Le,Close:()=>se,Danger:()=>jt,ExclamationPoint:()=>er,Info:()=>ce,Lightbulb:()=>tr,MagnifyingGlass:()=>rr,MaximizeAlt:()=>or,Minus:()=>Pe,MoreVerticalAlt:()=>me,Plus:()=>Ce});var zr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},(0,e.jsx)("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"})),Yt=zr;var Ur=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("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"})),ke=Ur;var Ar=t=>(0,e.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},(0,e.jsx)("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),Le=Ar;var Br=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},(0,e.jsx)("g",{fillRule:"evenodd"},(0,e.jsx)("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"}),(0,e.jsx)("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"}))),se=Br;var Or=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("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"})),jt=Or;var Hr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},(0,e.jsx)("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"})),er=Hr;var Fr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("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"}),(0,e.jsx)("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"})),ce=Fr;var $r=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("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"})),tr=$r;var Kr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("g",{clipPath:"url(#magnifying-glass_svg__a)"},(0,e.jsx)("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"}),(0,e.jsx)("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"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"magnifying-glass_svg__a"},(0,e.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),rr=Kr;var Qr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("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"})),or=Qr;var Nr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("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"})),me=Nr;var sr=require("react-use"),cr=require("uuid");var F=Z(require("react"));function nr(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}var ir=require("timeago.js");var M=require("@emotion/react"),ar=require("@uniformdev/design-system"),qe=M.css`
153
+ `}):null))))})))};var Y=W(require("react"));var G=W(require("react"));var Le={};Nt(Le,{Caution:()=>jt,Checkmark:()=>ke,ChevronDown:()=>xe,Close:()=>se,Danger:()=>er,ExclamationPoint:()=>tr,Info:()=>ce,Lightbulb:()=>rr,MagnifyingGlass:()=>or,MaximizeAlt:()=>nr,Minus:()=>Pe,MoreVerticalAlt:()=>me,Plus:()=>Ce});var Ur=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},(0,e.jsx)("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"})),jt=Ur;var Ar=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("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"})),ke=Ar;var Br=t=>(0,e.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},(0,e.jsx)("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"})),xe=Br;var Or=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},(0,e.jsx)("g",{fillRule:"evenodd"},(0,e.jsx)("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"}),(0,e.jsx)("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"}))),se=Or;var Hr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("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"})),er=Hr;var Fr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},(0,e.jsx)("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"})),tr=Fr;var $r=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("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"}),(0,e.jsx)("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"})),ce=$r;var Kr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("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"})),rr=Kr;var Qr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("g",{clipPath:"url(#magnifying-glass_svg__a)"},(0,e.jsx)("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"}),(0,e.jsx)("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"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"magnifying-glass_svg__a"},(0,e.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),or=Qr;var Nr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("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"})),nr=Nr;var _r=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("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"})),me=_r;var cr=require("react-use"),dr=require("uuid");var F=W(require("react"));function ar(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}var sr=require("timeago.js");var M=require("@emotion/react"),ir=require("@uniformdev/design-system"),qe=M.css`
154
154
  border: 1px solid var(--gray-200);
155
155
  background: var(--gray-50);
156
156
  border-radius: var(--rounded-base);
@@ -185,6 +185,7 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
185
185
  background: var(--white);
186
186
  border-radius: var(--rounded-base);
187
187
  border-left: 4px solid var(--brand-secondary-3);
188
+ box-shadow: var(--shadow-base);
188
189
  position: fixed;
189
190
  padding: var(--spacing-base);
190
191
  z-index: var(--z-10);
@@ -199,8 +200,9 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
199
200
  flex-direction: column;
200
201
  gap: var(--spacing-sm);
201
202
 
202
- ${(0,ar.mq)("md")} {
203
+ ${(0,ir.mq)("md")} {
203
204
  flex-direction: row;
205
+ min-width: 200px;
204
206
  }
205
207
  `,Me=M.css`
206
208
  align-items: center;
@@ -215,40 +217,42 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
215
217
  &:hover {
216
218
  background: var(--gray-50);
217
219
  }
218
- `;var O=require("@emotion/react");var nt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var b;let a=(0,F.useRef)(null),d=(0,F.useRef)(null),[m,f]=(0,F.useState)(!1);(0,F.useEffect)(()=>{let i=P=>{a.current&&!a.current.contains(P.target)&&d.current&&!d.current.contains(P.target)&&f(!1)},h=()=>{f(!1)};return window.addEventListener("resize",h,!0),document.addEventListener("scroll",i,!0),document.addEventListener("mousedown",i),()=>{window.removeEventListener("resize",h,!0),document.removeEventListener("scroll",i,!0),document.removeEventListener("mousedown",i)}},[d]);let v=()=>{var i;if(f(!m),d.current&&a.current){let h=(i=a==null?void 0:a.current)==null?void 0:i.getBoundingClientRect();d.current.style.top=`${h.top+30}px`}};return(0,e.jsx)("div",{css:qe,key:t.id},(0,e.jsx)("div",{css:Je},(0,e.jsx)("div",{css:Xe},(0,e.jsx)("div",{css:Ye},(0,e.jsx)("h4",{css:[je,t.popoverData?O.css`
220
+ `;var O=require("@emotion/react");var nt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var b;let a=(0,F.useRef)(null),d=(0,F.useRef)(null),[m,v]=(0,F.useState)(!1);(0,F.useEffect)(()=>{let i=w=>{a.current&&!a.current.contains(w.target)&&d.current&&!d.current.contains(w.target)&&v(!1)},g=()=>{v(!1)};return window.addEventListener("resize",g,!0),document.addEventListener("scroll",i,!0),document.addEventListener("mousedown",i),()=>{window.removeEventListener("resize",g,!0),document.removeEventListener("scroll",i,!0),document.removeEventListener("mousedown",i)}},[d]);let h=()=>{var i;if(v(!m),d.current&&a.current){let g=(i=a==null?void 0:a.current)==null?void 0:i.getBoundingClientRect(),w=d.current.offsetWidth;d.current.style.top=`${g.top+30}px`,d.current.style.left=`${g.left-w+30}px`}};return(0,e.jsx)("div",{css:qe,key:t.id},(0,e.jsx)("div",{css:Je},(0,e.jsx)("div",{css:Xe},(0,e.jsx)("div",{css:Ye},(0,e.jsx)("h4",{css:[je,t.popoverData?O.css`
219
221
  margin-bottom: var(--spacing-sm);
220
222
  `:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(F.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css:O.css`
221
223
  margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
222
- `,"aria-controls":"path-details","aria-expanded":m,onClick:v},(0,e.jsx)(ce,{width:24,height:24,css:O.css`
224
+ `,"aria-controls":"path-details","aria-expanded":m,onClick:h},(0,e.jsx)(ce,{width:24,height:24,css:O.css`
223
225
  color: var(--gray-400);
224
226
  `})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!m,ref:d,css:[rt,m?O.css`
225
227
  visibility: visible;
226
228
  `:O.css`
227
229
  visibility: hidden;
228
- `]},Object.entries(t.popoverData).map(([i,h],P)=>(0,e.jsx)("div",{css:q,key:P},(0,e.jsx)("span",{css:ge},i,":"),h)))):null),t.createdDate&&(0,e.jsx)("div",{css:q},(0,e.jsx)("span",{css:ge},"Created:"),(0,ir.format)((b=t.createdDate)!=null?b:0)),(0,e.jsx)("div",{css:O.css`
230
+ `]},Object.entries(t.popoverData).map(([i,g],w)=>(0,e.jsx)("div",{css:q,key:w},(0,e.jsx)("span",{css:ge},i,":"),g)))):null),t.createdDate&&(0,e.jsx)("div",{css:q},(0,e.jsx)("span",{css:ge},"Created:"),(0,sr.format)((b=t.createdDate)!=null?b:0)),(0,e.jsx)("div",{css:O.css`
229
231
  display: flex;
230
232
  gap: var(--spacing-base);
231
- `},t.metadata?Object.entries(t.metadata).filter(([i])=>["type","status"].includes(i.toLocaleLowerCase())).map(([i,h])=>(0,e.jsx)("span",{css:q,key:i},h)):null),t.metadata?Object.entries(t.metadata).filter(([i])=>!["type","status"].includes(i.toLocaleLowerCase())).map(([i,h])=>(0,e.jsx)("div",{css:[q,O.css`
233
+ `},t.metadata?Object.entries(t.metadata).filter(([i])=>["type","status"].includes(i.toLocaleLowerCase())).map(([i,g])=>(0,e.jsx)("span",{css:q,key:i},g)):null),t.metadata?Object.entries(t.metadata).filter(([i])=>!["type","status"].includes(i.toLocaleLowerCase())).map(([i,g])=>(0,e.jsx)("div",{css:[q,O.css`
232
234
  order: 1;
233
235
  `],key:i},(0,e.jsx)("span",{css:[ge,O.css`
234
236
  order: 1;
235
- `]},i,":"),h)):null),(0,e.jsx)("div",{css:ot},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:i=>{r&&(nr(i.currentTarget.href,()=>r(t)),i.preventDefault())},css:Me},(0,e.jsx)("span",{css:q},"Edit"),(0,e.jsx)(W,{src:n,css:et,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:i=>{i.preventDefault(),o(t)},css:Me},(0,e.jsx)("span",{css:q},"Unlink"),(0,e.jsx)(se,{css:[tt,O.css`
237
+ `]},i,":"),g)):null),(0,e.jsx)("div",{css:ot},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:i=>{r&&(ar(i.currentTarget.href,()=>r(t)),i.preventDefault())},css:Me},(0,e.jsx)("span",{css:q},"Edit"),(0,e.jsx)(Z,{src:n,css:et,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:i=>{i.preventDefault(),o(t)},css:Me},(0,e.jsx)("span",{css:q},"Unlink"),(0,e.jsx)(se,{css:[tt,O.css`
236
238
  color: var(--brand-secondary-5);
237
- `]})))))};var $=Z(require("react"));var j=require("@emotion/react"),at=j.css`
239
+ `]})))))};var $=W(require("react"));var J=require("@emotion/react"),at=J.css`
238
240
  cursor: pointer;
239
241
  padding: var(--spacing-sm);
240
242
  position: relative;
241
243
  transition: background-color var(--duration-fast) var(--timing-ease-out),
242
244
  color var(--duration-fast) var(--timing-ease-out);
243
- `,it=j.css`
245
+ `,it=J.css`
246
+ padding-right: var(--spacing-lg);
247
+ `,st=J.css`
244
248
  background: var(--brand-secondary-3);
245
249
  color: var(--white);
246
- `,Ve=j.css`
250
+ `,Ve=J.css`
247
251
  font-size: var(--fs-xs);
248
- `,Ee=j.css`
252
+ `,Ee=J.css`
249
253
  font-weight: var(--fw-bold);
250
254
  margin-right: var(--spacing-sm);
251
- `,st=j.css`
255
+ `,ct=J.css`
252
256
  background: var(--white);
253
257
  border-left: 4px solid var(--brand-secondary-3);
254
258
  border-radius: var(--rounded-base);
@@ -260,20 +264,20 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
260
264
  right: var(--spacing-xl);
261
265
  z-index: var(--z-10);
262
266
  width: max-content;
263
- `,ct=j.css`
267
+ `,dt=J.css`
264
268
  position: absolute;
265
269
  inset: 0 var(--spacing-sm) 0 auto;
266
- `;var dt=require("@emotion/react"),lt=({result:t,isSelected:n,triggerSelection:o})=>{let r=(0,$.useRef)(null),a=(0,$.useRef)(null),[d,m]=(0,$.useState)(!1);(0,$.useEffect)(()=>{function v(b){r.current&&!r.current.contains(b.target)&&a.current&&!a.current.contains(b.target)&&m(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[a]);let f=v=>{v.stopPropagation(),m(!d)};return(0,e.jsx)("div",{key:t.id,css:[at,n?it:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?(0,e.jsx)($.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:r,css:ct,"aria-controls":"path-details",onClick:v=>f(v),"aria-expanded":d},(0,e.jsx)(ce,{width:24,height:24})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!d,ref:a,css:[st,d?dt.css`
270
+ `;var lt=require("@emotion/react"),pt=({result:t,isSelected:n,triggerSelection:o})=>{let r=(0,$.useRef)(null),a=(0,$.useRef)(null),[d,m]=(0,$.useState)(!1);(0,$.useEffect)(()=>{function h(b){r.current&&!r.current.contains(b.target)&&a.current&&!a.current.contains(b.target)&&m(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[a]);let v=h=>{h.stopPropagation(),m(!d)};return(0,e.jsx)("div",{key:t.id,css:[at,n?st:void 0,t.popoverData?it:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?(0,e.jsx)($.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:r,css:dt,"aria-controls":"path-details",onClick:h=>v(h),"aria-expanded":d},(0,e.jsx)(ce,{width:24,height:24})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!d,ref:a,css:[ct,d?lt.css`
267
271
  visibility: visible;
268
- `:dt.css`
272
+ `:lt.css`
269
273
  visibility: hidden;
270
- `]},t.metadata&&Object.entries(t.metadata).map(([v,b],i)=>(0,e.jsx)("div",{css:Ve,key:i},(0,e.jsx)("span",{css:Ee},v,":"),b)),Object.entries(t.popoverData).map(([v,b],i)=>(0,e.jsx)("div",{css:Ve,key:i},(0,e.jsx)("span",{css:Ee},v,":"),b)))):null)};var de=require("react-beautiful-dnd");var C=require("@emotion/react"),pt=C.css`
274
+ `]},t.metadata&&Object.entries(t.metadata).map(([h,b],i)=>(0,e.jsx)("div",{css:Ve,key:i},(0,e.jsx)("span",{css:Ee},h,":"),b)),Object.entries(t.popoverData).map(([h,b],i)=>(0,e.jsx)("div",{css:Ve,key:i},(0,e.jsx)("span",{css:Ee},h,":"),b)))):null)};var de=require("react-beautiful-dnd");var P=require("@emotion/react"),ut=P.css`
271
275
  background: var(--white);
272
276
  border: 1px solid var(--gray-300);
273
277
  border-radius: var(--rounded-base);
274
278
  padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
275
279
  margin-bottom: var(--spacing-base);
276
- `,ut=C.css`
280
+ `,mt=P.css`
277
281
  align-items: center;
278
282
  display: flex;
279
283
  position: relative;
@@ -281,7 +285,7 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
281
285
  width: 100%;
282
286
  background-color: transparent;
283
287
  border: 0;
284
- `,mt=C.css`
288
+ `,gt=P.css`
285
289
  color: var(--brand-secondary-1);
286
290
  display: block;
287
291
  font-weight: var(--fw-bold);
@@ -297,15 +301,15 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
297
301
  background: var(--gray-100);
298
302
  outline: none;
299
303
  }
300
- `,gt=C.css`
304
+ `,ft=P.css`
301
305
  background: var(--white);
302
306
  border: 1px solid var(--gray-300);
303
307
  border-radius: var(--rounded-base);
304
308
  padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
305
309
  display: block;
306
- `,ft=C.css`
310
+ `,vt=P.css`
307
311
  display: none;
308
- `,vt=C.css`
312
+ `,ht=P.css`
309
313
  overflow-y: auto;
310
314
  max-height: 16rem;
311
315
  margin-bottom: var(--spacing-base);
@@ -313,138 +317,138 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
313
317
  & > :not(:last-child) {
314
318
  border-bottom: 1px solid var(--gray-200);
315
319
  }
316
- `,_r=C.css`
320
+ `,Wr=P.css`
317
321
  background-color: var(--gray-50);
318
322
  max-width: 33.33%;
319
- `,ht=C.css`
323
+ `,bt=P.css`
320
324
  align-items: center;
321
325
  display: flex;
322
326
  position: absolute;
323
327
  inset: 0 0 0 auto;
324
328
  pointer-events: none;
325
329
  padding-right: var(--spacing-sm);
326
- `,bt=C.css`
330
+ `,yt=P.css`
327
331
  color: var(--brand-secondary-1);
328
332
  width: 1.25rem;
329
333
  height: 1.25rem;
330
334
  transition: transform var(--duration-fast) var(--timing-ease-out);
331
335
  transform: rotate(0);
332
- `,Zr=C.css`
336
+ `,Zr=P.css`
333
337
  background: var(--white);
334
338
  color: var(--brand-secondary-1);
335
- `,yt=C.css`
339
+ `,St=P.css`
336
340
  position: relative;
337
341
  margin-block: var(--spacing-sm) 0;
338
342
 
339
343
  &:hover > span {
340
344
  opacity: 0.3;
341
345
  }
342
- `,St=C.css`
346
+ `,wt=P.css`
343
347
  align-items: center;
344
348
  display: flex;
345
349
  position: absolute;
346
350
  inset: 0 auto 0 0;
347
351
  margin-block: auto;
348
352
  opacity: 0;
349
- `,Te=C.css`
353
+ `,Te=P.css`
350
354
  color: var(--brand-secondary-1);
351
- `,wt=C.css`
355
+ `,Ct=P.css`
352
356
  position: absolute;
353
357
  left: 0.375rem;
354
- `,Ie=C.css`
358
+ `,Ie=P.css`
355
359
  width: calc(var(--spacing-lg) + var(--spacing-xs));
356
360
  height: calc(var(--spacing-lg) + var(--spacing-xs));
357
- `;var D=require("@emotion/react"),S=require("@uniformdev/design-system"),Wr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),(0,e.jsx)(S.Callout,{type:"info"},o)},Ct=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:d,multiSelect:m,multiSelectId:f,rowComponent:v,selectedItemComponent:b,totalResults:i,resultsLoading:h,requireContentType:P,onAddNew:ee,onEditClosed:K,onCancel:w,noResultsComponent:y,helpComponent:te,onSort:Y,typeSelectorLabel:A="Content Type Select",typeSelectorAllTypesOptionText:Q="All content types"})=>{var Ft,$t,Kt;let re=()=>P?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[N,B]=G.useState(""),[p,V]=G.useState(re),[_,oe]=G.useState(!1),[s,E]=G.useState([]),[le,At]=G.useState(!1),be=(0,sr.useThrottle)(N,750);G.useEffect(()=>{t(be,{count:5,offset:0,contentType:p==="any"?void 0:p})},[be,p]);let pr=c=>{s.some(g=>g.id===c.id)?E(g=>g.filter(ne=>ne.id!==c.id)):E(m?g=>[...g,c]:[c])},ur=()=>{V(re()),B(""),E(r!=null&&r.length?r:[])},mr=()=>{oe(c=>!c),_||ur()},Bt=c=>{d((r==null?void 0:r.filter(g=>g.id!==c.id))||[],"")},gr=c=>{c.preventDefault(),d(s,p),oe(!1)},fr=c=>{c.preventDefault(),oe(!1),w&&w()},vr=c=>{c.preventDefault(),t(be,{count:5,offset:(n==null?void 0:n.length)||0,contentType:p==="any"?void 0:p}),At(!0);let g=setTimeout(()=>{At(!1)},750);return()=>clearTimeout(g)},Ue=G.useRef((0,cr.v4)()),hr=!(r==null?void 0:r.length)||m,br=v||lt,Ot=b||nt,yr=y||Wr,Ht=a&&typeof a!="string"?a:null,Sr=Ht?(0,e.jsx)(Ht,{css:Ie}):(0,e.jsx)("img",{src:a,alt:"Logo",css:Ie}),wr=c=>{var g,ne;if(c.destination&&c.source.droppableId===((g=c.destination)==null?void 0:g.droppableId)){let T=[...r||[]],[pe]=(ne=T==null?void 0:T.splice(c.source.index,1))!=null?ne:[];return T==null||T.splice(c.destination.index,0,pe),Y==null||Y(T),T}};return(0,e.jsx)("div",{css:D.css`
361
+ `;var D=require("@emotion/react"),S=require("@uniformdev/design-system"),qr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),(0,e.jsx)(S.Callout,{type:"info"},o)},Pt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:d,multiSelect:m,multiSelectId:v,rowComponent:h,selectedItemComponent:b,totalResults:i,resultsLoading:g,requireContentType:w,onAddNew:ee,onEditClosed:K,onCancel:C,noResultsComponent:y,helpComponent:te,onSort:j,typeSelectorLabel:A="Content Type Select",typeSelectorAllTypesOptionText:Q="All content types"})=>{var $t,Kt,Qt;let re=()=>w?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[N,B]=G.useState(""),[u,V]=G.useState(re),[_,oe]=G.useState(!1),[s,E]=G.useState([]),[le,Bt]=G.useState(!1),be=(0,cr.useThrottle)(N,750);G.useEffect(()=>{t(be,{count:5,offset:0,contentType:u==="any"?void 0:u})},[be,u]);let ur=c=>{s.some(f=>f.id===c.id)?E(f=>f.filter(ne=>ne.id!==c.id)):E(m?f=>[...f,c]:[c])},mr=()=>{V(re()),B(""),E(r!=null&&r.length?r:[])},gr=()=>{oe(c=>!c),_||mr()},Ot=c=>{d((r==null?void 0:r.filter(f=>f.id!==c.id))||[],"")},fr=c=>{c.preventDefault(),d(s,u),oe(!1)},vr=c=>{c.preventDefault(),oe(!1),C&&C()},hr=c=>{c.preventDefault(),t(be,{count:5,offset:(n==null?void 0:n.length)||0,contentType:u==="any"?void 0:u}),Bt(!0);let f=setTimeout(()=>{Bt(!1)},750);return()=>clearTimeout(f)},Ue=G.useRef((0,dr.v4)()),br=!(r==null?void 0:r.length)||m,yr=h||pt,Ht=b||nt,Sr=y||qr,Ft=a&&typeof a!="string"?a:null,wr=Ft?(0,e.jsx)(Ft,{css:Ie}):(0,e.jsx)("img",{src:a,alt:"Logo",css:Ie}),Cr=c=>{var f,ne;if(c.destination&&c.source.droppableId===((f=c.destination)==null?void 0:f.droppableId)){let T=[...r||[]],[pe]=(ne=T==null?void 0:T.splice(c.source.index,1))!=null?ne:[];return T==null||T.splice(c.destination.index,0,pe),j==null||j(T),T}};return(0,e.jsx)("div",{css:D.css`
358
362
  width: 100%;
359
363
  `},(0,e.jsx)("div",{css:D.css`
360
364
  position: relative;
361
365
  margin-block: var(--spacing-base);
362
- `},hr&&(0,e.jsx)(G.Fragment,null,(0,e.jsx)("div",{css:pt,"data-test-id":"component-search"},(0,e.jsx)("button",{css:ut,onClick:mr,type:"button","aria-haspopup":!0,"aria-expanded":_,"aria-controls":`entry-search-config-${Ue.current}`},Sr,(0,e.jsx)("span",{css:D.css`
366
+ `},br&&(0,e.jsx)(G.Fragment,null,(0,e.jsx)("div",{css:ut,"data-test-id":"component-search"},(0,e.jsx)("button",{css:mt,onClick:gr,type:"button","aria-haspopup":!0,"aria-expanded":_,"aria-controls":`entry-search-config-${Ue.current}`},wr,(0,e.jsx)("span",{css:D.css`
363
367
  margin-left: var(--spacing-base);
364
- `},"Select"),(0,e.jsx)("span",{css:ht},(0,e.jsx)(Le,{css:[bt,_?D.css`
368
+ `},"Select"),(0,e.jsx)("span",{css:bt},(0,e.jsx)(xe,{css:[yt,_?D.css`
365
369
  transform: rotate(180deg);
366
- `:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${Ue.current}`,"aria-hidden":!_,css:[gt,_?void 0:ft]},te||null,(0,e.jsx)("div",{css:D.css`
370
+ `:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${Ue.current}`,"aria-hidden":!_,css:[ft,_?void 0:vt]},te||null,(0,e.jsx)("div",{css:D.css`
367
371
  display: flex;
368
372
  gap: calc(var(--spacing-base) - 0.25rem);
369
373
  margin-bottom: var(--spacing-base);
370
- `},(0,e.jsx)(S.InputSelect,{onChange:c=>V(c.target.value),value:p,label:A,showLabel:!1,options:[...P?[]:[{value:"any",label:Q}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),(0,e.jsx)("div",{css:D.css`
374
+ `},(0,e.jsx)(S.InputSelect,{onChange:c=>V(c.target.value),value:u,label:A,showLabel:!1,options:[...w?[]:[{value:"any",label:Q}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),(0,e.jsx)("div",{css:D.css`
371
375
  flex-grow: 1;
372
- `},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:B,disabledFieldSubmission:!0,value:N}))),(0,e.jsx)("div",{css:[vt,S.scrollbarStyles],id:Ue.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!h&&Array.isArray(n)?n.map(c=>(0,e.jsx)(br,{key:c.id,isSelected:s.some(g=>g.id===c.id),result:c,triggerSelection:()=>pr(c)})):h?null:(0,e.jsx)(yr,{searchText:be||N,selectedContentType:($t=(Ft=o==null?void 0:o.find(c=>c.id===p))==null?void 0:Ft.name)!=null?$t:p}),!h&&typeof i!="undefined"&&n&&(n==null?void 0:n.length)<i&&(0,e.jsx)("button",{css:mt,onClick:vr},le?(0,e.jsx)(S.LoadingIndicator,null):"Load More"),h&&!(n!=null&&n.length)?(0,e.jsx)("div",{css:D.css`
376
+ `},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:B,disabledFieldSubmission:!0,value:N}))),(0,e.jsx)("div",{css:[ht,S.scrollbarStyles],id:Ue.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(c=>(0,e.jsx)(yr,{key:c.id,isSelected:s.some(f=>f.id===c.id),result:c,triggerSelection:()=>ur(c)})):g?null:(0,e.jsx)(Sr,{searchText:be||N,selectedContentType:(Kt=($t=o==null?void 0:o.find(c=>c.id===u))==null?void 0:$t.name)!=null?Kt:u}),!g&&typeof i!="undefined"&&n&&(n==null?void 0:n.length)<i&&(0,e.jsx)("button",{css:gt,onClick:hr},le?(0,e.jsx)(S.LoadingIndicator,null):"Load More"),g&&!(n!=null&&n.length)?(0,e.jsx)("div",{css:D.css`
373
377
  padding: var(--spacing-base);
374
378
  text-align: center;
375
379
  width: 100%;
376
380
  `},(0,e.jsx)(S.LoadingIndicator,null)):null),(0,e.jsx)("div",{css:D.css`
377
381
  display: flex;
378
382
  justify-content: space-between;
379
- `},(0,e.jsx)("div",null,ee&&((Kt=o==null?void 0:o.length)!=null?Kt:0)>0?(0,e.jsx)(S.Menu,{menuLabel:"Add new menu",menuTrigger:(0,e.jsx)(S.Button,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>(0,e.jsx)(S.MenuItem,{key:c.id,css:D.css`
383
+ `},(0,e.jsx)("div",null,ee&&((Qt=o==null?void 0:o.length)!=null?Qt:0)>0?(0,e.jsx)(S.Menu,{menuLabel:"Add new menu",menuTrigger:(0,e.jsx)(S.Button,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>(0,e.jsx)(S.MenuItem,{key:c.id,css:D.css`
380
384
  background: var(--white);
381
385
  color: var(--brand-secondary-1);
382
386
  `,onClick:()=>ee(c)},c.name))):null),(0,e.jsx)("div",{css:D.css`
383
387
  display: flex;
384
388
  gap: var(--spacing-base);
385
- `},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:fr},"Cancel"),(0,e.jsx)(S.Button,{disabled:!s.length,onClick:gr,"data-test-id":"entry-accept-button"},"Accept"))))),m?(0,e.jsx)(de.DragDropContext,{onDragEnd:c=>wr(c)},(0,e.jsx)(de.Droppable,{droppableId:f||"canvas-multi-select"},c=>(0,e.jsx)("div",{...c.droppableProps,ref:c.innerRef,css:D.css`
389
+ `},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:vr},"Cancel"),(0,e.jsx)(S.Button,{disabled:!s.length,onClick:fr,"data-test-id":"entry-accept-button"},"Accept"))))),m?(0,e.jsx)(de.DragDropContext,{onDragEnd:c=>Cr(c)},(0,e.jsx)(de.Droppable,{droppableId:v||"canvas-multi-select"},c=>(0,e.jsx)("div",{...c.droppableProps,ref:c.innerRef,css:D.css`
386
390
  margin-block: var(--spacing-sm) 0;
387
- `},r==null?void 0:r.map((g,ne)=>{if(g!=null&&g.id)return(0,e.jsx)(de.Draggable,{key:g.id,draggableId:g.id,index:ne},T=>(0,e.jsx)("div",{css:yt,ref:T.innerRef,...T.draggableProps,...T.dragHandleProps},(0,e.jsx)("span",{css:St},(0,e.jsx)(me,{css:[Te,wt],width:24,height:24}),(0,e.jsx)(me,{css:Te,width:24,height:24})),(0,e.jsx)(Ot,{key:`selected-item-${g.id}`,logoIcon:a,selectedItem:g,onDeselect:pe=>Bt(pe),onEditClosed:K?pe=>K(pe):void 0})))}),c.placeholder))):r==null?void 0:r.map(c=>(0,e.jsx)(Ot,{key:`selected-item-${c.id}`,logoIcon:a,selectedItem:c,onDeselect:g=>Bt(g),onEditClosed:K?g=>K(g):void 0}))))};var J=require("@emotion/react"),Pt=J.css`
391
+ `},r==null?void 0:r.map((f,ne)=>{if(f!=null&&f.id)return(0,e.jsx)(de.Draggable,{key:f.id,draggableId:f.id,index:ne},T=>(0,e.jsx)("div",{css:St,ref:T.innerRef,...T.draggableProps,...T.dragHandleProps},(0,e.jsx)("span",{css:wt},(0,e.jsx)(me,{css:[Te,Ct],width:24,height:24}),(0,e.jsx)(me,{css:Te,width:24,height:24})),(0,e.jsx)(Ht,{key:`selected-item-${f.id}`,logoIcon:a,selectedItem:f,onDeselect:pe=>Ot(pe),onEditClosed:K?pe=>K(pe):void 0})))}),c.placeholder))):r==null?void 0:r.map(c=>(0,e.jsx)(Ht,{key:`selected-item-${c.id}`,logoIcon:a,selectedItem:c,onDeselect:f=>Ot(f),onEditClosed:K?f=>K(f):void 0}))))};var X=require("@emotion/react"),Rt=X.css`
388
392
  cursor: pointer;
389
393
  padding: var(--spacing-sm) 0;
390
394
  margin-right: var(--spacing-sm);
391
395
  position: relative;
392
396
  transition: background-color var(--duration-fast) var(--timing-ease-out),
393
397
  color var(--duration-fast) var(--timing-ease-out);
394
- `,Rt=J.css`
398
+ `,kt=X.css`
395
399
  border: 2px solid transparent;
396
400
  border-radius: var(--rounded-base);
397
401
  display: flex;
398
402
  align-items: center;
399
403
  gap: var(--spacing-base);
400
404
  padding: var(--spacing-sm) var(--spacing-xs);
401
- `,kt=J.css`
405
+ `,xt=X.css`
402
406
  background-color: var(--green-50);
403
- `,Lt=J.css`
407
+ `,Lt=X.css`
404
408
  font-size: var(--fs-sm);
405
409
  font-weight: var(--fw-bold);
406
410
  width: 50%;
407
- `,xt=J.css`
411
+ `,Mt=X.css`
408
412
  font-weight: var(--fw-normal);
409
413
  display: block;
410
- `,Mt=J.css`
414
+ `,Vt=X.css`
411
415
  font-size: var(--fs-sm);
412
416
  > * {
413
417
  display: block;
414
418
  }
415
- `,Vt=J.css`
419
+ `,Et=X.css`
416
420
  display: block;
417
421
  height: 1.5rem;
418
422
  width: 1.5rem;
419
423
  color: var(--brand-secondary-3);
420
424
  margin-left: auto;
421
- `;var Et=require("@emotion/react");function Tt({result:t,isSelected:n,triggerSelection:o}){var f;let{categories:r,logoIcon:a}=fe(),[d]=t.categories||[{id:"",name:""}],m=typeof d=="undefined"||!r||(f=r.find(v=>v.id===d.id))==null?void 0:f.name;return(0,e.jsx)("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Pt]},(0,e.jsx)("div",{css:[Rt,n?kt:void 0]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Et.css`
425
+ `;var Tt=require("@emotion/react");function It({result:t,isSelected:n,triggerSelection:o}){var v;let{categories:r,logoIcon:a}=fe(),[d]=t.categories||[{id:"",name:""}],m=typeof d=="undefined"||!r||(v=r.find(h=>h.id===d.id))==null?void 0:v.name;return(0,e.jsx)("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Rt]},(0,e.jsx)("div",{css:[kt,n?xt:void 0]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Tt.css`
422
426
  background-color: var(--gray-200);
423
427
  width: 3rem;
424
428
  height: 3rem;
425
429
  object-fit: cover;
426
- `}):(0,e.jsx)(W,{src:a,alt:"Logo",css:Et.css`
430
+ `}):(0,e.jsx)(Z,{src:a,alt:"Logo",css:Tt.css`
427
431
  height: 2.25rem;
428
432
  width: 2.25rem;
429
- `}),(0,e.jsx)("h4",{css:[Lt]},t.title,m?(0,e.jsx)("span",{css:[xt]},m):null),(0,e.jsx)("p",{css:[Mt]},"SKU: ",t.sku||t.id,t.price!==void 0?(0,e.jsx)("span",null,t.price):null),n?(0,e.jsx)(ke,{css:[Vt]}):null))}var ve=require("@emotion/react"),dr=require("@uniformdev/design-system"),It=ve.css`
433
+ `}),(0,e.jsx)("h4",{css:[Lt]},t.title,m?(0,e.jsx)("span",{css:[Mt]},m):null),(0,e.jsx)("p",{css:[Vt]},"SKU: ",t.sku||t.id,t.price!==void 0?(0,e.jsx)("span",null,t.price):null),n?(0,e.jsx)(ke,{css:[Et]}):null))}var ve=require("@emotion/react"),lr=require("@uniformdev/design-system"),Dt=ve.css`
430
434
  display: flex;
431
435
  width: 100%;
432
436
  border: 1px solid var(--gray-300);
433
437
  border-radius: var(--rounded-base);
434
438
  background-color: var(--gray-100);
435
439
  margin: var(--spacing-base) 0;
436
- `,Dt=ve.css`
440
+ `,Gt=ve.css`
437
441
  padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
438
442
  display: flex;
439
443
  flex-grow: 1;
440
444
  align-items: center;
441
445
  margin-right: var(--spacing-sm);
442
446
  gap: var(--spacing-base);
443
- `,Gt=ve.css`
447
+ `,zt=ve.css`
444
448
  display: flex;
445
449
  align-items: center;
446
450
  gap: var(--spacing-sm);
447
- ${(0,dr.mq)("lg")} {
451
+ ${(0,lr.mq)("lg")} {
448
452
  width: 50%;
449
453
  margin-bottom: 0;
450
454
  }
@@ -453,33 +457,33 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
453
457
  width: 3.5rem;
454
458
  height: 3.5rem;
455
459
  object-fit: cover;
456
- `;var L=require("@emotion/react"),lr=require("@uniformdev/design-system");function zt({selectedItem:t,onDeselect:n}){var m;let{categories:o,logoIcon:r}=fe(),[a]=t.categories||[{id:"",name:""}],d=typeof a=="undefined"||!o||(m=o.find(f=>f.id===a.id))==null?void 0:m.name;return(0,e.jsx)("div",{css:[It],key:t.id},(0,e.jsx)("article",{css:[Dt]},(0,e.jsx)("div",{css:[Gt]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:d,css:[De],loading:"lazy"}):(0,e.jsx)("div",{css:[De]}),(0,e.jsx)("div",{css:L.css`
460
+ `;var x=require("@emotion/react"),pr=require("@uniformdev/design-system");function Ut({selectedItem:t,onDeselect:n}){var m;let{categories:o,logoIcon:r}=fe(),[a]=t.categories||[{id:"",name:""}],d=typeof a=="undefined"||!o||(m=o.find(v=>v.id===a.id))==null?void 0:m.name;return(0,e.jsx)("div",{css:[Dt],key:t.id},(0,e.jsx)("article",{css:[Gt]},(0,e.jsx)("div",{css:[zt]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:d,css:[De],loading:"lazy"}):(0,e.jsx)("div",{css:[De]}),(0,e.jsx)("div",{css:x.css`
457
461
  > :not(:last-child) {
458
462
  margin-bottom: var(--spacing-xs);
459
463
  }
460
- `},(0,e.jsx)("h4",{css:L.css`
464
+ `},(0,e.jsx)("h4",{css:x.css`
461
465
  font-weight: var(--fw-bold);
462
- `},t.title||t.id||"",d&&(0,e.jsx)("span",{css:L.css`
466
+ `},t.title||t.id||"",d&&(0,e.jsx)("span",{css:x.css`
463
467
  display: block;
464
468
  font-weight: var(--fw-regular);
465
- `},d)),(0,e.jsx)("ul",{css:L.css`
469
+ `},d)),(0,e.jsx)("ul",{css:x.css`
466
470
  font-size: var(--fs-sm);
467
471
  display: flex;
468
472
  gap: var(--spacing-base);
469
- `},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:L.css`
473
+ `},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:x.css`
470
474
  margin-right: var(--spacing-xs);
471
- `},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:L.css`
475
+ `},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:x.css`
472
476
  margin-right: var(--spacing-xs);
473
- `},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:L.css`
477
+ `},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:x.css`
474
478
  display: flex;
475
479
  flex-wrap: wrap;
476
480
  gap: var(--spacing-sm);
477
481
  justify-content: flex-end;
478
482
  margin-left: auto;
479
- ${(0,lr.mq)("md")} {
483
+ ${(0,pr.mq)("md")} {
480
484
  align-items: center;
481
485
  }
482
- `},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:L.css`
486
+ `},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:x.css`
483
487
  display: inline-flex;
484
488
  justify-content: space-between;
485
489
  align-items: center;
@@ -490,14 +494,14 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
490
494
  &:hover {
491
495
  background-color: var(--gray-100);
492
496
  }
493
- `},(0,e.jsx)("span",{css:L.css`
497
+ `},(0,e.jsx)("span",{css:x.css`
494
498
  margin-right: var(--spacing-sm);
495
499
  font-size: var(--fs-sm);
496
- `},"Edit"),(0,e.jsx)(W,{src:r,alt:"Logo",css:L.css`
500
+ `},"Edit"),(0,e.jsx)(Z,{src:r,alt:"Logo",css:x.css`
497
501
  width: 1.75rem;
498
502
  height: 1.75rem;
499
503
  display: block;
500
- `})):null,(0,e.jsx)("button",{type:"button",onClick:f=>{f.preventDefault(),n==null||n(t)},css:L.css`
504
+ `})):null,(0,e.jsx)("button",{type:"button",onClick:v=>{v.preventDefault(),n==null||n(t)},css:x.css`
501
505
  display: flex;
502
506
  justify-content: space-between;
503
507
  align-items: center;
@@ -510,8 +514,8 @@ var Cr=Object.create;var Se=Object.defineProperty;var Pr=Object.getOwnPropertyDe
510
514
  &:hover {
511
515
  background-color: var(--gray-100);
512
516
  }
513
- `},(0,e.jsx)("span",{css:L.css`
517
+ `},(0,e.jsx)("span",{css:x.css`
514
518
  font-size: var(--fs-sm);
515
- `},"Unlink"),(0,e.jsx)(se,{css:L.css`
519
+ `},"Unlink"),(0,e.jsx)(se,{css:x.css`
516
520
  color: var(--brand-secondary-5);
517
- `})))))}var Ge=require("@uniformdev/design-system"),ze=require("react-use");function qr({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:d,multiSelectId:m,selectedItemComponent:f,rowComponent:v,errorComponent:b,helpComponent:i,noResultsComponent:h,onSort:P,typeSelectorAllTypesOptionText:ee="All categories",typeSelectorLabel:K="Select Category"}){var N;let{value:w,loading:y,error:te}=(0,ze.useAsync)(async()=>await o(),[o]),Y=(0,X.useMemo)(()=>w?w.map(p=>({id:p.id,name:p.name})):void 0,[w]),A=(0,X.useRef)(),[Q,he]=(0,ze.useAsyncFn)(async(B,p)=>{let V=await r({text:B,options:{limit:p==null?void 0:p.count,offset:p==null?void 0:p.offset,categoryId:p==null?void 0:p.contentType}});return(p==null?void 0:p.offset)===0&&(A.current=[]),(A.current=A.current||[]).push(...V.products),V},[r]),re=async B=>{await n(B)};return y?(0,e.jsx)(Ge.LoadingIndicator,null):te||Q.error?(0,e.jsx)(b||(({categoriesError:p,searchError:V})=>(0,e.jsx)(Ge.Callout,{type:"error"},"There was an error: ",(p==null?void 0:p.message)||(V==null?void 0:V.message))),{categoriesError:te,searchError:Q.error}):(0,e.jsx)(Ut.Provider,{value:{categories:w,logoIcon:a}},(0,e.jsx)(Ct,{search:he,results:A.current,logoIcon:a,selectedItems:t,select:re,multiSelectId:m||"product-search-multi-select",multiSelect:d,contentTypes:Y,selectedItemComponent:f||zt,rowComponent:v||Tt,totalResults:(N=Q.value)==null?void 0:N.total,resultsLoading:Q.loading,helpComponent:i,noResultsComponent:h,onSort:P,typeSelectorAllTypesOptionText:ee,typeSelectorLabel:K}))}var Ut=X.default.createContext(void 0),fe=()=>{let t=(0,X.useContext)(Ut);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};U(z,require("@uniformdev/mesh-sdk"),module.exports);var u=require("@uniformdev/design-system");0&&(module.exports={Button,Callout,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputSelect,InputToggle,KeywordSearchInput,LoadingIndicator,LoadingOverlay,Menu,MenuItem,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,badgeIcon,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemImage,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemCloseIcon,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
521
+ `})))))}var Ge=require("@uniformdev/design-system"),ze=require("react-use");function Jr({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:d,multiSelectId:m,selectedItemComponent:v,rowComponent:h,errorComponent:b,helpComponent:i,noResultsComponent:g,onSort:w,typeSelectorAllTypesOptionText:ee="All categories",typeSelectorLabel:K="Select Category"}){var N;let{value:C,loading:y,error:te}=(0,ze.useAsync)(async()=>await o(),[o]),j=(0,Y.useMemo)(()=>C?C.map(u=>({id:u.id,name:u.name})):void 0,[C]),A=(0,Y.useRef)(),[Q,he]=(0,ze.useAsyncFn)(async(B,u)=>{let V=await r({text:B,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType}});return(u==null?void 0:u.offset)===0&&(A.current=[]),(A.current=A.current||[]).push(...V.products),V},[r]),re=async B=>{await n(B)};return y?(0,e.jsx)(Ge.LoadingIndicator,null):te||Q.error?(0,e.jsx)(b||(({categoriesError:u,searchError:V})=>(0,e.jsx)(Ge.Callout,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(V==null?void 0:V.message))),{categoriesError:te,searchError:Q.error}):(0,e.jsx)(At.Provider,{value:{categories:C,logoIcon:a}},(0,e.jsx)(Pt,{search:he,results:A.current,logoIcon:a,selectedItems:t,select:re,multiSelectId:m||"product-search-multi-select",multiSelect:d,contentTypes:j,selectedItemComponent:v||Ut,rowComponent:h||It,totalResults:(N=Q.value)==null?void 0:N.total,resultsLoading:Q.loading,helpComponent:i,noResultsComponent:g,onSort:w,typeSelectorAllTypesOptionText:ee,typeSelectorLabel:K}))}var At=Y.default.createContext(void 0),fe=()=>{let t=(0,Y.useContext)(At);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};U(z,require("@uniformdev/mesh-sdk"),module.exports);var p=require("@uniformdev/design-system");0&&(module.exports={Button,Callout,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputSelect,InputToggle,KeywordSearchInput,Label,LoadingIndicator,LoadingOverlay,Menu,MenuItem,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Switch,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,badgeIcon,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemImage,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowContainerWithPopover,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemCloseIcon,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});