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