@uniformdev/mesh-sdk-react 17.2.1-alpha.224 → 17.3.1-alpha.117
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 +1 -1
- package/dist/index.esm.js +7 -7
- package/dist/index.js +118 -118
- package/dist/index.mjs +7 -7
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
|
|
|
52
52
|
*
|
|
53
53
|
* You can also combine (2) and (3) to get both explicit value typing and assertion of the location.
|
|
54
54
|
*/
|
|
55
|
-
declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLocationValue = unknown, TLocationSetValue = TLocationValue>(expectedLocation?: TLocationType): Extract<_uniformdev_mesh_sdk.
|
|
55
|
+
declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLocationValue = unknown, TLocationSetValue = TLocationValue>(expectedLocation?: TLocationType): Extract<_uniformdev_mesh_sdk.DataSourceLocation, {
|
|
56
56
|
type: TLocationType;
|
|
57
57
|
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
58
58
|
type: TLocationType;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enumerable:!0})};import{jsx as l}from"@emotion/react";import*as x from"react";import{createContext as Uo,useContext as Ao,useEffect as Go,useState as Bo}from"react";import{createContext as Mo,useContext as Vo}from"react";import{Theme as Do}from"@uniformdev/design-system";import{jsx as st,jsxs as zo}from"@emotion/react/jsx-runtime";var we=Mo(void 0),ha=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),zo(we.Provider,{value:r,children:[st(Do,{}),st(Ce,{children:e})]})},ct=()=>{let e=Vo(we);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function dt(){let{sdk:e}=ct();return e}import{jsx as Oo}from"@emotion/react/jsx-runtime";var lt=Uo(void 0),Ce=({children:e})=>{let r=dt(),[o,t]=Bo(r.getCurrentLocation()),n=a=>{t(d=>({...d,value:a.newValue}))};return Go(()=>(r.events.on("onValueChanged",n),()=>{r.events.off("onValueChanged",n)}),[r]),Oo(lt.Provider,{value:{location:o},children:e})},Pe=()=>{let e=Ao(lt);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function
|
|
1
|
+
var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enumerable:!0})};import{jsx as l}from"@emotion/react";import*as x from"react";import{createContext as Uo,useContext as Ao,useEffect as Go,useState as Bo}from"react";import{createContext as Mo,useContext as Vo}from"react";import{Theme as Do}from"@uniformdev/design-system";import{jsx as st,jsxs as zo}from"@emotion/react/jsx-runtime";var we=Mo(void 0),ha=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),zo(we.Provider,{value:r,children:[st(Do,{}),st(Ce,{children:e})]})},ct=()=>{let e=Vo(we);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function dt(){let{sdk:e}=ct();return e}import{jsx as Oo}from"@emotion/react/jsx-runtime";var lt=Uo(void 0),Ce=({children:e})=>{let r=dt(),[o,t]=Bo(r.getCurrentLocation()),n=a=>{t(d=>({...d,value:a.newValue}))};return Go(()=>(r.events.on("onValueChanged",n),()=>{r.events.off("onValueChanged",n)}),[r]),Oo(lt.Provider,{value:{location:o},children:e})},Pe=()=>{let e=Ao(lt);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Ma(){let{location:e}=Pe();return e}import{initializeUniformMeshSDK as Ho}from"@uniformdev/mesh-sdk";import{useEffect as $o,useRef as Fo,useState as pt}from"react";var mt=({autoResizingDisabled:e}={})=>{let[r,o]=pt(),[t,n]=pt(),a=Fo(!1);return $o(()=>{typeof window=="undefined"||t||(typeof window.UniformMeshSDK=="undefined"&&!a.current?(a.current=!0,Ho({autoResizingDisabled:e}).then(d=>{n(d)}).catch(d=>{o(d)}).finally(()=>{a.current=!1})):n(window.UniformMeshSDK))},[e]),{initializing:!t&&!r,error:r,sdk:t}};function Ha(e){let{location:r}=Pe();if(e&&r.type!==e)throw new Error(`Expected location type ${e} but got ${r.type}`);return r}import Xo,{useMemo as ke,useContext as qo}from"react";import{css as Ko}from"@emotion/react";import{Icon as No,InputSelect as Qo}from"@uniformdev/design-system";import{CgClose as Wo}from"react-icons/cg";import{Fragment as ut,jsxs as gt}from"@emotion/react/jsx-runtime";var ft=({value:e,text:r,loading:o})=>gt(ut,{children:[!!r&&r,!r&>(ut,{children:[o&&`${e} (Loading...)`,!o&&`${e} (Unresolvable)`]})]});import{css as Ge}from"@emotion/react";var vt=Ge`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -17,7 +17,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
18
|
`;import{jsx as fe,jsxs as bt}from"@emotion/react/jsx-runtime";var St=({id:e,label:r,loading:o,selectedValues:t,values:n,onAdd:a,onRemove:d})=>{var v;let f=(v=n==null?void 0:n.filter(i=>!(t!=null&&t.includes(i.id.toString()))))!=null?v:[],u=(i,p)=>{i.preventDefault(),d(p)};return bt("div",{children:[fe(Qo,{id:e,name:e,label:r,onChange:i=>a(i.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.map(i=>({value:i.id,label:i.name||i.id}))],value:"",css:Array.isArray(t)&&t.length>0?Ko`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),t==null?void 0:t.map(i=>{var p;return bt("div",{css:vt,children:[fe("span",{css:ht,children:fe(ft,{value:i,loading:o,text:(p=n.find(y=>y.id===i))==null?void 0:p.name})}),fe("button",{css:yt,title:"remove",onClick:y=>u(y,i),children:fe(No,{icon:Wo,iconColor:"currentColor",size:20})})]},i)})]})};import{jsx as xt}from"@emotion/react/jsx-runtime";var _o=e=>xt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:xt("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"})}),Le=_o;import{jsx as wt}from"@emotion/react/jsx-runtime";var Zo=e=>wt("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:wt("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Re=Zo;import{useAsyncFn as Yo,useDebounce as Jo}from"react-use";import{Input as Ct,InputSelect as Ie,mq as Te}from"@uniformdev/design-system";import{css as L}from"@emotion/react";import{jsx as w,jsxs as se}from"@emotion/react/jsx-runtime";var Pt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},
|
|
20
|
+
`:""}),t==null?void 0:t.map(i=>{var p;return bt("div",{css:vt,children:[fe("span",{css:ht,children:fe(ft,{value:i,loading:o,text:(p=n.find(y=>y.id===i))==null?void 0:p.name})}),fe("button",{css:yt,title:"remove",onClick:y=>u(y,i),children:fe(No,{icon:Wo,iconColor:"currentColor",size:20})})]},i)})]})};import{jsx as xt}from"@emotion/react/jsx-runtime";var _o=e=>xt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:xt("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"})}),Le=_o;import{jsx as wt}from"@emotion/react/jsx-runtime";var Zo=e=>wt("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:wt("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Re=Zo;import{useAsyncFn as Yo,useDebounce as Jo}from"react-use";import{Input as Ct,InputSelect as Ie,mq as Te}from"@uniformdev/design-system";import{css as L}from"@emotion/react";import{jsx as w,jsxs as se}from"@emotion/react/jsx-runtime";var Pt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},bi=({value:e,setValue:r,brands:o,categories:t,loading:n,categoriesLoading:a,brandsLoading:d,logoIcon:f,onGetProducts:u,sortOptions:v,sortOrderOptions:i,categoryLabel:p="Product Category",brandLabel:y="Brand",disableBrands:D,restrictToSingleCategory:ae=!1})=>{var E,m,V;let S=async s=>{r({...Pt,...e||{},...s})},b=ke(()=>({...Pt,...e||{}}),[e]),[ie,me]=Yo(async s=>await u(s),[u]);Jo(async()=>{await me({brand:b.brand,categories:b.categories,keyword:b.keyword,sort:b.sort,sortOrder:b.sortOrder,count:b.count})},250,[b]);let O=ke(()=>{let s=[];return t==null||t.forEach(z=>{let C=Rt(z,void 0);s.push(...C)}),s},[t]),_=ke(()=>[{value:"",label:"All categories"},...O.map(s=>({label:s.name,value:s.id}))],[O]),W=ke(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),ue=s=>{if(!s)return;let z=(e==null?void 0:e.categories)||[];S({categories:[...z,s]})},Se=s=>{var z;S({categories:(z=e==null?void 0:e.categories)==null?void 0:z.filter(C=>C!==s)})},j=s=>{S({brand:s.target.value})},H=s=>{S({count:s||1})};return n?w("div",{children:"Loading..."}):w(kt.Provider,{value:{categories:t,logoIcon:f},children:se("div",{css:L`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
@@ -311,7 +311,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
311
311
|
& > :not(:last-child) {
|
|
312
312
|
border-bottom: 1px solid var(--gray-200);
|
|
313
313
|
}
|
|
314
|
-
`,
|
|
314
|
+
`,ic=P`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
317
|
`,Mr=P`
|
|
@@ -327,7 +327,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
327
327
|
height: 1.25rem;
|
|
328
328
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
329
329
|
transform: rotate(0);
|
|
330
|
-
`,
|
|
330
|
+
`,sc=P`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
333
|
`,Dr=P`
|
|
@@ -501,7 +501,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
501
501
|
margin-right: var(--spacing-xs);
|
|
502
502
|
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?Q("li",{children:[B("span",{css:de`
|
|
503
503
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`,children:"Price:"}),B("span",{children:e.price})]}):null]})]})]}),Q("div",{css:jr,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Xe,children:[B("span",{css:qe,children:"Edit"}),B($,{src:t,alt:"Logo",css:Jr})]}):null,Q("button",{type:"button",onClick:()=>{r==null||r(e)},css:Xe,children:[B("span",{css:qe,children:"Unlink"}),B($n,{icon:Kn,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as Zn}from"@uniformdev/design-system";import{useAsync as Xn,useAsyncFn as qn}from"react-use";import{jsx as Ye,jsxs as Yn}from"@emotion/react/jsx-runtime";function
|
|
504
|
+
`,children:"Price:"}),B("span",{children:e.price})]}):null]})]})]}),Q("div",{css:jr,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Xe,children:[B("span",{css:qe,children:"Edit"}),B($,{src:t,alt:"Logo",css:Jr})]}):null,Q("button",{type:"button",onClick:()=>{r==null||r(e)},css:Xe,children:[B("span",{css:qe,children:"Unlink"}),B($n,{icon:Kn,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as Zn}from"@uniformdev/design-system";import{useAsync as Xn,useAsyncFn as qn}from"react-use";import{jsx as Ye,jsxs as Yn}from"@emotion/react/jsx-runtime";function cd({selectedProducts:e,setSelectedProducts:r,onGetCategories:o,onSearchProducts:t,logoIcon:n,multiSelect:a,multiSelectId:d,selectedItemComponent:f,rowComponent:u,errorComponent:v,helpComponent:i,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:ae="Select Category"}){var j,H;let{value:S,loading:b,error:ie}=Xn(async()=>await o(),[o]),me=S==null?void 0:S.map(E=>E.id).join(","),O=Wn(()=>S?S.map(m=>({id:m.id,name:m.name})):void 0,[me]),_=_n(),[W,ue]=qn(async(E,m)=>{let V=await t({text:E,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType,cursor:m==null?void 0:m.cursor}});return(m==null?void 0:m.offset)===0&&(_.current=[]),(_.current=_.current||[]).push(...V.products),V},[t]),Se=async E=>{await r(E)};return ie||W.error?Ye(v||(({categoriesError:m,searchError:V})=>Yn(Zn,{type:"error",children:["There was an error: ",(m==null?void 0:m.message)||(V==null?void 0:V.message)]})),{categoriesError:ie,searchError:W.error}):Ye(to.Provider,{value:{categories:S,logoIcon:n},children:Ye(Br,{search:ue,results:_.current,logoIcon:n,selectedItems:e,select:Se,multiSelectId:d||"product-search-multi-select",multiSelect:a,contentTypes:O,selectedItemComponent:f||eo,rowComponent:u||_r,totalResults:(j=W.value)==null?void 0:j.total,cursor:(H=W.value)==null?void 0:H.cursor,resultsLoading:W.loading||b,helpComponent:i,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:D,typeSelectorLabel:ae})})}var to=Nn.createContext(void 0),ze=()=>{let e=Qn(to);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};import{css as k}from"@emotion/react";import{mq as Jn}from"@uniformdev/design-system";var ro=k`
|
|
505
505
|
border: 1px solid var(--gray-200);
|
|
506
506
|
background: var(--gray-50);
|
|
507
507
|
border-radius: var(--rounded-base);
|
|
@@ -584,7 +584,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
584
584
|
max-width: 100%;
|
|
585
585
|
min-width: 100px;
|
|
586
586
|
height: auto;
|
|
587
|
-
`;import{useState as jn,useRef as uo,useEffect as ea}from"react";import{CgInfo as ta,CgClose as ra}from"react-icons/cg";import{format as oa}from"timeago.js";import{css as pe}from"@emotion/react";import{Icon as go}from"@uniformdev/design-system";import{Fragment as aa,jsx as I,jsxs as T}from"@emotion/react/jsx-runtime";function
|
|
587
|
+
`;import{useState as jn,useRef as uo,useEffect as ea}from"react";import{CgInfo as ta,CgClose as ra}from"react-icons/cg";import{format as oa}from"timeago.js";import{css as pe}from"@emotion/react";import{Icon as go}from"@uniformdev/design-system";import{Fragment as aa,jsx as I,jsxs as T}from"@emotion/react/jsx-runtime";function Ld({selectedItem:e,onDeselect:r,onEditClosed:o,logoIcon:t,itemDetailsRendererComponent:n}){let a=uo(null),d=uo(null),[f,u]=jn(!1);ea(()=>{let p=D=>{a.current&&!a.current.contains(D.target)&&d.current&&!d.current.contains(D.target)&&u(!1)},y=()=>{u(!1)};return window.addEventListener("resize",y,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",y,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[d]);let v=()=>{var p;if(u(!f),d.current&&a.current){let y=(p=a==null?void 0:a.current)==null?void 0:p.getBoundingClientRect();d.current.style.top=`${y.top+30}px`}},i=n!=null?n:na;return I("div",{css:[ro,pe`
|
|
588
588
|
margin: 0 0 1rem 0;
|
|
589
589
|
`],children:T("div",{css:oo,children:[T("div",{css:no,children:[T("div",{css:ao,children:[I("h4",{css:[io],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?T(aa,{children:[I("button",{type:"button",ref:a,css:mo,"aria-controls":"path-details","aria-expanded":f,onClick:v,children:I(go,{icon:ta,iconColor:"gray",size:24,css:pe`
|
|
590
590
|
opacity: var(--opacity-75);
|
|
@@ -596,4 +596,4 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
596
596
|
order: 1;
|
|
597
597
|
`],children:[T("span",{css:[Ue,pe`
|
|
598
598
|
order: 1;
|
|
599
|
-
`],children:[o,":"]}),t]},o)):null,e.createdDate?T("li",{css:le,children:[I("span",{css:Ue,children:"Date:"}),oa(e.createdDate)]}):null]})]}):null}import{LoadingIndicator as ia,Theme as sa}from"@uniformdev/design-system";import{jsx as be,jsxs as ca}from"@emotion/react/jsx-runtime";var
|
|
599
|
+
`],children:[o,":"]}),t]},o)):null,e.createdDate?T("li",{css:le,children:[I("span",{css:Ue,children:"Date:"}),oa(e.createdDate)]}):null]})]}):null}import{LoadingIndicator as ia,Theme as sa}from"@uniformdev/design-system";import{jsx as be,jsxs as ca}from"@emotion/react/jsx-runtime";var Dd=({children:e,loadingComponent:r,errorComponent:o})=>{let{initializing:t,error:n,sdk:a}=mt();if(t||!a){let d=r;return d?be(d,{}):be(ia,{})}if(n){let d=o;if(d)return be(d,{error:n});throw n}return ca(we.Provider,{value:{sdk:a},children:[be(sa,{}),be(Ce,{children:e})]})};export*from"@uniformdev/mesh-sdk";import{Button as Wd,Callout as _d,LoadingIndicator as Zd,LoadingOverlay as Xd,Menu as qd,MenuItem as Yd,Input as Jd,InputSelect as jd,InputToggle as el,Theme as tl,InputKeywordSearch as rl,Heading as ol,ScrollableList as nl,ScrollableListItem as al,Textarea as il,Switch as sl,Label as cl,AddListButton as dl}from"@uniformdev/design-system";export{dl as AddListButton,Wd as Button,_d as Callout,Ld as DamSelectedItem,Pr as DefaultSearchRow,fr as DefaultSelectedItem,Br as EntrySearch,ol as Heading,He as Icons,Jd as Input,jd as InputSelect,el as InputToggle,rl as KeywordSearchInput,cl as Label,Zd as LoadingIndicator,Xd as LoadingOverlay,qd as Menu,Yd as MenuItem,Dd as MeshApp,Tt as ProductPreviewList,bi as ProductQuery,kt as ProductQueryContext,cd as ProductSearch,to as ProductSearchContext,_r as ProductSearchRow,eo as ProductSelectedItem,ft as ResolvableLoadingValue,nl as ScrollableList,al as ScrollableListItem,St as SelectionField,sl as Switch,il as Textarea,tl as Theme,lt as UniformMeshLocationContext,Ce as UniformMeshLocationContextProvider,we as UniformMeshSdkContext,ha as UniformMeshSdkContextProvider,Qe as badgeIcon,je as damSelectItemImage,ro as damSelectedItemContainer,ao as damSelectedItemCopy,no as damSelectedItemDetails,so as damSelectedItemIcon,mo as damSelectedItemInfoBtn,oo as damSelectedItemInner,Je as damSelectedItemLinkBtn,lo as damSelectedItemLinkContainer,po as damSelectedItemMediaContainer,co as damSelectedItemPopover,Ue as damSelectedItemPopoverLabel,le as damSelectedItemSmallText,io as damSelectedItemTitle,Dr as draggableContainer,Ne as draggableIcon,Ur as draggableIconOffset,zr as draggableIconWrapper,Rr as entrySearchBtn,Ir as entrySearchConfig,Tr as entrySearchConfigHidden,kr as entrySearchLoadMoreBtn,Er as entrySearchResultList,Mr as entrySearchSelectIcon,Vr as entrySearchSelectImg,ic as entrySearchSelectInput,sc as entrySearchSelectOption,Lr as entrySearchWrapper,Qr as productSearchRowActiveIcon,Kr as productSearchRowCategory,Or as productSearchRowContainer,Hr as productSearchRowContent,$r as productSearchRowContentActive,Nr as productSearchRowDetails,Fr as productSearchRowTitle,Xr as productSelectedItemContainer,Yr as productSelectedItemContent,qr as productSelectedItemDetails,Jr as productSelectedItemIcon,Ze as productSelectedItemImage,jr as productSelectedItemLinkContainer,Xe as productedSelectedItemLinkBtn,qe as productedSelectedItemSmallText,Sr as searchRowBtn,vr as searchRowContainer,yr as searchRowContainerActive,hr as searchRowContainerWithPopover,br as searchRowPopover,Ke as searchRowText,Fe as searchRowTextSmall,$e as selectItemLinkBtn,mr as selectItemLinkContainer,pr as selectItemPopover,ye as selectItemPopoverLabel,te as selectItemSmallText,ar as selectedItemContainer,cr as selectedItemCopy,sr as selectedItemDetails,lr as selectedItemIcon,ir as selectedItemInner,dr as selectedItemTitle,mt as useInitializeUniformMeshSdk,Ha as useMeshLocation,It as useProductQueryContext,ze as useProductSearchContext,Ma as useUniformMeshLocation,Pe as useUniformMeshLocationContext,dt as useUniformMeshSdk,ct as useUniformMeshSdkContext};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var _o=Object.create;var $e=Object.defineProperty;var Zo=Object.getOwnPropertyDescriptor;var Xo=Object.getOwnPropertyNames;var qo=Object.getPrototypeOf,Yo=Object.prototype.hasOwnProperty;var Zr=(e,r)=>{for(var o in r)$e(e,o,{get:r[o],enumerable:!0})},He=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Xo(r))!Yo.call(e,n)&&n!==o&&$e(e,n,{get:()=>r[n],enumerable:!(t=Zo(r,n))||t.enumerable});return e},F=(e,r,o)=>(He(e,r,"default"),o&&He(o,r,"default")),Fe=(e,r,o)=>(o=e!=null?_o(qo(e)):{},He(r||!e||!e.__esModule?$e(o,"default",{value:e,enumerable:!0}):o,e)),Jo=e=>He($e({},"__esModule",{value:!0}),e);var O={};Zr(O,{AddListButton:()=>u.AddListButton,Button:()=>u.Button,Callout:()=>u.Callout,DamSelectedItem:()=>xn,DefaultSearchRow:()=>er,DefaultSelectedItem:()=>_t,EntrySearch:()=>mr,Heading:()=>u.Heading,Icons:()=>Je,Input:()=>u.Input,InputSelect:()=>u.InputSelect,InputToggle:()=>u.InputToggle,KeywordSearchInput:()=>u.InputKeywordSearch,Label:()=>u.Label,LoadingIndicator:()=>u.LoadingIndicator,LoadingOverlay:()=>u.LoadingOverlay,Menu:()=>u.Menu,MenuItem:()=>u.MenuItem,MeshApp:()=>Cn,ProductPreviewList:()=>Rt,ProductQuery:()=>nn,ProductQueryContext:()=>Pt,ProductSearch:()=>Sn,ProductSearchContext:()=>Tr,ProductSearchRow:()=>xr,ProductSelectedItem:()=>Ir,ResolvableLoadingValue:()=>St,ScrollableList:()=>u.ScrollableList,ScrollableListItem:()=>u.ScrollableListItem,SelectionField:()=>xt,Switch:()=>u.Switch,Textarea:()=>u.Textarea,Theme:()=>u.Theme,UniformMeshLocationContext:()=>yt,UniformMeshLocationContextProvider:()=>Ve,UniformMeshSdkContext:()=>Me,UniformMeshSdkContextProvider:()=>jo,badgeIcon:()=>at,damSelectItemImage:()=>mt,damSelectedItemContainer:()=>Er,damSelectedItemCopy:()=>Dr,damSelectedItemDetails:()=>Vr,damSelectedItemIcon:()=>Ur,damSelectedItemInfoBtn:()=>Or,damSelectedItemInner:()=>Mr,damSelectedItemLinkBtn:()=>pt,damSelectedItemLinkContainer:()=>Gr,damSelectedItemMediaContainer:()=>Br,damSelectedItemPopover:()=>Ar,damSelectedItemPopoverLabel:()=>Ge,damSelectedItemSmallText:()=>he,damSelectedItemTitle:()=>zr,draggableContainer:()=>dr,draggableIcon:()=>nt,draggableIconOffset:()=>pr,draggableIconWrapper:()=>lr,entrySearchBtn:()=>rr,entrySearchConfig:()=>nr,entrySearchConfigHidden:()=>ar,entrySearchLoadMoreBtn:()=>or,entrySearchResultList:()=>ir,entrySearchSelectIcon:()=>sr,entrySearchSelectImg:()=>cr,entrySearchSelectInput:()=>hn,entrySearchSelectOption:()=>yn,entrySearchWrapper:()=>tr,productSearchRowActiveIcon:()=>br,productSearchRowCategory:()=>hr,productSearchRowContainer:()=>ur,productSearchRowContent:()=>gr,productSearchRowContentActive:()=>fr,productSearchRowDetails:()=>yr,productSearchRowTitle:()=>vr,productSelectedItemContainer:()=>Cr,productSelectedItemContent:()=>Lr,productSelectedItemDetails:()=>Pr,productSelectedItemIcon:()=>Rr,productSelectedItemImage:()=>it,productSelectedItemLinkContainer:()=>kr,productedSelectedItemLinkBtn:()=>st,productedSelectedItemSmallText:()=>ct,searchRowBtn:()=>Jt,searchRowContainer:()=>Zt,searchRowContainerActive:()=>qt,searchRowContainerWithPopover:()=>Xt,searchRowPopover:()=>Yt,searchRowText:()=>ot,searchRowTextSmall:()=>rt,selectItemLinkBtn:()=>et,selectItemLinkContainer:()=>Qt,selectItemPopover:()=>Nt,selectItemPopoverLabel:()=>Pe,selectItemSmallText:()=>ae,selectedItemContainer:()=>Bt,selectedItemCopy:()=>$t,selectedItemDetails:()=>Ht,selectedItemIcon:()=>Kt,selectedItemInner:()=>Ot,selectedItemTitle:()=>Ft,useInitializeUniformMeshSdk:()=>bt,useMeshLocation:()=>tn,useProductQueryContext:()=>Lt,useProductSearchContext:()=>Ae,useUniformMeshLocation:()=>en,useUniformMeshLocationContext:()=>De,useUniformMeshSdk:()=>ht,useUniformMeshSdkContext:()=>vt});module.exports=Jo(O);var l=require("@emotion/react"),k=Fe(require("react"));var ne=require("react");var Ke=require("react");var Xr=require("@uniformdev/design-system"),Ee=require("@emotion/react/jsx-runtime"),Me=(0,Ke.createContext)(void 0),jo=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),(0,Ee.jsxs)(Me.Provider,{value:r,children:[(0,Ee.jsx)(Xr.Theme,{}),(0,Ee.jsx)(Ve,{children:e})]})},vt=()=>{let e=(0,Ke.useContext)(Me);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function ht(){let{sdk:e}=vt();return e}var qr=require("@emotion/react/jsx-runtime"),yt=(0,ne.createContext)(void 0),Ve=({children:e})=>{let r=ht(),[o,t]=(0,ne.useState)(r.getCurrentLocation()),n=a=>{t(d=>({...d,value:a.newValue}))};return(0,ne.useEffect)(()=>(r.events.on("onValueChanged",n),()=>{r.events.off("onValueChanged",n)}),[r]),(0,qr.jsx)(yt.Provider,{value:{location:o},children:e})},De=()=>{let e=(0,ne.useContext)(yt);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function en(){let{location:e}=De();return e}var Yr=require("@uniformdev/mesh-sdk"),me=require("react"),bt=({autoResizingDisabled:e}={})=>{let[r,o]=(0,me.useState)(),[t,n]=(0,me.useState)(),a=(0,me.useRef)(!1);return(0,me.useEffect)(()=>{typeof window=="undefined"||t||(typeof window.UniformMeshSDK=="undefined"&&!a.current?(a.current=!0,(0,Yr.initializeUniformMeshSDK)({autoResizingDisabled:e}).then(d=>{n(d)}).catch(d=>{o(d)}).finally(()=>{a.current=!1})):n(window.UniformMeshSDK))},[e]),{initializing:!t&&!r,error:r,sdk:t}};function tn(e){let{location:r}=De();if(e&&r.type!==e)throw new Error(`Expected location type ${e} but got ${r.type}`);return r}var J=Fe(require("react"));var to=require("@emotion/react"),Qe=require("@uniformdev/design-system"),ro=require("react-icons/cg");var we=require("@emotion/react/jsx-runtime"),St=({value:e,text:r,loading:o})=>(0,we.jsxs)(we.Fragment,{children:[!!r&&r,!r&&(0,we.jsxs)(we.Fragment,{children:[o&&`${e} (Loading...)`,!o&&`${e} (Unresolvable)`]})]});var Ne=require("@emotion/react"),Jr=Ne.css`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
margin-bottom: var(--spacing-sm);
|
|
9
9
|
margin-right: var(--spacing-sm);
|
|
10
|
-
|
|
10
|
+
`,jr=Ne.css`
|
|
11
11
|
color: var(--gray-800);
|
|
12
12
|
padding: var(--spacing-3);
|
|
13
|
-
`,
|
|
13
|
+
`,eo=Ne.css`
|
|
14
14
|
border: none;
|
|
15
15
|
border-left: 1px solid var(--gray-300);
|
|
16
16
|
background: var(--gray-100);
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
|
-
`;var
|
|
18
|
+
`;var Y=require("@emotion/react/jsx-runtime"),xt=({id:e,label:r,loading:o,selectedValues:t,values:n,onAdd:a,onRemove:d})=>{var S;let h=(S=n==null?void 0:n.filter(i=>!(t!=null&&t.includes(i.id.toString()))))!=null?S:[],v=(i,m)=>{i.preventDefault(),d(m)};return(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Qe.InputSelect,{id:e,name:e,label:r,onChange:i=>a(i.target.value),disabled:o,options:[{value:"",label:"Add..."},...h.map(i=>({value:i.id,label:i.name||i.id}))],value:"",css:Array.isArray(t)&&t.length>0?to.css`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),t==null?void 0:t.map(i=>{var m;return(0,
|
|
20
|
+
`:""}),t==null?void 0:t.map(i=>{var m;return(0,Y.jsxs)("div",{css:Jr,children:[(0,Y.jsx)("span",{css:jr,children:(0,Y.jsx)(St,{value:i,loading:o,text:(m=n.find(w=>w.id===i))==null?void 0:m.name})}),(0,Y.jsx)("button",{css:eo,title:"remove",onClick:w=>v(w,i),children:(0,Y.jsx)(Qe.Icon,{icon:ro.CgClose,iconColor:"currentColor",size:20})})]},i)})]})};var wt=require("@emotion/react/jsx-runtime"),rn=e=>(0,wt.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:(0,wt.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"})}),We=rn;var Ct=require("@emotion/react/jsx-runtime"),on=e=>(0,Ct.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:(0,Ct.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"})}),_e=on;var Ze=require("react-use"),U=require("@uniformdev/design-system"),M=require("@emotion/react"),y=require("@emotion/react/jsx-runtime"),oo={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},nn=({value:e,setValue:r,brands:o,categories:t,loading:n,categoriesLoading:a,brandsLoading:d,logoIcon:h,onGetProducts:v,sortOptions:S,sortOrderOptions:i,categoryLabel:m="Product Category",brandLabel:w="Brand",disableBrands:H,restrictToSingleCategory:Se=!1})=>{var D,g,G;let R=async s=>{r({...oo,...e||{},...s})},P=(0,J.useMemo)(()=>({...oo,...e||{}}),[e]),[xe,ke]=(0,Ze.useAsyncFn)(async s=>await v(s),[v]);(0,Ze.useDebounce)(async()=>{await ke({brand:P.brand,categories:P.categories,keyword:P.keyword,sort:P.sort,sortOrder:P.sortOrder,count:P.count})},250,[P]);let _=(0,J.useMemo)(()=>{let s=[];return t==null||t.forEach($=>{let T=ao($,void 0);s.push(...T)}),s},[t]),re=(0,J.useMemo)(()=>[{value:"",label:"All categories"},..._.map(s=>({label:s.name,value:s.id}))],[_]),q=(0,J.useMemo)(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),Ie=s=>{if(!s)return;let $=(e==null?void 0:e.categories)||[];R({categories:[...$,s]})},Be=s=>{var $;R({categories:($=e==null?void 0:e.categories)==null?void 0:$.filter(T=>T!==s)})},le=s=>{R({brand:s.target.value})},Z=s=>{R({count:s||1})};return n?(0,y.jsx)("div",{children:"Loading..."}):(0,y.jsx)(Pt.Provider,{value:{categories:t,logoIcon:h},children:(0,y.jsxs)("div",{css:M.css`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
24
|
-
`,children:[Se?(0,y.jsx)(U.InputSelect,{id:"selection-field-product-category",label:m,disabled:n,value:(g=(D=
|
|
24
|
+
`,children:[Se?(0,y.jsx)(U.InputSelect,{id:"selection-field-product-category",label:m,disabled:n,value:(g=(D=P.categories)==null?void 0:D[0])!=null?g:"",options:re,onChange:s=>{R({categories:s.target.value===""?[]:[s.target.value]})}}):(0,y.jsx)(xt,{loading:a||!1,id:"selection-field-product-category",label:m,onAdd:Ie,onRemove:Be,selectedValues:P.categories,values:_}),(0,y.jsxs)("div",{css:M.css`
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-wrap: wrap;
|
|
27
27
|
column-gap: var(--spacing-lg);
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
}
|
|
32
32
|
`,children:[H?null:(0,y.jsx)("div",{css:M.css`
|
|
33
33
|
width: 50%;
|
|
34
|
-
`,children:(0,y.jsx)(U.InputSelect,{id:"brand",name:"brand",label:w,disabled:d,value:
|
|
34
|
+
`,children:(0,y.jsx)(U.InputSelect,{id:"brand",name:"brand",label:w,disabled:d,value:P.brand,onChange:le,options:[{value:"",label:"Choose..."},...q.map(s=>({value:s.id,label:s.name}))]})}),(0,y.jsx)("div",{css:M.css`
|
|
35
35
|
flex-grow: 1;
|
|
36
36
|
position: relative;
|
|
37
|
-
`,children:(0,y.jsx)(U.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:
|
|
37
|
+
`,children:(0,y.jsx)(U.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:P.keyword,placeholder:"Enter keyword",onChange:s=>R({keyword:s.target.value})})})]}),(0,y.jsxs)("div",{css:M.css`
|
|
38
38
|
display: flex;
|
|
39
39
|
flex-wrap: wrap;
|
|
40
40
|
column-gap: var(--spacing-lg);
|
|
@@ -48,25 +48,25 @@
|
|
|
48
48
|
width: 33.333333%;
|
|
49
49
|
}
|
|
50
50
|
position: relative;
|
|
51
|
-
`,children:[(0,y.jsx)(U.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:
|
|
51
|
+
`,children:[(0,y.jsx)(U.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:P.count,onChange:s=>Z(s.target.valueAsNumber),label:"Count"}),(0,y.jsxs)("div",{css:M.css`
|
|
52
52
|
position: absolute;
|
|
53
53
|
bottom: var(--spacing-sm);
|
|
54
54
|
right: var(--spacing-sm);
|
|
55
55
|
display: flex;
|
|
56
56
|
gap: var(--spacing-sm);
|
|
57
|
-
`,children:[(0,y.jsx)(
|
|
57
|
+
`,children:[(0,y.jsx)(no,{onCountChange:()=>Z(P.count-1),countIcon:"decrement",disabled:P.count===1}),(0,y.jsx)(no,{onCountChange:()=>Z(P.count+1),countIcon:"increment"})]})]}),Array.isArray(S)&&S.length>0?(0,y.jsx)("div",{css:M.css`
|
|
58
58
|
flex-grow: 1;
|
|
59
59
|
${(0,U.mq)("md")} {
|
|
60
60
|
width: 33.333333%;
|
|
61
61
|
}
|
|
62
|
-
`,children:(0,y.jsx)(U.InputSelect,{id:"sort",name:"sort",label:"Sort",value:
|
|
62
|
+
`,children:(0,y.jsx)(U.InputSelect,{id:"sort",name:"sort",label:"Sort",value:P.sort,onChange:s=>R({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...S.map(s=>({value:s.sortKey,label:s.name}))]})}):null,Array.isArray(i)&&i.length>0?(0,y.jsx)("div",{css:M.css`
|
|
63
63
|
flex-grow: 1;
|
|
64
|
-
`,children:(0,y.jsx)(U.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:
|
|
64
|
+
`,children:(0,y.jsx)(U.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:P.sortOrder,onChange:s=>R({sortOrder:s.target.value}),options:i.map(s=>({value:s.sortOrderKey,label:s.name}))})}):null]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{css:M.css`
|
|
65
65
|
font-size: var(--fs-md);
|
|
66
66
|
line-height: var(--spacing-md);
|
|
67
67
|
font-weight: var(--fw-bold);
|
|
68
68
|
margin-bottom: var(--spacing-xs);
|
|
69
|
-
`,children:"Result Preview"}),(0,y.jsx)(
|
|
69
|
+
`,children:"Result Preview"}),(0,y.jsx)(Rt,{products:(G=xe.value)==null?void 0:G.products})]})]})})};function ao(e,r){var a;let o=[],t=r?`${r.name} > `:"",n={id:e.id.toString(),name:`${t}${e.name}`};return o.push(n),(a=e.children)==null||a.forEach(d=>{let h=ao(d,n);o.push(...h)}),o}function no({onCountChange:e,countIcon:r,disabled:o}){return(0,y.jsx)("button",{css:M.css`
|
|
70
70
|
width: 2.25rem;
|
|
71
71
|
height: 2.25rem;
|
|
72
72
|
border: 1px solid var(--gray-300);
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
cursor: not-allowed;
|
|
83
83
|
opacity: 0.3;
|
|
84
84
|
`:""}
|
|
85
|
-
`,onClick:e,disabled:o,children:r==="increment"?(0,y.jsx)(
|
|
85
|
+
`,onClick:e,disabled:o,children:r==="increment"?(0,y.jsx)(We,{css:M.css`
|
|
86
86
|
width: 1rem;
|
|
87
87
|
height: 1rem;
|
|
88
|
-
`}):(0,y.jsx)(
|
|
88
|
+
`}):(0,y.jsx)(_e,{css:M.css`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`})})}var
|
|
91
|
+
`})})}var Pt=J.default.createContext(void 0),Lt=()=>{let e=(0,J.useContext)(Pt);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};var kt=require("@emotion/react/jsx-runtime");function X({src:e,alt:r,className:o}){let t=e&&typeof e!="string"?e:null;return t?(0,kt.jsx)(t,{className:o}):(0,kt.jsx)("img",{src:e,alt:r,className:o})}var Tt=require("@emotion/react"),vo=require("@uniformdev/design-system");var K=require("@emotion/react"),io=K.css`
|
|
92
92
|
align-items: center;
|
|
93
93
|
background: var(--white);
|
|
94
94
|
border-radius: var(--rounded-base);
|
|
@@ -103,55 +103,55 @@
|
|
|
103
103
|
&:hover {
|
|
104
104
|
background: var(--gray-50);
|
|
105
105
|
}
|
|
106
|
-
`,
|
|
106
|
+
`,so=K.css`
|
|
107
107
|
font-size: var(--fs-sm);
|
|
108
|
-
`,
|
|
108
|
+
`,co=K.css`
|
|
109
109
|
width: 1rem;
|
|
110
110
|
height: 1rem;
|
|
111
|
-
`,
|
|
111
|
+
`,It=K.css`
|
|
112
112
|
margin-right: var(--spacing-lg);
|
|
113
113
|
font-size: var(--fs-sm);
|
|
114
|
-
`,
|
|
114
|
+
`,lo=K.css`
|
|
115
115
|
border: 1px solid var(--gray-200);
|
|
116
116
|
border-radius: var(--rounded-md);
|
|
117
117
|
background: var(--gray-50);
|
|
118
118
|
margin: var(--spacing-base) 0;
|
|
119
|
-
`,
|
|
119
|
+
`,po=K.css`
|
|
120
120
|
align-items: center;
|
|
121
121
|
display: flex;
|
|
122
122
|
flex-grow: 1;
|
|
123
123
|
gap: var(--spacing-base);
|
|
124
124
|
padding: var(--spacing-sm);
|
|
125
125
|
margin-right: var(--spacing-sm);
|
|
126
|
-
`,
|
|
126
|
+
`,mo=K.css`
|
|
127
127
|
background: var(--gray-200);
|
|
128
128
|
width: 3.5rem;
|
|
129
129
|
height: 3.5rem;
|
|
130
130
|
object-fit: cover;
|
|
131
|
-
`,
|
|
131
|
+
`,uo=K.css`
|
|
132
132
|
background: var(--gray-100);
|
|
133
133
|
height: 3.5rem;
|
|
134
134
|
width: 3.5rem;
|
|
135
|
-
`,
|
|
135
|
+
`,go=K.css`
|
|
136
136
|
margin-top: 0;
|
|
137
137
|
font-weight: var(--fw-bold);
|
|
138
138
|
font-size: var(--fs-sm);
|
|
139
139
|
width: calc(100% / 3);
|
|
140
|
-
`,
|
|
140
|
+
`,fo=K.css`
|
|
141
141
|
display: block;
|
|
142
142
|
font-weight: var(--fw-regular);
|
|
143
|
-
`;var
|
|
143
|
+
`;var L=require("@emotion/react/jsx-runtime"),Rt=({products:e})=>{let{categories:r,logoIcon:o}=Lt();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("p",{css:Tt.css`
|
|
144
144
|
margin-bottom: var(--spacing-base);
|
|
145
|
-
`,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),(0,
|
|
145
|
+
`,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),(0,L.jsx)("ul",{css:[Tt.css`
|
|
146
146
|
max-height: 24rem;
|
|
147
147
|
overflow-x: auto;
|
|
148
|
-
`,
|
|
148
|
+
`,vo.scrollbarStyles],children:e==null?void 0:e.map((t,n)=>{var h,v;let[a]=(t==null?void 0:t.categories)||[],d=typeof a=="undefined"||!r||(h=r.find(S=>S.id===a.id))==null?void 0:h.name;return(0,L.jsx)("li",{css:lo,children:(0,L.jsxs)("div",{css:po,"data-test-id":`product-item-${t.sku||t.id}`,children:[t.thumbnailUrl?(0,L.jsx)("img",{src:t.thumbnailUrl,alt:typeof t.title=="string"?t.title:t.name||`Product ${n}`,css:mo,"data-test-id":"product-image"}):(0,L.jsx)("div",{css:uo}),(0,L.jsxs)("h4",{css:go,"data-test-id":"product-name",children:[t.title||t.name,d&&(0,L.jsx)("span",{css:fo,children:d})]}),t&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("p",{css:It,"data-test-id":"product-sku",children:["SKU: ",t.sku||t.id,(0,L.jsx)("br",{})]}),t.price!==void 0?(0,L.jsxs)("p",{css:It,"data-test-id":"product-price",children:["Price: ",t.price]}):null,t.editLink||t.url?(0,L.jsxs)("a",{css:io,href:(v=t.editLink)!=null?v:t.url,title:`Go to ${t.title||t.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[(0,L.jsx)("span",{css:so,children:"Edit"}),o?(0,L.jsx)(X,{src:o,alt:"Logo",css:co}):null]}):null]})]})},`product-${t.id}`)})})]})};var ce=Fe(require("react"));var Q=Fe(require("react"));var Je={};Zr(Je,{Caution:()=>ho,Checkmark:()=>Xe,ChevronDown:()=>qe,Close:()=>yo,Danger:()=>bo,ExclamationPoint:()=>So,Info:()=>Ye,Lightbulb:()=>xo,MagnifyingGlass:()=>wo,MaximizeAlt:()=>Co,Minus:()=>_e,MoreVerticalAlt:()=>Ue,Plus:()=>We});var Et=require("@emotion/react/jsx-runtime"),an=e=>(0,Et.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",role:"img",...e,children:(0,Et.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"})}),ho=an;var Mt=require("@emotion/react/jsx-runtime"),sn=e=>(0,Mt.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:(0,Mt.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"})}),Xe=sn;var Vt=require("@emotion/react/jsx-runtime"),cn=e=>(0,Vt.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",role:"img",...e,children:(0,Vt.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"})}),qe=cn;var Ce=require("@emotion/react/jsx-runtime"),dn=e=>(0,Ce.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",role:"img",...e,children:(0,Ce.jsxs)("g",{fillRule:"evenodd",children:[(0,Ce.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,Ce.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"})]})}),yo=dn;var Dt=require("@emotion/react/jsx-runtime"),ln=e=>(0,Dt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",role:"img",...e,children:(0,Dt.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"})}),bo=ln;var zt=require("@emotion/react/jsx-runtime"),pn=e=>(0,zt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",role:"img",...e,children:(0,zt.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"})}),So=pn;var ze=require("@emotion/react/jsx-runtime"),mn=e=>(0,ze.jsxs)("svg",{width:"1em",height:"1em",fill:"currentColor",role:"img",...e,children:[(0,ze.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,ze.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"})]}),Ye=mn;var Ut=require("@emotion/react/jsx-runtime"),un=e=>(0,Ut.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",role:"img",...e,children:(0,Ut.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"})}),xo=un;var j=require("@emotion/react/jsx-runtime"),gn=e=>(0,j.jsxs)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:[(0,j.jsxs)("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[(0,j.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,j.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,j.jsx)("defs",{children:(0,j.jsx)("clipPath",{id:"magnifying-glass_svg__a",children:(0,j.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),wo=gn;var At=require("@emotion/react/jsx-runtime"),fn=e=>(0,At.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",role:"img",...e,children:(0,At.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"})}),Co=fn;var Gt=require("@emotion/react/jsx-runtime"),vn=e=>(0,Gt.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",role:"img",...e,children:(0,Gt.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"})}),Ue=vn;var ko=require("react-use"),Io=require("uuid");var ue=require("react");function je(e,r){let o=window.open(e,"_blank"),t=setInterval(()=>{o!=null&&o.closed&&(clearInterval(t),r())},500)}var Lo=require("timeago.js");var B=require("@emotion/react"),Po=require("@uniformdev/design-system"),Bt=B.css`
|
|
149
149
|
border: 1px solid var(--gray-200);
|
|
150
150
|
background: var(--gray-50);
|
|
151
151
|
border-radius: var(--rounded-base);
|
|
152
152
|
display: flex;
|
|
153
153
|
width: 100%;
|
|
154
|
-
`,
|
|
154
|
+
`,Ot=B.css`
|
|
155
155
|
align-items: center;
|
|
156
156
|
display: flex;
|
|
157
157
|
flex-grow: 1;
|
|
@@ -159,22 +159,22 @@
|
|
|
159
159
|
margin-inline: 0 var(--spacing-sm);
|
|
160
160
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
161
161
|
position: relative;
|
|
162
|
-
`,
|
|
162
|
+
`,Ht=B.css`
|
|
163
163
|
flex-grow: 1;
|
|
164
|
-
|
|
164
|
+
`,$t=B.css`
|
|
165
165
|
align-items: start;
|
|
166
166
|
display: inline-flex;
|
|
167
167
|
position: relative;
|
|
168
|
-
`,
|
|
168
|
+
`,Ft=B.css`
|
|
169
169
|
color: var(--brand-secondary-1);
|
|
170
170
|
font-size: var(--fs-base);
|
|
171
171
|
font-weight: var(--fw-bold);
|
|
172
172
|
line-height: 1;
|
|
173
173
|
margin: 0;
|
|
174
|
-
`,
|
|
174
|
+
`,Kt=B.css`
|
|
175
175
|
width: 1.5rem;
|
|
176
176
|
height: 1.5rem;
|
|
177
|
-
`,
|
|
177
|
+
`,Nt=B.css`
|
|
178
178
|
background: var(--white);
|
|
179
179
|
border-radius: var(--rounded-base);
|
|
180
180
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -183,22 +183,22 @@
|
|
|
183
183
|
padding: var(--spacing-base);
|
|
184
184
|
z-index: var(--z-10);
|
|
185
185
|
width: max-content;
|
|
186
|
-
`,ae=
|
|
186
|
+
`,ae=B.css`
|
|
187
187
|
font-size: var(--fs-sm);
|
|
188
|
-
`,
|
|
188
|
+
`,Pe=B.css`
|
|
189
189
|
font-weight: var(--fw-bold);
|
|
190
190
|
margin-right: var(--spacing-sm);
|
|
191
|
-
`,
|
|
191
|
+
`,Qt=B.css`
|
|
192
192
|
display: flex;
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
gap: var(--spacing-sm);
|
|
195
195
|
|
|
196
|
-
${(0,
|
|
196
|
+
${(0,Po.mq)("md")} {
|
|
197
197
|
flex-direction: row;
|
|
198
198
|
min-width: 200px;
|
|
199
199
|
justify-content: end;
|
|
200
200
|
}
|
|
201
|
-
`,et=
|
|
201
|
+
`,et=B.css`
|
|
202
202
|
align-items: center;
|
|
203
203
|
background: var(--white);
|
|
204
204
|
border-radius: var(--rounded-base);
|
|
@@ -213,31 +213,31 @@
|
|
|
213
213
|
&:hover {
|
|
214
214
|
background: var(--gray-50);
|
|
215
215
|
}
|
|
216
|
-
`;var
|
|
216
|
+
`;var ee=require("@emotion/react");var Wt=require("@uniformdev/design-system"),tt=require("react-icons/cg"),b=require("@emotion/react/jsx-runtime"),_t=({selectedItem:e,logoIcon:r,onDeselect:o,onEditClosed:t})=>{var S;let n=(0,ue.useRef)(null),a=(0,ue.useRef)(null),[d,h]=(0,ue.useState)(!1);(0,ue.useEffect)(()=>{let i=w=>{n.current&&!n.current.contains(w.target)&&a.current&&!a.current.contains(w.target)&&h(!1)},m=()=>{h(!1)};return window.addEventListener("resize",m,!0),document.addEventListener("scroll",i,!0),document.addEventListener("mousedown",i),()=>{window.removeEventListener("resize",m,!0),document.removeEventListener("scroll",i,!0),document.removeEventListener("mousedown",i)}},[a]);let v=()=>{var i;if(h(!d),a.current&&n.current){let m=(i=n==null?void 0:n.current)==null?void 0:i.getBoundingClientRect(),w=a.current.offsetWidth;a.current.style.top=`${m.top+30}px`,a.current.style.left=`${m.left-w+30}px`}};return(0,b.jsx)("div",{css:Bt,children:(0,b.jsxs)("div",{css:Ot,children:[(0,b.jsxs)("div",{css:Ht,children:[(0,b.jsxs)("div",{css:$t,children:[(0,b.jsx)("h4",{css:[Ft,e.popoverData?ee.css`
|
|
217
217
|
margin-bottom: var(--spacing-sm);
|
|
218
|
-
`:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",ref:n,css:
|
|
218
|
+
`:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",ref:n,css:ee.css`
|
|
219
219
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
220
|
-
`,"aria-controls":"path-details","aria-expanded":d,onClick:v,children:(0,b.jsx)(
|
|
220
|
+
`,"aria-controls":"path-details","aria-expanded":d,onClick:v,children:(0,b.jsx)(Wt.Icon,{icon:tt.CgInfo,iconColor:"gray",size:24,css:ee.css`
|
|
221
221
|
opacity: var(--opacity-75);
|
|
222
|
-
`})}),(0,b.jsx)("div",{id:"path-details","aria-hidden":!d,ref:a,css:[
|
|
222
|
+
`})}),(0,b.jsx)("div",{id:"path-details","aria-hidden":!d,ref:a,css:[Nt,d?ee.css`
|
|
223
223
|
visibility: visible;
|
|
224
|
-
`:
|
|
224
|
+
`:ee.css`
|
|
225
225
|
visibility: hidden;
|
|
226
|
-
`],children:Object.entries(e.popoverData).map(([i,m],w)=>(0,b.jsxs)("div",{css:ae,children:[(0,b.jsxs)("span",{css:
|
|
226
|
+
`],children:Object.entries(e.popoverData).map(([i,m],w)=>(0,b.jsxs)("div",{css:ae,children:[(0,b.jsxs)("span",{css:Pe,children:[i,":"]}),m]},w))})]}):null]}),e.createdDate&&(0,b.jsxs)("div",{css:ae,children:[(0,b.jsx)("span",{css:Pe,children:"Created:"}),(0,Lo.format)((S=e.createdDate)!=null?S:0)]}),e.metadata?Object.entries(e.metadata).filter(([i])=>["type","status"].includes(i.toLocaleLowerCase())).map(([i,m])=>(0,b.jsxs)("div",{css:[ae,ee.css`
|
|
227
227
|
order: 1;
|
|
228
|
-
`],children:[(0,b.jsxs)("span",{css:
|
|
228
|
+
`],children:[(0,b.jsxs)("span",{css:Pe,children:[i,":"]}),m]},i)):null,e.metadata?Object.entries(e.metadata).filter(([i])=>!["type","status"].includes(i.toLocaleLowerCase())).map(([i,m])=>(0,b.jsxs)("div",{css:[ae,ee.css`
|
|
229
229
|
order: 1;
|
|
230
|
-
`],children:[(0,b.jsxs)("span",{css:[
|
|
230
|
+
`],children:[(0,b.jsxs)("span",{css:[Pe,ee.css`
|
|
231
231
|
order: 1;
|
|
232
|
-
`],children:[i,":"]}),m]},i)):null]}),(0,b.jsxs)("div",{css:
|
|
232
|
+
`],children:[i,":"]}),m]},i)):null]}),(0,b.jsxs)("div",{css:Qt,children:[e.editLink?(0,b.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:i=>{t&&(je(i.currentTarget.href,()=>t(e)),i.preventDefault())},css:et,children:[(0,b.jsx)("span",{css:ae,children:"Edit"}),(0,b.jsx)(X,{src:r,css:Kt,alt:"Logo"})]}):null,(0,b.jsxs)("button",{type:"button",onClick:()=>{o(e)},css:et,children:[(0,b.jsx)("span",{css:ae,children:"Unlink"}),(0,b.jsx)(Wt.Icon,{icon:tt.CgClose,iconColor:"red",size:16})]})]})]})},e.id)};var ge=require("react");var ie=require("@emotion/react"),Zt=ie.css`
|
|
233
233
|
cursor: pointer;
|
|
234
234
|
padding: var(--spacing-sm);
|
|
235
235
|
position: relative;
|
|
236
236
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
237
237
|
color var(--duration-fast) var(--timing-ease-out);
|
|
238
|
-
`,
|
|
238
|
+
`,Xt=ie.css`
|
|
239
239
|
padding-right: var(--spacing-lg);
|
|
240
|
-
`,
|
|
240
|
+
`,qt=ie.css`
|
|
241
241
|
background: var(--brand-secondary-3);
|
|
242
242
|
color: var(--white);
|
|
243
243
|
`,rt=ie.css`
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
`,ot=ie.css`
|
|
246
246
|
font-weight: var(--fw-bold);
|
|
247
247
|
margin-right: var(--spacing-sm);
|
|
248
|
-
`,
|
|
248
|
+
`,Yt=ie.css`
|
|
249
249
|
background: var(--white);
|
|
250
250
|
border-left: 4px solid var(--brand-secondary-3);
|
|
251
251
|
border-radius: var(--rounded-base);
|
|
@@ -257,20 +257,20 @@
|
|
|
257
257
|
right: var(--spacing-xl);
|
|
258
258
|
z-index: var(--z-10);
|
|
259
259
|
width: max-content;
|
|
260
|
-
|
|
260
|
+
`,Jt=ie.css`
|
|
261
261
|
position: absolute;
|
|
262
262
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
263
|
-
`;var
|
|
263
|
+
`;var jt=require("@emotion/react"),A=require("@emotion/react/jsx-runtime"),er=({result:e,isSelected:r,triggerSelection:o})=>{let t=(0,ge.useRef)(null),n=(0,ge.useRef)(null),[a,d]=(0,ge.useState)(!1);(0,ge.useEffect)(()=>{function v(S){t.current&&!t.current.contains(S.target)&&n.current&&!n.current.contains(S.target)&&d(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[n]);let h=v=>{v.stopPropagation(),d(!a)};return(0,A.jsxs)("div",{css:[Zt,r?qt:void 0,e.popoverData?Xt:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o(),children:[e.title,e.popoverData&&r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("button",{type:"button",ref:t,css:Jt,"aria-controls":"path-details",onClick:v=>h(v),"aria-expanded":a,children:(0,A.jsx)(Ye,{width:24,height:24})}),(0,A.jsxs)("div",{id:"path-details","aria-hidden":!a,ref:n,css:[Yt,a?jt.css`
|
|
264
264
|
visibility: visible;
|
|
265
|
-
`:
|
|
265
|
+
`:jt.css`
|
|
266
266
|
visibility: hidden;
|
|
267
|
-
`],children:[e.metadata&&Object.entries(e.metadata).map(([v,S],i)=>(0,
|
|
267
|
+
`],children:[e.metadata&&Object.entries(e.metadata).map(([v,S],i)=>(0,A.jsxs)("div",{css:rt,children:[(0,A.jsxs)("span",{css:ot,children:[v,":"]}),S]},i)),Object.entries(e.popoverData).map(([v,S],i)=>(0,A.jsxs)("div",{css:rt,children:[(0,A.jsxs)("span",{css:ot,children:[v,":"]}),S]},i))]})]}):null]},e.id)};var Le=require("react-beautiful-dnd");var E=require("@emotion/react"),tr=E.css`
|
|
268
268
|
background: var(--white);
|
|
269
269
|
border: 1px solid var(--gray-300);
|
|
270
270
|
border-radius: var(--rounded-base);
|
|
271
271
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
272
272
|
margin-bottom: var(--spacing-base);
|
|
273
|
-
`,
|
|
273
|
+
`,rr=E.css`
|
|
274
274
|
align-items: center;
|
|
275
275
|
display: flex;
|
|
276
276
|
position: relative;
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
width: 100%;
|
|
279
279
|
background-color: transparent;
|
|
280
280
|
border: 0;
|
|
281
|
-
`,
|
|
281
|
+
`,or=E.css`
|
|
282
282
|
color: var(--brand-secondary-1);
|
|
283
283
|
display: block;
|
|
284
284
|
font-weight: var(--fw-bold);
|
|
@@ -294,15 +294,15 @@
|
|
|
294
294
|
background: var(--gray-100);
|
|
295
295
|
outline: none;
|
|
296
296
|
}
|
|
297
|
-
`,
|
|
297
|
+
`,nr=E.css`
|
|
298
298
|
background: var(--white);
|
|
299
299
|
border: 1px solid var(--gray-300);
|
|
300
300
|
border-radius: var(--rounded-base);
|
|
301
301
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
302
302
|
display: block;
|
|
303
|
-
`,
|
|
303
|
+
`,ar=E.css`
|
|
304
304
|
display: none;
|
|
305
|
-
`,
|
|
305
|
+
`,ir=E.css`
|
|
306
306
|
overflow-y: auto;
|
|
307
307
|
height: 16rem;
|
|
308
308
|
margin-bottom: var(--spacing-base);
|
|
@@ -314,14 +314,14 @@
|
|
|
314
314
|
`,hn=E.css`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
|
-
`,
|
|
317
|
+
`,sr=E.css`
|
|
318
318
|
align-items: center;
|
|
319
319
|
display: flex;
|
|
320
320
|
position: absolute;
|
|
321
321
|
inset: 0 0 0 auto;
|
|
322
322
|
pointer-events: none;
|
|
323
323
|
padding-right: var(--spacing-sm);
|
|
324
|
-
`,
|
|
324
|
+
`,cr=E.css`
|
|
325
325
|
color: var(--brand-secondary-1);
|
|
326
326
|
width: 1.25rem;
|
|
327
327
|
height: 1.25rem;
|
|
@@ -330,14 +330,14 @@
|
|
|
330
330
|
`,yn=E.css`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
|
-
`,
|
|
333
|
+
`,dr=E.css`
|
|
334
334
|
position: relative;
|
|
335
335
|
margin-block: var(--spacing-sm) 0;
|
|
336
336
|
|
|
337
337
|
&:hover > span {
|
|
338
338
|
opacity: 0.3;
|
|
339
339
|
}
|
|
340
|
-
`,
|
|
340
|
+
`,lr=E.css`
|
|
341
341
|
align-items: center;
|
|
342
342
|
display: flex;
|
|
343
343
|
position: absolute;
|
|
@@ -346,87 +346,87 @@
|
|
|
346
346
|
opacity: 0;
|
|
347
347
|
`,nt=E.css`
|
|
348
348
|
color: var(--brand-secondary-1);
|
|
349
|
-
`,
|
|
349
|
+
`,pr=E.css`
|
|
350
350
|
position: absolute;
|
|
351
351
|
left: 0.375rem;
|
|
352
352
|
`,at=E.css`
|
|
353
353
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
354
354
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
355
|
-
`;var N=require("@emotion/react"),I=require("@uniformdev/design-system");var
|
|
355
|
+
`;var N=require("@emotion/react"),I=require("@uniformdev/design-system");var fe=require("react");function Ro(e,{delay:r=500,minDuration:o=200}={delay:500,minDuration:200}){let[t,n]=(0,fe.useState)("IDLE"),a=(0,fe.useRef)(void 0);return(0,fe.useEffect)(()=>{e&&t==="IDLE"&&(clearTimeout(a.current),a.current=setTimeout(()=>{if(!e)return n("IDLE");a.current=setTimeout(()=>{n("EXPIRE")},o),n("DISPLAY")},r),n("DELAY")),!e&&t!=="DISPLAY"&&(clearTimeout(a.current),n("IDLE"))},[e,t,r,o]),(0,fe.useEffect)(()=>()=>clearTimeout(a.current),[]),t==="DISPLAY"||t==="EXPIRE"}var p=require("@emotion/react/jsx-runtime"),bn=({searchText:e,selectedContentType:r})=>{let o="No content found";return r&&r!=="any"&&(o=`No ${r} content was found`),e&&(o=`${o} for keyword '${e}'.`),(0,p.jsx)(I.Callout,{type:"info",children:o})},mr=({search:e,results:r,contentTypes:o,selectedItems:t,logoIcon:n,select:a,multiSelect:d,multiSelectId:h,rowComponent:v,selectedItemComponent:S,totalResults:i,cursor:m,resultsLoading:w,requireContentType:H,onAddNew:Se,onEditClosed:R,onCancel:P,noResultsComponent:xe,helpComponent:ke,onSort:_,typeSelectorLabel:re="Content Type Select",typeSelectorAllTypesOptionText:q="All content types",loadingIndicatorDelay:Ie=1e3})=>{var Qr,Wr,_r;let le=()=>H?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[Z,D]=Q.useState(""),[g,G]=Q.useState(le),[s,$]=Q.useState(!1),[T,pe]=Q.useState([]),[Do,$r]=Q.useState(!1),ft=Q.useRef(`x${(0,Io.v4)()}`),Oe=(0,ko.useThrottle)(Z,750);Q.useEffect(()=>{e(Oe,{count:5,offset:0,contentType:g==="any"?void 0:g})},[Oe,g]);let zo=Ro(w,{delay:Ie}),Uo=c=>{T.some(x=>x.id===c.id)?pe(x=>x.filter(oe=>oe.id!==c.id)):pe(d?x=>[...x,c]:[c])},Ao=t==null?void 0:t.map(c=>c.id+c.title).join(",");Q.useEffect(()=>{Array.isArray(t)&&pe(t)},[Ao]);let Go=()=>{G(le()),D(""),pe(t!=null&&t.length?t:[])},Bo=()=>{$(c=>!c),s||Go()},Fr=c=>{let x=(T==null?void 0:T.filter(oe=>oe.id!==c.id))||[];pe(x),a(x,"")},Oo=c=>{c.preventDefault(),a(T,g),$(!1)},Ho=c=>{c.preventDefault(),$(!1),P&&P()},$o=()=>{e(Oe,{count:5,offset:(r==null?void 0:r.length)||0,contentType:g==="any"?void 0:g,cursor:m}),$r(!0);let c=setTimeout(()=>{$r(!1)},750);return()=>clearTimeout(c)},Fo=!(t==null?void 0:t.length)||d,Ko=v||er,Kr=S||_t,No=xe||bn,Nr=n&&typeof n!="string"?n:null,Qo=Nr?(0,p.jsx)(Nr,{css:at}):(0,p.jsx)("img",{src:n,alt:"Logo",css:at}),Wo=c=>{var x,oe;if(c.destination&&c.source.droppableId===((x=c.destination)==null?void 0:x.droppableId)){let z=[...t||[]],[Te]=(oe=z==null?void 0:z.splice(c.source.index,1))!=null?oe:[];return z==null||z.splice(c.destination.index,0,Te),_&&(pe(z),_==null||_(z)),z}};return(0,p.jsx)("div",{css:N.css`
|
|
356
356
|
width: 100%;
|
|
357
357
|
`,children:(0,p.jsxs)("div",{css:N.css`
|
|
358
358
|
position: relative;
|
|
359
359
|
margin-block: var(--spacing-base);
|
|
360
|
-
`,children:[
|
|
360
|
+
`,children:[Fo?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{css:tr,"data-test-id":"component-search",children:(0,p.jsxs)("button",{css:rr,onClick:Bo,type:"button","aria-haspopup":!0,"aria-expanded":s,"aria-controls":`entry-search-config-${ft.current}`,children:[Qo,(0,p.jsx)("span",{css:N.css`
|
|
361
361
|
margin-left: var(--spacing-base);
|
|
362
|
-
`,children:"Select"}),(0,p.jsx)("span",{css:
|
|
362
|
+
`,children:"Select"}),(0,p.jsx)("span",{css:sr,children:(0,p.jsx)(qe,{css:[cr,s?N.css`
|
|
363
363
|
transform: rotate(180deg);
|
|
364
|
-
`:void 0]})})]})}),(0,p.jsxs)("div",{id:`entry-search-config-${ft.current}`,"aria-hidden":!s,css:[
|
|
364
|
+
`:void 0]})})]})}),(0,p.jsxs)("div",{id:`entry-search-config-${ft.current}`,"aria-hidden":!s,css:[nr,s?void 0:ar],children:[ke||null,(0,p.jsxs)("div",{css:N.css`
|
|
365
365
|
display: flex;
|
|
366
366
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
367
367
|
margin-bottom: var(--spacing-base);
|
|
368
|
-
`,children:[(0,p.jsx)(I.InputSelect,{onChange:c=>
|
|
368
|
+
`,children:[(0,p.jsx)(I.InputSelect,{onChange:c=>G(c.target.value),value:g,label:re,showLabel:!1,options:[...H?[]:[{value:"any",label:q}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),(0,p.jsx)("div",{css:N.css`
|
|
369
369
|
flex-grow: 1;
|
|
370
|
-
`,children:(0,p.jsx)(I.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:D,disabledFieldSubmission:!0,value:
|
|
370
|
+
`,children:(0,p.jsx)(I.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:D,disabledFieldSubmission:!0,value:Z})})]}),(0,p.jsxs)("div",{css:[ir,I.scrollbarStyles],id:ft.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[(0,p.jsx)(I.LoadingOverlay,{isActive:zo}),Array.isArray(r)&&r.length>0?r.map(c=>(0,p.jsx)(Ko,{isSelected:T.some(x=>x.id===c.id),result:c,triggerSelection:()=>Uo(c)},c.id)):(0,p.jsx)(No,{searchText:Oe||Z,selectedContentType:(Wr=(Qr=o==null?void 0:o.find(c=>c.id===g))==null?void 0:Qr.name)!=null?Wr:g}),!w&&typeof i!="undefined"&&r&&(r==null?void 0:r.length)<i&&(0,p.jsx)("button",{type:"button",css:or,onClick:$o,children:Do?(0,p.jsx)(I.LoadingIndicator,{}):"Load More"})]}),(0,p.jsxs)("div",{css:N.css`
|
|
371
371
|
display: flex;
|
|
372
372
|
justify-content: space-between;
|
|
373
|
-
`,children:[(0,p.jsx)("div",{children:Se&&((
|
|
373
|
+
`,children:[(0,p.jsx)("div",{children:Se&&((_r=o==null?void 0:o.length)!=null?_r:0)>0?(0,p.jsx)(I.Menu,{menuLabel:"Add new menu",menuTrigger:(0,p.jsx)(I.Button,{buttonType:"secondary",children:"Add New"}),children:o==null?void 0:o.map(c=>(0,p.jsx)(I.MenuItem,{css:N.css`
|
|
374
374
|
background: var(--white);
|
|
375
375
|
color: var(--brand-secondary-1);
|
|
376
376
|
`,onClick:()=>Se(c),children:c.name},c.id))}):null}),(0,p.jsxs)("div",{css:N.css`
|
|
377
377
|
display: flex;
|
|
378
378
|
gap: var(--spacing-base);
|
|
379
|
-
`,children:[(0,p.jsx)(I.Button,{buttonType:"unimportant",onClick:
|
|
379
|
+
`,children:[(0,p.jsx)(I.Button,{buttonType:"unimportant",onClick:Ho,children:"Cancel"}),(0,p.jsx)(I.Button,{disabled:!T.length,onClick:Oo,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,s?null:d&&T.length>1?(0,p.jsx)(Le.DragDropContext,{onDragEnd:c=>Wo(c),children:(0,p.jsx)(Le.Droppable,{droppableId:h||"canvas-multi-select",children:c=>(0,p.jsxs)("div",{...c.droppableProps,ref:c.innerRef,css:N.css`
|
|
380
380
|
margin-block: var(--spacing-sm) 0;
|
|
381
|
-
`,children:[T==null?void 0:T.map((x,
|
|
381
|
+
`,children:[T==null?void 0:T.map((x,oe)=>{if(x!=null&&x.id)return(0,p.jsx)(Le.Draggable,{draggableId:x.id,index:oe,children:z=>(0,p.jsxs)("div",{css:dr,ref:z.innerRef,...z.draggableProps,...z.dragHandleProps,children:[(0,p.jsxs)("span",{css:lr,children:[(0,p.jsx)(Ue,{css:[nt,pr],width:24,height:24}),(0,p.jsx)(Ue,{css:nt,width:24,height:24})]}),(0,p.jsx)(Kr,{logoIcon:n,selectedItem:x,onDeselect:Te=>Fr(Te),onEditClosed:R?Te=>R(Te):void 0},`selected-item-${x.id}`)]})},x.id)}),c.placeholder]})})}):T==null?void 0:T.map(c=>(0,p.jsx)(Kr,{logoIcon:n,selectedItem:c,onDeselect:x=>Fr(x),onEditClosed:R?x=>R(x):void 0},`selected-item-${c.id}`))]})})};var se=require("@emotion/react"),ur=se.css`
|
|
382
382
|
cursor: pointer;
|
|
383
383
|
padding: var(--spacing-sm) 0;
|
|
384
384
|
margin-right: var(--spacing-sm);
|
|
385
385
|
position: relative;
|
|
386
386
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
387
387
|
color var(--duration-fast) var(--timing-ease-out);
|
|
388
|
-
`,
|
|
388
|
+
`,gr=se.css`
|
|
389
389
|
border: 2px solid transparent;
|
|
390
390
|
border-radius: var(--rounded-base);
|
|
391
391
|
display: flex;
|
|
392
392
|
align-items: center;
|
|
393
393
|
gap: var(--spacing-base);
|
|
394
394
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
395
|
-
`,
|
|
395
|
+
`,fr=se.css`
|
|
396
396
|
background-color: var(--green-50);
|
|
397
|
-
`,
|
|
397
|
+
`,vr=se.css`
|
|
398
398
|
font-size: var(--fs-sm);
|
|
399
399
|
font-weight: var(--fw-bold);
|
|
400
400
|
width: 50%;
|
|
401
|
-
`,
|
|
401
|
+
`,hr=se.css`
|
|
402
402
|
font-weight: var(--fw-normal);
|
|
403
403
|
display: block;
|
|
404
|
-
`,
|
|
404
|
+
`,yr=se.css`
|
|
405
405
|
font-size: var(--fs-sm);
|
|
406
406
|
> * {
|
|
407
407
|
display: block;
|
|
408
408
|
}
|
|
409
|
-
`,
|
|
409
|
+
`,br=se.css`
|
|
410
410
|
display: block;
|
|
411
411
|
height: 1.5rem;
|
|
412
412
|
width: 1.5rem;
|
|
413
413
|
color: var(--brand-secondary-3);
|
|
414
414
|
margin-left: auto;
|
|
415
|
-
`;var
|
|
415
|
+
`;var Sr=require("@emotion/react");var W=require("@emotion/react/jsx-runtime");function xr({result:e,isSelected:r,triggerSelection:o}){var h;let{categories:t,logoIcon:n}=Ae(),[a]=e.categories||[{id:"",name:""}],d=typeof a=="undefined"||!t||(h=t.find(v=>v.id===a.id))==null?void 0:h.name;return(0,W.jsx)("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[ur],children:(0,W.jsxs)("div",{css:[gr,r?fr:void 0],children:[e.thumbnailUrl?(0,W.jsx)("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:Sr.css`
|
|
416
416
|
background-color: var(--gray-200);
|
|
417
417
|
width: 3rem;
|
|
418
418
|
height: 3rem;
|
|
419
419
|
object-fit: cover;
|
|
420
|
-
`}):(0,
|
|
420
|
+
`}):(0,W.jsx)(X,{src:n,alt:"Logo",css:Sr.css`
|
|
421
421
|
height: 2.25rem;
|
|
422
422
|
width: 2.25rem;
|
|
423
|
-
`}),(0,
|
|
423
|
+
`}),(0,W.jsxs)("h4",{css:[vr],children:[e.title,d?(0,W.jsx)("span",{css:[hr],children:d}):null]}),(0,W.jsxs)("p",{css:[yr],children:["SKU: ",e.sku||e.id,e.price!==void 0?(0,W.jsx)("span",{children:e.price}):null]}),r?(0,W.jsx)(Xe,{css:[br]}):null]})},e.id)}var te=require("@emotion/react"),wr=require("@uniformdev/design-system"),Cr=te.css`
|
|
424
424
|
border: 1px solid var(--gray-200);
|
|
425
425
|
border-radius: var(--rounded-base);
|
|
426
426
|
background: var(--gray-50);
|
|
427
427
|
display: flex;
|
|
428
428
|
width: 100%;
|
|
429
|
-
`,
|
|
429
|
+
`,Pr=te.css`
|
|
430
430
|
align-items: center;
|
|
431
431
|
display: flex;
|
|
432
432
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -434,22 +434,22 @@
|
|
|
434
434
|
flex-grow: 1;
|
|
435
435
|
gap: var(--spacing-sm);
|
|
436
436
|
margin-inline: 0 var(--spacing-sm);
|
|
437
|
-
`,
|
|
437
|
+
`,Lr=te.css`
|
|
438
438
|
display: flex;
|
|
439
439
|
align-items: center;
|
|
440
440
|
gap: var(--spacing-sm);
|
|
441
441
|
flex-grow: 1;
|
|
442
442
|
|
|
443
|
-
${(0,
|
|
443
|
+
${(0,wr.mq)("lg")} {
|
|
444
444
|
width: 50%;
|
|
445
445
|
margin-bottom: 0;
|
|
446
446
|
}
|
|
447
|
-
`,it=
|
|
447
|
+
`,it=te.css`
|
|
448
448
|
background-color: var(--gray-200);
|
|
449
449
|
width: 3.5rem;
|
|
450
450
|
height: 3.5rem;
|
|
451
451
|
object-fit: cover;
|
|
452
|
-
`,st=
|
|
452
|
+
`,st=te.css`
|
|
453
453
|
align-items: center;
|
|
454
454
|
background: var(--white);
|
|
455
455
|
border-radius: var(--rounded-base);
|
|
@@ -464,50 +464,50 @@
|
|
|
464
464
|
&:hover {
|
|
465
465
|
background: var(--gray-50);
|
|
466
466
|
}
|
|
467
|
-
`,ct=
|
|
467
|
+
`,ct=te.css`
|
|
468
468
|
font-size: var(--fs-sm);
|
|
469
|
-
`,
|
|
469
|
+
`,Rr=te.css`
|
|
470
470
|
display: block;
|
|
471
471
|
width: 1rem;
|
|
472
472
|
height: 1rem;
|
|
473
|
-
`,
|
|
473
|
+
`,kr=te.css`
|
|
474
474
|
display: flex;
|
|
475
475
|
flex-direction: column;
|
|
476
476
|
gap: var(--spacing-sm);
|
|
477
477
|
|
|
478
|
-
${(0,
|
|
478
|
+
${(0,wr.mq)("md")} {
|
|
479
479
|
flex-direction: row;
|
|
480
480
|
min-width: 200px;
|
|
481
481
|
justify-content: end;
|
|
482
482
|
}
|
|
483
|
-
`;var
|
|
483
|
+
`;var ve=require("@emotion/react"),dt=require("@uniformdev/design-system"),To=require("react-icons/cg"),C=require("@emotion/react/jsx-runtime");function Ir({selectedItem:e,onDeselect:r}){var d;let{categories:o,logoIcon:t}=Ae(),[n]=e.categories||[{id:"",name:""}],a=typeof n=="undefined"||!o||(d=o.find(h=>h.id===n.id))==null?void 0:d.name;return(0,C.jsx)("div",{css:[Cr],children:(0,C.jsxs)("article",{css:[Pr],children:[(0,C.jsxs)("div",{css:[Lr],children:[e.thumbnailUrl?(0,C.jsx)("img",{src:e.thumbnailUrl,alt:a,css:[it],loading:"lazy"}):(0,C.jsx)("div",{css:[it]}),(0,C.jsxs)("div",{css:ve.css`
|
|
484
484
|
> :not(:last-child) {
|
|
485
485
|
margin-bottom: var(--spacing-xs);
|
|
486
486
|
}
|
|
487
|
-
`,children:[(0,
|
|
487
|
+
`,children:[(0,C.jsxs)("h4",{css:ve.css`
|
|
488
488
|
margin-top: 0px;
|
|
489
489
|
font-weight: var(--fw-bold);
|
|
490
|
-
`,children:[e.title||e.id||"",a&&(0,
|
|
490
|
+
`,children:[e.title||e.id||"",a&&(0,C.jsx)("span",{css:ve.css`
|
|
491
491
|
display: block;
|
|
492
492
|
font-weight: var(--fw-regular);
|
|
493
|
-
`,children:a})]}),(0,
|
|
493
|
+
`,children:a})]}),(0,C.jsxs)("ul",{css:ve.css`
|
|
494
494
|
font-size: var(--fs-sm);
|
|
495
495
|
|
|
496
496
|
${(0,dt.mq)("sm")} {
|
|
497
497
|
display: flex;
|
|
498
498
|
gap: var(--spacing-base);
|
|
499
499
|
}
|
|
500
|
-
`,children:[(0,
|
|
500
|
+
`,children:[(0,C.jsxs)("li",{children:[(0,C.jsx)("span",{css:ve.css`
|
|
501
501
|
margin-right: var(--spacing-xs);
|
|
502
|
-
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?(0,
|
|
502
|
+
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?(0,C.jsxs)("li",{children:[(0,C.jsx)("span",{css:ve.css`
|
|
503
503
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`,children:"Price:"}),(0,
|
|
504
|
+
`,children:"Price:"}),(0,C.jsx)("span",{children:e.price})]}):null]})]})]}),(0,C.jsxs)("div",{css:kr,children:[e.editLink?(0,C.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:st,children:[(0,C.jsx)("span",{css:ct,children:"Edit"}),(0,C.jsx)(X,{src:t,alt:"Logo",css:Rr})]}):null,(0,C.jsxs)("button",{type:"button",onClick:()=>{r==null||r(e)},css:st,children:[(0,C.jsx)("span",{css:ct,children:"Unlink"}),(0,C.jsx)(dt.Icon,{icon:To.CgClose,iconColor:"red",size:16})]})]})]})},e.id)}var Eo=require("@uniformdev/design-system"),lt=require("react-use"),Re=require("@emotion/react/jsx-runtime");function Sn({selectedProducts:e,setSelectedProducts:r,onGetCategories:o,onSearchProducts:t,logoIcon:n,multiSelect:a,multiSelectId:d,selectedItemComponent:h,rowComponent:v,errorComponent:S,helpComponent:i,noResultsComponent:m,onSort:w,typeSelectorAllTypesOptionText:H="All categories",typeSelectorLabel:Se="Select Category"}){var le,Z;let{value:R,loading:P,error:xe}=(0,lt.useAsync)(async()=>await o(),[o]),ke=R==null?void 0:R.map(D=>D.id).join(","),_=(0,ce.useMemo)(()=>R?R.map(g=>({id:g.id,name:g.name})):void 0,[ke]),re=(0,ce.useRef)(),[q,Ie]=(0,lt.useAsyncFn)(async(D,g)=>{let G=await t({text:D,options:{limit:g==null?void 0:g.count,offset:g==null?void 0:g.offset,categoryId:g==null?void 0:g.contentType,cursor:g==null?void 0:g.cursor}});return(g==null?void 0:g.offset)===0&&(re.current=[]),(re.current=re.current||[]).push(...G.products),G},[t]),Be=async D=>{await r(D)};return xe||q.error?(0,Re.jsx)(S||(({categoriesError:g,searchError:G})=>(0,Re.jsxs)(Eo.Callout,{type:"error",children:["There was an error: ",(g==null?void 0:g.message)||(G==null?void 0:G.message)]})),{categoriesError:xe,searchError:q.error}):(0,Re.jsx)(Tr.Provider,{value:{categories:R,logoIcon:n},children:(0,Re.jsx)(mr,{search:Ie,results:re.current,logoIcon:n,selectedItems:e,select:Be,multiSelectId:d||"product-search-multi-select",multiSelect:a,contentTypes:_,selectedItemComponent:h||Ir,rowComponent:v||xr,totalResults:(le=q.value)==null?void 0:le.total,cursor:(Z=q.value)==null?void 0:Z.cursor,resultsLoading:q.loading||P,helpComponent:i,noResultsComponent:m,onSort:w,typeSelectorAllTypesOptionText:H,typeSelectorLabel:Se})})}var Tr=ce.default.createContext(void 0),Ae=()=>{let e=(0,ce.useContext)(Tr);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};var V=require("@emotion/react"),Mo=require("@uniformdev/design-system"),Er=V.css`
|
|
505
505
|
border: 1px solid var(--gray-200);
|
|
506
506
|
background: var(--gray-50);
|
|
507
507
|
border-radius: var(--rounded-base);
|
|
508
508
|
display: flex;
|
|
509
509
|
width: 100%;
|
|
510
|
-
`,
|
|
510
|
+
`,Mr=V.css`
|
|
511
511
|
align-items: center;
|
|
512
512
|
display: flex;
|
|
513
513
|
flex-grow: 1;
|
|
@@ -515,23 +515,23 @@
|
|
|
515
515
|
margin-inline: 0 var(--spacing-sm);
|
|
516
516
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
517
517
|
position: relative;
|
|
518
|
-
`,
|
|
518
|
+
`,Vr=V.css`
|
|
519
519
|
flex-grow: 1;
|
|
520
|
-
`,
|
|
520
|
+
`,Dr=V.css`
|
|
521
521
|
align-items: center;
|
|
522
522
|
display: flex;
|
|
523
523
|
position: relative;
|
|
524
|
-
`,
|
|
524
|
+
`,zr=V.css`
|
|
525
525
|
color: var(--brand-secondary-1);
|
|
526
526
|
font-size: var(--fs-base);
|
|
527
527
|
font-weight: var(--fw-bold);
|
|
528
528
|
line-height: 1;
|
|
529
529
|
margin: 0;
|
|
530
530
|
word-break: break-word;
|
|
531
|
-
`,
|
|
531
|
+
`,Ur=V.css`
|
|
532
532
|
width: 1.5rem;
|
|
533
533
|
height: 1.5rem;
|
|
534
|
-
`,
|
|
534
|
+
`,Ar=V.css`
|
|
535
535
|
background: var(--white);
|
|
536
536
|
border-radius: var(--rounded-base);
|
|
537
537
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -540,17 +540,17 @@
|
|
|
540
540
|
padding: var(--spacing-base);
|
|
541
541
|
z-index: var(--z-10);
|
|
542
542
|
width: max-content;
|
|
543
|
-
`,
|
|
543
|
+
`,he=V.css`
|
|
544
544
|
font-size: var(--fs-sm);
|
|
545
|
-
`,
|
|
545
|
+
`,Ge=V.css`
|
|
546
546
|
font-weight: var(--fw-bold);
|
|
547
547
|
margin-right: var(--spacing-sm);
|
|
548
|
-
`,
|
|
548
|
+
`,Gr=V.css`
|
|
549
549
|
display: flex;
|
|
550
550
|
flex-direction: column;
|
|
551
551
|
gap: var(--spacing-sm);
|
|
552
552
|
|
|
553
|
-
${(0,
|
|
553
|
+
${(0,Mo.mq)("md")} {
|
|
554
554
|
flex-direction: row;
|
|
555
555
|
justify-content: end;
|
|
556
556
|
min-width: 200px;
|
|
@@ -570,11 +570,11 @@
|
|
|
570
570
|
&:hover {
|
|
571
571
|
background: var(--gray-50);
|
|
572
572
|
}
|
|
573
|
-
`,
|
|
573
|
+
`,Br=V.css`
|
|
574
574
|
display: flex;
|
|
575
575
|
margin-top: var(--spacing-sm);
|
|
576
576
|
gap: var(--spacing-sm);
|
|
577
|
-
`,
|
|
577
|
+
`,Or=V.css`
|
|
578
578
|
background: none;
|
|
579
579
|
outline: none;
|
|
580
580
|
border: none;
|
|
@@ -584,16 +584,16 @@
|
|
|
584
584
|
max-width: 100%;
|
|
585
585
|
min-width: 100px;
|
|
586
586
|
height: auto;
|
|
587
|
-
`;var
|
|
587
|
+
`;var be=require("react");var ut=require("react-icons/cg"),Vo=require("timeago.js");var ye=require("@emotion/react");var Hr=require("@uniformdev/design-system"),f=require("@emotion/react/jsx-runtime");function xn({selectedItem:e,onDeselect:r,onEditClosed:o,logoIcon:t,itemDetailsRendererComponent:n}){let a=(0,be.useRef)(null),d=(0,be.useRef)(null),[h,v]=(0,be.useState)(!1);(0,be.useEffect)(()=>{let m=H=>{a.current&&!a.current.contains(H.target)&&d.current&&!d.current.contains(H.target)&&v(!1)},w=()=>{v(!1)};return window.addEventListener("resize",w,!0),document.addEventListener("scroll",m,!0),document.addEventListener("mousedown",m),()=>{window.removeEventListener("resize",w,!0),document.removeEventListener("scroll",m,!0),document.removeEventListener("mousedown",m)}},[d]);let S=()=>{var m;if(v(!h),d.current&&a.current){let w=(m=a==null?void 0:a.current)==null?void 0:m.getBoundingClientRect();d.current.style.top=`${w.top+30}px`}},i=n!=null?n:wn;return(0,f.jsx)("div",{css:[Er,ye.css`
|
|
588
588
|
margin: 0 0 1rem 0;
|
|
589
|
-
`],children:(0,f.jsxs)("div",{css:
|
|
589
|
+
`],children:(0,f.jsxs)("div",{css:Mr,children:[(0,f.jsxs)("div",{css:Vr,children:[(0,f.jsxs)("div",{css:Dr,children:[(0,f.jsx)("h4",{css:[zr],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("button",{type:"button",ref:a,css:Or,"aria-controls":"path-details","aria-expanded":h,onClick:S,children:(0,f.jsx)(Hr.Icon,{icon:ut.CgInfo,iconColor:"gray",size:24,css:ye.css`
|
|
590
590
|
opacity: var(--opacity-75);
|
|
591
|
-
`})}),(0,f.jsx)("div",{id:"path-details","aria-hidden":!h,ref:d,css:[
|
|
591
|
+
`})}),(0,f.jsx)("div",{id:"path-details","aria-hidden":!h,ref:d,css:[Ar,h?ye.css`
|
|
592
592
|
visibility: visible;
|
|
593
|
-
`:
|
|
593
|
+
`:ye.css`
|
|
594
594
|
visibility: hidden;
|
|
595
|
-
`],children:Object.entries(e.popoverData).map(([m,w],H)=>(0,f.jsxs)("div",{css:
|
|
595
|
+
`],children:Object.entries(e.popoverData).map(([m,w],H)=>(0,f.jsxs)("div",{css:he,children:[(0,f.jsxs)("span",{css:Ge,children:[m,":"]}),w]},H))})]}):null]}),(0,f.jsx)(i,{item:e})]}),(0,f.jsxs)("div",{css:Gr,children:[e.editLink?typeof e.editLink=="string"?(0,f.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:m=>{o&&(je(m.currentTarget.href,()=>o(e)),m.preventDefault())},css:pt,children:[(0,f.jsx)("span",{css:he,children:"Edit"}),t?(0,f.jsx)(X,{src:t,css:Ur,alt:"Logo"}):null]}):e.editLink:null,(0,f.jsxs)("button",{type:"button",onClick:()=>{r(e)},css:pt,children:[(0,f.jsx)("span",{css:he,children:"Unlink"}),(0,f.jsx)(Hr.Icon,{icon:ut.CgClose,iconColor:"red",size:16})]})]})]})},e.id)}function wn({item:e}){let r=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?r=(0,f.jsx)("img",{src:e.previewUrl,alt:e.id,width:"200",css:mt}):e.type==="video"&&(r=(0,f.jsx)("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:mt})):e.previewUrl&&typeof e.previewUrl!="string"&&(r=e.previewUrl),r||e.metadata?(0,f.jsxs)("div",{css:Br,children:[r?(0,f.jsx)("div",{children:r}):null,(0,f.jsxs)("ul",{children:[e.metadata?Object.entries(e.metadata).map(([o,t])=>(0,f.jsxs)("li",{css:[he,ye.css`
|
|
596
596
|
order: 1;
|
|
597
|
-
`],children:[(0,f.jsxs)("span",{css:[
|
|
597
|
+
`],children:[(0,f.jsxs)("span",{css:[Ge,ye.css`
|
|
598
598
|
order: 1;
|
|
599
|
-
`],children:[o,":"]}),t]},o)):null,e.createdDate?(0,f.jsxs)("li",{css:
|
|
599
|
+
`],children:[o,":"]}),t]},o)):null,e.createdDate?(0,f.jsxs)("li",{css:he,children:[(0,f.jsx)("span",{css:Ge,children:"Date:"}),(0,Vo.format)(e.createdDate)]}):null]})]}):null}var gt=require("@uniformdev/design-system");var de=require("@emotion/react/jsx-runtime"),Cn=({children:e,loadingComponent:r,errorComponent:o})=>{let{initializing:t,error:n,sdk:a}=bt();if(t||!a){let d=r;return d?(0,de.jsx)(d,{}):(0,de.jsx)(gt.LoadingIndicator,{})}if(n){let d=o;if(d)return(0,de.jsx)(d,{error:n});throw n}return(0,de.jsxs)(Me.Provider,{value:{sdk:a},children:[(0,de.jsx)(gt.Theme,{}),(0,de.jsx)(Ve,{children:e})]})};F(O,require("@uniformdev/mesh-sdk"),module.exports);var u=require("@uniformdev/design-system");0&&(module.exports={AddListButton,Button,Callout,DamSelectedItem,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputSelect,InputToggle,KeywordSearchInput,Label,LoadingIndicator,LoadingOverlay,Menu,MenuItem,MeshApp,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Switch,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,badgeIcon,damSelectItemImage,damSelectedItemContainer,damSelectedItemCopy,damSelectedItemDetails,damSelectedItemIcon,damSelectedItemInfoBtn,damSelectedItemInner,damSelectedItemLinkBtn,damSelectedItemLinkContainer,damSelectedItemMediaContainer,damSelectedItemPopover,damSelectedItemPopoverLabel,damSelectedItemSmallText,damSelectedItemTitle,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemIcon,productSelectedItemImage,productSelectedItemLinkContainer,productedSelectedItemLinkBtn,productedSelectedItemSmallText,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowContainerWithPopover,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useMeshLocation,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enumerable:!0})};import{jsx as l}from"@emotion/react";import*as x from"react";import{createContext as Uo,useContext as Ao,useEffect as Go,useState as Bo}from"react";import{createContext as Mo,useContext as Vo}from"react";import{Theme as Do}from"@uniformdev/design-system";import{jsx as st,jsxs as zo}from"@emotion/react/jsx-runtime";var we=Mo(void 0),ha=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),zo(we.Provider,{value:r,children:[st(Do,{}),st(Ce,{children:e})]})},ct=()=>{let e=Vo(we);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function dt(){let{sdk:e}=ct();return e}import{jsx as Oo}from"@emotion/react/jsx-runtime";var lt=Uo(void 0),Ce=({children:e})=>{let r=dt(),[o,t]=Bo(r.getCurrentLocation()),n=a=>{t(d=>({...d,value:a.newValue}))};return Go(()=>(r.events.on("onValueChanged",n),()=>{r.events.off("onValueChanged",n)}),[r]),Oo(lt.Provider,{value:{location:o},children:e})},Pe=()=>{let e=Ao(lt);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function
|
|
1
|
+
var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enumerable:!0})};import{jsx as l}from"@emotion/react";import*as x from"react";import{createContext as Uo,useContext as Ao,useEffect as Go,useState as Bo}from"react";import{createContext as Mo,useContext as Vo}from"react";import{Theme as Do}from"@uniformdev/design-system";import{jsx as st,jsxs as zo}from"@emotion/react/jsx-runtime";var we=Mo(void 0),ha=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),zo(we.Provider,{value:r,children:[st(Do,{}),st(Ce,{children:e})]})},ct=()=>{let e=Vo(we);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function dt(){let{sdk:e}=ct();return e}import{jsx as Oo}from"@emotion/react/jsx-runtime";var lt=Uo(void 0),Ce=({children:e})=>{let r=dt(),[o,t]=Bo(r.getCurrentLocation()),n=a=>{t(d=>({...d,value:a.newValue}))};return Go(()=>(r.events.on("onValueChanged",n),()=>{r.events.off("onValueChanged",n)}),[r]),Oo(lt.Provider,{value:{location:o},children:e})},Pe=()=>{let e=Ao(lt);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Ma(){let{location:e}=Pe();return e}import{initializeUniformMeshSDK as Ho}from"@uniformdev/mesh-sdk";import{useEffect as $o,useRef as Fo,useState as pt}from"react";var mt=({autoResizingDisabled:e}={})=>{let[r,o]=pt(),[t,n]=pt(),a=Fo(!1);return $o(()=>{typeof window=="undefined"||t||(typeof window.UniformMeshSDK=="undefined"&&!a.current?(a.current=!0,Ho({autoResizingDisabled:e}).then(d=>{n(d)}).catch(d=>{o(d)}).finally(()=>{a.current=!1})):n(window.UniformMeshSDK))},[e]),{initializing:!t&&!r,error:r,sdk:t}};function Ha(e){let{location:r}=Pe();if(e&&r.type!==e)throw new Error(`Expected location type ${e} but got ${r.type}`);return r}import Xo,{useMemo as ke,useContext as qo}from"react";import{css as Ko}from"@emotion/react";import{Icon as No,InputSelect as Qo}from"@uniformdev/design-system";import{CgClose as Wo}from"react-icons/cg";import{Fragment as ut,jsxs as gt}from"@emotion/react/jsx-runtime";var ft=({value:e,text:r,loading:o})=>gt(ut,{children:[!!r&&r,!r&>(ut,{children:[o&&`${e} (Loading...)`,!o&&`${e} (Unresolvable)`]})]});import{css as Ge}from"@emotion/react";var vt=Ge`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -17,7 +17,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
18
|
`;import{jsx as fe,jsxs as bt}from"@emotion/react/jsx-runtime";var St=({id:e,label:r,loading:o,selectedValues:t,values:n,onAdd:a,onRemove:d})=>{var v;let f=(v=n==null?void 0:n.filter(i=>!(t!=null&&t.includes(i.id.toString()))))!=null?v:[],u=(i,p)=>{i.preventDefault(),d(p)};return bt("div",{children:[fe(Qo,{id:e,name:e,label:r,onChange:i=>a(i.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.map(i=>({value:i.id,label:i.name||i.id}))],value:"",css:Array.isArray(t)&&t.length>0?Ko`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),t==null?void 0:t.map(i=>{var p;return bt("div",{css:vt,children:[fe("span",{css:ht,children:fe(ft,{value:i,loading:o,text:(p=n.find(y=>y.id===i))==null?void 0:p.name})}),fe("button",{css:yt,title:"remove",onClick:y=>u(y,i),children:fe(No,{icon:Wo,iconColor:"currentColor",size:20})})]},i)})]})};import{jsx as xt}from"@emotion/react/jsx-runtime";var _o=e=>xt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:xt("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"})}),Le=_o;import{jsx as wt}from"@emotion/react/jsx-runtime";var Zo=e=>wt("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:wt("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Re=Zo;import{useAsyncFn as Yo,useDebounce as Jo}from"react-use";import{Input as Ct,InputSelect as Ie,mq as Te}from"@uniformdev/design-system";import{css as L}from"@emotion/react";import{jsx as w,jsxs as se}from"@emotion/react/jsx-runtime";var Pt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},
|
|
20
|
+
`:""}),t==null?void 0:t.map(i=>{var p;return bt("div",{css:vt,children:[fe("span",{css:ht,children:fe(ft,{value:i,loading:o,text:(p=n.find(y=>y.id===i))==null?void 0:p.name})}),fe("button",{css:yt,title:"remove",onClick:y=>u(y,i),children:fe(No,{icon:Wo,iconColor:"currentColor",size:20})})]},i)})]})};import{jsx as xt}from"@emotion/react/jsx-runtime";var _o=e=>xt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:xt("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"})}),Le=_o;import{jsx as wt}from"@emotion/react/jsx-runtime";var Zo=e=>wt("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",...e,children:wt("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Re=Zo;import{useAsyncFn as Yo,useDebounce as Jo}from"react-use";import{Input as Ct,InputSelect as Ie,mq as Te}from"@uniformdev/design-system";import{css as L}from"@emotion/react";import{jsx as w,jsxs as se}from"@emotion/react/jsx-runtime";var Pt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},bi=({value:e,setValue:r,brands:o,categories:t,loading:n,categoriesLoading:a,brandsLoading:d,logoIcon:f,onGetProducts:u,sortOptions:v,sortOrderOptions:i,categoryLabel:p="Product Category",brandLabel:y="Brand",disableBrands:D,restrictToSingleCategory:ae=!1})=>{var E,m,V;let S=async s=>{r({...Pt,...e||{},...s})},b=ke(()=>({...Pt,...e||{}}),[e]),[ie,me]=Yo(async s=>await u(s),[u]);Jo(async()=>{await me({brand:b.brand,categories:b.categories,keyword:b.keyword,sort:b.sort,sortOrder:b.sortOrder,count:b.count})},250,[b]);let O=ke(()=>{let s=[];return t==null||t.forEach(z=>{let C=Rt(z,void 0);s.push(...C)}),s},[t]),_=ke(()=>[{value:"",label:"All categories"},...O.map(s=>({label:s.name,value:s.id}))],[O]),W=ke(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),ue=s=>{if(!s)return;let z=(e==null?void 0:e.categories)||[];S({categories:[...z,s]})},Se=s=>{var z;S({categories:(z=e==null?void 0:e.categories)==null?void 0:z.filter(C=>C!==s)})},j=s=>{S({brand:s.target.value})},H=s=>{S({count:s||1})};return n?w("div",{children:"Loading..."}):w(kt.Provider,{value:{categories:t,logoIcon:f},children:se("div",{css:L`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
@@ -311,7 +311,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
311
311
|
& > :not(:last-child) {
|
|
312
312
|
border-bottom: 1px solid var(--gray-200);
|
|
313
313
|
}
|
|
314
|
-
`,
|
|
314
|
+
`,ic=P`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
317
|
`,Mr=P`
|
|
@@ -327,7 +327,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
327
327
|
height: 1.25rem;
|
|
328
328
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
329
329
|
transform: rotate(0);
|
|
330
|
-
`,
|
|
330
|
+
`,sc=P`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
333
|
`,Dr=P`
|
|
@@ -501,7 +501,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
501
501
|
margin-right: var(--spacing-xs);
|
|
502
502
|
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?Q("li",{children:[B("span",{css:de`
|
|
503
503
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`,children:"Price:"}),B("span",{children:e.price})]}):null]})]})]}),Q("div",{css:jr,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Xe,children:[B("span",{css:qe,children:"Edit"}),B($,{src:t,alt:"Logo",css:Jr})]}):null,Q("button",{type:"button",onClick:()=>{r==null||r(e)},css:Xe,children:[B("span",{css:qe,children:"Unlink"}),B($n,{icon:Kn,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as Zn}from"@uniformdev/design-system";import{useAsync as Xn,useAsyncFn as qn}from"react-use";import{jsx as Ye,jsxs as Yn}from"@emotion/react/jsx-runtime";function
|
|
504
|
+
`,children:"Price:"}),B("span",{children:e.price})]}):null]})]})]}),Q("div",{css:jr,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Xe,children:[B("span",{css:qe,children:"Edit"}),B($,{src:t,alt:"Logo",css:Jr})]}):null,Q("button",{type:"button",onClick:()=>{r==null||r(e)},css:Xe,children:[B("span",{css:qe,children:"Unlink"}),B($n,{icon:Kn,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as Zn}from"@uniformdev/design-system";import{useAsync as Xn,useAsyncFn as qn}from"react-use";import{jsx as Ye,jsxs as Yn}from"@emotion/react/jsx-runtime";function cd({selectedProducts:e,setSelectedProducts:r,onGetCategories:o,onSearchProducts:t,logoIcon:n,multiSelect:a,multiSelectId:d,selectedItemComponent:f,rowComponent:u,errorComponent:v,helpComponent:i,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:ae="Select Category"}){var j,H;let{value:S,loading:b,error:ie}=Xn(async()=>await o(),[o]),me=S==null?void 0:S.map(E=>E.id).join(","),O=Wn(()=>S?S.map(m=>({id:m.id,name:m.name})):void 0,[me]),_=_n(),[W,ue]=qn(async(E,m)=>{let V=await t({text:E,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType,cursor:m==null?void 0:m.cursor}});return(m==null?void 0:m.offset)===0&&(_.current=[]),(_.current=_.current||[]).push(...V.products),V},[t]),Se=async E=>{await r(E)};return ie||W.error?Ye(v||(({categoriesError:m,searchError:V})=>Yn(Zn,{type:"error",children:["There was an error: ",(m==null?void 0:m.message)||(V==null?void 0:V.message)]})),{categoriesError:ie,searchError:W.error}):Ye(to.Provider,{value:{categories:S,logoIcon:n},children:Ye(Br,{search:ue,results:_.current,logoIcon:n,selectedItems:e,select:Se,multiSelectId:d||"product-search-multi-select",multiSelect:a,contentTypes:O,selectedItemComponent:f||eo,rowComponent:u||_r,totalResults:(j=W.value)==null?void 0:j.total,cursor:(H=W.value)==null?void 0:H.cursor,resultsLoading:W.loading||b,helpComponent:i,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:D,typeSelectorLabel:ae})})}var to=Nn.createContext(void 0),ze=()=>{let e=Qn(to);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};import{css as k}from"@emotion/react";import{mq as Jn}from"@uniformdev/design-system";var ro=k`
|
|
505
505
|
border: 1px solid var(--gray-200);
|
|
506
506
|
background: var(--gray-50);
|
|
507
507
|
border-radius: var(--rounded-base);
|
|
@@ -584,7 +584,7 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
584
584
|
max-width: 100%;
|
|
585
585
|
min-width: 100px;
|
|
586
586
|
height: auto;
|
|
587
|
-
`;import{useState as jn,useRef as uo,useEffect as ea}from"react";import{CgInfo as ta,CgClose as ra}from"react-icons/cg";import{format as oa}from"timeago.js";import{css as pe}from"@emotion/react";import{Icon as go}from"@uniformdev/design-system";import{Fragment as aa,jsx as I,jsxs as T}from"@emotion/react/jsx-runtime";function
|
|
587
|
+
`;import{useState as jn,useRef as uo,useEffect as ea}from"react";import{CgInfo as ta,CgClose as ra}from"react-icons/cg";import{format as oa}from"timeago.js";import{css as pe}from"@emotion/react";import{Icon as go}from"@uniformdev/design-system";import{Fragment as aa,jsx as I,jsxs as T}from"@emotion/react/jsx-runtime";function Ld({selectedItem:e,onDeselect:r,onEditClosed:o,logoIcon:t,itemDetailsRendererComponent:n}){let a=uo(null),d=uo(null),[f,u]=jn(!1);ea(()=>{let p=D=>{a.current&&!a.current.contains(D.target)&&d.current&&!d.current.contains(D.target)&&u(!1)},y=()=>{u(!1)};return window.addEventListener("resize",y,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",y,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[d]);let v=()=>{var p;if(u(!f),d.current&&a.current){let y=(p=a==null?void 0:a.current)==null?void 0:p.getBoundingClientRect();d.current.style.top=`${y.top+30}px`}},i=n!=null?n:na;return I("div",{css:[ro,pe`
|
|
588
588
|
margin: 0 0 1rem 0;
|
|
589
589
|
`],children:T("div",{css:oo,children:[T("div",{css:no,children:[T("div",{css:ao,children:[I("h4",{css:[io],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?T(aa,{children:[I("button",{type:"button",ref:a,css:mo,"aria-controls":"path-details","aria-expanded":f,onClick:v,children:I(go,{icon:ta,iconColor:"gray",size:24,css:pe`
|
|
590
590
|
opacity: var(--opacity-75);
|
|
@@ -596,4 +596,4 @@ var To=Object.defineProperty;var Eo=(e,r)=>{for(var o in r)To(e,o,{get:r[o],enum
|
|
|
596
596
|
order: 1;
|
|
597
597
|
`],children:[T("span",{css:[Ue,pe`
|
|
598
598
|
order: 1;
|
|
599
|
-
`],children:[o,":"]}),t]},o)):null,e.createdDate?T("li",{css:le,children:[I("span",{css:Ue,children:"Date:"}),oa(e.createdDate)]}):null]})]}):null}import{LoadingIndicator as ia,Theme as sa}from"@uniformdev/design-system";import{jsx as be,jsxs as ca}from"@emotion/react/jsx-runtime";var
|
|
599
|
+
`],children:[o,":"]}),t]},o)):null,e.createdDate?T("li",{css:le,children:[I("span",{css:Ue,children:"Date:"}),oa(e.createdDate)]}):null]})]}):null}import{LoadingIndicator as ia,Theme as sa}from"@uniformdev/design-system";import{jsx as be,jsxs as ca}from"@emotion/react/jsx-runtime";var Dd=({children:e,loadingComponent:r,errorComponent:o})=>{let{initializing:t,error:n,sdk:a}=mt();if(t||!a){let d=r;return d?be(d,{}):be(ia,{})}if(n){let d=o;if(d)return be(d,{error:n});throw n}return ca(we.Provider,{value:{sdk:a},children:[be(sa,{}),be(Ce,{children:e})]})};export*from"@uniformdev/mesh-sdk";import{Button as Wd,Callout as _d,LoadingIndicator as Zd,LoadingOverlay as Xd,Menu as qd,MenuItem as Yd,Input as Jd,InputSelect as jd,InputToggle as el,Theme as tl,InputKeywordSearch as rl,Heading as ol,ScrollableList as nl,ScrollableListItem as al,Textarea as il,Switch as sl,Label as cl,AddListButton as dl}from"@uniformdev/design-system";export{dl as AddListButton,Wd as Button,_d as Callout,Ld as DamSelectedItem,Pr as DefaultSearchRow,fr as DefaultSelectedItem,Br as EntrySearch,ol as Heading,He as Icons,Jd as Input,jd as InputSelect,el as InputToggle,rl as KeywordSearchInput,cl as Label,Zd as LoadingIndicator,Xd as LoadingOverlay,qd as Menu,Yd as MenuItem,Dd as MeshApp,Tt as ProductPreviewList,bi as ProductQuery,kt as ProductQueryContext,cd as ProductSearch,to as ProductSearchContext,_r as ProductSearchRow,eo as ProductSelectedItem,ft as ResolvableLoadingValue,nl as ScrollableList,al as ScrollableListItem,St as SelectionField,sl as Switch,il as Textarea,tl as Theme,lt as UniformMeshLocationContext,Ce as UniformMeshLocationContextProvider,we as UniformMeshSdkContext,ha as UniformMeshSdkContextProvider,Qe as badgeIcon,je as damSelectItemImage,ro as damSelectedItemContainer,ao as damSelectedItemCopy,no as damSelectedItemDetails,so as damSelectedItemIcon,mo as damSelectedItemInfoBtn,oo as damSelectedItemInner,Je as damSelectedItemLinkBtn,lo as damSelectedItemLinkContainer,po as damSelectedItemMediaContainer,co as damSelectedItemPopover,Ue as damSelectedItemPopoverLabel,le as damSelectedItemSmallText,io as damSelectedItemTitle,Dr as draggableContainer,Ne as draggableIcon,Ur as draggableIconOffset,zr as draggableIconWrapper,Rr as entrySearchBtn,Ir as entrySearchConfig,Tr as entrySearchConfigHidden,kr as entrySearchLoadMoreBtn,Er as entrySearchResultList,Mr as entrySearchSelectIcon,Vr as entrySearchSelectImg,ic as entrySearchSelectInput,sc as entrySearchSelectOption,Lr as entrySearchWrapper,Qr as productSearchRowActiveIcon,Kr as productSearchRowCategory,Or as productSearchRowContainer,Hr as productSearchRowContent,$r as productSearchRowContentActive,Nr as productSearchRowDetails,Fr as productSearchRowTitle,Xr as productSelectedItemContainer,Yr as productSelectedItemContent,qr as productSelectedItemDetails,Jr as productSelectedItemIcon,Ze as productSelectedItemImage,jr as productSelectedItemLinkContainer,Xe as productedSelectedItemLinkBtn,qe as productedSelectedItemSmallText,Sr as searchRowBtn,vr as searchRowContainer,yr as searchRowContainerActive,hr as searchRowContainerWithPopover,br as searchRowPopover,Ke as searchRowText,Fe as searchRowTextSmall,$e as selectItemLinkBtn,mr as selectItemLinkContainer,pr as selectItemPopover,ye as selectItemPopoverLabel,te as selectItemSmallText,ar as selectedItemContainer,cr as selectedItemCopy,sr as selectedItemDetails,lr as selectedItemIcon,ir as selectedItemInner,dr as selectedItemTitle,mt as useInitializeUniformMeshSdk,Ha as useMeshLocation,It as useProductQueryContext,ze as useProductSearchContext,Ma as useUniformMeshLocation,Pe as useUniformMeshLocationContext,dt as useUniformMeshSdk,ct as useUniformMeshSdkContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.1-alpha.117+8812fbe6b",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"storybook:publish": "pnpm build && pnpm build-storybook -o ./out"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@uniformdev/design-system": "^17.
|
|
48
|
-
"@uniformdev/mesh-sdk": "^17.
|
|
47
|
+
"@uniformdev/design-system": "^17.3.1-alpha.117+8812fbe6b",
|
|
48
|
+
"@uniformdev/mesh-sdk": "^17.3.1-alpha.117+8812fbe6b",
|
|
49
49
|
"react-beautiful-dnd": "13.1.1",
|
|
50
50
|
"react-icons": "4.4.0",
|
|
51
51
|
"react-use": "17.4.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"react-dom": ">=16.8"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "7.
|
|
62
|
-
"@babel/preset-env": "7.
|
|
61
|
+
"@babel/core": "7.19.3",
|
|
62
|
+
"@babel/preset-env": "7.19.4",
|
|
63
63
|
"@babel/preset-react": "7.18.6",
|
|
64
64
|
"@babel/preset-typescript": "7.18.6",
|
|
65
65
|
"@emotion/babel-preset-css-prop": "11.10.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@storybook/addon-essentials": "6.5.12",
|
|
69
69
|
"@storybook/addon-postcss": "2.0.0",
|
|
70
70
|
"@storybook/react": "6.5.12",
|
|
71
|
-
"@svgr/cli": "6.
|
|
71
|
+
"@svgr/cli": "6.5.0",
|
|
72
72
|
"@types/react": "18.0.21",
|
|
73
73
|
"@types/react-beautiful-dnd": "13.1.2",
|
|
74
74
|
"@types/uuid": "8.3.4",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "8812fbe6b2d14f5b53cd9163b163fdd18bb76799"
|
|
86
86
|
}
|