@uniformdev/mesh-sdk-react 16.1.0 → 16.1.1-alpha.139
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 +2 -1
- package/dist/index.esm.js +139 -142
- package/dist/index.js +138 -141
- package/dist/index.mjs +139 -142
- package/package.json +11 -11
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var nr=Object.defineProperty;var ar=(t,n)=>{for(var o in n)nr(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as x from"react";import{createContext as ir,useContext as sr,useState as cr}from"react";var Ee=ir(void 0),Me=({children:t})=>{let[n,o]=cr(),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(s,l)=>{await i.setValue(s,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async s=>{await i.setValidationResult(s)}}}}return e(Ee.Provider,{value:r},t)},Ve=()=>{let t=sr(Ee);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function wo(){let{location:t}=Ve();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 dr}from"@uniformdev/mesh-sdk";import{useEffect as lr,useState as Te}from"react";var ko=({autoResizingDisabled:t}={})=>{let[n,o]=Te(),[r,i]=Te();return lr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?dr({autoResizingDisabled:t}).then(s=>{i(s)}).catch(s=>{o(s)}):i(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as pr,useContext as ur}from"react";import{Theme as mr}from"@uniformdev/design-system";var Ie=pr(void 0),Io=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e(Ie.Provider,{value:n},e(mr,null),e(Me,null,t))},De=()=>{let t=ur(Ie);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function zo(){let{sdk:t}=De();return t}import Qe from"react";import hr,{useMemo as ne,useContext as yr}from"react";import{css as j}from"@emotion/react";import{InputSelect as gr}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 Ae=({id:t,label:n,loading:o,selectedValues:r,values:i,onAdd:s,onRemove:l})=>{var v;let f=(v=i==null?void 0:i.filter(c=>!(r!=null&&r.includes(c.id.toString()))))!=null?v:[],p=(c,g)=>{c.preventDefault(),l(g)};return e("div",null,e(gr,{id:t,name:t,label:n,onChange:c=>s(c.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.map(c=>({value:c.id,label:c.name||c.id}))],value:"",css:Array.isArray(r)&&r.length>0?j`
|
|
2
2
|
margin-bottom: var(--spacing-base);
|
|
3
|
-
`:""}),r==null?void 0:r.map(
|
|
3
|
+
`:""}),r==null?void 0:r.map(c=>{var g;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 or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
9
9
|
border: 1px solid var(--gray-300);
|
|
10
10
|
margin-bottom: var(--spacing-sm);
|
|
11
11
|
margin-right: var(--spacing-sm);
|
|
12
|
-
`,key:
|
|
12
|
+
`,key:c},e("span",{css:j`
|
|
13
13
|
padding: var(--spacing-3);
|
|
14
14
|
color: var(--gray-800);
|
|
15
|
-
`},e(
|
|
15
|
+
`},e(ze,{value:c,loading:o,text:(g=i.find(S=>S.id===c))==null?void 0:g.name})),e("button",{css:j`
|
|
16
16
|
padding: var(--spacing-3);
|
|
17
17
|
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:S=>
|
|
18
|
+
`,title:"remove",onClick:S=>p(S,c)},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
|
|
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 fr=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=fr;var vr=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=vr;import{useAsyncFn as br,useDebounce as Sr}from"react-use";import{Input as Ue,InputSelect as ae,mq as ie}from"@uniformdev/design-system";import{css as R}from"@emotion/react";var Oe={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},tn=({value:t,setValue:n,brands:o,categories:r,loading:i,categoriesLoading:s,brandsLoading:l,logoIcon:f,onGetProducts:p,sortOptions:v,sortOrderOptions:c,categoryLabel:g="Product Category",brandLabel:S="Brand",disableBrands:N,restrictToSingleCategory:D=!1})=>{var u,w,Z;let b=async a=>{n({...Oe,...t||{},...a})},h=ne(()=>({...Oe,...t||{}}),[t]),[_,G]=br(async a=>await p(a),[p]);Sr(async()=>{await G({brand:h.brand,categories:h.categories,keyword:h.keyword,sort:h.sort,sortOrder:h.sortOrder,count:h.count})},250,[h]);let O=ne(()=>{let a=[];return r==null||r.forEach(C=>{let q=He(C,void 0);a.push(...q)}),a},[r]),z=ne(()=>[{value:"",label:"All categories"},...O.map(a=>({label:a.name,value:a.id}))],[O]),B=ne(()=>(o==null?void 0:o.map(a=>({id:a.id.toString(),name:a.name})))||[],[o]),W=a=>{if(!a)return;let C=(t==null?void 0:t.categories)||[];b({categories:[...C,a]})},H=a=>{var C;b({categories:(C=t==null?void 0:t.categories)==null?void 0:C.filter(q=>q!==a)})},$=a=>{b({brand:a.target.value})},y=a=>{b({count:a||1})};return i?e("div",null,"Loading..."):e($e.Provider,{value:{categories:r,logoIcon:f}},e("div",{css:R`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
27
|
-
`},
|
|
27
|
+
`},D?e(ae,{id:"selection-field-product-category",label:g,disabled:i,value:(w=(u=h.categories)==null?void 0:u[0])!=null?w:"",options:z,onChange:a=>{b({categories:a.target.value===""?[]:[a.target.value]})}}):e(Ae,{loading:s||!1,id:"selection-field-product-category",label:g,onAdd:W,onRemove:H,selectedValues:h.categories,values:O}),e("div",{css:R`
|
|
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
|
-
`},N?null:e("div",{css:
|
|
35
|
+
`},N?null:e("div",{css:R`
|
|
36
36
|
width: 50%;
|
|
37
|
-
`},e(
|
|
37
|
+
`},e(ae,{id:"brand",name:"brand",label:S,disabled:l,value:h.brand,onChange:$,options:[{value:"",label:"Choose..."},...B.map(a=>({value:a.id,label:a.name}))]})),e("div",{css:R`
|
|
38
38
|
flex-grow: 1;
|
|
39
39
|
position: relative;
|
|
40
|
-
`},e(
|
|
40
|
+
`},e(Ue,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:h.keyword,placeholder:"Enter keyword",onChange:a=>b({keyword:a.target.value})}))),e("div",{css:R`
|
|
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:R`
|
|
49
49
|
width: 100%;
|
|
50
|
-
${
|
|
50
|
+
${ie("md")} {
|
|
51
51
|
width: 33.333333%;
|
|
52
52
|
}
|
|
53
53
|
position: relative;
|
|
54
|
-
`},e(
|
|
54
|
+
`},e(Ue,{id:"count",name:"count",type:"number",min:1,step:1,value:h.count,onChange:a=>y(a.target.valueAsNumber),label:"Count"}),e("div",{css:R`
|
|
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(Be,{onCountChange:()=>y(h.count-1),countIcon:"decrement",disabled:h.count===1}),e(Be,{onCountChange:()=>y(h.count+1),countIcon:"increment"}))),Array.isArray(v)&&v.length>0?e("div",{css:R`
|
|
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:a=>b({sort:a.target.value}),options:[{value:"",label:"Select a sort"},...v.map(a=>({value:a.sortKey,label:a.name}))]})):null,Array.isArray(c)&&c.length>0?e("div",{css:R`
|
|
66
66
|
flex-grow: 1;
|
|
67
|
-
`},e(
|
|
67
|
+
`},e(ae,{id:"sort-order",name:"sort-order",label:"Sort Order",value:h.sortOrder,onChange:a=>b({sortOrder:a.target.value}),options:c.map(a=>({value:a.sortOrderKey,label:a.name}))})):null),e("div",null,e("h3",{css:R`
|
|
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:(Z=_.value)==null?void 0:Z.products}))))};function He(t,n){var s;let o=[],r=n?`${n.name} > `:"",i={id:t.id.toString(),name:`${r}${t.name}`};return o.push(i),(s=t.children)==null||s.forEach(l=>{let f=He(l,i);o.push(...f)}),o}function Be({onCountChange:t,countIcon:n,disabled:o}){return e("button",{css:R`
|
|
73
73
|
width: 2.25rem;
|
|
74
74
|
height: 2.25rem;
|
|
75
75
|
border: 1px solid var(--gray-300);
|
|
@@ -81,82 +81,82 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
81
81
|
&:hover {
|
|
82
82
|
background-color: var(--gray-200);
|
|
83
83
|
}
|
|
84
|
-
${o?
|
|
84
|
+
${o?R`
|
|
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:R`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`}):e(
|
|
91
|
+
`}):e(oe,{css:R`
|
|
92
92
|
width: 1rem;
|
|
93
93
|
height: 1rem;
|
|
94
|
-
`}))}var
|
|
94
|
+
`}))}var $e=hr.createContext(void 0),Fe=()=>{let t=yr($e);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function U({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 L}from"@emotion/react";import{scrollbarStyles as wr}from"@uniformdev/design-system";var Ke=({products:t})=>{let{categories:n,logoIcon:o}=Fe();return e(Qe.Fragment,null,e("p",{css:L`
|
|
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:[L`
|
|
97
97
|
max-height: 24rem;
|
|
98
98
|
overflow-x: auto;
|
|
99
|
-
`,
|
|
99
|
+
`,wr]},t==null?void 0:t.map((r,i)=>{var f,p;let[s]=(r==null?void 0:r.categories)||[],l=typeof s=="undefined"||!n||(f=n.find(v=>v.id===s.id))==null?void 0:f.name;return e("li",{key:`product-${r.id}`,css:L`
|
|
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:L`
|
|
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:L`
|
|
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:L`
|
|
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:L`
|
|
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,l&&e("span",{css:L`
|
|
125
125
|
display: block;
|
|
126
126
|
font-weight: var(--fw-regular);
|
|
127
|
-
`},
|
|
127
|
+
`},l)),r&&e(Qe.Fragment,null,e("p",{css:L`
|
|
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:L`
|
|
131
131
|
margin-right: var(--spacing-lg);
|
|
132
132
|
font-size: var(--fs-sm);
|
|
133
|
-
`},e("span",{css:
|
|
133
|
+
`},e("span",{css:L`
|
|
134
134
|
display: block;
|
|
135
|
-
`},"Price: ",r.price)):null,e("a",{css:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
135
|
+
`},"Price: ",r.price)):null,r.editLink||r.url?e("a",{css:L`
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
justify-content: space-between;
|
|
138
|
+
align-items: center;
|
|
139
|
+
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
140
|
+
background-color: var(--white);
|
|
141
|
+
border-radius: var(--rounded-base);
|
|
142
|
+
border: 2px solid var(--gray-400);
|
|
143
|
+
margin-left: auto;
|
|
144
|
+
&:hover {
|
|
145
|
+
background-color: var(--gray-100);
|
|
146
|
+
}
|
|
147
|
+
`,href:(p=r.editLink)!=null?p:r.url,title:`Goto ${r.name}`,target:"__blank",rel:"noopener"},e("span",{css:L`
|
|
148
|
+
font-size: var(--fs-sm);
|
|
149
|
+
margin-right: var(--spacing-sm);
|
|
150
|
+
`},"Edit"),o?e(U,{src:o,alt:"Logo",css:L`
|
|
151
|
+
width: 2.25rem;
|
|
152
|
+
height: 2.25rem;
|
|
153
|
+
`}):null):null)))})))};import ao,{useContext as io,useMemo as so,useRef as co}from"react";import*as E from"react";var me={};ar(me,{Caution:()=>Ne,Checkmark:()=>se,ChevronDown:()=>ce,Close:()=>X,Danger:()=>_e,ExclamationPoint:()=>We,Info:()=>Y,Lightbulb:()=>Ze,MagnifyingGlass:()=>Xe,MaximizeAlt:()=>Ye,Minus:()=>oe,MoreVerticalAlt:()=>ee,Plus:()=>re});var Cr=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=Cr;var Pr=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=Pr;var Rr=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=Rr;var Lr=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"}))),X=Lr;var kr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),_e=kr;var xr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),We=xr;var Er=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"})),Y=Er;var Mr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),Ze=Mr;var Vr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),e("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),Xe=Vr;var Tr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),Ye=Tr;var Ir=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"})),ee=Ir;import{useThrottle as Kr}from"react-use";import{v4 as Qr}from"uuid";import Gr,{useState as zr,useRef as st,useEffect as Ar}from"react";function qe(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as Ur}from"timeago.js";import{css as V}from"@emotion/react";import{mq as Dr}from"@uniformdev/design-system";var Je=V`
|
|
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=V`
|
|
160
160
|
align-items: center;
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-grow: 1;
|
|
@@ -164,24 +164,24 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(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=V`
|
|
168
168
|
flex-grow: 1;
|
|
169
|
-
`,
|
|
169
|
+
`,tt=V`
|
|
170
170
|
align-items: start;
|
|
171
171
|
display: inline-flex;
|
|
172
172
|
position: relative;
|
|
173
|
-
`,
|
|
173
|
+
`,rt=V`
|
|
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=V`
|
|
179
179
|
width: 1.5rem;
|
|
180
180
|
height: 1.5rem;
|
|
181
|
-
`,
|
|
181
|
+
`,nt=V`
|
|
182
182
|
width: 1rem;
|
|
183
183
|
height: 1rem;
|
|
184
|
-
`,
|
|
184
|
+
`,at=V`
|
|
185
185
|
background: var(--white);
|
|
186
186
|
border-radius: var(--rounded-base);
|
|
187
187
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -190,21 +190,21 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
190
190
|
padding: var(--spacing-base);
|
|
191
191
|
z-index: var(--z-10);
|
|
192
192
|
width: max-content;
|
|
193
|
-
|
|
193
|
+
`,F=V`
|
|
194
194
|
font-size: var(--fs-sm);
|
|
195
|
-
`,
|
|
195
|
+
`,de=V`
|
|
196
196
|
font-weight: var(--fw-bold);
|
|
197
197
|
margin-right: var(--spacing-sm);
|
|
198
|
-
`,
|
|
198
|
+
`,it=V`
|
|
199
199
|
display: flex;
|
|
200
200
|
flex-direction: column;
|
|
201
201
|
gap: var(--spacing-sm);
|
|
202
202
|
|
|
203
|
-
${
|
|
203
|
+
${Dr("md")} {
|
|
204
204
|
flex-direction: row;
|
|
205
205
|
min-width: 200px;
|
|
206
206
|
}
|
|
207
|
-
`,
|
|
207
|
+
`,ge=V`
|
|
208
208
|
align-items: center;
|
|
209
209
|
background: var(--white);
|
|
210
210
|
border-radius: var(--rounded-base);
|
|
@@ -217,42 +217,42 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
217
217
|
&:hover {
|
|
218
218
|
background: var(--gray-50);
|
|
219
219
|
}
|
|
220
|
-
`;import{css as
|
|
220
|
+
`;import{css as I}from"@emotion/react";var ct=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var v;let i=st(null),s=st(null),[l,f]=zr(!1);Ar(()=>{let c=S=>{i.current&&!i.current.contains(S.target)&&s.current&&!s.current.contains(S.target)&&f(!1)},g=()=>{f(!1)};return window.addEventListener("resize",g,!0),document.addEventListener("scroll",c,!0),document.addEventListener("mousedown",c),()=>{window.removeEventListener("resize",g,!0),document.removeEventListener("scroll",c,!0),document.removeEventListener("mousedown",c)}},[s]);let p=()=>{var c;if(f(!l),s.current&&i.current){let g=(c=i==null?void 0:i.current)==null?void 0:c.getBoundingClientRect(),S=s.current.offsetWidth;s.current.style.top=`${g.top+30}px`,s.current.style.left=`${g.left-S+30}px`}};return e("div",{css:Je,key:t.id},e("div",{css:je},e("div",{css:et},e("div",{css:tt},e("h4",{css:[rt,t.popoverData?I`
|
|
221
221
|
margin-bottom: var(--spacing-sm);
|
|
222
|
-
`:""],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(Gr.Fragment,null,e("button",{type:"button",ref:i,css:I`
|
|
223
223
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
224
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
224
|
+
`,"aria-controls":"path-details","aria-expanded":l,onClick:p},e(Y,{width:24,height:24,css:I`
|
|
225
225
|
color: var(--gray-400);
|
|
226
|
-
`})),e("div",{id:"path-details","aria-hidden":!
|
|
226
|
+
`})),e("div",{id:"path-details","aria-hidden":!l,ref:s,css:[at,l?I`
|
|
227
227
|
visibility: visible;
|
|
228
|
-
`:
|
|
228
|
+
`:I`
|
|
229
229
|
visibility: hidden;
|
|
230
|
-
`]},Object.entries(t.popoverData).map(([
|
|
230
|
+
`]},Object.entries(t.popoverData).map(([c,g],S)=>e("div",{css:F,key:S},e("span",{css:de},c,":"),g)))):null),t.createdDate&&e("div",{css:F},e("span",{css:de},"Created:"),Ur((v=t.createdDate)!=null?v:0)),e("div",{css:I`
|
|
231
231
|
display: flex;
|
|
232
232
|
gap: var(--spacing-base);
|
|
233
|
-
`},t.metadata?Object.entries(t.metadata).filter(([
|
|
233
|
+
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,g])=>e("span",{css:F,key:c},g)):null),t.metadata?Object.entries(t.metadata).filter(([c])=>!["type","status"].includes(c.toLocaleLowerCase())).map(([c,g])=>e("div",{css:[F,I`
|
|
234
234
|
order: 1;
|
|
235
|
-
`],key:
|
|
235
|
+
`],key:c},e("span",{css:[de,I`
|
|
236
236
|
order: 1;
|
|
237
|
-
`]},
|
|
237
|
+
`]},c,":"),g)):null),e("div",{css:it},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:c=>{r&&(qe(c.currentTarget.href,()=>r(t)),c.preventDefault())},css:ge},e("span",{css:F},"Edit"),e(U,{src:n,css:ot,alt:"Logo"})):null,e("button",{type:"button",onClick:()=>{o(t)},css:ge},e("span",{css:F},"Unlink"),e(X,{css:[nt,I`
|
|
238
238
|
color: var(--brand-secondary-5);
|
|
239
|
-
`]})))))};import
|
|
239
|
+
`]})))))};import Or,{useState as Br,useRef as gt,useEffect as Hr}from"react";import{css as K}from"@emotion/react";var dt=K`
|
|
240
240
|
cursor: pointer;
|
|
241
241
|
padding: var(--spacing-sm);
|
|
242
242
|
position: relative;
|
|
243
243
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
244
244
|
color var(--duration-fast) var(--timing-ease-out);
|
|
245
|
-
`,
|
|
245
|
+
`,lt=K`
|
|
246
246
|
padding-right: var(--spacing-lg);
|
|
247
|
-
`,
|
|
247
|
+
`,pt=K`
|
|
248
248
|
background: var(--brand-secondary-3);
|
|
249
249
|
color: var(--white);
|
|
250
|
-
`,
|
|
250
|
+
`,fe=K`
|
|
251
251
|
font-size: var(--fs-xs);
|
|
252
|
-
`,
|
|
252
|
+
`,ve=K`
|
|
253
253
|
font-weight: var(--fw-bold);
|
|
254
254
|
margin-right: var(--spacing-sm);
|
|
255
|
-
`,
|
|
255
|
+
`,ut=K`
|
|
256
256
|
background: var(--white);
|
|
257
257
|
border-left: 4px solid var(--brand-secondary-3);
|
|
258
258
|
border-radius: var(--rounded-base);
|
|
@@ -264,20 +264,20 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
264
264
|
right: var(--spacing-xl);
|
|
265
265
|
z-index: var(--z-10);
|
|
266
266
|
width: max-content;
|
|
267
|
-
`,
|
|
267
|
+
`,mt=K`
|
|
268
268
|
position: absolute;
|
|
269
269
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
270
|
-
`;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),[s,l]=Br(!1);Hr(()=>{function p(v){r.current&&!r.current.contains(v.target)&&i.current&&!i.current.contains(v.target)&&l(!1)}return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[i]);let f=p=>{p.stopPropagation(),l(!s)};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(Or.Fragment,null,e("button",{type:"button",ref:r,css:mt,"aria-controls":"path-details",onClick:p=>f(p),"aria-expanded":s},e(Y,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!s,ref:i,css:[ut,s?ft`
|
|
271
271
|
visibility: visible;
|
|
272
|
-
`:
|
|
272
|
+
`:ft`
|
|
273
273
|
visibility: hidden;
|
|
274
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([
|
|
274
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([p,v],c)=>e("div",{css:fe,key:c},e("span",{css:ve},p,":"),v)),Object.entries(t.popoverData).map(([p,v],c)=>e("div",{css:fe,key:c},e("span",{css:ve},p,":"),v)))):null)};import{Droppable as Nr,DragDropContext as _r,Draggable as Wr}from"react-beautiful-dnd";import{css as P}from"@emotion/react";var ht=P`
|
|
275
275
|
background: var(--white);
|
|
276
276
|
border: 1px solid var(--gray-300);
|
|
277
277
|
border-radius: var(--rounded-base);
|
|
278
278
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
279
279
|
margin-bottom: var(--spacing-base);
|
|
280
|
-
`,
|
|
280
|
+
`,yt=P`
|
|
281
281
|
align-items: center;
|
|
282
282
|
display: flex;
|
|
283
283
|
position: relative;
|
|
@@ -285,7 +285,7 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
285
285
|
width: 100%;
|
|
286
286
|
background-color: transparent;
|
|
287
287
|
border: 0;
|
|
288
|
-
`,
|
|
288
|
+
`,bt=P`
|
|
289
289
|
color: var(--brand-secondary-1);
|
|
290
290
|
display: block;
|
|
291
291
|
font-weight: var(--fw-bold);
|
|
@@ -301,114 +301,111 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
301
301
|
background: var(--gray-100);
|
|
302
302
|
outline: none;
|
|
303
303
|
}
|
|
304
|
-
`,
|
|
304
|
+
`,St=P`
|
|
305
305
|
background: var(--white);
|
|
306
306
|
border: 1px solid var(--gray-300);
|
|
307
307
|
border-radius: var(--rounded-base);
|
|
308
308
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
309
309
|
display: block;
|
|
310
|
-
`,
|
|
310
|
+
`,wt=P`
|
|
311
311
|
display: none;
|
|
312
|
-
`,
|
|
312
|
+
`,Ct=P`
|
|
313
313
|
overflow-y: auto;
|
|
314
|
-
|
|
314
|
+
height: 16rem;
|
|
315
315
|
margin-bottom: var(--spacing-base);
|
|
316
|
+
position: relative;
|
|
316
317
|
|
|
317
318
|
& > :not(:last-child) {
|
|
318
319
|
border-bottom: 1px solid var(--gray-200);
|
|
319
320
|
}
|
|
320
|
-
`,
|
|
321
|
+
`,ta=P`
|
|
321
322
|
background-color: var(--gray-50);
|
|
322
323
|
max-width: 33.33%;
|
|
323
|
-
`,
|
|
324
|
+
`,Pt=P`
|
|
324
325
|
align-items: center;
|
|
325
326
|
display: flex;
|
|
326
327
|
position: absolute;
|
|
327
328
|
inset: 0 0 0 auto;
|
|
328
329
|
pointer-events: none;
|
|
329
330
|
padding-right: var(--spacing-sm);
|
|
330
|
-
`,
|
|
331
|
+
`,Rt=P`
|
|
331
332
|
color: var(--brand-secondary-1);
|
|
332
333
|
width: 1.25rem;
|
|
333
334
|
height: 1.25rem;
|
|
334
335
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
335
336
|
transform: rotate(0);
|
|
336
|
-
`,
|
|
337
|
+
`,ra=P`
|
|
337
338
|
background: var(--white);
|
|
338
339
|
color: var(--brand-secondary-1);
|
|
339
|
-
`,Lt=
|
|
340
|
+
`,Lt=P`
|
|
340
341
|
position: relative;
|
|
341
342
|
margin-block: var(--spacing-sm) 0;
|
|
342
343
|
|
|
343
344
|
&:hover > span {
|
|
344
345
|
opacity: 0.3;
|
|
345
346
|
}
|
|
346
|
-
`,
|
|
347
|
+
`,kt=P`
|
|
347
348
|
align-items: center;
|
|
348
349
|
display: flex;
|
|
349
350
|
position: absolute;
|
|
350
351
|
inset: 0 auto 0 0;
|
|
351
352
|
margin-block: auto;
|
|
352
353
|
opacity: 0;
|
|
353
|
-
`,
|
|
354
|
+
`,he=P`
|
|
354
355
|
color: var(--brand-secondary-1);
|
|
355
|
-
`,
|
|
356
|
+
`,xt=P`
|
|
356
357
|
position: absolute;
|
|
357
358
|
left: 0.375rem;
|
|
358
|
-
`,
|
|
359
|
+
`,ye=P`
|
|
359
360
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
360
361
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
361
|
-
`;import{css as
|
|
362
|
+
`;import{css as T}from"@emotion/react";import{InputSelect as Zr,scrollbarStyles as Xr,Button as be,Callout as Yr,InputKeywordSearch as qr,LoadingIndicator as Jr,Menu as jr,MenuItem as eo,LoadingOverlay as to}from"@uniformdev/design-system";import{useState as $r,useEffect as Et,useRef as Fr}from"react";function Mt(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,i]=$r("IDLE"),s=Fr(void 0);return Et(()=>{t&&r==="IDLE"&&(clearTimeout(s.current),s.current=setTimeout(()=>{if(!t)return i("IDLE");s.current=setTimeout(()=>{i("EXPIRE")},o),i("DISPLAY")},n),i("DELAY")),!t&&r!=="DISPLAY"&&(clearTimeout(s.current),i("IDLE"))},[t,r,n,o]),Et(()=>()=>clearTimeout(s.current),[]),r==="DISPLAY"||r==="EXPIRE"}var ro=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&n!=="any"&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Yr,{type:"info"},o)},Vt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:i,select:s,multiSelect:l,multiSelectId:f,rowComponent:p,selectedItemComponent:v,totalResults:c,resultsLoading:g,requireContentType:S,onAddNew:N,onEditClosed:D,onCancel:b,noResultsComponent:h,helpComponent:_,onSort:G,typeSelectorLabel:O="Content Type Select",typeSelectorAllTypesOptionText:z="All content types"})=>{var Le,ke,xe;let W=()=>S?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[H,$]=E.useState(""),[y,u]=E.useState(W),[w,Z]=E.useState(!1),[a,C]=E.useState([]),[q,we]=E.useState(!1),ue=E.useRef(`x${Qr()}`),te=Kr(H,750);E.useEffect(()=>{t(te,{count:5,offset:0,contentType:y==="any"?void 0:y})},[te,y]);let Nt=Mt(g,{delay:1e3}),_t=d=>{a.some(m=>m.id===d.id)?C(m=>m.filter(A=>A.id!==d.id)):C(l?m=>[...m,d]:[d])},Wt=r==null?void 0:r.map(d=>d.id).join(",");E.useEffect(()=>{Array.isArray(r)&&C(r)},[Wt]);let Zt=()=>{u(W()),$(""),C(r!=null&&r.length?r:[])},Xt=()=>{Z(d=>!d),w||Zt()},Ce=d=>{let m=(a==null?void 0:a.filter(A=>A.id!==d.id))||[];C(m),s(m,"")},Yt=d=>{d.preventDefault(),s(a,y),Z(!1)},qt=d=>{d.preventDefault(),Z(!1),b&&b()},Jt=()=>{t(te,{count:5,offset:(n==null?void 0:n.length)||0,contentType:y==="any"?void 0:y}),we(!0);let d=setTimeout(()=>{we(!1)},750);return()=>clearTimeout(d)},jt=!(r==null?void 0:r.length)||l,er=p||vt,Pe=v||ct,tr=h||ro,Re=i&&typeof i!="string"?i:null,rr=Re?e(Re,{css:ye}):e("img",{src:i,alt:"Logo",css:ye}),or=d=>{var m,A;if(d.destination&&d.source.droppableId===((m=d.destination)==null?void 0:m.droppableId)){let k=[...r||[]],[J]=(A=k==null?void 0:k.splice(d.source.index,1))!=null?A:[];return k==null||k.splice(d.destination.index,0,J),G&&(C(k),G==null||G(k)),k}};return e("div",{css:T`
|
|
362
363
|
width: 100%;
|
|
363
|
-
`},e("div",{css:
|
|
364
|
+
`},e("div",{css:T`
|
|
364
365
|
position: relative;
|
|
365
366
|
margin-block: var(--spacing-base);
|
|
366
|
-
`},
|
|
367
|
+
`},jt?e(E.Fragment,null,e("div",{css:ht,"data-test-id":"component-search"},e("button",{css:yt,onClick:Xt,type:"button","aria-haspopup":!0,"aria-expanded":w,"aria-controls":`entry-search-config-${ue.current}`},rr,e("span",{css:T`
|
|
367
368
|
margin-left: var(--spacing-base);
|
|
368
|
-
`},"Select"),e("span",{css:
|
|
369
|
+
`},"Select"),e("span",{css:Pt},e(ce,{css:[Rt,w?T`
|
|
369
370
|
transform: rotate(180deg);
|
|
370
|
-
`:void 0]})))),e("div",{id:`entry-search-config-${
|
|
371
|
+
`:void 0]})))),e("div",{id:`entry-search-config-${ue.current}`,"aria-hidden":!w,css:[St,w?void 0:wt]},_||null,e("div",{css:T`
|
|
371
372
|
display: flex;
|
|
372
373
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
373
374
|
margin-bottom: var(--spacing-base);
|
|
374
|
-
`},e(
|
|
375
|
+
`},e(Zr,{onChange:d=>u(d.target.value),value:y,label:O,showLabel:!1,options:[...S?[]:[{value:"any",label:z}],...o?o.map(d=>({value:d.id,label:d.name})):[]]}),e("div",{css:T`
|
|
375
376
|
flex-grow: 1;
|
|
376
|
-
`},e(
|
|
377
|
-
padding: var(--spacing-base);
|
|
378
|
-
text-align: center;
|
|
379
|
-
width: 100%;
|
|
380
|
-
`},e(Et,null)):null),e("div",{css:I`
|
|
377
|
+
`},e(qr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:$,disabledFieldSubmission:!0,value:H}))),e("div",{css:[Ct,Xr],id:ue.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},e(to,{isActive:Nt}),Array.isArray(n)&&n.length>0?n.map(d=>e(er,{key:d.id,isSelected:a.some(m=>m.id===d.id),result:d,triggerSelection:()=>_t(d)})):e(tr,{searchText:te||H,selectedContentType:(ke=(Le=o==null?void 0:o.find(d=>d.id===y))==null?void 0:Le.name)!=null?ke:y}),!g&&typeof c!="undefined"&&n&&(n==null?void 0:n.length)<c&&e("button",{type:"button",css:bt,onClick:Jt},q?e(Jr,null):"Load More")),e("div",{css:T`
|
|
381
378
|
display: flex;
|
|
382
379
|
justify-content: space-between;
|
|
383
|
-
`},e("div",null,N&&((
|
|
380
|
+
`},e("div",null,N&&((xe=o==null?void 0:o.length)!=null?xe:0)>0?e(jr,{menuLabel:"Add new menu",menuTrigger:e(be,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(d=>e(eo,{key:d.id,css:T`
|
|
384
381
|
background: var(--white);
|
|
385
382
|
color: var(--brand-secondary-1);
|
|
386
|
-
`,onClick:()=>N(
|
|
383
|
+
`,onClick:()=>N(d)},d.name))):null),e("div",{css:T`
|
|
387
384
|
display: flex;
|
|
388
385
|
gap: var(--spacing-base);
|
|
389
|
-
`},e(
|
|
390
|
-
|
|
391
|
-
|
|
386
|
+
`},e(be,{buttonType:"unimportant",onClick:qt},"Cancel"),e(be,{disabled:!a.length,onClick:Yt,"data-test-id":"entry-accept-button"},"Accept"))))):null,w?null:l?e(_r,{onDragEnd:d=>or(d)},e(Nr,{droppableId:f||"canvas-multi-select"},d=>e("div",{...d.droppableProps,ref:d.innerRef,css:T`
|
|
387
|
+
margin-block: var(--spacing-sm) 0;
|
|
388
|
+
`},a==null?void 0:a.map((m,A)=>{if(m!=null&&m.id)return e(Wr,{key:m.id,draggableId:m.id,index:A},k=>e("div",{css:Lt,ref:k.innerRef,...k.draggableProps,...k.dragHandleProps},e("span",{css:kt},e(ee,{css:[he,xt],width:24,height:24}),e(ee,{css:he,width:24,height:24})),e(Pe,{key:`selected-item-${m.id}`,logoIcon:i,selectedItem:m,onDeselect:J=>Ce(J),onEditClosed:D?J=>D(J):void 0})))}),d.placeholder))):a==null?void 0:a.map(d=>e(Pe,{key:`selected-item-${d.id}`,logoIcon:i,selectedItem:d,onDeselect:m=>Ce(m),onEditClosed:D?m=>D(m):void 0}))))};import{css as Q}from"@emotion/react";var Tt=Q`
|
|
392
389
|
cursor: pointer;
|
|
393
390
|
padding: var(--spacing-sm) 0;
|
|
394
391
|
margin-right: var(--spacing-sm);
|
|
395
392
|
position: relative;
|
|
396
393
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
397
394
|
color var(--duration-fast) var(--timing-ease-out);
|
|
398
|
-
`,
|
|
395
|
+
`,It=Q`
|
|
399
396
|
border: 2px solid transparent;
|
|
400
397
|
border-radius: var(--rounded-base);
|
|
401
398
|
display: flex;
|
|
402
399
|
align-items: center;
|
|
403
400
|
gap: var(--spacing-base);
|
|
404
401
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
405
|
-
`,
|
|
402
|
+
`,Dt=Q`
|
|
406
403
|
background-color: var(--green-50);
|
|
407
|
-
`,
|
|
404
|
+
`,Gt=Q`
|
|
408
405
|
font-size: var(--fs-sm);
|
|
409
406
|
font-weight: var(--fw-bold);
|
|
410
407
|
width: 50%;
|
|
411
|
-
`,
|
|
408
|
+
`,zt=Q`
|
|
412
409
|
font-weight: var(--fw-normal);
|
|
413
410
|
display: block;
|
|
414
411
|
`,At=Q`
|
|
@@ -416,74 +413,74 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
416
413
|
> * {
|
|
417
414
|
display: block;
|
|
418
415
|
}
|
|
419
|
-
`,
|
|
416
|
+
`,Ut=Q`
|
|
420
417
|
display: block;
|
|
421
418
|
height: 1.5rem;
|
|
422
419
|
width: 1.5rem;
|
|
423
420
|
color: var(--brand-secondary-3);
|
|
424
421
|
margin-left: auto;
|
|
425
|
-
`;import{css as Ot}from"@emotion/react";function
|
|
422
|
+
`;import{css as Ot}from"@emotion/react";function Bt({result:t,isSelected:n,triggerSelection:o}){var f;let{categories:r,logoIcon:i}=le(),[s]=t.categories||[{id:"",name:""}],l=typeof s=="undefined"||!r||(f=r.find(p=>p.id===s.id))==null?void 0:f.name;return e("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Tt]},e("div",{css:[It,n?Dt:void 0]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Ot`
|
|
426
423
|
background-color: var(--gray-200);
|
|
427
424
|
width: 3rem;
|
|
428
425
|
height: 3rem;
|
|
429
426
|
object-fit: cover;
|
|
430
|
-
`}):e(
|
|
427
|
+
`}):e(U,{src:i,alt:"Logo",css:Ot`
|
|
431
428
|
height: 2.25rem;
|
|
432
429
|
width: 2.25rem;
|
|
433
|
-
`}),e("h4",{css:[
|
|
430
|
+
`}),e("h4",{css:[Gt]},t.title,l?e("span",{css:[zt]},l):null),e("p",{css:[At]},"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 oo}from"@uniformdev/design-system";var Ht=pe`
|
|
434
431
|
display: flex;
|
|
435
432
|
width: 100%;
|
|
436
433
|
border: 1px solid var(--gray-300);
|
|
437
434
|
border-radius: var(--rounded-base);
|
|
438
435
|
background-color: var(--gray-100);
|
|
439
436
|
margin: var(--spacing-base) 0;
|
|
440
|
-
`,$t=
|
|
437
|
+
`,$t=pe`
|
|
441
438
|
padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
|
|
442
439
|
display: flex;
|
|
443
440
|
flex-grow: 1;
|
|
444
441
|
align-items: center;
|
|
445
442
|
margin-right: var(--spacing-sm);
|
|
446
443
|
gap: var(--spacing-base);
|
|
447
|
-
`,
|
|
444
|
+
`,Ft=pe`
|
|
448
445
|
display: flex;
|
|
449
446
|
align-items: center;
|
|
450
447
|
gap: var(--spacing-sm);
|
|
451
|
-
${
|
|
448
|
+
${oo("lg")} {
|
|
452
449
|
width: 50%;
|
|
453
450
|
margin-bottom: 0;
|
|
454
451
|
}
|
|
455
|
-
`,
|
|
452
|
+
`,Se=pe`
|
|
456
453
|
background-color: var(--gray-200);
|
|
457
454
|
width: 3.5rem;
|
|
458
455
|
height: 3.5rem;
|
|
459
456
|
object-fit: cover;
|
|
460
|
-
`;import{css as
|
|
457
|
+
`;import{css as M}from"@emotion/react";import{mq as no}from"@uniformdev/design-system";function Kt({selectedItem:t,onDeselect:n}){var l;let{categories:o,logoIcon:r}=le(),[i]=t.categories||[{id:"",name:""}],s=typeof i=="undefined"||!o||(l=o.find(f=>f.id===i.id))==null?void 0:l.name;return e("div",{css:[Ht],key:t.id},e("article",{css:[$t]},e("div",{css:[Ft]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:s,css:[Se],loading:"lazy"}):e("div",{css:[Se]}),e("div",{css:M`
|
|
461
458
|
> :not(:last-child) {
|
|
462
459
|
margin-bottom: var(--spacing-xs);
|
|
463
460
|
}
|
|
464
|
-
`},e("h4",{css:
|
|
461
|
+
`},e("h4",{css:M`
|
|
465
462
|
font-weight: var(--fw-bold);
|
|
466
|
-
`},t.title||t.id||"",
|
|
463
|
+
`},t.title||t.id||"",s&&e("span",{css:M`
|
|
467
464
|
display: block;
|
|
468
465
|
font-weight: var(--fw-regular);
|
|
469
|
-
`},
|
|
466
|
+
`},s)),e("ul",{css:M`
|
|
470
467
|
font-size: var(--fs-sm);
|
|
471
468
|
display: flex;
|
|
472
469
|
gap: var(--spacing-base);
|
|
473
|
-
`},e("li",null,e("span",{css:
|
|
470
|
+
`},e("li",null,e("span",{css:M`
|
|
474
471
|
margin-right: var(--spacing-xs);
|
|
475
|
-
`},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:
|
|
472
|
+
`},"SKU:"),t.sku||t.id),t.price!==void 0?e("li",null,e("span",{css:M`
|
|
476
473
|
margin-right: var(--spacing-xs);
|
|
477
|
-
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:
|
|
474
|
+
`},"Price:"),e("span",null,t.price)):null))),e("div",{css:M`
|
|
478
475
|
display: flex;
|
|
479
476
|
flex-wrap: wrap;
|
|
480
477
|
gap: var(--spacing-sm);
|
|
481
478
|
justify-content: flex-end;
|
|
482
479
|
margin-left: auto;
|
|
483
|
-
${
|
|
480
|
+
${no("md")} {
|
|
484
481
|
align-items: center;
|
|
485
482
|
}
|
|
486
|
-
`},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:
|
|
483
|
+
`},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:M`
|
|
487
484
|
display: inline-flex;
|
|
488
485
|
justify-content: space-between;
|
|
489
486
|
align-items: center;
|
|
@@ -494,14 +491,14 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
494
491
|
&:hover {
|
|
495
492
|
background-color: var(--gray-100);
|
|
496
493
|
}
|
|
497
|
-
`},e("span",{css:
|
|
494
|
+
`},e("span",{css:M`
|
|
498
495
|
margin-right: var(--spacing-sm);
|
|
499
496
|
font-size: var(--fs-sm);
|
|
500
|
-
`},"Edit"),e(
|
|
497
|
+
`},"Edit"),e(U,{src:r,alt:"Logo",css:M`
|
|
501
498
|
width: 1.75rem;
|
|
502
499
|
height: 1.75rem;
|
|
503
500
|
display: block;
|
|
504
|
-
`})):null,e("button",{type:"button",onClick:
|
|
501
|
+
`})):null,e("button",{type:"button",onClick:()=>{n==null||n(t)},css:M`
|
|
505
502
|
display: flex;
|
|
506
503
|
justify-content: space-between;
|
|
507
504
|
align-items: center;
|
|
@@ -514,8 +511,8 @@ var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enum
|
|
|
514
511
|
&:hover {
|
|
515
512
|
background-color: var(--gray-100);
|
|
516
513
|
}
|
|
517
|
-
`},e("span",{css:
|
|
514
|
+
`},e("span",{css:M`
|
|
518
515
|
font-size: var(--fs-sm);
|
|
519
|
-
`},"Unlink"),e(
|
|
516
|
+
`},"Unlink"),e(X,{css:M`
|
|
520
517
|
color: var(--brand-secondary-5);
|
|
521
|
-
`})))))}import{Callout as
|
|
518
|
+
`})))))}import{Callout as lo}from"@uniformdev/design-system";import{useAsync as po,useAsyncFn as uo}from"react-use";function Wa({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:i,multiSelect:s,multiSelectId:l,selectedItemComponent:f,rowComponent:p,errorComponent:v,helpComponent:c,noResultsComponent:g,onSort:S,typeSelectorAllTypesOptionText:N="All categories",typeSelectorLabel:D="Select Category"}){var $;let{value:b,loading:h,error:_}=po(async()=>await o(),[o]),G=b==null?void 0:b.map(y=>y.id).join(","),O=so(()=>b?b.map(u=>({id:u.id,name:u.name})):void 0,[G]),z=co(),[B,W]=uo(async(y,u)=>{let w=await r({text:y,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType}});return(u==null?void 0:u.offset)===0&&(z.current=[]),(z.current=z.current||[]).push(...w.products),w},[r]),H=async y=>{await n(y)};return _||B.error?e(v||(({categoriesError:u,searchError:w})=>e(lo,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(w==null?void 0:w.message))),{categoriesError:_,searchError:B.error}):e(Qt.Provider,{value:{categories:b,logoIcon:i}},e(Vt,{search:W,results:z.current,logoIcon:i,selectedItems:t,select:H,multiSelectId:l||"product-search-multi-select",multiSelect:s,contentTypes:O,selectedItemComponent:f||Kt,rowComponent:p||Bt,totalResults:($=B.value)==null?void 0:$.total,resultsLoading:B.loading||h,helpComponent:c,noResultsComponent:g,onSort:S,typeSelectorAllTypesOptionText:N,typeSelectorLabel:D}))}var Qt=ao.createContext(void 0),le=()=>{let t=io(Qt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as ri,Callout as oi,LoadingIndicator as ni,LoadingOverlay as ai,Menu as ii,MenuItem as si,Input as ci,InputSelect as di,InputToggle as li,Theme as pi,InputKeywordSearch as ui,Heading as mi,ScrollableList as gi,ScrollableListItem as fi,Textarea as vi,Switch as hi,Label as yi}from"@uniformdev/design-system";export{ri as Button,oi as Callout,vt as DefaultSearchRow,ct as DefaultSelectedItem,Vt as EntrySearch,mi as Heading,me as Icons,ci as Input,di as InputSelect,li as InputToggle,ui as KeywordSearchInput,yi as Label,ni as LoadingIndicator,ai as LoadingOverlay,ii as Menu,si as MenuItem,Ke as ProductPreviewList,tn as ProductQuery,$e as ProductQueryContext,Wa as ProductSearch,Qt as ProductSearchContext,Bt as ProductSearchRow,Kt as ProductSelectedItem,ze as ResolvableLoadingValue,gi as ScrollableList,fi as ScrollableListItem,Ae as SelectionField,hi as Switch,vi as Textarea,pi as Theme,Ee as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,Io as UniformMeshSdkContextProvider,ye as badgeIcon,Lt as draggableContainer,he as draggableIcon,xt as draggableIconOffset,kt as draggableIconWrapper,yt as entrySearchBtn,St as entrySearchConfig,wt as entrySearchConfigHidden,bt as entrySearchLoadMoreBtn,Ct as entrySearchResultList,Pt as entrySearchSelectIcon,Rt as entrySearchSelectImg,ta as entrySearchSelectInput,ra as entrySearchSelectOption,ht as entrySearchWrapper,Ut as productSearchRowActiveIcon,zt as productSearchRowCategory,Tt as productSearchRowContainer,It as productSearchRowContent,Dt as productSearchRowContentActive,At as productSearchRowDetails,Gt as productSearchRowTitle,Ht as productSelectedItemContainer,Ft as productSelectedItemContent,$t 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,F as selectItemSmallText,nt as selectedItemCloseIcon,Je as selectedItemContainer,tt as selectedItemCopy,et as selectedItemDetails,ot as selectedItemIcon,je as selectedItemInner,rt as selectedItemTitle,ko as useInitializeUniformMeshSdk,Fe as useProductQueryContext,le as useProductSearchContext,wo as useUniformMeshLocation,Ve as useUniformMeshLocationContext,zo as useUniformMeshSdk,De as useUniformMeshSdkContext};
|