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