@uniformdev/mesh-sdk-react 16.1.1-alpha.169 → 16.1.1-alpha.294
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 +7 -3
- package/dist/index.esm.js +235 -248
- package/dist/index.js +233 -246
- package/dist/index.mjs +235 -248
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Br=Object.defineProperty;var Or=(t,n)=>{for(var o in n)Br(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as S from"react";import{createContext as Hr,useContext as $r,useState as Fr}from"react";var Ae=Hr(void 0),Be=({children:t})=>{let[n,o]=Fr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return e(Ae.Provider,{value:r},t)},Oe=()=>{let t=$r(Ae);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function un(){let{location:t}=Oe();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}import{initializeUniformMeshSDK as Kr}from"@uniformdev/mesh-sdk";import{useEffect as Nr,useState as He}from"react";var bn=({autoResizingDisabled:t}={})=>{let[n,o]=He(),[r,a]=He();return Nr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?Kr({autoResizingDisabled:t}).then(i=>{a(i)}).catch(i=>{o(i)}):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as Qr,useContext as Wr}from"react";import{Theme as _r}from"@uniformdev/design-system";var $e=Qr(void 0),Ln=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e($e.Provider,{value:n},e(_r,null),e(Be,null,t))},Fe=()=>{let t=Wr($e);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function kn(){let{sdk:t}=Fe();return t}import Yr,{useMemo as se,useContext as Jr}from"react";import{css as ee}from"@emotion/react";import{InputSelect as Zr}from"@uniformdev/design-system";import Ke from"react";var Ne=({value:t,text:n,loading:o})=>e(Ke.Fragment,null,!!n&&n,!n&&e(Ke.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 f;let g=(f=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?f:[],u=(s,p)=>{s.preventDefault(),l(p)};return e("div",null,e(Zr,{id:t,name:t,label:n,onChange:s=>i(s.target.value),disabled:o,options:[{value:"",label:"Add..."},...g.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(r)&&r.length>0?ee`
|
|
2
2
|
margin-bottom: var(--spacing-base);
|
|
3
|
-
`:""}),r==null?void 0:r.map(s=>{var p;return e("div",{css:
|
|
3
|
+
`:""}),r==null?void 0:r.map(s=>{var p;return e("div",{css:ee`
|
|
4
4
|
font-size: var(--fs-sm);
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
align-items: center;
|
|
@@ -9,67 +9,67 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
9
9
|
border: 1px solid var(--gray-300);
|
|
10
10
|
margin-bottom: var(--spacing-sm);
|
|
11
11
|
margin-right: var(--spacing-sm);
|
|
12
|
-
`,key:s},e("span",{css:
|
|
12
|
+
`,key:s},e("span",{css:ee`
|
|
13
13
|
padding: var(--spacing-3);
|
|
14
14
|
color: var(--gray-800);
|
|
15
|
-
`},e(
|
|
15
|
+
`},e(Ne,{value:s,loading:o,text:(p=a.find(h=>h.id===s))==null?void 0:p.name})),e("button",{css:ee`
|
|
16
16
|
padding: var(--spacing-3);
|
|
17
17
|
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:h=>u(h,s)},e("svg",{xmlns:"http://www.w3.org/2000/svg",css:
|
|
18
|
+
`,title:"remove",onClick:h=>u(h,s)},e("svg",{xmlns:"http://www.w3.org/2000/svg",css:ee`
|
|
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"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var
|
|
23
|
+
`,viewBox:"0 0 20 20",fill:"currentColor"},e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Xr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ae=Xr;var qr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),ie=qr;import{useAsyncFn as jr,useDebounce as eo}from"react-use";import{Input as We,InputSelect as ce,mq as de}from"@uniformdev/design-system";import{css as L}from"@emotion/react";var _e={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},_n=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:g,onGetProducts:u,sortOptions:f,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:h="Brand",disableBrands:E,restrictToSingleCategory:G=!1})=>{var m,I,U;let w=async d=>{n({..._e,...t||{},...d})},b=se(()=>({..._e,...t||{}}),[t]),[Z,A]=jr(async d=>await u(d),[u]);eo(async()=>{await A({brand:b.brand,categories:b.categories,keyword:b.keyword,sort:b.sort,sortOrder:b.sortOrder,count:b.count})},250,[b]);let N=se(()=>{let d=[];return r==null||r.forEach(y=>{let T=Xe(y,void 0);d.push(...T)}),d},[r]),B=se(()=>[{value:"",label:"All categories"},...N.map(d=>({label:d.name,value:d.id}))],[N]),O=se(()=>(o==null?void 0:o.map(d=>({id:d.id.toString(),name:d.name})))||[],[o]),oe=d=>{if(!d)return;let y=(t==null?void 0:t.categories)||[];w({categories:[...y,d]})},X=d=>{var y;w({categories:(y=t==null?void 0:t.categories)==null?void 0:y.filter(T=>T!==d)})},H=d=>{w({brand:d.target.value})},P=d=>{w({count:d||1})};return a?e("div",null,"Loading..."):e(qe.Provider,{value:{categories:r,logoIcon:g}},e("div",{css:L`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
27
|
-
`},
|
|
27
|
+
`},G?e(ce,{id:"selection-field-product-category",label:p,disabled:a,value:(I=(m=b.categories)==null?void 0:m[0])!=null?I:"",options:B,onChange:d=>{w({categories:d.target.value===""?[]:[d.target.value]})}}):e(Qe,{loading:i||!1,id:"selection-field-product-category",label:p,onAdd:oe,onRemove:X,selectedValues:b.categories,values:N}),e("div",{css:L`
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-wrap: wrap;
|
|
30
30
|
column-gap: var(--spacing-lg);
|
|
31
31
|
row-gap: var(--spacing-md);
|
|
32
|
-
${
|
|
32
|
+
${de("md")} {
|
|
33
33
|
flex-wrap: nowrap;
|
|
34
34
|
}
|
|
35
|
-
`},
|
|
35
|
+
`},E?null:e("div",{css:L`
|
|
36
36
|
width: 50%;
|
|
37
|
-
`},e(
|
|
37
|
+
`},e(ce,{id:"brand",name:"brand",label:h,disabled:l,value:b.brand,onChange:H,options:[{value:"",label:"Choose..."},...O.map(d=>({value:d.id,label:d.name}))]})),e("div",{css:L`
|
|
38
38
|
flex-grow: 1;
|
|
39
39
|
position: relative;
|
|
40
|
-
`},e(
|
|
40
|
+
`},e(We,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:b.keyword,placeholder:"Enter keyword",onChange:d=>w({keyword:d.target.value})}))),e("div",{css:L`
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-wrap: wrap;
|
|
43
43
|
column-gap: var(--spacing-lg);
|
|
44
44
|
row-gap: var(--spacing-md);
|
|
45
|
-
${
|
|
45
|
+
${de("md")} {
|
|
46
46
|
flex-wrap: nowrap;
|
|
47
47
|
}
|
|
48
|
-
`},e("div",{css:
|
|
48
|
+
`},e("div",{css:L`
|
|
49
49
|
width: 100%;
|
|
50
|
-
${
|
|
50
|
+
${de("md")} {
|
|
51
51
|
width: 33.333333%;
|
|
52
52
|
}
|
|
53
53
|
position: relative;
|
|
54
|
-
`},e(
|
|
54
|
+
`},e(We,{id:"count",name:"count",type:"number",min:1,step:1,value:b.count,onChange:d=>P(d.target.valueAsNumber),label:"Count"}),e("div",{css:L`
|
|
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
|
-
`},e(
|
|
60
|
+
`},e(Ze,{onCountChange:()=>P(b.count-1),countIcon:"decrement",disabled:b.count===1}),e(Ze,{onCountChange:()=>P(b.count+1),countIcon:"increment"}))),Array.isArray(f)&&f.length>0?e("div",{css:L`
|
|
61
61
|
flex-grow: 1;
|
|
62
|
-
${
|
|
62
|
+
${de("md")} {
|
|
63
63
|
width: 33.333333%;
|
|
64
64
|
}
|
|
65
|
-
`},e(
|
|
65
|
+
`},e(ce,{id:"sort",name:"sort",label:"Sort",value:b.sort,onChange:d=>w({sort:d.target.value}),options:[{value:"",label:"Select a sort"},...f.map(d=>({value:d.sortKey,label:d.name}))]})):null,Array.isArray(s)&&s.length>0?e("div",{css:L`
|
|
66
66
|
flex-grow: 1;
|
|
67
|
-
`},e(
|
|
67
|
+
`},e(ce,{id:"sort-order",name:"sort-order",label:"Sort Order",value:b.sortOrder,onChange:d=>w({sortOrder:d.target.value}),options:s.map(d=>({value:d.sortOrderKey,label:d.name}))})):null),e("div",null,e("h3",{css:L`
|
|
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"),e(
|
|
72
|
+
`},"Result Preview"),e(Je,{products:(U=Z.value)==null?void 0:U.products}))))};function Xe(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 g=Xe(l,a);o.push(...g)}),o}function Ze({onCountChange:t,countIcon:n,disabled:o}){return e("button",{css:L`
|
|
73
73
|
width: 2.25rem;
|
|
74
74
|
height: 2.25rem;
|
|
75
75
|
border: 1px solid var(--gray-300);
|
|
@@ -81,83 +81,79 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
81
81
|
&:hover {
|
|
82
82
|
background-color: var(--gray-200);
|
|
83
83
|
}
|
|
84
|
-
${o?
|
|
84
|
+
${o?L`
|
|
85
85
|
cursor: not-allowed;
|
|
86
86
|
opacity: 0.3;
|
|
87
87
|
`:""}
|
|
88
|
-
`,onClick:t,disabled:o},n==="increment"?e(
|
|
88
|
+
`,onClick:t,disabled:o},n==="increment"?e(ae,{css:L`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`}):e(
|
|
91
|
+
`}):e(ie,{css:L`
|
|
92
92
|
width: 1rem;
|
|
93
93
|
height: 1rem;
|
|
94
|
-
`}))}var
|
|
94
|
+
`}))}var qe=Yr.createContext(void 0),Ye=()=>{let t=Jr(qe);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function V({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?e(r,{className:o}):e("img",{src:t,alt:n,className:o})}import{css as ct}from"@emotion/react";import{scrollbarStyles as to}from"@uniformdev/design-system";import{css as D}from"@emotion/react";var je=D`
|
|
95
|
+
align-items: center;
|
|
96
|
+
background: var(--white);
|
|
97
|
+
border-radius: var(--rounded-base);
|
|
98
|
+
border: 2px solid var(--gray-300);
|
|
99
|
+
color: currentColor;
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
justify-content: space-between;
|
|
102
|
+
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
103
|
+
margin-left: auto;
|
|
104
|
+
text-decoration: none;
|
|
105
|
+
&:hover {
|
|
106
|
+
background: var(--gray-50);
|
|
107
|
+
}
|
|
108
|
+
`,et=D`
|
|
109
|
+
font-size: var(--fs-sm);
|
|
110
|
+
`,tt=D`
|
|
111
|
+
width: 2.25rem;
|
|
112
|
+
height: 2.25rem;
|
|
113
|
+
`,he=D`
|
|
114
|
+
margin-right: var(--spacing-lg);
|
|
115
|
+
font-size: var(--fs-sm);
|
|
116
|
+
`,rt=D`
|
|
117
|
+
border: 1px solid var(--gray-200);
|
|
118
|
+
border-radius: var(--rounded-md);
|
|
119
|
+
background: var(--gray-50);
|
|
120
|
+
margin: var(--spacing-base) 0;
|
|
121
|
+
`,ot=D`
|
|
122
|
+
align-items: center;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-grow: 1;
|
|
125
|
+
gap: var(--spacing-base);
|
|
126
|
+
padding: var(--spacing-sm);
|
|
127
|
+
margin-right: var(--spacing-sm);
|
|
128
|
+
`,nt=D`
|
|
129
|
+
background: var(--gray-200);
|
|
130
|
+
width: 3.5rem;
|
|
131
|
+
height: 3.5rem;
|
|
132
|
+
object-fit: cover;
|
|
133
|
+
`,at=D`
|
|
134
|
+
background: var(--gray-100);
|
|
135
|
+
height: 3.5rem;
|
|
136
|
+
width: 3.5rem;
|
|
137
|
+
`,it=D`
|
|
138
|
+
margin-top: 0;
|
|
139
|
+
font-weight: var(--fw-bold);
|
|
140
|
+
font-size: var(--fs-sm);
|
|
141
|
+
width: calc(100% / 3);
|
|
142
|
+
`,st=D`
|
|
143
|
+
display: block;
|
|
144
|
+
font-weight: var(--fw-regular);
|
|
145
|
+
`;var Je=({products:t})=>{let{categories:n,logoIcon:o}=Ye();return e(S.Fragment,null,e("p",{css:ct`
|
|
95
146
|
margin-bottom: var(--spacing-base);
|
|
96
|
-
`},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[
|
|
147
|
+
`},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[ct`
|
|
97
148
|
max-height: 24rem;
|
|
98
149
|
overflow-x: auto;
|
|
99
|
-
`,
|
|
100
|
-
border: 1px solid var(--gray-300);
|
|
101
|
-
border-radius: var(--rounded-md);
|
|
102
|
-
background-color: var(--gray-100);
|
|
103
|
-
margin: var(--spacing-base) 0;
|
|
104
|
-
`},e("div",{css:L`
|
|
105
|
-
padding: var(--spacing-sm);
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-grow: 1;
|
|
108
|
-
margin-right: var(--spacing-sm);
|
|
109
|
-
gap: var(--spacing-base);
|
|
110
|
-
align-items: center;
|
|
111
|
-
`},r.thumbnailUrl?e("img",{src:r.thumbnailUrl,alt:typeof r.title=="string"?r.title:r.name||`Product ${a}`,css:L`
|
|
112
|
-
background-color: var(--gray-200);
|
|
113
|
-
width: 3.5rem;
|
|
114
|
-
height: 3.5rem;
|
|
115
|
-
object-fit: cover;
|
|
116
|
-
`}):e("div",{css:L`
|
|
117
|
-
height: 3.5rem;
|
|
118
|
-
width: 3.5rem;
|
|
119
|
-
background-color: var(--gray-100);
|
|
120
|
-
`}),e("h4",{css:L`
|
|
121
|
-
font-weight: var(--fw-bold);
|
|
122
|
-
width: 33.333333%;
|
|
123
|
-
font-size: var(--fs-sm);
|
|
124
|
-
margin-top: 0px;
|
|
125
|
-
`},r.title||r.name,l&&e("span",{css:L`
|
|
126
|
-
display: block;
|
|
127
|
-
font-weight: var(--fw-regular);
|
|
128
|
-
`},l)),r&&e(qe.Fragment,null,e("p",{css:L`
|
|
129
|
-
margin-right: var(--spacing-lg);
|
|
130
|
-
font-size: var(--fs-sm);
|
|
131
|
-
`},"SKU: ",r.sku||r.id,e("br",null)),r.price!==void 0?e("p",{css:L`
|
|
132
|
-
margin-right: var(--spacing-lg);
|
|
133
|
-
font-size: var(--fs-sm);
|
|
134
|
-
`},e("span",{css:L`
|
|
135
|
-
display: block;
|
|
136
|
-
`},"Price: ",r.price)):null,r.editLink||r.url?e("a",{css:L`
|
|
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:(u=r.editLink)!=null?u:r.url,title:`Go to ${r.title||r.name}`,target:"_blank",rel:"noopener noreferrer"},e("span",{css:L`
|
|
149
|
-
font-size: var(--fs-sm);
|
|
150
|
-
margin-right: var(--spacing-sm);
|
|
151
|
-
`},"Edit"),o?e(z,{src:o,alt:"Logo",css:L`
|
|
152
|
-
width: 2.25rem;
|
|
153
|
-
height: 2.25rem;
|
|
154
|
-
`}):null):null)))})))};import Po,{useContext as Ro,useMemo as Lo,useRef as ko}from"react";import*as x from"react";var be={};Cr(be,{Caution:()=>Ye,Checkmark:()=>pe,ChevronDown:()=>me,Close:()=>Q,Danger:()=>Je,ExclamationPoint:()=>je,Info:()=>W,Lightbulb:()=>et,MagnifyingGlass:()=>tt,MaximizeAlt:()=>rt,Minus:()=>se,MoreVerticalAlt:()=>re,Plus:()=>ie});var Or=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),Ye=Or;var Hr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),pe=Hr;var $r=t=>e("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},e("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),me=$r;var Fr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},e("g",{fillRule:"evenodd"},e("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),e("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),Q=Fr;var Kr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),Je=Kr;var Nr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),je=Nr;var Qr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),e("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),W=Qr;var Wr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),et=Wr;var _r=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),e("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),tt=_r;var Zr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),rt=Zr;var Xr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),re=Xr;import{useThrottle as io}from"react-use";import{v4 as so}from"uuid";import Yr,{useState as Jr,useRef as mt,useEffect as jr}from"react";function ue(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as eo}from"timeago.js";import{css as T}from"@emotion/react";import{mq as qr}from"@uniformdev/design-system";var ot=T`
|
|
150
|
+
`,to]},t==null?void 0:t.map((r,a)=>{var g,u;let[i]=(r==null?void 0:r.categories)||[],l=typeof i=="undefined"||!n||(g=n.find(f=>f.id===i.id))==null?void 0:g.name;return e("li",{key:`product-${r.id}`,css:rt},e("div",{css:ot},r.thumbnailUrl?e("img",{src:r.thumbnailUrl,alt:typeof r.title=="string"?r.title:r.name||`Product ${a}`,css:nt}):e("div",{css:at}),e("h4",{css:it},r.title||r.name,l&&e("span",{css:st},l)),r&&e(S.Fragment,null,e("p",{css:he},"SKU: ",r.sku||r.id,e("br",null)),r.price!==void 0?e("p",{css:he},"Price: ",r.price):null,r.editLink||r.url?e("a",{css:je,href:(u=r.editLink)!=null?u:r.url,title:`Go to ${r.title||r.name}`,target:"_blank",rel:"noopener noreferrer"},e("span",{css:et},"Edit"),o?e(V,{src:o,alt:"Logo",css:tt}):null):null)))})))};import Ko,{useContext as No,useMemo as Qo,useRef as Wo}from"react";import*as k from"react";var be={};Or(be,{Caution:()=>dt,Checkmark:()=>le,ChevronDown:()=>pe,Close:()=>lt,Danger:()=>pt,ExclamationPoint:()=>mt,Info:()=>me,Lightbulb:()=>ut,MagnifyingGlass:()=>gt,MaximizeAlt:()=>ft,Minus:()=>ie,MoreVerticalAlt:()=>te,Plus:()=>ae});var ro=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),dt=ro;var oo=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),le=oo;var no=t=>e("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},e("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),pe=no;var ao=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},e("g",{fillRule:"evenodd"},e("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),e("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),lt=ao;var io=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),pt=io;var so=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),mt=so;var co=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),e("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),me=co;var lo=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),ut=lo;var po=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),e("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),gt=po;var mo=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),ft=mo;var uo=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),te=uo;import{useThrottle as xo}from"react-use";import{v4 as ko}from"uuid";import fo,{useState as vo,useRef as Lt,useEffect as ho}from"react";function ue(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as bo}from"timeago.js";import{css as M}from"@emotion/react";import{mq as go}from"@uniformdev/design-system";var vt=M`
|
|
155
151
|
border: 1px solid var(--gray-200);
|
|
156
152
|
background: var(--gray-50);
|
|
157
153
|
border-radius: var(--rounded-base);
|
|
158
154
|
display: flex;
|
|
159
155
|
width: 100%;
|
|
160
|
-
`,
|
|
156
|
+
`,ht=M`
|
|
161
157
|
align-items: center;
|
|
162
158
|
display: flex;
|
|
163
159
|
flex-grow: 1;
|
|
@@ -165,25 +161,22 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
165
161
|
margin-inline: 0 var(--spacing-sm);
|
|
166
162
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
167
163
|
position: relative;
|
|
168
|
-
`,
|
|
164
|
+
`,bt=M`
|
|
169
165
|
flex-grow: 1;
|
|
170
|
-
`,
|
|
166
|
+
`,yt=M`
|
|
171
167
|
align-items: start;
|
|
172
168
|
display: inline-flex;
|
|
173
169
|
position: relative;
|
|
174
|
-
`,
|
|
170
|
+
`,St=M`
|
|
175
171
|
color: var(--brand-secondary-1);
|
|
176
172
|
font-size: var(--fs-base);
|
|
177
173
|
font-weight: var(--fw-bold);
|
|
178
174
|
line-height: 1;
|
|
179
175
|
margin: 0;
|
|
180
|
-
`,
|
|
176
|
+
`,wt=M`
|
|
181
177
|
width: 1.5rem;
|
|
182
178
|
height: 1.5rem;
|
|
183
|
-
`,
|
|
184
|
-
width: 1rem;
|
|
185
|
-
height: 1rem;
|
|
186
|
-
`,lt=T`
|
|
179
|
+
`,Ct=M`
|
|
187
180
|
background: var(--white);
|
|
188
181
|
border-radius: var(--rounded-base);
|
|
189
182
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -192,69 +185,69 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
192
185
|
padding: var(--spacing-base);
|
|
193
186
|
z-index: var(--z-10);
|
|
194
187
|
width: max-content;
|
|
195
|
-
`,
|
|
188
|
+
`,Q=M`
|
|
196
189
|
font-size: var(--fs-sm);
|
|
197
|
-
`,
|
|
190
|
+
`,re=M`
|
|
198
191
|
font-weight: var(--fw-bold);
|
|
199
192
|
margin-right: var(--spacing-sm);
|
|
200
|
-
`,
|
|
193
|
+
`,Pt=M`
|
|
201
194
|
display: flex;
|
|
202
195
|
flex-direction: column;
|
|
203
196
|
gap: var(--spacing-sm);
|
|
204
197
|
|
|
205
|
-
${
|
|
198
|
+
${go("md")} {
|
|
206
199
|
flex-direction: row;
|
|
207
200
|
min-width: 200px;
|
|
208
201
|
justify-content: end;
|
|
209
202
|
}
|
|
210
|
-
`,ye=
|
|
203
|
+
`,ye=M`
|
|
211
204
|
align-items: center;
|
|
212
205
|
background: var(--white);
|
|
213
206
|
border-radius: var(--rounded-base);
|
|
214
207
|
border: 2px solid var(--gray-300);
|
|
208
|
+
color: currentColor;
|
|
215
209
|
display: flex;
|
|
216
210
|
gap: var(--spacing-sm);
|
|
217
211
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
218
212
|
justify-content: space-between;
|
|
213
|
+
text-decoration: none;
|
|
219
214
|
|
|
220
215
|
&:hover {
|
|
221
216
|
background: var(--gray-50);
|
|
222
217
|
}
|
|
223
|
-
`;import{css as
|
|
218
|
+
`;import{css as F}from"@emotion/react";import{Icon as Rt}from"@uniformdev/design-system";import{CgClose as yo,CgInfo as So}from"react-icons/cg";var xt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var f;let a=Lt(null),i=Lt(null),[l,g]=vo(!1);ho(()=>{let s=h=>{a.current&&!a.current.contains(h.target)&&i.current&&!i.current.contains(h.target)&&g(!1)},p=()=>{g(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[i]);let u=()=>{var s;if(g(!l),i.current&&a.current){let p=(s=a==null?void 0:a.current)==null?void 0:s.getBoundingClientRect(),h=i.current.offsetWidth;i.current.style.top=`${p.top+30}px`,i.current.style.left=`${p.left-h+30}px`}};return e("div",{css:vt,key:t.id},e("div",{css:ht},e("div",{css:bt},e("div",{css:yt},e("h4",{css:[St,t.popoverData?F`
|
|
224
219
|
margin-bottom: var(--spacing-sm);
|
|
225
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(
|
|
220
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(fo.Fragment,null,e("button",{type:"button",ref:a,css:F`
|
|
226
221
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
227
|
-
`,"aria-controls":"path-details","aria-expanded":l,onClick:u},e(
|
|
228
|
-
|
|
229
|
-
`})),e("div",{id:"path-details","aria-hidden":!l,ref:i,css:[
|
|
222
|
+
`,"aria-controls":"path-details","aria-expanded":l,onClick:u},e(Rt,{icon:So,iconColor:"gray",size:24,css:F`
|
|
223
|
+
opacity: var(--opacity-75);
|
|
224
|
+
`})),e("div",{id:"path-details","aria-hidden":!l,ref:i,css:[Ct,l?F`
|
|
230
225
|
visibility: visible;
|
|
231
|
-
`:
|
|
226
|
+
`:F`
|
|
232
227
|
visibility: hidden;
|
|
233
|
-
`]},Object.entries(t.popoverData).map(([s,p],h)=>e("div",{css:
|
|
228
|
+
`]},Object.entries(t.popoverData).map(([s,p],h)=>e("div",{css:Q,key:h},e("span",{css:re},s,":"),p)))):null),t.createdDate&&e("div",{css:Q},e("span",{css:re},"Created:"),bo((f=t.createdDate)!=null?f:0)),t.metadata?Object.entries(t.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>e("div",{css:[Q,F`
|
|
234
229
|
order: 1;
|
|
235
|
-
`],key:s},e("span",{css:
|
|
230
|
+
`],key:s},e("span",{css:re},s,":"),p)):null,t.metadata?Object.entries(t.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>e("div",{css:[Q,F`
|
|
236
231
|
order: 1;
|
|
237
|
-
`],key:s},e("span",{css:[
|
|
232
|
+
`],key:s},e("span",{css:[re,F`
|
|
238
233
|
order: 1;
|
|
239
|
-
`]},s,":"),p)):null),e("div",{css:
|
|
240
|
-
color: var(--brand-secondary-5);
|
|
241
|
-
`]})))))};import to,{useState as ro,useRef as yt,useEffect as oo}from"react";import{css as X}from"@emotion/react";var gt=X`
|
|
234
|
+
`]},s,":"),p)):null),e("div",{css:Pt},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(ue(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:ye},e("span",{css:Q},"Edit"),e(V,{src:n,css:wt,alt:"Logo"})):null,e("button",{type:"button",onClick:()=>{o(t)},css:ye},e("span",{css:Q},"Unlink"),e(Rt,{icon:yo,iconColor:"red",size:16})))))};import wo,{useState as Co,useRef as Vt,useEffect as Po}from"react";import{css as W}from"@emotion/react";var kt=W`
|
|
242
235
|
cursor: pointer;
|
|
243
236
|
padding: var(--spacing-sm);
|
|
244
237
|
position: relative;
|
|
245
238
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
246
239
|
color var(--duration-fast) var(--timing-ease-out);
|
|
247
|
-
`,
|
|
240
|
+
`,It=W`
|
|
248
241
|
padding-right: var(--spacing-lg);
|
|
249
|
-
`,
|
|
242
|
+
`,Et=W`
|
|
250
243
|
background: var(--brand-secondary-3);
|
|
251
244
|
color: var(--white);
|
|
252
|
-
`,Se=
|
|
245
|
+
`,Se=W`
|
|
253
246
|
font-size: var(--fs-xs);
|
|
254
|
-
`,we=
|
|
247
|
+
`,we=W`
|
|
255
248
|
font-weight: var(--fw-bold);
|
|
256
249
|
margin-right: var(--spacing-sm);
|
|
257
|
-
`,
|
|
250
|
+
`,Tt=W`
|
|
258
251
|
background: var(--white);
|
|
259
252
|
border-left: 4px solid var(--brand-secondary-3);
|
|
260
253
|
border-radius: var(--rounded-base);
|
|
@@ -266,20 +259,20 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
266
259
|
right: var(--spacing-xl);
|
|
267
260
|
z-index: var(--z-10);
|
|
268
261
|
width: max-content;
|
|
269
|
-
`,
|
|
262
|
+
`,Mt=W`
|
|
270
263
|
position: absolute;
|
|
271
264
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
272
|
-
`;import{css as
|
|
265
|
+
`;import{css as Dt}from"@emotion/react";var zt=({result:t,isSelected:n,triggerSelection:o})=>{let r=Vt(null),a=Vt(null),[i,l]=Co(!1);Po(()=>{function u(f){r.current&&!r.current.contains(f.target)&&a.current&&!a.current.contains(f.target)&&l(!1)}return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]);let g=u=>{u.stopPropagation(),l(!i)};return e("div",{key:t.id,css:[kt,n?Et:void 0,t.popoverData?It:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(wo.Fragment,null,e("button",{type:"button",ref:r,css:Mt,"aria-controls":"path-details",onClick:u=>g(u),"aria-expanded":i},e(me,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!i,ref:a,css:[Tt,i?Dt`
|
|
273
266
|
visibility: visible;
|
|
274
|
-
`:
|
|
267
|
+
`:Dt`
|
|
275
268
|
visibility: hidden;
|
|
276
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([u,f],s)=>e("div",{css:Se,key:s},e("span",{css:we},u,":"),f)),Object.entries(t.popoverData).map(([u,f],s)=>e("div",{css:Se,key:s},e("span",{css:we},u,":"),f)))):null)};import{Droppable as
|
|
269
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([u,f],s)=>e("div",{css:Se,key:s},e("span",{css:we},u,":"),f)),Object.entries(t.popoverData).map(([u,f],s)=>e("div",{css:Se,key:s},e("span",{css:we},u,":"),f)))):null)};import{Droppable as Io,DragDropContext as Eo,Draggable as To}from"react-beautiful-dnd";import{css as C}from"@emotion/react";var Ut=C`
|
|
277
270
|
background: var(--white);
|
|
278
271
|
border: 1px solid var(--gray-300);
|
|
279
272
|
border-radius: var(--rounded-base);
|
|
280
273
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
281
274
|
margin-bottom: var(--spacing-base);
|
|
282
|
-
`,
|
|
275
|
+
`,Gt=C`
|
|
283
276
|
align-items: center;
|
|
284
277
|
display: flex;
|
|
285
278
|
position: relative;
|
|
@@ -287,7 +280,7 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
287
280
|
width: 100%;
|
|
288
281
|
background-color: transparent;
|
|
289
282
|
border: 0;
|
|
290
|
-
`,
|
|
283
|
+
`,At=C`
|
|
291
284
|
color: var(--brand-secondary-1);
|
|
292
285
|
display: block;
|
|
293
286
|
font-weight: var(--fw-bold);
|
|
@@ -303,15 +296,15 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
303
296
|
background: var(--gray-100);
|
|
304
297
|
outline: none;
|
|
305
298
|
}
|
|
306
|
-
`,
|
|
299
|
+
`,Bt=C`
|
|
307
300
|
background: var(--white);
|
|
308
301
|
border: 1px solid var(--gray-300);
|
|
309
302
|
border-radius: var(--rounded-base);
|
|
310
303
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
311
304
|
display: block;
|
|
312
|
-
`,
|
|
305
|
+
`,Ot=C`
|
|
313
306
|
display: none;
|
|
314
|
-
`,
|
|
307
|
+
`,Ht=C`
|
|
315
308
|
overflow-y: auto;
|
|
316
309
|
height: 16rem;
|
|
317
310
|
margin-bottom: var(--spacing-base);
|
|
@@ -320,211 +313,204 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
320
313
|
& > :not(:last-child) {
|
|
321
314
|
border-bottom: 1px solid var(--gray-200);
|
|
322
315
|
}
|
|
323
|
-
`,
|
|
316
|
+
`,Xa=C`
|
|
324
317
|
background-color: var(--gray-50);
|
|
325
318
|
max-width: 33.33%;
|
|
326
|
-
|
|
319
|
+
`,$t=C`
|
|
327
320
|
align-items: center;
|
|
328
321
|
display: flex;
|
|
329
322
|
position: absolute;
|
|
330
323
|
inset: 0 0 0 auto;
|
|
331
324
|
pointer-events: none;
|
|
332
325
|
padding-right: var(--spacing-sm);
|
|
333
|
-
`,
|
|
326
|
+
`,Ft=C`
|
|
334
327
|
color: var(--brand-secondary-1);
|
|
335
328
|
width: 1.25rem;
|
|
336
329
|
height: 1.25rem;
|
|
337
330
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
338
331
|
transform: rotate(0);
|
|
339
|
-
`,
|
|
332
|
+
`,qa=C`
|
|
340
333
|
background: var(--white);
|
|
341
334
|
color: var(--brand-secondary-1);
|
|
342
|
-
`,
|
|
335
|
+
`,Kt=C`
|
|
343
336
|
position: relative;
|
|
344
337
|
margin-block: var(--spacing-sm) 0;
|
|
345
338
|
|
|
346
339
|
&:hover > span {
|
|
347
340
|
opacity: 0.3;
|
|
348
341
|
}
|
|
349
|
-
`,
|
|
342
|
+
`,Nt=C`
|
|
350
343
|
align-items: center;
|
|
351
344
|
display: flex;
|
|
352
345
|
position: absolute;
|
|
353
346
|
inset: 0 auto 0 0;
|
|
354
347
|
margin-block: auto;
|
|
355
348
|
opacity: 0;
|
|
356
|
-
`,Ce=
|
|
349
|
+
`,Ce=C`
|
|
357
350
|
color: var(--brand-secondary-1);
|
|
358
|
-
`,
|
|
351
|
+
`,Qt=C`
|
|
359
352
|
position: absolute;
|
|
360
353
|
left: 0.375rem;
|
|
361
|
-
`,Pe=
|
|
354
|
+
`,Pe=C`
|
|
362
355
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
363
356
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
364
|
-
`;import{css as
|
|
357
|
+
`;import{css as z}from"@emotion/react";import{InputSelect as Mo,scrollbarStyles as Vo,Button as Le,Callout as Do,InputKeywordSearch as zo,LoadingIndicator as Uo,Menu as Go,MenuItem as Ao,LoadingOverlay as Bo}from"@uniformdev/design-system";import{useState as Lo,useEffect as Wt,useRef as Ro}from"react";function _t(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,a]=Lo("IDLE"),i=Ro(void 0);return Wt(()=>{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]),Wt(()=>()=>clearTimeout(i.current),[]),r==="DISPLAY"||r==="EXPIRE"}var Oo=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&n!=="any"&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Do,{type:"info"},o)},Zt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:i,multiSelect:l,multiSelectId:g,rowComponent:u,selectedItemComponent:f,totalResults:s,resultsLoading:p,requireContentType:h,onAddNew:E,onEditClosed:G,onCancel:w,noResultsComponent:b,helpComponent:Z,onSort:A,typeSelectorLabel:N="Content Type Select",typeSelectorAllTypesOptionText:B="All content types",loadingIndicatorDelay:O=1e3})=>{var ze,Ue,Ge;let X=()=>h?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[H,P]=k.useState(""),[m,I]=k.useState(X),[U,d]=k.useState(!1),[y,T]=k.useState([]),[Lr,Te]=k.useState(!1),ve=k.useRef(`x${ko()}`),ne=xo(H,750);k.useEffect(()=>{t(ne,{count:5,offset:0,contentType:m==="any"?void 0:m})},[ne,m]);let Rr=_t(p,{delay:O}),xr=c=>{y.some(v=>v.id===c.id)?T(v=>v.filter($=>$.id!==c.id)):T(l?v=>[...v,c]:[c])},kr=r==null?void 0:r.map(c=>c.id+c.title).join(",");k.useEffect(()=>{Array.isArray(r)&&T(r)},[kr]);let Ir=()=>{I(X()),P(""),T(r!=null&&r.length?r:[])},Er=()=>{d(c=>!c),U||Ir()},Me=c=>{let v=(y==null?void 0:y.filter($=>$.id!==c.id))||[];T(v),i(v,"")},Tr=c=>{c.preventDefault(),i(y,m),d(!1)},Mr=c=>{c.preventDefault(),d(!1),w&&w()},Vr=()=>{t(ne,{count:5,offset:(n==null?void 0:n.length)||0,contentType:m==="any"?void 0:m}),Te(!0);let c=setTimeout(()=>{Te(!1)},750);return()=>clearTimeout(c)},Dr=!(r==null?void 0:r.length)||l,zr=u||zt,Ve=f||xt,Ur=b||Oo,De=a&&typeof a!="string"?a:null,Gr=De?e(De,{css:Pe}):e("img",{src:a,alt:"Logo",css:Pe}),Ar=c=>{var v,$;if(c.destination&&c.source.droppableId===((v=c.destination)==null?void 0:v.droppableId)){let x=[...r||[]],[j]=($=x==null?void 0:x.splice(c.source.index,1))!=null?$:[];return x==null||x.splice(c.destination.index,0,j),A&&(T(x),A==null||A(x)),x}};return e("div",{css:z`
|
|
365
358
|
width: 100%;
|
|
366
|
-
`},e("div",{css:
|
|
359
|
+
`},e("div",{css:z`
|
|
367
360
|
position: relative;
|
|
368
361
|
margin-block: var(--spacing-base);
|
|
369
|
-
`},
|
|
362
|
+
`},Dr?e(k.Fragment,null,e("div",{css:Ut,"data-test-id":"component-search"},e("button",{css:Gt,onClick:Er,type:"button","aria-haspopup":!0,"aria-expanded":U,"aria-controls":`entry-search-config-${ve.current}`},Gr,e("span",{css:z`
|
|
370
363
|
margin-left: var(--spacing-base);
|
|
371
|
-
`},"Select"),e("span",{css
|
|
364
|
+
`},"Select"),e("span",{css:$t},e(pe,{css:[Ft,U?z`
|
|
372
365
|
transform: rotate(180deg);
|
|
373
|
-
`:void 0]})))),e("div",{id:`entry-search-config-${
|
|
366
|
+
`:void 0]})))),e("div",{id:`entry-search-config-${ve.current}`,"aria-hidden":!U,css:[Bt,U?void 0:Ot]},Z||null,e("div",{css:z`
|
|
374
367
|
display: flex;
|
|
375
368
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
376
369
|
margin-bottom: var(--spacing-base);
|
|
377
|
-
`},e(
|
|
370
|
+
`},e(Mo,{onChange:c=>I(c.target.value),value:m,label:N,showLabel:!1,options:[...h?[]:[{value:"any",label:B}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),e("div",{css:z`
|
|
378
371
|
flex-grow: 1;
|
|
379
|
-
`},e(
|
|
372
|
+
`},e(zo,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:P,disabledFieldSubmission:!0,value:H}))),e("div",{css:[Ht,Vo],id:ve.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},e(Bo,{isActive:Rr}),Array.isArray(n)&&n.length>0?n.map(c=>e(zr,{key:c.id,isSelected:y.some(v=>v.id===c.id),result:c,triggerSelection:()=>xr(c)})):e(Ur,{searchText:ne||H,selectedContentType:(Ue=(ze=o==null?void 0:o.find(c=>c.id===m))==null?void 0:ze.name)!=null?Ue:m}),!p&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&e("button",{type:"button",css:At,onClick:Vr},Lr?e(Uo,null):"Load More")),e("div",{css:z`
|
|
380
373
|
display: flex;
|
|
381
374
|
justify-content: space-between;
|
|
382
|
-
`},e("div",null,
|
|
375
|
+
`},e("div",null,E&&((Ge=o==null?void 0:o.length)!=null?Ge:0)>0?e(Go,{menuLabel:"Add new menu",menuTrigger:e(Le,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>e(Ao,{key:c.id,css:z`
|
|
383
376
|
background: var(--white);
|
|
384
377
|
color: var(--brand-secondary-1);
|
|
385
|
-
`,onClick:()=>
|
|
378
|
+
`,onClick:()=>E(c)},c.name))):null),e("div",{css:z`
|
|
386
379
|
display: flex;
|
|
387
380
|
gap: var(--spacing-base);
|
|
388
|
-
`},e(
|
|
381
|
+
`},e(Le,{buttonType:"unimportant",onClick:Mr},"Cancel"),e(Le,{disabled:!y.length,onClick:Tr,"data-test-id":"entry-accept-button"},"Accept"))))):null,U?null:l?e(Eo,{onDragEnd:c=>Ar(c)},e(Io,{droppableId:g||"canvas-multi-select"},c=>e("div",{...c.droppableProps,ref:c.innerRef,css:z`
|
|
389
382
|
margin-block: var(--spacing-sm) 0;
|
|
390
|
-
`},y==null?void 0:y.map((v
|
|
383
|
+
`},y==null?void 0:y.map((v,$)=>{if(v!=null&&v.id)return e(To,{key:v.id,draggableId:v.id,index:$},x=>e("div",{css:Kt,ref:x.innerRef,...x.draggableProps,...x.dragHandleProps},e("span",{css:Nt},e(te,{css:[Ce,Qt],width:24,height:24}),e(te,{css:Ce,width:24,height:24})),e(Ve,{key:`selected-item-${v.id}`,logoIcon:a,selectedItem:v,onDeselect:j=>Me(j),onEditClosed:G?j=>G(j):void 0})))}),c.placeholder))):y==null?void 0:y.map(c=>e(Ve,{key:`selected-item-${c.id}`,logoIcon:a,selectedItem:c,onDeselect:v=>Me(v),onEditClosed:G?v=>G(v):void 0}))))};import{css as _}from"@emotion/react";var Xt=_`
|
|
391
384
|
cursor: pointer;
|
|
392
385
|
padding: var(--spacing-sm) 0;
|
|
393
386
|
margin-right: var(--spacing-sm);
|
|
394
387
|
position: relative;
|
|
395
388
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
396
389
|
color var(--duration-fast) var(--timing-ease-out);
|
|
397
|
-
`,
|
|
390
|
+
`,qt=_`
|
|
398
391
|
border: 2px solid transparent;
|
|
399
392
|
border-radius: var(--rounded-base);
|
|
400
393
|
display: flex;
|
|
401
394
|
align-items: center;
|
|
402
395
|
gap: var(--spacing-base);
|
|
403
396
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
404
|
-
`,
|
|
397
|
+
`,Yt=_`
|
|
405
398
|
background-color: var(--green-50);
|
|
406
|
-
`,
|
|
399
|
+
`,Jt=_`
|
|
407
400
|
font-size: var(--fs-sm);
|
|
408
401
|
font-weight: var(--fw-bold);
|
|
409
402
|
width: 50%;
|
|
410
|
-
`,
|
|
403
|
+
`,jt=_`
|
|
411
404
|
font-weight: var(--fw-normal);
|
|
412
405
|
display: block;
|
|
413
|
-
|
|
406
|
+
`,er=_`
|
|
414
407
|
font-size: var(--fs-sm);
|
|
415
408
|
> * {
|
|
416
409
|
display: block;
|
|
417
410
|
}
|
|
418
|
-
`,
|
|
411
|
+
`,tr=_`
|
|
419
412
|
display: block;
|
|
420
413
|
height: 1.5rem;
|
|
421
414
|
width: 1.5rem;
|
|
422
415
|
color: var(--brand-secondary-3);
|
|
423
416
|
margin-left: auto;
|
|
424
|
-
`;import{css as
|
|
417
|
+
`;import{css as rr}from"@emotion/react";function or({result:t,isSelected:n,triggerSelection:o}){var g;let{categories:r,logoIcon:a}=ge(),[i]=t.categories||[{id:"",name:""}],l=typeof i=="undefined"||!r||(g=r.find(u=>u.id===i.id))==null?void 0:g.name;return e("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Xt]},e("div",{css:[qt,n?Yt:void 0]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:rr`
|
|
425
418
|
background-color: var(--gray-200);
|
|
426
419
|
width: 3rem;
|
|
427
420
|
height: 3rem;
|
|
428
421
|
object-fit: cover;
|
|
429
|
-
`}):e(
|
|
422
|
+
`}):e(V,{src:a,alt:"Logo",css:rr`
|
|
430
423
|
height: 2.25rem;
|
|
431
424
|
width: 2.25rem;
|
|
432
|
-
`}),e("h4",{css:[
|
|
425
|
+
`}),e("h4",{css:[Jt]},t.title,l?e("span",{css:[jt]},l):null),e("p",{css:[er]},"SKU: ",t.sku||t.id,t.price!==void 0?e("span",null,t.price):null),n?e(le,{css:[tr]}):null))}import{css as K}from"@emotion/react";import{mq as nr}from"@uniformdev/design-system";var ar=K`
|
|
426
|
+
border: 1px solid var(--gray-200);
|
|
427
|
+
border-radius: var(--rounded-base);
|
|
428
|
+
background: var(--gray-50);
|
|
433
429
|
display: flex;
|
|
434
430
|
width: 100%;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
|
|
431
|
+
margin-block: var(--spacing-base) 0;
|
|
432
|
+
`,ir=K`
|
|
433
|
+
align-items: center;
|
|
434
|
+
display: flex;
|
|
435
|
+
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
441
436
|
display: flex;
|
|
442
437
|
flex-grow: 1;
|
|
443
|
-
|
|
444
|
-
margin-
|
|
445
|
-
|
|
446
|
-
`,_t=fe`
|
|
438
|
+
gap: var(--spacing-sm);
|
|
439
|
+
margin-inline: 0 var(--spacing-sm);
|
|
440
|
+
`,sr=K`
|
|
447
441
|
display: flex;
|
|
448
442
|
align-items: center;
|
|
449
443
|
gap: var(--spacing-sm);
|
|
450
|
-
|
|
444
|
+
flex-grow: 1;
|
|
445
|
+
|
|
446
|
+
${nr("lg")} {
|
|
451
447
|
width: 50%;
|
|
452
448
|
margin-bottom: 0;
|
|
453
449
|
}
|
|
454
|
-
`,
|
|
450
|
+
`,Re=K`
|
|
455
451
|
background-color: var(--gray-200);
|
|
456
452
|
width: 3.5rem;
|
|
457
453
|
height: 3.5rem;
|
|
458
454
|
object-fit: cover;
|
|
459
|
-
|
|
455
|
+
`,xe=K`
|
|
456
|
+
align-items: center;
|
|
457
|
+
background: var(--white);
|
|
458
|
+
border-radius: var(--rounded-base);
|
|
459
|
+
border: 2px solid var(--gray-300);
|
|
460
|
+
color: currentColor;
|
|
461
|
+
display: flex;
|
|
462
|
+
gap: var(--spacing-sm);
|
|
463
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
464
|
+
justify-content: space-between;
|
|
465
|
+
text-decoration: none;
|
|
466
|
+
|
|
467
|
+
&:hover {
|
|
468
|
+
background: var(--gray-50);
|
|
469
|
+
}
|
|
470
|
+
`,ke=K`
|
|
471
|
+
font-size: var(--fs-sm);
|
|
472
|
+
`,cr=K`
|
|
473
|
+
display: block;
|
|
474
|
+
width: 1rem;
|
|
475
|
+
height: 1rem;
|
|
476
|
+
`,dr=K`
|
|
477
|
+
display: flex;
|
|
478
|
+
flex-direction: column;
|
|
479
|
+
gap: var(--spacing-sm);
|
|
480
|
+
|
|
481
|
+
${nr("md")} {
|
|
482
|
+
flex-direction: row;
|
|
483
|
+
min-width: 200px;
|
|
484
|
+
justify-content: end;
|
|
485
|
+
}
|
|
486
|
+
`;import{css as q}from"@emotion/react";import{Icon as Ho,mq as $o}from"@uniformdev/design-system";import{CgClose as Fo}from"react-icons/cg";function lr({selectedItem:t,onDeselect:n}){var l;let{categories:o,logoIcon:r}=ge(),[a]=t.categories||[{id:"",name:""}],i=typeof a=="undefined"||!o||(l=o.find(g=>g.id===a.id))==null?void 0:l.name;return e("div",{css:[ar],key:t.id},e("article",{css:[ir]},e("div",{css:[sr]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:i,css:[Re],loading:"lazy"}):e("div",{css:[Re]}),e("div",{css:q`
|
|
460
487
|
> :not(:last-child) {
|
|
461
488
|
margin-bottom: var(--spacing-xs);
|
|
462
489
|
}
|
|
463
|
-
`},e("h4",{css:
|
|
490
|
+
`},e("h4",{css:q`
|
|
464
491
|
margin-top: 0px;
|
|
465
492
|
font-weight: var(--fw-bold);
|
|
466
|
-
`},t.title||t.id||"",i&&e("span",{css:
|
|
493
|
+
`},t.title||t.id||"",i&&e("span",{css:q`
|
|
467
494
|
display: block;
|
|
468
495
|
font-weight: var(--fw-regular);
|
|
469
|
-
`},i)),e("ul",{css:
|
|
496
|
+
`},i)),e("ul",{css:q`
|
|
470
497
|
font-size: var(--fs-sm);
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
498
|
+
|
|
499
|
+
${$o("sm")} {
|
|
500
|
+
display: flex;
|
|
501
|
+
gap: var(--spacing-base);
|
|
502
|
+
}
|
|
503
|
+
`},e("li",null,e("span",{css:q`
|
|
474
504
|
margin-right: var(--spacing-xs);
|
|
475
|
-
`},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:
|
|
505
|
+
`},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:q`
|
|
476
506
|
margin-right: var(--spacing-xs);
|
|
477
|
-
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:I`
|
|
478
|
-
display: flex;
|
|
479
|
-
flex-wrap: wrap;
|
|
480
|
-
gap: var(--spacing-sm);
|
|
481
|
-
justify-content: flex-end;
|
|
482
|
-
margin-left: auto;
|
|
483
|
-
${Co("md")} {
|
|
484
|
-
align-items: center;
|
|
485
|
-
}
|
|
486
|
-
`},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:I`
|
|
487
|
-
display: inline-flex;
|
|
488
|
-
justify-content: space-between;
|
|
489
|
-
align-items: center;
|
|
490
|
-
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
491
|
-
background-color: var(--white);
|
|
492
|
-
border-radius: var(--rounded-base);
|
|
493
|
-
border: 2px solid var(--gray-400);
|
|
494
|
-
&:hover {
|
|
495
|
-
background-color: var(--gray-100);
|
|
496
|
-
}
|
|
497
|
-
`},e("span",{css:I`
|
|
498
|
-
margin-right: var(--spacing-sm);
|
|
499
|
-
font-size: var(--fs-sm);
|
|
500
|
-
`},"Edit"),e(z,{src:r,alt:"Logo",css:I`
|
|
501
|
-
width: 1.75rem;
|
|
502
|
-
height: 1.75rem;
|
|
503
|
-
display: block;
|
|
504
|
-
`})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:I`
|
|
505
|
-
display: flex;
|
|
506
|
-
justify-content: space-between;
|
|
507
|
-
align-items: center;
|
|
508
|
-
background-color: var(--white);
|
|
509
|
-
border-radius: var(--rounded-base);
|
|
510
|
-
border: 2px solid var(--gray-400);
|
|
511
|
-
height: 2.5rem;
|
|
512
|
-
padding: 0 var(--spacing-base);
|
|
513
|
-
gap: var(--spacing-sm);
|
|
514
|
-
&:hover {
|
|
515
|
-
background-color: var(--gray-100);
|
|
516
|
-
}
|
|
517
|
-
`},e("span",{css:I`
|
|
518
|
-
font-size: var(--fs-sm);
|
|
519
|
-
`},"Unlink"),e(Q,{css:I`
|
|
520
|
-
color: var(--brand-secondary-5);
|
|
521
|
-
`})))))}import{Callout as xo}from"@uniformdev/design-system";import{useAsync as Io,useAsyncFn as Eo}from"react-use";function vi({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:g,rowComponent:u,errorComponent:f,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:V="All categories",typeSelectorLabel:O="Select Category"}){var K;let{value:S,loading:b,error:Y}=Io(async()=>await o(),[o]),H=S==null?void 0:S.map(C=>C.id).join(","),_=Lo(()=>S?S.map(m=>({id:m.id,name:m.name})):void 0,[H]),$=ko(),[F,ne]=Eo(async(C,m)=>{let M=await r({text:C,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&($.current=[]),($.current=$.current||[]).push(...M.products),M},[r]),J=async C=>{await n(C)};return Y||F.error?e(f||(({categoriesError:m,searchError:M})=>e(xo,{type:"error"},"There was an error: ",(m==null?void 0:m.message)||(M==null?void 0:M.message))),{categoriesError:Y,searchError:F.error}):e(Xt.Provider,{value:{categories:S,logoIcon:a}},e(Ut,{search:ne,results:$.current,logoIcon:a,selectedItems:t,select:J,multiSelectId:l||"product-search-multi-select",multiSelect:i,contentTypes:_,selectedItemComponent:g||Zt,rowComponent:u||Nt,totalResults:(K=F.value)==null?void 0:K.total,resultsLoading:F.loading||b,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:V,typeSelectorLabel:O}))}var Xt=Po.createContext(void 0),ge=()=>{let t=Ro(Xt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};import{css as E}from"@emotion/react";import{mq as Mo}from"@uniformdev/design-system";var qt=E`
|
|
507
|
+
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:dr},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:xe},e("span",{css:ke},"Edit"),e(V,{src:r,alt:"Logo",css:cr})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:xe},e("span",{css:ke},"Unlink"),e(Ho,{icon:Fo,iconColor:"red",size:16})))))}import{Callout as _o}from"@uniformdev/design-system";import{useAsync as Zo,useAsyncFn as Xo}from"react-use";function $i({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:g,rowComponent:u,errorComponent:f,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:E="All categories",typeSelectorLabel:G="Select Category"}){var H;let{value:w,loading:b,error:Z}=Zo(async()=>await o(),[o]),A=w==null?void 0:w.map(P=>P.id).join(","),N=Qo(()=>w?w.map(m=>({id:m.id,name:m.name})):void 0,[A]),B=Wo(),[O,oe]=Xo(async(P,m)=>{let I=await r({text:P,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(B.current=[]),(B.current=B.current||[]).push(...I.products),I},[r]),X=async P=>{await n(P)};return Z||O.error?e(f||(({categoriesError:m,searchError:I})=>e(_o,{type:"error"},"There was an error: ",(m==null?void 0:m.message)||(I==null?void 0:I.message))),{categoriesError:Z,searchError:O.error}):e(pr.Provider,{value:{categories:w,logoIcon:a}},e(Zt,{search:oe,results:B.current,logoIcon:a,selectedItems:t,select:X,multiSelectId:l||"product-search-multi-select",multiSelect:i,contentTypes:N,selectedItemComponent:g||lr,rowComponent:u||or,totalResults:(H=O.value)==null?void 0:H.total,resultsLoading:O.loading||b,helpComponent:s,noResultsComponent:p,onSort:h,typeSelectorAllTypesOptionText:E,typeSelectorLabel:G}))}var pr=Ko.createContext(void 0),ge=()=>{let t=No(pr);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};import{css as R}from"@emotion/react";import{mq as qo}from"@uniformdev/design-system";var mr=R`
|
|
522
508
|
border: 1px solid var(--gray-200);
|
|
523
509
|
background: var(--gray-50);
|
|
524
510
|
border-radius: var(--rounded-base);
|
|
525
511
|
display: flex;
|
|
526
512
|
width: 100%;
|
|
527
|
-
`,
|
|
513
|
+
`,ur=R`
|
|
528
514
|
align-items: center;
|
|
529
515
|
display: flex;
|
|
530
516
|
flex-grow: 1;
|
|
@@ -532,25 +518,22 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
532
518
|
margin-inline: 0 var(--spacing-sm);
|
|
533
519
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
534
520
|
position: relative;
|
|
535
|
-
`,
|
|
521
|
+
`,gr=R`
|
|
536
522
|
flex-grow: 1;
|
|
537
|
-
`,
|
|
523
|
+
`,fr=R`
|
|
538
524
|
align-items: center;
|
|
539
525
|
display: flex;
|
|
540
526
|
position: relative;
|
|
541
|
-
`,
|
|
527
|
+
`,vr=R`
|
|
542
528
|
color: var(--brand-secondary-1);
|
|
543
529
|
font-size: var(--fs-base);
|
|
544
530
|
font-weight: var(--fw-bold);
|
|
545
531
|
line-height: 1;
|
|
546
532
|
margin: 0;
|
|
547
|
-
`,
|
|
533
|
+
`,hr=R`
|
|
548
534
|
width: 1.5rem;
|
|
549
535
|
height: 1.5rem;
|
|
550
|
-
`,
|
|
551
|
-
width: 1rem;
|
|
552
|
-
height: 1rem;
|
|
553
|
-
`,or=E`
|
|
536
|
+
`,br=R`
|
|
554
537
|
background: var(--white);
|
|
555
538
|
border-radius: var(--rounded-base);
|
|
556
539
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -559,56 +542,60 @@ var wr=Object.defineProperty;var Cr=(t,n)=>{for(var o in n)wr(t,o,{get:n[o],enum
|
|
|
559
542
|
padding: var(--spacing-base);
|
|
560
543
|
z-index: var(--z-10);
|
|
561
544
|
width: max-content;
|
|
562
|
-
`,
|
|
545
|
+
`,Y=R`
|
|
563
546
|
font-size: var(--fs-sm);
|
|
564
|
-
`,
|
|
547
|
+
`,fe=R`
|
|
565
548
|
font-weight: var(--fw-bold);
|
|
566
549
|
margin-right: var(--spacing-sm);
|
|
567
|
-
`,
|
|
550
|
+
`,yr=R`
|
|
568
551
|
display: flex;
|
|
569
552
|
flex-direction: column;
|
|
570
553
|
gap: var(--spacing-sm);
|
|
571
554
|
|
|
572
|
-
${
|
|
555
|
+
${qo("md")} {
|
|
573
556
|
flex-direction: row;
|
|
574
557
|
justify-content: end;
|
|
575
558
|
min-width: 200px;
|
|
576
559
|
}
|
|
577
|
-
`,
|
|
560
|
+
`,Ie=R`
|
|
578
561
|
align-items: center;
|
|
579
562
|
background: var(--white);
|
|
580
563
|
border-radius: var(--rounded-base);
|
|
581
564
|
border: 2px solid var(--gray-300);
|
|
565
|
+
color: currentColor;
|
|
582
566
|
display: flex;
|
|
583
567
|
gap: var(--spacing-sm);
|
|
584
568
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
585
|
-
justify-content:
|
|
569
|
+
justify-content: center;
|
|
570
|
+
text-decoration: none;
|
|
586
571
|
|
|
587
572
|
&:hover {
|
|
588
573
|
background: var(--gray-50);
|
|
589
574
|
}
|
|
590
|
-
`,
|
|
575
|
+
`,Sr=R`
|
|
591
576
|
display: flex;
|
|
592
577
|
margin-top: var(--spacing-sm);
|
|
593
|
-
|
|
578
|
+
gap: var(--spacing-sm);
|
|
579
|
+
`,wr=R`
|
|
580
|
+
background: none;
|
|
581
|
+
outline: none;
|
|
582
|
+
border: none;
|
|
583
|
+
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
584
|
+
`,Ee=R`
|
|
585
|
+
display: block;
|
|
586
|
+
max-width: 100%;
|
|
587
|
+
min-width: 100px;
|
|
588
|
+
height: auto;
|
|
589
|
+
`;import Yo,{useState as Jo,useRef as Cr,useEffect as jo}from"react";import{CgInfo as en,CgClose as tn}from"react-icons/cg";import{format as rn}from"timeago.js";import{css as J}from"@emotion/react";import{Icon as Pr}from"@uniformdev/design-system";function es({selectedItem:t,onDeselect:n,onEditClosed:o,logoIcon:r,itemDetailsRendererComponent:a}){let i=Cr(null),l=Cr(null),[g,u]=Jo(!1);jo(()=>{let p=E=>{i.current&&!i.current.contains(E.target)&&l.current&&!l.current.contains(E.target)&&u(!1)},h=()=>{u(!1)};return window.addEventListener("resize",h,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",h,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[l]);let f=()=>{var p;if(u(!g),l.current&&i.current){let h=(p=i==null?void 0:i.current)==null?void 0:p.getBoundingClientRect();l.current.style.top=`${h.top+30}px`}},s=a!=null?a:on;return e("div",{css:[mr,J`
|
|
594
590
|
margin: 0 0 1rem 0;
|
|
595
|
-
`],key:t.id},e("div",{css:
|
|
596
|
-
|
|
597
|
-
|
|
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":g,onClick:f},e(W,{width:24,height:24,css:B`
|
|
601
|
-
color: var(--gray-400);
|
|
602
|
-
`})),e("div",{id:"path-details","aria-hidden":!g,ref:l,css:[or,g?B`
|
|
591
|
+
`],key:t.id},e("div",{css:ur},e("div",{css:gr},e("div",{css:fr},e("h4",{css:[vr],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?e(Yo.Fragment,null,e("button",{type:"button",ref:i,css:wr,"aria-controls":"path-details","aria-expanded":g,onClick:f},e(Pr,{icon:en,iconColor:"gray",size:24,css:J`
|
|
592
|
+
opacity: var(--opacity-75);
|
|
593
|
+
`})),e("div",{id:"path-details","aria-hidden":!g,ref:l,css:[br,g?J`
|
|
603
594
|
visibility: visible;
|
|
604
|
-
`:
|
|
595
|
+
`:J`
|
|
605
596
|
visibility: hidden;
|
|
606
|
-
`]},Object.entries(t.popoverData).map(([p,h],
|
|
607
|
-
color: var(--brand-secondary-5);
|
|
608
|
-
`]})))))}function Uo({item:t}){let n=null;return t.previewUrl&&typeof t.previewUrl=="string"?t.type==="image"?n=e("img",{src:t.previewUrl,alt:t.id,width:"200"}):t.type==="video"&&(n=e("video",{src:t.previewUrl,title:t.id,width:"200",controls:!0})):t.previewUrl&&typeof t.previewUrl!="string"&&(n=t.previewUrl),n||t.metadata?e("div",{css:ar},n?e("div",{css:B`
|
|
609
|
-
margin-right: var(--spacing-sm);
|
|
610
|
-
`},n):null,e("ul",null,t.metadata?Object.entries(t.metadata).map(([o,r])=>e("li",{css:[j,B`
|
|
597
|
+
`]},Object.entries(t.popoverData).map(([p,h],E)=>e("div",{css:Y,key:E},e("span",{css:fe},p,":"),h)))):null),e(s,{item:t})),e("div",{css:yr},t.editLink?typeof t.editLink=="string"?e("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ue(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:Ie},e("span",{css:Y},"Edit"),r?e(V,{src:r,css:hr,alt:"Logo"}):null):t.editLink:null,e("button",{type:"button",onClick:()=>{n(t)},css:Ie},e("span",{css:Y},"Unlink"),e(Pr,{icon:tn,iconColor:"red",size:16})))))}function on({item:t}){let n=null;return t.previewUrl&&typeof t.previewUrl=="string"?t.type==="image"?n=e("img",{src:t.previewUrl,alt:t.id,width:"200",css:Ee}):t.type==="video"&&(n=e("video",{src:t.previewUrl,title:t.id,width:"200",controls:!0,css:Ee})):t.previewUrl&&typeof t.previewUrl!="string"&&(n=t.previewUrl),n||t.metadata?e("div",{css:Sr},n?e("div",null,n):null,e("ul",null,t.metadata?Object.entries(t.metadata).map(([o,r])=>e("li",{css:[Y,J`
|
|
611
598
|
order: 1;
|
|
612
|
-
`],key:o},e("span",{css:[
|
|
599
|
+
`],key:o},e("span",{css:[fe,J`
|
|
613
600
|
order: 1;
|
|
614
|
-
`]},o,":"),r)):null,t.createdDate?e("li",{css:
|
|
601
|
+
`]},o,":"),r)):null,t.createdDate?e("li",{css:Y},e("span",{css:fe},"Date:"),rn(t.createdDate)):null)):null}export*from"@uniformdev/mesh-sdk";import{Button as ds,Callout as ls,LoadingIndicator as ps,LoadingOverlay as ms,Menu as us,MenuItem as gs,Input as fs,InputSelect as vs,InputToggle as hs,Theme as bs,InputKeywordSearch as ys,Heading as Ss,ScrollableList as ws,ScrollableListItem as Cs,Textarea as Ps,Switch as Ls,Label as Rs,AddListButton as xs}from"@uniformdev/design-system";export{xs as AddListButton,ds as Button,ls as Callout,es as DamSelectedItem,zt as DefaultSearchRow,xt as DefaultSelectedItem,Zt as EntrySearch,Ss as Heading,be as Icons,fs as Input,vs as InputSelect,hs as InputToggle,ys as KeywordSearchInput,Rs as Label,ps as LoadingIndicator,ms as LoadingOverlay,us as Menu,gs as MenuItem,Je as ProductPreviewList,_n as ProductQuery,qe as ProductQueryContext,$i as ProductSearch,pr as ProductSearchContext,or as ProductSearchRow,lr as ProductSelectedItem,Ne as ResolvableLoadingValue,ws as ScrollableList,Cs as ScrollableListItem,Qe as SelectionField,Ls as Switch,Ps as Textarea,bs as Theme,Ae as UniformMeshLocationContext,Be as UniformMeshLocationContextProvider,$e as UniformMeshSdkContext,Ln as UniformMeshSdkContextProvider,Pe as badgeIcon,Ee as damSelectItemImage,mr as damSelectedItemContainer,fr as damSelectedItemCopy,gr as damSelectedItemDetails,hr as damSelectedItemIcon,wr as damSelectedItemInfoBtn,ur as damSelectedItemInner,Ie as damSelectedItemLinkBtn,yr as damSelectedItemLinkContainer,Sr as damSelectedItemMediaContainer,br as damSelectedItemPopover,fe as damSelectedItemPopoverLabel,Y as damSelectedItemSmallText,vr as damSelectedItemTitle,Kt as draggableContainer,Ce as draggableIcon,Qt as draggableIconOffset,Nt as draggableIconWrapper,Gt as entrySearchBtn,Bt as entrySearchConfig,Ot as entrySearchConfigHidden,At as entrySearchLoadMoreBtn,Ht as entrySearchResultList,$t as entrySearchSelectIcon,Ft as entrySearchSelectImg,Xa as entrySearchSelectInput,qa as entrySearchSelectOption,Ut as entrySearchWrapper,tr as productSearchRowActiveIcon,jt as productSearchRowCategory,Xt as productSearchRowContainer,qt as productSearchRowContent,Yt as productSearchRowContentActive,er as productSearchRowDetails,Jt as productSearchRowTitle,ar as productSelectedItemContainer,sr as productSelectedItemContent,ir as productSelectedItemDetails,cr as productSelectedItemIcon,Re as productSelectedItemImage,dr as productSelectedItemLinkContainer,xe as productedSelectedItemLinkBtn,ke as productedSelectedItemSmallText,Mt as searchRowBtn,kt as searchRowContainer,Et as searchRowContainerActive,It as searchRowContainerWithPopover,Tt as searchRowPopover,we as searchRowText,Se as searchRowTextSmall,ye as selectItemLinkBtn,Pt as selectItemLinkContainer,Ct as selectItemPopover,re as selectItemPopoverLabel,Q as selectItemSmallText,vt as selectedItemContainer,yt as selectedItemCopy,bt as selectedItemDetails,wt as selectedItemIcon,ht as selectedItemInner,St as selectedItemTitle,bn as useInitializeUniformMeshSdk,Ye as useProductQueryContext,ge as useProductSearchContext,un as useUniformMeshLocation,Oe as useUniformMeshLocationContext,kn as useUniformMeshSdk,Fe as useUniformMeshSdkContext};
|