@uniformdev/mesh-sdk-react 16.2.1-alpha.60 → 16.2.1-nuxt.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +29 -29
- package/dist/index.js +30 -30
- package/dist/index.mjs +29 -29
- package/package.json +9 -9
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as y from"react";import{createContext as Nr,useContext as Qr,useState as Wr}from"react";var Be=Nr(void 0),Oe=({children:t})=>{let[n,o]=Wr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return e(Be.Provider,{value:r},t)},He=()=>{let t=Qr(Be);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function
|
|
1
|
+
var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as y from"react";import{createContext as Nr,useContext as Qr,useState as Wr}from"react";var Be=Nr(void 0),Oe=({children:t})=>{let[n,o]=Wr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return e(Be.Provider,{value:r},t)},He=()=>{let t=Qr(Be);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function wn(){let{location:t}=He();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}import{initializeUniformMeshSDK as _r}from"@uniformdev/mesh-sdk";import{useEffect as Zr,useRef as Xr,useState as Fe}from"react";var xn=({autoResizingDisabled:t}={})=>{let[n,o]=Fe(),[r,a]=Fe(),i=Xr(!1);return Zr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"&&!i.current?(i.current=!0,_r({autoResizingDisabled:t}).then(l=>{a(l)}).catch(l=>{o(l)}).finally(()=>{i.current=!1})):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as qr,useContext as Yr}from"react";import{Theme as Jr}from"@uniformdev/design-system";var $e=qr(void 0),Vn=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e($e.Provider,{value:n},e(Jr,null),e(Oe,null,t))},Ke=()=>{let t=Yr($e);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Un(){let{sdk:t}=Ke();return t}import ao,{useMemo as se,useContext as io}from"react";import{css as jr}from"@emotion/react";import{Icon as eo,InputSelect as to}from"@uniformdev/design-system";import{CgClose as ro}from"react-icons/cg";import Ne from"react";var Qe=({value:t,text:n,loading:o})=>e(Ne.Fragment,null,!!n&&n,!n&&e(Ne.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));import{css as he}from"@emotion/react";var We=he`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -15,9 +15,9 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
15
15
|
border-left: 1px solid var(--gray-300);
|
|
16
16
|
background: var(--gray-100);
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
|
-
`;var Xe=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:i,onRemove:l})=>{var f;let g=(f=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?f:[],u=(s,p)=>{s.preventDefault(),l(p)};return e("div",null,e(
|
|
18
|
+
`;var Xe=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:i,onRemove:l})=>{var f;let g=(f=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?f:[],u=(s,p)=>{s.preventDefault(),l(p)};return e("div",null,e(to,{id:t,name:t,label:n,onChange:s=>i(s.target.value),disabled:o,options:[{value:"",label:"Add..."},...g.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(r)&&r.length>0?jr`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),r==null?void 0:r.map(s=>{var p;return e("div",{css:We,key:s},e("span",{css:_e},e(Qe,{value:s,loading:o,text:(p=a.find(h=>h.id===s))==null?void 0:p.name})),e("button",{css:Ze,title:"remove",onClick:h=>u(h,s)},e(
|
|
20
|
+
`:""}),r==null?void 0:r.map(s=>{var p;return e("div",{css:We,key:s},e("span",{css:_e},e(Qe,{value:s,loading:o,text:(p=a.find(h=>h.id===s))==null?void 0:p.name})),e("button",{css:Ze,title:"remove",onClick:h=>u(h,s)},e(eo,{icon:ro,iconColor:"currentColor",size:20})))}))};var oo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ae=oo;var no=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),ie=no;import{useAsyncFn as so,useDebounce as co}from"react-use";import{Input as qe,InputSelect as ce,mq as de}from"@uniformdev/design-system";import{css as P}from"@emotion/react";var Ye={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},aa=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:g,onGetProducts:u,sortOptions:f,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:h="Brand",disableBrands:E,restrictToSingleCategory:_=!1})=>{var R,m,I;let S=async c=>{n({...Ye,...t||{},...c})},b=se(()=>({...Ye,...t||{}}),[t]),[Z,J]=so(async c=>await u(c),[u]);co(async()=>{await J({brand:b.brand,categories:b.categories,keyword:b.keyword,sort:b.sort,sortOrder:b.sortOrder,count:b.count})},250,[b]);let V=se(()=>{let c=[];return r==null||r.forEach(T=>{let w=je(T,void 0);c.push(...w)}),c},[r]),B=se(()=>[{value:"",label:"All categories"},...V.map(c=>({label:c.name,value:c.id}))],[V]),A=se(()=>(o==null?void 0:o.map(c=>({id:c.id.toString(),name:c.name})))||[],[o]),j=c=>{if(!c)return;let T=(t==null?void 0:t.categories)||[];S({categories:[...T,c]})},oe=c=>{var T;S({categories:(T=t==null?void 0:t.categories)==null?void 0:T.filter(w=>w!==c)})},$=c=>{S({brand:c.target.value})},D=c=>{S({count:c||1})};return a?e("div",null,"Loading..."):e(et.Provider,{value:{categories:r,logoIcon:g}},e("div",{css:P`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
@@ -88,7 +88,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
88
88
|
`}):e(ie,{css:P`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`}))}var et=
|
|
91
|
+
`}))}var et=ao.createContext(void 0),tt=()=>{let t=io(et);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function z({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?e(r,{className:o}):e("img",{src:t,alt:n,className:o})}import{css as mt}from"@emotion/react";import{scrollbarStyles as lo}from"@uniformdev/design-system";import{css as U}from"@emotion/react";var ot=U`
|
|
92
92
|
align-items: center;
|
|
93
93
|
background: var(--white);
|
|
94
94
|
border-radius: var(--rounded-base);
|
|
@@ -145,7 +145,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
145
145
|
`},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[mt`
|
|
146
146
|
max-height: 24rem;
|
|
147
147
|
overflow-x: auto;
|
|
148
|
-
`,
|
|
148
|
+
`,lo]},t==null?void 0:t.map((r,a)=>{var g,u;let[i]=(r==null?void 0:r.categories)||[],l=typeof i=="undefined"||!n||(g=n.find(f=>f.id===i.id))==null?void 0:g.name;return e("li",{key:`product-${r.id}`,css:it},e("div",{css:st},r.thumbnailUrl?e("img",{src:r.thumbnailUrl,alt:typeof r.title=="string"?r.title:r.name||`Product ${a}`,css:ct}):e("div",{css:dt}),e("h4",{css:lt},r.title||r.name,l&&e("span",{css:pt},l)),r&&e(y.Fragment,null,e("p",{css:be},"SKU: ",r.sku||r.id,e("br",null)),r.price!==void 0?e("p",{css:be},"Price: ",r.price):null,r.editLink||r.url?e("a",{css:ot,href:(u=r.editLink)!=null?u:r.url,title:`Go to ${r.title||r.name}`,target:"_blank",rel:"noopener noreferrer"},e("span",{css:nt},"Edit"),o?e(z,{src:o,alt:"Logo",css:at}):null):null)))})))};import Yo,{useContext as Jo,useMemo as jo,useRef as en}from"react";import*as k from"react";var ye={};Kr(ye,{Caution:()=>ut,Checkmark:()=>le,ChevronDown:()=>pe,Close:()=>gt,Danger:()=>ft,ExclamationPoint:()=>vt,Info:()=>me,Lightbulb:()=>ht,MagnifyingGlass:()=>bt,MaximizeAlt:()=>yt,Minus:()=>ie,MoreVerticalAlt:()=>te,Plus:()=>ae});var po=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),ut=po;var mo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),le=mo;var uo=t=>e("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},e("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),pe=uo;var go=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},e("g",{fillRule:"evenodd"},e("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),e("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),gt=go;var fo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),ft=fo;var vo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),vt=vo;var ho=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),e("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),me=ho;var bo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),ht=bo;var yo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),e("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),bt=yo;var So=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),yt=So;var wo=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),te=wo;import{useThrottle as zo}from"react-use";import{v4 as Uo}from"uuid";import Po,{useState as Lo,useRef as It,useEffect as Ro}from"react";function ue(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as xo}from"timeago.js";import{css as M}from"@emotion/react";import{mq as Co}from"@uniformdev/design-system";var St=M`
|
|
149
149
|
border: 1px solid var(--gray-200);
|
|
150
150
|
background: var(--gray-50);
|
|
151
151
|
border-radius: var(--rounded-base);
|
|
@@ -193,7 +193,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
gap: var(--spacing-sm);
|
|
195
195
|
|
|
196
|
-
${
|
|
196
|
+
${Co("md")} {
|
|
197
197
|
flex-direction: row;
|
|
198
198
|
min-width: 200px;
|
|
199
199
|
justify-content: end;
|
|
@@ -213,23 +213,23 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
213
213
|
&:hover {
|
|
214
214
|
background: var(--gray-50);
|
|
215
215
|
}
|
|
216
|
-
`;import{css as H}from"@emotion/react";import{Icon as Et}from"@uniformdev/design-system";import{CgClose as
|
|
216
|
+
`;import{css as H}from"@emotion/react";import{Icon as Et}from"@uniformdev/design-system";import{CgClose as ko,CgInfo as Io}from"react-icons/cg";var Tt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var f;let a=It(null),i=It(null),[l,g]=Lo(!1);Ro(()=>{let s=h=>{a.current&&!a.current.contains(h.target)&&i.current&&!i.current.contains(h.target)&&g(!1)},p=()=>{g(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[i]);let u=()=>{var s;if(g(!l),i.current&&a.current){let p=(s=a==null?void 0:a.current)==null?void 0:s.getBoundingClientRect(),h=i.current.offsetWidth;i.current.style.top=`${p.top+30}px`,i.current.style.left=`${p.left-h+30}px`}};return e("div",{css:St,key:t.id},e("div",{css:wt},e("div",{css:Ct},e("div",{css:Pt},e("h4",{css:[Lt,t.popoverData?H`
|
|
217
217
|
margin-bottom: var(--spacing-sm);
|
|
218
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(
|
|
218
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(Po.Fragment,null,e("button",{type:"button",ref:a,css:H`
|
|
219
219
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
220
|
-
`,"aria-controls":"path-details","aria-expanded":l,onClick:u},e(Et,{icon:
|
|
220
|
+
`,"aria-controls":"path-details","aria-expanded":l,onClick:u},e(Et,{icon:Io,iconColor:"gray",size:24,css:H`
|
|
221
221
|
opacity: var(--opacity-75);
|
|
222
222
|
`})),e("div",{id:"path-details","aria-hidden":!l,ref:i,css:[xt,l?H`
|
|
223
223
|
visibility: visible;
|
|
224
224
|
`:H`
|
|
225
225
|
visibility: hidden;
|
|
226
|
-
`]},Object.entries(t.popoverData).map(([s,p],h)=>e("div",{css:N,key:h},e("span",{css:re},s,":"),p)))):null),t.createdDate&&e("div",{css:N},e("span",{css:re},"Created:"),
|
|
226
|
+
`]},Object.entries(t.popoverData).map(([s,p],h)=>e("div",{css:N,key:h},e("span",{css:re},s,":"),p)))):null),t.createdDate&&e("div",{css:N},e("span",{css:re},"Created:"),xo((f=t.createdDate)!=null?f:0)),t.metadata?Object.entries(t.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>e("div",{css:[N,H`
|
|
227
227
|
order: 1;
|
|
228
228
|
`],key:s},e("span",{css:re},s,":"),p)):null,t.metadata?Object.entries(t.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>e("div",{css:[N,H`
|
|
229
229
|
order: 1;
|
|
230
230
|
`],key:s},e("span",{css:[re,H`
|
|
231
231
|
order: 1;
|
|
232
|
-
`]},s,":"),p)):null),e("div",{css:kt},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(ue(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:Se},e("span",{css:N},"Edit"),e(z,{src:n,css:Rt,alt:"Logo"})):null,e("button",{type:"button",onClick:()=>{o(t)},css:Se},e("span",{css:N},"Unlink"),e(Et,{icon:
|
|
232
|
+
`]},s,":"),p)):null),e("div",{css:kt},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(ue(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:Se},e("span",{css:N},"Edit"),e(z,{src:n,css:Rt,alt:"Logo"})):null,e("button",{type:"button",onClick:()=>{o(t)},css:Se},e("span",{css:N},"Unlink"),e(Et,{icon:ko,iconColor:"red",size:16})))))};import Eo,{useState as To,useRef as Gt,useEffect as Mo}from"react";import{css as Q}from"@emotion/react";var Mt=Q`
|
|
233
233
|
cursor: pointer;
|
|
234
234
|
padding: var(--spacing-sm);
|
|
235
235
|
position: relative;
|
|
@@ -260,11 +260,11 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
260
260
|
`,Ut=Q`
|
|
261
261
|
position: absolute;
|
|
262
262
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
263
|
-
`;import{css as At}from"@emotion/react";var Bt=({result:t,isSelected:n,triggerSelection:o})=>{let r=Gt(null),a=Gt(null),[i,l]=
|
|
263
|
+
`;import{css as At}from"@emotion/react";var Bt=({result:t,isSelected:n,triggerSelection:o})=>{let r=Gt(null),a=Gt(null),[i,l]=To(!1);Mo(()=>{function u(f){r.current&&!r.current.contains(f.target)&&a.current&&!a.current.contains(f.target)&&l(!1)}return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]);let g=u=>{u.stopPropagation(),l(!i)};return e("div",{key:t.id,css:[Mt,n?Dt:void 0,t.popoverData?Vt:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(Eo.Fragment,null,e("button",{type:"button",ref:r,css:Ut,"aria-controls":"path-details",onClick:u=>g(u),"aria-expanded":i},e(me,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!i,ref:a,css:[zt,i?At`
|
|
264
264
|
visibility: visible;
|
|
265
265
|
`:At`
|
|
266
266
|
visibility: hidden;
|
|
267
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)),Object.entries(t.popoverData).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)))):null)};import{Droppable as
|
|
267
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)),Object.entries(t.popoverData).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)))):null)};import{Droppable as Go,DragDropContext as Ao,Draggable as Bo}from"react-beautiful-dnd";import{css as C}from"@emotion/react";var Ot=C`
|
|
268
268
|
background: var(--white);
|
|
269
269
|
border: 1px solid var(--gray-300);
|
|
270
270
|
border-radius: var(--rounded-base);
|
|
@@ -311,7 +311,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
311
311
|
& > :not(:last-child) {
|
|
312
312
|
border-bottom: 1px solid var(--gray-200);
|
|
313
313
|
}
|
|
314
|
-
`,
|
|
314
|
+
`,si=C`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
317
|
`,Qt=C`
|
|
@@ -327,7 +327,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[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
|
+
`,ci=C`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
333
|
`,_t=C`
|
|
@@ -352,7 +352,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
352
352
|
`,Le=C`
|
|
353
353
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
354
354
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
355
|
-
`;import{css as G}from"@emotion/react";import{InputSelect as
|
|
355
|
+
`;import{css as G}from"@emotion/react";import{InputSelect as Oo,scrollbarStyles as Ho,Button as Re,Callout as Fo,InputKeywordSearch as $o,LoadingIndicator as Ko,Menu as No,MenuItem as Qo,LoadingOverlay as Wo}from"@uniformdev/design-system";import{useState as Vo,useEffect as qt,useRef as Do}from"react";function Yt(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,a]=Vo("IDLE"),i=Do(void 0);return qt(()=>{t&&r==="IDLE"&&(clearTimeout(i.current),i.current=setTimeout(()=>{if(!t)return a("IDLE");i.current=setTimeout(()=>{a("EXPIRE")},o),a("DISPLAY")},n),a("DELAY")),!t&&r!=="DISPLAY"&&(clearTimeout(i.current),a("IDLE"))},[t,r,n,o]),qt(()=>()=>clearTimeout(i.current),[]),r==="DISPLAY"||r==="EXPIRE"}var _o=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&n!=="any"&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Fo,{type:"info"},o)},Jt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:i,multiSelect:l,multiSelectId:g,rowComponent:u,selectedItemComponent:f,totalResults:s,cursor:p,resultsLoading:h,requireContentType:E,onAddNew:_,onEditClosed:S,onCancel:b,noResultsComponent:Z,helpComponent:J,onSort:V,typeSelectorLabel:B="Content Type Select",typeSelectorAllTypesOptionText:A="All content types",loadingIndicatorDelay:j=1e3})=>{var Ue,Ge,Ae;let $=()=>E?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[D,R]=k.useState(""),[m,I]=k.useState($),[c,T]=k.useState(!1),[w,K]=k.useState([]),[Ir,Me]=k.useState(!1),ve=k.useRef(`x${Uo()}`),ne=zo(D,750);k.useEffect(()=>{t(ne,{count:5,offset:0,contentType:m==="any"?void 0:m})},[ne,m]);let Er=Yt(h,{delay:j}),Tr=d=>{w.some(v=>v.id===d.id)?K(v=>v.filter(O=>O.id!==d.id)):K(l?v=>[...v,d]:[d])},Mr=r==null?void 0:r.map(d=>d.id+d.title).join(",");k.useEffect(()=>{Array.isArray(r)&&K(r)},[Mr]);let Vr=()=>{I($()),R(""),K(r!=null&&r.length?r:[])},Dr=()=>{T(d=>!d),c||Vr()},Ve=d=>{let v=(w==null?void 0:w.filter(O=>O.id!==d.id))||[];K(v),i(v,"")},zr=d=>{d.preventDefault(),i(w,m),T(!1)},Ur=d=>{d.preventDefault(),T(!1),b&&b()},Gr=()=>{t(ne,{count:5,offset:(n==null?void 0:n.length)||0,contentType:m==="any"?void 0:m,cursor:p}),Me(!0);let d=setTimeout(()=>{Me(!1)},750);return()=>clearTimeout(d)},Ar=!(r==null?void 0:r.length)||l,Br=u||Bt,De=f||Tt,Or=Z||_o,ze=a&&typeof a!="string"?a:null,Hr=ze?e(ze,{css:Le}):e("img",{src:a,alt:"Logo",css:Le}),Fr=d=>{var v,O;if(d.destination&&d.source.droppableId===((v=d.destination)==null?void 0:v.droppableId)){let x=[...r||[]],[ee]=(O=x==null?void 0:x.splice(d.source.index,1))!=null?O:[];return x==null||x.splice(d.destination.index,0,ee),V&&(K(x),V==null||V(x)),x}};return e("div",{css:G`
|
|
356
356
|
width: 100%;
|
|
357
357
|
`},e("div",{css:G`
|
|
358
358
|
position: relative;
|
|
@@ -365,20 +365,20 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
365
365
|
display: flex;
|
|
366
366
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
367
367
|
margin-bottom: var(--spacing-base);
|
|
368
|
-
`},e(
|
|
368
|
+
`},e(Oo,{onChange:d=>I(d.target.value),value:m,label:B,showLabel:!1,options:[...E?[]:[{value:"any",label:A}],...o?o.map(d=>({value:d.id,label:d.name})):[]]}),e("div",{css:G`
|
|
369
369
|
flex-grow: 1;
|
|
370
|
-
`},e(
|
|
370
|
+
`},e($o,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:R,disabledFieldSubmission:!0,value:D}))),e("div",{css:[Nt,Ho],id:ve.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},e(Wo,{isActive:Er}),Array.isArray(n)&&n.length>0?n.map(d=>e(Br,{key:d.id,isSelected:w.some(v=>v.id===d.id),result:d,triggerSelection:()=>Tr(d)})):e(Or,{searchText:ne||D,selectedContentType:(Ge=(Ue=o==null?void 0:o.find(d=>d.id===m))==null?void 0:Ue.name)!=null?Ge:m}),!h&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{type:"button",css:Ft,onClick:Gr},Ir?e(Ko,null):"Load More")),e("div",{css:G`
|
|
371
371
|
display: flex;
|
|
372
372
|
justify-content: space-between;
|
|
373
|
-
`},e("div",null,_&&((Ae=o==null?void 0:o.length)!=null?Ae:0)>0?e(
|
|
373
|
+
`},e("div",null,_&&((Ae=o==null?void 0:o.length)!=null?Ae:0)>0?e(No,{menuLabel:"Add new menu",menuTrigger:e(Re,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(d=>e(Qo,{key:d.id,css:G`
|
|
374
374
|
background: var(--white);
|
|
375
375
|
color: var(--brand-secondary-1);
|
|
376
376
|
`,onClick:()=>_(d)},d.name))):null),e("div",{css:G`
|
|
377
377
|
display: flex;
|
|
378
378
|
gap: var(--spacing-base);
|
|
379
|
-
`},e(Re,{buttonType:"unimportant",onClick:Ur},"Cancel"),e(Re,{disabled:!w.length,onClick:zr,"data-test-id":"entry-accept-button"},"Accept"))))):null,c?null:l&&w.length>1?e(
|
|
379
|
+
`},e(Re,{buttonType:"unimportant",onClick:Ur},"Cancel"),e(Re,{disabled:!w.length,onClick:zr,"data-test-id":"entry-accept-button"},"Accept"))))):null,c?null:l&&w.length>1?e(Ao,{onDragEnd:d=>Fr(d)},e(Go,{droppableId:g||"canvas-multi-select"},d=>e("div",{...d.droppableProps,ref:d.innerRef,css:G`
|
|
380
380
|
margin-block: var(--spacing-sm) 0;
|
|
381
|
-
`},w==null?void 0:w.map((v,O)=>{if(v!=null&&v.id)return e(
|
|
381
|
+
`},w==null?void 0:w.map((v,O)=>{if(v!=null&&v.id)return e(Bo,{key:v.id,draggableId:v.id,index:O},x=>e("div",{css:_t,ref:x.innerRef,...x.draggableProps,...x.dragHandleProps},e("span",{css:Zt},e(te,{css:[Pe,Xt],width:24,height:24}),e(te,{css:Pe,width:24,height:24})),e(De,{key:`selected-item-${v.id}`,logoIcon:a,selectedItem:v,onDeselect:ee=>Ve(ee),onEditClosed:S?ee=>S(ee):void 0})))}),d.placeholder))):w==null?void 0:w.map(d=>e(De,{key:`selected-item-${d.id}`,logoIcon:a,selectedItem:d,onDeselect:v=>Ve(v),onEditClosed:S?v=>S(v):void 0}))))};import{css as W}from"@emotion/react";var jt=W`
|
|
382
382
|
cursor: pointer;
|
|
383
383
|
padding: var(--spacing-sm) 0;
|
|
384
384
|
margin-right: var(--spacing-sm);
|
|
@@ -480,7 +480,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
480
480
|
min-width: 200px;
|
|
481
481
|
justify-content: end;
|
|
482
482
|
}
|
|
483
|
-
`;import{css as X}from"@emotion/react";import{Icon as
|
|
483
|
+
`;import{css as X}from"@emotion/react";import{Icon as Zo,mq as Xo}from"@uniformdev/design-system";import{CgClose as qo}from"react-icons/cg";function gr({selectedItem:t,onDeselect:n}){var l;let{categories:o,logoIcon:r}=ge(),[a]=t.categories||[{id:"",name:""}],i=typeof a=="undefined"||!o||(l=o.find(g=>g.id===a.id))==null?void 0:l.name;return e("div",{css:[dr],key:t.id},e("article",{css:[lr]},e("div",{css:[pr]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:i,css:[xe],loading:"lazy"}):e("div",{css:[xe]}),e("div",{css:X`
|
|
484
484
|
> :not(:last-child) {
|
|
485
485
|
margin-bottom: var(--spacing-xs);
|
|
486
486
|
}
|
|
@@ -493,7 +493,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
493
493
|
`},i)),e("ul",{css:X`
|
|
494
494
|
font-size: var(--fs-sm);
|
|
495
495
|
|
|
496
|
-
${
|
|
496
|
+
${Xo("sm")} {
|
|
497
497
|
display: flex;
|
|
498
498
|
gap: var(--spacing-base);
|
|
499
499
|
}
|
|
@@ -501,7 +501,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
501
501
|
margin-right: var(--spacing-xs);
|
|
502
502
|
`},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:X`
|
|
503
503
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:ur},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:ke},e("span",{css:Ie},"Edit"),e(z,{src:r,alt:"Logo",css:mr})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:ke},e("span",{css:Ie},"Unlink"),e(
|
|
504
|
+
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:ur},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:ke},e("span",{css:Ie},"Edit"),e(z,{src:r,alt:"Logo",css:mr})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:ke},e("span",{css:Ie},"Unlink"),e(Zo,{icon:qo,iconColor:"red",size:16})))))}import{Callout as tn}from"@uniformdev/design-system";import{useAsync as rn,useAsyncFn as on}from"react-use";function ji({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:g,rowComponent:u,errorComponent:f,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:E="All categories",typeSelectorLabel:_="Select Category"}){var $,D;let{value:S,loading:b,error:Z}=rn(async()=>await o(),[o]),J=S==null?void 0:S.map(R=>R.id).join(","),V=jo(()=>S?S.map(m=>({id:m.id,name:m.name})):void 0,[J]),B=en(),[A,j]=on(async(R,m)=>{let I=await r({text:R,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&&(B.current=[]),(B.current=B.current||[]).push(...I.products),I},[r]),oe=async R=>{await n(R)};return Z||A.error?e(f||(({categoriesError:m,searchError:I})=>e(tn,{type:"error"},"There was an error: ",(m==null?void 0:m.message)||(I==null?void 0:I.message))),{categoriesError:Z,searchError:A.error}):e(fr.Provider,{value:{categories:S,logoIcon:a}},e(Jt,{search:j,results:B.current,logoIcon:a,selectedItems:t,select:oe,multiSelectId:l||"product-search-multi-select",multiSelect:i,contentTypes:V,selectedItemComponent:g||gr,rowComponent:u||sr,totalResults:($=A.value)==null?void 0:$.total,cursor:(D=A.value)==null?void 0:D.cursor,resultsLoading:A.loading||b,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:E,typeSelectorLabel:_}))}var fr=Yo.createContext(void 0),ge=()=>{let t=Jo(fr);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};import{css as L}from"@emotion/react";import{mq as nn}from"@uniformdev/design-system";var vr=L`
|
|
505
505
|
border: 1px solid var(--gray-200);
|
|
506
506
|
background: var(--gray-50);
|
|
507
507
|
border-radius: var(--rounded-base);
|
|
@@ -550,7 +550,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
550
550
|
flex-direction: column;
|
|
551
551
|
gap: var(--spacing-sm);
|
|
552
552
|
|
|
553
|
-
${
|
|
553
|
+
${nn("md")} {
|
|
554
554
|
flex-direction: row;
|
|
555
555
|
justify-content: end;
|
|
556
556
|
min-width: 200px;
|
|
@@ -584,16 +584,16 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
584
584
|
max-width: 100%;
|
|
585
585
|
min-width: 100px;
|
|
586
586
|
height: auto;
|
|
587
|
-
`;import
|
|
587
|
+
`;import an,{useState as sn,useRef as xr,useEffect as cn}from"react";import{CgInfo as dn,CgClose as ln}from"react-icons/cg";import{format as pn}from"timeago.js";import{css as Y}from"@emotion/react";import{Icon as kr}from"@uniformdev/design-system";function ms({selectedItem:t,onDeselect:n,onEditClosed:o,logoIcon:r,itemDetailsRendererComponent:a}){let i=xr(null),l=xr(null),[g,u]=sn(!1);cn(()=>{let p=E=>{i.current&&!i.current.contains(E.target)&&l.current&&!l.current.contains(E.target)&&u(!1)},h=()=>{u(!1)};return window.addEventListener("resize",h,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",h,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[l]);let f=()=>{var p;if(u(!g),l.current&&i.current){let h=(p=i==null?void 0:i.current)==null?void 0:p.getBoundingClientRect();l.current.style.top=`${h.top+30}px`}},s=a!=null?a:mn;return e("div",{css:[vr,Y`
|
|
588
588
|
margin: 0 0 1rem 0;
|
|
589
|
-
`],key:t.id},e("div",{css:hr},e("div",{css:br},e("div",{css:yr},e("h4",{css:[Sr],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?e(
|
|
589
|
+
`],key:t.id},e("div",{css:hr},e("div",{css:br},e("div",{css:yr},e("h4",{css:[Sr],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?e(an.Fragment,null,e("button",{type:"button",ref:i,css:Rr,"aria-controls":"path-details","aria-expanded":g,onClick:f},e(kr,{icon:dn,iconColor:"gray",size:24,css:Y`
|
|
590
590
|
opacity: var(--opacity-75);
|
|
591
591
|
`})),e("div",{id:"path-details","aria-hidden":!g,ref:l,css:[Cr,g?Y`
|
|
592
592
|
visibility: visible;
|
|
593
593
|
`:Y`
|
|
594
594
|
visibility: hidden;
|
|
595
|
-
`]},Object.entries(t.popoverData).map(([p,h],E)=>e("div",{css:q,key:E},e("span",{css:fe},p,":"),h)))):null),e(s,{item:t})),e("div",{css:Pr},t.editLink?typeof t.editLink=="string"?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ue(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:Ee},e("span",{css:q},"Edit"),r?e(z,{src:r,css:wr,alt:"Logo"}):null):t.editLink:null,e("button",{type:"button",onClick:()=>{n(t)},css:Ee},e("span",{css:q},"Unlink"),e(kr,{icon:
|
|
595
|
+
`]},Object.entries(t.popoverData).map(([p,h],E)=>e("div",{css:q,key:E},e("span",{css:fe},p,":"),h)))):null),e(s,{item:t})),e("div",{css:Pr},t.editLink?typeof t.editLink=="string"?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ue(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:Ee},e("span",{css:q},"Edit"),r?e(z,{src:r,css:wr,alt:"Logo"}):null):t.editLink:null,e("button",{type:"button",onClick:()=>{n(t)},css:Ee},e("span",{css:q},"Unlink"),e(kr,{icon:ln,iconColor:"red",size:16})))))}function mn({item:t}){let n=null;return t.previewUrl&&typeof t.previewUrl=="string"?t.type==="image"?n=e("img",{src:t.previewUrl,alt:t.id,width:"200",css:Te}):t.type==="video"&&(n=e("video",{src:t.previewUrl,title:t.id,width:"200",controls:!0,css:Te})):t.previewUrl&&typeof t.previewUrl!="string"&&(n=t.previewUrl),n||t.metadata?e("div",{css:Lr},n?e("div",null,n):null,e("ul",null,t.metadata?Object.entries(t.metadata).map(([o,r])=>e("li",{css:[q,Y`
|
|
596
596
|
order: 1;
|
|
597
597
|
`],key:o},e("span",{css:[fe,Y`
|
|
598
598
|
order: 1;
|
|
599
|
-
`]},o,":"),r)):null,t.createdDate?e("li",{css:q},e("span",{css:fe},"Date:"),
|
|
599
|
+
`]},o,":"),r)):null,t.createdDate?e("li",{css:q},e("span",{css:fe},"Date:"),pn(t.createdDate)):null)):null}export*from"@uniformdev/mesh-sdk";import{Button as ws,Callout as Cs,LoadingIndicator as Ps,LoadingOverlay as Ls,Menu as Rs,MenuItem as xs,Input as ks,InputSelect as Is,InputToggle as Es,Theme as Ts,InputKeywordSearch as Ms,Heading as Vs,ScrollableList as Ds,ScrollableListItem as zs,Textarea as Us,Switch as Gs,Label as As,AddListButton as Bs}from"@uniformdev/design-system";export{Bs as AddListButton,ws as Button,Cs as Callout,ms as DamSelectedItem,Bt as DefaultSearchRow,Tt as DefaultSelectedItem,Jt as EntrySearch,Vs as Heading,ye as Icons,ks as Input,Is as InputSelect,Es as InputToggle,Ms as KeywordSearchInput,As as Label,Ps as LoadingIndicator,Ls as LoadingOverlay,Rs as Menu,xs as MenuItem,rt as ProductPreviewList,aa as ProductQuery,et as ProductQueryContext,ji as ProductSearch,fr as ProductSearchContext,sr as ProductSearchRow,gr as ProductSelectedItem,Qe as ResolvableLoadingValue,Ds as ScrollableList,zs as ScrollableListItem,Xe as SelectionField,Gs as Switch,Us as Textarea,Ts as Theme,Be as UniformMeshLocationContext,Oe as UniformMeshLocationContextProvider,$e as UniformMeshSdkContext,Vn as UniformMeshSdkContextProvider,Le as badgeIcon,Te as damSelectItemImage,vr as damSelectedItemContainer,yr as damSelectedItemCopy,br as damSelectedItemDetails,wr as damSelectedItemIcon,Rr as damSelectedItemInfoBtn,hr as damSelectedItemInner,Ee as damSelectedItemLinkBtn,Pr as damSelectedItemLinkContainer,Lr as damSelectedItemMediaContainer,Cr as damSelectedItemPopover,fe as damSelectedItemPopoverLabel,q as damSelectedItemSmallText,Sr as damSelectedItemTitle,_t as draggableContainer,Pe as draggableIcon,Xt as draggableIconOffset,Zt as draggableIconWrapper,Ht as entrySearchBtn,$t as entrySearchConfig,Kt as entrySearchConfigHidden,Ft as entrySearchLoadMoreBtn,Nt as entrySearchResultList,Qt as entrySearchSelectIcon,Wt as entrySearchSelectImg,si as entrySearchSelectInput,ci as entrySearchSelectOption,Ot as entrySearchWrapper,ar as productSearchRowActiveIcon,or as productSearchRowCategory,jt as productSearchRowContainer,er as productSearchRowContent,tr as productSearchRowContentActive,nr as productSearchRowDetails,rr as productSearchRowTitle,dr as productSelectedItemContainer,pr as productSelectedItemContent,lr as productSelectedItemDetails,mr as productSelectedItemIcon,xe as productSelectedItemImage,ur as productSelectedItemLinkContainer,ke as productedSelectedItemLinkBtn,Ie as productedSelectedItemSmallText,Ut as searchRowBtn,Mt as searchRowContainer,Dt as searchRowContainerActive,Vt as searchRowContainerWithPopover,zt as searchRowPopover,Ce as searchRowText,we as searchRowTextSmall,Se as selectItemLinkBtn,kt as selectItemLinkContainer,xt as selectItemPopover,re as selectItemPopoverLabel,N as selectItemSmallText,St as selectedItemContainer,Pt as selectedItemCopy,Ct as selectedItemDetails,Rt as selectedItemIcon,wt as selectedItemInner,Lt as selectedItemTitle,xn as useInitializeUniformMeshSdk,tt as useProductQueryContext,ge as useProductSearchContext,wn as useUniformMeshLocation,He as useUniformMeshLocationContext,Un as useUniformMeshSdk,Ke as useUniformMeshSdkContext};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ho=Object.create;var Pe=Object.defineProperty;var bo=Object.getOwnPropertyDescriptor;var yo=Object.getOwnPropertyNames;var So=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var yr=(t,n)=>{for(var o in n)Pe(t,o,{get:n[o],enumerable:!0})},Ce=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of yo(n))!wo.call(t,a)&&a!==o&&Pe(t,a,{get:()=>n[a],enumerable:!(r=bo(n,a))||r.enumerable});return t},H=(t,n,o)=>(Ce(t,n,"default"),o&&Ce(o,n,"default")),Y=(t,n,o)=>(o=t!=null?ho(So(t)):{},Ce(n||!t||!t.__esModule?Pe(o,"default",{value:t,enumerable:!0}):o,t)),Co=t=>Ce(Pe({},"__esModule",{value:!0}),t);var A={};yr(A,{AddListButton:()=>m.AddListButton,Button:()=>m.Button,Callout:()=>m.Callout,DamSelectedItem:()=>Qo,DefaultSearchRow:()=>Rt,DefaultSelectedItem:()=>bt,EntrySearch:()=>At,Heading:()=>m.Heading,Icons:()=>De,Input:()=>m.Input,InputSelect:()=>m.InputSelect,InputToggle:()=>m.InputToggle,KeywordSearchInput:()=>m.InputKeywordSearch,Label:()=>m.Label,LoadingIndicator:()=>m.LoadingIndicator,LoadingOverlay:()=>m.LoadingOverlay,Menu:()=>m.Menu,MenuItem:()=>m.MenuItem,ProductPreviewList:()=>it,ProductQuery:()=>Eo,ProductQueryContext:()=>nt,ProductSearch:()=>No,ProductSearchContext:()=>er,ProductSearchRow:()=>Wt,ProductSelectedItem:()=>jt,ResolvableLoadingValue:()=>rt,ScrollableList:()=>m.ScrollableList,ScrollableListItem:()=>m.ScrollableListItem,SelectionField:()=>ot,Switch:()=>m.Switch,Textarea:()=>m.Textarea,Theme:()=>m.Theme,UniformMeshLocationContext:()=>qe,UniformMeshLocationContextProvider:()=>Ye,UniformMeshSdkContext:()=>je,UniformMeshSdkContextProvider:()=>Ro,badgeIcon:()=>He,damSelectItemImage:()=>_e,damSelectedItemContainer:()=>tr,damSelectedItemCopy:()=>nr,damSelectedItemDetails:()=>or,damSelectedItemIcon:()=>ir,damSelectedItemInfoBtn:()=>lr,damSelectedItemInner:()=>rr,damSelectedItemLinkBtn:()=>We,damSelectedItemLinkContainer:()=>cr,damSelectedItemMediaContainer:()=>dr,damSelectedItemPopover:()=>sr,damSelectedItemPopoverLabel:()=>ye,damSelectedItemSmallText:()=>
|
|
1
|
+
"use strict";var ho=Object.create;var Pe=Object.defineProperty;var bo=Object.getOwnPropertyDescriptor;var yo=Object.getOwnPropertyNames;var So=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var yr=(t,n)=>{for(var o in n)Pe(t,o,{get:n[o],enumerable:!0})},Ce=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of yo(n))!wo.call(t,a)&&a!==o&&Pe(t,a,{get:()=>n[a],enumerable:!(r=bo(n,a))||r.enumerable});return t},H=(t,n,o)=>(Ce(t,n,"default"),o&&Ce(o,n,"default")),Y=(t,n,o)=>(o=t!=null?ho(So(t)):{},Ce(n||!t||!t.__esModule?Pe(o,"default",{value:t,enumerable:!0}):o,t)),Co=t=>Ce(Pe({},"__esModule",{value:!0}),t);var A={};yr(A,{AddListButton:()=>m.AddListButton,Button:()=>m.Button,Callout:()=>m.Callout,DamSelectedItem:()=>Qo,DefaultSearchRow:()=>Rt,DefaultSelectedItem:()=>bt,EntrySearch:()=>At,Heading:()=>m.Heading,Icons:()=>De,Input:()=>m.Input,InputSelect:()=>m.InputSelect,InputToggle:()=>m.InputToggle,KeywordSearchInput:()=>m.InputKeywordSearch,Label:()=>m.Label,LoadingIndicator:()=>m.LoadingIndicator,LoadingOverlay:()=>m.LoadingOverlay,Menu:()=>m.Menu,MenuItem:()=>m.MenuItem,ProductPreviewList:()=>it,ProductQuery:()=>Eo,ProductQueryContext:()=>nt,ProductSearch:()=>No,ProductSearchContext:()=>er,ProductSearchRow:()=>Wt,ProductSelectedItem:()=>jt,ResolvableLoadingValue:()=>rt,ScrollableList:()=>m.ScrollableList,ScrollableListItem:()=>m.ScrollableListItem,SelectionField:()=>ot,Switch:()=>m.Switch,Textarea:()=>m.Textarea,Theme:()=>m.Theme,UniformMeshLocationContext:()=>qe,UniformMeshLocationContextProvider:()=>Ye,UniformMeshSdkContext:()=>je,UniformMeshSdkContextProvider:()=>Ro,badgeIcon:()=>He,damSelectItemImage:()=>_e,damSelectedItemContainer:()=>tr,damSelectedItemCopy:()=>nr,damSelectedItemDetails:()=>or,damSelectedItemIcon:()=>ir,damSelectedItemInfoBtn:()=>lr,damSelectedItemInner:()=>rr,damSelectedItemLinkBtn:()=>We,damSelectedItemLinkContainer:()=>cr,damSelectedItemMediaContainer:()=>dr,damSelectedItemPopover:()=>sr,damSelectedItemPopoverLabel:()=>ye,damSelectedItemSmallText:()=>se,damSelectedItemTitle:()=>ar,draggableContainer:()=>zt,draggableIcon:()=>Oe,draggableIconOffset:()=>Gt,draggableIconWrapper:()=>Ut,entrySearchBtn:()=>kt,entrySearchConfig:()=>Et,entrySearchConfigHidden:()=>Tt,entrySearchLoadMoreBtn:()=>It,entrySearchResultList:()=>Mt,entrySearchSelectIcon:()=>Vt,entrySearchSelectImg:()=>Dt,entrySearchSelectInput:()=>Fo,entrySearchSelectOption:()=>$o,entrySearchWrapper:()=>xt,productSearchRowActiveIcon:()=>Nt,productSearchRowCategory:()=>$t,productSearchRowContainer:()=>Bt,productSearchRowContent:()=>Ot,productSearchRowContentActive:()=>Ht,productSearchRowDetails:()=>Kt,productSearchRowTitle:()=>Ft,productSelectedItemContainer:()=>Zt,productSelectedItemContent:()=>qt,productSelectedItemDetails:()=>Xt,productSelectedItemIcon:()=>Yt,productSelectedItemImage:()=>Fe,productSelectedItemLinkContainer:()=>Jt,productedSelectedItemLinkBtn:()=>$e,productedSelectedItemSmallText:()=>Ke,searchRowBtn:()=>Pt,searchRowContainer:()=>yt,searchRowContainerActive:()=>wt,searchRowContainerWithPopover:()=>St,searchRowPopover:()=>Ct,searchRowText:()=>Be,searchRowTextSmall:()=>Ae,selectItemLinkBtn:()=>Ue,selectItemLinkContainer:()=>vt,selectItemPopover:()=>ft,selectItemPopoverLabel:()=>me,selectItemSmallText:()=>J,selectedItemContainer:()=>dt,selectedItemCopy:()=>mt,selectedItemDetails:()=>pt,selectedItemIcon:()=>gt,selectedItemInner:()=>lt,selectedItemTitle:()=>ut,useInitializeUniformMeshSdk:()=>Lo,useProductQueryContext:()=>at,useProductSearchContext:()=>be,useUniformMeshLocation:()=>Po,useUniformMeshLocationContext:()=>Je,useUniformMeshSdk:()=>xo,useUniformMeshSdkContext:()=>et});module.exports=Co(A);var e=require("@emotion/react"),S=Y(require("react"));var pe=require("react"),qe=(0,pe.createContext)(void 0),Ye=({children:t})=>{let[n,o]=(0,pe.useState)(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return(0,e.jsx)(qe.Provider,{value:r},t)},Je=()=>{let t=(0,pe.useContext)(qe);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Po(){let{location:t}=Je();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}var Sr=require("@uniformdev/mesh-sdk"),ne=require("react"),Lo=({autoResizingDisabled:t}={})=>{let[n,o]=(0,ne.useState)(),[r,a]=(0,ne.useState)(),i=(0,ne.useRef)(!1);return(0,ne.useEffect)(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"&&!i.current?(i.current=!0,(0,Sr.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(l=>{a(l)}).catch(l=>{o(l)}).finally(()=>{i.current=!1})):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};var Le=require("react");var wr=require("@uniformdev/design-system"),je=(0,Le.createContext)(void 0),Ro=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(je.Provider,{value:n},(0,e.jsx)(wr.Theme,null),(0,e.jsx)(Ye,null,t))},et=()=>{let t=(0,Le.useContext)(je);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function xo(){let{sdk:t}=et();return t}var K=Y(require("react"));var Rr=require("@emotion/react"),xe=require("@uniformdev/design-system"),xr=require("react-icons/cg");var tt=Y(require("react")),rt=({value:t,text:n,loading:o})=>(0,e.jsx)(tt.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)(tt.default.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Re=require("@emotion/react"),Cr=Re.css`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
18
|
`;var ot=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:i,onRemove:l})=>{var v;let f=(v=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?v:[],g=(s,p)=>{s.preventDefault(),l(p)};return(0,e.jsx)("div",null,(0,e.jsx)(xe.InputSelect,{id:t,name:t,label:n,onChange:s=>i(s.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(r)&&r.length>0?Rr.css`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),r==null?void 0:r.map(s=>{var p;return(0,e.jsx)("div",{css:Cr,key:s},(0,e.jsx)("span",{css:Pr},(0,e.jsx)(rt,{value:s,loading:o,text:(p=a.find(b=>b.id===s))==null?void 0:p.name})),(0,e.jsx)("button",{css:Lr,title:"remove",onClick:b=>g(b,s)},(0,e.jsx)(xe.Icon,{icon:xr.CgClose,iconColor:"currentColor",size:20})))}))};var ko=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ke=ko;var Io=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),Ie=Io;var Ee=require("react-use"),E=require("@uniformdev/design-system"),R=require("@emotion/react"),kr={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Eo=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:f,onGetProducts:g,sortOptions:v,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:b="Brand",disableBrands:D,restrictToSingleCategory:
|
|
20
|
+
`:""}),r==null?void 0:r.map(s=>{var p;return(0,e.jsx)("div",{css:Cr,key:s},(0,e.jsx)("span",{css:Pr},(0,e.jsx)(rt,{value:s,loading:o,text:(p=a.find(b=>b.id===s))==null?void 0:p.name})),(0,e.jsx)("button",{css:Lr,title:"remove",onClick:b=>g(b,s)},(0,e.jsx)(xe.Icon,{icon:xr.CgClose,iconColor:"currentColor",size:20})))}))};var ko=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ke=ko;var Io=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),Ie=Io;var Ee=require("react-use"),E=require("@uniformdev/design-system"),R=require("@emotion/react"),kr={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Eo=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:f,onGetProducts:g,sortOptions:v,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:b="Brand",disableBrands:D,restrictToSingleCategory:de=!1})=>{var k,u,M;let w=async c=>{n({...kr,...t||{},...c})},y=(0,K.useMemo)(()=>({...kr,...t||{}}),[t]),[le,ge]=(0,Ee.useAsyncFn)(async c=>await g(c),[g]);(0,Ee.useDebounce)(async()=>{await ge({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let B=(0,K.useMemo)(()=>{let c=[];return r==null||r.forEach(z=>{let P=Er(z,void 0);c.push(...P)}),c},[r]),X=(0,K.useMemo)(()=>[{value:"",label:"All categories"},...B.map(c=>({label:c.name,value:c.id}))],[B]),$=(0,K.useMemo)(()=>(o==null?void 0:o.map(c=>({id:c.id.toString(),name:c.name})))||[],[o]),fe=c=>{if(!c)return;let z=(t==null?void 0:t.categories)||[];w({categories:[...z,c]})},Se=c=>{var z;w({categories:(z=t==null?void 0:t.categories)==null?void 0:z.filter(P=>P!==c)})},re=c=>{w({brand:c.target.value})},O=c=>{w({count:c||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(nt.Provider,{value:{categories:r,logoIcon:f}},(0,e.jsx)("div",{css:R.css`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
24
|
-
`},
|
|
24
|
+
`},de?(0,e.jsx)(E.InputSelect,{id:"selection-field-product-category",label:p,disabled:a,value:(u=(k=y.categories)==null?void 0:k[0])!=null?u:"",options:X,onChange:c=>{w({categories:c.target.value===""?[]:[c.target.value]})}}):(0,e.jsx)(ot,{loading:i||!1,id:"selection-field-product-category",label:p,onAdd:fe,onRemove:Se,selectedValues:y.categories,values:B}),(0,e.jsx)("div",{css:R.css`
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-wrap: wrap;
|
|
27
27
|
column-gap: var(--spacing-lg);
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
line-height: var(--spacing-md);
|
|
67
67
|
font-weight: var(--fw-bold);
|
|
68
68
|
margin-bottom: var(--spacing-xs);
|
|
69
|
-
`},"Result Preview"),(0,e.jsx)(it,{products:(M=
|
|
69
|
+
`},"Result Preview"),(0,e.jsx)(it,{products:(M=le.value)==null?void 0:M.products}))))};function Er(t,n){var i;let o=[],r=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${r}${t.name}`};return o.push(a),(i=t.children)==null||i.forEach(l=>{let f=Er(l,a);o.push(...f)}),o}function Ir({onCountChange:t,countIcon:n,disabled:o}){return(0,e.jsx)("button",{css:R.css`
|
|
70
70
|
width: 2.25rem;
|
|
71
71
|
height: 2.25rem;
|
|
72
72
|
border: 1px solid var(--gray-300);
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
width: max-content;
|
|
186
186
|
`,J=V.css`
|
|
187
187
|
font-size: var(--fs-sm);
|
|
188
|
-
`,
|
|
188
|
+
`,me=V.css`
|
|
189
189
|
font-weight: var(--fw-bold);
|
|
190
190
|
margin-right: var(--spacing-sm);
|
|
191
191
|
`,vt=V.css`
|
|
@@ -223,11 +223,11 @@
|
|
|
223
223
|
visibility: visible;
|
|
224
224
|
`:N.css`
|
|
225
225
|
visibility: hidden;
|
|
226
|
-
`]},Object.entries(t.popoverData).map(([s,p],b)=>(0,e.jsx)("div",{css:J,key:b},(0,e.jsx)("span",{css:
|
|
226
|
+
`]},Object.entries(t.popoverData).map(([s,p],b)=>(0,e.jsx)("div",{css:J,key:b},(0,e.jsx)("span",{css:me},s,":"),p)))):null),t.createdDate&&(0,e.jsx)("div",{css:J},(0,e.jsx)("span",{css:me},"Created:"),(0,Zr.format)((v=t.createdDate)!=null?v:0)),t.metadata?Object.entries(t.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>(0,e.jsx)("div",{css:[J,N.css`
|
|
227
227
|
order: 1;
|
|
228
|
-
`],key:s},(0,e.jsx)("span",{css:
|
|
228
|
+
`],key:s},(0,e.jsx)("span",{css:me},s,":"),p)):null,t.metadata?Object.entries(t.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>(0,e.jsx)("div",{css:[J,N.css`
|
|
229
229
|
order: 1;
|
|
230
|
-
`],key:s},(0,e.jsx)("span",{css:[
|
|
230
|
+
`],key:s},(0,e.jsx)("span",{css:[me,N.css`
|
|
231
231
|
order: 1;
|
|
232
232
|
`]},s,":"),p)):null),(0,e.jsx)("div",{css:vt},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(ze(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:Ue},(0,e.jsx)("span",{css:J},"Edit"),(0,e.jsx)(F,{src:n,css:gt,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{o(t)},css:Ue},(0,e.jsx)("span",{css:J},"Unlink"),(0,e.jsx)(ht.Icon,{icon:Ge.CgClose,iconColor:"red",size:16})))))};var W=Y(require("react"));var j=require("@emotion/react"),yt=j.css`
|
|
233
233
|
cursor: pointer;
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
visibility: visible;
|
|
265
265
|
`:Lt.css`
|
|
266
266
|
visibility: hidden;
|
|
267
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([g,v],s)=>(0,e.jsx)("div",{css:Ae,key:s},(0,e.jsx)("span",{css:Be},g,":"),v)),Object.entries(t.popoverData).map(([g,v],s)=>(0,e.jsx)("div",{css:Ae,key:s},(0,e.jsx)("span",{css:Be},g,":"),v)))):null)};var
|
|
267
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([g,v],s)=>(0,e.jsx)("div",{css:Ae,key:s},(0,e.jsx)("span",{css:Be},g,":"),v)),Object.entries(t.popoverData).map(([g,v],s)=>(0,e.jsx)("div",{css:Ae,key:s},(0,e.jsx)("span",{css:Be},g,":"),v)))):null)};var ue=require("react-beautiful-dnd");var L=require("@emotion/react"),xt=L.css`
|
|
268
268
|
background: var(--white);
|
|
269
269
|
border: 1px solid var(--gray-300);
|
|
270
270
|
border-radius: var(--rounded-base);
|
|
@@ -352,7 +352,7 @@
|
|
|
352
352
|
`,He=L.css`
|
|
353
353
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
354
354
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
355
|
-
`;var G=require("@emotion/react"),C=require("@uniformdev/design-system");var
|
|
355
|
+
`;var G=require("@emotion/react"),C=require("@uniformdev/design-system");var ae=require("react");function Xr(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,a]=(0,ae.useState)("IDLE"),i=(0,ae.useRef)(void 0);return(0,ae.useEffect)(()=>{t&&r==="IDLE"&&(clearTimeout(i.current),i.current=setTimeout(()=>{if(!t)return a("IDLE");i.current=setTimeout(()=>{a("EXPIRE")},o),a("DISPLAY")},n),a("DELAY")),!t&&r!=="DISPLAY"&&(clearTimeout(i.current),a("IDLE"))},[t,r,n,o]),(0,ae.useEffect)(()=>()=>clearTimeout(i.current),[]),r==="DISPLAY"||r==="EXPIRE"}var Ko=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&n!=="any"&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),(0,e.jsx)(C.Callout,{type:"info"},o)},At=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:i,multiSelect:l,multiSelectId:f,rowComponent:g,selectedItemComponent:v,totalResults:s,cursor:p,resultsLoading:b,requireContentType:D,onAddNew:de,onEditClosed:w,onCancel:y,noResultsComponent:le,helpComponent:ge,onSort:B,typeSelectorLabel:X="Content Type Select",typeSelectorAllTypesOptionText:$="All content types",loadingIndicatorDelay:fe=1e3})=>{var vr,hr,br;let re=()=>D?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[O,k]=T.useState(""),[u,M]=T.useState(re),[c,z]=T.useState(!1),[P,oe]=T.useState([]),[ro,mr]=T.useState(!1),Xe=T.useRef(`x${(0,Yr.v4)()}`),we=(0,qr.useThrottle)(O,750);T.useEffect(()=>{t(we,{count:5,offset:0,contentType:u==="any"?void 0:u})},[we,u]);let oo=Xr(b,{delay:fe}),no=d=>{P.some(h=>h.id===d.id)?oe(h=>h.filter(q=>q.id!==d.id)):oe(l?h=>[...h,d]:[d])},ao=r==null?void 0:r.map(d=>d.id+d.title).join(",");T.useEffect(()=>{Array.isArray(r)&&oe(r)},[ao]);let io=()=>{M(re()),k(""),oe(r!=null&&r.length?r:[])},so=()=>{z(d=>!d),c||io()},ur=d=>{let h=(P==null?void 0:P.filter(q=>q.id!==d.id))||[];oe(h),i(h,"")},co=d=>{d.preventDefault(),i(P,u),z(!1)},lo=d=>{d.preventDefault(),z(!1),y&&y()},po=()=>{t(we,{count:5,offset:(n==null?void 0:n.length)||0,contentType:u==="any"?void 0:u,cursor:p}),mr(!0);let d=setTimeout(()=>{mr(!1)},750);return()=>clearTimeout(d)},mo=!(r==null?void 0:r.length)||l,uo=g||Rt,gr=v||bt,go=le||Ko,fr=a&&typeof a!="string"?a:null,fo=fr?(0,e.jsx)(fr,{css:He}):(0,e.jsx)("img",{src:a,alt:"Logo",css:He}),vo=d=>{var h,q;if(d.destination&&d.source.droppableId===((h=d.destination)==null?void 0:h.droppableId)){let I=[...r||[]],[ve]=(q=I==null?void 0:I.splice(d.source.index,1))!=null?q:[];return I==null||I.splice(d.destination.index,0,ve),B&&(oe(I),B==null||B(I)),I}};return(0,e.jsx)("div",{css:G.css`
|
|
356
356
|
width: 100%;
|
|
357
357
|
`},(0,e.jsx)("div",{css:G.css`
|
|
358
358
|
position: relative;
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
margin-left: var(--spacing-base);
|
|
362
362
|
`},"Select"),(0,e.jsx)("span",{css:Vt},(0,e.jsx)(Me,{css:[Dt,c?G.css`
|
|
363
363
|
transform: rotate(180deg);
|
|
364
|
-
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${Xe.current}`,"aria-hidden":!c,css:[Et,c?void 0:Tt]},
|
|
364
|
+
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${Xe.current}`,"aria-hidden":!c,css:[Et,c?void 0:Tt]},ge||null,(0,e.jsx)("div",{css:G.css`
|
|
365
365
|
display: flex;
|
|
366
366
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
367
367
|
margin-bottom: var(--spacing-base);
|
|
@@ -370,15 +370,15 @@
|
|
|
370
370
|
`},(0,e.jsx)(C.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:k,disabledFieldSubmission:!0,value:O}))),(0,e.jsx)("div",{css:[Mt,C.scrollbarStyles],id:Xe.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(0,e.jsx)(C.LoadingOverlay,{isActive:oo}),Array.isArray(n)&&n.length>0?n.map(d=>(0,e.jsx)(uo,{key:d.id,isSelected:P.some(h=>h.id===d.id),result:d,triggerSelection:()=>no(d)})):(0,e.jsx)(go,{searchText:we||O,selectedContentType:(hr=(vr=o==null?void 0:o.find(d=>d.id===u))==null?void 0:vr.name)!=null?hr:u}),!b&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&(0,e.jsx)("button",{type:"button",css:It,onClick:po},ro?(0,e.jsx)(C.LoadingIndicator,null):"Load More")),(0,e.jsx)("div",{css:G.css`
|
|
371
371
|
display: flex;
|
|
372
372
|
justify-content: space-between;
|
|
373
|
-
`},(0,e.jsx)("div",null,
|
|
373
|
+
`},(0,e.jsx)("div",null,de&&((br=o==null?void 0:o.length)!=null?br:0)>0?(0,e.jsx)(C.Menu,{menuLabel:"Add new menu",menuTrigger:(0,e.jsx)(C.Button,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(d=>(0,e.jsx)(C.MenuItem,{key:d.id,css:G.css`
|
|
374
374
|
background: var(--white);
|
|
375
375
|
color: var(--brand-secondary-1);
|
|
376
|
-
`,onClick:()=>
|
|
376
|
+
`,onClick:()=>de(d)},d.name))):null),(0,e.jsx)("div",{css:G.css`
|
|
377
377
|
display: flex;
|
|
378
378
|
gap: var(--spacing-base);
|
|
379
|
-
`},(0,e.jsx)(C.Button,{buttonType:"unimportant",onClick:lo},"Cancel"),(0,e.jsx)(C.Button,{disabled:!P.length,onClick:co,"data-test-id":"entry-accept-button"},"Accept"))))):null,c?null:l&&P.length>1?(0,e.jsx)(
|
|
379
|
+
`},(0,e.jsx)(C.Button,{buttonType:"unimportant",onClick:lo},"Cancel"),(0,e.jsx)(C.Button,{disabled:!P.length,onClick:co,"data-test-id":"entry-accept-button"},"Accept"))))):null,c?null:l&&P.length>1?(0,e.jsx)(ue.DragDropContext,{onDragEnd:d=>vo(d)},(0,e.jsx)(ue.Droppable,{droppableId:f||"canvas-multi-select"},d=>(0,e.jsx)("div",{...d.droppableProps,ref:d.innerRef,css:G.css`
|
|
380
380
|
margin-block: var(--spacing-sm) 0;
|
|
381
|
-
`},P==null?void 0:P.map((h,q)=>{if(h!=null&&h.id)return(0,e.jsx)(
|
|
381
|
+
`},P==null?void 0:P.map((h,q)=>{if(h!=null&&h.id)return(0,e.jsx)(ue.Draggable,{key:h.id,draggableId:h.id,index:q},I=>(0,e.jsx)("div",{css:zt,ref:I.innerRef,...I.draggableProps,...I.dragHandleProps},(0,e.jsx)("span",{css:Ut},(0,e.jsx)(he,{css:[Oe,Gt],width:24,height:24}),(0,e.jsx)(he,{css:Oe,width:24,height:24})),(0,e.jsx)(gr,{key:`selected-item-${h.id}`,logoIcon:a,selectedItem:h,onDeselect:ve=>ur(ve),onEditClosed:w?ve=>w(ve):void 0})))}),d.placeholder))):P==null?void 0:P.map(d=>(0,e.jsx)(gr,{key:`selected-item-${d.id}`,logoIcon:a,selectedItem:d,onDeselect:h=>ur(h),onEditClosed:w?h=>w(h):void 0}))))};var ee=require("@emotion/react"),Bt=ee.css`
|
|
382
382
|
cursor: pointer;
|
|
383
383
|
padding: var(--spacing-sm) 0;
|
|
384
384
|
margin-right: var(--spacing-sm);
|
|
@@ -480,28 +480,28 @@
|
|
|
480
480
|
min-width: 200px;
|
|
481
481
|
justify-content: end;
|
|
482
482
|
}
|
|
483
|
-
`;var
|
|
483
|
+
`;var ie=require("@emotion/react"),Ne=require("@uniformdev/design-system"),Jr=require("react-icons/cg");function jt({selectedItem:t,onDeselect:n}){var l;let{categories:o,logoIcon:r}=be(),[a]=t.categories||[{id:"",name:""}],i=typeof a=="undefined"||!o||(l=o.find(f=>f.id===a.id))==null?void 0:l.name;return(0,e.jsx)("div",{css:[Zt],key:t.id},(0,e.jsx)("article",{css:[Xt]},(0,e.jsx)("div",{css:[qt]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:i,css:[Fe],loading:"lazy"}):(0,e.jsx)("div",{css:[Fe]}),(0,e.jsx)("div",{css:ie.css`
|
|
484
484
|
> :not(:last-child) {
|
|
485
485
|
margin-bottom: var(--spacing-xs);
|
|
486
486
|
}
|
|
487
|
-
`},(0,e.jsx)("h4",{css:
|
|
487
|
+
`},(0,e.jsx)("h4",{css:ie.css`
|
|
488
488
|
margin-top: 0px;
|
|
489
489
|
font-weight: var(--fw-bold);
|
|
490
|
-
`},t.title||t.id||"",i&&(0,e.jsx)("span",{css:
|
|
490
|
+
`},t.title||t.id||"",i&&(0,e.jsx)("span",{css:ie.css`
|
|
491
491
|
display: block;
|
|
492
492
|
font-weight: var(--fw-regular);
|
|
493
|
-
`},i)),(0,e.jsx)("ul",{css:
|
|
493
|
+
`},i)),(0,e.jsx)("ul",{css:ie.css`
|
|
494
494
|
font-size: var(--fs-sm);
|
|
495
495
|
|
|
496
496
|
${(0,Ne.mq)("sm")} {
|
|
497
497
|
display: flex;
|
|
498
498
|
gap: var(--spacing-base);
|
|
499
499
|
}
|
|
500
|
-
`},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:
|
|
500
|
+
`},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:ie.css`
|
|
501
501
|
margin-right: var(--spacing-xs);
|
|
502
|
-
`},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:
|
|
502
|
+
`},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:ie.css`
|
|
503
503
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:Jt},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:$e},(0,e.jsx)("span",{css:Ke},"Edit"),(0,e.jsx)(F,{src:r,alt:"Logo",css:Yt})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{n==null||n(t)},css:$e},(0,e.jsx)("span",{css:Ke},"Unlink"),(0,e.jsx)(Ne.Icon,{icon:Jr.CgClose,iconColor:"red",size:16})))))}var jr=require("@uniformdev/design-system"),Qe=require("react-use");function No({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:f,rowComponent:g,errorComponent:v,helpComponent:s,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:
|
|
504
|
+
`},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:Jt},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:$e},(0,e.jsx)("span",{css:Ke},"Edit"),(0,e.jsx)(F,{src:r,alt:"Logo",css:Yt})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{n==null||n(t)},css:$e},(0,e.jsx)("span",{css:Ke},"Unlink"),(0,e.jsx)(Ne.Icon,{icon:Jr.CgClose,iconColor:"red",size:16})))))}var jr=require("@uniformdev/design-system"),Qe=require("react-use");function No({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:f,rowComponent:g,errorComponent:v,helpComponent:s,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:de="Select Category"}){var re,O;let{value:w,loading:y,error:le}=(0,Qe.useAsync)(async()=>await o(),[o]),ge=w==null?void 0:w.map(k=>k.id).join(","),B=(0,te.useMemo)(()=>w?w.map(u=>({id:u.id,name:u.name})):void 0,[ge]),X=(0,te.useRef)(),[$,fe]=(0,Qe.useAsyncFn)(async(k,u)=>{let M=await r({text:k,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType,cursor:u==null?void 0:u.cursor}});return(u==null?void 0:u.offset)===0&&(X.current=[]),(X.current=X.current||[]).push(...M.products),M},[r]),Se=async k=>{await n(k)};return le||$.error?(0,e.jsx)(v||(({categoriesError:u,searchError:M})=>(0,e.jsx)(jr.Callout,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(M==null?void 0:M.message))),{categoriesError:le,searchError:$.error}):(0,e.jsx)(er.Provider,{value:{categories:w,logoIcon:a}},(0,e.jsx)(At,{search:fe,results:X.current,logoIcon:a,selectedItems:t,select:Se,multiSelectId:l||"product-search-multi-select",multiSelect:i,contentTypes:B,selectedItemComponent:f||jt,rowComponent:g||Wt,totalResults:(re=$.value)==null?void 0:re.total,cursor:(O=$.value)==null?void 0:O.cursor,resultsLoading:$.loading||y,helpComponent:s,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D,typeSelectorLabel:de}))}var er=te.default.createContext(void 0),be=()=>{let t=(0,te.useContext)(er);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};var x=require("@emotion/react"),eo=require("@uniformdev/design-system"),tr=x.css`
|
|
505
505
|
border: 1px solid var(--gray-200);
|
|
506
506
|
background: var(--gray-50);
|
|
507
507
|
border-radius: var(--rounded-base);
|
|
@@ -540,7 +540,7 @@
|
|
|
540
540
|
padding: var(--spacing-base);
|
|
541
541
|
z-index: var(--z-10);
|
|
542
542
|
width: max-content;
|
|
543
|
-
`,
|
|
543
|
+
`,se=x.css`
|
|
544
544
|
font-size: var(--fs-sm);
|
|
545
545
|
`,ye=x.css`
|
|
546
546
|
font-weight: var(--fw-bold);
|
|
@@ -584,16 +584,16 @@
|
|
|
584
584
|
max-width: 100%;
|
|
585
585
|
min-width: 100px;
|
|
586
586
|
height: auto;
|
|
587
|
-
`;var Z=Y(require("react"));var Ze=require("react-icons/cg"),to=require("timeago.js");var
|
|
587
|
+
`;var Z=Y(require("react"));var Ze=require("react-icons/cg"),to=require("timeago.js");var ce=require("@emotion/react");var pr=require("@uniformdev/design-system");function Qo({selectedItem:t,onDeselect:n,onEditClosed:o,logoIcon:r,itemDetailsRendererComponent:a}){let i=(0,Z.useRef)(null),l=(0,Z.useRef)(null),[f,g]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let p=D=>{i.current&&!i.current.contains(D.target)&&l.current&&!l.current.contains(D.target)&&g(!1)},b=()=>{g(!1)};return window.addEventListener("resize",b,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",b,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[l]);let v=()=>{var p;if(g(!f),l.current&&i.current){let b=(p=i==null?void 0:i.current)==null?void 0:p.getBoundingClientRect();l.current.style.top=`${b.top+30}px`}},s=a!=null?a:Wo;return(0,e.jsx)("div",{css:[tr,ce.css`
|
|
588
588
|
margin: 0 0 1rem 0;
|
|
589
|
-
`],key:t.id},(0,e.jsx)("div",{css:rr},(0,e.jsx)("div",{css:or},(0,e.jsx)("div",{css:nr},(0,e.jsx)("h4",{css:[ar],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?(0,e.jsx)(Z.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:i,css:lr,"aria-controls":"path-details","aria-expanded":f,onClick:v},(0,e.jsx)(pr.Icon,{icon:Ze.CgInfo,iconColor:"gray",size:24,css:
|
|
589
|
+
`],key:t.id},(0,e.jsx)("div",{css:rr},(0,e.jsx)("div",{css:or},(0,e.jsx)("div",{css:nr},(0,e.jsx)("h4",{css:[ar],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?(0,e.jsx)(Z.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:i,css:lr,"aria-controls":"path-details","aria-expanded":f,onClick:v},(0,e.jsx)(pr.Icon,{icon:Ze.CgInfo,iconColor:"gray",size:24,css:ce.css`
|
|
590
590
|
opacity: var(--opacity-75);
|
|
591
|
-
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!f,ref:l,css:[sr,f?
|
|
591
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!f,ref:l,css:[sr,f?ce.css`
|
|
592
592
|
visibility: visible;
|
|
593
|
-
`:
|
|
593
|
+
`:ce.css`
|
|
594
594
|
visibility: hidden;
|
|
595
|
-
`]},Object.entries(t.popoverData).map(([p,b],D)=>(0,e.jsx)("div",{css:
|
|
595
|
+
`]},Object.entries(t.popoverData).map(([p,b],D)=>(0,e.jsx)("div",{css:se,key:D},(0,e.jsx)("span",{css:ye},p,":"),b)))):null),(0,e.jsx)(s,{item:t})),(0,e.jsx)("div",{css:cr},t.editLink?typeof t.editLink=="string"?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ze(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:We},(0,e.jsx)("span",{css:se},"Edit"),r?(0,e.jsx)(F,{src:r,css:ir,alt:"Logo"}):null):t.editLink:null,(0,e.jsx)("button",{type:"button",onClick:()=>{n(t)},css:We},(0,e.jsx)("span",{css:se},"Unlink"),(0,e.jsx)(pr.Icon,{icon:Ze.CgClose,iconColor:"red",size:16})))))}function Wo({item:t}){let n=null;return t.previewUrl&&typeof t.previewUrl=="string"?t.type==="image"?n=(0,e.jsx)("img",{src:t.previewUrl,alt:t.id,width:"200",css:_e}):t.type==="video"&&(n=(0,e.jsx)("video",{src:t.previewUrl,title:t.id,width:"200",controls:!0,css:_e})):t.previewUrl&&typeof t.previewUrl!="string"&&(n=t.previewUrl),n||t.metadata?(0,e.jsx)("div",{css:dr},n?(0,e.jsx)("div",null,n):null,(0,e.jsx)("ul",null,t.metadata?Object.entries(t.metadata).map(([o,r])=>(0,e.jsx)("li",{css:[se,ce.css`
|
|
596
596
|
order: 1;
|
|
597
|
-
`],key:o},(0,e.jsx)("span",{css:[ye,
|
|
597
|
+
`],key:o},(0,e.jsx)("span",{css:[ye,ce.css`
|
|
598
598
|
order: 1;
|
|
599
|
-
`]},o,":"),r)):null,t.createdDate?(0,e.jsx)("li",{css:
|
|
599
|
+
`]},o,":"),r)):null,t.createdDate?(0,e.jsx)("li",{css:se},(0,e.jsx)("span",{css:ye},"Date:"),(0,to.format)(t.createdDate)):null)):null}H(A,require("@uniformdev/mesh-sdk"),module.exports);var m=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,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,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as y from"react";import{createContext as Nr,useContext as Qr,useState as Wr}from"react";var Be=Nr(void 0),Oe=({children:t})=>{let[n,o]=Wr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return e(Be.Provider,{value:r},t)},He=()=>{let t=Qr(Be);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function
|
|
1
|
+
var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as y from"react";import{createContext as Nr,useContext as Qr,useState as Wr}from"react";var Be=Nr(void 0),Oe=({children:t})=>{let[n,o]=Wr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return e(Be.Provider,{value:r},t)},He=()=>{let t=Qr(Be);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function wn(){let{location:t}=He();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}import{initializeUniformMeshSDK as _r}from"@uniformdev/mesh-sdk";import{useEffect as Zr,useRef as Xr,useState as Fe}from"react";var xn=({autoResizingDisabled:t}={})=>{let[n,o]=Fe(),[r,a]=Fe(),i=Xr(!1);return Zr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"&&!i.current?(i.current=!0,_r({autoResizingDisabled:t}).then(l=>{a(l)}).catch(l=>{o(l)}).finally(()=>{i.current=!1})):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as qr,useContext as Yr}from"react";import{Theme as Jr}from"@uniformdev/design-system";var $e=qr(void 0),Vn=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e($e.Provider,{value:n},e(Jr,null),e(Oe,null,t))},Ke=()=>{let t=Yr($e);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Un(){let{sdk:t}=Ke();return t}import ao,{useMemo as se,useContext as io}from"react";import{css as jr}from"@emotion/react";import{Icon as eo,InputSelect as to}from"@uniformdev/design-system";import{CgClose as ro}from"react-icons/cg";import Ne from"react";var Qe=({value:t,text:n,loading:o})=>e(Ne.Fragment,null,!!n&&n,!n&&e(Ne.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));import{css as he}from"@emotion/react";var We=he`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -15,9 +15,9 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
15
15
|
border-left: 1px solid var(--gray-300);
|
|
16
16
|
background: var(--gray-100);
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
|
-
`;var Xe=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:i,onRemove:l})=>{var f;let g=(f=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?f:[],u=(s,p)=>{s.preventDefault(),l(p)};return e("div",null,e(
|
|
18
|
+
`;var Xe=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:i,onRemove:l})=>{var f;let g=(f=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?f:[],u=(s,p)=>{s.preventDefault(),l(p)};return e("div",null,e(to,{id:t,name:t,label:n,onChange:s=>i(s.target.value),disabled:o,options:[{value:"",label:"Add..."},...g.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(r)&&r.length>0?jr`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),r==null?void 0:r.map(s=>{var p;return e("div",{css:We,key:s},e("span",{css:_e},e(Qe,{value:s,loading:o,text:(p=a.find(h=>h.id===s))==null?void 0:p.name})),e("button",{css:Ze,title:"remove",onClick:h=>u(h,s)},e(
|
|
20
|
+
`:""}),r==null?void 0:r.map(s=>{var p;return e("div",{css:We,key:s},e("span",{css:_e},e(Qe,{value:s,loading:o,text:(p=a.find(h=>h.id===s))==null?void 0:p.name})),e("button",{css:Ze,title:"remove",onClick:h=>u(h,s)},e(eo,{icon:ro,iconColor:"currentColor",size:20})))}))};var oo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ae=oo;var no=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),ie=no;import{useAsyncFn as so,useDebounce as co}from"react-use";import{Input as qe,InputSelect as ce,mq as de}from"@uniformdev/design-system";import{css as P}from"@emotion/react";var Ye={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},aa=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:g,onGetProducts:u,sortOptions:f,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:h="Brand",disableBrands:E,restrictToSingleCategory:_=!1})=>{var R,m,I;let S=async c=>{n({...Ye,...t||{},...c})},b=se(()=>({...Ye,...t||{}}),[t]),[Z,J]=so(async c=>await u(c),[u]);co(async()=>{await J({brand:b.brand,categories:b.categories,keyword:b.keyword,sort:b.sort,sortOrder:b.sortOrder,count:b.count})},250,[b]);let V=se(()=>{let c=[];return r==null||r.forEach(T=>{let w=je(T,void 0);c.push(...w)}),c},[r]),B=se(()=>[{value:"",label:"All categories"},...V.map(c=>({label:c.name,value:c.id}))],[V]),A=se(()=>(o==null?void 0:o.map(c=>({id:c.id.toString(),name:c.name})))||[],[o]),j=c=>{if(!c)return;let T=(t==null?void 0:t.categories)||[];S({categories:[...T,c]})},oe=c=>{var T;S({categories:(T=t==null?void 0:t.categories)==null?void 0:T.filter(w=>w!==c)})},$=c=>{S({brand:c.target.value})},D=c=>{S({count:c||1})};return a?e("div",null,"Loading..."):e(et.Provider,{value:{categories:r,logoIcon:g}},e("div",{css:P`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
@@ -88,7 +88,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
88
88
|
`}):e(ie,{css:P`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`}))}var et=
|
|
91
|
+
`}))}var et=ao.createContext(void 0),tt=()=>{let t=io(et);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function z({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?e(r,{className:o}):e("img",{src:t,alt:n,className:o})}import{css as mt}from"@emotion/react";import{scrollbarStyles as lo}from"@uniformdev/design-system";import{css as U}from"@emotion/react";var ot=U`
|
|
92
92
|
align-items: center;
|
|
93
93
|
background: var(--white);
|
|
94
94
|
border-radius: var(--rounded-base);
|
|
@@ -145,7 +145,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
145
145
|
`},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[mt`
|
|
146
146
|
max-height: 24rem;
|
|
147
147
|
overflow-x: auto;
|
|
148
|
-
`,
|
|
148
|
+
`,lo]},t==null?void 0:t.map((r,a)=>{var g,u;let[i]=(r==null?void 0:r.categories)||[],l=typeof i=="undefined"||!n||(g=n.find(f=>f.id===i.id))==null?void 0:g.name;return e("li",{key:`product-${r.id}`,css:it},e("div",{css:st},r.thumbnailUrl?e("img",{src:r.thumbnailUrl,alt:typeof r.title=="string"?r.title:r.name||`Product ${a}`,css:ct}):e("div",{css:dt}),e("h4",{css:lt},r.title||r.name,l&&e("span",{css:pt},l)),r&&e(y.Fragment,null,e("p",{css:be},"SKU: ",r.sku||r.id,e("br",null)),r.price!==void 0?e("p",{css:be},"Price: ",r.price):null,r.editLink||r.url?e("a",{css:ot,href:(u=r.editLink)!=null?u:r.url,title:`Go to ${r.title||r.name}`,target:"_blank",rel:"noopener noreferrer"},e("span",{css:nt},"Edit"),o?e(z,{src:o,alt:"Logo",css:at}):null):null)))})))};import Yo,{useContext as Jo,useMemo as jo,useRef as en}from"react";import*as k from"react";var ye={};Kr(ye,{Caution:()=>ut,Checkmark:()=>le,ChevronDown:()=>pe,Close:()=>gt,Danger:()=>ft,ExclamationPoint:()=>vt,Info:()=>me,Lightbulb:()=>ht,MagnifyingGlass:()=>bt,MaximizeAlt:()=>yt,Minus:()=>ie,MoreVerticalAlt:()=>te,Plus:()=>ae});var po=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),ut=po;var mo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),le=mo;var uo=t=>e("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},e("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),pe=uo;var go=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},e("g",{fillRule:"evenodd"},e("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),e("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),gt=go;var fo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),ft=fo;var vo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),vt=vo;var ho=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),e("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),me=ho;var bo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),ht=bo;var yo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),e("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),bt=yo;var So=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),yt=So;var wo=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),te=wo;import{useThrottle as zo}from"react-use";import{v4 as Uo}from"uuid";import Po,{useState as Lo,useRef as It,useEffect as Ro}from"react";function ue(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as xo}from"timeago.js";import{css as M}from"@emotion/react";import{mq as Co}from"@uniformdev/design-system";var St=M`
|
|
149
149
|
border: 1px solid var(--gray-200);
|
|
150
150
|
background: var(--gray-50);
|
|
151
151
|
border-radius: var(--rounded-base);
|
|
@@ -193,7 +193,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
gap: var(--spacing-sm);
|
|
195
195
|
|
|
196
|
-
${
|
|
196
|
+
${Co("md")} {
|
|
197
197
|
flex-direction: row;
|
|
198
198
|
min-width: 200px;
|
|
199
199
|
justify-content: end;
|
|
@@ -213,23 +213,23 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
213
213
|
&:hover {
|
|
214
214
|
background: var(--gray-50);
|
|
215
215
|
}
|
|
216
|
-
`;import{css as H}from"@emotion/react";import{Icon as Et}from"@uniformdev/design-system";import{CgClose as
|
|
216
|
+
`;import{css as H}from"@emotion/react";import{Icon as Et}from"@uniformdev/design-system";import{CgClose as ko,CgInfo as Io}from"react-icons/cg";var Tt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var f;let a=It(null),i=It(null),[l,g]=Lo(!1);Ro(()=>{let s=h=>{a.current&&!a.current.contains(h.target)&&i.current&&!i.current.contains(h.target)&&g(!1)},p=()=>{g(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[i]);let u=()=>{var s;if(g(!l),i.current&&a.current){let p=(s=a==null?void 0:a.current)==null?void 0:s.getBoundingClientRect(),h=i.current.offsetWidth;i.current.style.top=`${p.top+30}px`,i.current.style.left=`${p.left-h+30}px`}};return e("div",{css:St,key:t.id},e("div",{css:wt},e("div",{css:Ct},e("div",{css:Pt},e("h4",{css:[Lt,t.popoverData?H`
|
|
217
217
|
margin-bottom: var(--spacing-sm);
|
|
218
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(
|
|
218
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(Po.Fragment,null,e("button",{type:"button",ref:a,css:H`
|
|
219
219
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
220
|
-
`,"aria-controls":"path-details","aria-expanded":l,onClick:u},e(Et,{icon:
|
|
220
|
+
`,"aria-controls":"path-details","aria-expanded":l,onClick:u},e(Et,{icon:Io,iconColor:"gray",size:24,css:H`
|
|
221
221
|
opacity: var(--opacity-75);
|
|
222
222
|
`})),e("div",{id:"path-details","aria-hidden":!l,ref:i,css:[xt,l?H`
|
|
223
223
|
visibility: visible;
|
|
224
224
|
`:H`
|
|
225
225
|
visibility: hidden;
|
|
226
|
-
`]},Object.entries(t.popoverData).map(([s,p],h)=>e("div",{css:N,key:h},e("span",{css:re},s,":"),p)))):null),t.createdDate&&e("div",{css:N},e("span",{css:re},"Created:"),
|
|
226
|
+
`]},Object.entries(t.popoverData).map(([s,p],h)=>e("div",{css:N,key:h},e("span",{css:re},s,":"),p)))):null),t.createdDate&&e("div",{css:N},e("span",{css:re},"Created:"),xo((f=t.createdDate)!=null?f:0)),t.metadata?Object.entries(t.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>e("div",{css:[N,H`
|
|
227
227
|
order: 1;
|
|
228
228
|
`],key:s},e("span",{css:re},s,":"),p)):null,t.metadata?Object.entries(t.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>e("div",{css:[N,H`
|
|
229
229
|
order: 1;
|
|
230
230
|
`],key:s},e("span",{css:[re,H`
|
|
231
231
|
order: 1;
|
|
232
|
-
`]},s,":"),p)):null),e("div",{css:kt},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(ue(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:Se},e("span",{css:N},"Edit"),e(z,{src:n,css:Rt,alt:"Logo"})):null,e("button",{type:"button",onClick:()=>{o(t)},css:Se},e("span",{css:N},"Unlink"),e(Et,{icon:
|
|
232
|
+
`]},s,":"),p)):null),e("div",{css:kt},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(ue(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:Se},e("span",{css:N},"Edit"),e(z,{src:n,css:Rt,alt:"Logo"})):null,e("button",{type:"button",onClick:()=>{o(t)},css:Se},e("span",{css:N},"Unlink"),e(Et,{icon:ko,iconColor:"red",size:16})))))};import Eo,{useState as To,useRef as Gt,useEffect as Mo}from"react";import{css as Q}from"@emotion/react";var Mt=Q`
|
|
233
233
|
cursor: pointer;
|
|
234
234
|
padding: var(--spacing-sm);
|
|
235
235
|
position: relative;
|
|
@@ -260,11 +260,11 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
260
260
|
`,Ut=Q`
|
|
261
261
|
position: absolute;
|
|
262
262
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
263
|
-
`;import{css as At}from"@emotion/react";var Bt=({result:t,isSelected:n,triggerSelection:o})=>{let r=Gt(null),a=Gt(null),[i,l]=
|
|
263
|
+
`;import{css as At}from"@emotion/react";var Bt=({result:t,isSelected:n,triggerSelection:o})=>{let r=Gt(null),a=Gt(null),[i,l]=To(!1);Mo(()=>{function u(f){r.current&&!r.current.contains(f.target)&&a.current&&!a.current.contains(f.target)&&l(!1)}return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]);let g=u=>{u.stopPropagation(),l(!i)};return e("div",{key:t.id,css:[Mt,n?Dt:void 0,t.popoverData?Vt:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(Eo.Fragment,null,e("button",{type:"button",ref:r,css:Ut,"aria-controls":"path-details",onClick:u=>g(u),"aria-expanded":i},e(me,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!i,ref:a,css:[zt,i?At`
|
|
264
264
|
visibility: visible;
|
|
265
265
|
`:At`
|
|
266
266
|
visibility: hidden;
|
|
267
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)),Object.entries(t.popoverData).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)))):null)};import{Droppable as
|
|
267
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)),Object.entries(t.popoverData).map(([u,f],s)=>e("div",{css:we,key:s},e("span",{css:Ce},u,":"),f)))):null)};import{Droppable as Go,DragDropContext as Ao,Draggable as Bo}from"react-beautiful-dnd";import{css as C}from"@emotion/react";var Ot=C`
|
|
268
268
|
background: var(--white);
|
|
269
269
|
border: 1px solid var(--gray-300);
|
|
270
270
|
border-radius: var(--rounded-base);
|
|
@@ -311,7 +311,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
311
311
|
& > :not(:last-child) {
|
|
312
312
|
border-bottom: 1px solid var(--gray-200);
|
|
313
313
|
}
|
|
314
|
-
`,
|
|
314
|
+
`,si=C`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
317
|
`,Qt=C`
|
|
@@ -327,7 +327,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[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
|
+
`,ci=C`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
333
|
`,_t=C`
|
|
@@ -352,7 +352,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
352
352
|
`,Le=C`
|
|
353
353
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
354
354
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
355
|
-
`;import{css as G}from"@emotion/react";import{InputSelect as
|
|
355
|
+
`;import{css as G}from"@emotion/react";import{InputSelect as Oo,scrollbarStyles as Ho,Button as Re,Callout as Fo,InputKeywordSearch as $o,LoadingIndicator as Ko,Menu as No,MenuItem as Qo,LoadingOverlay as Wo}from"@uniformdev/design-system";import{useState as Vo,useEffect as qt,useRef as Do}from"react";function Yt(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,a]=Vo("IDLE"),i=Do(void 0);return qt(()=>{t&&r==="IDLE"&&(clearTimeout(i.current),i.current=setTimeout(()=>{if(!t)return a("IDLE");i.current=setTimeout(()=>{a("EXPIRE")},o),a("DISPLAY")},n),a("DELAY")),!t&&r!=="DISPLAY"&&(clearTimeout(i.current),a("IDLE"))},[t,r,n,o]),qt(()=>()=>clearTimeout(i.current),[]),r==="DISPLAY"||r==="EXPIRE"}var _o=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&n!=="any"&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Fo,{type:"info"},o)},Jt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:i,multiSelect:l,multiSelectId:g,rowComponent:u,selectedItemComponent:f,totalResults:s,cursor:p,resultsLoading:h,requireContentType:E,onAddNew:_,onEditClosed:S,onCancel:b,noResultsComponent:Z,helpComponent:J,onSort:V,typeSelectorLabel:B="Content Type Select",typeSelectorAllTypesOptionText:A="All content types",loadingIndicatorDelay:j=1e3})=>{var Ue,Ge,Ae;let $=()=>E?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[D,R]=k.useState(""),[m,I]=k.useState($),[c,T]=k.useState(!1),[w,K]=k.useState([]),[Ir,Me]=k.useState(!1),ve=k.useRef(`x${Uo()}`),ne=zo(D,750);k.useEffect(()=>{t(ne,{count:5,offset:0,contentType:m==="any"?void 0:m})},[ne,m]);let Er=Yt(h,{delay:j}),Tr=d=>{w.some(v=>v.id===d.id)?K(v=>v.filter(O=>O.id!==d.id)):K(l?v=>[...v,d]:[d])},Mr=r==null?void 0:r.map(d=>d.id+d.title).join(",");k.useEffect(()=>{Array.isArray(r)&&K(r)},[Mr]);let Vr=()=>{I($()),R(""),K(r!=null&&r.length?r:[])},Dr=()=>{T(d=>!d),c||Vr()},Ve=d=>{let v=(w==null?void 0:w.filter(O=>O.id!==d.id))||[];K(v),i(v,"")},zr=d=>{d.preventDefault(),i(w,m),T(!1)},Ur=d=>{d.preventDefault(),T(!1),b&&b()},Gr=()=>{t(ne,{count:5,offset:(n==null?void 0:n.length)||0,contentType:m==="any"?void 0:m,cursor:p}),Me(!0);let d=setTimeout(()=>{Me(!1)},750);return()=>clearTimeout(d)},Ar=!(r==null?void 0:r.length)||l,Br=u||Bt,De=f||Tt,Or=Z||_o,ze=a&&typeof a!="string"?a:null,Hr=ze?e(ze,{css:Le}):e("img",{src:a,alt:"Logo",css:Le}),Fr=d=>{var v,O;if(d.destination&&d.source.droppableId===((v=d.destination)==null?void 0:v.droppableId)){let x=[...r||[]],[ee]=(O=x==null?void 0:x.splice(d.source.index,1))!=null?O:[];return x==null||x.splice(d.destination.index,0,ee),V&&(K(x),V==null||V(x)),x}};return e("div",{css:G`
|
|
356
356
|
width: 100%;
|
|
357
357
|
`},e("div",{css:G`
|
|
358
358
|
position: relative;
|
|
@@ -365,20 +365,20 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
365
365
|
display: flex;
|
|
366
366
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
367
367
|
margin-bottom: var(--spacing-base);
|
|
368
|
-
`},e(
|
|
368
|
+
`},e(Oo,{onChange:d=>I(d.target.value),value:m,label:B,showLabel:!1,options:[...E?[]:[{value:"any",label:A}],...o?o.map(d=>({value:d.id,label:d.name})):[]]}),e("div",{css:G`
|
|
369
369
|
flex-grow: 1;
|
|
370
|
-
`},e(
|
|
370
|
+
`},e($o,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:R,disabledFieldSubmission:!0,value:D}))),e("div",{css:[Nt,Ho],id:ve.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},e(Wo,{isActive:Er}),Array.isArray(n)&&n.length>0?n.map(d=>e(Br,{key:d.id,isSelected:w.some(v=>v.id===d.id),result:d,triggerSelection:()=>Tr(d)})):e(Or,{searchText:ne||D,selectedContentType:(Ge=(Ue=o==null?void 0:o.find(d=>d.id===m))==null?void 0:Ue.name)!=null?Ge:m}),!h&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{type:"button",css:Ft,onClick:Gr},Ir?e(Ko,null):"Load More")),e("div",{css:G`
|
|
371
371
|
display: flex;
|
|
372
372
|
justify-content: space-between;
|
|
373
|
-
`},e("div",null,_&&((Ae=o==null?void 0:o.length)!=null?Ae:0)>0?e(
|
|
373
|
+
`},e("div",null,_&&((Ae=o==null?void 0:o.length)!=null?Ae:0)>0?e(No,{menuLabel:"Add new menu",menuTrigger:e(Re,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(d=>e(Qo,{key:d.id,css:G`
|
|
374
374
|
background: var(--white);
|
|
375
375
|
color: var(--brand-secondary-1);
|
|
376
376
|
`,onClick:()=>_(d)},d.name))):null),e("div",{css:G`
|
|
377
377
|
display: flex;
|
|
378
378
|
gap: var(--spacing-base);
|
|
379
|
-
`},e(Re,{buttonType:"unimportant",onClick:Ur},"Cancel"),e(Re,{disabled:!w.length,onClick:zr,"data-test-id":"entry-accept-button"},"Accept"))))):null,c?null:l&&w.length>1?e(
|
|
379
|
+
`},e(Re,{buttonType:"unimportant",onClick:Ur},"Cancel"),e(Re,{disabled:!w.length,onClick:zr,"data-test-id":"entry-accept-button"},"Accept"))))):null,c?null:l&&w.length>1?e(Ao,{onDragEnd:d=>Fr(d)},e(Go,{droppableId:g||"canvas-multi-select"},d=>e("div",{...d.droppableProps,ref:d.innerRef,css:G`
|
|
380
380
|
margin-block: var(--spacing-sm) 0;
|
|
381
|
-
`},w==null?void 0:w.map((v,O)=>{if(v!=null&&v.id)return e(
|
|
381
|
+
`},w==null?void 0:w.map((v,O)=>{if(v!=null&&v.id)return e(Bo,{key:v.id,draggableId:v.id,index:O},x=>e("div",{css:_t,ref:x.innerRef,...x.draggableProps,...x.dragHandleProps},e("span",{css:Zt},e(te,{css:[Pe,Xt],width:24,height:24}),e(te,{css:Pe,width:24,height:24})),e(De,{key:`selected-item-${v.id}`,logoIcon:a,selectedItem:v,onDeselect:ee=>Ve(ee),onEditClosed:S?ee=>S(ee):void 0})))}),d.placeholder))):w==null?void 0:w.map(d=>e(De,{key:`selected-item-${d.id}`,logoIcon:a,selectedItem:d,onDeselect:v=>Ve(v),onEditClosed:S?v=>S(v):void 0}))))};import{css as W}from"@emotion/react";var jt=W`
|
|
382
382
|
cursor: pointer;
|
|
383
383
|
padding: var(--spacing-sm) 0;
|
|
384
384
|
margin-right: var(--spacing-sm);
|
|
@@ -480,7 +480,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
480
480
|
min-width: 200px;
|
|
481
481
|
justify-content: end;
|
|
482
482
|
}
|
|
483
|
-
`;import{css as X}from"@emotion/react";import{Icon as
|
|
483
|
+
`;import{css as X}from"@emotion/react";import{Icon as Zo,mq as Xo}from"@uniformdev/design-system";import{CgClose as qo}from"react-icons/cg";function gr({selectedItem:t,onDeselect:n}){var l;let{categories:o,logoIcon:r}=ge(),[a]=t.categories||[{id:"",name:""}],i=typeof a=="undefined"||!o||(l=o.find(g=>g.id===a.id))==null?void 0:l.name;return e("div",{css:[dr],key:t.id},e("article",{css:[lr]},e("div",{css:[pr]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:i,css:[xe],loading:"lazy"}):e("div",{css:[xe]}),e("div",{css:X`
|
|
484
484
|
> :not(:last-child) {
|
|
485
485
|
margin-bottom: var(--spacing-xs);
|
|
486
486
|
}
|
|
@@ -493,7 +493,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
493
493
|
`},i)),e("ul",{css:X`
|
|
494
494
|
font-size: var(--fs-sm);
|
|
495
495
|
|
|
496
|
-
${
|
|
496
|
+
${Xo("sm")} {
|
|
497
497
|
display: flex;
|
|
498
498
|
gap: var(--spacing-base);
|
|
499
499
|
}
|
|
@@ -501,7 +501,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
501
501
|
margin-right: var(--spacing-xs);
|
|
502
502
|
`},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:X`
|
|
503
503
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:ur},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:ke},e("span",{css:Ie},"Edit"),e(z,{src:r,alt:"Logo",css:mr})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:ke},e("span",{css:Ie},"Unlink"),e(
|
|
504
|
+
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:ur},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:ke},e("span",{css:Ie},"Edit"),e(z,{src:r,alt:"Logo",css:mr})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:ke},e("span",{css:Ie},"Unlink"),e(Zo,{icon:qo,iconColor:"red",size:16})))))}import{Callout as tn}from"@uniformdev/design-system";import{useAsync as rn,useAsyncFn as on}from"react-use";function ji({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:g,rowComponent:u,errorComponent:f,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:E="All categories",typeSelectorLabel:_="Select Category"}){var $,D;let{value:S,loading:b,error:Z}=rn(async()=>await o(),[o]),J=S==null?void 0:S.map(R=>R.id).join(","),V=jo(()=>S?S.map(m=>({id:m.id,name:m.name})):void 0,[J]),B=en(),[A,j]=on(async(R,m)=>{let I=await r({text:R,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&&(B.current=[]),(B.current=B.current||[]).push(...I.products),I},[r]),oe=async R=>{await n(R)};return Z||A.error?e(f||(({categoriesError:m,searchError:I})=>e(tn,{type:"error"},"There was an error: ",(m==null?void 0:m.message)||(I==null?void 0:I.message))),{categoriesError:Z,searchError:A.error}):e(fr.Provider,{value:{categories:S,logoIcon:a}},e(Jt,{search:j,results:B.current,logoIcon:a,selectedItems:t,select:oe,multiSelectId:l||"product-search-multi-select",multiSelect:i,contentTypes:V,selectedItemComponent:g||gr,rowComponent:u||sr,totalResults:($=A.value)==null?void 0:$.total,cursor:(D=A.value)==null?void 0:D.cursor,resultsLoading:A.loading||b,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:E,typeSelectorLabel:_}))}var fr=Yo.createContext(void 0),ge=()=>{let t=Jo(fr);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};import{css as L}from"@emotion/react";import{mq as nn}from"@uniformdev/design-system";var vr=L`
|
|
505
505
|
border: 1px solid var(--gray-200);
|
|
506
506
|
background: var(--gray-50);
|
|
507
507
|
border-radius: var(--rounded-base);
|
|
@@ -550,7 +550,7 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
550
550
|
flex-direction: column;
|
|
551
551
|
gap: var(--spacing-sm);
|
|
552
552
|
|
|
553
|
-
${
|
|
553
|
+
${nn("md")} {
|
|
554
554
|
flex-direction: row;
|
|
555
555
|
justify-content: end;
|
|
556
556
|
min-width: 200px;
|
|
@@ -584,16 +584,16 @@ var $r=Object.defineProperty;var Kr=(t,n)=>{for(var o in n)$r(t,o,{get:n[o],enum
|
|
|
584
584
|
max-width: 100%;
|
|
585
585
|
min-width: 100px;
|
|
586
586
|
height: auto;
|
|
587
|
-
`;import
|
|
587
|
+
`;import an,{useState as sn,useRef as xr,useEffect as cn}from"react";import{CgInfo as dn,CgClose as ln}from"react-icons/cg";import{format as pn}from"timeago.js";import{css as Y}from"@emotion/react";import{Icon as kr}from"@uniformdev/design-system";function ms({selectedItem:t,onDeselect:n,onEditClosed:o,logoIcon:r,itemDetailsRendererComponent:a}){let i=xr(null),l=xr(null),[g,u]=sn(!1);cn(()=>{let p=E=>{i.current&&!i.current.contains(E.target)&&l.current&&!l.current.contains(E.target)&&u(!1)},h=()=>{u(!1)};return window.addEventListener("resize",h,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",h,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[l]);let f=()=>{var p;if(u(!g),l.current&&i.current){let h=(p=i==null?void 0:i.current)==null?void 0:p.getBoundingClientRect();l.current.style.top=`${h.top+30}px`}},s=a!=null?a:mn;return e("div",{css:[vr,Y`
|
|
588
588
|
margin: 0 0 1rem 0;
|
|
589
|
-
`],key:t.id},e("div",{css:hr},e("div",{css:br},e("div",{css:yr},e("h4",{css:[Sr],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?e(
|
|
589
|
+
`],key:t.id},e("div",{css:hr},e("div",{css:br},e("div",{css:yr},e("h4",{css:[Sr],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?e(an.Fragment,null,e("button",{type:"button",ref:i,css:Rr,"aria-controls":"path-details","aria-expanded":g,onClick:f},e(kr,{icon:dn,iconColor:"gray",size:24,css:Y`
|
|
590
590
|
opacity: var(--opacity-75);
|
|
591
591
|
`})),e("div",{id:"path-details","aria-hidden":!g,ref:l,css:[Cr,g?Y`
|
|
592
592
|
visibility: visible;
|
|
593
593
|
`:Y`
|
|
594
594
|
visibility: hidden;
|
|
595
|
-
`]},Object.entries(t.popoverData).map(([p,h],E)=>e("div",{css:q,key:E},e("span",{css:fe},p,":"),h)))):null),e(s,{item:t})),e("div",{css:Pr},t.editLink?typeof t.editLink=="string"?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ue(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:Ee},e("span",{css:q},"Edit"),r?e(z,{src:r,css:wr,alt:"Logo"}):null):t.editLink:null,e("button",{type:"button",onClick:()=>{n(t)},css:Ee},e("span",{css:q},"Unlink"),e(kr,{icon:
|
|
595
|
+
`]},Object.entries(t.popoverData).map(([p,h],E)=>e("div",{css:q,key:E},e("span",{css:fe},p,":"),h)))):null),e(s,{item:t})),e("div",{css:Pr},t.editLink?typeof t.editLink=="string"?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ue(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:Ee},e("span",{css:q},"Edit"),r?e(z,{src:r,css:wr,alt:"Logo"}):null):t.editLink:null,e("button",{type:"button",onClick:()=>{n(t)},css:Ee},e("span",{css:q},"Unlink"),e(kr,{icon:ln,iconColor:"red",size:16})))))}function mn({item:t}){let n=null;return t.previewUrl&&typeof t.previewUrl=="string"?t.type==="image"?n=e("img",{src:t.previewUrl,alt:t.id,width:"200",css:Te}):t.type==="video"&&(n=e("video",{src:t.previewUrl,title:t.id,width:"200",controls:!0,css:Te})):t.previewUrl&&typeof t.previewUrl!="string"&&(n=t.previewUrl),n||t.metadata?e("div",{css:Lr},n?e("div",null,n):null,e("ul",null,t.metadata?Object.entries(t.metadata).map(([o,r])=>e("li",{css:[q,Y`
|
|
596
596
|
order: 1;
|
|
597
597
|
`],key:o},e("span",{css:[fe,Y`
|
|
598
598
|
order: 1;
|
|
599
|
-
`]},o,":"),r)):null,t.createdDate?e("li",{css:q},e("span",{css:fe},"Date:"),
|
|
599
|
+
`]},o,":"),r)):null,t.createdDate?e("li",{css:q},e("span",{css:fe},"Date:"),pn(t.createdDate)):null)):null}export*from"@uniformdev/mesh-sdk";import{Button as ws,Callout as Cs,LoadingIndicator as Ps,LoadingOverlay as Ls,Menu as Rs,MenuItem as xs,Input as ks,InputSelect as Is,InputToggle as Es,Theme as Ts,InputKeywordSearch as Ms,Heading as Vs,ScrollableList as Ds,ScrollableListItem as zs,Textarea as Us,Switch as Gs,Label as As,AddListButton as Bs}from"@uniformdev/design-system";export{Bs as AddListButton,ws as Button,Cs as Callout,ms as DamSelectedItem,Bt as DefaultSearchRow,Tt as DefaultSelectedItem,Jt as EntrySearch,Vs as Heading,ye as Icons,ks as Input,Is as InputSelect,Es as InputToggle,Ms as KeywordSearchInput,As as Label,Ps as LoadingIndicator,Ls as LoadingOverlay,Rs as Menu,xs as MenuItem,rt as ProductPreviewList,aa as ProductQuery,et as ProductQueryContext,ji as ProductSearch,fr as ProductSearchContext,sr as ProductSearchRow,gr as ProductSelectedItem,Qe as ResolvableLoadingValue,Ds as ScrollableList,zs as ScrollableListItem,Xe as SelectionField,Gs as Switch,Us as Textarea,Ts as Theme,Be as UniformMeshLocationContext,Oe as UniformMeshLocationContextProvider,$e as UniformMeshSdkContext,Vn as UniformMeshSdkContextProvider,Le as badgeIcon,Te as damSelectItemImage,vr as damSelectedItemContainer,yr as damSelectedItemCopy,br as damSelectedItemDetails,wr as damSelectedItemIcon,Rr as damSelectedItemInfoBtn,hr as damSelectedItemInner,Ee as damSelectedItemLinkBtn,Pr as damSelectedItemLinkContainer,Lr as damSelectedItemMediaContainer,Cr as damSelectedItemPopover,fe as damSelectedItemPopoverLabel,q as damSelectedItemSmallText,Sr as damSelectedItemTitle,_t as draggableContainer,Pe as draggableIcon,Xt as draggableIconOffset,Zt as draggableIconWrapper,Ht as entrySearchBtn,$t as entrySearchConfig,Kt as entrySearchConfigHidden,Ft as entrySearchLoadMoreBtn,Nt as entrySearchResultList,Qt as entrySearchSelectIcon,Wt as entrySearchSelectImg,si as entrySearchSelectInput,ci as entrySearchSelectOption,Ot as entrySearchWrapper,ar as productSearchRowActiveIcon,or as productSearchRowCategory,jt as productSearchRowContainer,er as productSearchRowContent,tr as productSearchRowContentActive,nr as productSearchRowDetails,rr as productSearchRowTitle,dr as productSelectedItemContainer,pr as productSelectedItemContent,lr as productSelectedItemDetails,mr as productSelectedItemIcon,xe as productSelectedItemImage,ur as productSelectedItemLinkContainer,ke as productedSelectedItemLinkBtn,Ie as productedSelectedItemSmallText,Ut as searchRowBtn,Mt as searchRowContainer,Dt as searchRowContainerActive,Vt as searchRowContainerWithPopover,zt as searchRowPopover,Ce as searchRowText,we as searchRowTextSmall,Se as selectItemLinkBtn,kt as selectItemLinkContainer,xt as selectItemPopover,re as selectItemPopoverLabel,N as selectItemSmallText,St as selectedItemContainer,Pt as selectedItemCopy,Ct as selectedItemDetails,Rt as selectedItemIcon,wt as selectedItemInner,Lt as selectedItemTitle,xn as useInitializeUniformMeshSdk,tt as useProductQueryContext,ge as useProductSearchContext,wn as useUniformMeshLocation,He as useUniformMeshLocationContext,Un as useUniformMeshSdk,Ke as useUniformMeshSdkContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "16.2.1-
|
|
3
|
+
"version": "16.2.1-nuxt.274+0a8a48855",
|
|
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": "^16.2.1-
|
|
48
|
-
"@uniformdev/mesh-sdk": "^16.2.1-
|
|
47
|
+
"@uniformdev/design-system": "^16.2.1-nuxt.274+0a8a48855",
|
|
48
|
+
"@uniformdev/mesh-sdk": "^16.2.1-nuxt.274+0a8a48855",
|
|
49
49
|
"react-beautiful-dnd": "13.1.0",
|
|
50
50
|
"react-icons": "4.4.0",
|
|
51
51
|
"react-use": "17.4.0",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"react-dom": ">=16.8"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "7.18.
|
|
62
|
-
"@babel/preset-env": "7.18.
|
|
63
|
-
"@babel/preset-react": "7.
|
|
64
|
-
"@babel/preset-typescript": "7.
|
|
61
|
+
"@babel/core": "7.18.9",
|
|
62
|
+
"@babel/preset-env": "7.18.9",
|
|
63
|
+
"@babel/preset-react": "7.18.6",
|
|
64
|
+
"@babel/preset-typescript": "7.18.6",
|
|
65
65
|
"@emotion/babel-preset-css-prop": "11.2.0",
|
|
66
66
|
"@emotion/react": "11.9.3",
|
|
67
67
|
"@storybook/addon-controls": "6.5.9",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@storybook/addon-postcss": "2.0.0",
|
|
70
70
|
"@storybook/react": "6.5.9",
|
|
71
71
|
"@svgr/cli": "6.2.1",
|
|
72
|
-
"@types/react": "18.0.
|
|
72
|
+
"@types/react": "18.0.15",
|
|
73
73
|
"@types/react-beautiful-dnd": "13.1.2",
|
|
74
74
|
"@types/uuid": "8.3.4",
|
|
75
75
|
"react": "18.2.0",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "0a8a48855ef532336761a3872c3d515ab6b9113e"
|
|
86
86
|
}
|