@uniformdev/mesh-sdk-react 13.0.1-alpha.132 → 13.0.1-alpha.278
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/LICENSE.txt +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +18 -23
- package/dist/index.js +92 -97
- package/dist/index.mjs +18 -23
- package/package.json +13 -11
package/LICENSE.txt
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import React__default, { SVGProps } from 'react';
|
|
|
6
6
|
import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
|
|
7
7
|
import { TDate } from 'timeago.js';
|
|
8
8
|
import * as _emotion_react from '@emotion/react';
|
|
9
|
-
export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
9
|
+
export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Textarea, TextareaProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Provides convenient access to the current Uniform Mesh location via React hook.
|
package/dist/index.esm.js
CHANGED
|
@@ -20,7 +20,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
20
20
|
width: 1.25rem;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
display: block;
|
|
23
|
-
`,viewBox:"0 0 20 20",fill:"currentColor"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var ur=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"})),ee=ur;var gr=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"})),te=gr;import{useAsyncFn as hr,useDebounce as br}from"react-use";import{Input as Ue,InputSelect as pe,mq as re}from"@uniformdev/design-system";import{css as w}from"@emotion/react";var Ae={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Zo=({value:t,setValue:n,brands:o,categories:r,loading:c,categoriesLoading:d,brandsLoading:v,logoIcon:b,onGetProducts:h,sortOptions:u,sortOrderOptions:s})=>{var I;let g=async i=>{n({...Ae,...t||{},...i})},f=le(()=>({...Ae,...t||{}}),[t]),[H,
|
|
23
|
+
`,viewBox:"0 0 20 20",fill:"currentColor"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var ur=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"})),ee=ur;var gr=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"})),te=gr;import{useAsyncFn as hr,useDebounce as br}from"react-use";import{Input as Ue,InputSelect as pe,mq as re}from"@uniformdev/design-system";import{css as w}from"@emotion/react";var Ae={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Zo=({value:t,setValue:n,brands:o,categories:r,loading:c,categoriesLoading:d,brandsLoading:v,logoIcon:b,onGetProducts:h,sortOptions:u,sortOrderOptions:s})=>{var I;let g=async i=>{n({...Ae,...t||{},...i})},f=le(()=>({...Ae,...t||{}}),[t]),[H,M]=hr(async i=>await h(i),[h]);br(async()=>{await M({brand:f.brand,categories:f.categories,keyword:f.keyword,sort:f.sort,sortOrder:f.sortOrder,count:f.count})},250,[f]);let F=le(()=>{let i=[];return r==null||r.forEach(m=>{let T=Oe(m,void 0);i.push(...T)}),i},[r]),G=le(()=>(o==null?void 0:o.map(i=>({id:i.id.toString(),name:i.name})))||[],[o]),z=i=>{let m=(t==null?void 0:t.categories)||[];g({categories:[...m,i]})},A=i=>{var m;g({categories:(m=t==null?void 0:t.categories)==null?void 0:m.filter(T=>T!==i)})},J=i=>{g({brand:i.target.value})},E=i=>{g({count:i||1})};return c?e("div",null,"Loading..."):e(He.Provider,{value:{categories:r,logoIcon:b}},e("div",{css:w`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
@@ -150,7 +150,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
150
150
|
`},"Edit"),o?e(U,{src:o,alt:"Logo",css:C`
|
|
151
151
|
width: 2.25rem;
|
|
152
152
|
height: 2.25rem;
|
|
153
|
-
`}):null))))})))};import jr,{useContext as eo,useMemo as to,useRef as ro}from"react";import*as
|
|
153
|
+
`}):null))))})))};import jr,{useContext as eo,useMemo as to,useRef as ro}from"react";import*as L from"react";var me={};or(me,{Caution:()=>Qe,Checkmark:()=>oe,ChevronDown:()=>ne,Close:()=>K,Danger:()=>Ne,ExclamationPoint:()=>_e,Info:()=>Q,Lightbulb:()=>Ze,MagnifyingGlass:()=>qe,MaximizeAlt:()=>We,Minus:()=>te,MoreVerticalAlt:()=>W,Plus:()=>ee});var Sr=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"})),Qe=Sr;var wr=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"})),oe=wr;var Cr=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"})),ne=Cr;var Pr=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"}))),K=Pr;var Rr=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"})),Ne=Rr;var kr=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"})),_e=kr;var xr=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"})),Q=xr;var Lr=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"})),Ze=Lr;var Mr=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"})))),qe=Mr;var Vr=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"})),We=Vr;var Er=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"})),W=Er;import{useThrottle as Or}from"react-use";import{v4 as Hr}from"uuid";import Tr,{useState as Dr,useRef as it,useEffect as Gr}from"react";function Je(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as zr}from"timeago.js";import{css as x}from"@emotion/react";import{mq as Ir}from"@uniformdev/design-system";var Xe=x`
|
|
154
154
|
border: 1px solid var(--gray-200);
|
|
155
155
|
background: var(--gray-50);
|
|
156
156
|
border-radius: var(--rounded-base);
|
|
@@ -272,7 +272,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
272
272
|
border: 1px solid var(--gray-300);
|
|
273
273
|
border-radius: var(--rounded-base);
|
|
274
274
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
275
|
-
margin-
|
|
275
|
+
margin-bottom: var(--spacing-base);
|
|
276
276
|
`,vt=S`
|
|
277
277
|
align-items: center;
|
|
278
278
|
display: flex;
|
|
@@ -302,14 +302,9 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
302
302
|
border: 1px solid var(--gray-300);
|
|
303
303
|
border-radius: var(--rounded-base);
|
|
304
304
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
305
|
+
display: block;
|
|
305
306
|
`,yt=S`
|
|
306
|
-
|
|
307
|
-
position: absolute;
|
|
308
|
-
padding: 0;
|
|
309
|
-
clip: rect(0, 0, 0, 0);
|
|
310
|
-
height: 1px;
|
|
311
|
-
width: 1px;
|
|
312
|
-
overflow: hidden;
|
|
307
|
+
display: none;
|
|
313
308
|
`,St=S`
|
|
314
309
|
overflow-y: auto;
|
|
315
310
|
max-height: 16rem;
|
|
@@ -359,37 +354,37 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
359
354
|
`,he=S`
|
|
360
355
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
361
356
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
362
|
-
`;import{css as
|
|
357
|
+
`;import{css as V}from"@emotion/react";import{InputSelect as Qr,scrollbarStyles as Nr,Button as be,Callout as _r,InputKeywordSearch as Zr,LoadingIndicator as xt,Menu as qr,MenuItem as Wr}from"@uniformdev/design-system";var Jr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(_r,{type:"info"},o)},Lt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:c,select:d,multiSelect:v,multiSelectId:b,rowComponent:h,selectedItemComponent:u,totalResults:s,resultsLoading:g,requireContentType:f,onAddNew:H,onEditClosed:M,onCancel:F,noResultsComponent:G,helpComponent:z,onSort:A})=>{var Re,ke,xe;let E=()=>f?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[I,i]=L.useState(""),[m,T]=L.useState(E),[_,ce]=L.useState(!1),[X,Y]=L.useState([]),[Kt,Se]=L.useState(!1),j=Or(I,750);L.useEffect(()=>{t(j,{count:5,offset:0,contentType:m==="any"?void 0:m})},[j,m]);let Qt=a=>{X.includes(a.id)?Y(y=>y.filter($=>$!==a.id)):Y(v?y=>[...y,a==null?void 0:a.id]:[a.id])},Nt=()=>{T(E()),i(""),Y(r!=null&&r.length?r.map(a=>a.id):[])},_t=()=>{ce(a=>!a),_||Nt()},we=a=>{d((r==null?void 0:r.filter(y=>y.id!==a.id).map(y=>y.id))||[],"")},Zt=a=>{a.preventDefault(),d(X,m),ce(!1)},qt=a=>{a.preventDefault(),ce(!1),F&&F()},Wt=a=>{a.preventDefault(),t(j,{count:5,offset:(n==null?void 0:n.length)||0,contentType:m==="any"?void 0:m}),Se(!0);let y=setTimeout(()=>{Se(!1)},750);return()=>clearTimeout(y)},de=L.useRef(Hr()),Jt=!(r==null?void 0:r.length)||v,Xt=h||gt,Ce=u||st,Yt=G||Jr,Pe=c&&typeof c!="string"?c:null,jt=Pe?e(Pe,{css:he}):e("img",{src:c,alt:"CMS logo",css:he}),er=a=>{var y,$;if(a.destination&&a.source.droppableId===((y=a.destination)==null?void 0:y.droppableId)){let R=[...r||[]],[Z]=($=R==null?void 0:R.splice(a.source.index,1))!=null?$:[];return R==null||R.splice(a.destination.index,0,Z),A==null||A(R.map(tr=>tr.id)),R}};return e("div",{css:V`
|
|
363
358
|
width: 100%;
|
|
364
|
-
`},e("div",{css:
|
|
359
|
+
`},e("div",{css:V`
|
|
365
360
|
position: relative;
|
|
366
361
|
margin-block: var(--spacing-base);
|
|
367
|
-
`},Jt&&e(
|
|
362
|
+
`},Jt&&e(L.Fragment,null,e("div",{css:ft,"data-test-id":"component-search"},e("button",{css:vt,onClick:_t,type:"button","aria-haspopup":!0,"aria-expanded":_,"aria-controls":`entry-search-config-${de.current}`},jt,e("span",{css:V`
|
|
368
363
|
margin-left: var(--spacing-base);
|
|
369
|
-
`},"Select"),e("span",{css:wt},e(ne,{css:[Ct,_?
|
|
364
|
+
`},"Select"),e("span",{css:wt},e(ne,{css:[Ct,_?V`
|
|
370
365
|
transform: rotate(180deg);
|
|
371
|
-
`:void 0]})))),e("div",{id:`entry-search-config-${de.current}`,"aria-hidden":!_,css:[bt,_?void 0:yt]},z||null,e("div",{css:
|
|
366
|
+
`:void 0]})))),e("div",{id:`entry-search-config-${de.current}`,"aria-hidden":!_,css:[bt,_?void 0:yt]},z||null,e("div",{css:V`
|
|
372
367
|
display: flex;
|
|
373
368
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
374
369
|
margin-bottom: var(--spacing-base);
|
|
375
|
-
`},e(Qr,{onChange:a=>T(a.target.value),value:m,label:"Content Type Select",showLabel:!1,options:[...f?[]:[{value:"any",label:"All content types"}],...o?o.map(a=>({value:a.id,label:a.name})):[]]}),e("div",{css:
|
|
370
|
+
`},e(Qr,{onChange:a=>T(a.target.value),value:m,label:"Content Type Select",showLabel:!1,options:[...f?[]:[{value:"any",label:"All content types"}],...o?o.map(a=>({value:a.id,label:a.name})):[]]}),e("div",{css:V`
|
|
376
371
|
flex-grow: 1;
|
|
377
|
-
`},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:i,disabledFieldSubmission:!0,value:I}))),e("div",{css:[St,Nr],id:de.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(a=>e(Xt,{key:a.id,isSelected:X.includes(a.id),result:a,triggerSelection:()=>Qt(a)})):g?null:e(Yt,{searchText:j||I,selectedContentType:(ke=(Re=o==null?void 0:o.find(a=>a.id===m))==null?void 0:Re.name)!=null?ke:m}),!g&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{css:ht,onClick:Wt},Kt?e(xt,null):"Load More"),g&&!(n!=null&&n.length)?e("div",{css:
|
|
372
|
+
`},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:i,disabledFieldSubmission:!0,value:I}))),e("div",{css:[St,Nr],id:de.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(a=>e(Xt,{key:a.id,isSelected:X.includes(a.id),result:a,triggerSelection:()=>Qt(a)})):g?null:e(Yt,{searchText:j||I,selectedContentType:(ke=(Re=o==null?void 0:o.find(a=>a.id===m))==null?void 0:Re.name)!=null?ke:m}),!g&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{css:ht,onClick:Wt},Kt?e(xt,null):"Load More"),g&&!(n!=null&&n.length)?e("div",{css:V`
|
|
378
373
|
padding: var(--spacing-base);
|
|
379
374
|
text-align: center;
|
|
380
375
|
width: 100%;
|
|
381
|
-
`},e(xt,null)):null),e("div",{css:
|
|
376
|
+
`},e(xt,null)):null),e("div",{css:V`
|
|
382
377
|
display: flex;
|
|
383
378
|
justify-content: space-between;
|
|
384
|
-
`},e("div",null,H&&((xe=o==null?void 0:o.length)!=null?xe:0)>0?e(qr,{menuLabel:"Add new menu",menuTrigger:e(be,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(a=>e(Wr,{key:a.id,css:
|
|
379
|
+
`},e("div",null,H&&((xe=o==null?void 0:o.length)!=null?xe:0)>0?e(qr,{menuLabel:"Add new menu",menuTrigger:e(be,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(a=>e(Wr,{key:a.id,css:V`
|
|
385
380
|
background: var(--white);
|
|
386
381
|
color: var(--brand-secondary-1);
|
|
387
|
-
`,onClick:()=>H(a)},a.name))):null),e("div",{css:
|
|
382
|
+
`,onClick:()=>H(a)},a.name))):null),e("div",{css:V`
|
|
388
383
|
display: flex;
|
|
389
384
|
gap: var(--spacing-base);
|
|
390
|
-
`},e(be,{buttonType:"unimportant",onClick:qt},"Cancel"),e(be,{disabled:!X.length,onClick:Zt,"data-test-id":"entry-accept-button"},"Accept"))))),v?e($r,{onDragEnd:a=>er(a)},e(Fr,{droppableId:b||"canvas-multi-select"},a=>e("div",{...a.droppableProps,ref:a.innerRef,css:
|
|
385
|
+
`},e(be,{buttonType:"unimportant",onClick:qt},"Cancel"),e(be,{disabled:!X.length,onClick:Zt,"data-test-id":"entry-accept-button"},"Accept"))))),v?e($r,{onDragEnd:a=>er(a)},e(Fr,{droppableId:b||"canvas-multi-select"},a=>e("div",{...a.droppableProps,ref:a.innerRef,css:V`
|
|
391
386
|
margin-block: var(--spacing-sm) 0;
|
|
392
|
-
`},r==null?void 0:r.map((y,$)=>{if(y!=null&&y.id)return e(Kr,{key:y.id,draggableId:y.id,index:$},R=>e("div",{css:Pt,ref:R.innerRef,...R.draggableProps,...R.dragHandleProps},e("span",{css:Rt},e(W,{css:[ve,kt],width:24,height:24}),e(W,{css:ve,width:24,height:24})),e(Ce,{key:`selected-item-${y.id}`,logoIcon:c,selectedItem:y,onDeselect:Z=>we(Z),onEditClosed:
|
|
387
|
+
`},r==null?void 0:r.map((y,$)=>{if(y!=null&&y.id)return e(Kr,{key:y.id,draggableId:y.id,index:$},R=>e("div",{css:Pt,ref:R.innerRef,...R.draggableProps,...R.dragHandleProps},e("span",{css:Rt},e(W,{css:[ve,kt],width:24,height:24}),e(W,{css:ve,width:24,height:24})),e(Ce,{key:`selected-item-${y.id}`,logoIcon:c,selectedItem:y,onDeselect:Z=>we(Z),onEditClosed:M?Z=>M(Z):void 0})))}),a.placeholder))):r==null?void 0:r.map(a=>e(Ce,{key:`selected-item-${a.id}`,logoIcon:c,selectedItem:a,onDeselect:y=>we(y),onEditClosed:M?y=>M(y):void 0}))))};import{css as O}from"@emotion/react";var Mt=O`
|
|
393
388
|
cursor: pointer;
|
|
394
389
|
padding: var(--spacing-sm) 0;
|
|
395
390
|
margin-right: var(--spacing-sm);
|
|
@@ -519,4 +514,4 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
519
514
|
font-size: var(--fs-sm);
|
|
520
515
|
`},"Unlink"),e(K,{css:P`
|
|
521
516
|
color: var(--brand-secondary-5);
|
|
522
|
-
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:
|
|
517
|
+
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:M}=Ft(async()=>{if(!t)return;let i=await o({ids:t});return Array.isArray(i)?i:void 0},[o,t]),F=to(()=>s?s.map(m=>({id:m.id,name:m.name})):void 0,[s]),G=ro(),[z,A]=no(async(i,m)=>{let T=await c({text:i,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(G.current=[]),(G.current=G.current||[]).push(...T.products),T},[c]),J=async i=>{i&&await n(i)};return g?e(oo,null):f||M||z.error?e("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(M==null?void 0:M.message)||((E=z.error)==null?void 0:E.message)):e($t.Provider,{value:{categories:s,logoIcon:d}},e(Lt,{search:A,results:G.current,logoIcon:d,selectedItems:H,select:J,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:F,selectedItemComponent:h||Ht,rowComponent:u||Ut,totalResults:(I=z.value)==null?void 0:I.total,resultsLoading:z.loading}))}var $t=jr.createContext(void 0),ie=()=>{let t=eo($t);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Na,Callout as _a,LoadingIndicator as Za,LoadingOverlay as qa,Menu as Wa,MenuItem as Ja,Input as Xa,InputSelect as Ya,InputToggle as ja,Theme as ei,InputKeywordSearch as ti,Heading as ri,ScrollableList as oi,ScrollableListItem as ni,Textarea as ai}from"@uniformdev/design-system";export{Na as Button,_a as Callout,gt as DefaultSearchRow,st as DefaultSelectedItem,Lt as EntrySearch,ri as Heading,me as Icons,Xa as Input,Ya as InputSelect,ja as InputToggle,ti as KeywordSearchInput,Za as LoadingIndicator,qa as LoadingOverlay,Wa as Menu,Ja as MenuItem,$e as ProductPreviewList,Zo as ProductQuery,He as ProductQueryContext,Ua as ProductSearch,$t as ProductSearchContext,Ut as ProductSearchRow,Ht as ProductSelectedItem,Ge as ResolvableLoadingValue,oi as ScrollableList,ni as ScrollableListItem,ze as SelectionField,ai as Textarea,ei as Theme,Le as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,ko as UniformMeshSdkContextProvider,he as badgeIcon,Pt as draggableContainer,ve as draggableIcon,kt as draggableIconOffset,Rt as draggableIconWrapper,vt as entrySearchBtn,bt as entrySearchConfig,yt as entrySearchConfigHidden,ht as entrySearchLoadMoreBtn,St as entrySearchResultList,wt as entrySearchSelectIcon,Ct as entrySearchSelectImg,Zn as entrySearchSelectInput,qn as entrySearchSelectOption,ft as entrySearchWrapper,Gt as productSearchRowActiveIcon,Tt as productSearchRowCategory,Mt as productSearchRowContainer,Vt as productSearchRowContent,Et as productSearchRowContentActive,Dt as productSearchRowDetails,It as productSearchRowTitle,At as productSelectedItemContainer,Ot as productSelectedItemContent,Bt as productSelectedItemDetails,ye as productSelectedItemImage,pt as searchRowBtn,ct as searchRowContainer,dt as searchRowContainerActive,lt as searchRowPopover,fe as searchRowText,ge as searchRowTextSmall,ue as selectItemLinkBtn,at as selectItemLinkContainer,nt as selectItemPopover,ae as selectItemPopoverLabel,B as selectItemSmallText,ot as selectedItemCloseIcon,Xe as selectedItemContainer,et as selectedItemCopy,je as selectedItemDetails,rt as selectedItemIcon,Ye as selectedItemInner,tt as selectedItemTitle,yo as useInitializeUniformMeshSdk,Fe as useProductQueryContext,ie as useProductSearchContext,go as useUniformMeshLocation,Ve as useUniformMeshLocationContext,Mo as useUniformMeshSdk,Te as useUniformMeshSdkContext};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var wr=Object.create;var
|
|
1
|
+
var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Rr=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty;var Ht=(t,n)=>{for(var r in n)he(t,r,{get:n[r],enumerable:!0})},ve=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Pr(n))!kr.call(t,a)&&a!==r&&he(t,a,{get:()=>n[a],enumerable:!(o=Cr(n,a))||o.enumerable});return t},D=(t,n,r)=>(ve(t,n,"default"),r&&ve(r,n,"default")),$=(t,n,r)=>(r=t!=null?wr(Rr(t)):{},ve(n||!t||!t.__esModule?he(r,"default",{value:t,enumerable:!0}):r,t)),xr=t=>ve(he({},"__esModule",{value:!0}),t);var I={};Ht(I,{Button:()=>u.Button,Callout:()=>u.Callout,DefaultSearchRow:()=>it,DefaultSelectedItem:()=>et,EntrySearch:()=>bt,Heading:()=>u.Heading,Icons:()=>Re,Input:()=>u.Input,InputSelect:()=>u.InputSelect,InputToggle:()=>u.InputToggle,KeywordSearchInput:()=>u.InputKeywordSearch,LoadingIndicator:()=>u.LoadingIndicator,LoadingOverlay:()=>u.LoadingOverlay,Menu:()=>u.Menu,MenuItem:()=>u.MenuItem,ProductPreviewList:()=>Ke,ProductQuery:()=>Dr,ProductQueryContext:()=>Fe,ProductSearch:()=>qr,ProductSearchContext:()=>Tt,ProductSearchRow:()=>Lt,ProductSelectedItem:()=>It,ResolvableLoadingValue:()=>Oe,ScrollableList:()=>u.ScrollableList,ScrollableListItem:()=>u.ScrollableListItem,SelectionField:()=>He,Textarea:()=>u.Textarea,Theme:()=>u.Theme,UniformMeshLocationContext:()=>De,UniformMeshLocationContextProvider:()=>Ge,UniformMeshSdkContext:()=>Ue,UniformMeshSdkContextProvider:()=>Vr,badgeIcon:()=>Ve,draggableContainer:()=>ft,draggableIcon:()=>Me,draggableIconOffset:()=>ht,draggableIconWrapper:()=>vt,entrySearchBtn:()=>ct,entrySearchConfig:()=>lt,entrySearchConfigHidden:()=>pt,entrySearchLoadMoreBtn:()=>dt,entrySearchResultList:()=>mt,entrySearchSelectIcon:()=>ut,entrySearchSelectImg:()=>gt,entrySearchSelectInput:()=>Nr,entrySearchSelectOption:()=>_r,entrySearchWrapper:()=>st,productSearchRowActiveIcon:()=>kt,productSearchRowCategory:()=>Pt,productSearchRowContainer:()=>yt,productSearchRowContent:()=>St,productSearchRowContentActive:()=>wt,productSearchRowDetails:()=>Rt,productSearchRowTitle:()=>Ct,productSelectedItemContainer:()=>Mt,productSelectedItemContent:()=>Et,productSelectedItemDetails:()=>Vt,productSelectedItemImage:()=>Ee,searchRowBtn:()=>nt,searchRowContainer:()=>tt,searchRowContainerActive:()=>rt,searchRowPopover:()=>ot,searchRowText:()=>Le,searchRowTextSmall:()=>xe,selectItemLinkBtn:()=>ke,selectItemLinkContainer:()=>je,selectItemPopover:()=>Ye,selectItemPopoverLabel:()=>ce,selectItemSmallText:()=>N,selectedItemCloseIcon:()=>Xe,selectedItemContainer:()=>Ne,selectedItemCopy:()=>qe,selectedItemDetails:()=>Ze,selectedItemIcon:()=>Je,selectedItemInner:()=>_e,selectedItemTitle:()=>We,useInitializeUniformMeshSdk:()=>Mr,useProductQueryContext:()=>$e,useProductSearchContext:()=>de,useUniformMeshLocation:()=>Lr,useUniformMeshLocationContext:()=>ze,useUniformMeshSdk:()=>Er,useUniformMeshSdkContext:()=>Ae});module.exports=xr(I);var e=require("@emotion/react"),L=$(require("react"));var j=require("react"),De=(0,j.createContext)(void 0),Ge=({children:t})=>{let[n,r]=(0,j.useState)(),o;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();o={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async d=>{await a.setValue(d),r(window.UniformMeshSDK.getCurrentLocation())}}}}return(0,e.jsx)(De.Provider,{value:o},t)},ze=()=>{let t=(0,j.useContext)(De);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Lr(){let{location:t}=ze();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata()}}var Ft=require("@uniformdev/mesh-sdk"),ie=require("react"),Mr=({autoResizingDisabled:t}={})=>{let[n,r]=(0,ie.useState)(),[o,a]=(0,ie.useState)();return(0,ie.useEffect)(()=>{typeof window=="undefined"||o||(typeof window.UniformMeshSDK=="undefined"?(0,Ft.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(d=>{a(d)}).catch(d=>{r(d)}):a(window.UniformMeshSDK))},[t]),{initializing:!o&&!n,error:n,sdk:o}};var be=require("react");var $t=require("@uniformdev/design-system"),Ue=(0,be.createContext)(void 0),Vr=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(Ue.Provider,{value:n},(0,e.jsx)($t.Theme,null),(0,e.jsx)(Ge,null,t))},Ae=()=>{let t=(0,be.useContext)(Ue);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Er(){let{sdk:t}=Ae();return t}var Qe=$(require("react"));var K=$(require("react"));var ee=require("@emotion/react"),Kt=require("@uniformdev/design-system");var Be=$(require("react")),Oe=({value:t,text:n,loading:r})=>(0,e.jsx)(Be.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)(Be.default.Fragment,null,r&&`${t} (Loading...)`,!r&&`${t} (Unresolvable)`));var He=({name:t,loading:n,selectedValues:r,values:o,onAdd:a,onRemove:d})=>{var h;let v=(h=o==null?void 0:o.filter(m=>!(r!=null&&r.includes(m.id.toString()))))!=null?h:[],b=(m,c)=>{m.preventDefault(),d(c)};return(0,e.jsx)("div",null,(0,e.jsx)(Kt.InputSelect,{id:"product-query",name:"product-query",label:t,onChange:m=>a(m.target.value),disabled:n,options:[{value:"",label:"Add..."},...v.map(m=>({value:m.id,label:m.name||m.id}))],css:Array.isArray(r)&&r.length>0?ee.css`
|
|
2
2
|
margin-bottom: var(--spacing-base);
|
|
3
3
|
`:""}),r==null?void 0:r.map(m=>{var c;return(0,e.jsx)("div",{css:ee.css`
|
|
4
4
|
font-size: var(--fs-sm);
|
|
@@ -12,64 +12,64 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
12
12
|
`,key:m},(0,e.jsx)("span",{css:ee.css`
|
|
13
13
|
padding: var(--spacing-3);
|
|
14
14
|
color: var(--gray-800);
|
|
15
|
-
`},(0,e.jsx)(
|
|
15
|
+
`},(0,e.jsx)(Oe,{value:m,loading:n,text:(c=o.find(g=>g.id===m))==null?void 0:c.name})),(0,e.jsx)("button",{css:ee.css`
|
|
16
16
|
padding: var(--spacing-3);
|
|
17
17
|
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:
|
|
18
|
+
`,title:"remove",onClick:g=>b(g,m)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:ee.css`
|
|
19
19
|
height: 1.25rem;
|
|
20
20
|
width: 1.25rem;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
display: block;
|
|
23
|
-
`,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Ir=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),
|
|
23
|
+
`,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Ir=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ye=Ir;var Tr=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"})),Se=Tr;var we=require("react-use"),M=require("@uniformdev/design-system"),C=require("@emotion/react"),Qt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Dr=({value:t,setValue:n,brands:r,categories:o,loading:a,categoriesLoading:d,brandsLoading:v,logoIcon:b,onGetProducts:h,sortOptions:m,sortOrderOptions:c})=>{var U;let g=async s=>{n({...Qt,...t||{},...s})},f=(0,K.useMemo)(()=>({...Qt,...t||{}}),[t]),[J,T]=(0,we.useAsyncFn)(async s=>await h(s),[h]);(0,we.useDebounce)(async()=>{await T({brand:f.brand,categories:f.categories,keyword:f.keyword,sort:f.sort,sortOrder:f.sortOrder,count:f.count})},250,[f]);let X=(0,K.useMemo)(()=>{let s=[];return o==null||o.forEach(p=>{let A=_t(p,void 0);s.push(...A)}),s},[o]),H=(0,K.useMemo)(()=>(r==null?void 0:r.map(s=>({id:s.id.toString(),name:s.name})))||[],[r]),F=s=>{let p=(t==null?void 0:t.categories)||[];g({categories:[...p,s]})},q=s=>{var p;g({categories:(p=t==null?void 0:t.categories)==null?void 0:p.filter(A=>A!==s)})},me=s=>{g({brand:s.target.value})},z=s=>{g({count:s||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(Fe.Provider,{value:{categories:o,logoIcon:b}},(0,e.jsx)("div",{css:C.css`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
27
|
-
`},(0,e.jsx)(
|
|
27
|
+
`},(0,e.jsx)(He,{loading:d||!1,name:"Product Category",onAdd:F,onRemove:q,selectedValues:f.categories,values:X}),(0,e.jsx)("div",{css:C.css`
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-wrap: wrap;
|
|
30
30
|
column-gap: var(--spacing-lg);
|
|
31
31
|
row-gap: var(--spacing-md);
|
|
32
|
-
${(0,
|
|
32
|
+
${(0,M.mq)("md")} {
|
|
33
33
|
flex-wrap: nowrap;
|
|
34
34
|
}
|
|
35
35
|
`},(0,e.jsx)("div",{css:C.css`
|
|
36
36
|
width: 50%;
|
|
37
37
|
flex-grow: 1;
|
|
38
|
-
`},(0,e.jsx)(
|
|
38
|
+
`},(0,e.jsx)(M.InputSelect,{id:"brand",name:"brand",label:"Brand",disabled:v,value:f.brand,onChange:me,options:[{value:"",label:"Select a brand"},...H.map(s=>({value:s.id,label:s.name}))]})),(0,e.jsx)("div",{css:C.css`
|
|
39
39
|
flex-grow: 1;
|
|
40
40
|
position: relative;
|
|
41
|
-
`},(0,e.jsx)(
|
|
41
|
+
`},(0,e.jsx)(M.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:f.count,onChange:s=>z(s.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:C.css`
|
|
42
42
|
position: absolute;
|
|
43
43
|
bottom: var(--spacing-sm);
|
|
44
44
|
right: var(--spacing-sm);
|
|
45
45
|
display: flex;
|
|
46
46
|
gap: var(--spacing-sm);
|
|
47
|
-
`},(0,e.jsx)(Nt,{onCountChange:()=>z(
|
|
47
|
+
`},(0,e.jsx)(Nt,{onCountChange:()=>z(f.count-1),countIcon:"decrement",disabled:f.count===1}),(0,e.jsx)(Nt,{onCountChange:()=>z(f.count+1),countIcon:"increment"})))),(0,e.jsx)("div",{css:C.css`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-wrap: wrap;
|
|
50
50
|
column-gap: var(--spacing-lg);
|
|
51
51
|
row-gap: var(--spacing-md);
|
|
52
|
-
${(0,
|
|
52
|
+
${(0,M.mq)("md")} {
|
|
53
53
|
flex-wrap: nowrap;
|
|
54
54
|
}
|
|
55
55
|
`},(0,e.jsx)("div",{css:C.css`
|
|
56
56
|
width: 100%;
|
|
57
|
-
${(0,
|
|
57
|
+
${(0,M.mq)("md")} {
|
|
58
58
|
width: 33.333333%;
|
|
59
59
|
}
|
|
60
|
-
`},(0,e.jsx)(
|
|
60
|
+
`},(0,e.jsx)(M.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:f.keyword,placeholder:"Enter keyword",onChange:s=>g({keyword:s.target.value})})),Array.isArray(m)&&m.length>0?(0,e.jsx)("div",{css:C.css`
|
|
61
61
|
flex-grow: 1;
|
|
62
|
-
${(0,
|
|
62
|
+
${(0,M.mq)("md")} {
|
|
63
63
|
width: 33.333333%;
|
|
64
64
|
}
|
|
65
|
-
`},(0,e.jsx)(
|
|
65
|
+
`},(0,e.jsx)(M.InputSelect,{id:"sort",name:"sort",label:"Sort",value:f.sort,onChange:s=>g({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...m.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(c)&&c.length>0?(0,e.jsx)("div",{css:C.css`
|
|
66
66
|
flex-grow: 1;
|
|
67
|
-
`},(0,e.jsx)(
|
|
67
|
+
`},(0,e.jsx)(M.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:f.sortOrder,onChange:s=>g({sortOrder:s.target.value}),options:c.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),(0,e.jsx)("div",null,(0,e.jsx)("h3",{css:C.css`
|
|
68
68
|
font-size: var(--fs-md);
|
|
69
69
|
line-height: var(--spacing-md);
|
|
70
70
|
font-weight: var(--fw-bold);
|
|
71
71
|
margin-bottom: var(--spacing-xs);
|
|
72
|
-
`},"Result Preview"),(0,e.jsx)(
|
|
72
|
+
`},"Result Preview"),(0,e.jsx)(Ke,{products:(U=J.value)==null?void 0:U.products}))))};function _t(t,n){var d;let r=[],o=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${o}${t.name}`};return r.push(a),(d=t.children)==null||d.forEach(v=>{let b=_t(v,a);r.push(...b)}),r}function Nt({onCountChange:t,countIcon:n,disabled:r}){return(0,e.jsx)("button",{css:C.css`
|
|
73
73
|
width: 2.25rem;
|
|
74
74
|
height: 2.25rem;
|
|
75
75
|
border: 1px solid var(--gray-300);
|
|
@@ -85,18 +85,18 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
85
85
|
cursor: not-allowed;
|
|
86
86
|
opacity: 0.3;
|
|
87
87
|
`:""}
|
|
88
|
-
`,onClick:t,disabled:r},n==="increment"?(0,e.jsx)(
|
|
88
|
+
`,onClick:t,disabled:r},n==="increment"?(0,e.jsx)(ye,{css:C.css`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`}):(0,e.jsx)(
|
|
91
|
+
`}):(0,e.jsx)(Se,{css:C.css`
|
|
92
92
|
width: 1rem;
|
|
93
93
|
height: 1rem;
|
|
94
|
-
`}))}var
|
|
94
|
+
`}))}var Fe=K.default.createContext(void 0),$e=()=>{let t=(0,K.useContext)(Fe);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function Q({src:t,alt:n,className:r}){let o=t&&typeof t!="string"?t:null;return o?(0,e.jsx)(o,{className:r}):(0,e.jsx)("img",{src:t,alt:n,className:r})}var P=require("@emotion/react"),Zt=require("@uniformdev/design-system"),Ke=({products:t})=>{let{categories:n,logoIcon:r}=$e();return(0,e.jsx)(Qe.default.Fragment,null,(0,e.jsx)("p",{css:P.css`
|
|
95
95
|
margin-bottom: var(--spacing-base);
|
|
96
96
|
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[P.css`
|
|
97
97
|
max-height: 24rem;
|
|
98
98
|
overflow-x: auto;
|
|
99
|
-
`,Zt.scrollbarStyles]},t==null?void 0:t.map((o,a)=>{var b;let[d]=(o==null?void 0:o.categories)||[],
|
|
99
|
+
`,Zt.scrollbarStyles]},t==null?void 0:t.map((o,a)=>{var b;let[d]=(o==null?void 0:o.categories)||[],v=typeof d=="undefined"||!n||(b=n.find(h=>h.id===d.id))==null?void 0:b.name;return(0,e.jsx)("li",{key:`product-${o.id}`,css:P.css`
|
|
100
100
|
border: 1px solid var(--gray-300);
|
|
101
101
|
border-radius: var(--rounded-md);
|
|
102
102
|
background-color: var(--gray-100);
|
|
@@ -121,10 +121,10 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
121
121
|
font-weight: var(--fw-bold);
|
|
122
122
|
width: 33.333333%;
|
|
123
123
|
font-size: var(--fs-sm);
|
|
124
|
-
`},o.name,
|
|
124
|
+
`},o.name,v&&(0,e.jsx)("span",{css:P.css`
|
|
125
125
|
display: block;
|
|
126
126
|
font-weight: var(--fw-regular);
|
|
127
|
-
`},
|
|
127
|
+
`},v)),o&&(0,e.jsx)(Qe.default.Fragment,null,(0,e.jsx)("p",{css:P.css`
|
|
128
128
|
margin-right: var(--spacing-lg);
|
|
129
129
|
font-size: var(--fs-sm);
|
|
130
130
|
`},"SKU: ",o.sku," ",o.id,(0,e.jsx)("br",null)),o.price&&(0,e.jsx)("p",{css:P.css`
|
|
@@ -150,13 +150,13 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
150
150
|
`},"Edit"),r?(0,e.jsx)(Q,{src:r,alt:"Logo",css:P.css`
|
|
151
151
|
width: 2.25rem;
|
|
152
152
|
height: 2.25rem;
|
|
153
|
-
`}):null))))})))};var Z=$(require("react"));var
|
|
153
|
+
`}):null))))})))};var Z=$(require("react"));var E=$(require("react"));var Re={};Ht(Re,{Caution:()=>qt,Checkmark:()=>Ce,ChevronDown:()=>Pe,Close:()=>te,Danger:()=>Wt,ExclamationPoint:()=>Jt,Info:()=>re,Lightbulb:()=>Xt,MagnifyingGlass:()=>Yt,MaximizeAlt:()=>jt,Minus:()=>Se,MoreVerticalAlt:()=>se,Plus:()=>ye});var Gr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),qt=Gr;var zr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),Ce=zr;var Ur=t=>(0,e.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},(0,e.jsx)("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),Pe=Ur;var Ar=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},(0,e.jsx)("g",{fillRule:"evenodd"},(0,e.jsx)("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),(0,e.jsx)("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),te=Ar;var Br=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),Wt=Br;var Or=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),Jt=Or;var Hr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),re=Hr;var Fr=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),Xt=Fr;var $r=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("g",{clipPath:"url(#magnifying-glass_svg__a)"},(0,e.jsx)("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),(0,e.jsx)("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"magnifying-glass_svg__a"},(0,e.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),Yt=$r;var Kr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),jt=Kr;var Qr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"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"})),se=Qr;var or=require("react-use"),nr=require("uuid");var B=$(require("react"));function er(t,n){let r=window.open(t,"_blank"),o=setInterval(()=>{r!=null&&r.closed&&(clearInterval(o),n())},500)}var rr=require("timeago.js");var k=require("@emotion/react"),tr=require("@uniformdev/design-system"),Ne=k.css`
|
|
154
154
|
border: 1px solid var(--gray-200);
|
|
155
155
|
background: var(--gray-50);
|
|
156
156
|
border-radius: var(--rounded-base);
|
|
157
157
|
display: flex;
|
|
158
158
|
width: 100%;
|
|
159
|
-
`,
|
|
159
|
+
`,_e=k.css`
|
|
160
160
|
align-items: center;
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-grow: 1;
|
|
@@ -164,24 +164,24 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
164
164
|
margin-inline: 0 var(--spacing-sm);
|
|
165
165
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
166
166
|
position: relative;
|
|
167
|
-
`,
|
|
167
|
+
`,Ze=k.css`
|
|
168
168
|
flex-grow: 1;
|
|
169
|
-
`,
|
|
169
|
+
`,qe=k.css`
|
|
170
170
|
align-items: start;
|
|
171
171
|
display: inline-flex;
|
|
172
172
|
position: relative;
|
|
173
|
-
`,
|
|
173
|
+
`,We=k.css`
|
|
174
174
|
color: var(--brand-secondary-1);
|
|
175
175
|
font-size: var(--fs-base);
|
|
176
176
|
font-weight: var(--fw-bold);
|
|
177
177
|
line-height: 1;
|
|
178
|
-
`,
|
|
178
|
+
`,Je=k.css`
|
|
179
179
|
width: 1.5rem;
|
|
180
180
|
height: 1.5rem;
|
|
181
|
-
`,
|
|
181
|
+
`,Xe=k.css`
|
|
182
182
|
width: 1rem;
|
|
183
183
|
height: 1rem;
|
|
184
|
-
`,
|
|
184
|
+
`,Ye=k.css`
|
|
185
185
|
background: var(--white);
|
|
186
186
|
border-radius: var(--rounded-base);
|
|
187
187
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -189,12 +189,12 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
189
189
|
padding: var(--spacing-base);
|
|
190
190
|
z-index: var(--z-10);
|
|
191
191
|
width: max-content;
|
|
192
|
-
`,N=
|
|
192
|
+
`,N=k.css`
|
|
193
193
|
font-size: var(--fs-sm);
|
|
194
|
-
`,ce=
|
|
194
|
+
`,ce=k.css`
|
|
195
195
|
font-weight: var(--fw-bold);
|
|
196
196
|
margin-right: var(--spacing-sm);
|
|
197
|
-
`,
|
|
197
|
+
`,je=k.css`
|
|
198
198
|
display: flex;
|
|
199
199
|
flex-direction: column;
|
|
200
200
|
gap: var(--spacing-sm);
|
|
@@ -202,7 +202,7 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
202
202
|
${(0,tr.mq)("md")} {
|
|
203
203
|
flex-direction: row;
|
|
204
204
|
}
|
|
205
|
-
`,
|
|
205
|
+
`,ke=k.css`
|
|
206
206
|
align-items: center;
|
|
207
207
|
background: var(--white);
|
|
208
208
|
border-radius: var(--rounded-base);
|
|
@@ -215,40 +215,40 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
215
215
|
&:hover {
|
|
216
216
|
background: var(--gray-50);
|
|
217
217
|
}
|
|
218
|
-
`;var
|
|
218
|
+
`;var G=require("@emotion/react");var et=({selectedItem:t,logoIcon:n,onDeselect:r,onEditClosed:o})=>{var m;let a=(0,B.useRef)(null),d=(0,B.useRef)(null),[v,b]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let c=f=>{a.current&&!a.current.contains(f.target)&&d.current&&!d.current.contains(f.target)&&b(!1)},g=()=>{b(!1)};return window.addEventListener("resize",g,!0),document.addEventListener("scroll",c,!0),document.addEventListener("mousedown",c),()=>{window.removeEventListener("resize",g,!0),document.removeEventListener("scroll",c,!0),document.removeEventListener("mousedown",c)}},[d]);let h=()=>{var c;if(b(!v),d.current&&a.current){let g=(c=a==null?void 0:a.current)==null?void 0:c.getBoundingClientRect();d.current.style.top=`${g.top+30}px`}};return(0,e.jsx)("div",{css:Ne,key:t.id},(0,e.jsx)("div",{css:_e},(0,e.jsx)("div",{css:Ze},(0,e.jsx)("div",{css:qe},(0,e.jsx)("h4",{css:[We,t.popoverData?G.css`
|
|
219
219
|
margin-bottom: var(--spacing-sm);
|
|
220
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(B.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css:
|
|
220
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(B.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css:G.css`
|
|
221
221
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
222
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
222
|
+
`,"aria-controls":"path-details","aria-expanded":v,onClick:h},(0,e.jsx)(re,{width:24,height:24,css:G.css`
|
|
223
223
|
color: var(--gray-400);
|
|
224
|
-
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!
|
|
224
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!v,ref:d,css:[Ye,v?G.css`
|
|
225
225
|
visibility: visible;
|
|
226
|
-
`:
|
|
226
|
+
`:G.css`
|
|
227
227
|
visibility: hidden;
|
|
228
|
-
`]},Object.entries(t.popoverData).map(([c,
|
|
228
|
+
`]},Object.entries(t.popoverData).map(([c,g],f)=>(0,e.jsx)("div",{css:N,key:f},(0,e.jsx)("span",{css:ce},c,":"),g)))):null),t.createdDate&&(0,e.jsx)("div",{css:N},(0,e.jsx)("span",{css:ce},"Created:"),(0,rr.format)((m=t.createdDate)!=null?m:0)),(0,e.jsx)("div",{css:G.css`
|
|
229
229
|
display: flex;
|
|
230
230
|
gap: var(--spacing-base);
|
|
231
|
-
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,
|
|
231
|
+
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,g])=>(0,e.jsx)("span",{css:N,key:c},g)):null),t.metadata?Object.entries(t.metadata).filter(([c])=>!["type","status"].includes(c.toLocaleLowerCase())).map(([c,g])=>(0,e.jsx)("div",{css:[N,G.css`
|
|
232
232
|
order: 1;
|
|
233
|
-
`],key:c},(0,e.jsx)("span",{css:[ce,
|
|
233
|
+
`],key:c},(0,e.jsx)("span",{css:[ce,G.css`
|
|
234
234
|
order: 1;
|
|
235
|
-
`]},c,":"),
|
|
235
|
+
`]},c,":"),g)):null),(0,e.jsx)("div",{css:je},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:c=>{o&&(er(c.currentTarget.href,()=>o(t)),c.preventDefault())},css:ke},(0,e.jsx)("span",{css:N},"Edit"),(0,e.jsx)(Q,{src:n,css:Je,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:c=>{c.preventDefault(),r(t)},css:ke},(0,e.jsx)("span",{css:N},"Unlink"),(0,e.jsx)(te,{css:[Xe,G.css`
|
|
236
236
|
color: var(--brand-secondary-5);
|
|
237
|
-
`]})))))};var O=$(require("react"));var W=require("@emotion/react"),
|
|
237
|
+
`]})))))};var O=$(require("react"));var W=require("@emotion/react"),tt=W.css`
|
|
238
238
|
cursor: pointer;
|
|
239
239
|
padding: var(--spacing-sm);
|
|
240
240
|
position: relative;
|
|
241
241
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
242
242
|
color var(--duration-fast) var(--timing-ease-out);
|
|
243
|
-
`,
|
|
243
|
+
`,rt=W.css`
|
|
244
244
|
background: var(--brand-secondary-3);
|
|
245
245
|
color: var(--white);
|
|
246
|
-
`,ke=W.css`
|
|
247
|
-
font-size: var(--fs-xs);
|
|
248
246
|
`,xe=W.css`
|
|
247
|
+
font-size: var(--fs-xs);
|
|
248
|
+
`,Le=W.css`
|
|
249
249
|
font-weight: var(--fw-bold);
|
|
250
250
|
margin-right: var(--spacing-sm);
|
|
251
|
-
`,
|
|
251
|
+
`,ot=W.css`
|
|
252
252
|
background: var(--white);
|
|
253
253
|
border-left: 4px solid var(--brand-secondary-3);
|
|
254
254
|
border-radius: var(--rounded-base);
|
|
@@ -260,20 +260,20 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
260
260
|
right: var(--spacing-xl);
|
|
261
261
|
z-index: var(--z-10);
|
|
262
262
|
width: max-content;
|
|
263
|
-
`,
|
|
263
|
+
`,nt=W.css`
|
|
264
264
|
position: absolute;
|
|
265
265
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
266
|
-
`;var
|
|
266
|
+
`;var at=require("@emotion/react"),it=({result:t,isSelected:n,triggerSelection:r})=>{let o=(0,O.useRef)(null),a=(0,O.useRef)(null),[d,v]=(0,O.useState)(!1);(0,O.useEffect)(()=>{function h(m){o.current&&!o.current.contains(m.target)&&a.current&&!a.current.contains(m.target)&&v(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[a]);let b=h=>{h.stopPropagation(),v(!d)};return(0,e.jsx)("div",{key:t.id,css:[tt,n?rt:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>r()},t.title,t.popoverData&&n?(0,e.jsx)(O.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:o,css:nt,"aria-controls":"path-details",onClick:h=>b(h),"aria-expanded":d},(0,e.jsx)(re,{width:24,height:24})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!d,ref:a,css:[ot,d?at.css`
|
|
267
267
|
visibility: visible;
|
|
268
|
-
`:
|
|
268
|
+
`:at.css`
|
|
269
269
|
visibility: hidden;
|
|
270
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([h,m],c)=>(0,e.jsx)("div",{css:
|
|
270
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([h,m],c)=>(0,e.jsx)("div",{css:xe,key:c},(0,e.jsx)("span",{css:Le},h,":"),m)),Object.entries(t.popoverData).map(([h,m],c)=>(0,e.jsx)("div",{css:xe,key:c},(0,e.jsx)("span",{css:Le},h,":"),m)))):null)};var oe=require("react-beautiful-dnd");var w=require("@emotion/react"),st=w.css`
|
|
271
271
|
background: var(--white);
|
|
272
272
|
border: 1px solid var(--gray-300);
|
|
273
273
|
border-radius: var(--rounded-base);
|
|
274
274
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
275
|
-
margin-
|
|
276
|
-
`,
|
|
275
|
+
margin-bottom: var(--spacing-base);
|
|
276
|
+
`,ct=w.css`
|
|
277
277
|
align-items: center;
|
|
278
278
|
display: flex;
|
|
279
279
|
position: relative;
|
|
@@ -281,7 +281,7 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
281
281
|
width: 100%;
|
|
282
282
|
background-color: transparent;
|
|
283
283
|
border: 0;
|
|
284
|
-
`,
|
|
284
|
+
`,dt=w.css`
|
|
285
285
|
color: var(--brand-secondary-1);
|
|
286
286
|
display: block;
|
|
287
287
|
font-weight: var(--fw-bold);
|
|
@@ -297,20 +297,15 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
297
297
|
background: var(--gray-100);
|
|
298
298
|
outline: none;
|
|
299
299
|
}
|
|
300
|
-
`,
|
|
300
|
+
`,lt=w.css`
|
|
301
301
|
background: var(--white);
|
|
302
302
|
border: 1px solid var(--gray-300);
|
|
303
303
|
border-radius: var(--rounded-base);
|
|
304
304
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
305
|
-
|
|
306
|
-
border: none;
|
|
307
|
-
position: absolute;
|
|
308
|
-
padding: 0;
|
|
309
|
-
clip: rect(0, 0, 0, 0);
|
|
310
|
-
height: 1px;
|
|
311
|
-
width: 1px;
|
|
312
|
-
overflow: hidden;
|
|
305
|
+
display: block;
|
|
313
306
|
`,pt=w.css`
|
|
307
|
+
display: none;
|
|
308
|
+
`,mt=w.css`
|
|
314
309
|
overflow-y: auto;
|
|
315
310
|
max-height: 16rem;
|
|
316
311
|
margin-bottom: var(--spacing-base);
|
|
@@ -321,14 +316,14 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
321
316
|
`,Nr=w.css`
|
|
322
317
|
background-color: var(--gray-50);
|
|
323
318
|
max-width: 33.33%;
|
|
324
|
-
`,
|
|
319
|
+
`,ut=w.css`
|
|
325
320
|
align-items: center;
|
|
326
321
|
display: flex;
|
|
327
322
|
position: absolute;
|
|
328
323
|
inset: 0 0 0 auto;
|
|
329
324
|
pointer-events: none;
|
|
330
325
|
padding-right: var(--spacing-sm);
|
|
331
|
-
`,
|
|
326
|
+
`,gt=w.css`
|
|
332
327
|
color: var(--brand-secondary-1);
|
|
333
328
|
width: 1.25rem;
|
|
334
329
|
height: 1.25rem;
|
|
@@ -337,115 +332,115 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
337
332
|
`,_r=w.css`
|
|
338
333
|
background: var(--white);
|
|
339
334
|
color: var(--brand-secondary-1);
|
|
340
|
-
`,
|
|
335
|
+
`,ft=w.css`
|
|
341
336
|
position: relative;
|
|
342
337
|
margin-block: var(--spacing-sm) 0;
|
|
343
338
|
|
|
344
339
|
&:hover > span {
|
|
345
340
|
opacity: 0.3;
|
|
346
341
|
}
|
|
347
|
-
`,
|
|
342
|
+
`,vt=w.css`
|
|
348
343
|
align-items: center;
|
|
349
344
|
display: flex;
|
|
350
345
|
position: absolute;
|
|
351
346
|
inset: 0 auto 0 0;
|
|
352
347
|
margin-block: auto;
|
|
353
348
|
opacity: 0;
|
|
354
|
-
`,
|
|
349
|
+
`,Me=w.css`
|
|
355
350
|
color: var(--brand-secondary-1);
|
|
356
|
-
`,
|
|
351
|
+
`,ht=w.css`
|
|
357
352
|
position: absolute;
|
|
358
353
|
left: 0.375rem;
|
|
359
|
-
`,
|
|
354
|
+
`,Ve=w.css`
|
|
360
355
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
361
356
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
362
|
-
`;var
|
|
357
|
+
`;var V=require("@emotion/react"),S=require("@uniformdev/design-system"),Zr=({searchText:t,selectedContentType:n})=>{let r="No content found";return n&&(r=`No ${n} content was found`),t&&(r=`${r} for keyword '${t}'.`),(0,e.jsx)(S.Callout,{type:"info"},r)},bt=({search:t,results:n,contentTypes:r,selectedItems:o,logoIcon:a,select:d,multiSelect:v,multiSelectId:b,rowComponent:h,selectedItemComponent:m,totalResults:c,resultsLoading:g,requireContentType:f,onAddNew:J,onEditClosed:T,onCancel:X,noResultsComponent:H,helpComponent:F,onSort:q})=>{var At,Bt,Ot;let z=()=>f?Array.isArray(r)&&r.length>0?r[0].id:"":"any",[U,s]=E.useState(""),[p,A]=E.useState(z),[ne,Ie]=E.useState(!1),[ue,ge]=E.useState([]),[cr,Dt]=E.useState(!1),fe=(0,or.useThrottle)(U,750);E.useEffect(()=>{t(fe,{count:5,offset:0,contentType:p==="any"?void 0:p})},[fe,p]);let dr=i=>{ue.includes(i.id)?ge(y=>y.filter(Y=>Y!==i.id)):ge(v?y=>[...y,i==null?void 0:i.id]:[i.id])},lr=()=>{A(z()),s(""),ge(o!=null&&o.length?o.map(i=>i.id):[])},pr=()=>{Ie(i=>!i),ne||lr()},Gt=i=>{d((o==null?void 0:o.filter(y=>y.id!==i.id).map(y=>y.id))||[],"")},mr=i=>{i.preventDefault(),d(ue,p),Ie(!1)},ur=i=>{i.preventDefault(),Ie(!1),X&&X()},gr=i=>{i.preventDefault(),t(fe,{count:5,offset:(n==null?void 0:n.length)||0,contentType:p==="any"?void 0:p}),Dt(!0);let y=setTimeout(()=>{Dt(!1)},750);return()=>clearTimeout(y)},Te=E.useRef((0,nr.v4)()),fr=!(o==null?void 0:o.length)||v,vr=h||it,zt=m||et,hr=H||Zr,Ut=a&&typeof a!="string"?a:null,br=Ut?(0,e.jsx)(Ut,{css:Ve}):(0,e.jsx)("img",{src:a,alt:"CMS logo",css:Ve}),yr=i=>{var y,Y;if(i.destination&&i.source.droppableId===((y=i.destination)==null?void 0:y.droppableId)){let x=[...o||[]],[ae]=(Y=x==null?void 0:x.splice(i.source.index,1))!=null?Y:[];return x==null||x.splice(i.destination.index,0,ae),q==null||q(x.map(Sr=>Sr.id)),x}};return(0,e.jsx)("div",{css:V.css`
|
|
363
358
|
width: 100%;
|
|
364
|
-
`},(0,e.jsx)("div",{css:
|
|
359
|
+
`},(0,e.jsx)("div",{css:V.css`
|
|
365
360
|
position: relative;
|
|
366
361
|
margin-block: var(--spacing-base);
|
|
367
|
-
`},fr&&(0,e.jsx)(
|
|
362
|
+
`},fr&&(0,e.jsx)(E.Fragment,null,(0,e.jsx)("div",{css:st,"data-test-id":"component-search"},(0,e.jsx)("button",{css:ct,onClick:pr,type:"button","aria-haspopup":!0,"aria-expanded":ne,"aria-controls":`entry-search-config-${Te.current}`},br,(0,e.jsx)("span",{css:V.css`
|
|
368
363
|
margin-left: var(--spacing-base);
|
|
369
|
-
`},"Select"),(0,e.jsx)("span",{css:
|
|
364
|
+
`},"Select"),(0,e.jsx)("span",{css:ut},(0,e.jsx)(Pe,{css:[gt,ne?V.css`
|
|
370
365
|
transform: rotate(180deg);
|
|
371
|
-
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${
|
|
366
|
+
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${Te.current}`,"aria-hidden":!ne,css:[lt,ne?void 0:pt]},F||null,(0,e.jsx)("div",{css:V.css`
|
|
372
367
|
display: flex;
|
|
373
368
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
374
369
|
margin-bottom: var(--spacing-base);
|
|
375
|
-
`},(0,e.jsx)(S.InputSelect,{onChange:i=>A(i.target.value),value:p,label:"Content Type Select",showLabel:!1,options:[...
|
|
370
|
+
`},(0,e.jsx)(S.InputSelect,{onChange:i=>A(i.target.value),value:p,label:"Content Type Select",showLabel:!1,options:[...f?[]:[{value:"any",label:"All content types"}],...r?r.map(i=>({value:i.id,label:i.name})):[]]}),(0,e.jsx)("div",{css:V.css`
|
|
376
371
|
flex-grow: 1;
|
|
377
|
-
`},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:s,disabledFieldSubmission:!0,value:U}))),(0,e.jsx)("div",{css:[
|
|
372
|
+
`},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:s,disabledFieldSubmission:!0,value:U}))),(0,e.jsx)("div",{css:[mt,S.scrollbarStyles],id:Te.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(i=>(0,e.jsx)(vr,{key:i.id,isSelected:ue.includes(i.id),result:i,triggerSelection:()=>dr(i)})):g?null:(0,e.jsx)(hr,{searchText:fe||U,selectedContentType:(Bt=(At=r==null?void 0:r.find(i=>i.id===p))==null?void 0:At.name)!=null?Bt:p}),!g&&typeof c!="undefined"&&n&&(n==null?void 0:n.length)<c&&(0,e.jsx)("button",{css:dt,onClick:gr},cr?(0,e.jsx)(S.LoadingIndicator,null):"Load More"),g&&!(n!=null&&n.length)?(0,e.jsx)("div",{css:V.css`
|
|
378
373
|
padding: var(--spacing-base);
|
|
379
374
|
text-align: center;
|
|
380
375
|
width: 100%;
|
|
381
|
-
`},(0,e.jsx)(S.LoadingIndicator,null)):null),(0,e.jsx)("div",{css:
|
|
376
|
+
`},(0,e.jsx)(S.LoadingIndicator,null)):null),(0,e.jsx)("div",{css:V.css`
|
|
382
377
|
display: flex;
|
|
383
378
|
justify-content: space-between;
|
|
384
|
-
`},(0,e.jsx)("div",null,J&&((
|
|
379
|
+
`},(0,e.jsx)("div",null,J&&((Ot=r==null?void 0:r.length)!=null?Ot:0)>0?(0,e.jsx)(S.Menu,{menuLabel:"Add new menu",menuTrigger:(0,e.jsx)(S.Button,{buttonType:"secondary"},"Add New")},r==null?void 0:r.map(i=>(0,e.jsx)(S.MenuItem,{key:i.id,css:V.css`
|
|
385
380
|
background: var(--white);
|
|
386
381
|
color: var(--brand-secondary-1);
|
|
387
|
-
`,onClick:()=>J(i)},i.name))):null),(0,e.jsx)("div",{css:
|
|
382
|
+
`,onClick:()=>J(i)},i.name))):null),(0,e.jsx)("div",{css:V.css`
|
|
388
383
|
display: flex;
|
|
389
384
|
gap: var(--spacing-base);
|
|
390
|
-
`},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:ur},"Cancel"),(0,e.jsx)(S.Button,{disabled:!ue.length,onClick:mr,"data-test-id":"entry-accept-button"},"Accept"))))),
|
|
385
|
+
`},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:ur},"Cancel"),(0,e.jsx)(S.Button,{disabled:!ue.length,onClick:mr,"data-test-id":"entry-accept-button"},"Accept"))))),v?(0,e.jsx)(oe.DragDropContext,{onDragEnd:i=>yr(i)},(0,e.jsx)(oe.Droppable,{droppableId:b||"canvas-multi-select"},i=>(0,e.jsx)("div",{...i.droppableProps,ref:i.innerRef,css:V.css`
|
|
391
386
|
margin-block: var(--spacing-sm) 0;
|
|
392
|
-
`},o==null?void 0:o.map((y,Y)=>{if(y!=null&&y.id)return(0,e.jsx)(oe.Draggable,{key:y.id,draggableId:y.id,index:Y},
|
|
387
|
+
`},o==null?void 0:o.map((y,Y)=>{if(y!=null&&y.id)return(0,e.jsx)(oe.Draggable,{key:y.id,draggableId:y.id,index:Y},x=>(0,e.jsx)("div",{css:ft,ref:x.innerRef,...x.draggableProps,...x.dragHandleProps},(0,e.jsx)("span",{css:vt},(0,e.jsx)(se,{css:[Me,ht],width:24,height:24}),(0,e.jsx)(se,{css:Me,width:24,height:24})),(0,e.jsx)(zt,{key:`selected-item-${y.id}`,logoIcon:a,selectedItem:y,onDeselect:ae=>Gt(ae),onEditClosed:T?ae=>T(ae):void 0})))}),i.placeholder))):o==null?void 0:o.map(i=>(0,e.jsx)(zt,{key:`selected-item-${i.id}`,logoIcon:a,selectedItem:i,onDeselect:y=>Gt(y),onEditClosed:T?y=>T(y):void 0}))))};var _=require("@emotion/react"),yt=_.css`
|
|
393
388
|
cursor: pointer;
|
|
394
389
|
padding: var(--spacing-sm) 0;
|
|
395
390
|
margin-right: var(--spacing-sm);
|
|
396
391
|
position: relative;
|
|
397
392
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
398
393
|
color var(--duration-fast) var(--timing-ease-out);
|
|
399
|
-
`,
|
|
394
|
+
`,St=_.css`
|
|
400
395
|
border: 2px solid transparent;
|
|
401
396
|
border-radius: var(--rounded-base);
|
|
402
397
|
display: flex;
|
|
403
398
|
align-items: center;
|
|
404
399
|
gap: var(--spacing-base);
|
|
405
400
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
406
|
-
`,St=_.css`
|
|
407
|
-
background-color: var(--green-50);
|
|
408
401
|
`,wt=_.css`
|
|
402
|
+
background-color: var(--green-50);
|
|
403
|
+
`,Ct=_.css`
|
|
409
404
|
font-size: var(--fs-sm);
|
|
410
405
|
font-weight: var(--fw-bold);
|
|
411
406
|
width: 50%;
|
|
412
|
-
`,
|
|
407
|
+
`,Pt=_.css`
|
|
413
408
|
font-weight: var(--fw-normal);
|
|
414
409
|
display: block;
|
|
415
|
-
`,
|
|
410
|
+
`,Rt=_.css`
|
|
416
411
|
font-size: var(--fs-sm);
|
|
417
412
|
> * {
|
|
418
413
|
display: block;
|
|
419
414
|
}
|
|
420
|
-
`,
|
|
415
|
+
`,kt=_.css`
|
|
421
416
|
display: block;
|
|
422
417
|
height: 1.5rem;
|
|
423
418
|
width: 1.5rem;
|
|
424
419
|
color: var(--brand-secondary-3);
|
|
425
420
|
margin-left: auto;
|
|
426
|
-
`;var
|
|
421
|
+
`;var xt=require("@emotion/react");function Lt({result:t,isSelected:n,triggerSelection:r}){var b;let{categories:o,logoIcon:a}=de(),[d]=t.categories||[{id:"",name:""}],v=typeof d=="undefined"||!o||(b=o.find(h=>h.id===d.id))==null?void 0:b.name;return(0,e.jsx)("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>r(),css:[yt]},(0,e.jsx)("div",{css:[St,n?wt:void 0]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:xt.css`
|
|
427
422
|
background-color: var(--gray-200);
|
|
428
423
|
width: 3rem;
|
|
429
424
|
height: 3rem;
|
|
430
425
|
object-fit: cover;
|
|
431
|
-
`}):(0,e.jsx)(Q,{src:a,alt:"Logo",css:
|
|
426
|
+
`}):(0,e.jsx)(Q,{src:a,alt:"Logo",css:xt.css`
|
|
432
427
|
height: 2.25rem;
|
|
433
428
|
width: 2.25rem;
|
|
434
|
-
`}),(0,e.jsx)("h4",{css:[
|
|
429
|
+
`}),(0,e.jsx)("h4",{css:[Ct]},t.title,v?(0,e.jsx)("span",{css:[Pt]},v):null),(0,e.jsx)("p",{css:[Rt]},"SKU: ",t.id,t.price&&(0,e.jsx)("span",null,t.price)),n?(0,e.jsx)(Ce,{css:[kt]}):null))}var le=require("@emotion/react"),ar=require("@uniformdev/design-system"),Mt=le.css`
|
|
435
430
|
display: flex;
|
|
436
431
|
width: 100%;
|
|
437
432
|
border: 1px solid var(--gray-300);
|
|
438
433
|
border-radius: var(--rounded-base);
|
|
439
434
|
background-color: var(--gray-100);
|
|
440
435
|
margin: var(--spacing-base) 0;
|
|
441
|
-
`,
|
|
436
|
+
`,Vt=le.css`
|
|
442
437
|
padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
|
|
443
438
|
display: flex;
|
|
444
439
|
flex-grow: 1;
|
|
445
440
|
align-items: center;
|
|
446
441
|
margin-right: var(--spacing-sm);
|
|
447
442
|
gap: var(--spacing-base);
|
|
448
|
-
`,
|
|
443
|
+
`,Et=le.css`
|
|
449
444
|
display: flex;
|
|
450
445
|
align-items: center;
|
|
451
446
|
gap: var(--spacing-sm);
|
|
@@ -454,12 +449,12 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
454
449
|
width: 50%;
|
|
455
450
|
margin-bottom: 0;
|
|
456
451
|
}
|
|
457
|
-
`,
|
|
452
|
+
`,Ee=le.css`
|
|
458
453
|
background-color: var(--gray-200);
|
|
459
454
|
width: 3.5rem;
|
|
460
455
|
height: 3.5rem;
|
|
461
456
|
object-fit: cover;
|
|
462
|
-
`;var R=require("@emotion/react"),ir=require("@uniformdev/design-system");function
|
|
457
|
+
`;var R=require("@emotion/react"),ir=require("@uniformdev/design-system");function It({selectedItem:t,onDeselect:n}){var v;let{categories:r,logoIcon:o}=de(),[a]=t.categories||[{id:"",name:""}],d=typeof a=="undefined"||!r||(v=r.find(b=>b.id===a.id))==null?void 0:v.name;return(0,e.jsx)("div",{css:[Mt],key:t.id},(0,e.jsx)("article",{css:[Vt]},(0,e.jsx)("div",{css:[Et]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:d,css:[Ee],loading:"lazy"}):(0,e.jsx)("div",{css:[Ee]}),(0,e.jsx)("div",{css:R.css`
|
|
463
458
|
> :not(:last-child) {
|
|
464
459
|
margin-bottom: var(--spacing-xs);
|
|
465
460
|
}
|
|
@@ -519,4 +514,4 @@ var wr=Object.create;var ve=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
519
514
|
font-size: var(--fs-sm);
|
|
520
515
|
`},"Unlink"),(0,e.jsx)(te,{css:R.css`
|
|
521
516
|
color: var(--brand-secondary-5);
|
|
522
|
-
`})))))}var sr=require("@uniformdev/design-system"),pe=require("react-use");function qr({value:t,setValue:n,onGetSelectedProducts:r,onGetCategories:o,onSearchProducts:a,logoIcon:d,multiSelect:
|
|
517
|
+
`})))))}var sr=require("@uniformdev/design-system"),pe=require("react-use");function qr({value:t,setValue:n,onGetSelectedProducts:r,onGetCategories:o,onSearchProducts:a,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:m}){var z,U;let{value:c,loading:g,error:f}=(0,pe.useAsync)(async()=>await o(),[o]),{value:J,error:T}=(0,pe.useAsync)(async()=>{if(!t)return;let s=await r({ids:t});return Array.isArray(s)?s:void 0},[r,t]),X=(0,Z.useMemo)(()=>c?c.map(p=>({id:p.id,name:p.name})):void 0,[c]),H=(0,Z.useRef)(),[F,q]=(0,pe.useAsyncFn)(async(s,p)=>{let A=await a({text:s,options:{limit:p==null?void 0:p.count,offset:p==null?void 0:p.offset,categoryId:p==null?void 0:p.contentType}});return(p==null?void 0:p.offset)===0&&(H.current=[]),(H.current=H.current||[]).push(...A.products),A},[a]),me=async s=>{s&&await n(s)};return g?(0,e.jsx)(sr.LoadingIndicator,null):f||T||F.error?(0,e.jsx)("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(T==null?void 0:T.message)||((z=F.error)==null?void 0:z.message)):(0,e.jsx)(Tt.Provider,{value:{categories:c,logoIcon:d}},(0,e.jsx)(bt,{search:q,results:H.current,logoIcon:d,selectedItems:J,select:me,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:X,selectedItemComponent:h||It,rowComponent:m||Lt,totalResults:(U=F.value)==null?void 0:U.total,resultsLoading:F.loading}))}var Tt=Z.default.createContext(void 0),de=()=>{let t=(0,Z.useContext)(Tt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};D(I,require("@uniformdev/mesh-sdk"),module.exports);var u=require("@uniformdev/design-system");0&&(module.exports={Button,Callout,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputSelect,InputToggle,KeywordSearchInput,LoadingIndicator,LoadingOverlay,Menu,MenuItem,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,badgeIcon,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemImage,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemCloseIcon,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
20
20
|
width: 1.25rem;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
display: block;
|
|
23
|
-
`,viewBox:"0 0 20 20",fill:"currentColor"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var ur=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"})),ee=ur;var gr=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"})),te=gr;import{useAsyncFn as hr,useDebounce as br}from"react-use";import{Input as Ue,InputSelect as pe,mq as re}from"@uniformdev/design-system";import{css as w}from"@emotion/react";var Ae={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Zo=({value:t,setValue:n,brands:o,categories:r,loading:c,categoriesLoading:d,brandsLoading:v,logoIcon:b,onGetProducts:h,sortOptions:u,sortOrderOptions:s})=>{var I;let g=async i=>{n({...Ae,...t||{},...i})},f=le(()=>({...Ae,...t||{}}),[t]),[H,
|
|
23
|
+
`,viewBox:"0 0 20 20",fill:"currentColor"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var ur=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"})),ee=ur;var gr=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"})),te=gr;import{useAsyncFn as hr,useDebounce as br}from"react-use";import{Input as Ue,InputSelect as pe,mq as re}from"@uniformdev/design-system";import{css as w}from"@emotion/react";var Ae={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Zo=({value:t,setValue:n,brands:o,categories:r,loading:c,categoriesLoading:d,brandsLoading:v,logoIcon:b,onGetProducts:h,sortOptions:u,sortOrderOptions:s})=>{var I;let g=async i=>{n({...Ae,...t||{},...i})},f=le(()=>({...Ae,...t||{}}),[t]),[H,M]=hr(async i=>await h(i),[h]);br(async()=>{await M({brand:f.brand,categories:f.categories,keyword:f.keyword,sort:f.sort,sortOrder:f.sortOrder,count:f.count})},250,[f]);let F=le(()=>{let i=[];return r==null||r.forEach(m=>{let T=Oe(m,void 0);i.push(...T)}),i},[r]),G=le(()=>(o==null?void 0:o.map(i=>({id:i.id.toString(),name:i.name})))||[],[o]),z=i=>{let m=(t==null?void 0:t.categories)||[];g({categories:[...m,i]})},A=i=>{var m;g({categories:(m=t==null?void 0:t.categories)==null?void 0:m.filter(T=>T!==i)})},J=i=>{g({brand:i.target.value})},E=i=>{g({count:i||1})};return c?e("div",null,"Loading..."):e(He.Provider,{value:{categories:r,logoIcon:b}},e("div",{css:w`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
@@ -150,7 +150,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
150
150
|
`},"Edit"),o?e(U,{src:o,alt:"Logo",css:C`
|
|
151
151
|
width: 2.25rem;
|
|
152
152
|
height: 2.25rem;
|
|
153
|
-
`}):null))))})))};import jr,{useContext as eo,useMemo as to,useRef as ro}from"react";import*as
|
|
153
|
+
`}):null))))})))};import jr,{useContext as eo,useMemo as to,useRef as ro}from"react";import*as L from"react";var me={};or(me,{Caution:()=>Qe,Checkmark:()=>oe,ChevronDown:()=>ne,Close:()=>K,Danger:()=>Ne,ExclamationPoint:()=>_e,Info:()=>Q,Lightbulb:()=>Ze,MagnifyingGlass:()=>qe,MaximizeAlt:()=>We,Minus:()=>te,MoreVerticalAlt:()=>W,Plus:()=>ee});var Sr=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"})),Qe=Sr;var wr=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"})),oe=wr;var Cr=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"})),ne=Cr;var Pr=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"}))),K=Pr;var Rr=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"})),Ne=Rr;var kr=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"})),_e=kr;var xr=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"})),Q=xr;var Lr=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"})),Ze=Lr;var Mr=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"})))),qe=Mr;var Vr=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"})),We=Vr;var Er=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"})),W=Er;import{useThrottle as Or}from"react-use";import{v4 as Hr}from"uuid";import Tr,{useState as Dr,useRef as it,useEffect as Gr}from"react";function Je(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as zr}from"timeago.js";import{css as x}from"@emotion/react";import{mq as Ir}from"@uniformdev/design-system";var Xe=x`
|
|
154
154
|
border: 1px solid var(--gray-200);
|
|
155
155
|
background: var(--gray-50);
|
|
156
156
|
border-radius: var(--rounded-base);
|
|
@@ -272,7 +272,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
272
272
|
border: 1px solid var(--gray-300);
|
|
273
273
|
border-radius: var(--rounded-base);
|
|
274
274
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
275
|
-
margin-
|
|
275
|
+
margin-bottom: var(--spacing-base);
|
|
276
276
|
`,vt=S`
|
|
277
277
|
align-items: center;
|
|
278
278
|
display: flex;
|
|
@@ -302,14 +302,9 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
302
302
|
border: 1px solid var(--gray-300);
|
|
303
303
|
border-radius: var(--rounded-base);
|
|
304
304
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
305
|
+
display: block;
|
|
305
306
|
`,yt=S`
|
|
306
|
-
|
|
307
|
-
position: absolute;
|
|
308
|
-
padding: 0;
|
|
309
|
-
clip: rect(0, 0, 0, 0);
|
|
310
|
-
height: 1px;
|
|
311
|
-
width: 1px;
|
|
312
|
-
overflow: hidden;
|
|
307
|
+
display: none;
|
|
313
308
|
`,St=S`
|
|
314
309
|
overflow-y: auto;
|
|
315
310
|
max-height: 16rem;
|
|
@@ -359,37 +354,37 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
359
354
|
`,he=S`
|
|
360
355
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
361
356
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
362
|
-
`;import{css as
|
|
357
|
+
`;import{css as V}from"@emotion/react";import{InputSelect as Qr,scrollbarStyles as Nr,Button as be,Callout as _r,InputKeywordSearch as Zr,LoadingIndicator as xt,Menu as qr,MenuItem as Wr}from"@uniformdev/design-system";var Jr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(_r,{type:"info"},o)},Lt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:c,select:d,multiSelect:v,multiSelectId:b,rowComponent:h,selectedItemComponent:u,totalResults:s,resultsLoading:g,requireContentType:f,onAddNew:H,onEditClosed:M,onCancel:F,noResultsComponent:G,helpComponent:z,onSort:A})=>{var Re,ke,xe;let E=()=>f?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[I,i]=L.useState(""),[m,T]=L.useState(E),[_,ce]=L.useState(!1),[X,Y]=L.useState([]),[Kt,Se]=L.useState(!1),j=Or(I,750);L.useEffect(()=>{t(j,{count:5,offset:0,contentType:m==="any"?void 0:m})},[j,m]);let Qt=a=>{X.includes(a.id)?Y(y=>y.filter($=>$!==a.id)):Y(v?y=>[...y,a==null?void 0:a.id]:[a.id])},Nt=()=>{T(E()),i(""),Y(r!=null&&r.length?r.map(a=>a.id):[])},_t=()=>{ce(a=>!a),_||Nt()},we=a=>{d((r==null?void 0:r.filter(y=>y.id!==a.id).map(y=>y.id))||[],"")},Zt=a=>{a.preventDefault(),d(X,m),ce(!1)},qt=a=>{a.preventDefault(),ce(!1),F&&F()},Wt=a=>{a.preventDefault(),t(j,{count:5,offset:(n==null?void 0:n.length)||0,contentType:m==="any"?void 0:m}),Se(!0);let y=setTimeout(()=>{Se(!1)},750);return()=>clearTimeout(y)},de=L.useRef(Hr()),Jt=!(r==null?void 0:r.length)||v,Xt=h||gt,Ce=u||st,Yt=G||Jr,Pe=c&&typeof c!="string"?c:null,jt=Pe?e(Pe,{css:he}):e("img",{src:c,alt:"CMS logo",css:he}),er=a=>{var y,$;if(a.destination&&a.source.droppableId===((y=a.destination)==null?void 0:y.droppableId)){let R=[...r||[]],[Z]=($=R==null?void 0:R.splice(a.source.index,1))!=null?$:[];return R==null||R.splice(a.destination.index,0,Z),A==null||A(R.map(tr=>tr.id)),R}};return e("div",{css:V`
|
|
363
358
|
width: 100%;
|
|
364
|
-
`},e("div",{css:
|
|
359
|
+
`},e("div",{css:V`
|
|
365
360
|
position: relative;
|
|
366
361
|
margin-block: var(--spacing-base);
|
|
367
|
-
`},Jt&&e(
|
|
362
|
+
`},Jt&&e(L.Fragment,null,e("div",{css:ft,"data-test-id":"component-search"},e("button",{css:vt,onClick:_t,type:"button","aria-haspopup":!0,"aria-expanded":_,"aria-controls":`entry-search-config-${de.current}`},jt,e("span",{css:V`
|
|
368
363
|
margin-left: var(--spacing-base);
|
|
369
|
-
`},"Select"),e("span",{css:wt},e(ne,{css:[Ct,_?
|
|
364
|
+
`},"Select"),e("span",{css:wt},e(ne,{css:[Ct,_?V`
|
|
370
365
|
transform: rotate(180deg);
|
|
371
|
-
`:void 0]})))),e("div",{id:`entry-search-config-${de.current}`,"aria-hidden":!_,css:[bt,_?void 0:yt]},z||null,e("div",{css:
|
|
366
|
+
`:void 0]})))),e("div",{id:`entry-search-config-${de.current}`,"aria-hidden":!_,css:[bt,_?void 0:yt]},z||null,e("div",{css:V`
|
|
372
367
|
display: flex;
|
|
373
368
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
374
369
|
margin-bottom: var(--spacing-base);
|
|
375
|
-
`},e(Qr,{onChange:a=>T(a.target.value),value:m,label:"Content Type Select",showLabel:!1,options:[...f?[]:[{value:"any",label:"All content types"}],...o?o.map(a=>({value:a.id,label:a.name})):[]]}),e("div",{css:
|
|
370
|
+
`},e(Qr,{onChange:a=>T(a.target.value),value:m,label:"Content Type Select",showLabel:!1,options:[...f?[]:[{value:"any",label:"All content types"}],...o?o.map(a=>({value:a.id,label:a.name})):[]]}),e("div",{css:V`
|
|
376
371
|
flex-grow: 1;
|
|
377
|
-
`},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:i,disabledFieldSubmission:!0,value:I}))),e("div",{css:[St,Nr],id:de.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(a=>e(Xt,{key:a.id,isSelected:X.includes(a.id),result:a,triggerSelection:()=>Qt(a)})):g?null:e(Yt,{searchText:j||I,selectedContentType:(ke=(Re=o==null?void 0:o.find(a=>a.id===m))==null?void 0:Re.name)!=null?ke:m}),!g&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{css:ht,onClick:Wt},Kt?e(xt,null):"Load More"),g&&!(n!=null&&n.length)?e("div",{css:
|
|
372
|
+
`},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:i,disabledFieldSubmission:!0,value:I}))),e("div",{css:[St,Nr],id:de.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(a=>e(Xt,{key:a.id,isSelected:X.includes(a.id),result:a,triggerSelection:()=>Qt(a)})):g?null:e(Yt,{searchText:j||I,selectedContentType:(ke=(Re=o==null?void 0:o.find(a=>a.id===m))==null?void 0:Re.name)!=null?ke:m}),!g&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{css:ht,onClick:Wt},Kt?e(xt,null):"Load More"),g&&!(n!=null&&n.length)?e("div",{css:V`
|
|
378
373
|
padding: var(--spacing-base);
|
|
379
374
|
text-align: center;
|
|
380
375
|
width: 100%;
|
|
381
|
-
`},e(xt,null)):null),e("div",{css:
|
|
376
|
+
`},e(xt,null)):null),e("div",{css:V`
|
|
382
377
|
display: flex;
|
|
383
378
|
justify-content: space-between;
|
|
384
|
-
`},e("div",null,H&&((xe=o==null?void 0:o.length)!=null?xe:0)>0?e(qr,{menuLabel:"Add new menu",menuTrigger:e(be,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(a=>e(Wr,{key:a.id,css:
|
|
379
|
+
`},e("div",null,H&&((xe=o==null?void 0:o.length)!=null?xe:0)>0?e(qr,{menuLabel:"Add new menu",menuTrigger:e(be,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(a=>e(Wr,{key:a.id,css:V`
|
|
385
380
|
background: var(--white);
|
|
386
381
|
color: var(--brand-secondary-1);
|
|
387
|
-
`,onClick:()=>H(a)},a.name))):null),e("div",{css:
|
|
382
|
+
`,onClick:()=>H(a)},a.name))):null),e("div",{css:V`
|
|
388
383
|
display: flex;
|
|
389
384
|
gap: var(--spacing-base);
|
|
390
|
-
`},e(be,{buttonType:"unimportant",onClick:qt},"Cancel"),e(be,{disabled:!X.length,onClick:Zt,"data-test-id":"entry-accept-button"},"Accept"))))),v?e($r,{onDragEnd:a=>er(a)},e(Fr,{droppableId:b||"canvas-multi-select"},a=>e("div",{...a.droppableProps,ref:a.innerRef,css:
|
|
385
|
+
`},e(be,{buttonType:"unimportant",onClick:qt},"Cancel"),e(be,{disabled:!X.length,onClick:Zt,"data-test-id":"entry-accept-button"},"Accept"))))),v?e($r,{onDragEnd:a=>er(a)},e(Fr,{droppableId:b||"canvas-multi-select"},a=>e("div",{...a.droppableProps,ref:a.innerRef,css:V`
|
|
391
386
|
margin-block: var(--spacing-sm) 0;
|
|
392
|
-
`},r==null?void 0:r.map((y,$)=>{if(y!=null&&y.id)return e(Kr,{key:y.id,draggableId:y.id,index:$},R=>e("div",{css:Pt,ref:R.innerRef,...R.draggableProps,...R.dragHandleProps},e("span",{css:Rt},e(W,{css:[ve,kt],width:24,height:24}),e(W,{css:ve,width:24,height:24})),e(Ce,{key:`selected-item-${y.id}`,logoIcon:c,selectedItem:y,onDeselect:Z=>we(Z),onEditClosed:
|
|
387
|
+
`},r==null?void 0:r.map((y,$)=>{if(y!=null&&y.id)return e(Kr,{key:y.id,draggableId:y.id,index:$},R=>e("div",{css:Pt,ref:R.innerRef,...R.draggableProps,...R.dragHandleProps},e("span",{css:Rt},e(W,{css:[ve,kt],width:24,height:24}),e(W,{css:ve,width:24,height:24})),e(Ce,{key:`selected-item-${y.id}`,logoIcon:c,selectedItem:y,onDeselect:Z=>we(Z),onEditClosed:M?Z=>M(Z):void 0})))}),a.placeholder))):r==null?void 0:r.map(a=>e(Ce,{key:`selected-item-${a.id}`,logoIcon:c,selectedItem:a,onDeselect:y=>we(y),onEditClosed:M?y=>M(y):void 0}))))};import{css as O}from"@emotion/react";var Mt=O`
|
|
393
388
|
cursor: pointer;
|
|
394
389
|
padding: var(--spacing-sm) 0;
|
|
395
390
|
margin-right: var(--spacing-sm);
|
|
@@ -519,4 +514,4 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
519
514
|
font-size: var(--fs-sm);
|
|
520
515
|
`},"Unlink"),e(K,{css:P`
|
|
521
516
|
color: var(--brand-secondary-5);
|
|
522
|
-
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:
|
|
517
|
+
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:M}=Ft(async()=>{if(!t)return;let i=await o({ids:t});return Array.isArray(i)?i:void 0},[o,t]),F=to(()=>s?s.map(m=>({id:m.id,name:m.name})):void 0,[s]),G=ro(),[z,A]=no(async(i,m)=>{let T=await c({text:i,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(G.current=[]),(G.current=G.current||[]).push(...T.products),T},[c]),J=async i=>{i&&await n(i)};return g?e(oo,null):f||M||z.error?e("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(M==null?void 0:M.message)||((E=z.error)==null?void 0:E.message)):e($t.Provider,{value:{categories:s,logoIcon:d}},e(Lt,{search:A,results:G.current,logoIcon:d,selectedItems:H,select:J,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:F,selectedItemComponent:h||Ht,rowComponent:u||Ut,totalResults:(I=z.value)==null?void 0:I.total,resultsLoading:z.loading}))}var $t=jr.createContext(void 0),ie=()=>{let t=eo($t);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Na,Callout as _a,LoadingIndicator as Za,LoadingOverlay as qa,Menu as Wa,MenuItem as Ja,Input as Xa,InputSelect as Ya,InputToggle as ja,Theme as ei,InputKeywordSearch as ti,Heading as ri,ScrollableList as oi,ScrollableListItem as ni,Textarea as ai}from"@uniformdev/design-system";export{Na as Button,_a as Callout,gt as DefaultSearchRow,st as DefaultSelectedItem,Lt as EntrySearch,ri as Heading,me as Icons,Xa as Input,Ya as InputSelect,ja as InputToggle,ti as KeywordSearchInput,Za as LoadingIndicator,qa as LoadingOverlay,Wa as Menu,Ja as MenuItem,$e as ProductPreviewList,Zo as ProductQuery,He as ProductQueryContext,Ua as ProductSearch,$t as ProductSearchContext,Ut as ProductSearchRow,Ht as ProductSelectedItem,Ge as ResolvableLoadingValue,oi as ScrollableList,ni as ScrollableListItem,ze as SelectionField,ai as Textarea,ei as Theme,Le as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,ko as UniformMeshSdkContextProvider,he as badgeIcon,Pt as draggableContainer,ve as draggableIcon,kt as draggableIconOffset,Rt as draggableIconWrapper,vt as entrySearchBtn,bt as entrySearchConfig,yt as entrySearchConfigHidden,ht as entrySearchLoadMoreBtn,St as entrySearchResultList,wt as entrySearchSelectIcon,Ct as entrySearchSelectImg,Zn as entrySearchSelectInput,qn as entrySearchSelectOption,ft as entrySearchWrapper,Gt as productSearchRowActiveIcon,Tt as productSearchRowCategory,Mt as productSearchRowContainer,Vt as productSearchRowContent,Et as productSearchRowContentActive,Dt as productSearchRowDetails,It as productSearchRowTitle,At as productSelectedItemContainer,Ot as productSelectedItemContent,Bt as productSelectedItemDetails,ye as productSelectedItemImage,pt as searchRowBtn,ct as searchRowContainer,dt as searchRowContainerActive,lt as searchRowPopover,fe as searchRowText,ge as searchRowTextSmall,ue as selectItemLinkBtn,at as selectItemLinkContainer,nt as selectItemPopover,ae as selectItemPopoverLabel,B as selectItemSmallText,ot as selectedItemCloseIcon,Xe as selectedItemContainer,et as selectedItemCopy,je as selectedItemDetails,rt as selectedItemIcon,Ye as selectedItemInner,tt as selectedItemTitle,yo as useInitializeUniformMeshSdk,Fe as useProductQueryContext,ie as useProductSearchContext,go as useUniformMeshLocation,Ve as useUniformMeshLocationContext,Mo as useUniformMeshSdk,Te as useUniformMeshSdkContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "13.0.1-alpha.
|
|
3
|
+
"version": "13.0.1-alpha.278+8557f2dc1",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,34 +44,36 @@
|
|
|
44
44
|
"storybook:publish": "pnpm build && pnpm build-storybook -o ./out"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@uniformdev/
|
|
49
|
-
"@uniformdev/mesh-sdk": "^13.0.1-alpha.132+8cada5baa",
|
|
47
|
+
"@uniformdev/design-system": "^13.0.1-alpha.278+8557f2dc1",
|
|
48
|
+
"@uniformdev/mesh-sdk": "^13.0.1-alpha.278+8557f2dc1",
|
|
50
49
|
"react-beautiful-dnd": "13.1.0",
|
|
51
50
|
"react-use": "17.3.2",
|
|
52
51
|
"timeago.js": "4.0.2",
|
|
53
52
|
"uuid": "8.3.2"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
|
-
"react": ">=
|
|
55
|
+
"@emotion/react": ">=11.8.0",
|
|
56
|
+
"react": ">=16.8",
|
|
57
|
+
"react-dom": ">=16.8"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@babel/core": "7.17.
|
|
60
|
+
"@babel/core": "7.17.9",
|
|
60
61
|
"@babel/preset-env": "7.16.11",
|
|
61
62
|
"@babel/preset-react": "7.16.7",
|
|
62
63
|
"@babel/preset-typescript": "7.16.7",
|
|
63
64
|
"@emotion/babel-preset-css-prop": "11.2.0",
|
|
64
|
-
"@
|
|
65
|
-
"@storybook/addon-
|
|
65
|
+
"@emotion/react": "11.9.0",
|
|
66
|
+
"@storybook/addon-controls": "6.4.22",
|
|
67
|
+
"@storybook/addon-essentials": "6.4.22",
|
|
66
68
|
"@storybook/addon-postcss": "2.0.0",
|
|
67
|
-
"@storybook/react": "6.4.
|
|
69
|
+
"@storybook/react": "6.4.22",
|
|
68
70
|
"@svgr/cli": "6.2.1",
|
|
69
71
|
"@types/react": "17.0.44",
|
|
70
72
|
"@types/react-beautiful-dnd": "13.1.2",
|
|
71
73
|
"@types/uuid": "8.3.4",
|
|
72
74
|
"react": "17.0.2",
|
|
73
75
|
"react-dom": "17.0.2",
|
|
74
|
-
"webpack": "5.
|
|
76
|
+
"webpack": "5.72.0"
|
|
75
77
|
},
|
|
76
78
|
"files": [
|
|
77
79
|
"/dist"
|
|
@@ -79,5 +81,5 @@
|
|
|
79
81
|
"publishConfig": {
|
|
80
82
|
"access": "public"
|
|
81
83
|
},
|
|
82
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "8557f2dc1d71ce4c26b588fb5a4d8659a4ff3966"
|
|
83
85
|
}
|