@uniformdev/mesh-sdk-react 16.0.1-alpha.221 → 16.0.1-nuxt.156
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 +62 -6
- package/dist/index.esm.js +302 -222
- package/dist/index.js +300 -220
- package/dist/index.mjs +302 -222
- package/package.json +15 -14
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
"use strict";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(
|
|
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 or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(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:
|
|
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:
|
|
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,82 +81,79 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(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:R`
|
|
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:r.name||`Product ${i}`,css:R`
|
|
112
|
-
background-color: var(--gray-200);
|
|
113
|
-
width: 3.5rem;
|
|
114
|
-
height: 3.5rem;
|
|
115
|
-
object-fit: cover;
|
|
116
|
-
`}):e("div",{css:R`
|
|
117
|
-
height: 3.5rem;
|
|
118
|
-
width: 3.5rem;
|
|
119
|
-
background-color: var(--gray-100);
|
|
120
|
-
`}),e("h4",{css:R`
|
|
121
|
-
font-weight: var(--fw-bold);
|
|
122
|
-
width: 33.333333%;
|
|
123
|
-
font-size: var(--fs-sm);
|
|
124
|
-
`},r.name,m&&e("span",{css:R`
|
|
125
|
-
display: block;
|
|
126
|
-
font-weight: var(--fw-regular);
|
|
127
|
-
`},m)),r&&e(_e.Fragment,null,e("p",{css:R`
|
|
128
|
-
margin-right: var(--spacing-lg);
|
|
129
|
-
font-size: var(--fs-sm);
|
|
130
|
-
`},"SKU: ",r.sku||r.id,e("br",null)),r.price!==void 0?e("p",{css:R`
|
|
131
|
-
margin-right: var(--spacing-lg);
|
|
132
|
-
font-size: var(--fs-sm);
|
|
133
|
-
`},e("span",{css:R`
|
|
134
|
-
display: block;
|
|
135
|
-
`},"Price: ",r.price)):null,e("a",{css:R`
|
|
136
|
-
display: inline-flex;
|
|
137
|
-
justify-content: space-between;
|
|
138
|
-
align-items: center;
|
|
139
|
-
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
140
|
-
background-color: var(--white);
|
|
141
|
-
border-radius: var(--rounded-base);
|
|
142
|
-
border: 2px solid var(--gray-400);
|
|
143
|
-
margin-left: auto;
|
|
144
|
-
&:hover {
|
|
145
|
-
background-color: var(--gray-100);
|
|
146
|
-
}
|
|
147
|
-
`,href:r.url,title:`Goto ${r.name}`,target:"__blank",rel:"noopener"},e("span",{css:R`
|
|
148
|
-
font-size: var(--fs-sm);
|
|
149
|
-
margin-right: var(--spacing-sm);
|
|
150
|
-
`},"Edit"),o?e(H,{src:o,alt:"Logo",css:R`
|
|
151
|
-
width: 2.25rem;
|
|
152
|
-
height: 2.25rem;
|
|
153
|
-
`}):null))))})))};import eo,{useContext as to,useMemo as ro,useRef as oo}from"react";import*as T from"react";var fe={};nr(fe,{Caution:()=>We,Checkmark:()=>de,ChevronDown:()=>le,Close:()=>J,Danger:()=>Ze,ExclamationPoint:()=>qe,Info:()=>X,Lightbulb:()=>Je,MagnifyingGlass:()=>Xe,MaximizeAlt:()=>Ye,Minus:()=>ae,MoreVerticalAlt:()=>te,Plus:()=>ne});var wr=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"})),We=wr;var Cr=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"})),de=Cr;var Pr=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"})),le=Pr;var Rr=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"}))),J=Rr;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"})),Ze=kr;var xr=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"})),qe=xr;var Lr=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"})),X=Lr;var Mr=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"})),Je=Mr;var Vr=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"})))),Xe=Vr;var Er=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"})),Ye=Er;var Tr=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=Tr;import{useThrottle as Hr}from"react-use";import{v4 as Fr}from"uuid";import Dr,{useState as Gr,useRef as dt,useEffect as zr}from"react";function je(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as Ur}from"timeago.js";import{css as E}from"@emotion/react";import{mq as Ir}from"@uniformdev/design-system";var et=E`
|
|
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`
|
|
154
151
|
border: 1px solid var(--gray-200);
|
|
155
152
|
background: var(--gray-50);
|
|
156
153
|
border-radius: var(--rounded-base);
|
|
157
154
|
display: flex;
|
|
158
155
|
width: 100%;
|
|
159
|
-
`,
|
|
156
|
+
`,ht=M`
|
|
160
157
|
align-items: center;
|
|
161
158
|
display: flex;
|
|
162
159
|
flex-grow: 1;
|
|
@@ -164,24 +161,22 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
164
161
|
margin-inline: 0 var(--spacing-sm);
|
|
165
162
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
166
163
|
position: relative;
|
|
167
|
-
`,
|
|
164
|
+
`,bt=M`
|
|
168
165
|
flex-grow: 1;
|
|
169
|
-
`,
|
|
166
|
+
`,yt=M`
|
|
170
167
|
align-items: start;
|
|
171
168
|
display: inline-flex;
|
|
172
169
|
position: relative;
|
|
173
|
-
`,
|
|
170
|
+
`,St=M`
|
|
174
171
|
color: var(--brand-secondary-1);
|
|
175
172
|
font-size: var(--fs-base);
|
|
176
173
|
font-weight: var(--fw-bold);
|
|
177
174
|
line-height: 1;
|
|
178
|
-
|
|
175
|
+
margin: 0;
|
|
176
|
+
`,wt=M`
|
|
179
177
|
width: 1.5rem;
|
|
180
178
|
height: 1.5rem;
|
|
181
|
-
`,
|
|
182
|
-
width: 1rem;
|
|
183
|
-
height: 1rem;
|
|
184
|
-
`,st=E`
|
|
179
|
+
`,Ct=M`
|
|
185
180
|
background: var(--white);
|
|
186
181
|
border-radius: var(--rounded-base);
|
|
187
182
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -190,69 +185,69 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
190
185
|
padding: var(--spacing-base);
|
|
191
186
|
z-index: var(--z-10);
|
|
192
187
|
width: max-content;
|
|
193
|
-
|
|
188
|
+
`,Q=M`
|
|
194
189
|
font-size: var(--fs-sm);
|
|
195
|
-
`,
|
|
190
|
+
`,re=M`
|
|
196
191
|
font-weight: var(--fw-bold);
|
|
197
192
|
margin-right: var(--spacing-sm);
|
|
198
|
-
`,
|
|
193
|
+
`,Pt=M`
|
|
199
194
|
display: flex;
|
|
200
195
|
flex-direction: column;
|
|
201
196
|
gap: var(--spacing-sm);
|
|
202
197
|
|
|
203
|
-
${
|
|
198
|
+
${go("md")} {
|
|
204
199
|
flex-direction: row;
|
|
205
200
|
min-width: 200px;
|
|
201
|
+
justify-content: end;
|
|
206
202
|
}
|
|
207
|
-
`,
|
|
203
|
+
`,ye=M`
|
|
208
204
|
align-items: center;
|
|
209
205
|
background: var(--white);
|
|
210
206
|
border-radius: var(--rounded-base);
|
|
211
207
|
border: 2px solid var(--gray-300);
|
|
208
|
+
color: currentColor;
|
|
212
209
|
display: flex;
|
|
213
210
|
gap: var(--spacing-sm);
|
|
214
211
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
215
212
|
justify-content: space-between;
|
|
213
|
+
text-decoration: none;
|
|
216
214
|
|
|
217
215
|
&:hover {
|
|
218
216
|
background: var(--gray-50);
|
|
219
217
|
}
|
|
220
|
-
`;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`
|
|
221
219
|
margin-bottom: var(--spacing-sm);
|
|
222
|
-
`:""],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`
|
|
223
221
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
224
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
225
|
-
|
|
226
|
-
`})),e("div",{id:"path-details","aria-hidden":!
|
|
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`
|
|
227
225
|
visibility: visible;
|
|
228
|
-
`:
|
|
226
|
+
`:F`
|
|
229
227
|
visibility: hidden;
|
|
230
|
-
`]},Object.entries(t.popoverData).map(([
|
|
231
|
-
display: flex;
|
|
232
|
-
gap: var(--spacing-base);
|
|
233
|
-
`},t.metadata?Object.entries(t.metadata).filter(([a])=>["type","status"].includes(a.toLocaleLowerCase())).map(([a,g])=>e("span",{css:$,key:a},g)):null),t.metadata?Object.entries(t.metadata).filter(([a])=>!["type","status"].includes(a.toLocaleLowerCase())).map(([a,g])=>e("div",{css:[$,z`
|
|
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:
|
|
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`
|
|
231
|
+
order: 1;
|
|
232
|
+
`],key:s},e("span",{css:[re,F`
|
|
236
233
|
order: 1;
|
|
237
|
-
`]},
|
|
238
|
-
color: var(--brand-secondary-5);
|
|
239
|
-
`]})))))};import Ar,{useState as Br,useRef as vt,useEffect as Or}from"react";import{css as K}from"@emotion/react";var pt=K`
|
|
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`
|
|
240
235
|
cursor: pointer;
|
|
241
236
|
padding: var(--spacing-sm);
|
|
242
237
|
position: relative;
|
|
243
238
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
244
239
|
color var(--duration-fast) var(--timing-ease-out);
|
|
245
|
-
`,
|
|
240
|
+
`,It=W`
|
|
246
241
|
padding-right: var(--spacing-lg);
|
|
247
|
-
`,
|
|
242
|
+
`,Et=W`
|
|
248
243
|
background: var(--brand-secondary-3);
|
|
249
244
|
color: var(--white);
|
|
250
|
-
`,
|
|
245
|
+
`,Se=W`
|
|
251
246
|
font-size: var(--fs-xs);
|
|
252
|
-
`,
|
|
247
|
+
`,we=W`
|
|
253
248
|
font-weight: var(--fw-bold);
|
|
254
249
|
margin-right: var(--spacing-sm);
|
|
255
|
-
`,
|
|
250
|
+
`,Tt=W`
|
|
256
251
|
background: var(--white);
|
|
257
252
|
border-left: 4px solid var(--brand-secondary-3);
|
|
258
253
|
border-radius: var(--rounded-base);
|
|
@@ -264,20 +259,20 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
264
259
|
right: var(--spacing-xl);
|
|
265
260
|
z-index: var(--z-10);
|
|
266
261
|
width: max-content;
|
|
267
|
-
`,
|
|
262
|
+
`,Mt=W`
|
|
268
263
|
position: absolute;
|
|
269
264
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
270
|
-
`;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`
|
|
271
266
|
visibility: visible;
|
|
272
|
-
`:
|
|
267
|
+
`:Dt`
|
|
273
268
|
visibility: hidden;
|
|
274
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([
|
|
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`
|
|
275
270
|
background: var(--white);
|
|
276
271
|
border: 1px solid var(--gray-300);
|
|
277
272
|
border-radius: var(--rounded-base);
|
|
278
273
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
279
274
|
margin-bottom: var(--spacing-base);
|
|
280
|
-
`,
|
|
275
|
+
`,Gt=C`
|
|
281
276
|
align-items: center;
|
|
282
277
|
display: flex;
|
|
283
278
|
position: relative;
|
|
@@ -285,7 +280,7 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
285
280
|
width: 100%;
|
|
286
281
|
background-color: transparent;
|
|
287
282
|
border: 0;
|
|
288
|
-
`,
|
|
283
|
+
`,At=C`
|
|
289
284
|
color: var(--brand-secondary-1);
|
|
290
285
|
display: block;
|
|
291
286
|
font-weight: var(--fw-bold);
|
|
@@ -301,221 +296,306 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
301
296
|
background: var(--gray-100);
|
|
302
297
|
outline: none;
|
|
303
298
|
}
|
|
304
|
-
`,
|
|
299
|
+
`,Bt=C`
|
|
305
300
|
background: var(--white);
|
|
306
301
|
border: 1px solid var(--gray-300);
|
|
307
302
|
border-radius: var(--rounded-base);
|
|
308
303
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
309
304
|
display: block;
|
|
310
|
-
`,
|
|
305
|
+
`,Ot=C`
|
|
311
306
|
display: none;
|
|
312
|
-
`,
|
|
307
|
+
`,Ht=C`
|
|
313
308
|
overflow-y: auto;
|
|
314
|
-
|
|
309
|
+
height: 16rem;
|
|
315
310
|
margin-bottom: var(--spacing-base);
|
|
311
|
+
position: relative;
|
|
316
312
|
|
|
317
313
|
& > :not(:last-child) {
|
|
318
314
|
border-bottom: 1px solid var(--gray-200);
|
|
319
315
|
}
|
|
320
|
-
`,
|
|
316
|
+
`,Xa=C`
|
|
321
317
|
background-color: var(--gray-50);
|
|
322
318
|
max-width: 33.33%;
|
|
323
|
-
|
|
319
|
+
`,$t=C`
|
|
324
320
|
align-items: center;
|
|
325
321
|
display: flex;
|
|
326
322
|
position: absolute;
|
|
327
323
|
inset: 0 0 0 auto;
|
|
328
324
|
pointer-events: none;
|
|
329
325
|
padding-right: var(--spacing-sm);
|
|
330
|
-
`,
|
|
326
|
+
`,Ft=C`
|
|
331
327
|
color: var(--brand-secondary-1);
|
|
332
328
|
width: 1.25rem;
|
|
333
329
|
height: 1.25rem;
|
|
334
330
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
335
331
|
transform: rotate(0);
|
|
336
|
-
`,
|
|
332
|
+
`,qa=C`
|
|
337
333
|
background: var(--white);
|
|
338
334
|
color: var(--brand-secondary-1);
|
|
339
|
-
`,
|
|
335
|
+
`,Kt=C`
|
|
340
336
|
position: relative;
|
|
341
337
|
margin-block: var(--spacing-sm) 0;
|
|
342
338
|
|
|
343
339
|
&:hover > span {
|
|
344
340
|
opacity: 0.3;
|
|
345
341
|
}
|
|
346
|
-
`,
|
|
342
|
+
`,Nt=C`
|
|
347
343
|
align-items: center;
|
|
348
344
|
display: flex;
|
|
349
345
|
position: absolute;
|
|
350
346
|
inset: 0 auto 0 0;
|
|
351
347
|
margin-block: auto;
|
|
352
348
|
opacity: 0;
|
|
353
|
-
`,
|
|
349
|
+
`,Ce=C`
|
|
354
350
|
color: var(--brand-secondary-1);
|
|
355
|
-
`,
|
|
351
|
+
`,Qt=C`
|
|
356
352
|
position: absolute;
|
|
357
353
|
left: 0.375rem;
|
|
358
|
-
`,
|
|
354
|
+
`,Pe=C`
|
|
359
355
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
360
356
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
361
|
-
`;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`
|
|
362
358
|
width: 100%;
|
|
363
|
-
`},e("div",{css:
|
|
359
|
+
`},e("div",{css:z`
|
|
364
360
|
position: relative;
|
|
365
361
|
margin-block: var(--spacing-base);
|
|
366
|
-
`},
|
|
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`
|
|
367
363
|
margin-left: var(--spacing-base);
|
|
368
|
-
`},"Select"),e("span",{css
|
|
364
|
+
`},"Select"),e("span",{css:$t},e(pe,{css:[Ft,U?z`
|
|
369
365
|
transform: rotate(180deg);
|
|
370
|
-
`: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`
|
|
371
367
|
display: flex;
|
|
372
368
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
373
369
|
margin-bottom: var(--spacing-base);
|
|
374
|
-
`},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`
|
|
375
371
|
flex-grow: 1;
|
|
376
|
-
`},e(
|
|
377
|
-
padding: var(--spacing-base);
|
|
378
|
-
text-align: center;
|
|
379
|
-
width: 100%;
|
|
380
|
-
`},e(Et,null)):null),e("div",{css:I`
|
|
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`
|
|
381
373
|
display: flex;
|
|
382
374
|
justify-content: space-between;
|
|
383
|
-
`},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`
|
|
384
376
|
background: var(--white);
|
|
385
377
|
color: var(--brand-secondary-1);
|
|
386
|
-
`,onClick:()=>
|
|
378
|
+
`,onClick:()=>E(c)},c.name))):null),e("div",{css:z`
|
|
387
379
|
display: flex;
|
|
388
380
|
gap: var(--spacing-base);
|
|
389
|
-
`},e(
|
|
390
|
-
|
|
391
|
-
|
|
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`
|
|
382
|
+
margin-block: var(--spacing-sm) 0;
|
|
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=_`
|
|
392
384
|
cursor: pointer;
|
|
393
385
|
padding: var(--spacing-sm) 0;
|
|
394
386
|
margin-right: var(--spacing-sm);
|
|
395
387
|
position: relative;
|
|
396
388
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
397
389
|
color var(--duration-fast) var(--timing-ease-out);
|
|
398
|
-
`,
|
|
390
|
+
`,qt=_`
|
|
399
391
|
border: 2px solid transparent;
|
|
400
392
|
border-radius: var(--rounded-base);
|
|
401
393
|
display: flex;
|
|
402
394
|
align-items: center;
|
|
403
395
|
gap: var(--spacing-base);
|
|
404
396
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
405
|
-
`,
|
|
397
|
+
`,Yt=_`
|
|
406
398
|
background-color: var(--green-50);
|
|
407
|
-
`,
|
|
399
|
+
`,Jt=_`
|
|
408
400
|
font-size: var(--fs-sm);
|
|
409
401
|
font-weight: var(--fw-bold);
|
|
410
402
|
width: 50%;
|
|
411
|
-
`,
|
|
403
|
+
`,jt=_`
|
|
412
404
|
font-weight: var(--fw-normal);
|
|
413
405
|
display: block;
|
|
414
|
-
`,
|
|
406
|
+
`,er=_`
|
|
415
407
|
font-size: var(--fs-sm);
|
|
416
408
|
> * {
|
|
417
409
|
display: block;
|
|
418
410
|
}
|
|
419
|
-
`,
|
|
411
|
+
`,tr=_`
|
|
420
412
|
display: block;
|
|
421
413
|
height: 1.5rem;
|
|
422
414
|
width: 1.5rem;
|
|
423
415
|
color: var(--brand-secondary-3);
|
|
424
416
|
margin-left: auto;
|
|
425
|
-
`;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`
|
|
426
418
|
background-color: var(--gray-200);
|
|
427
419
|
width: 3rem;
|
|
428
420
|
height: 3rem;
|
|
429
421
|
object-fit: cover;
|
|
430
|
-
`}):e(
|
|
422
|
+
`}):e(V,{src:a,alt:"Logo",css:rr`
|
|
431
423
|
height: 2.25rem;
|
|
432
424
|
width: 2.25rem;
|
|
433
|
-
`}),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);
|
|
434
429
|
display: flex;
|
|
435
430
|
width: 100%;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
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);
|
|
442
436
|
display: flex;
|
|
443
437
|
flex-grow: 1;
|
|
444
|
-
|
|
445
|
-
margin-
|
|
446
|
-
|
|
447
|
-
`,Kt=me`
|
|
438
|
+
gap: var(--spacing-sm);
|
|
439
|
+
margin-inline: 0 var(--spacing-sm);
|
|
440
|
+
`,sr=K`
|
|
448
441
|
display: flex;
|
|
449
442
|
align-items: center;
|
|
450
443
|
gap: var(--spacing-sm);
|
|
451
|
-
|
|
444
|
+
flex-grow: 1;
|
|
445
|
+
|
|
446
|
+
${nr("lg")} {
|
|
452
447
|
width: 50%;
|
|
453
448
|
margin-bottom: 0;
|
|
454
449
|
}
|
|
455
|
-
`,
|
|
450
|
+
`,Re=K`
|
|
456
451
|
background-color: var(--gray-200);
|
|
457
452
|
width: 3.5rem;
|
|
458
453
|
height: 3.5rem;
|
|
459
454
|
object-fit: cover;
|
|
460
|
-
|
|
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`
|
|
461
487
|
> :not(:last-child) {
|
|
462
488
|
margin-bottom: var(--spacing-xs);
|
|
463
489
|
}
|
|
464
|
-
`},e("h4",{css:
|
|
490
|
+
`},e("h4",{css:q`
|
|
491
|
+
margin-top: 0px;
|
|
465
492
|
font-weight: var(--fw-bold);
|
|
466
|
-
`},t.title||t.id||"",
|
|
493
|
+
`},t.title||t.id||"",i&&e("span",{css:q`
|
|
467
494
|
display: block;
|
|
468
495
|
font-weight: var(--fw-regular);
|
|
469
|
-
`},
|
|
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:
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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`
|
|
508
|
+
border: 1px solid var(--gray-200);
|
|
509
|
+
background: var(--gray-50);
|
|
510
|
+
border-radius: var(--rounded-base);
|
|
511
|
+
display: flex;
|
|
512
|
+
width: 100%;
|
|
513
|
+
`,ur=R`
|
|
514
|
+
align-items: center;
|
|
515
|
+
display: flex;
|
|
516
|
+
flex-grow: 1;
|
|
517
|
+
gap: var(--spacing-sm);
|
|
518
|
+
margin-inline: 0 var(--spacing-sm);
|
|
519
|
+
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
520
|
+
position: relative;
|
|
521
|
+
`,gr=R`
|
|
522
|
+
flex-grow: 1;
|
|
523
|
+
`,fr=R`
|
|
524
|
+
align-items: center;
|
|
525
|
+
display: flex;
|
|
526
|
+
position: relative;
|
|
527
|
+
`,vr=R`
|
|
528
|
+
color: var(--brand-secondary-1);
|
|
529
|
+
font-size: var(--fs-base);
|
|
530
|
+
font-weight: var(--fw-bold);
|
|
531
|
+
line-height: 1;
|
|
532
|
+
margin: 0;
|
|
533
|
+
`,hr=R`
|
|
534
|
+
width: 1.5rem;
|
|
535
|
+
height: 1.5rem;
|
|
536
|
+
`,br=R`
|
|
537
|
+
background: var(--white);
|
|
538
|
+
border-radius: var(--rounded-base);
|
|
539
|
+
border-left: 4px solid var(--brand-secondary-3);
|
|
540
|
+
box-shadow: var(--shadow-base);
|
|
541
|
+
position: fixed;
|
|
542
|
+
padding: var(--spacing-base);
|
|
543
|
+
z-index: var(--z-10);
|
|
544
|
+
width: max-content;
|
|
545
|
+
`,Y=R`
|
|
546
|
+
font-size: var(--fs-sm);
|
|
547
|
+
`,fe=R`
|
|
548
|
+
font-weight: var(--fw-bold);
|
|
549
|
+
margin-right: var(--spacing-sm);
|
|
550
|
+
`,yr=R`
|
|
551
|
+
display: flex;
|
|
552
|
+
flex-direction: column;
|
|
553
|
+
gap: var(--spacing-sm);
|
|
554
|
+
|
|
555
|
+
${qo("md")} {
|
|
556
|
+
flex-direction: row;
|
|
557
|
+
justify-content: end;
|
|
558
|
+
min-width: 200px;
|
|
559
|
+
}
|
|
560
|
+
`,Ie=R`
|
|
561
|
+
align-items: center;
|
|
562
|
+
background: var(--white);
|
|
563
|
+
border-radius: var(--rounded-base);
|
|
564
|
+
border: 2px solid var(--gray-300);
|
|
565
|
+
color: currentColor;
|
|
566
|
+
display: flex;
|
|
567
|
+
gap: var(--spacing-sm);
|
|
568
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
569
|
+
justify-content: center;
|
|
570
|
+
text-decoration: none;
|
|
571
|
+
|
|
572
|
+
&:hover {
|
|
573
|
+
background: var(--gray-50);
|
|
574
|
+
}
|
|
575
|
+
`,Sr=R`
|
|
576
|
+
display: flex;
|
|
577
|
+
margin-top: var(--spacing-sm);
|
|
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`
|
|
590
|
+
margin: 0 0 1rem 0;
|
|
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`
|
|
594
|
+
visibility: visible;
|
|
595
|
+
`:J`
|
|
596
|
+
visibility: hidden;
|
|
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`
|
|
598
|
+
order: 1;
|
|
599
|
+
`],key:o},e("span",{css:[fe,J`
|
|
600
|
+
order: 1;
|
|
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};
|