@uniformdev/mesh-sdk-react 17.4.1-alpha.1 → 17.4.1-alpha.250
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 +130 -1
- package/dist/index.esm.js +674 -136
- package/dist/index.js +674 -136
- package/dist/index.mjs +674 -136
- package/package.json +15 -10
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ca=Object.defineProperty;var Ra=(e,r)=>{for(var a in r)Ca(e,a,{get:r[a],enumerable:!0})};import{jsx as l}from"@emotion/react";import*as b from"react";import{createContext as _a,useContext as Ia,useEffect as Va,useState as Ea}from"react";import{createContext as Pa,useContext as ka}from"react";import{Theme as Ta}from"@uniformdev/design-system";import{jsx as Lt,jsxs as La}from"@emotion/react/jsx-runtime";var Ie=Pa(void 0),Oi=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),La(Ie.Provider,{value:r,children:[Lt(Ta,{}),Lt(Ve,{children:e})]})},_t=()=>{let e=ka(Ie);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function It(){let{sdk:e}=_t();return e}import{jsx as Da}from"@emotion/react/jsx-runtime";var Vt=_a(void 0),Ve=({children:e})=>{let r=It(),[a,o]=Ea(r.getCurrentLocation()),t=n=>{o(i=>({...i,value:n.newValue}))};return Va(()=>(r.events.on("onValueChanged",t),()=>{r.events.off("onValueChanged",t)}),[r]),Da(Vt.Provider,{value:{location:a},children:e})},Ee=()=>{let e=Ia(Vt);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function ts(){let{location:e}=Ee();return e}import{initializeUniformMeshSDK as Ma}from"@uniformdev/mesh-sdk";import{useEffect as Ua,useRef as za,useState as Et}from"react";var Dt=({autoResizingDisabled:e}={})=>{let[r,a]=Et(),[o,t]=Et(),n=za(!1);return Ua(()=>{typeof window=="undefined"||o||(typeof window.UniformMeshSDK=="undefined"&&!n.current?(n.current=!0,Ma({autoResizingDisabled:e}).then(i=>{t(i)}).catch(i=>{a(i)}).finally(()=>{n.current=!1})):t(window.UniformMeshSDK))},[e]),{initializing:!o&&!r,error:r,sdk:o}};function cs(e){let{location:r}=Ee();if(e&&r.type!==e)throw new Error(`Expected location type ${e} but got ${r.type}`);return r}import $a,{useMemo as Ue,useContext as Fa}from"react";import{css as Ba}from"@emotion/react";import{Icon as Aa,InputSelect as Ha}from"@uniformdev/design-system";import{CgClose as Ga}from"react-icons/cg";import{Fragment as Mt,jsxs as Ut}from"@emotion/react/jsx-runtime";var zt=({value:e,text:r,loading:a})=>Ut(Mt,{children:[!!r&&r,!r&&Ut(Mt,{children:[a&&`${e} (Loading...)`,!a&&`${e} (Unresolvable)`]})]});import{css as Ye}from"@emotion/react";var Bt=Ye`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -7,66 +7,66 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
margin-bottom: var(--spacing-sm);
|
|
9
9
|
margin-right: var(--spacing-sm);
|
|
10
|
-
`,
|
|
10
|
+
`,At=Ye`
|
|
11
11
|
color: var(--gray-800);
|
|
12
12
|
padding: var(--spacing-3);
|
|
13
|
-
`,
|
|
13
|
+
`,Ht=Ye`
|
|
14
14
|
border: none;
|
|
15
15
|
border-left: 1px solid var(--gray-300);
|
|
16
16
|
background: var(--gray-100);
|
|
17
17
|
padding: var(--spacing-3);
|
|
18
|
-
`;import{jsx as
|
|
18
|
+
`;import{jsx as Re,jsxs as Gt}from"@emotion/react/jsx-runtime";var Ot=({id:e,label:r,loading:a,selectedValues:o,values:t,onAdd:n,onRemove:i})=>{var f;let g=(f=t==null?void 0:t.filter(s=>!(o!=null&&o.includes(s.id.toString()))))!=null?f:[],d=(s,m)=>{s.preventDefault(),i(m)};return Gt("div",{children:[Re(Ha,{id:e,name:e,label:r,onChange:s=>n(s.target.value),disabled:a,options:[{value:"",label:"Add..."},...g.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(o)&&o.length>0?Ba`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),
|
|
20
|
+
`:""}),o==null?void 0:o.map(s=>{var m;return Gt("div",{css:Bt,children:[Re("span",{css:At,children:Re(zt,{value:s,loading:a,text:(m=t.find(c=>c.id===s))==null?void 0:m.name})}),Re("button",{css:Ht,title:"remove",onClick:c=>d(c,s),children:Re(Aa,{icon:Ga,iconColor:"currentColor",size:20})})]},s)})]})};import{jsx as qt}from"@emotion/react/jsx-runtime";var Oa=e=>qt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:qt("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"})}),De=Oa;import{jsx as $t}from"@emotion/react/jsx-runtime";var qa=e=>$t("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:$t("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Me=qa;import{useAsyncFn as Na,useDebounce as Wa}from"react-use";import{Input as Ft,InputSelect as ze,mq as Be}from"@uniformdev/design-system";import{css as T}from"@emotion/react";import{jsx as C,jsxs as ge}from"@emotion/react/jsx-runtime";var Nt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},$s=({value:e,setValue:r,brands:a,categories:o,loading:t,categoriesLoading:n,brandsLoading:i,logoIcon:g,onGetProducts:d,sortOptions:f,sortOrderOptions:s,categoryLabel:m="Product Category",brandLabel:c="Brand",disableBrands:y,restrictToSingleCategory:P=!1})=>{var D,v,B;let w=async p=>{r({...Nt,...e||{},...p})},S=Ue(()=>({...Nt,...e||{}}),[e]),[ue,Se]=Na(async p=>await d(p),[d]);Wa(async()=>{await Se({brand:S.brand,categories:S.categories,keyword:S.keyword,sort:S.sort,sortOrder:S.sortOrder,count:S.count})},250,[S]);let q=Ue(()=>{let p=[];return o==null||o.forEach(A=>{let R=Kt(A,void 0);p.push(...R)}),p},[o]),ee=Ue(()=>[{value:"",label:"All categories"},...q.map(p=>({label:p.name,value:p.id}))],[q]),Z=Ue(()=>(a==null?void 0:a.map(p=>({id:p.id.toString(),name:p.name})))||[],[a]),Ce=p=>{if(!p)return;let A=(e==null?void 0:e.categories)||[];w({categories:[...A,p]})},_e=p=>{var A;w({categories:(A=e==null?void 0:e.categories)==null?void 0:A.filter(R=>R!==p)})},ie=p=>{w({brand:p.target.value})},E=p=>{w({count:p||1})};return t?C("div",{children:"Loading..."}):C(Qt.Provider,{value:{categories:o,logoIcon:g},children:ge("div",{css:T`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
24
|
-
`,children:[
|
|
24
|
+
`,children:[P?C(ze,{id:"selection-field-product-category",label:m,disabled:t,value:(v=(D=S.categories)==null?void 0:D[0])!=null?v:"",options:ee,onChange:p=>{w({categories:p.target.value===""?[]:[p.target.value]})}}):C(Ot,{loading:n||!1,id:"selection-field-product-category",label:m,onAdd:Ce,onRemove:_e,selectedValues:S.categories,values:q}),ge("div",{css:T`
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-wrap: wrap;
|
|
27
27
|
column-gap: var(--spacing-lg);
|
|
28
28
|
row-gap: var(--spacing-md);
|
|
29
|
-
${
|
|
29
|
+
${Be("md")} {
|
|
30
30
|
flex-wrap: nowrap;
|
|
31
31
|
}
|
|
32
|
-
`,children:[
|
|
32
|
+
`,children:[y?null:C("div",{css:T`
|
|
33
33
|
width: 50%;
|
|
34
|
-
`,children:
|
|
34
|
+
`,children:C(ze,{id:"brand",name:"brand",label:c,disabled:i,value:S.brand,onChange:ie,options:[{value:"",label:"Choose..."},...Z.map(p=>({value:p.id,label:p.name}))]})}),C("div",{css:T`
|
|
35
35
|
flex-grow: 1;
|
|
36
36
|
position: relative;
|
|
37
|
-
`,children:
|
|
37
|
+
`,children:C(Ft,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:S.keyword,placeholder:"Enter keyword",onChange:p=>w({keyword:p.target.value})})})]}),ge("div",{css:T`
|
|
38
38
|
display: flex;
|
|
39
39
|
flex-wrap: wrap;
|
|
40
40
|
column-gap: var(--spacing-lg);
|
|
41
41
|
row-gap: var(--spacing-md);
|
|
42
|
-
${
|
|
42
|
+
${Be("md")} {
|
|
43
43
|
flex-wrap: nowrap;
|
|
44
44
|
}
|
|
45
|
-
`,children:[
|
|
45
|
+
`,children:[ge("div",{css:T`
|
|
46
46
|
width: 100%;
|
|
47
|
-
${
|
|
47
|
+
${Be("md")} {
|
|
48
48
|
width: 33.333333%;
|
|
49
49
|
}
|
|
50
50
|
position: relative;
|
|
51
|
-
`,children:[
|
|
51
|
+
`,children:[C(Ft,{id:"count",name:"count",type:"number",min:1,step:1,value:S.count,onChange:p=>E(p.target.valueAsNumber),label:"Count"}),ge("div",{css:T`
|
|
52
52
|
position: absolute;
|
|
53
53
|
bottom: var(--spacing-sm);
|
|
54
54
|
right: var(--spacing-sm);
|
|
55
55
|
display: flex;
|
|
56
56
|
gap: var(--spacing-sm);
|
|
57
|
-
`,children:[
|
|
57
|
+
`,children:[C(Wt,{onCountChange:()=>E(S.count-1),countIcon:"decrement",disabled:S.count===1}),C(Wt,{onCountChange:()=>E(S.count+1),countIcon:"increment"})]})]}),Array.isArray(f)&&f.length>0?C("div",{css:T`
|
|
58
58
|
flex-grow: 1;
|
|
59
|
-
${
|
|
59
|
+
${Be("md")} {
|
|
60
60
|
width: 33.333333%;
|
|
61
61
|
}
|
|
62
|
-
`,children:
|
|
62
|
+
`,children:C(ze,{id:"sort",name:"sort",label:"Sort",value:S.sort,onChange:p=>w({sort:p.target.value}),options:[{value:"",label:"Select a sort"},...f.map(p=>({value:p.sortKey,label:p.name}))]})}):null,Array.isArray(s)&&s.length>0?C("div",{css:T`
|
|
63
63
|
flex-grow: 1;
|
|
64
|
-
`,children:
|
|
64
|
+
`,children:C(ze,{id:"sort-order",name:"sort-order",label:"Sort Order",value:S.sortOrder,onChange:p=>w({sortOrder:p.target.value}),options:s.map(p=>({value:p.sortOrderKey,label:p.name}))})}):null]}),ge("div",{children:[C("h3",{css:T`
|
|
65
65
|
font-size: var(--fs-md);
|
|
66
66
|
line-height: var(--spacing-md);
|
|
67
67
|
font-weight: var(--fw-bold);
|
|
68
68
|
margin-bottom: var(--spacing-xs);
|
|
69
|
-
`,children:"Result Preview"}),
|
|
69
|
+
`,children:"Result Preview"}),C(Zt,{products:(B=ue.value)==null?void 0:B.products})]})]})})};function Kt(e,r){var n;let a=[],o=r?`${r.name} > `:"",t={id:e.id.toString(),name:`${o}${e.name}`};return a.push(t),(n=e.children)==null||n.forEach(i=>{let g=Kt(i,t);a.push(...g)}),a}function Wt({onCountChange:e,countIcon:r,disabled:a}){return C("button",{css:T`
|
|
70
70
|
width: 2.25rem;
|
|
71
71
|
height: 2.25rem;
|
|
72
72
|
border: 1px solid var(--gray-300);
|
|
@@ -78,17 +78,17 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
78
78
|
&:hover {
|
|
79
79
|
background-color: var(--gray-200);
|
|
80
80
|
}
|
|
81
|
-
${
|
|
81
|
+
${a?T`
|
|
82
82
|
cursor: not-allowed;
|
|
83
83
|
opacity: 0.3;
|
|
84
84
|
`:""}
|
|
85
|
-
`,onClick:e,disabled:
|
|
85
|
+
`,onClick:e,disabled:a,children:r==="increment"?C(De,{css:T`
|
|
86
86
|
width: 1rem;
|
|
87
87
|
height: 1rem;
|
|
88
|
-
`}):
|
|
88
|
+
`}):C(Me,{css:T`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`})})}var
|
|
91
|
+
`})})}var Qt=$a.createContext(void 0),Yt=()=>{let e=Fa(Qt);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};import{jsx as Xt}from"@emotion/react/jsx-runtime";function $({src:e,alt:r,className:a}){let o=e&&typeof e!="string"?e:null;return o?Xt(o,{className:a}):Xt("img",{src:e,alt:r,className:a})}import{css as sr}from"@emotion/react";import{scrollbarStyles as Ka}from"@uniformdev/design-system";import{css as F}from"@emotion/react";var Jt=F`
|
|
92
92
|
align-items: center;
|
|
93
93
|
background: var(--white);
|
|
94
94
|
border-radius: var(--rounded-base);
|
|
@@ -103,55 +103,55 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
103
103
|
&:hover {
|
|
104
104
|
background: var(--gray-50);
|
|
105
105
|
}
|
|
106
|
-
`,
|
|
106
|
+
`,jt=F`
|
|
107
107
|
font-size: var(--fs-sm);
|
|
108
|
-
`,
|
|
108
|
+
`,er=F`
|
|
109
109
|
width: 1rem;
|
|
110
110
|
height: 1rem;
|
|
111
|
-
`,
|
|
111
|
+
`,Ze=F`
|
|
112
112
|
margin-right: var(--spacing-lg);
|
|
113
113
|
font-size: var(--fs-sm);
|
|
114
|
-
`,
|
|
114
|
+
`,tr=F`
|
|
115
115
|
border: 1px solid var(--gray-200);
|
|
116
116
|
border-radius: var(--rounded-md);
|
|
117
117
|
background: var(--gray-50);
|
|
118
118
|
margin: var(--spacing-base) 0;
|
|
119
|
-
`,
|
|
119
|
+
`,rr=F`
|
|
120
120
|
align-items: center;
|
|
121
121
|
display: flex;
|
|
122
122
|
flex-grow: 1;
|
|
123
123
|
gap: var(--spacing-base);
|
|
124
124
|
padding: var(--spacing-sm);
|
|
125
125
|
margin-right: var(--spacing-sm);
|
|
126
|
-
`,
|
|
126
|
+
`,or=F`
|
|
127
127
|
background: var(--gray-200);
|
|
128
128
|
width: 3.5rem;
|
|
129
129
|
height: 3.5rem;
|
|
130
130
|
object-fit: cover;
|
|
131
|
-
`,
|
|
131
|
+
`,ar=F`
|
|
132
132
|
background: var(--gray-100);
|
|
133
133
|
height: 3.5rem;
|
|
134
134
|
width: 3.5rem;
|
|
135
|
-
`,
|
|
135
|
+
`,nr=F`
|
|
136
136
|
margin-top: 0;
|
|
137
137
|
font-weight: var(--fw-bold);
|
|
138
138
|
font-size: var(--fs-sm);
|
|
139
139
|
width: calc(100% / 3);
|
|
140
|
-
`,
|
|
140
|
+
`,ir=F`
|
|
141
141
|
display: block;
|
|
142
142
|
font-weight: var(--fw-regular);
|
|
143
|
-
`;import{Fragment as
|
|
143
|
+
`;import{Fragment as lr,jsx as oe,jsxs as re}from"@emotion/react/jsx-runtime";var Zt=({products:e})=>{let{categories:r,logoIcon:a}=Yt();return re(lr,{children:[re("p",{css:sr`
|
|
144
144
|
margin-bottom: var(--spacing-base);
|
|
145
|
-
`,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),
|
|
145
|
+
`,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),oe("ul",{css:[sr`
|
|
146
146
|
max-height: 24rem;
|
|
147
147
|
overflow-x: auto;
|
|
148
|
-
`,
|
|
148
|
+
`,Ka],children:e==null?void 0:e.map((o,t)=>{var g,d;let[n]=(o==null?void 0:o.categories)||[],i=typeof n=="undefined"||!r||(g=r.find(f=>f.id===n.id))==null?void 0:g.name;return oe("li",{css:tr,children:re("div",{css:rr,"data-test-id":`product-item-${o.sku||o.id}`,children:[o.thumbnailUrl?oe("img",{src:o.thumbnailUrl,alt:typeof o.title=="string"?o.title:o.name||`Product ${t}`,css:or,"data-test-id":"product-image"}):oe("div",{css:ar}),re("h4",{css:nr,"data-test-id":"product-name",children:[o.title||o.name,i&&oe("span",{css:ir,children:i})]}),o&&re(lr,{children:[re("p",{css:Ze,"data-test-id":"product-sku",children:["SKU: ",o.sku||o.id,oe("br",{})]}),o.price!==void 0?re("p",{css:Ze,"data-test-id":"product-price",children:["Price: ",o.price]}):null,o.editLink||o.url?re("a",{css:Jt,href:(d=o.editLink)!=null?d:o.url,title:`Go to ${o.title||o.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[oe("span",{css:jt,children:"Edit"}),a?oe($,{src:a,alt:"Logo",css:er}):null]}):null]})]})},`product-${o.id}`)})})]})};import An,{useContext as Hn,useMemo as Gn,useRef as On}from"react";import*as K from"react";var Je={};Ra(Je,{Caution:()=>cr,Checkmark:()=>Ae,ChevronDown:()=>He,Close:()=>gr,Danger:()=>fr,ExclamationPoint:()=>hr,Info:()=>Ge,Lightbulb:()=>xr,MagnifyingGlass:()=>Sr,MaximizeAlt:()=>Rr,Minus:()=>Me,MoreVerticalAlt:()=>ke,Plus:()=>De});import{jsx as dr}from"@emotion/react/jsx-runtime";var Qa=e=>dr("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:dr("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"})}),cr=Qa;import{jsx as pr}from"@emotion/react/jsx-runtime";var Ya=e=>pr("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:pr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})}),Ae=Ya;import{jsx as ur}from"@emotion/react/jsx-runtime";var Za=e=>ur("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:ur("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"})}),He=Za;import{jsx as Xe,jsxs as Ja}from"@emotion/react/jsx-runtime";var Xa=e=>Xe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:Ja("g",{fillRule:"evenodd",children:[Xe("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"}),Xe("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"})]})}),gr=Xa;import{jsx as mr}from"@emotion/react/jsx-runtime";var ja=e=>mr("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:mr("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"})}),fr=ja;import{jsx as vr}from"@emotion/react/jsx-runtime";var en=e=>vr("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e,children:vr("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"})}),hr=en;import{jsx as yr,jsxs as rn}from"@emotion/react/jsx-runtime";var tn=e=>rn("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:[yr("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"}),yr("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"})]}),Ge=tn;import{jsx as br}from"@emotion/react/jsx-runtime";var on=e=>br("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:br("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"})}),xr=on;import{jsx as Pe,jsxs as wr}from"@emotion/react/jsx-runtime";var an=e=>wr("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[wr("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[Pe("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"}),Pe("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"})]}),Pe("defs",{children:Pe("clipPath",{id:"magnifying-glass_svg__a",children:Pe("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),Sr=an;import{jsx as Cr}from"@emotion/react/jsx-runtime";var nn=e=>Cr("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:Cr("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"})}),Rr=nn;import{jsx as Pr}from"@emotion/react/jsx-runtime";var sn=e=>Pr("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:Pr("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"})}),ke=sn;import{useDebounce as xn}from"react-use";import{v4 as wn}from"uuid";import{useState as dn,useRef as Mr,useEffect as cn}from"react";function Oe(e,r){let a=window.open(e,"_blank"),o=setInterval(()=>{a!=null&&a.closed&&(clearInterval(o),r())},500)}import{format as pn}from"timeago.js";import{css as H}from"@emotion/react";import{mq as ln}from"@uniformdev/design-system";var kr=H`
|
|
149
149
|
border: 1px solid var(--gray-200);
|
|
150
150
|
background: var(--gray-50);
|
|
151
151
|
border-radius: var(--rounded-base);
|
|
152
152
|
display: flex;
|
|
153
153
|
width: 100%;
|
|
154
|
-
`,
|
|
154
|
+
`,Tr=H`
|
|
155
155
|
align-items: center;
|
|
156
156
|
display: flex;
|
|
157
157
|
flex-grow: 1;
|
|
@@ -159,22 +159,22 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
159
159
|
margin-inline: 0 var(--spacing-sm);
|
|
160
160
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
161
161
|
position: relative;
|
|
162
|
-
`,
|
|
162
|
+
`,Lr=H`
|
|
163
163
|
flex-grow: 1;
|
|
164
|
-
`,
|
|
164
|
+
`,_r=H`
|
|
165
165
|
align-items: start;
|
|
166
166
|
display: inline-flex;
|
|
167
167
|
position: relative;
|
|
168
|
-
`,
|
|
168
|
+
`,Ir=H`
|
|
169
169
|
color: var(--brand-secondary-1);
|
|
170
170
|
font-size: var(--fs-base);
|
|
171
171
|
font-weight: var(--fw-bold);
|
|
172
172
|
line-height: 1;
|
|
173
173
|
margin: 0;
|
|
174
|
-
`,
|
|
174
|
+
`,Vr=H`
|
|
175
175
|
width: 1.5rem;
|
|
176
176
|
height: 1.5rem;
|
|
177
|
-
`,
|
|
177
|
+
`,Er=H`
|
|
178
178
|
background: var(--white);
|
|
179
179
|
border-radius: var(--rounded-base);
|
|
180
180
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -183,22 +183,22 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
183
183
|
padding: var(--spacing-base);
|
|
184
184
|
z-index: var(--z-10);
|
|
185
185
|
width: max-content;
|
|
186
|
-
`,
|
|
186
|
+
`,le=H`
|
|
187
187
|
font-size: var(--fs-sm);
|
|
188
|
-
`,
|
|
188
|
+
`,Te=H`
|
|
189
189
|
font-weight: var(--fw-bold);
|
|
190
190
|
margin-right: var(--spacing-sm);
|
|
191
|
-
`,
|
|
191
|
+
`,Dr=H`
|
|
192
192
|
display: flex;
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
gap: var(--spacing-sm);
|
|
195
195
|
|
|
196
|
-
${
|
|
196
|
+
${ln("md")} {
|
|
197
197
|
flex-direction: row;
|
|
198
198
|
min-width: 200px;
|
|
199
199
|
justify-content: end;
|
|
200
200
|
}
|
|
201
|
-
`,
|
|
201
|
+
`,je=H`
|
|
202
202
|
align-items: center;
|
|
203
203
|
background: var(--white);
|
|
204
204
|
border-radius: var(--rounded-base);
|
|
@@ -213,39 +213,39 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
213
213
|
&:hover {
|
|
214
214
|
background: var(--gray-50);
|
|
215
215
|
}
|
|
216
|
-
`;import{css as
|
|
216
|
+
`;import{css as ae}from"@emotion/react";import{Icon as Ur}from"@uniformdev/design-system";import{CgClose as un,CgInfo as gn}from"react-icons/cg";import{Fragment as mn,jsx as N,jsxs as L}from"@emotion/react/jsx-runtime";var zr=({selectedItem:e,logoIcon:r,onDeselect:a,onEditClosed:o})=>{var f;let t=Mr(null),n=Mr(null),[i,g]=dn(!1);cn(()=>{let s=c=>{t.current&&!t.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&g(!1)},m=()=>{g(!1)};return window.addEventListener("resize",m,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",m,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[n]);let d=()=>{var s;if(g(!i),n.current&&t.current){let m=(s=t==null?void 0:t.current)==null?void 0:s.getBoundingClientRect(),c=n.current.offsetWidth;n.current.style.top=`${m.top+30}px`,n.current.style.left=`${m.left-c+30}px`}};return N("div",{css:kr,children:L("div",{css:Tr,children:[L("div",{css:Lr,children:[L("div",{css:_r,children:[N("h4",{css:[Ir,e.popoverData?ae`
|
|
217
217
|
margin-bottom: var(--spacing-sm);
|
|
218
|
-
`:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?
|
|
218
|
+
`:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?L(mn,{children:[N("button",{type:"button",ref:t,css:ae`
|
|
219
219
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
220
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
220
|
+
`,"aria-controls":"path-details","aria-expanded":i,onClick:d,children:N(Ur,{icon:gn,iconColor:"gray",size:24,css:ae`
|
|
221
221
|
opacity: var(--opacity-75);
|
|
222
|
-
`})}),
|
|
222
|
+
`})}),N("div",{id:"path-details","aria-hidden":!i,ref:n,css:[Er,i?ae`
|
|
223
223
|
visibility: visible;
|
|
224
|
-
`:
|
|
224
|
+
`:ae`
|
|
225
225
|
visibility: hidden;
|
|
226
|
-
`],children:Object.entries(e.popoverData).map(([
|
|
226
|
+
`],children:Object.entries(e.popoverData).map(([s,m],c)=>L("div",{css:le,children:[L("span",{css:Te,children:[s,":"]}),m]},c))})]}):null]}),e.createdDate&&L("div",{css:le,children:[N("span",{css:Te,children:"Created:"}),pn((f=e.createdDate)!=null?f:0)]}),e.metadata?Object.entries(e.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,m])=>L("div",{css:[le,ae`
|
|
227
227
|
order: 1;
|
|
228
|
-
`],children:[
|
|
228
|
+
`],children:[L("span",{css:Te,children:[s,":"]}),m]},s)):null,e.metadata?Object.entries(e.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,m])=>L("div",{css:[le,ae`
|
|
229
229
|
order: 1;
|
|
230
|
-
`],children:[
|
|
230
|
+
`],children:[L("span",{css:[Te,ae`
|
|
231
231
|
order: 1;
|
|
232
|
-
`],children:[
|
|
232
|
+
`],children:[s,":"]}),m]},s)):null]}),L("div",{css:Dr,children:[e.editLink?L("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{o&&(Oe(s.currentTarget.href,()=>o(e)),s.preventDefault())},css:je,children:[N("span",{css:le,children:"Edit"}),N($,{src:r,css:Vr,alt:"Logo"})]}):null,L("button",{type:"button",onClick:()=>{a(e)},css:je,children:[N("span",{css:le,children:"Unlink"}),N(Ur,{icon:un,iconColor:"red",size:16})]})]})]})},e.id)};import{useState as fn,useRef as qr,useEffect as vn}from"react";import{css as de}from"@emotion/react";var Br=de`
|
|
233
233
|
cursor: pointer;
|
|
234
234
|
padding: var(--spacing-sm);
|
|
235
235
|
position: relative;
|
|
236
236
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
237
237
|
color var(--duration-fast) var(--timing-ease-out);
|
|
238
|
-
`,
|
|
238
|
+
`,Ar=de`
|
|
239
239
|
padding-right: var(--spacing-lg);
|
|
240
|
-
`,
|
|
240
|
+
`,Hr=de`
|
|
241
241
|
background: var(--brand-secondary-3);
|
|
242
242
|
color: var(--white);
|
|
243
|
-
|
|
243
|
+
`,et=de`
|
|
244
244
|
font-size: var(--fs-xs);
|
|
245
|
-
`,
|
|
245
|
+
`,tt=de`
|
|
246
246
|
font-weight: var(--fw-bold);
|
|
247
247
|
margin-right: var(--spacing-sm);
|
|
248
|
-
`,
|
|
248
|
+
`,Gr=de`
|
|
249
249
|
background: var(--white);
|
|
250
250
|
border-left: 4px solid var(--brand-secondary-3);
|
|
251
251
|
border-radius: var(--rounded-base);
|
|
@@ -257,20 +257,20 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
257
257
|
right: var(--spacing-xl);
|
|
258
258
|
z-index: var(--z-10);
|
|
259
259
|
width: max-content;
|
|
260
|
-
`,
|
|
260
|
+
`,Or=de`
|
|
261
261
|
position: absolute;
|
|
262
262
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
263
|
-
`;import{css as
|
|
263
|
+
`;import{css as $r}from"@emotion/react";import{Fragment as hn,jsx as Fr,jsxs as ce}from"@emotion/react/jsx-runtime";var Nr=({result:e,isSelected:r,triggerSelection:a})=>{let o=qr(null),t=qr(null),[n,i]=fn(!1);vn(()=>{function d(f){o.current&&!o.current.contains(f.target)&&t.current&&!t.current.contains(f.target)&&i(!1)}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[t]);let g=d=>{d.stopPropagation(),i(!n)};return ce("div",{css:[Br,r?Hr:void 0,e.popoverData?Ar:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>a(),children:[e.title,e.popoverData&&r?ce(hn,{children:[Fr("button",{type:"button",ref:o,css:Or,"aria-controls":"path-details",onClick:d=>g(d),"aria-expanded":n,children:Fr(Ge,{width:24,height:24})}),ce("div",{id:"path-details","aria-hidden":!n,ref:t,css:[Gr,n?$r`
|
|
264
264
|
visibility: visible;
|
|
265
|
-
|
|
265
|
+
`:$r`
|
|
266
266
|
visibility: hidden;
|
|
267
|
-
`],children:[e.metadata&&Object.entries(e.metadata).map(([
|
|
267
|
+
`],children:[e.metadata&&Object.entries(e.metadata).map(([d,f],s)=>ce("div",{css:et,children:[ce("span",{css:tt,children:[d,":"]}),f]},s)),Object.entries(e.popoverData).map(([d,f],s)=>ce("div",{css:et,children:[ce("span",{css:tt,children:[d,":"]}),f]},s))]})]}):null]},e.id)};import{Droppable as Sn,DragDropContext as Cn,Draggable as Rn}from"react-beautiful-dnd";import{css as k}from"@emotion/react";var Wr=k`
|
|
268
268
|
background: var(--white);
|
|
269
269
|
border: 1px solid var(--gray-300);
|
|
270
270
|
border-radius: var(--rounded-base);
|
|
271
271
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
272
272
|
margin-bottom: var(--spacing-base);
|
|
273
|
-
`,
|
|
273
|
+
`,Kr=k`
|
|
274
274
|
align-items: center;
|
|
275
275
|
display: flex;
|
|
276
276
|
position: relative;
|
|
@@ -278,7 +278,7 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
278
278
|
width: 100%;
|
|
279
279
|
background-color: transparent;
|
|
280
280
|
border: 0;
|
|
281
|
-
`,
|
|
281
|
+
`,Qr=k`
|
|
282
282
|
color: var(--brand-secondary-1);
|
|
283
283
|
display: block;
|
|
284
284
|
font-weight: var(--fw-bold);
|
|
@@ -294,15 +294,15 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
294
294
|
background: var(--gray-100);
|
|
295
295
|
outline: none;
|
|
296
296
|
}
|
|
297
|
-
`,
|
|
297
|
+
`,Yr=k`
|
|
298
298
|
background: var(--white);
|
|
299
299
|
border: 1px solid var(--gray-300);
|
|
300
300
|
border-radius: var(--rounded-base);
|
|
301
301
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
302
302
|
display: block;
|
|
303
|
-
`,
|
|
303
|
+
`,Zr=k`
|
|
304
304
|
display: none;
|
|
305
|
-
`,
|
|
305
|
+
`,Xr=k`
|
|
306
306
|
overflow-y: auto;
|
|
307
307
|
height: 16rem;
|
|
308
308
|
margin-bottom: var(--spacing-base);
|
|
@@ -311,122 +311,127 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
311
311
|
& > :not(:last-child) {
|
|
312
312
|
border-bottom: 1px solid var(--gray-200);
|
|
313
313
|
}
|
|
314
|
-
`,
|
|
314
|
+
`,Id=k`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
|
-
`,
|
|
317
|
+
`,Jr=k`
|
|
318
318
|
align-items: center;
|
|
319
319
|
display: flex;
|
|
320
320
|
position: absolute;
|
|
321
321
|
inset: 0 0 0 auto;
|
|
322
322
|
pointer-events: none;
|
|
323
323
|
padding-right: var(--spacing-sm);
|
|
324
|
-
`,
|
|
324
|
+
`,jr=k`
|
|
325
325
|
color: var(--brand-secondary-1);
|
|
326
326
|
width: 1.25rem;
|
|
327
327
|
height: 1.25rem;
|
|
328
328
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
329
329
|
transform: rotate(0);
|
|
330
|
-
`,
|
|
330
|
+
`,Vd=k`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
|
-
`,
|
|
333
|
+
`,eo=k`
|
|
334
334
|
position: relative;
|
|
335
335
|
margin-block: var(--spacing-sm) 0;
|
|
336
336
|
|
|
337
337
|
&:hover > span {
|
|
338
338
|
opacity: 0.3;
|
|
339
339
|
}
|
|
340
|
-
|
|
340
|
+
|
|
341
|
+
&[data-dragging='true'] {
|
|
342
|
+
left: auto !important;
|
|
343
|
+
top: auto !important;
|
|
344
|
+
}
|
|
345
|
+
`,to=k`
|
|
341
346
|
align-items: center;
|
|
342
347
|
display: flex;
|
|
343
348
|
position: absolute;
|
|
344
349
|
inset: 0 auto 0 0;
|
|
345
350
|
margin-block: auto;
|
|
346
351
|
opacity: 0;
|
|
347
|
-
`,
|
|
352
|
+
`,rt=k`
|
|
348
353
|
color: var(--brand-secondary-1);
|
|
349
|
-
`,
|
|
354
|
+
`,ro=k`
|
|
350
355
|
position: absolute;
|
|
351
356
|
left: 0.375rem;
|
|
352
|
-
`,
|
|
357
|
+
`,ot=k`
|
|
353
358
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
354
359
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
355
|
-
`;import{css as
|
|
360
|
+
`;import{css as W}from"@emotion/react";import{InputSelect as Pn,scrollbarStyles as kn,Button as at,Callout as Tn,InputKeywordSearch as Ln,LoadingIndicator as _n,Menu as In,MenuItem as Vn,LoadingOverlay as En}from"@uniformdev/design-system";import{useState as yn,useEffect as oo,useRef as bn}from"react";function ao(e,{delay:r=500,minDuration:a=200}={delay:500,minDuration:200}){let[o,t]=yn("IDLE"),n=bn(void 0);return oo(()=>{e&&o==="IDLE"&&(clearTimeout(n.current),n.current=setTimeout(()=>{if(!e)return t("IDLE");n.current=setTimeout(()=>{t("EXPIRE")},a),t("DISPLAY")},r),t("DELAY")),!e&&o!=="DISPLAY"&&(clearTimeout(n.current),t("IDLE"))},[e,o,r,a]),oo(()=>()=>clearTimeout(n.current),[]),o==="DISPLAY"||o==="EXPIRE"}import{Fragment as Mn,jsx as h,jsxs as G}from"@emotion/react/jsx-runtime";var Dn=({searchText:e,selectedContentType:r})=>{let a="No content found";return r&&r!=="any"&&(a=`No ${r} content was found`),e&&(a=`${a} for keyword '${e}'.`),h(Tn,{type:"info",children:a})},no=({search:e,results:r,contentTypes:a,selectedItems:o,logoIcon:t,select:n,multiSelect:i,multiSelectId:g,rowComponent:d,selectedItemComponent:f,totalResults:s,cursor:m,resultsLoading:c,requireContentType:y,onAddNew:P,onEditClosed:w,onCancel:S,noResultsComponent:ue,helpComponent:Se,onSort:q,typeSelectorLabel:ee="Content Type Select",typeSelectorAllTypesOptionText:Z="All content types",loadingIndicatorDelay:Ce=1e3})=>{var Pt,kt,Tt;let ie=()=>y?Array.isArray(a)&&a.length>0?a[0].id:"":"any",[E,D]=K.useState(""),[v,B]=K.useState(ie),[p,A]=K.useState(!1),[R,se]=K.useState([]),[da,wt]=K.useState(!1),We=K.useRef(`x${wn()}`);xn(()=>{e(E,{count:5,offset:0,contentType:v==="any"?void 0:v})},300,[E,v]);let ca=ao(c,{delay:Ce}),pa=u=>{R.some(x=>x.id===u.id)?se(x=>x.filter(te=>te.id!==u.id)):se(i?x=>[...x,u]:[u])},ua=o==null?void 0:o.map(u=>u.id+u.title).join(",");K.useEffect(()=>{Array.isArray(o)&&se(o)},[ua]);let ga=()=>{B(ie()),D(""),se(o!=null&&o.length?o:[])},ma=()=>{A(u=>!u),p||ga()},St=u=>{let x=(R==null?void 0:R.filter(te=>te.id!==u.id))||[];se(x),n(x,"")},fa=u=>{u.preventDefault(),n(R,v),A(!1)},va=u=>{u.preventDefault(),A(!1),S&&S()},ha=()=>{e(E,{count:5,offset:(r==null?void 0:r.length)||0,contentType:v==="any"?void 0:v,cursor:m}),wt(!0);let u=setTimeout(()=>{wt(!1)},750);return()=>clearTimeout(u)},ya=!(o==null?void 0:o.length)||i,ba=d||Nr,Ct=f||zr,xa=ue||Dn,Rt=t&&typeof t!="string"?t:null,wa=Rt?h(Rt,{css:ot}):h("img",{src:t,alt:"Logo",css:ot}),Sa=u=>{var x,te;if(u.destination&&u.source.droppableId===((x=u.destination)==null?void 0:x.droppableId)){let M=[...o||[]],[Ke]=(te=M==null?void 0:M.splice(u.source.index,1))!=null?te:[];return M==null||M.splice(u.destination.index,0,Ke),q&&(se(M),q==null||q(M)),M}};return h("div",{css:W`
|
|
356
361
|
width: 100%;
|
|
357
|
-
`,children:G("div",{css:
|
|
362
|
+
`,children:G("div",{css:W`
|
|
358
363
|
position: relative;
|
|
359
364
|
margin-block: var(--spacing-base);
|
|
360
|
-
`,children:[
|
|
365
|
+
`,children:[ya?G(Mn,{children:[h("div",{css:Wr,"data-test-id":"component-search",children:G("button",{css:Kr,onClick:ma,type:"button","aria-haspopup":!0,"aria-expanded":p,"aria-controls":`entry-search-config-${We.current}`,children:[wa,h("span",{css:W`
|
|
361
366
|
margin-left: var(--spacing-base);
|
|
362
|
-
`,children:"Select"}),
|
|
367
|
+
`,children:"Select"}),h("span",{css:Jr,children:h(He,{css:[jr,p?W`
|
|
363
368
|
transform: rotate(180deg);
|
|
364
|
-
`:void 0]})})]})}),G("div",{id:`entry-search-config-${
|
|
369
|
+
`:void 0]})})]})}),G("div",{id:`entry-search-config-${We.current}`,"aria-hidden":!p,css:[Yr,p?void 0:Zr],children:[Se||null,G("div",{css:W`
|
|
365
370
|
display: flex;
|
|
366
371
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
367
372
|
margin-bottom: var(--spacing-base);
|
|
368
|
-
`,children:[
|
|
373
|
+
`,children:[h(Pn,{onChange:u=>B(u.target.value),value:v,label:ee,showLabel:!1,options:[...y?[]:[{value:"any",label:Z}],...a?a.map(u=>({value:u.id,label:u.name})):[]]}),h("div",{css:W`
|
|
369
374
|
flex-grow: 1;
|
|
370
|
-
`,children:
|
|
375
|
+
`,children:h(Ln,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:D,disabledFieldSubmission:!0,value:E})})]}),G("div",{css:[Xr,kn],id:We.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[h(En,{isActive:ca}),Array.isArray(r)&&r.length>0?r.map(u=>h(ba,{isSelected:R.some(x=>x.id===u.id),result:u,triggerSelection:()=>pa(u)},u.id)):c?null:h(xa,{searchText:E||E,selectedContentType:(kt=(Pt=a==null?void 0:a.find(u=>u.id===v))==null?void 0:Pt.name)!=null?kt:v}),!c&&typeof s!="undefined"&&r&&(r==null?void 0:r.length)<s&&h("button",{type:"button",css:Qr,onClick:ha,children:da?h(_n,{}):"Load More"})]}),G("div",{css:W`
|
|
371
376
|
display: flex;
|
|
372
377
|
justify-content: space-between;
|
|
373
|
-
`,children:[
|
|
378
|
+
`,children:[h("div",{children:P&&((Tt=a==null?void 0:a.length)!=null?Tt:0)>0?h(In,{menuLabel:"Add new menu",menuTrigger:h(at,{buttonType:"secondary",children:"Add New"}),children:a==null?void 0:a.map(u=>h(Vn,{css:W`
|
|
374
379
|
background: var(--white);
|
|
375
380
|
color: var(--brand-secondary-1);
|
|
376
|
-
`,onClick:()=>
|
|
381
|
+
`,onClick:()=>P(u),children:u.name},u.id))}):null}),G("div",{css:W`
|
|
377
382
|
display: flex;
|
|
378
383
|
gap: var(--spacing-base);
|
|
379
|
-
`,children:[
|
|
384
|
+
`,children:[h(at,{buttonType:"unimportant",onClick:va,children:"Cancel"}),h(at,{disabled:!R.length,onClick:fa,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,p?null:i&&R.length>1?h(Cn,{onDragEnd:u=>Sa(u),children:h(Sn,{droppableId:g||"canvas-multi-select",children:u=>G("div",{...u.droppableProps,ref:u.innerRef,css:W`
|
|
380
385
|
margin-block: var(--spacing-sm) 0;
|
|
381
|
-
`,children:[
|
|
386
|
+
`,children:[R==null?void 0:R.map((x,te)=>{if(x!=null&&x.id)return h(Rn,{draggableId:x.id,index:te,children:(M,Ke)=>G("div",{css:eo,ref:M.innerRef,"data-dragging":Ke.isDragging,...M.draggableProps,...M.dragHandleProps,children:[G("span",{css:to,children:[h(ke,{css:[rt,ro],width:24,height:24}),h(ke,{css:rt,width:24,height:24})]}),h(Ct,{logoIcon:t,selectedItem:x,onDeselect:Qe=>St(Qe),onEditClosed:w?Qe=>w(Qe):void 0},`selected-item-${x.id}`)]})},x.id)}),u.placeholder]})})}):R==null?void 0:R.map(u=>h(Ct,{logoIcon:t,selectedItem:u,onDeselect:x=>St(x),onEditClosed:w?x=>w(x):void 0},`selected-item-${u.id}`))]})})};import{css as pe}from"@emotion/react";var io=pe`
|
|
382
387
|
cursor: pointer;
|
|
383
388
|
padding: var(--spacing-sm) 0;
|
|
384
389
|
margin-right: var(--spacing-sm);
|
|
385
390
|
position: relative;
|
|
386
391
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
387
392
|
color var(--duration-fast) var(--timing-ease-out);
|
|
388
|
-
`,
|
|
393
|
+
`,so=pe`
|
|
389
394
|
border: 2px solid transparent;
|
|
390
395
|
border-radius: var(--rounded-base);
|
|
391
396
|
display: flex;
|
|
392
397
|
align-items: center;
|
|
393
398
|
gap: var(--spacing-base);
|
|
394
399
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
395
|
-
`,
|
|
400
|
+
`,lo=pe`
|
|
396
401
|
background-color: var(--green-50);
|
|
397
|
-
|
|
402
|
+
`,co=pe`
|
|
398
403
|
font-size: var(--fs-sm);
|
|
399
404
|
font-weight: var(--fw-bold);
|
|
400
405
|
width: 50%;
|
|
401
|
-
`,
|
|
406
|
+
`,po=pe`
|
|
402
407
|
font-weight: var(--fw-normal);
|
|
403
408
|
display: block;
|
|
404
|
-
`,
|
|
409
|
+
`,uo=pe`
|
|
405
410
|
font-size: var(--fs-sm);
|
|
406
411
|
> * {
|
|
407
412
|
display: block;
|
|
408
413
|
}
|
|
409
|
-
`,
|
|
414
|
+
`,go=pe`
|
|
410
415
|
display: block;
|
|
411
416
|
height: 1.5rem;
|
|
412
417
|
width: 1.5rem;
|
|
413
418
|
color: var(--brand-secondary-3);
|
|
414
419
|
margin-left: auto;
|
|
415
|
-
`;import{css as
|
|
420
|
+
`;import{css as mo}from"@emotion/react";import{jsx as me,jsxs as nt}from"@emotion/react/jsx-runtime";function fo({result:e,isSelected:r,triggerSelection:a}){var g;let{categories:o,logoIcon:t}=qe(),[n]=e.categories||[{id:"",name:""}],i=typeof n=="undefined"||!o||(g=o.find(d=>d.id===n.id))==null?void 0:g.name;return me("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>a(),css:[io],children:nt("div",{css:[so,r?lo:void 0],children:[e.thumbnailUrl?me("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:mo`
|
|
416
421
|
background-color: var(--gray-200);
|
|
417
422
|
width: 3rem;
|
|
418
423
|
height: 3rem;
|
|
419
424
|
object-fit: cover;
|
|
420
|
-
`}):
|
|
425
|
+
`}):me($,{src:t,alt:"Logo",css:mo`
|
|
421
426
|
height: 2.25rem;
|
|
422
427
|
width: 2.25rem;
|
|
423
|
-
`}),
|
|
428
|
+
`}),nt("h4",{css:[co],children:[e.title,i?me("span",{css:[po],children:i}):null]}),nt("p",{css:[uo],children:["SKU: ",e.sku||e.id,e.price!==void 0?me("span",{children:e.price}):null]}),r?me(Ae,{css:[go]}):null]})},e.id)}import{css as ne}from"@emotion/react";import{mq as vo}from"@uniformdev/design-system";var ho=ne`
|
|
424
429
|
border: 1px solid var(--gray-200);
|
|
425
430
|
border-radius: var(--rounded-base);
|
|
426
431
|
background: var(--gray-50);
|
|
427
432
|
display: flex;
|
|
428
433
|
width: 100%;
|
|
429
|
-
`,
|
|
434
|
+
`,yo=ne`
|
|
430
435
|
align-items: center;
|
|
431
436
|
display: flex;
|
|
432
437
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -434,22 +439,22 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
434
439
|
flex-grow: 1;
|
|
435
440
|
gap: var(--spacing-sm);
|
|
436
441
|
margin-inline: 0 var(--spacing-sm);
|
|
437
|
-
`,
|
|
442
|
+
`,bo=ne`
|
|
438
443
|
display: flex;
|
|
439
444
|
align-items: center;
|
|
440
445
|
gap: var(--spacing-sm);
|
|
441
446
|
flex-grow: 1;
|
|
442
447
|
|
|
443
|
-
${
|
|
448
|
+
${vo("lg")} {
|
|
444
449
|
width: 50%;
|
|
445
450
|
margin-bottom: 0;
|
|
446
451
|
}
|
|
447
|
-
`,
|
|
452
|
+
`,it=ne`
|
|
448
453
|
background-color: var(--gray-200);
|
|
449
454
|
width: 3.5rem;
|
|
450
455
|
height: 3.5rem;
|
|
451
456
|
object-fit: cover;
|
|
452
|
-
`,
|
|
457
|
+
`,st=ne`
|
|
453
458
|
align-items: center;
|
|
454
459
|
background: var(--white);
|
|
455
460
|
border-radius: var(--rounded-base);
|
|
@@ -464,50 +469,50 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
464
469
|
&:hover {
|
|
465
470
|
background: var(--gray-50);
|
|
466
471
|
}
|
|
467
|
-
`,
|
|
472
|
+
`,lt=ne`
|
|
468
473
|
font-size: var(--fs-sm);
|
|
469
|
-
`,
|
|
474
|
+
`,xo=ne`
|
|
470
475
|
display: block;
|
|
471
476
|
width: 1rem;
|
|
472
477
|
height: 1rem;
|
|
473
|
-
`,
|
|
478
|
+
`,wo=ne`
|
|
474
479
|
display: flex;
|
|
475
480
|
flex-direction: column;
|
|
476
481
|
gap: var(--spacing-sm);
|
|
477
482
|
|
|
478
|
-
${
|
|
483
|
+
${vo("md")} {
|
|
479
484
|
flex-direction: row;
|
|
480
485
|
min-width: 200px;
|
|
481
486
|
justify-content: end;
|
|
482
487
|
}
|
|
483
|
-
`;import{css as
|
|
488
|
+
`;import{css as fe}from"@emotion/react";import{Icon as Un,mq as zn}from"@uniformdev/design-system";import{CgClose as Bn}from"react-icons/cg";import{jsx as O,jsxs as Q}from"@emotion/react/jsx-runtime";function So({selectedItem:e,onDeselect:r}){var i;let{categories:a,logoIcon:o}=qe(),[t]=e.categories||[{id:"",name:""}],n=typeof t=="undefined"||!a||(i=a.find(g=>g.id===t.id))==null?void 0:i.name;return O("div",{css:[ho],children:Q("article",{css:[yo],children:[Q("div",{css:[bo],children:[e.thumbnailUrl?O("img",{src:e.thumbnailUrl,alt:n,css:[it],loading:"lazy"}):O("div",{css:[it]}),Q("div",{css:fe`
|
|
484
489
|
> :not(:last-child) {
|
|
485
490
|
margin-bottom: var(--spacing-xs);
|
|
486
491
|
}
|
|
487
|
-
`,children:[Q("h4",{css:
|
|
492
|
+
`,children:[Q("h4",{css:fe`
|
|
488
493
|
margin-top: 0px;
|
|
489
494
|
font-weight: var(--fw-bold);
|
|
490
|
-
`,children:[e.title||e.id||"",
|
|
495
|
+
`,children:[e.title||e.id||"",n&&O("span",{css:fe`
|
|
491
496
|
display: block;
|
|
492
497
|
font-weight: var(--fw-regular);
|
|
493
|
-
`,children:
|
|
498
|
+
`,children:n})]}),Q("ul",{css:fe`
|
|
494
499
|
font-size: var(--fs-sm);
|
|
495
500
|
|
|
496
|
-
${
|
|
501
|
+
${zn("sm")} {
|
|
497
502
|
display: flex;
|
|
498
503
|
gap: var(--spacing-base);
|
|
499
504
|
}
|
|
500
|
-
`,children:[Q("li",{children:[
|
|
505
|
+
`,children:[Q("li",{children:[O("span",{css:fe`
|
|
501
506
|
margin-right: var(--spacing-xs);
|
|
502
|
-
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?Q("li",{children:[
|
|
507
|
+
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?Q("li",{children:[O("span",{css:fe`
|
|
503
508
|
margin-right: var(--spacing-xs);
|
|
504
|
-
`,children:"Price:"}),
|
|
509
|
+
`,children:"Price:"}),O("span",{children:e.price})]}):null]})]})]}),Q("div",{css:wo,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:st,children:[O("span",{css:lt,children:"Edit"}),O($,{src:o,alt:"Logo",css:xo})]}):null,Q("button",{type:"button",onClick:()=>{r==null||r(e)},css:st,children:[O("span",{css:lt,children:"Unlink"}),O(Un,{icon:Bn,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as qn}from"@uniformdev/design-system";import{useAsync as $n,useAsyncFn as Fn}from"react-use";import{jsx as dt,jsxs as Nn}from"@emotion/react/jsx-runtime";function Ec({selectedProducts:e,setSelectedProducts:r,onGetCategories:a,onSearchProducts:o,logoIcon:t,multiSelect:n,multiSelectId:i,selectedItemComponent:g,rowComponent:d,errorComponent:f,helpComponent:s,noResultsComponent:m,onSort:c,typeSelectorAllTypesOptionText:y="All categories",typeSelectorLabel:P="Select Category"}){var ie,E;let{value:w,loading:S,error:ue}=$n(async()=>await a(),[a]),Se=w==null?void 0:w.map(D=>D.id).join(","),q=Gn(()=>w?w.map(v=>({id:v.id,name:v.name})):void 0,[Se]),ee=On(),[Z,Ce]=Fn(async(D,v)=>{let B=await o({text:D,options:{limit:v==null?void 0:v.count,offset:v==null?void 0:v.offset,categoryId:v==null?void 0:v.contentType,cursor:v==null?void 0:v.cursor}});return(v==null?void 0:v.offset)===0&&(ee.current=[]),(ee.current=ee.current||[]).push(...B.products),B},[o]),_e=async D=>{await r(D)};return ue||Z.error?dt(f||(({categoriesError:v,searchError:B})=>Nn(qn,{type:"error",children:["There was an error: ",(v==null?void 0:v.message)||(B==null?void 0:B.message)]})),{categoriesError:ue,searchError:Z.error}):dt(Co.Provider,{value:{categories:w,logoIcon:t},children:dt(no,{search:Ce,results:ee.current,logoIcon:t,selectedItems:e,select:_e,multiSelectId:i||"product-search-multi-select",multiSelect:n,contentTypes:q,selectedItemComponent:g||So,rowComponent:d||fo,totalResults:(ie=Z.value)==null?void 0:ie.total,cursor:(E=Z.value)==null?void 0:E.cursor,resultsLoading:Z.loading||S,helpComponent:s,noResultsComponent:m,onSort:c,typeSelectorAllTypesOptionText:y,typeSelectorLabel:P})})}var Co=An.createContext(void 0),qe=()=>{let e=Hn(Co);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};import{css as _}from"@emotion/react";import{mq as Wn}from"@uniformdev/design-system";var Ro=_`
|
|
505
510
|
border: 1px solid var(--gray-200);
|
|
506
511
|
background: var(--gray-50);
|
|
507
512
|
border-radius: var(--rounded-base);
|
|
508
513
|
display: flex;
|
|
509
514
|
width: 100%;
|
|
510
|
-
`,
|
|
515
|
+
`,Po=_`
|
|
511
516
|
align-items: center;
|
|
512
517
|
display: flex;
|
|
513
518
|
flex-grow: 1;
|
|
@@ -515,23 +520,23 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
515
520
|
margin-inline: 0 var(--spacing-sm);
|
|
516
521
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
517
522
|
position: relative;
|
|
518
|
-
`,
|
|
523
|
+
`,ko=_`
|
|
519
524
|
flex-grow: 1;
|
|
520
|
-
`,
|
|
525
|
+
`,To=_`
|
|
521
526
|
align-items: center;
|
|
522
527
|
display: flex;
|
|
523
528
|
position: relative;
|
|
524
|
-
`,
|
|
529
|
+
`,Lo=_`
|
|
525
530
|
color: var(--brand-secondary-1);
|
|
526
531
|
font-size: var(--fs-base);
|
|
527
532
|
font-weight: var(--fw-bold);
|
|
528
533
|
line-height: 1;
|
|
529
534
|
margin: 0;
|
|
530
535
|
word-break: break-word;
|
|
531
|
-
`,
|
|
536
|
+
`,_o=_`
|
|
532
537
|
width: 1.5rem;
|
|
533
538
|
height: 1.5rem;
|
|
534
|
-
`,
|
|
539
|
+
`,Io=_`
|
|
535
540
|
background: var(--white);
|
|
536
541
|
border-radius: var(--rounded-base);
|
|
537
542
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -540,22 +545,22 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
540
545
|
padding: var(--spacing-base);
|
|
541
546
|
z-index: var(--z-10);
|
|
542
547
|
width: max-content;
|
|
543
|
-
`,
|
|
548
|
+
`,ve=_`
|
|
544
549
|
font-size: var(--fs-sm);
|
|
545
|
-
|
|
550
|
+
`,$e=_`
|
|
546
551
|
font-weight: var(--fw-bold);
|
|
547
552
|
margin-right: var(--spacing-sm);
|
|
548
|
-
`,
|
|
553
|
+
`,Vo=_`
|
|
549
554
|
display: flex;
|
|
550
555
|
flex-direction: column;
|
|
551
556
|
gap: var(--spacing-sm);
|
|
552
557
|
|
|
553
|
-
${
|
|
558
|
+
${Wn("md")} {
|
|
554
559
|
flex-direction: row;
|
|
555
560
|
justify-content: end;
|
|
556
561
|
min-width: 200px;
|
|
557
562
|
}
|
|
558
|
-
`,
|
|
563
|
+
`,ct=_`
|
|
559
564
|
align-items: center;
|
|
560
565
|
background: var(--white);
|
|
561
566
|
border-radius: var(--rounded-base);
|
|
@@ -570,30 +575,563 @@ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enum
|
|
|
570
575
|
&:hover {
|
|
571
576
|
background: var(--gray-50);
|
|
572
577
|
}
|
|
573
|
-
`,
|
|
578
|
+
`,Eo=_`
|
|
574
579
|
display: flex;
|
|
575
580
|
margin-top: var(--spacing-sm);
|
|
576
581
|
gap: var(--spacing-sm);
|
|
577
|
-
`,
|
|
582
|
+
`,Do=_`
|
|
578
583
|
background: none;
|
|
579
584
|
outline: none;
|
|
580
585
|
border: none;
|
|
581
586
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
582
|
-
`,
|
|
587
|
+
`,pt=_`
|
|
583
588
|
display: block;
|
|
584
589
|
max-width: 100%;
|
|
585
590
|
min-width: 100px;
|
|
586
591
|
height: auto;
|
|
587
|
-
`;import{useState as
|
|
592
|
+
`;import{useState as Kn,useRef as Mo,useEffect as Qn}from"react";import{CgInfo as Yn,CgClose as Zn}from"react-icons/cg";import{format as Xn}from"timeago.js";import{css as he}from"@emotion/react";import{Icon as Uo}from"@uniformdev/design-system";import{Fragment as jn,jsx as I,jsxs as V}from"@emotion/react/jsx-runtime";function Yc({selectedItem:e,onDeselect:r,onEditClosed:a,logoIcon:o,itemDetailsRendererComponent:t}){let n=Mo(null),i=Mo(null),[g,d]=Kn(!1);Qn(()=>{let m=y=>{n.current&&!n.current.contains(y.target)&&i.current&&!i.current.contains(y.target)&&d(!1)},c=()=>{d(!1)};return window.addEventListener("resize",c,!0),document.addEventListener("scroll",m,!0),document.addEventListener("mousedown",m),()=>{window.removeEventListener("resize",c,!0),document.removeEventListener("scroll",m,!0),document.removeEventListener("mousedown",m)}},[i]);let f=()=>{var m;if(d(!g),i.current&&n.current){let c=(m=n==null?void 0:n.current)==null?void 0:m.getBoundingClientRect();i.current.style.top=`${c.top+30}px`}},s=t!=null?t:Jn;return I("div",{css:[Ro,he`
|
|
588
593
|
margin: 0 0 1rem 0;
|
|
589
|
-
`],children:
|
|
594
|
+
`],children:V("div",{css:Po,children:[V("div",{css:ko,children:[V("div",{css:To,children:[I("h4",{css:[Lo],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?V(jn,{children:[I("button",{type:"button",ref:n,css:Do,"aria-controls":"path-details","aria-expanded":g,onClick:f,children:I(Uo,{icon:Yn,iconColor:"gray",size:24,css:he`
|
|
590
595
|
opacity: var(--opacity-75);
|
|
591
|
-
`})}),I("div",{id:"path-details","aria-hidden":!
|
|
596
|
+
`})}),I("div",{id:"path-details","aria-hidden":!g,ref:i,css:[Io,g?he`
|
|
592
597
|
visibility: visible;
|
|
593
|
-
`:
|
|
598
|
+
`:he`
|
|
594
599
|
visibility: hidden;
|
|
595
|
-
`],children:Object.entries(e.popoverData).map(([
|
|
600
|
+
`],children:Object.entries(e.popoverData).map(([m,c],y)=>V("div",{css:ve,children:[V("span",{css:$e,children:[m,":"]}),c]},y))})]}):null]}),I(s,{item:e})]}),V("div",{css:Vo,children:[e.editLink?typeof e.editLink=="string"?V("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:m=>{a&&(Oe(m.currentTarget.href,()=>a(e)),m.preventDefault())},css:ct,children:[I("span",{css:ve,children:"Edit"}),o?I($,{src:o,css:_o,alt:"Logo"}):null]}):e.editLink:null,V("button",{type:"button",onClick:()=>{r(e)},css:ct,children:[I("span",{css:ve,children:"Unlink"}),I(Uo,{icon:Zn,iconColor:"red",size:16})]})]})]})},e.id)}function Jn({item:e}){let r=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?r=I("img",{src:e.previewUrl,alt:e.id,width:"200",css:pt}):e.type==="video"&&(r=I("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:pt})):e.previewUrl&&typeof e.previewUrl!="string"&&(r=e.previewUrl),r||e.metadata?V("div",{css:Eo,children:[r?I("div",{children:r}):null,V("ul",{children:[e.metadata?Object.entries(e.metadata).map(([a,o])=>V("li",{css:[ve,he`
|
|
596
601
|
order: 1;
|
|
597
|
-
`],children:[
|
|
602
|
+
`],children:[V("span",{css:[$e,he`
|
|
598
603
|
order: 1;
|
|
599
|
-
`],children:[
|
|
604
|
+
`],children:[a,":"]}),o]},a)):null,e.createdDate?V("li",{css:ve,children:[I("span",{css:$e,children:"Date:"}),Xn(e.createdDate)]}):null]})]}):null}import{LoadingIndicator as ei,Theme as ti}from"@uniformdev/design-system";import{jsx as Le,jsxs as ri}from"@emotion/react/jsx-runtime";var op=({children:e,loadingComponent:r,errorComponent:a})=>{let{initializing:o,error:t,sdk:n}=Dt();if(o||!n){let i=r;return i?Le(i,{}):Le(ei,{})}if(t){let i=a;if(i)return Le(i,{error:t});throw t}return ri(Ie.Provider,{value:{sdk:n},children:[Le(ti,{}),Le(Ve,{children:e})]})};function zo(e){return Object.entries(e||{}).sort(([r,a],[o,t])=>{var n,i;return a.order&&t.order?a.order-t.order:a.order?1:t.order?-1:((n=a.displayName)!=null?n:r).localeCompare((i=t.displayName)!=null?i:o)}).map(([r,a])=>({name:r,...a}))}import*as xe from"react";import{Button as Oo,Input as gt}from"@uniformdev/design-system";import{Form as oi,Formik as ai}from"formik";import{css as ut}from"@emotion/react";var Bo=ut`
|
|
605
|
+
> * {
|
|
606
|
+
margin: var(--spacing-base) 0 0;
|
|
607
|
+
}
|
|
608
|
+
`,Ao=ut`
|
|
609
|
+
display: flex;
|
|
610
|
+
gap: var(--spacing-sm);
|
|
611
|
+
`,Ho=ut`
|
|
612
|
+
:root {
|
|
613
|
+
--tagify-dd-color-primary: rgb(53, 149, 246);
|
|
614
|
+
--tagify-dd-bg-color: var(--white);
|
|
615
|
+
--tagify-dd-item-pad: var(--spacing-xs) var(--spacing-sm);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.tagify {
|
|
619
|
+
--tags-disabled-bg: #f1f1f1;
|
|
620
|
+
--tags-border-color: var(--gray-400);
|
|
621
|
+
--tags-hover-border-color: var(--gray-300);
|
|
622
|
+
--tags-focus-border-color: var(--brand-secondary-1);
|
|
623
|
+
--tag-border-radius: var(--rounded-md);
|
|
624
|
+
--tag-bg: var(--gray-100);
|
|
625
|
+
--tag-hover: var(--gray-200);
|
|
626
|
+
--tag-text-color: var(--brand-secondary-1);
|
|
627
|
+
--tag-text-color--edit: var(--brand-secondary-1);
|
|
628
|
+
--tag-pad: var(--spacing-2xs) var(--spacing-sm);
|
|
629
|
+
--tag-inset-shadow-size: 1rem;
|
|
630
|
+
--tag-invalid-color: #d39494;
|
|
631
|
+
--tag-invalid-bg: rgba(211, 148, 148, 0.5);
|
|
632
|
+
--tag-remove-bg: rgba(211, 148, 148, 0.3);
|
|
633
|
+
--tag-remove-btn-color: black;
|
|
634
|
+
--tag-remove-btn-bg: none;
|
|
635
|
+
--tag-remove-btn-bg--hover: #c77777;
|
|
636
|
+
--input-color: inherit;
|
|
637
|
+
--tag--min-width: 1ch;
|
|
638
|
+
--tag--max-width: auto;
|
|
639
|
+
--tag-hide-transition: 0.3s;
|
|
640
|
+
--placeholder-color: rgba(0, 0, 0, 0.4);
|
|
641
|
+
--placeholder-color-focus: rgba(0, 0, 0, 0.25);
|
|
642
|
+
--loader-size: 0.8em;
|
|
643
|
+
--readonly-striped: 1;
|
|
644
|
+
|
|
645
|
+
background: var(--white);
|
|
646
|
+
display: inline-flex;
|
|
647
|
+
align-items: flex-start;
|
|
648
|
+
flex-wrap: wrap;
|
|
649
|
+
border-radius: var(--rounded-md);
|
|
650
|
+
outline: 1px solid var(--gray-400);
|
|
651
|
+
padding: 0;
|
|
652
|
+
line-height: 0;
|
|
653
|
+
cursor: text;
|
|
654
|
+
position: relative;
|
|
655
|
+
box-sizing: border-box;
|
|
656
|
+
transition: 0.1s;
|
|
657
|
+
word-break: break-word;
|
|
658
|
+
}
|
|
659
|
+
.tagify:hover:not(.tagify--focus):not(.tagify--invalid) {
|
|
660
|
+
--tags-border-color: var(--tags-hover-border-color);
|
|
661
|
+
}
|
|
662
|
+
.tagify[disabled] {
|
|
663
|
+
background: var(--tags-disabled-bg);
|
|
664
|
+
filter: saturate(0);
|
|
665
|
+
opacity: 0.5;
|
|
666
|
+
pointer-events: none;
|
|
667
|
+
}
|
|
668
|
+
.tagify[disabled].tagify--select,
|
|
669
|
+
.tagify[readonly].tagify--select {
|
|
670
|
+
pointer-events: none;
|
|
671
|
+
}
|
|
672
|
+
.tagify[disabled]:not(.tagify--mix):not(.tagify--select),
|
|
673
|
+
.tagify[readonly]:not(.tagify--mix):not(.tagify--select) {
|
|
674
|
+
cursor: default;
|
|
675
|
+
}
|
|
676
|
+
.tagify[disabled]:not(.tagify--mix):not(.tagify--select) > .tagify__input,
|
|
677
|
+
.tagify[readonly]:not(.tagify--mix):not(.tagify--select) > .tagify__input {
|
|
678
|
+
visibility: hidden;
|
|
679
|
+
width: 0;
|
|
680
|
+
margin: 5px 0;
|
|
681
|
+
}
|
|
682
|
+
.tagify[disabled]:not(.tagify--mix):not(.tagify--select) .tagify__tag > div,
|
|
683
|
+
.tagify[readonly]:not(.tagify--mix):not(.tagify--select) .tagify__tag > div {
|
|
684
|
+
padding: var(--tag-pad);
|
|
685
|
+
}
|
|
686
|
+
.tagify[disabled]:not(.tagify--mix):not(.tagify--select) .tagify__tag > div::before,
|
|
687
|
+
.tagify[readonly]:not(.tagify--mix):not(.tagify--select) .tagify__tag > div::before {
|
|
688
|
+
animation: readonlyStyles 1s calc(-1s * (var(--readonly-striped) - 1)) paused;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.tagify[disabled] .tagify__tag__removeBtn,
|
|
692
|
+
.tagify[readonly] .tagify__tag__removeBtn {
|
|
693
|
+
display: none;
|
|
694
|
+
}
|
|
695
|
+
.tagify--loading .tagify__input > br:last-child {
|
|
696
|
+
display: none;
|
|
697
|
+
}
|
|
698
|
+
.tagify--loading .tagify__input::before {
|
|
699
|
+
content: none;
|
|
700
|
+
}
|
|
701
|
+
.tagify--loading .tagify__input::after {
|
|
702
|
+
content: '';
|
|
703
|
+
vertical-align: middle;
|
|
704
|
+
opacity: 1;
|
|
705
|
+
width: 0.7em;
|
|
706
|
+
height: 0.7em;
|
|
707
|
+
width: var(--loader-size);
|
|
708
|
+
height: var(--loader-size);
|
|
709
|
+
min-width: 0;
|
|
710
|
+
border: 3px solid;
|
|
711
|
+
border-color: #eee #bbb #888 transparent;
|
|
712
|
+
border-radius: 50%;
|
|
713
|
+
animation: rotateLoader 0.4s infinite linear;
|
|
714
|
+
content: '' !important;
|
|
715
|
+
margin: -2px 0 -2px 0.5em;
|
|
716
|
+
}
|
|
717
|
+
.tagify--loading .tagify__input:empty::after {
|
|
718
|
+
margin-left: 0;
|
|
719
|
+
}
|
|
720
|
+
.tagify + input,
|
|
721
|
+
.tagify + textarea {
|
|
722
|
+
position: absolute !important;
|
|
723
|
+
left: -9999em !important;
|
|
724
|
+
transform: scale(0) !important;
|
|
725
|
+
}
|
|
726
|
+
.tagify__tag {
|
|
727
|
+
display: inline-flex;
|
|
728
|
+
align-items: center;
|
|
729
|
+
margin: 5px 0 5px 5px;
|
|
730
|
+
position: relative;
|
|
731
|
+
z-index: 1;
|
|
732
|
+
outline: 0;
|
|
733
|
+
line-height: normal;
|
|
734
|
+
cursor: default;
|
|
735
|
+
transition: 0.13s ease-out;
|
|
736
|
+
}
|
|
737
|
+
.tagify__tag > div {
|
|
738
|
+
vertical-align: top;
|
|
739
|
+
box-sizing: border-box;
|
|
740
|
+
max-width: 100%;
|
|
741
|
+
padding: var(--tag-pad);
|
|
742
|
+
color: var(--tag-text-color);
|
|
743
|
+
line-height: inherit;
|
|
744
|
+
border-radius: var(--tag-border-radius);
|
|
745
|
+
white-space: nowrap;
|
|
746
|
+
transition: 0.13s ease-out;
|
|
747
|
+
}
|
|
748
|
+
.tagify__tag > div > * {
|
|
749
|
+
white-space: pre-wrap;
|
|
750
|
+
overflow: hidden;
|
|
751
|
+
text-overflow: ellipsis;
|
|
752
|
+
display: inline-block;
|
|
753
|
+
vertical-align: top;
|
|
754
|
+
min-width: var(--tag--min-width);
|
|
755
|
+
max-width: var(--tag--max-width);
|
|
756
|
+
transition: 0.8s ease, 0.1s color;
|
|
757
|
+
}
|
|
758
|
+
.tagify__tag > div > [contenteditable] {
|
|
759
|
+
outline: 0;
|
|
760
|
+
-webkit-user-select: text;
|
|
761
|
+
user-select: text;
|
|
762
|
+
cursor: text;
|
|
763
|
+
margin: -2px;
|
|
764
|
+
padding: 2px;
|
|
765
|
+
max-width: 350px;
|
|
766
|
+
}
|
|
767
|
+
.tagify__tag > div::before {
|
|
768
|
+
content: '';
|
|
769
|
+
position: absolute;
|
|
770
|
+
border-radius: inherit;
|
|
771
|
+
inset: var(--tag-bg-inset, 0);
|
|
772
|
+
z-index: -1;
|
|
773
|
+
pointer-events: none;
|
|
774
|
+
transition: 120ms ease;
|
|
775
|
+
animation: tags--bump 0.3s ease-out 1;
|
|
776
|
+
background: var(--tag-bg);
|
|
777
|
+
}
|
|
778
|
+
.tagify__tag:focus div::before,
|
|
779
|
+
.tagify__tag:hover:not([readonly]) div::before {
|
|
780
|
+
--tag-bg-inset: -2.5px;
|
|
781
|
+
--tag-bg: var(--tag-hover);
|
|
782
|
+
}
|
|
783
|
+
.tagify__tag--loading {
|
|
784
|
+
pointer-events: none;
|
|
785
|
+
}
|
|
786
|
+
.tagify__tag--loading .tagify__tag__removeBtn {
|
|
787
|
+
display: none;
|
|
788
|
+
}
|
|
789
|
+
.tagify__tag--loading::after {
|
|
790
|
+
--loader-size: 0.4em;
|
|
791
|
+
content: '';
|
|
792
|
+
vertical-align: middle;
|
|
793
|
+
opacity: 1;
|
|
794
|
+
width: 0.7em;
|
|
795
|
+
height: 0.7em;
|
|
796
|
+
width: var(--loader-size);
|
|
797
|
+
height: var(--loader-size);
|
|
798
|
+
min-width: 0;
|
|
799
|
+
border: 3px solid;
|
|
800
|
+
border-color: #eee #bbb #888 transparent;
|
|
801
|
+
border-radius: 50%;
|
|
802
|
+
animation: rotateLoader 0.4s infinite linear;
|
|
803
|
+
margin: 0 0.5em 0 -0.1em;
|
|
804
|
+
}
|
|
805
|
+
.tagify__tag--flash div::before {
|
|
806
|
+
animation: none;
|
|
807
|
+
}
|
|
808
|
+
.tagify__tag--hide {
|
|
809
|
+
width: 0 !important;
|
|
810
|
+
padding-left: 0;
|
|
811
|
+
padding-right: 0;
|
|
812
|
+
margin-left: 0;
|
|
813
|
+
margin-right: 0;
|
|
814
|
+
opacity: 0;
|
|
815
|
+
transform: scale(0);
|
|
816
|
+
transition: var(--tag-hide-transition);
|
|
817
|
+
pointer-events: none;
|
|
818
|
+
}
|
|
819
|
+
.tagify__tag--hide > div > * {
|
|
820
|
+
white-space: nowrap;
|
|
821
|
+
}
|
|
822
|
+
.tagify__tag.tagify--noAnim > div::before {
|
|
823
|
+
animation: none;
|
|
824
|
+
}
|
|
825
|
+
.tagify__tag.tagify--notAllowed:not(.tagify__tag--editable) div > span {
|
|
826
|
+
opacity: 0.5;
|
|
827
|
+
}
|
|
828
|
+
.tagify__tag.tagify--notAllowed:not(.tagify__tag--editable) div::before {
|
|
829
|
+
--tag-bg: var(--tag-invalid-bg);
|
|
830
|
+
transition: 0.2s;
|
|
831
|
+
}
|
|
832
|
+
.tagify__tag[readonly] .tagify__tag__removeBtn {
|
|
833
|
+
display: none;
|
|
834
|
+
}
|
|
835
|
+
.tagify__tag[readonly] > div::before {
|
|
836
|
+
animation: readonlyStyles 1s calc(-1s * (var(--readonly-striped) - 1)) paused;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
.tagify__tag--editable > div {
|
|
840
|
+
color: var(--tag-text-color--edit);
|
|
841
|
+
}
|
|
842
|
+
.tagify__tag--editable > div::before {
|
|
843
|
+
background-color: var(--tag-hover) !important;
|
|
844
|
+
}
|
|
845
|
+
.tagify__tag--editable > .tagify__tag__removeBtn {
|
|
846
|
+
pointer-events: none;
|
|
847
|
+
}
|
|
848
|
+
.tagify__tag--editable > .tagify__tag__removeBtn::after {
|
|
849
|
+
opacity: 0;
|
|
850
|
+
transform: translateX(100%) translateX(5px);
|
|
851
|
+
}
|
|
852
|
+
.tagify__tag--editable.tagify--invalid > div::before {
|
|
853
|
+
background-color: var(--tag-invalid-color) !important;
|
|
854
|
+
}
|
|
855
|
+
.tagify__tag__removeBtn {
|
|
856
|
+
order: 5;
|
|
857
|
+
display: inline-flex;
|
|
858
|
+
align-items: center;
|
|
859
|
+
justify-content: center;
|
|
860
|
+
border-radius: 50px;
|
|
861
|
+
cursor: pointer;
|
|
862
|
+
font: 14px/1 Arial;
|
|
863
|
+
background: var(--tag-remove-btn-bg);
|
|
864
|
+
color: var(--tag-remove-btn-color);
|
|
865
|
+
width: 14px;
|
|
866
|
+
height: 14px;
|
|
867
|
+
margin-right: 4.6666666667px;
|
|
868
|
+
margin-left: auto;
|
|
869
|
+
overflow: hidden;
|
|
870
|
+
transition: 0.2s ease-out;
|
|
871
|
+
}
|
|
872
|
+
.tagify__tag__removeBtn::after {
|
|
873
|
+
content: '×';
|
|
874
|
+
transition: 0.3s, color 0s;
|
|
875
|
+
}
|
|
876
|
+
.tagify__tag__removeBtn:hover {
|
|
877
|
+
color: var(--white);
|
|
878
|
+
background: var(--tag-remove-btn-bg--hover);
|
|
879
|
+
}
|
|
880
|
+
.tagify__tag__removeBtn:hover + div > span {
|
|
881
|
+
opacity: 0.5;
|
|
882
|
+
}
|
|
883
|
+
.tagify__tag__removeBtn:hover + div::before {
|
|
884
|
+
background: var(--tag-remove-bg);
|
|
885
|
+
transition: background-color 0.2s;
|
|
886
|
+
}
|
|
887
|
+
.tagify:not(.tagify--mix) .tagify__input br {
|
|
888
|
+
display: none;
|
|
889
|
+
}
|
|
890
|
+
.tagify:not(.tagify--mix) .tagify__input * {
|
|
891
|
+
display: inline;
|
|
892
|
+
white-space: nowrap;
|
|
893
|
+
}
|
|
894
|
+
.tagify__input {
|
|
895
|
+
border-radius: var(--rounded-md);
|
|
896
|
+
flex-grow: 1;
|
|
897
|
+
display: inline-block;
|
|
898
|
+
min-width: 110px;
|
|
899
|
+
margin: 5px;
|
|
900
|
+
padding: var(--spacing-base) var(--spacing-md) var(--spacing-base) var(--spacing-base);
|
|
901
|
+
line-height: normal;
|
|
902
|
+
position: relative;
|
|
903
|
+
white-space: pre-wrap;
|
|
904
|
+
color: var(--input-color);
|
|
905
|
+
box-sizing: inherit;
|
|
906
|
+
}
|
|
907
|
+
.tagify__input:empty::before {
|
|
908
|
+
position: static;
|
|
909
|
+
}
|
|
910
|
+
.tagify__input:focus {
|
|
911
|
+
outline: 0;
|
|
912
|
+
}
|
|
913
|
+
.tagify__input:focus::before {
|
|
914
|
+
transition: 0.2s ease-out;
|
|
915
|
+
opacity: 0;
|
|
916
|
+
transform: translatex(6px);
|
|
917
|
+
}
|
|
918
|
+
.tagify__input:focus:empty::before {
|
|
919
|
+
transition: 0.2s ease-out;
|
|
920
|
+
opacity: 1;
|
|
921
|
+
transform: none;
|
|
922
|
+
color: rgba(0, 0, 0, 0.25);
|
|
923
|
+
color: var(--placeholder-color-focus);
|
|
924
|
+
}
|
|
925
|
+
.tagify__input::before {
|
|
926
|
+
content: attr(data-placeholder);
|
|
927
|
+
height: 1em;
|
|
928
|
+
line-height: 1em;
|
|
929
|
+
margin: auto 0;
|
|
930
|
+
z-index: 1;
|
|
931
|
+
color: var(--placeholder-color);
|
|
932
|
+
white-space: nowrap;
|
|
933
|
+
pointer-events: none;
|
|
934
|
+
opacity: 0;
|
|
935
|
+
position: absolute;
|
|
936
|
+
}
|
|
937
|
+
.tagify__input::after {
|
|
938
|
+
content: attr(data-suggest);
|
|
939
|
+
display: inline-block;
|
|
940
|
+
vertical-align: middle;
|
|
941
|
+
position: absolute;
|
|
942
|
+
min-width: calc(100% - 1.5em);
|
|
943
|
+
text-overflow: ellipsis;
|
|
944
|
+
overflow: hidden;
|
|
945
|
+
white-space: pre;
|
|
946
|
+
color: var(--tag-text-color);
|
|
947
|
+
opacity: 0.3;
|
|
948
|
+
pointer-events: none;
|
|
949
|
+
max-width: 100px;
|
|
950
|
+
}
|
|
951
|
+
.tagify__input .tagify__tag {
|
|
952
|
+
margin: 0 1px;
|
|
953
|
+
}
|
|
954
|
+
.tagify--mix {
|
|
955
|
+
display: block;
|
|
956
|
+
}
|
|
957
|
+
.tagify--mix .tagify__input {
|
|
958
|
+
background-image: url("data:image/svg+xml,%3Csvg width='18' height='10' viewBox='0 0 18 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 6C13.5523 6 14 5.55228 14 5C14 4.44772 13.5523 4 13 4L5 4C4.44771 4 4 4.44772 4 5C4 5.55228 4.44772 6 5 6L13 6Z' fill='%23D1D5DB'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18 5C18 7.76142 15.7614 10 13 10L5 10C2.23858 10 0 7.76142 0 5C0 2.23858 2.23858 0 5 0L13 0C15.7614 0 18 2.23858 18 5ZM13 8L5 8C3.34315 8 2 6.65685 2 5C2 3.34315 3.34315 2 5 2L13 2C14.6569 2 16 3.34315 16 5C16 6.65685 14.6569 8 13 8Z' fill='%23D1D5DB'/%3E%3C/svg%3E%0A");
|
|
959
|
+
background-repeat: no-repeat;
|
|
960
|
+
background-position: right var(--spacing-sm) center;
|
|
961
|
+
padding: var(--spacing-base) var(--spacing-xl) var(--spacing-base) var(--spacing-base);
|
|
962
|
+
margin: 0;
|
|
963
|
+
width: 100%;
|
|
964
|
+
height: 100%;
|
|
965
|
+
display: block;
|
|
966
|
+
min-height: 54px;
|
|
967
|
+
}
|
|
968
|
+
.tagify--mix .tagify__input::before {
|
|
969
|
+
height: auto;
|
|
970
|
+
display: none;
|
|
971
|
+
line-height: inherit;
|
|
972
|
+
}
|
|
973
|
+
.tagify--mix .tagify__input::after {
|
|
974
|
+
content: none;
|
|
975
|
+
}
|
|
976
|
+
.tagify--select::after {
|
|
977
|
+
content: '>';
|
|
978
|
+
opacity: 0.5;
|
|
979
|
+
position: absolute;
|
|
980
|
+
top: 50%;
|
|
981
|
+
right: 0;
|
|
982
|
+
bottom: 0;
|
|
983
|
+
font: 16px monospace;
|
|
984
|
+
line-height: 8px;
|
|
985
|
+
height: 8px;
|
|
986
|
+
pointer-events: none;
|
|
987
|
+
transform: translate(-150%, -50%) scaleX(1.2) rotate(90deg);
|
|
988
|
+
transition: 0.2s ease-in-out;
|
|
989
|
+
}
|
|
990
|
+
.tagify--select[aria-expanded='true']::after {
|
|
991
|
+
transform: translate(-150%, -50%) rotate(270deg) scaleY(1.2);
|
|
992
|
+
}
|
|
993
|
+
.tagify--select .tagify__tag {
|
|
994
|
+
position: absolute;
|
|
995
|
+
top: 0;
|
|
996
|
+
right: 1.8em;
|
|
997
|
+
bottom: 0;
|
|
998
|
+
}
|
|
999
|
+
.tagify--select .tagify__tag div {
|
|
1000
|
+
display: none;
|
|
1001
|
+
}
|
|
1002
|
+
.tagify--select .tagify__input {
|
|
1003
|
+
width: 100%;
|
|
1004
|
+
}
|
|
1005
|
+
.tagify--empty .tagify__input::before {
|
|
1006
|
+
transition: 0.2s ease-out;
|
|
1007
|
+
opacity: 1;
|
|
1008
|
+
transform: none;
|
|
1009
|
+
display: inline-block;
|
|
1010
|
+
width: auto;
|
|
1011
|
+
}
|
|
1012
|
+
.tagify--mix .tagify--empty .tagify__input::before {
|
|
1013
|
+
display: inline-block;
|
|
1014
|
+
}
|
|
1015
|
+
.tagify--focus {
|
|
1016
|
+
--tags-border-color: var(--tags-focus-border-color);
|
|
1017
|
+
transition: 0s;
|
|
1018
|
+
}
|
|
1019
|
+
.tagify--invalid {
|
|
1020
|
+
--tags-border-color: #d39494;
|
|
1021
|
+
}
|
|
1022
|
+
.tagify__dropdown {
|
|
1023
|
+
position: absolute;
|
|
1024
|
+
z-index: 9999;
|
|
1025
|
+
transform: translateY(1px);
|
|
1026
|
+
overflow: hidden;
|
|
1027
|
+
}
|
|
1028
|
+
.tagify__dropdown[placement='top'] {
|
|
1029
|
+
margin-top: 0;
|
|
1030
|
+
transform: translateY(-100%);
|
|
1031
|
+
}
|
|
1032
|
+
.tagify__dropdown[placement='top'] .tagify__dropdown__wrapper {
|
|
1033
|
+
border-top-width: 1.1px;
|
|
1034
|
+
border-bottom-width: 0;
|
|
1035
|
+
}
|
|
1036
|
+
.tagify__dropdown[position='text'] {
|
|
1037
|
+
box-shadow: 0 0 0 3px rgba(var(--tagify-dd-color-primary), 0.1);
|
|
1038
|
+
font-size: 0.9em;
|
|
1039
|
+
}
|
|
1040
|
+
.tagify__dropdown[position='text'] .tagify__dropdown__wrapper {
|
|
1041
|
+
border-width: 1px;
|
|
1042
|
+
}
|
|
1043
|
+
.tagify__dropdown__wrapper {
|
|
1044
|
+
max-height: 300px;
|
|
1045
|
+
overflow: auto;
|
|
1046
|
+
overflow-x: hidden;
|
|
1047
|
+
background: var(--tagify-dd-bg-color);
|
|
1048
|
+
border: 1px solid;
|
|
1049
|
+
border-color: var(--tagify-dd-color-primary);
|
|
1050
|
+
border-bottom-width: 1.5px;
|
|
1051
|
+
border-top-width: 0;
|
|
1052
|
+
box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 0.2);
|
|
1053
|
+
transition: 0.25s cubic-bezier(0, 1, 0.5, 1);
|
|
1054
|
+
}
|
|
1055
|
+
.tagify__dropdown__header:empty {
|
|
1056
|
+
display: none;
|
|
1057
|
+
}
|
|
1058
|
+
.tagify__dropdown__footer {
|
|
1059
|
+
display: inline-block;
|
|
1060
|
+
margin-top: 0.5em;
|
|
1061
|
+
padding: var(--tagify-dd-item-pad);
|
|
1062
|
+
font-size: 0.7em;
|
|
1063
|
+
font-style: italic;
|
|
1064
|
+
opacity: 0.5;
|
|
1065
|
+
}
|
|
1066
|
+
.tagify__dropdown__footer:empty {
|
|
1067
|
+
display: none;
|
|
1068
|
+
}
|
|
1069
|
+
.tagify__dropdown--initial .tagify__dropdown__wrapper {
|
|
1070
|
+
max-height: 20px;
|
|
1071
|
+
transform: translateY(-1em);
|
|
1072
|
+
}
|
|
1073
|
+
.tagify__dropdown--initial[placement='top'] .tagify__dropdown__wrapper {
|
|
1074
|
+
transform: translateY(2em);
|
|
1075
|
+
}
|
|
1076
|
+
.tagify__dropdown__item {
|
|
1077
|
+
box-sizing: border-box;
|
|
1078
|
+
padding: var(--tagify-dd-item-pad);
|
|
1079
|
+
margin: 1px;
|
|
1080
|
+
cursor: pointer;
|
|
1081
|
+
border-radius: 2px;
|
|
1082
|
+
position: relative;
|
|
1083
|
+
outline: 0;
|
|
1084
|
+
max-height: 60px;
|
|
1085
|
+
max-width: 100%;
|
|
1086
|
+
}
|
|
1087
|
+
.tagify__dropdown__item--active {
|
|
1088
|
+
background: var(--tagify-dd-color-primary);
|
|
1089
|
+
color: #fff;
|
|
1090
|
+
}
|
|
1091
|
+
.tagify__dropdown__item:active {
|
|
1092
|
+
filter: brightness(105%);
|
|
1093
|
+
}
|
|
1094
|
+
.tagify__dropdown__item--hidden {
|
|
1095
|
+
padding-top: 0;
|
|
1096
|
+
padding-bottom: 0;
|
|
1097
|
+
margin: 0 1px;
|
|
1098
|
+
pointer-events: none;
|
|
1099
|
+
overflow: hidden;
|
|
1100
|
+
max-height: 0;
|
|
1101
|
+
transition: var(--tagify-dd-item--hidden-duration, 0.3s) !important;
|
|
1102
|
+
}
|
|
1103
|
+
.tagify__dropdown__item--hidden > * {
|
|
1104
|
+
transform: translateY(-100%);
|
|
1105
|
+
opacity: 0;
|
|
1106
|
+
transition: inherit;
|
|
1107
|
+
}
|
|
1108
|
+
`;import{jsx as ye,jsxs as qo}from"@emotion/react/jsx-runtime";function $o({variable:e,onSubmit:r,onCancel:a}){var t,n,i,g,d,f,s,m,c;let{variables:o}=be();return ye(ai,{initialValues:{name:e,default:(n=(t=o[e])==null?void 0:t.default)!=null?n:"",displayName:(g=(i=o[e])==null?void 0:i.displayName)!=null?g:"",helpText:(f=(d=o[e])==null?void 0:d.helpText)!=null?f:"",order:(s=o[e])==null?void 0:s.order,type:(c=(m=o[e])==null?void 0:m.type)!=null?c:""},onSubmit:y=>{let P={...y,helpText:y.helpText||void 0,type:y.type||void 0,displayName:y.displayName||void 0};return r(P)},children:({getFieldProps:y})=>qo(oi,{css:Bo,children:[ye(gt,{...y("name"),label:"Name"}),ye(gt,{...y("helpText"),label:"Help Text",caption:"Appears in the composition data resource when entering a value for this variable.",autoComplete:"off"}),ye(gt,{...y("default"),label:"Default Value",autoComplete:"off"}),qo("div",{css:Ao,children:[ye(Oo,{type:"submit",children:"Save"}),ye(Oo,{type:"button",buttonType:"ghost",onClick:a,children:"cancel"})]})]})})}import{jsx as ni,jsxs as ii}from"@emotion/react/jsx-runtime";var Fo=xe.createContext(null);function bp({value:e,onChange:r,editVariableComponent:a,children:o}){let[t,n]=xe.useState(),i=a!=null?a:$o,g={dispatch:d=>{if(d.type==="set"){let{name:f,...s}=d.variable;r({...g.variables,[d.variable.name]:s}),d.openEditor&&n(d.variable.name)}else if(d.type==="edit")n(d.variable);else if(d.type==="remove"){let f={...e};delete f[d.variable],r(f)}else throw new Error(`Unknown event ${JSON.stringify(d)}`)},variables:e};return ii(Fo.Provider,{value:g,children:[o,typeof t!="undefined"?ni(i,{onSubmit:d=>{n(void 0);let{name:f,...s}=d;r({...e,[f]:s})},onCancel:()=>n(void 0),variable:t}):null]})}function be(){let e=xe.useContext(Fo);if(!e)throw new Error("No VariablesProvider present");return e}import{AddListButton as si,button as li,Icon as di,Table as ci,TableBody as pi,TableCellData as mt,TableCellHead as ft,TableHead as ui,TableRow as No}from"@uniformdev/design-system";import{css as vt}from"@emotion/react";import{Fragment as gi,jsx as U,jsxs as Fe}from"@emotion/react/jsx-runtime";function Tp(){let{variables:e,dispatch:r}=be(),a=zo(e);return Fe(gi,{children:[Fe(ci,{children:[U(ui,{children:Fe(No,{children:[U(ft,{children:"Name"}),U(ft,{children:"Default Value"}),U(ft,{})]})}),U(pi,{children:a.map(({name:o,displayName:t,default:n})=>{let i=t!=null?t:o;return Fe(No,{id:i,children:[U(mt,{children:U("button",{css:vt`
|
|
1109
|
+
border: none;
|
|
1110
|
+
color: var(--brand-secondary-5);
|
|
1111
|
+
font-weight: var(--fw-medium);
|
|
1112
|
+
padding: 0;
|
|
1113
|
+
background: none;
|
|
1114
|
+
overflow: hidden;
|
|
1115
|
+
text-overflow: ellipsis;
|
|
1116
|
+
white-space: nowrap;
|
|
1117
|
+
max-width: 20ch;
|
|
1118
|
+
`,type:"button",onClick:g=>{g.preventDefault(),r({type:"edit",variable:o})},title:i,children:i})}),U(mt,{children:U("span",{css:vt`
|
|
1119
|
+
overflow: hidden;
|
|
1120
|
+
text-overflow: ellipsis;
|
|
1121
|
+
white-space: nowrap;
|
|
1122
|
+
max-width: 20ch;
|
|
1123
|
+
`,title:n,children:n})}),U(mt,{align:"right",children:U("button",{type:"button",title:`delete ${i}`,css:[li,vt`
|
|
1124
|
+
background: transparent;
|
|
1125
|
+
`],"aria-controls":i,onClick:()=>r({type:"remove",variable:o}),children:U(di,{icon:"trash",iconColor:"red"})})})]},o)})})]}),U(si,{onButtonClick:()=>r({type:"edit",variable:""}),"aria-label":"Add variable",buttonText:"add variable",icon:"math-plus",css:{marginLeft:"var(--spacing-md)"}})]})}import*as z from"react";import mi from"@yaireo/tagify/dist/react.tagify";import{Global as fi}from"@emotion/react";import{Fragment as vi,jsx as Ko,jsxs as hi}from"@emotion/react/jsx-runtime";function Wo(e){return e.replace(/\${{.*?"value":"([^"]+)".*?}}/g,"${$1}").replace(/[\r\n]+/g,"")}function Qo({label:e,value:r,disableVariables:a,onChange:o}){let{variables:t,dispatch:n}=be(),i=z.useRef(t),g=z.useRef(n),d=z.useRef(o),f=z.useRef();z.useEffect(()=>{i.current=t},[t]),z.useEffect(()=>{g.current=n},[n]),z.useEffect(()=>{d.current=o},[o]),z.useEffect(()=>{var y,P,w;let c=Wo((P=(y=f.current)==null?void 0:y.getInputValue())!=null?P:"");r!==c&&((w=f.current)==null||w.loadOriginalValues(r))},[r]);let s=z.useCallback(c=>{d.current(Wo(c))},[]),m=z.useCallback(c=>{i.current[c]||g.current({type:"set",variable:{name:c,default:""},openEditor:!0})},[]);return hi(vi,{children:[Ko(fi,{styles:Ho}),Ko(mi,{tagifyRef:f,"aria-label":e,defaultValue:r,autoFocus:!1,whitelist:Object.entries(t).map(([c,y])=>{var P;return{name:(P=y.displayName)!=null?P:c,value:c}}),settings:{pattern:a?null:/\$/,enforceWhitelist:a,mixTagsInterpolator:["${","}"],duplicates:!0,tagTextProp:"name",dropdown:{position:"text",enabled:0,mapValueTo:c=>c.name,includeSelectedTags:!0,searchKeys:["name","value"],highlightFirst:!0}},InputMode:"textarea",onAdd:c=>{var P;let y=(P=c.detail.data)==null?void 0:P.value;y&&m(y)},onRemove:c=>{s(c.detail.tagify.getInputValue())},onChange:c=>{s(c.detail.value)},onInput:c=>{s(c.detail.tagify.getInputValue())}})]})}import xi from"@monaco-editor/react";import{InputSelect as wi}from"@uniformdev/design-system";import{useState as Si}from"react";import*as we from"react";import{jsx as yi}from"@emotion/react/jsx-runtime";var Zo=we.createContext(null);function Bp({value:e,onChange:r,children:a}){let o=we.useMemo(()=>({dispatch:t=>{if(t.type==="setRelativeUrl")r({...e,relativeUrl:t.relativeUrl,parameters:X(t.relativeUrl)});else if(t.type==="updateParameter"){let n=Yo(e.relativeUrl,i=>{let g=`${t.parameter.key}=${t.parameter.value}`;typeof t.index!="undefined"?i[t.index]=g:i.push(g)});r({...e,relativeUrl:n,parameters:X(n)})}else if(t.type==="removeParameter"){let n=Yo(e.relativeUrl,i=>{i.splice(t.index,1)});r({...e,relativeUrl:n,parameters:X(n)})}else if(t.type==="updateHeader"){let n=[...e.headers];typeof t.index!="undefined"?n[t.index]=t.header:n.push(t.header),r({...e,headers:n,parameters:X(e.relativeUrl)})}else if(t.type==="removeHeader"){let n=[...e.headers];n.splice(t.index,1),r({...e,headers:n,parameters:X(e.relativeUrl)})}else if(t.type==="setMethod")r({...e,method:t.method,parameters:X(e.relativeUrl)});else if(t.type==="setBody")r({...e,body:t.body,parameters:X(e.relativeUrl)});else throw new Error(`Unknown event ${JSON.stringify(t)}`)},request:{...e,parameters:X(e.relativeUrl)}}),[r,e]);return yi(Zo.Provider,{value:o,children:a})}function Y(){let e=we.useContext(Zo);if(!e)throw new Error("No RequestProvider present");return e}function Yo(e,r){let[a,o]=e.split("?"),t=a,n=(o!=null?o:"").split("&");return r(n),t+=`?${n.join("&")}`,t}function X(e){var r,a;return((a=(r=e.split("?")[1])==null?void 0:r.split("&").map(o=>{let[t,n]=o.split("=");return{key:t,value:n!=null?n:""}}))!=null?a:[]).filter(o=>o.key)}function Ap(e){let[r]=e.split("?");return[r,X(e)]}import{css as Xo}from"@emotion/react";var Ne=Xo`
|
|
1126
|
+
background: var(--white);
|
|
1127
|
+
`,Jo=e=>Xo`
|
|
1128
|
+
align-items: start;
|
|
1129
|
+
background: ${e};
|
|
1130
|
+
display: grid;
|
|
1131
|
+
grid-template-columns: 12ch 1fr;
|
|
1132
|
+
gap: var(--spacing-sm);
|
|
1133
|
+
`;import{jsx as bi}from"@emotion/react/jsx-runtime";var jo=({bgColor:e="transparent",children:r,...a})=>bi("div",{css:Jo(e),...a,children:r});import{css as ea}from"@emotion/react";import{jsx as yt,jsxs as Ci}from"@emotion/react/jsx-runtime";function jp(){let{request:e,dispatch:r}=Y(),[a,o]=Si("json");return Ci("div",{css:ea`
|
|
1134
|
+
background: var(--white);
|
|
1135
|
+
`,children:[yt(jo,{bgColor:"var(--gray-100)",css:ea`
|
|
1136
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
1137
|
+
`,children:yt(wi,{label:"Language",showLabel:!1,options:[{label:"Text",value:"plaintext"},{label:"JSON",value:"json"},{label:"YAML",value:"yaml"},{label:"JavaScript",value:"javascript"},{label:"XML",value:"xml"},{label:"HTML",value:"html"}],value:a,onChange:t=>{o(t.currentTarget.value)}})}),yt(xi,{height:200,value:e.body,language:a,options:{language:a,minimap:{enabled:!1},folding:!1},onChange:t=>{!t||r({type:"setBody",body:t})}})]})}import{Table as Ri,TableHead as Pi,TableRow as ta,TableCellHead as ra,TableBody as ki,TableCellData as oa,Input as aa}from"@uniformdev/design-system";import{jsx as J,jsxs as bt}from"@emotion/react/jsx-runtime";function nu({disableVariables:e}){let{dispatch:r,request:a}=Y(),o=[...a.headers,{key:"",value:""}];return J("div",{css:Ne,children:bt(Ri,{children:[J(Pi,{children:bt(ta,{children:[J(ra,{children:"Name"}),J(ra,{children:"Value"})]})}),J(ki,{children:o.map((t,n)=>bt(ta,{children:[J(oa,{width:"50%",children:J(aa,{label:t.key,value:t.key,showLabel:!1,onChange:i=>{i.currentTarget.value?r({type:"updateHeader",header:{key:i.currentTarget.value,value:t.value},index:n}):r({type:"removeHeader",index:n})}})}),J(oa,{width:"50%",children:t.key?J(aa,{showLabel:!1,label:t.value,value:t.value,onChange:i=>r({type:"updateHeader",header:{key:t.key,value:i.currentTarget.value},index:n})}):null})]},n))})]})})}import{InputSelect as Ti}from"@uniformdev/design-system";import{jsx as Li}from"@emotion/react/jsx-runtime";function uu(e){var o;let{request:r,dispatch:a}=Y();return Li(Ti,{...e,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"HEAD",value:"HEAD"}],value:(o=r.method)!=null?o:"GET",onChange:t=>a({type:"setMethod",method:t.currentTarget.value})})}import{Table as _i,TableHead as Ii,TableRow as na,TableCellHead as ia,TableBody as Vi,TableCellData as sa,Input as la}from"@uniformdev/design-system";import{jsx as j,jsxs as xt}from"@emotion/react/jsx-runtime";function yu({disableVariables:e}){let{dispatch:r,request:a}=Y(),o=[...a.parameters,{key:"",value:""}];return j("div",{css:Ne,children:xt(_i,{children:[j(Ii,{children:xt(na,{children:[j(ia,{children:"Name"}),j(ia,{children:"Value"})]})}),j(Vi,{children:o.map((t,n)=>xt(na,{children:[j(sa,{width:"50%",children:j(la,{label:t.key,value:t.key,showLabel:!1,onChange:i=>{i.currentTarget.value?r({type:"updateParameter",parameter:{key:i.currentTarget.value,value:t.value},index:n}):r({type:"removeParameter",index:n})}})}),j(sa,{width:"50%",children:t.key?j(la,{showLabel:!1,label:t.value,value:t.value,onChange:i=>r({type:"updateParameter",parameter:{key:t.key,value:i.currentTarget.value},index:n})}):null})]},n))})]})})}import{jsx as Ei}from"@emotion/react/jsx-runtime";function Pu(e){let{request:r,dispatch:a}=Y();return Ei(Qo,{...e,value:r.relativeUrl,onChange:o=>{let t=o;r.baseUrl&&t.startsWith(r.baseUrl)&&(t=t.substring(r.baseUrl.length)),a({type:"setRelativeUrl",relativeUrl:t})}})}export*from"@uniformdev/mesh-sdk";import{Button as Au,Callout as Hu,LoadingIndicator as Gu,LoadingOverlay as Ou,Menu as qu,MenuItem as $u,Input as Fu,InputSelect as Nu,InputToggle as Wu,Theme as Ku,InputKeywordSearch as Qu,Heading as Yu,ScrollableList as Zu,ScrollableListItem as Xu,Textarea as Ju,Switch as ju,Label as eg,AddListButton as tg}from"@uniformdev/design-system";export{tg as AddListButton,Au as Button,Hu as Callout,Yc as DamSelectedItem,Nr as DefaultSearchRow,zr as DefaultSelectedItem,no as EntrySearch,Yu as Heading,Je as Icons,Fu as Input,Nu as InputSelect,Wu as InputToggle,Qo as InputVariables,Qu as KeywordSearchInput,eg as Label,Gu as LoadingIndicator,Ou as LoadingOverlay,qu as Menu,$u as MenuItem,op as MeshApp,Zt as ProductPreviewList,$s as ProductQuery,Qt as ProductQueryContext,Ec as ProductSearch,Co as ProductSearchContext,fo as ProductSearchRow,So as ProductSelectedItem,jp as RequestBody,nu as RequestHeaders,uu as RequestMethodSelect,yu as RequestParameters,Bp as RequestProvider,jo as RequestTypeContainer,Pu as RequestUrlInput,zt as ResolvableLoadingValue,Zu as ScrollableList,Xu as ScrollableListItem,Ot as SelectionField,ju as Switch,Ju as Textarea,Ku as Theme,Vt as UniformMeshLocationContext,Ve as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,Oi as UniformMeshSdkContextProvider,$o as VariableEditor,Tp as VariablesList,bp as VariablesProvider,ot as badgeIcon,pt as damSelectItemImage,Ro as damSelectedItemContainer,To as damSelectedItemCopy,ko as damSelectedItemDetails,_o as damSelectedItemIcon,Do as damSelectedItemInfoBtn,Po as damSelectedItemInner,ct as damSelectedItemLinkBtn,Vo as damSelectedItemLinkContainer,Eo as damSelectedItemMediaContainer,Io as damSelectedItemPopover,$e as damSelectedItemPopoverLabel,ve as damSelectedItemSmallText,Lo as damSelectedItemTitle,Ap as decomposeRelativeUrl,eo as draggableContainer,rt as draggableIcon,ro as draggableIconOffset,to as draggableIconWrapper,Kr as entrySearchBtn,Yr as entrySearchConfig,Zr as entrySearchConfigHidden,Qr as entrySearchLoadMoreBtn,Xr as entrySearchResultList,Jr as entrySearchSelectIcon,jr as entrySearchSelectImg,Id as entrySearchSelectInput,Vd as entrySearchSelectOption,Wr as entrySearchWrapper,go as productSearchRowActiveIcon,po as productSearchRowCategory,io as productSearchRowContainer,so as productSearchRowContent,lo as productSearchRowContentActive,uo as productSearchRowDetails,co as productSearchRowTitle,ho as productSelectedItemContainer,bo as productSelectedItemContent,yo as productSelectedItemDetails,xo as productSelectedItemIcon,it as productSelectedItemImage,wo as productSelectedItemLinkContainer,st as productedSelectedItemLinkBtn,lt as productedSelectedItemSmallText,Or as searchRowBtn,Br as searchRowContainer,Hr as searchRowContainerActive,Ar as searchRowContainerWithPopover,Gr as searchRowPopover,tt as searchRowText,et as searchRowTextSmall,je as selectItemLinkBtn,Dr as selectItemLinkContainer,Er as selectItemPopover,Te as selectItemPopoverLabel,le as selectItemSmallText,kr as selectedItemContainer,_r as selectedItemCopy,Lr as selectedItemDetails,Vr as selectedItemIcon,Tr as selectedItemInner,Ir as selectedItemTitle,Dt as useInitializeUniformMeshSdk,cs as useMeshLocation,Yt as useProductQueryContext,qe as useProductSearchContext,Y as useRequest,ts as useUniformMeshLocation,Ee as useUniformMeshLocationContext,It as useUniformMeshSdk,_t as useUniformMeshSdkContext,be as useVariables,zo as variablesToList};
|