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