@uniformdev/mesh-sdk-react 13.0.0-beta.0 → 13.0.1-alpha.271
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +311 -14
- package/dist/index.esm.js +517 -1
- package/dist/index.js +517 -1
- package/dist/index.mjs +517 -1
- package/package.json +59 -22
package/dist/index.js
CHANGED
|
@@ -1 +1,517 @@
|
|
|
1
|
-
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:()=>v.Button,Callout:()=>v.Callout,DefaultSearchRow:()=>it,DefaultSelectedItem:()=>et,EntrySearch:()=>bt,Heading:()=>v.Heading,Icons:()=>Re,Input:()=>v.Input,InputSelect:()=>v.InputSelect,InputToggle:()=>v.InputToggle,KeywordSearchInput:()=>v.InputKeywordSearch,LoadingIndicator:()=>v.LoadingIndicator,LoadingOverlay:()=>v.LoadingOverlay,Menu:()=>v.Menu,MenuItem:()=>v.MenuItem,ProductPreviewList:()=>Ke,ProductQuery:()=>Dr,ProductQueryContext:()=>Fe,ProductSearch:()=>qr,ProductSearchContext:()=>Tt,ProductSearchRow:()=>Lt,ProductSelectedItem:()=>It,ResolvableLoadingValue:()=>Oe,ScrollableList:()=>v.ScrollableList,ScrollableListItem:()=>v.ScrollableListItem,SelectionField:()=>He,Theme:()=>v.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 f=(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..."},...f.map(m=>({value:m.id,label:m.name||m.id}))],css:Array.isArray(r)&&r.length>0?ee.css`
|
|
2
|
+
margin-bottom: var(--spacing-base);
|
|
3
|
+
`:""}),r==null?void 0:r.map(m=>{var c;return(0,e.jsx)("div",{css:ee.css`
|
|
4
|
+
font-size: var(--fs-sm);
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
background-color: var(--gray-100);
|
|
9
|
+
border: 1px solid var(--gray-300);
|
|
10
|
+
margin-bottom: var(--spacing-sm);
|
|
11
|
+
margin-right: var(--spacing-sm);
|
|
12
|
+
`,key:m},(0,e.jsx)("span",{css:ee.css`
|
|
13
|
+
padding: var(--spacing-3);
|
|
14
|
+
color: var(--gray-800);
|
|
15
|
+
`},(0,e.jsx)(Oe,{value:m,loading:n,text:(c=o.find(u=>u.id===m))==null?void 0:c.name})),(0,e.jsx)("button",{css:ee.css`
|
|
16
|
+
padding: var(--spacing-3);
|
|
17
|
+
border-left: 1px solid var(--gray-300);
|
|
18
|
+
`,title:"remove",onClick:u=>b(u,m)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:ee.css`
|
|
19
|
+
height: 1.25rem;
|
|
20
|
+
width: 1.25rem;
|
|
21
|
+
pointer-events: none;
|
|
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"})),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:f,logoIcon:b,onGetProducts:h,sortOptions:m,sortOrderOptions:c})=>{var U;let u=async s=>{n({...Qt,...t||{},...s})},g=(0,K.useMemo)(()=>({...Qt,...t||{}}),[t]),[J,T]=(0,we.useAsyncFn)(async s=>await h(s),[h]);(0,we.useDebounce)(async()=>{await T({brand:g.brand,categories:g.categories,keyword:g.keyword,sort:g.sort,sortOrder:g.sortOrder,count:g.count})},250,[g]);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)||[];u({categories:[...p,s]})},q=s=>{var p;u({categories:(p=t==null?void 0:t.categories)==null?void 0:p.filter(A=>A!==s)})},me=s=>{u({brand:s.target.value})},z=s=>{u({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
|
+
> :not(:last-child) {
|
|
25
|
+
margin-bottom: var(--spacing-md);
|
|
26
|
+
}
|
|
27
|
+
`},(0,e.jsx)(He,{loading:d||!1,name:"Product Category",onAdd:F,onRemove:q,selectedValues:g.categories,values:X}),(0,e.jsx)("div",{css:C.css`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
column-gap: var(--spacing-lg);
|
|
31
|
+
row-gap: var(--spacing-md);
|
|
32
|
+
${(0,M.mq)("md")} {
|
|
33
|
+
flex-wrap: nowrap;
|
|
34
|
+
}
|
|
35
|
+
`},(0,e.jsx)("div",{css:C.css`
|
|
36
|
+
width: 50%;
|
|
37
|
+
flex-grow: 1;
|
|
38
|
+
`},(0,e.jsx)(M.InputSelect,{id:"brand",name:"brand",label:"Brand",disabled:f,value:g.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
|
+
flex-grow: 1;
|
|
40
|
+
position: relative;
|
|
41
|
+
`},(0,e.jsx)(M.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:g.count,onChange:s=>z(s.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:C.css`
|
|
42
|
+
position: absolute;
|
|
43
|
+
bottom: var(--spacing-sm);
|
|
44
|
+
right: var(--spacing-sm);
|
|
45
|
+
display: flex;
|
|
46
|
+
gap: var(--spacing-sm);
|
|
47
|
+
`},(0,e.jsx)(Nt,{onCountChange:()=>z(g.count-1),countIcon:"decrement",disabled:g.count===1}),(0,e.jsx)(Nt,{onCountChange:()=>z(g.count+1),countIcon:"increment"})))),(0,e.jsx)("div",{css:C.css`
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
column-gap: var(--spacing-lg);
|
|
51
|
+
row-gap: var(--spacing-md);
|
|
52
|
+
${(0,M.mq)("md")} {
|
|
53
|
+
flex-wrap: nowrap;
|
|
54
|
+
}
|
|
55
|
+
`},(0,e.jsx)("div",{css:C.css`
|
|
56
|
+
width: 100%;
|
|
57
|
+
${(0,M.mq)("md")} {
|
|
58
|
+
width: 33.333333%;
|
|
59
|
+
}
|
|
60
|
+
`},(0,e.jsx)(M.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:g.keyword,placeholder:"Enter keyword",onChange:s=>u({keyword:s.target.value})})),Array.isArray(m)&&m.length>0?(0,e.jsx)("div",{css:C.css`
|
|
61
|
+
flex-grow: 1;
|
|
62
|
+
${(0,M.mq)("md")} {
|
|
63
|
+
width: 33.333333%;
|
|
64
|
+
}
|
|
65
|
+
`},(0,e.jsx)(M.InputSelect,{id:"sort",name:"sort",label:"Sort",value:g.sort,onChange:s=>u({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
|
+
flex-grow: 1;
|
|
67
|
+
`},(0,e.jsx)(M.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:g.sortOrder,onChange:s=>u({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
|
+
font-size: var(--fs-md);
|
|
69
|
+
line-height: var(--spacing-md);
|
|
70
|
+
font-weight: var(--fw-bold);
|
|
71
|
+
margin-bottom: var(--spacing-xs);
|
|
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(f=>{let b=_t(f,a);r.push(...b)}),r}function Nt({onCountChange:t,countIcon:n,disabled:r}){return(0,e.jsx)("button",{css:C.css`
|
|
73
|
+
width: 2.25rem;
|
|
74
|
+
height: 2.25rem;
|
|
75
|
+
border: 1px solid var(--gray-300);
|
|
76
|
+
border-radius: var(--rounded-base);
|
|
77
|
+
background-color: var(--gray-100);
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
&:hover {
|
|
82
|
+
background-color: var(--gray-200);
|
|
83
|
+
}
|
|
84
|
+
${r?C.css`
|
|
85
|
+
cursor: not-allowed;
|
|
86
|
+
opacity: 0.3;
|
|
87
|
+
`:""}
|
|
88
|
+
`,onClick:t,disabled:r},n==="increment"?(0,e.jsx)(ye,{css:C.css`
|
|
89
|
+
width: 1rem;
|
|
90
|
+
height: 1rem;
|
|
91
|
+
`}):(0,e.jsx)(Se,{css:C.css`
|
|
92
|
+
width: 1rem;
|
|
93
|
+
height: 1rem;
|
|
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
|
+
margin-bottom: var(--spacing-base);
|
|
96
|
+
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[P.css`
|
|
97
|
+
max-height: 24rem;
|
|
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)||[],f=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
|
+
border: 1px solid var(--gray-300);
|
|
101
|
+
border-radius: var(--rounded-md);
|
|
102
|
+
background-color: var(--gray-100);
|
|
103
|
+
margin: var(--spacing-base) 0;
|
|
104
|
+
`},(0,e.jsx)("div",{css:P.css`
|
|
105
|
+
padding: var(--spacing-sm);
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-grow: 1;
|
|
108
|
+
margin-right: var(--spacing-sm);
|
|
109
|
+
gap: var(--spacing-base);
|
|
110
|
+
align-items: center;
|
|
111
|
+
`},o.thumbnailUrl?(0,e.jsx)("img",{src:o.thumbnailUrl,alt:o.name||`Product ${a}`,css:P.css`
|
|
112
|
+
background-color: var(--gray-200);
|
|
113
|
+
width: 3.5rem;
|
|
114
|
+
height: 3.5rem;
|
|
115
|
+
object-fit: cover;
|
|
116
|
+
`}):(0,e.jsx)("div",{css:P.css`
|
|
117
|
+
height: 3.5rem;
|
|
118
|
+
width: 3.5rem;
|
|
119
|
+
background-color: var(--gray-100);
|
|
120
|
+
`}),(0,e.jsx)("h4",{css:P.css`
|
|
121
|
+
font-weight: var(--fw-bold);
|
|
122
|
+
width: 33.333333%;
|
|
123
|
+
font-size: var(--fs-sm);
|
|
124
|
+
`},o.name,f&&(0,e.jsx)("span",{css:P.css`
|
|
125
|
+
display: block;
|
|
126
|
+
font-weight: var(--fw-regular);
|
|
127
|
+
`},f)),o&&(0,e.jsx)(Qe.default.Fragment,null,(0,e.jsx)("p",{css:P.css`
|
|
128
|
+
margin-right: var(--spacing-lg);
|
|
129
|
+
font-size: var(--fs-sm);
|
|
130
|
+
`},"SKU: ",o.sku," ",o.id,(0,e.jsx)("br",null)),o.price&&(0,e.jsx)("p",{css:P.css`
|
|
131
|
+
margin-right: var(--spacing-lg);
|
|
132
|
+
font-size: var(--fs-sm);
|
|
133
|
+
`},o.price&&(0,e.jsx)("span",{css:P.css`
|
|
134
|
+
display: block;
|
|
135
|
+
`},"Price: ",o.price)),(0,e.jsx)("a",{css:P.css`
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
justify-content: space-between;
|
|
138
|
+
align-items: center;
|
|
139
|
+
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
140
|
+
background-color: var(--white);
|
|
141
|
+
border-radius: var(--rounded-base);
|
|
142
|
+
border: 2px solid var(--gray-400);
|
|
143
|
+
margin-left: auto;
|
|
144
|
+
&:hover {
|
|
145
|
+
background-color: var(--gray-100);
|
|
146
|
+
}
|
|
147
|
+
`,href:o.url,title:`Goto ${o.name}`,target:"__blank",rel:"noopener"},(0,e.jsx)("span",{css:P.css`
|
|
148
|
+
font-size: var(--fs-sm);
|
|
149
|
+
margin-right: var(--spacing-sm);
|
|
150
|
+
`},"Edit"),r?(0,e.jsx)(Q,{src:r,alt:"Logo",css:P.css`
|
|
151
|
+
width: 2.25rem;
|
|
152
|
+
height: 2.25rem;
|
|
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
|
+
border: 1px solid var(--gray-200);
|
|
155
|
+
background: var(--gray-50);
|
|
156
|
+
border-radius: var(--rounded-base);
|
|
157
|
+
display: flex;
|
|
158
|
+
width: 100%;
|
|
159
|
+
`,_e=k.css`
|
|
160
|
+
align-items: center;
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-grow: 1;
|
|
163
|
+
gap: var(--spacing-sm);
|
|
164
|
+
margin-inline: 0 var(--spacing-sm);
|
|
165
|
+
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
166
|
+
position: relative;
|
|
167
|
+
`,Ze=k.css`
|
|
168
|
+
flex-grow: 1;
|
|
169
|
+
`,qe=k.css`
|
|
170
|
+
align-items: start;
|
|
171
|
+
display: inline-flex;
|
|
172
|
+
position: relative;
|
|
173
|
+
`,We=k.css`
|
|
174
|
+
color: var(--brand-secondary-1);
|
|
175
|
+
font-size: var(--fs-base);
|
|
176
|
+
font-weight: var(--fw-bold);
|
|
177
|
+
line-height: 1;
|
|
178
|
+
`,Je=k.css`
|
|
179
|
+
width: 1.5rem;
|
|
180
|
+
height: 1.5rem;
|
|
181
|
+
`,Xe=k.css`
|
|
182
|
+
width: 1rem;
|
|
183
|
+
height: 1rem;
|
|
184
|
+
`,Ye=k.css`
|
|
185
|
+
background: var(--white);
|
|
186
|
+
border-radius: var(--rounded-base);
|
|
187
|
+
border-left: 4px solid var(--brand-secondary-3);
|
|
188
|
+
position: fixed;
|
|
189
|
+
padding: var(--spacing-base);
|
|
190
|
+
z-index: var(--z-10);
|
|
191
|
+
width: max-content;
|
|
192
|
+
`,N=k.css`
|
|
193
|
+
font-size: var(--fs-sm);
|
|
194
|
+
`,ce=k.css`
|
|
195
|
+
font-weight: var(--fw-bold);
|
|
196
|
+
margin-right: var(--spacing-sm);
|
|
197
|
+
`,je=k.css`
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: var(--spacing-sm);
|
|
201
|
+
|
|
202
|
+
${(0,tr.mq)("md")} {
|
|
203
|
+
flex-direction: row;
|
|
204
|
+
}
|
|
205
|
+
`,ke=k.css`
|
|
206
|
+
align-items: center;
|
|
207
|
+
background: var(--white);
|
|
208
|
+
border-radius: var(--rounded-base);
|
|
209
|
+
border: 2px solid var(--gray-300);
|
|
210
|
+
display: flex;
|
|
211
|
+
gap: var(--spacing-sm);
|
|
212
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
213
|
+
justify-content: space-between;
|
|
214
|
+
|
|
215
|
+
&:hover {
|
|
216
|
+
background: var(--gray-50);
|
|
217
|
+
}
|
|
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),[f,b]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let c=g=>{a.current&&!a.current.contains(g.target)&&d.current&&!d.current.contains(g.target)&&b(!1)},u=()=>{b(!1)};return window.addEventListener("resize",u,!0),document.addEventListener("scroll",c,!0),document.addEventListener("mousedown",c),()=>{window.removeEventListener("resize",u,!0),document.removeEventListener("scroll",c,!0),document.removeEventListener("mousedown",c)}},[d]);let h=()=>{var c;if(b(!f),d.current&&a.current){let u=(c=a==null?void 0:a.current)==null?void 0:c.getBoundingClientRect();d.current.style.top=`${u.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
|
+
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:G.css`
|
|
221
|
+
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
222
|
+
`,"aria-controls":"path-details","aria-expanded":f,onClick:h},(0,e.jsx)(re,{width:24,height:24,css:G.css`
|
|
223
|
+
color: var(--gray-400);
|
|
224
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!f,ref:d,css:[Ye,f?G.css`
|
|
225
|
+
visibility: visible;
|
|
226
|
+
`:G.css`
|
|
227
|
+
visibility: hidden;
|
|
228
|
+
`]},Object.entries(t.popoverData).map(([c,u],g)=>(0,e.jsx)("div",{css:N,key:g},(0,e.jsx)("span",{css:ce},c,":"),u)))):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
|
+
display: flex;
|
|
230
|
+
gap: var(--spacing-base);
|
|
231
|
+
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,u])=>(0,e.jsx)("span",{css:N,key:c},u)):null),t.metadata?Object.entries(t.metadata).filter(([c])=>!["type","status"].includes(c.toLocaleLowerCase())).map(([c,u])=>(0,e.jsx)("div",{css:[N,G.css`
|
|
232
|
+
order: 1;
|
|
233
|
+
`],key:c},(0,e.jsx)("span",{css:[ce,G.css`
|
|
234
|
+
order: 1;
|
|
235
|
+
`]},c,":"),u)):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
|
+
color: var(--brand-secondary-5);
|
|
237
|
+
`]})))))};var O=$(require("react"));var W=require("@emotion/react"),tt=W.css`
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
padding: var(--spacing-sm);
|
|
240
|
+
position: relative;
|
|
241
|
+
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
242
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
243
|
+
`,rt=W.css`
|
|
244
|
+
background: var(--brand-secondary-3);
|
|
245
|
+
color: var(--white);
|
|
246
|
+
`,xe=W.css`
|
|
247
|
+
font-size: var(--fs-xs);
|
|
248
|
+
`,Le=W.css`
|
|
249
|
+
font-weight: var(--fw-bold);
|
|
250
|
+
margin-right: var(--spacing-sm);
|
|
251
|
+
`,ot=W.css`
|
|
252
|
+
background: var(--white);
|
|
253
|
+
border-left: 4px solid var(--brand-secondary-3);
|
|
254
|
+
border-radius: var(--rounded-base);
|
|
255
|
+
box-shadow: var(--shadow-base);
|
|
256
|
+
color: var(--brand-secondary-1);
|
|
257
|
+
padding: var(--spacing-base);
|
|
258
|
+
position: absolute;
|
|
259
|
+
top: var(--spacing-base);
|
|
260
|
+
right: var(--spacing-xl);
|
|
261
|
+
z-index: var(--z-10);
|
|
262
|
+
width: max-content;
|
|
263
|
+
`,nt=W.css`
|
|
264
|
+
position: absolute;
|
|
265
|
+
inset: 0 var(--spacing-sm) 0 auto;
|
|
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,f]=(0,O.useState)(!1);(0,O.useEffect)(()=>{function h(m){o.current&&!o.current.contains(m.target)&&a.current&&!a.current.contains(m.target)&&f(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[a]);let b=h=>{h.stopPropagation(),f(!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
|
+
visibility: visible;
|
|
268
|
+
`:at.css`
|
|
269
|
+
visibility: hidden;
|
|
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
|
+
background: var(--white);
|
|
272
|
+
border: 1px solid var(--gray-300);
|
|
273
|
+
border-radius: var(--rounded-base);
|
|
274
|
+
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
275
|
+
margin-bottom: var(--spacing-base);
|
|
276
|
+
`,ct=w.css`
|
|
277
|
+
align-items: center;
|
|
278
|
+
display: flex;
|
|
279
|
+
position: relative;
|
|
280
|
+
font-size: var(--fs-base);
|
|
281
|
+
width: 100%;
|
|
282
|
+
background-color: transparent;
|
|
283
|
+
border: 0;
|
|
284
|
+
`,dt=w.css`
|
|
285
|
+
color: var(--brand-secondary-1);
|
|
286
|
+
display: block;
|
|
287
|
+
font-weight: var(--fw-bold);
|
|
288
|
+
font-size: var(--fs-sm);
|
|
289
|
+
padding: var(--spacing-base);
|
|
290
|
+
width: 100%;
|
|
291
|
+
text-align: center;
|
|
292
|
+
border: none;
|
|
293
|
+
background: none;
|
|
294
|
+
|
|
295
|
+
&:focus,
|
|
296
|
+
&:hover {
|
|
297
|
+
background: var(--gray-100);
|
|
298
|
+
outline: none;
|
|
299
|
+
}
|
|
300
|
+
`,lt=w.css`
|
|
301
|
+
background: var(--white);
|
|
302
|
+
border: 1px solid var(--gray-300);
|
|
303
|
+
border-radius: var(--rounded-base);
|
|
304
|
+
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
305
|
+
display: block;
|
|
306
|
+
`,pt=w.css`
|
|
307
|
+
display: none;
|
|
308
|
+
`,mt=w.css`
|
|
309
|
+
overflow-y: auto;
|
|
310
|
+
max-height: 16rem;
|
|
311
|
+
margin-bottom: var(--spacing-base);
|
|
312
|
+
|
|
313
|
+
& > :not(:last-child) {
|
|
314
|
+
border-bottom: 1px solid var(--gray-200);
|
|
315
|
+
}
|
|
316
|
+
`,Nr=w.css`
|
|
317
|
+
background-color: var(--gray-50);
|
|
318
|
+
max-width: 33.33%;
|
|
319
|
+
`,ut=w.css`
|
|
320
|
+
align-items: center;
|
|
321
|
+
display: flex;
|
|
322
|
+
position: absolute;
|
|
323
|
+
inset: 0 0 0 auto;
|
|
324
|
+
pointer-events: none;
|
|
325
|
+
padding-right: var(--spacing-sm);
|
|
326
|
+
`,gt=w.css`
|
|
327
|
+
color: var(--brand-secondary-1);
|
|
328
|
+
width: 1.25rem;
|
|
329
|
+
height: 1.25rem;
|
|
330
|
+
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
331
|
+
transform: rotate(0);
|
|
332
|
+
`,_r=w.css`
|
|
333
|
+
background: var(--white);
|
|
334
|
+
color: var(--brand-secondary-1);
|
|
335
|
+
`,ft=w.css`
|
|
336
|
+
position: relative;
|
|
337
|
+
margin-block: var(--spacing-sm) 0;
|
|
338
|
+
|
|
339
|
+
&:hover > span {
|
|
340
|
+
opacity: 0.3;
|
|
341
|
+
}
|
|
342
|
+
`,vt=w.css`
|
|
343
|
+
align-items: center;
|
|
344
|
+
display: flex;
|
|
345
|
+
position: absolute;
|
|
346
|
+
inset: 0 auto 0 0;
|
|
347
|
+
margin-block: auto;
|
|
348
|
+
opacity: 0;
|
|
349
|
+
`,Me=w.css`
|
|
350
|
+
color: var(--brand-secondary-1);
|
|
351
|
+
`,ht=w.css`
|
|
352
|
+
position: absolute;
|
|
353
|
+
left: 0.375rem;
|
|
354
|
+
`,Ve=w.css`
|
|
355
|
+
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
356
|
+
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
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:f,multiSelectId:b,rowComponent:h,selectedItemComponent:m,totalResults:c,resultsLoading:u,requireContentType:g,onAddNew:J,onEditClosed:T,onCancel:X,noResultsComponent:H,helpComponent:F,onSort:q})=>{var At,Bt,Ot;let z=()=>g?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(f?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)||f,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`
|
|
358
|
+
width: 100%;
|
|
359
|
+
`},(0,e.jsx)("div",{css:V.css`
|
|
360
|
+
position: relative;
|
|
361
|
+
margin-block: var(--spacing-base);
|
|
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`
|
|
363
|
+
margin-left: var(--spacing-base);
|
|
364
|
+
`},"Select"),(0,e.jsx)("span",{css:ut},(0,e.jsx)(Pe,{css:[gt,ne?V.css`
|
|
365
|
+
transform: rotate(180deg);
|
|
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`
|
|
367
|
+
display: flex;
|
|
368
|
+
gap: calc(var(--spacing-base) - 0.25rem);
|
|
369
|
+
margin-bottom: var(--spacing-base);
|
|
370
|
+
`},(0,e.jsx)(S.InputSelect,{onChange:i=>A(i.target.value),value:p,label:"Content Type Select",showLabel:!1,options:[...g?[]:[{value:"any",label:"All content types"}],...r?r.map(i=>({value:i.id,label:i.name})):[]]}),(0,e.jsx)("div",{css:V.css`
|
|
371
|
+
flex-grow: 1;
|
|
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"},!u&&Array.isArray(n)?n.map(i=>(0,e.jsx)(vr,{key:i.id,isSelected:ue.includes(i.id),result:i,triggerSelection:()=>dr(i)})):u?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}),!u&&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"),u&&!(n!=null&&n.length)?(0,e.jsx)("div",{css:V.css`
|
|
373
|
+
padding: var(--spacing-base);
|
|
374
|
+
text-align: center;
|
|
375
|
+
width: 100%;
|
|
376
|
+
`},(0,e.jsx)(S.LoadingIndicator,null)):null),(0,e.jsx)("div",{css:V.css`
|
|
377
|
+
display: flex;
|
|
378
|
+
justify-content: space-between;
|
|
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`
|
|
380
|
+
background: var(--white);
|
|
381
|
+
color: var(--brand-secondary-1);
|
|
382
|
+
`,onClick:()=>J(i)},i.name))):null),(0,e.jsx)("div",{css:V.css`
|
|
383
|
+
display: flex;
|
|
384
|
+
gap: var(--spacing-base);
|
|
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"))))),f?(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`
|
|
386
|
+
margin-block: var(--spacing-sm) 0;
|
|
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`
|
|
388
|
+
cursor: pointer;
|
|
389
|
+
padding: var(--spacing-sm) 0;
|
|
390
|
+
margin-right: var(--spacing-sm);
|
|
391
|
+
position: relative;
|
|
392
|
+
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
393
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
394
|
+
`,St=_.css`
|
|
395
|
+
border: 2px solid transparent;
|
|
396
|
+
border-radius: var(--rounded-base);
|
|
397
|
+
display: flex;
|
|
398
|
+
align-items: center;
|
|
399
|
+
gap: var(--spacing-base);
|
|
400
|
+
padding: var(--spacing-sm) var(--spacing-xs);
|
|
401
|
+
`,wt=_.css`
|
|
402
|
+
background-color: var(--green-50);
|
|
403
|
+
`,Ct=_.css`
|
|
404
|
+
font-size: var(--fs-sm);
|
|
405
|
+
font-weight: var(--fw-bold);
|
|
406
|
+
width: 50%;
|
|
407
|
+
`,Pt=_.css`
|
|
408
|
+
font-weight: var(--fw-normal);
|
|
409
|
+
display: block;
|
|
410
|
+
`,Rt=_.css`
|
|
411
|
+
font-size: var(--fs-sm);
|
|
412
|
+
> * {
|
|
413
|
+
display: block;
|
|
414
|
+
}
|
|
415
|
+
`,kt=_.css`
|
|
416
|
+
display: block;
|
|
417
|
+
height: 1.5rem;
|
|
418
|
+
width: 1.5rem;
|
|
419
|
+
color: var(--brand-secondary-3);
|
|
420
|
+
margin-left: auto;
|
|
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:""}],f=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`
|
|
422
|
+
background-color: var(--gray-200);
|
|
423
|
+
width: 3rem;
|
|
424
|
+
height: 3rem;
|
|
425
|
+
object-fit: cover;
|
|
426
|
+
`}):(0,e.jsx)(Q,{src:a,alt:"Logo",css:xt.css`
|
|
427
|
+
height: 2.25rem;
|
|
428
|
+
width: 2.25rem;
|
|
429
|
+
`}),(0,e.jsx)("h4",{css:[Ct]},t.title,f?(0,e.jsx)("span",{css:[Pt]},f):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`
|
|
430
|
+
display: flex;
|
|
431
|
+
width: 100%;
|
|
432
|
+
border: 1px solid var(--gray-300);
|
|
433
|
+
border-radius: var(--rounded-base);
|
|
434
|
+
background-color: var(--gray-100);
|
|
435
|
+
margin: var(--spacing-base) 0;
|
|
436
|
+
`,Vt=le.css`
|
|
437
|
+
padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
|
|
438
|
+
display: flex;
|
|
439
|
+
flex-grow: 1;
|
|
440
|
+
align-items: center;
|
|
441
|
+
margin-right: var(--spacing-sm);
|
|
442
|
+
gap: var(--spacing-base);
|
|
443
|
+
`,Et=le.css`
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
446
|
+
gap: var(--spacing-sm);
|
|
447
|
+
margin-bottom: var(--spacing-sm);
|
|
448
|
+
${(0,ar.mq)("lg")} {
|
|
449
|
+
width: 50%;
|
|
450
|
+
margin-bottom: 0;
|
|
451
|
+
}
|
|
452
|
+
`,Ee=le.css`
|
|
453
|
+
background-color: var(--gray-200);
|
|
454
|
+
width: 3.5rem;
|
|
455
|
+
height: 3.5rem;
|
|
456
|
+
object-fit: cover;
|
|
457
|
+
`;var R=require("@emotion/react"),ir=require("@uniformdev/design-system");function It({selectedItem:t,onDeselect:n}){var f;let{categories:r,logoIcon:o}=de(),[a]=t.categories||[{id:"",name:""}],d=typeof a=="undefined"||!r||(f=r.find(b=>b.id===a.id))==null?void 0:f.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`
|
|
458
|
+
> :not(:last-child) {
|
|
459
|
+
margin-bottom: var(--spacing-xs);
|
|
460
|
+
}
|
|
461
|
+
`},(0,e.jsx)("h4",{css:R.css`
|
|
462
|
+
font-weight: var(--fw-bold);
|
|
463
|
+
`},t.title||t.id||"",d&&(0,e.jsx)("span",{css:R.css`
|
|
464
|
+
display: block;
|
|
465
|
+
font-weight: var(--fw-regular);
|
|
466
|
+
`},d)),(0,e.jsx)("ul",{css:R.css`
|
|
467
|
+
font-size: var(--fs-sm);
|
|
468
|
+
display: flex;
|
|
469
|
+
gap: var(--spacing-base);
|
|
470
|
+
`},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:R.css`
|
|
471
|
+
margin-right: var(--spacing-xs);
|
|
472
|
+
`},"SKU:"),t.id),t.price&&(0,e.jsx)("li",null,(0,e.jsx)("span",{css:R.css`
|
|
473
|
+
margin-right: var(--spacing-xs);
|
|
474
|
+
`},"Price:"),(0,e.jsx)("span",null,t.price))))),(0,e.jsx)("div",{css:R.css`
|
|
475
|
+
display: flex;
|
|
476
|
+
flex-wrap: wrap;
|
|
477
|
+
gap: var(--spacing-sm);
|
|
478
|
+
justify-content: flex-end;
|
|
479
|
+
margin-left: auto;
|
|
480
|
+
${(0,ir.mq)("md")} {
|
|
481
|
+
align-items: center;
|
|
482
|
+
}
|
|
483
|
+
`},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:R.css`
|
|
484
|
+
display: inline-flex;
|
|
485
|
+
justify-content: space-between;
|
|
486
|
+
align-items: center;
|
|
487
|
+
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
488
|
+
background-color: var(--white);
|
|
489
|
+
border-radius: var(--rounded-base);
|
|
490
|
+
border: 2px solid var(--gray-400);
|
|
491
|
+
&:hover {
|
|
492
|
+
background-color: var(--gray-100);
|
|
493
|
+
}
|
|
494
|
+
`},(0,e.jsx)("span",{css:R.css`
|
|
495
|
+
margin-right: var(--spacing-sm);
|
|
496
|
+
font-size: var(--fs-sm);
|
|
497
|
+
`},"Edit"),(0,e.jsx)(Q,{src:o,alt:"Logo",css:R.css`
|
|
498
|
+
width: 1.75rem;
|
|
499
|
+
height: 1.75rem;
|
|
500
|
+
display: block;
|
|
501
|
+
`})):null,(0,e.jsx)("button",{type:"button",onClick:b=>{b.preventDefault(),n==null||n(t)},css:R.css`
|
|
502
|
+
display: flex;
|
|
503
|
+
justify-content: space-between;
|
|
504
|
+
align-items: center;
|
|
505
|
+
background-color: var(--white);
|
|
506
|
+
border-radius: var(--rounded-base);
|
|
507
|
+
border: 2px solid var(--gray-400);
|
|
508
|
+
height: 2.5rem;
|
|
509
|
+
padding: 0 var(--spacing-base);
|
|
510
|
+
&:hover {
|
|
511
|
+
background-color: var(--gray-100);
|
|
512
|
+
}
|
|
513
|
+
`},(0,e.jsx)("span",{css:R.css`
|
|
514
|
+
font-size: var(--fs-sm);
|
|
515
|
+
`},"Unlink"),(0,e.jsx)(te,{css:R.css`
|
|
516
|
+
color: var(--brand-secondary-5);
|
|
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:f,multiSelectId:b,selectedItemComponent:h,rowComponent:m}){var z,U;let{value:c,loading:u,error:g}=(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 u?(0,e.jsx)(sr.LoadingIndicator,null):g||T||F.error?(0,e.jsx)("div",null,"There was an error:"," ",(g==null?void 0:g.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:f,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 v=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,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});
|