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