@devgateway/dvz-ui-react 1.7.16 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,9 +1,184 @@
1
- The MIT License (MIT)
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Copyright © 2025-present Development Gateway
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ 1. Definitions.
6
8
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
8
11
 
9
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and the Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and incorporated
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a
80
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
81
+ or a Contribution incorporated within the Work constitutes direct
82
+ or contributory patent infringement, then any patent licenses
83
+ granted to You under this License for that Work shall terminate
84
+ as of the date such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or in addition to the
115
+ NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, reproduce, modify,
120
+ prepare derivative works of, collect, publish, distribute,
121
+ sublicense, and/or sell copies of the Contribution, either alone
122
+ or combined with the Work.
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any warranties or conditions
142
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143
+ PARTICULAR PURPOSE. You are solely responsible for determining the
144
+ appropriateness of using or reproducing the Work and assume any
145
+ risks associated with Your exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (including but not limited to damages for loss of goodwill,
155
+ work stoppage, computer failure or malfunction, or all other
156
+ commercial damages or losses), even if such Contributor has been
157
+ advised of the possibility of such damages.
158
+
159
+ 9. Accepting Warranty or Liability. While redistributing the Work or
160
+ Derivative Works thereof, You may choose to offer, and charge a fee
161
+ for, acceptance of support, warranty, indemnity, or other liability
162
+ obligations and/or rights consistent with this License. However, in
163
+ accepting such obligations, You may offer such obligations only on
164
+ Your own behalf and on Your sole responsibility, not on behalf of
165
+ any other Contributor, and only if You agree to indemnify, defend,
166
+ and hold each Contributor harmless for any liability incurred by,
167
+ or claims asserted against, such Contributor by reason of your
168
+ accepting any warranty or additional liability.
169
+
170
+ END OF TERMS AND CONDITIONS
171
+
172
+ Copyright 2021-present Development Gateway
173
+
174
+ Licensed under the Apache License, Version 2.0 (the "License");
175
+ you may not use this file except in compliance with the License.
176
+ You may obtain a copy of the License at
177
+
178
+ http://www.apache.org/licenses/LICENSE-2.0
179
+
180
+ Unless required by applicable law or agreed to in writing, software
181
+ distributed under the License is distributed on an "AS IS" BASIS,
182
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
+ See the License for the specific language governing permissions and
184
+ limitations under the License.
package/README.md CHANGED
@@ -169,4 +169,4 @@ We welcome contributions! To get started:
169
169
 
170
170
  ## License
171
171
 
172
- MIT
172
+ Apache-2.0
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),j=require("react"),lt=require("react-intl"),ct=require("@nivo/line"),it=require("./Tooltip.js"),pe=require("d3-shape"),ot=require("@nivo/theming"),dt=require("../../layout/FlexWrapDetector.js"),V=require("../../utils/deviceType.js"),ht="#66676d",G="#f0f0f1",ye=["mobile","tablet","midTablet"].includes(V.default()),ge=V.default()==="mobile",be=["tablet","midTablet"].includes(V.default()),ut=(d,p)=>{const v=document.createElement("canvas").getContext("2d");return v.font=p,v.measureText(d).width},mt=({editing:d,previewMode:p,app:Y,legends:v,tooltip:k,tooltipEnabled:je,options:h,intl:D,groupMode:J,reverse:xt,marginLeft:ve,lineLabelPosition:Ee,marginTop:K,marginRight:Ne,marginBottom:Z,format:E,colors:pt,offsetY:Oe,height:Me,showLegends:P,legendPosition:u,tickRotation:y,offsetText:_,tickColor:w,legendLabel:Q,xLabelColor:N,colorGenerator:X,legendCheckBack:z,legendLabelBack:Te,legendLabelColor:C,highlightXAxisLine:ke,showTickLine:A,showRightAxis:De,valueScale:yt,enableArea:Ie,areaShadingCriteria:ee,areaLowerBound:te,areaUpperBound:ae,showPoints:$e,maxValue:Fe,fixedMinValue:B,fixedMaxValue:q,offsetBottom:Le,yAxisTickValues:Se,enableGridY:We,enableGridX:_e,overrideTickColor:H,offsetRight:we,selectedMeasures:ze,tooltipEnableMarkdown:Ae,minMaxClamp:Be,reverseLegend:qe,customAxisFormat:I,mobileCustomization:He,lineCurve:Re,customLabels:R,lineXAxisTickMode:se,lineXAxisTickCount:Ue,lineXAxisTickEvery:Ge})=>{var me,fe,xe;const c=JSON.parse(decodeURIComponent(He)),ne=ye&&((c==null?void 0:c.showCustomization)??!1),$=ne&&p!=="Desktop",F=!d&&ne,[re,Ve]=j.useState(50),[le,Ye]=j.useState(K),[gt,ce]=j.useState(0),[ie,Je]=j.useState(Z),[O,Ke]=j.useState([]),L=h.data.map(e=>({id:e.id,label:R&&R[e.id]?R[e.id]:e.label||e.id,color:X.getColor(e.id,e)})),oe=()=>(qe&&L.reverse(),n.jsx(n.Fragment,{children:P&&L.map((e,a)=>n.jsxs("div",{className:"legend item",onClick:()=>Qe(e.id),children:[n.jsx("input",{className:"ignore",type:"checkbox",checked:O.length===0||!O.includes(e.id),readOnly:!0,style:{backgroundColor:z===!0?e.color:"none",color:C}}),n.jsx("span",{className:z===!0?"checkmark-with-bg":"checkmark",style:{backgroundColor:z===!0?e.color:"transparent"}}),n.jsx("label",{style:{backgroundColor:Te===!0?e.color:"transparent",color:C},children:e.label})]},a))}));j.useEffect(()=>{(()=>{const l=5*Math.max(L.length-5,0);Ve(l)})()},[L]);const Ze={bottom:`-${re}px`},Pe={bottom:`-${re}px`,gap:"0px",top:"0px"},S=e=>O.length?e.filter(a=>O.indexOf(a.id)===-1):e,Qe=e=>{const a=O.slice();if(a.indexOf(e)>-1){const l=a.indexOf(e);a.splice(l,1)}else a.push(e);Ke(a)},Xe=e=>{const a=Object.assign({},e),l=ot.useTheme();($||F)&&he.includes(String(a.value))&&(a.value="");let t=[],s="";if($||F){const i=String(a.value).split(" ");let o=25;d&&p==="Mobile"||ge&&!d?o=(c==null?void 0:c.mobileMaxTickLength)??25:d&&p==="Tablet"||be&&!d?o=(c==null?void 0:c.tabletMaxTickLength)??25:window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches&&!d&&(o=15),i.forEach(g=>{s.length+String(g).length<=o?s+=(s?" ":"")+g:(t.push(s),s=g)}),s&&t.push(s)}else t=[a.value];let r=12;return d&&p==="Mobile"||ge&&!d?r=(c==null?void 0:c.mobileYAxisLineHeight)??12:(d&&p==="Tablet"||be&&!d)&&(r=(c==null?void 0:c.tabletYAxisLineHeight)??12),ut(a.value,"12px Roboto")+15,y>0&&y<180?n.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[A&&n.jsx("line",{stroke:H?w:G,strokeWidth:1.5,y1:-32,y2:-12}),n.jsx("g",{transform:`translate(0, ${e.y+_})`,children:t.map((i,o)=>n.jsx("text",{transform:`rotate(${y})`,textAnchor:"start",y:typeof e.value=="number"?0:o*r,dominantBaseline:"middle",style:{...l.axis.ticks.text,fill:N==="null"?"black":N,fontSize:"12px",fontFamily:"sans-serif"},children:i},i))})]}):y>180&&y<360?n.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[A&&n.jsx("line",{stroke:H?w:G,strokeWidth:1.5,y1:-32,y2:-12}),n.jsx("g",{transform:`translate(0, ${e.y+_})`,children:n.jsx("text",{transform:`rotate(${y})`,textAnchor:"end",dominantBaseline:"middle",style:{...l.axis.ticks.text,fill:N,fontSize:"12px"},children:a.value})})]}):n.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[A&&n.jsx("line",{stroke:H?w:G,strokeWidth:1.5,y1:-32,y2:-12}),n.jsx("g",{transform:`translate(0, ${e.y+_})`,children:t.map((i,o)=>n.jsx("text",{transform:`rotate(${y})`,textAnchor:"middle",y:typeof e.value=="number"?0:o*r,dominantBaseline:"middle",style:{...l.axis.ticks.text,fill:N==="null"?"black":N,fontSize:"12px",fontFamily:"sans-serif"},children:i},i))})]})},Ce=({series:e,xScale:a,yScale:l,innerHeight:t})=>{const s=e&&e.length>0?e[0].color:"#3daff7",r=[];e[0]&&e[0].data.forEach(x=>{Y=="csv"?h.keys.forEach(b=>{r.push({measure:b,min:x.data.variables[b]})}):ze.forEach(b=>{r.push({measure:b,min:x.data.variables[b]})})});const i=r.sort((x,b)=>x.min-b.min),o=ee=="CUSTOM_BETWEEN_TWO_LINES"&&te?te:i[0].measure,g=ee=="CUSTOM_BETWEEN_TWO_LINES"&&ae?ae:i[i.length-1].measure,rt=pe.area().x(x=>a(x.data.x)).y0(x=>l(x.data.variables[o])).y1(x=>l(x.data.variables[g]));return n.jsx(n.Fragment,{children:e&&e[0]&&n.jsx("path",{d:rt(e[0].data),fill:s,fillOpacity:.4})})},et=({series:e,xScale:a,yScale:l,innerHeight:t,innerWidth:s})=>{const r=[0,s],i=pe.line().x((o,g)=>g===0?-10:o).y(o=>l(0));return n.jsx(j.Fragment,{children:n.jsx("path",{d:i(r),fill:"none",stroke:ht,style:{pointerEvents:"none",strokeDasharray:"4 4"}})})},M=["grid","axes","lines","legends"];Ie&&M.push(Ce),$e&&(M.push("points"),M.push("mesh")),ke&&M.push(et);let T=[];S(h.data).forEach(e=>{e.data&&(T=[...T,...e.data.map(a=>a.y)])});const tt=()=>{if(J==="stacked"){const e=[];S(h.data).forEach(t=>{e.push(...t.data)});const l=[];e.forEach(t=>{l.indexOf(t.x)==-1&&l.push(t.x)}),f=Math.max(...l.map(t=>e.filter(s=>s.x==t).map(s=>s.y).reduce((s,r)=>Math.max(s+r,s+0)))),m=Math.min(...l.map(t=>e.filter(s=>s.x==t).map(s=>s.y).reduce((s,r)=>Math.min(s-r,r-s))))}else T.length>0&&(f=Math.max(...T),m=Math.min(...T));return f=f<0?f*.9:f*1.1,m=m>0?m*.9:m*1.1,{min:m,max:f}};let m="auto",f="auto";const W=tt();Fe=="fixed"?(m=B!=null&&B!=""?B:W.min,f=q!=null&&q!=""?q:W.max):(m=W.min,f=W.max);const de=()=>n.jsx(n.Fragment,{children:P&&Q&&n.jsx("div",{className:"legend item",children:n.jsx("label",{className:"legend-title",children:Q})})}),at={top:le,right:Ne,bottom:ie,left:ve};let U=parseInt(Se);const st=h.data&&((fe=(me=h.data)==null?void 0:me.filter(e=>{var a;return((a=e==null?void 0:e.data)==null?void 0:a.length)>0}))==null?void 0:fe.length),he=[];if($||F){U=Number.parseInt(c.yAxisTickValues);const e=new Map(Object.entries(((xe=c==null?void 0:c.labels)==null?void 0:xe.xAxis)??{}));for(const[a,l]of e)l||he.push(a)}const ue=S(h.data),nt=["grid","axes","legends"];if(h!=null&&h.data&&st>0){let e=S(h.data);const a=[];e.forEach(t=>{t&&Array.isArray(t.data)&&t.data.forEach(s=>{const r=s&&s.x;r!==void 0&&a.indexOf(r)===-1&&a.push(r)})});let l;if(se==="count"){const t=Math.max(1,parseInt(Ue));if(a.length>0&&t>0)if(a.length<=t)l=a.slice();else{const s=(a.length-1)/(t-1),r=new Array(t);for(let i=0;i<t;i++)r[i]=Math.floor(i*s);r[t-1]=a.length-1,l=r.map(i=>a[i])}}else if(se==="every"){const t=Math.max(1,parseInt(Ge));if(a.length>0){const s=[];for(let r=0;r<a.length;r++)r%t===0&&s.push(a[r]);s[s.length-1]!==a[a.length-1]&&s.push(a[a.length-1]),l=s}}return n.jsxs("div",{style:{height:Me},children:[n.jsx(ct.ResponsiveLine,{curve:Re,data:ue,margin:at,xScale:{type:"point"},yScale:{type:"linear",min:m,max:f,stacked:J=="stacked",reverse:!1,clamp:Be},layers:ue.length===0?nt:M,axisTop:null,axisRight:De?{tickSize:5,tickValues:U,tickPadding:5,tickRotation:0,legend:v.right,legendPosition:"middle",legendOffset:parseInt(we),format:t=>{const s=I||E;return D.formatNumber(s.style==="percent"?t/100:t,{...s})}}:null,enableGridY:We,enableGridX:_e,enablePointLabel:Ee==="top",pointLabel:t=>D.formatNumber(E.style==="percent"?t.yFormatted/100:t.yFormatted,E),lineWidth:3,colors:t=>X.getColor(t.id,t),axisBottom:($||F)&&(c==null?void 0:c.xAxisDisabled)===!0?null:{...l?{tickValues:l}:{},renderTick:Xe,legend:v.bottom,legendPosition:"middle",legendOffset:Number.parseInt(Le)},axisLeft:{tickSize:5,tickValues:U,tickPadding:5,tickRotation:0,legend:v.left,legendPosition:"middle",legendOffset:Number.parseInt(Oe),format:t=>{const s=I||E;return D.formatNumber(s.style==="percent"?t/100:t,{...s})}},tooltip:t=>je&&k&&k.trim().length>0?n.jsx(it.default,{intl:D,format:E,d:t,tooltip:k,tooltipEnableMarkdown:Ae}):null,pointSize:10,pointBorderWidth:2,pointBorderColor:{from:"serieColor"},useMesh:e.length>0&&e[0].data.length>0},new Date),(u==="top"||u==="bottom")&&n.jsx("div",{className:`legends container has-standard-12-font-size ${u}`,style:u==="top"?{marginTop:ye&&`${le}px`}:u==="bottom"?{marginBottom:`${ie}px`}:{},children:n.jsxs("div",{className:"legend-sections",children:[n.jsx("div",{className:"title-section",children:de()}),n.jsx(dt.default,{onWrapChange:t=>{if(u==="top"){const s=K+t/2*40;Ye(s),ce(t)}else Je(Z+t/2*25),ce(t)},className:"legends container has-standard-12-font-size items-section",children:oe()})]})}),(u==="right"||u==="left")&&n.jsxs("div",{className:`legends container has-standard-12-font-size ${u}`,style:u==="right"?Ze:Pe,children:[de(),oe()]})]})}return n.jsx("div",{})},ft=lt.injectIntl(mt);exports.default=ft;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),j=require("react"),lt=require("react-intl"),ct=require("@nivo/line"),it=require("./Tooltip.js"),pe=require("d3-shape"),ot=require("@nivo/theming"),dt=require("../../layout/FlexWrapDetector.js"),V=require("../../utils/deviceType.js"),ht="#66676d",G="#f0f0f1",ye=["mobile","tablet","midTablet"].includes(V.default()),ge=V.default()==="mobile",be=["tablet","midTablet"].includes(V.default()),ut=(d,p)=>{const v=document.createElement("canvas").getContext("2d");return v.font=p,v.measureText(d).width},mt=({editing:d,previewMode:p,app:Y,legends:v,tooltip:k,tooltipEnabled:je,options:h,intl:D,groupMode:J,reverse:xt,marginLeft:ve,lineLabelPosition:Ee,marginTop:K,marginRight:Ne,marginBottom:Z,format:E,colors:pt,offsetY:Oe,height:Me,showLegends:P,legendPosition:u,tickRotation:y,offsetText:_,tickColor:w,legendLabel:Q,xLabelColor:N,colorGenerator:X,legendCheckBack:z,legendLabelBack:Te,legendLabelColor:C,highlightXAxisLine:ke,showTickLine:A,showRightAxis:De,valueScale:yt,enableArea:Ie,areaShadingCriteria:ee,areaLowerBound:te,areaUpperBound:ae,showPoints:$e,maxValue:Fe,fixedMinValue:B,fixedMaxValue:q,offsetBottom:Le,yAxisTickValues:Se,enableGridY:We,enableGridX:_e,overrideTickColor:H,offsetRight:we,selectedMeasures:ze,tooltipEnableMarkdown:Ae,minMaxClamp:Be,reverseLegend:qe,customAxisFormat:I,mobileCustomization:He,lineCurve:Re,customLabels:R,lineXAxisTickMode:se,lineXAxisTickCount:Ue,lineXAxisTickEvery:Ge})=>{var me,fe,xe;const c=JSON.parse(decodeURIComponent(He)),ne=ye&&((c==null?void 0:c.showCustomization)??!1),$=ne&&p!=="Desktop",F=!d&&ne,[re,Ve]=j.useState(50),[le,Ye]=j.useState(K),[gt,ce]=j.useState(0),[ie,Je]=j.useState(Z),[O,Ke]=j.useState([]),L=h.data.map(e=>({id:e.id,label:R&&R[e.id]?R[e.id]:e.label||e.id,color:X.getColor(e.id,e)})),oe=()=>(qe&&L.reverse(),n.jsx(n.Fragment,{children:P&&L.map((e,a)=>n.jsxs("div",{className:"legend item",onClick:()=>Qe(e.id),children:[n.jsx("input",{className:"ignore",type:"checkbox",checked:O.length===0||!O.includes(e.id),readOnly:!0,style:{backgroundColor:z===!0?e.color:"none",color:C}}),n.jsx("span",{className:z===!0?"checkmark-with-bg":"checkmark",style:{backgroundColor:z===!0?e.color:"transparent"}}),n.jsx("label",{style:{backgroundColor:Te===!0?e.color:"transparent",color:C},children:e.label})]},a))}));j.useEffect(()=>{(()=>{const l=5*Math.max(L.length-5,0);Ve(l)})()},[L]);const Ze={bottom:`-${re}px`},Pe={bottom:`-${re}px`,gap:"0px",top:"0px"},S=e=>O.length?e.filter(a=>O.indexOf(a.id)===-1):e,Qe=e=>{const a=O.slice();if(a.indexOf(e)>-1){const l=a.indexOf(e);a.splice(l,1)}else a.push(e);Ke(a)},Xe=e=>{const a=Object.assign({},e),l=ot.useTheme();($||F)&&he.includes(String(a.value))&&(a.value="");let t=[],s="";if($||F){const i=String(a.value).split(" ");let o=25;d&&p==="Mobile"||ge&&!d?o=(c==null?void 0:c.mobileMaxTickLength)??25:d&&p==="Tablet"||be&&!d?o=(c==null?void 0:c.tabletMaxTickLength)??25:window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches&&!d&&(o=15),i.forEach(g=>{s.length+String(g).length<=o?s+=(s?" ":"")+g:(t.push(s),s=g)}),s&&t.push(s)}else t=[a.value];let r=12;return d&&p==="Mobile"||ge&&!d?r=(c==null?void 0:c.mobileYAxisLineHeight)??12:(d&&p==="Tablet"||be&&!d)&&(r=(c==null?void 0:c.tabletYAxisLineHeight)??12),ut(a.value,"12px Roboto")+15,y>0&&y<180?n.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[A&&n.jsx("line",{stroke:H?w:G,strokeWidth:1.5,y1:-32,y2:-12}),n.jsx("g",{transform:`translate(0, ${e.y+_})`,children:t.map((i,o)=>n.jsx("text",{transform:`rotate(${y})`,textAnchor:"start",y:typeof e.value=="number"?0:o*r,dominantBaseline:"middle",style:{...l.axis.ticks.text,fill:N==="null"?"black":N,fontSize:"12px",fontFamily:"sans-serif"},children:i},i))})]}):y>180&&y<360?n.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[A&&n.jsx("line",{stroke:H?w:G,strokeWidth:1.5,y1:-32,y2:-12}),n.jsx("g",{transform:`translate(0, ${e.y+_})`,children:n.jsx("text",{transform:`rotate(${y})`,textAnchor:"end",dominantBaseline:"middle",style:{...l.axis.ticks.text,fill:N,fontSize:"12px"},children:a.value})})]}):n.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[A&&n.jsx("line",{stroke:H?w:G,strokeWidth:1.5,y1:-32,y2:-12}),n.jsx("g",{transform:`translate(0, ${e.y+_})`,children:t.map((i,o)=>n.jsx("text",{transform:`rotate(${y})`,textAnchor:"middle",y:typeof e.value=="number"?0:o*r,dominantBaseline:"middle",style:{...l.axis.ticks.text,fill:N==="null"?"black":N,fontSize:"12px",fontFamily:"sans-serif"},children:i},i))})]})},Ce=({series:e,xScale:a,yScale:l,innerHeight:t})=>{const s=e&&e.length>0?e[0].color:"#3daff7",r=[];e[0]&&e[0].data.forEach(x=>{Y=="csv"?h.keys.forEach(b=>{r.push({measure:b,min:x.data.variables[b]})}):ze.forEach(b=>{r.push({measure:b,min:x.data.variables[b]})})});const i=r.sort((x,b)=>x.min-b.min),o=ee=="CUSTOM_BETWEEN_TWO_LINES"&&te?te:i[0].measure,g=ee=="CUSTOM_BETWEEN_TWO_LINES"&&ae?ae:i[i.length-1].measure,rt=pe.area().x(x=>a(x.data.x)).y0(x=>l(x.data.variables[o])).y1(x=>l(x.data.variables[g]));return n.jsx(n.Fragment,{children:e&&e[0]&&n.jsx("path",{d:rt(e[0].data),fill:s,fillOpacity:.4})})},et=({series:e,xScale:a,yScale:l,innerHeight:t,innerWidth:s})=>{const r=[0,s],i=pe.line().x((o,g)=>g===0?-10:o).y(o=>l(0));return n.jsx(j.Fragment,{children:n.jsx("path",{d:i(r),fill:"none",stroke:ht,style:{pointerEvents:"none",strokeDasharray:"4 4"}})})},M=["grid","axes","lines","legends"];Ie&&M.push(Ce),$e&&(M.push("points"),M.push("mesh")),ke&&M.push(et);let T=[];S(h.data).forEach(e=>{e.data&&(T=[...T,...e.data.map(a=>a.y)])});const tt=()=>{if(J==="stacked"){const e=[];S(h.data).forEach(t=>{e.push(...t.data)});const l=[];e.forEach(t=>{l.indexOf(t.x)==-1&&l.push(t.x)}),f=Math.max(...l.map(t=>e.filter(s=>s.x==t).map(s=>s.y).reduce((s,r)=>Math.max(s+r,s+0)))),m=Math.min(...l.map(t=>e.filter(s=>s.x==t).map(s=>s.y).reduce((s,r)=>Math.min(s-r,r-s))))}else T.length>0&&(f=Math.max(...T),m=Math.min(...T));return f=f<0?f*.9:f*1.1,m=m>0?m*.9:m*1.1,{min:m,max:f}};let m="auto",f="auto";const W=tt();Fe=="fixed"?(m=B!=null&&B!=""?B:W.min,f=q!=null&&q!=""?q:W.max):(m=W.min,f=W.max);const de=()=>n.jsx(n.Fragment,{children:P&&Q&&n.jsx("div",{className:"legend item",children:n.jsx("label",{className:"legend-title",children:Q})})}),at={top:le,right:Ne,bottom:ie,left:ve};let U=parseInt(Se);const st=h.data&&((fe=(me=h.data)==null?void 0:me.filter(e=>{var a;return((a=e==null?void 0:e.data)==null?void 0:a.length)>0}))==null?void 0:fe.length),he=[];if($||F){U=Number.parseInt(c.yAxisTickValues);const e=new Map(Object.entries(((xe=c==null?void 0:c.labels)==null?void 0:xe.xAxis)??{}));for(const[a,l]of e)l||he.push(a)}const ue=S(h.data),nt=["grid","axes","legends"];if(h!=null&&h.data&&st>0){let e=S(h.data);const a=[];e.forEach(t=>{t&&Array.isArray(t.data)&&t.data.forEach(s=>{const r=s&&s.x;r!==void 0&&a.indexOf(r)===-1&&a.push(r)})});let l;if(se==="count"){const t=Math.max(1,parseInt(Ue));if(a.length>0&&t>0)if(a.length<=t)l=a.slice();else{const s=(a.length-1)/(t-1),r=new Array(t);for(let i=0;i<t;i++)r[i]=Math.floor(i*s);r[t-1]=a.length-1,l=r.map(i=>a[i])}}else if(se==="every"){const t=Math.max(1,parseInt(Ge));if(a.length>0){const s=[];for(let r=0;r<a.length;r++)r%t===0&&s.push(a[r]);s[s.length-1]!==a[a.length-1]&&s.push(a[a.length-1]),l=s}}return n.jsxs("div",{style:{height:Me},children:[n.jsx(ct.ResponsiveLine,{curve:Re,data:ue,margin:at,xScale:{type:"point"},yScale:{type:"linear",min:m,max:f,stacked:J=="stacked",reverse:!1,clamp:Be},layers:ue.length===0?nt:M,axisTop:null,axisRight:De?{tickSize:5,tickValues:U,tickPadding:5,tickRotation:0,legend:v.right,legendPosition:"middle",legendOffset:parseInt(we),format:t=>{const s=I||E;return D.formatNumber(s.style==="percent"?t/100:t,{...s})}}:null,enableGridY:We,enableGridX:_e,enablePointLabel:Ee==="top",pointLabel:t=>D.formatNumber(E.style==="percent"?t.data.yFormatted/100:t.data.yFormatted,E),lineWidth:3,colors:t=>X.getColor(t.id,t),axisBottom:($||F)&&(c==null?void 0:c.xAxisDisabled)===!0?null:{...l?{tickValues:l}:{},renderTick:Xe,legend:v.bottom,legendPosition:"middle",legendOffset:Number.parseInt(Le)},axisLeft:{tickSize:5,tickValues:U,tickPadding:5,tickRotation:0,legend:v.left,legendPosition:"middle",legendOffset:Number.parseInt(Oe),format:t=>{const s=I||E;return D.formatNumber(s.style==="percent"?t/100:t,{...s})}},tooltip:t=>je&&k&&k.trim().length>0?n.jsx(it.default,{intl:D,format:E,d:t,tooltip:k,tooltipEnableMarkdown:Ae}):null,pointSize:10,pointBorderWidth:2,pointBorderColor:{from:"serieColor"},useMesh:e.length>0&&e[0].data.length>0},new Date),(u==="top"||u==="bottom")&&n.jsx("div",{className:`legends container has-standard-12-font-size ${u}`,style:u==="top"?{marginTop:ye&&`${le}px`}:u==="bottom"?{marginBottom:`${ie}px`}:{},children:n.jsxs("div",{className:"legend-sections",children:[n.jsx("div",{className:"title-section",children:de()}),n.jsx(dt.default,{onWrapChange:t=>{if(u==="top"){const s=K+t/2*40;Ye(s),ce(t)}else Je(Z+t/2*25),ce(t)},className:"legends container has-standard-12-font-size items-section",children:oe()})]})}),(u==="right"||u==="left")&&n.jsxs("div",{className:`legends container has-standard-12-font-size ${u}`,style:u==="right"?Ze:Pe,children:[de(),oe()]})]})}return n.jsx("div",{})},ft=lt.injectIntl(mt);exports.default=ft;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),c=require("react"),D=require("./PostsFilterDropdown.js"),E=require("../../conf/index.js"),F=u=>{const{taxonomy:n,group:p,placeholder:f,allLabel:d,noneLabel:g,useSingleColumn:y,enableTextSearch:m,filterType:S,showNoDataOption:h,closeOnSelect:x,allNoneSameBehaviour:O,autoApply:P,alphabeticalSort:v,ascOrder:A,type:T,categories:a,onChange:b,wpApiBase:t,locale:s,...w}=u,[B,e]=c.useState([]),C=async()=>{if(!n||n==="none"){e([]);return}const _=t!=null&&t!==""?t:E.Config.REACT_APP_WP_API,j=s?`?lang=${s}`:"?lang=en",l=await(await fetch(_+"/wp/v2/"+n+j)).json();if(l){const r=l.map(o=>({key:o.id,value:o.id,text:o.name}));if(a){const o=r.filter(q=>a.indexOf(q.value.toString())>-1);e([]),e(o)}else e([]),e(r)}};return c.useEffect(()=>{let i=!1;return i||(e([]),C()),()=>{i=!0}},[T,n,a,t,s]),R.jsx(D.default,{...w,group:p,placeholder:f,allLabel:d,noneLabel:g,useSingleColumn:y,enableTextSearch:m,filterType:S,showNoDataOption:h,closeOnSelect:x,allNoneSameBehaviour:O,autoApply:P,alphabeticalSort:v,ascOrder:A,options:B,onChange:b})};exports.default=F;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),u=require("react"),D=require("./PostsFilterDropdown.js"),E=require("../../conf/index.js"),F=p=>{const{taxonomy:n,group:f,placeholder:d,allLabel:g,noneLabel:m,useSingleColumn:y,enableTextSearch:b,filterType:h,showNoDataOption:x,closeOnSelect:O,allNoneSameBehaviour:P,autoApply:S,alphabeticalSort:v,ascOrder:A,type:N,categories:s,onChange:T,wpApiBase:t,locale:r,...w}=p,[B,e]=u.useState([]),C=async()=>{if(!n||n==="none"){e([]);return}const _=t!=null&&t!==""?t:E.Config.REACT_APP_WP_API,j=r?`?lang=${r}`:"?lang=en",l=await(await fetch(_+"/wp/v2/"+n+j)).json();if(l){const c=l.map(o=>({key:o.id,value:o.id,text:o.name}));if(s){const o=s.map(a=>Number(a)).filter(a=>!Number.isNaN(a)),q=c.filter(a=>o.indexOf(Number(a.value))>-1);e([]),e(q)}else e([]),e(c)}};return u.useEffect(()=>{let i=!1;return i||(e([]),C()),()=>{i=!0}},[N,n,s,t,r]),R.jsx(D.default,{...w,group:f,placeholder:d,allLabel:g,noneLabel:m,useSingleColumn:y,enableTextSearch:b,filterType:h,showNoDataOption:x,closeOnSelect:O,allNoneSameBehaviour:P,autoApply:S,alphabeticalSort:v,ascOrder:A,options:B,onChange:T})};exports.default=F;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),i=require("react"),ce=require("semantic-ui-react"),s=require("../../utils/data.js"),ue=require("../../redux/hooks.js"),ye=require("react-redux"),pe=require("./CategoricalFilter.js"),de=require("./YearFilter.js"),R=require("react-intl"),Fe=q=>{const{"data-alphabetical-sort":v,"data-asc-order":M,"data-group":c,"data-placeholder":C,"data-all-label":T,"data-none-label":b,"data-use-single-column":j,"data-enable-text-search":D,"data-filter-type":d,"data-show-no-data-option":P,"data-close-on-select":z,"data-all-none-same-behaviour":J,"data-auto-apply":K,"data-taxonomy":u,"data-categories":F="[]","data-is-country-filter":U,"data-is-year-filter":k,"data-type":$,"data-sort-first-by":B,"data-default-values":G="[]","data-wordpress-source-type":me,"data-wordpress-source":O,editing:x=!1}=q,p=ue.useAppDispatch(),{locale:H}=R.useIntl(),t=ye.useSelector(e=>e.getIn(["data","posts",c]))||{},a=d==="multi-select",[N,fe]=i.useState(0),V=e=>x?e:decodeURIComponent(e),A=e=>{try{return JSON.parse(V(e))}catch(o){return console.warn("JSON parsing failed for value:",e,"- treating as plain string. Error:",o),V(e)}};let l=A(G);l||(l=[]),typeof l=="string"&&(l=l.split(",").map(Number)),typeof l=="number"&&(l=[l]);const Q=s.toBoolean(v),W=s.toBoolean(M),I=s.toBoolean(P),_=s.toBoolean(z),w=s.toBoolean(J),Y=s.toBoolean(K),r=s.toBoolean(U),n=s.toBoolean(k),E=s.toBoolean(j),L=s.toBoolean(D),g=B!=="none"?s.toNumber(B):null,[y,X]=i.useState([]),[m,Z]=i.useState(!1),S=(e,o)=>o?Array.isArray(e)?e:e!=null?[e]:[]:e||void 0,ee=i.useMemo(()=>S(t.countryFilter,a),[t.countryFilter,a]),te=i.useMemo(()=>S(t.categoryFilter,a),[t.categoryFilter,a]),re=i.useMemo(()=>n?S(t.yearFilter,a):void 0,[t.yearFilter,a,n]),f=i.useMemo(()=>{if(!F)return[];const e=A(F);return Array.isArray(e)?e:typeof e=="string"||typeof e=="number"?e.toString().split(",").filter(Boolean):[]},[F,x]),oe=e=>{p({type:"SET_POSTS_FILTER",group:c,...t,isYearFilter:n,yearFilter:n?e:null,isCountryFilter:r,categoryFilter:t.categoryFilter,countryFilter:t.countryFilter,sortFirstBy:g})},ae=e=>{p({type:"SET_POSTS_FILTER",group:c,...t,categoryFilter:r?t.categoryFilter:e,countryFilter:r?e:t.countryFilter,isYearFilter:t.isYearFilter,yearFilter:t.yearFilter,isCountryFilter:t.isCountryFilter,sortFirstBy:r?g:t.sortFirstBy,countryCategory:r?u:t.countryCategory,categoryCategory:r?t.categoryCategory:e,categoryTaxonomy:r?t.categoryTaxonomy:u,countryTaxonomy:r?u:t.countryTaxonomy})};return i.useEffect(()=>{const e=l.length>0,o=a?l:l[0],le=r?t.categoryFilter:e?o:a?f.map(Number):t.categoryFilter,ne=r?e?o:a?f.map(Number):t.countryFilter:t.countryFilter,se=n&&a?y.length>0?y.map(ie=>ie.value):[]:t.yearFilter;p({type:"SET_INITIAL_POSTS_FILTER",group:c,categoryFilter:le,countryFilter:ne,isYearFilter:n,isCountryFilter:r,sortFirstBy:g,yearFilter:n?se:null,categoryCategory:r?null:t.categoryCategory,categoryTaxonomy:r?null:u,countryCategory:r?u:null,countryTaxonomy:r?u:null,page:1})},[]),i.useEffect(()=>{if(n&&!m&&a&&y.length>0){const e=y.map(o=>o.value);p({type:"SET_INITIAL_POSTS_FILTER",group:c,isYearFilter:n,yearFilter:e})}},[m]),h.jsxs(ce.Container,{fluid:!0,className:"filter post-filter",children:[n&&h.jsx(de.default,{group:c,placeholder:C,allLabel:T,noneLabel:b,useSingleColumn:E,enableTextSearch:L,filterType:d,showNoDataOption:I,closeOnSelect:_,allNoneSameBehaviour:w,autoApply:Y,alphabeticalSort:Q,ascOrder:W,options:y,value:re,yearOptions:y,setYearOptions:X,yearFilterLoading:m,setYearFilterLoading:Z,onChange:(e,o)=>{oe(o)},resetKey:N,wpApiBase:O??void 0}),!n&&h.jsx(pe.default,{group:c,placeholder:C,allLabel:T,noneLabel:b,useSingleColumn:E,enableTextSearch:L,filterType:d,showNoDataOption:I,closeOnSelect:_,allNoneSameBehaviour:w,autoApply:Y,taxonomy:u,type:$,value:r?ee:te,onChange:(e,o)=>{ae(o)},categories:f,resetKey:N,wpApiBase:O??void 0,locale:H},`cat-${c}`)]})},ge=R.injectIntl(i.memo(Fe));exports.default=ge;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react/jsx-runtime"),i=require("react"),ue=require("semantic-ui-react"),s=require("../../utils/data.js"),ye=require("../../redux/hooks.js"),pe=require("react-redux"),de=require("./CategoricalFilter.js"),Fe=require("./YearFilter.js"),v=require("react-intl"),ge=M=>{const{"data-alphabetical-sort":j,"data-asc-order":D,"data-group":c,"data-placeholder":h,"data-all-label":T,"data-none-label":C,"data-use-single-column":P,"data-enable-text-search":z,"data-filter-type":d,"data-show-no-data-option":J,"data-close-on-select":K,"data-all-none-same-behaviour":U,"data-auto-apply":k,"data-taxonomy":u,"data-categories":F="[]","data-is-country-filter":$,"data-is-year-filter":G,"data-type":H,"data-sort-first-by":b,"data-default-values":Q="[]","data-wordpress-source-type":Se,"data-wordpress-source":B,editing:O=!1}=M,p=ye.useAppDispatch(),{locale:W}=v.useIntl(),t=pe.useSelector(e=>e.getIn(["data","posts",c]))||{},a=d==="multi-select",[x,he]=i.useState(0),V=e=>O?e:decodeURIComponent(e),N=e=>{try{return JSON.parse(V(e))}catch(o){return console.warn("JSON parsing failed for value:",e,"- treating as plain string. Error:",o),V(e)}};let l=N(Q);l||(l=[]),typeof l=="string"&&(l=l.split(",").map(Number)),typeof l=="number"&&(l=[l]);const X=s.toBoolean(j),Z=s.toBoolean(D),A=s.toBoolean(J),I=s.toBoolean(K),_=s.toBoolean(U),w=s.toBoolean(k),r=s.toBoolean($),n=s.toBoolean(G),Y=s.toBoolean(P),E=s.toBoolean(z),g=b!=="none"?s.toNumber(b):null,[y,ee]=i.useState([]),[m,te]=i.useState(!1),S=(e,o)=>o?Array.isArray(e)?e:e!=null?[e]:[]:e||void 0,re=i.useMemo(()=>S(t.countryFilter,a),[t.countryFilter,a]),oe=i.useMemo(()=>S(t.categoryFilter,a),[t.categoryFilter,a]),ae=i.useMemo(()=>n?S(t.yearFilter,a):void 0,[t.yearFilter,a,n]),L=i.useMemo(()=>{if(!F)return[];const e=N(F);return Array.isArray(e)?e:typeof e=="string"||typeof e=="number"?e.toString().split(",").filter(o=>o.trim()!==""):[]},[F,O]),le=e=>{p({type:"SET_POSTS_FILTER",group:c,...t,isYearFilter:n,yearFilter:n?e:null,isCountryFilter:r,categoryFilter:t.categoryFilter,countryFilter:t.countryFilter,sortFirstBy:g})},ne=e=>{p({type:"SET_POSTS_FILTER",group:c,...t,categoryFilter:r?t.categoryFilter:e,countryFilter:r?e:t.countryFilter,isYearFilter:t.isYearFilter,yearFilter:t.yearFilter,isCountryFilter:t.isCountryFilter,sortFirstBy:r?g:t.sortFirstBy,countryCategory:r?u:t.countryCategory,categoryCategory:r?t.categoryCategory:e,categoryTaxonomy:r?t.categoryTaxonomy:u,countryTaxonomy:r?u:t.countryTaxonomy})};return i.useEffect(()=>{const e=l.length>0,o=a?l:l[0],R=L.map(Number),q=r?t.categoryFilter:e?o:a?R:t.categoryFilter,se=r?e?o:a?R:t.countryFilter:t.countryFilter,ie=n&&a?y.length>0?y.map(ce=>ce.value):[]:t.yearFilter;p({type:"SET_INITIAL_POSTS_FILTER",group:c,categoryFilter:q,countryFilter:se,isYearFilter:n,isCountryFilter:r,sortFirstBy:g,yearFilter:n?ie:null,categoryCategory:r?null:q,categoryTaxonomy:r?null:u,countryCategory:r?u:null,countryTaxonomy:r?u:null,page:1})},[]),i.useEffect(()=>{if(n&&!m&&a&&y.length>0){const e=y.map(o=>o.value);p({type:"SET_INITIAL_POSTS_FILTER",group:c,isYearFilter:n,yearFilter:e})}},[m]),f.jsxs(ue.Container,{fluid:!0,className:"filter post-filter",children:[n&&f.jsx(Fe.default,{group:c,placeholder:h,allLabel:T,noneLabel:C,useSingleColumn:Y,enableTextSearch:E,filterType:d,showNoDataOption:A,closeOnSelect:I,allNoneSameBehaviour:_,autoApply:w,alphabeticalSort:X,ascOrder:Z,options:y,value:ae,yearOptions:y,setYearOptions:ee,yearFilterLoading:m,setYearFilterLoading:te,onChange:(e,o)=>{le(o)},resetKey:x,wpApiBase:B??void 0}),!n&&f.jsx(de.default,{group:c,placeholder:h,allLabel:T,noneLabel:C,useSingleColumn:Y,enableTextSearch:E,filterType:d,showNoDataOption:A,closeOnSelect:I,allNoneSameBehaviour:_,autoApply:w,taxonomy:u,type:H,value:r?re:oe,onChange:(e,o)=>{ne(o)},categories:L,resetKey:x,wpApiBase:B??void 0,locale:W},`cat-${c}`)]})},me=v.injectIntl(i.memo(ge));exports.default=me;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),d=require("react"),i=require("react-redux"),o=require("semantic-ui-react"),p=require("lodash.isequal"),I=require("react-intl"),g=l=>{const{"data-group":n,"data-reset-label":c="Reset All Filters"}=l,u=i.useDispatch(),r=i.useSelector(a=>a.getIn(["data","posts",n])),t=i.useSelector(a=>a.getIn(["data","posts","initialFilters",n])),e=d.useMemo(()=>r&&t?!p(r,t):!1,[r,t]);return s.jsxs(o.Container,{fluid:!0,style:{pointerEvents:e?"auto":"none",cursor:e?"pointer":"not-allowed",opacity:e?1:.5},className:`data-filters-reset ignore ${e?"":"disabled"}`,onClick:()=>{u({type:"SET_INITIAL_POSTS_FILTER",group:n,...t,reset:!0,page:1})},children:[s.jsx("span",{children:c}),s.jsx("span",{children:s.jsx(o.Icon,{disabled:!e,name:"undo alternate",className:"custom-undo-icon"})})]})},m=I.injectIntl(g);exports.default=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),p=require("react"),l=require("react-redux"),d=require("semantic-ui-react"),f=require("lodash.isequal"),g=require("react-intl"),a=e=>e==null?e:Array.isArray(e)?[...e].map(a).sort((t,r)=>{const i=JSON.stringify(t),s=JSON.stringify(r);return i<s?-1:i>s?1:0}):typeof e=="object"?Object.keys(e).sort().reduce((t,r)=>(t[r]=a(e[r]),t),{}):typeof e=="number"||typeof e=="string"?String(e):e,m=e=>{const{"data-group":t,"data-reset-label":r="Reset All Filters"}=e,i=l.useDispatch(),s=l.useSelector(u=>u.getIn(["data","posts",t])),o=l.useSelector(u=>u.getIn(["data","posts","initialFilters",t])),n=p.useMemo(()=>s&&o?!f(a(s),a(o)):!1,[s,o]);return c.jsxs(d.Container,{fluid:!0,style:{pointerEvents:n?"auto":"none",cursor:n?"pointer":"not-allowed",opacity:n?1:.5},className:`data-filters-reset ignore ${n?"":"disabled"}`,onClick:()=>{i({type:"SET_INITIAL_POSTS_FILTER",group:t,...o,reset:!0,page:1})},children:[c.jsx("span",{children:r}),c.jsx("span",{children:c.jsx(d.Icon,{disabled:!n,name:"undo alternate",className:"custom-undo-icon"})})]})},y=g.injectIntl(m);exports.default=y;
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("semantic-ui-react"),i=require("react"),h=require("@devgateway/wp-react-lib"),C=require("react-intl"),L=require("react-router"),T=require("./SearchControl.js"),$=require("./LangSwitcher.js"),k=(n,r)=>{const c=[];return n.items.forEach(l=>{l.child_items?l.child_items.forEach(a=>{a.slug==r.slug&&(c.push(l),c.push(a))}):l.slug==r.slug&&l.url!="/"&&c.push(l)}),c},E=(n,r)=>{if(n){const c=n.indexOf("/wp");if(c!==-1){const l=n.substr(c+3);return l.startsWith("/"+r)?l:"/"+r+l}else return n.startsWith("/"+r)?n:"/"+r+n}return""},O=C.injectIntl(({menu:n,intl:r})=>{const c=L.useParams(),l=k(n,c);return e.jsx(i.Fragment,{children:l.filter(a=>a.url!="#wpm-languages").map(a=>a.child_items?e.jsxs("span",{children:[a.post_title," "]}):e.jsxs("a",{className:a.slug==c.slug?"active":"",href:h.utils.replaceLink(a.url,r.locale),children:[" ",a.post_title]}))})}),N=C.injectIntl(({settings:n,withIcons:r,active:c,menu:l,onSetSelected:a,selected:d,intl:{locale:j},isSmallScreen:S})=>{const w=L.useParams();i.useEffect(s=>{const t=k(l,w).filter(x=>x.menu_item_parent==0);t&&t.length>0?a(t[0]):a(null)},[l,a,w.slug]);const[g,_]=i.useState(null);i.useEffect(()=>{_(l)},[l]),i.useEffect(()=>{if(n&&n.menu_settings&&g){const s=[],f=l.items.map(t=>(n.menu_settings&&n.menu_settings["nav_menu_item["+t.ID+"]"]===!1&&s.push(t.ID),n.menu_settings&&n.menu_settings["nav_menu_item["+t.ID+"]"]?(n.menu_settings["nav_menu_item["+t.ID+"]"],{...t,...n.menu_settings["nav_menu_item["+t.ID+"]"]}):t));Object.keys(n.menu_settings).map(t=>{const x=n.menu_settings[t];if(x.type=="nav_menu_item"){const b=/(-)?[0-9]+/g.exec(t),M=parseInt(b[0]);f.find(o=>o.ID==M)||f.push(x.value)}}),_({...l,items:f.filter(t=>s.indexOf(t.ID)===-1)})}},[n]);const[p,v]=i.useState(!1);return i.useEffect(()=>{const s=()=>{v(window.innerWidth<=1200)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),g&&e.jsx(i.Fragment,{children:g.items.filter(s=>s.url!=="#wpm-languages").map((s,f)=>e.jsxs(i.Fragment,{children:[e.jsxs(u.Menu.Item,{className:`divided ${s.child_items?"has-child-items":""}
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),c=require("semantic-ui-react"),i=require("react"),f=require("@devgateway/wp-react-lib"),R=require("react-intl"),k=require("react-router"),O=require("./SearchControl.js"),T=require("./LangSwitcher.js"),D=(n,t)=>{const u=[];return n.items.forEach(l=>{l.child_items?l.child_items.forEach(a=>{a.slug==t.slug&&(u.push(l),u.push(a))}):l.slug==t.slug&&l.url!="/"&&u.push(l)}),u},S=(n,t)=>{if(n){const u=n.indexOf("/wp");if(u!==-1){const l=n.substr(u+3);return l.startsWith("/"+t)?l:"/"+t+l}else return n.startsWith("/"+t)?n:"/"+t+n}return""},q=R.injectIntl(({menu:n,intl:t})=>{const u=k.useParams(),l=D(n,u);return e.jsx(i.Fragment,{children:l.filter(a=>a.url!="#wpm-languages").map(a=>a.child_items?e.jsxs("span",{children:[a.post_title," "]}):e.jsxs("a",{className:a.slug==u.slug?"active":"",href:f.utils.replaceLink(a.url,t.locale),children:[" ",a.post_title]}))})}),z=R.injectIntl(({settings:n,withIcons:t,active:u,menu:l,onSetSelected:a,selected:d,intl:{locale:x},isSmallScreen:I})=>{const M=k.useParams();i.useEffect(s=>{const r=D(l,M).filter(j=>j.menu_item_parent==0);r&&r.length>0?a(r[0]):a(null)},[l,a,M.slug]);const[g,_]=i.useState(null);i.useEffect(()=>{_(l)},[l]),i.useEffect(()=>{if(n&&n.menu_settings&&g){const s=[],m=l.items.map(r=>(n.menu_settings&&n.menu_settings["nav_menu_item["+r.ID+"]"]===!1&&s.push(r.ID),n.menu_settings&&n.menu_settings["nav_menu_item["+r.ID+"]"]?(n.menu_settings["nav_menu_item["+r.ID+"]"],{...r,...n.menu_settings["nav_menu_item["+r.ID+"]"]}):r));Object.keys(n.menu_settings).map(r=>{const j=n.menu_settings[r];if(j.type=="nav_menu_item"){const b=/(-)?[0-9]+/g.exec(r),N=parseInt(b[0]);m.find(C=>C.ID==N)||m.push(j.value)}}),_({...l,items:m.filter(r=>s.indexOf(r.ID)===-1)})}},[n]);const[w,p]=i.useState(!1);return i.useEffect(()=>{const s=()=>{p(window.innerWidth<=1200)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),g&&e.jsx(i.Fragment,{children:g.items.filter(s=>s.url!=="#wpm-languages").map((s,m)=>e.jsxs(i.Fragment,{children:[e.jsxs(c.Menu.Item,{className:`divided ${s.child_items?"has-child-items":""}
2
2
  ${d&&d.ID===s.ID?"selected":""}
3
- ${c===s.slug?"active":""}`,children:[r&&e.jsx("a",{href:E(s.url,j),children:e.jsx("div",{className:"mark",children:e.jsx("span",{className:"sr-only",children:s.title})})}),S?s.child_items?e.jsx("span",{onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{href:E(s.url,j),children:s.title}):s.child_items?e.jsx("span",{onMouseOver:t=>a(s),onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{onMouseOut:t=>a(null),onMouseOver:t=>a(s),href:E(s.url,j),children:s.title})]}),p&&d&&d.ID===s.ID&&d.child_items&&e.jsx(i.Fragment,{children:d.child_items.map(t=>e.jsxs(u.Menu.Item,{className:`divided child-item ${c===t.slug?"active":""}`,children:[e.jsx("div",{className:"mark"}),e.jsx("a",{href:E(t.url,j),children:t.title})]},t.ID))})]},s.ID))})}),q=({intl:n,settings:r})=>{const[c,l]=i.useState(),[a,d]=i.useState(!1),[j,S]=i.useState(!1),[w,g]=i.useState(!1),[_,p]=i.useState(!1),{slug:v}=L.useParams(),s=i.useRef(null),f=i.useRef(null),t=()=>{p(!_),d(!a)};i.useEffect(()=>{const o=m=>{(s.current&&!s.current.contains(m.target)&&!f.current.contains(m.target)||m.target.closest(".desktop")||m.target.closest(".breadcrumbs"))&&(d(!1),p(!1))},I=m=>{m.key==="Escape"&&(d(!1),p(!1))};return document.addEventListener("mousedown",o),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",I)}},[]),i.useEffect(()=>{let o;const I=()=>{const D=window.innerWidth<=1200;S(D),g(!1)},m=()=>{g(!0),clearTimeout(o),o=setTimeout(I,300)};return I(),window.addEventListener("resize",m),()=>{clearTimeout(o),window.removeEventListener("resize",m)}},[]);const[x,z]=i.useState(!1);i.useEffect(()=>{const o=()=>{z(window.innerWidth<=1364)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const b=({media:o})=>o?e.jsx(u.Image,{src:o.guid.rendered}):e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),M=(r==null?void 0:r.landing_page_url)&&r.landing_page_url!==!1&&r.landing_page_url!==void 0&&r.landing_page_url!=="",R=M?r.landing_page_url:`/${n.locale}`;return e.jsx(i.Fragment,{children:e.jsxs(h.MenuProvider,{slug:"main",locale:n.locale,children:[e.jsxs(u.Container,{fluid:!0,className:"header",children:[e.jsx(u.Container,{fluid:!0,className:"background",ref:s,children:e.jsxs(u.Menu,{className:"branding",text:!0,children:[e.jsx(u.Menu.Item,{children:e.jsxs("a",{href:`${R}`,target:M?"_blank":"_self",rel:"noopener noreferrer",id:"site_url",children:[r.site_logo!==0&&!x&&e.jsx(h.MediaProvider,{id:r.site_logo,children:e.jsx(h.MediaConsumer,{children:e.jsx(b,{},"logo")})}),r.site_logo===0&&!x&&e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),x&&e.jsx("img",{className:"brand logo small",size:"small",src:"/wp-media/TCDI-Icon-small_02.png"})]})}),e.jsx(u.Menu.Item,{className:"divider",children:e.jsx("div",{})}),e.jsxs(u.Menu.Item,{fitted:!0,href:"/",children:[e.jsx(u.Flag,{name:"za"}),e.jsx("div",{className:"site name",children:r.name})]}),!w&&(j?e.jsx(u.Menu,{className:`pages ${a?"show":""}`,children:e.jsx(u.Container,{fluid:!0,children:e.jsx(h.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l,isSmallScreen:j},"items")})})}):e.jsx(u.Menu.Menu,{className:"pages",children:e.jsx(h.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l},"items")})})),e.jsx(u.Menu.Item,{children:e.jsx(h.MenuConsumer,{children:e.jsx($.default,{locale:n.locale},"lang")})}),e.jsx(u.Menu.Item,{fitted:!0,children:e.jsx(h.MenuConsumer,{children:e.jsx(T.default,{onSetSelected:l,settings:r})})}),e.jsxs("div",{ref:f,className:`hamburger-menu ${_?"animate":""} ${a?"open":"close"}`,onClick:t,children:[e.jsx("div",{}),e.jsx("div",{className:"middle-line"}),e.jsx("div",{})]})]})}),e.jsx(u.Container,{fluid:!0,className:"child",children:c&&c.child_items&&e.jsx(u.Menu,{fluid:!0,text:!0,children:e.jsx(N,{active:v,locale:n.locale,withIcons:!0,onSetSelected:o=>null,menu:{items:c.child_items}})})})]},"header-container"),e.jsx(u.Container,{className:"url breadcrumbs",children:e.jsx(h.MenuConsumer,{children:e.jsx(O,{})})})]})})},y=C.injectIntl(q);exports.default=y;
3
+ ${u===s.slug?"active":""}`,children:[t&&e.jsx("a",{href:S(s.url,x),children:e.jsx("div",{className:"mark",children:e.jsx("span",{className:"sr-only",children:s.title})})}),I?s.child_items?e.jsx("span",{onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{href:S(s.url,x),children:s.title}):s.child_items?e.jsx("span",{onMouseOver:r=>a(s),onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{onMouseOut:r=>a(null),onMouseOver:r=>a(s),href:S(s.url,x),children:s.title})]}),w&&d&&d.ID===s.ID&&d.child_items&&e.jsx(i.Fragment,{children:d.child_items.map(r=>e.jsxs(c.Menu.Item,{className:`divided child-item ${u===r.slug?"active":""}`,children:[e.jsx("div",{className:"mark"}),e.jsx("a",{href:S(r.url,x),children:r.title})]},r.ID))})]},s.ID))})}),y=({intl:n,settings:t,logoSmallSrc:u="/logo_small.png"})=>{const[l,a]=i.useState(),[d,x]=i.useState(!1),[I,M]=i.useState(!1),[g,_]=i.useState(!1),[w,p]=i.useState(!1),{slug:s}=k.useParams(),m=i.useRef(null),r=i.useRef(null),j=()=>{p(!w),x(!d)};i.useEffect(()=>{const o=h=>{(m.current&&!m.current.contains(h.target)&&!r.current.contains(h.target)||h.target.closest(".desktop")||h.target.closest(".breadcrumbs"))&&(x(!1),p(!1))},v=h=>{h.key==="Escape"&&(x(!1),p(!1))};return document.addEventListener("mousedown",o),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",v)}},[]),i.useEffect(()=>{let o;const v=()=>{const $=window.innerWidth<=1200;M($),_(!1)},h=()=>{_(!0),clearTimeout(o),o=setTimeout(v,300)};return v(),window.addEventListener("resize",h),()=>{clearTimeout(o),window.removeEventListener("resize",h)}},[]);const[E,b]=i.useState(!1);i.useEffect(()=>{const o=()=>{b(window.innerWidth<=1364)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const N=({media:o})=>o?e.jsx(c.Image,{src:o.guid.rendered}):e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),L=(t==null?void 0:t.landing_page_url)&&t.landing_page_url!==!1&&t.landing_page_url!==void 0&&t.landing_page_url!=="",C=L?t.landing_page_url:`/${n.locale}`;return e.jsx(i.Fragment,{children:e.jsxs(f.MenuProvider,{slug:"main",locale:n.locale,children:[e.jsxs(c.Container,{fluid:!0,className:"header",children:[e.jsx(c.Container,{fluid:!0,className:"background",ref:m,children:e.jsxs(c.Menu,{className:"branding",text:!0,children:[e.jsx(c.Menu.Item,{children:e.jsxs("a",{href:`${C}`,target:L?"_blank":"_self",rel:"noopener noreferrer",id:"site_url",children:[t.site_logo!==0&&!E&&e.jsx(f.MediaProvider,{id:t.site_logo,children:e.jsx(f.MediaConsumer,{children:e.jsx(N,{},"logo")})}),t.site_logo===0&&!E&&e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),E&&e.jsx("img",{className:"brand logo small",size:"small",src:u})]})}),e.jsx(c.Menu.Item,{className:"divider",children:e.jsx("div",{})}),e.jsxs(c.Menu.Item,{fitted:!0,href:"/",children:[e.jsx(c.Flag,{name:"za"}),e.jsx("div",{className:"site name",children:t.name})]}),!g&&(I?e.jsx(c.Menu,{className:`pages ${d?"show":""}`,children:e.jsx(c.Container,{fluid:!0,children:e.jsx(f.MenuConsumer,{children:e.jsx(z,{settings:t,active:s,selected:l,onSetSelected:a,isSmallScreen:I},"items")})})}):e.jsx(c.Menu.Menu,{className:"pages",children:e.jsx(f.MenuConsumer,{children:e.jsx(z,{settings:t,active:s,selected:l,onSetSelected:a},"items")})})),e.jsx(c.Menu.Item,{children:e.jsx(f.MenuConsumer,{children:e.jsx(T.default,{locale:n.locale},"lang")})}),e.jsx(c.Menu.Item,{fitted:!0,children:e.jsx(f.MenuConsumer,{children:e.jsx(O.default,{onSetSelected:a,settings:t})})}),e.jsxs("div",{ref:r,className:`hamburger-menu ${w?"animate":""} ${d?"open":"close"}`,onClick:j,children:[e.jsx("div",{}),e.jsx("div",{className:"middle-line"}),e.jsx("div",{})]})]})}),e.jsx(c.Container,{fluid:!0,className:"child",children:l&&l.child_items&&e.jsx(c.Menu,{fluid:!0,text:!0,children:e.jsx(z,{active:s,locale:n.locale,withIcons:!0,onSetSelected:o=>null,menu:{items:l.child_items}})})})]},"header-container"),e.jsx(c.Container,{className:"url breadcrumbs",children:e.jsx(f.MenuConsumer,{children:e.jsx(q,{})})})]})})},P=R.injectIntl(y);exports.default=P;
@@ -366,7 +366,7 @@ const xt = "#66676d", J = "#f0f0f1", ge = ["mobile", "tablet", "midTablet"].incl
366
366
  enableGridX: Ae,
367
367
  enablePointLabel: Oe === "top",
368
368
  pointLabel: (t) => I.formatNumber(
369
- N.style === "percent" ? t.yFormatted / 100 : t.yFormatted,
369
+ N.style === "percent" ? t.data.yFormatted / 100 : t.data.yFormatted,
370
370
  N
371
371
  ),
372
372
  lineWidth: 3,
@@ -1,72 +1,74 @@
1
1
  import { jsx as D } from "react/jsx-runtime";
2
2
  import { useState as E, useEffect as F } from "react";
3
3
  import L from "./PostsFilterDropdown.js";
4
- import { Config as N } from "../../conf/index.js";
5
- const q = (p) => {
4
+ import { Config as k } from "../../conf/index.js";
5
+ const q = (c) => {
6
6
  const {
7
- taxonomy: a,
8
- group: c,
7
+ taxonomy: n,
8
+ group: m,
9
9
  placeholder: f,
10
- allLabel: m,
11
- noneLabel: u,
12
- useSingleColumn: g,
13
- enableTextSearch: d,
14
- filterType: y,
15
- showNoDataOption: h,
16
- closeOnSelect: x,
17
- allNoneSameBehaviour: O,
18
- autoApply: P,
19
- alphabeticalSort: S,
20
- ascOrder: A,
21
- type: w,
22
- categories: n,
23
- onChange: B,
10
+ allLabel: u,
11
+ noneLabel: g,
12
+ useSingleColumn: d,
13
+ enableTextSearch: y,
14
+ filterType: h,
15
+ showNoDataOption: x,
16
+ closeOnSelect: O,
17
+ allNoneSameBehaviour: P,
18
+ autoApply: b,
19
+ alphabeticalSort: A,
20
+ ascOrder: N,
21
+ type: S,
22
+ categories: s,
23
+ onChange: w,
24
24
  wpApiBase: o,
25
- locale: s,
26
- ...T
27
- } = p, [v, e] = E([]), C = async () => {
28
- if (!a || a === "none") {
25
+ locale: r,
26
+ ...B
27
+ } = c, [C, e] = E([]), T = async () => {
28
+ if (!n || n === "none") {
29
29
  e([]);
30
30
  return;
31
31
  }
32
- const b = o != null && o !== "" ? o : N.REACT_APP_WP_API, _ = s ? `?lang=${s}` : "?lang=en", i = await (await fetch(b + "/wp/v2/" + a + _)).json();
33
- if (i) {
34
- const l = i.map((t) => ({
32
+ const v = o != null && o !== "" ? o : k.REACT_APP_WP_API, _ = r ? `?lang=${r}` : "?lang=en", l = await (await fetch(v + "/wp/v2/" + n + _)).json();
33
+ if (l) {
34
+ const p = l.map((t) => ({
35
35
  key: t.id,
36
36
  value: t.id,
37
37
  text: t.name
38
38
  }));
39
- if (n) {
40
- const t = l.filter((j) => n.indexOf(j.value.toString()) > -1);
41
- e([]), e(t);
39
+ if (s) {
40
+ const t = s.map((a) => Number(a)).filter((a) => !Number.isNaN(a)), j = p.filter(
41
+ (a) => t.indexOf(Number(a.value)) > -1
42
+ );
43
+ e([]), e(j);
42
44
  } else
43
- e([]), e(l);
45
+ e([]), e(p);
44
46
  }
45
47
  };
46
48
  return F(() => {
47
- let r = !1;
48
- return r || (e([]), C()), () => {
49
- r = !0;
49
+ let i = !1;
50
+ return i || (e([]), T()), () => {
51
+ i = !0;
50
52
  };
51
- }, [w, a, n, o, s]), /* @__PURE__ */ D(
53
+ }, [S, n, s, o, r]), /* @__PURE__ */ D(
52
54
  L,
53
55
  {
54
- ...T,
55
- group: c,
56
+ ...B,
57
+ group: m,
56
58
  placeholder: f,
57
- allLabel: m,
58
- noneLabel: u,
59
- useSingleColumn: g,
60
- enableTextSearch: d,
61
- filterType: y,
62
- showNoDataOption: h,
63
- closeOnSelect: x,
64
- allNoneSameBehaviour: O,
65
- autoApply: P,
66
- alphabeticalSort: S,
67
- ascOrder: A,
68
- options: v,
69
- onChange: B
59
+ allLabel: u,
60
+ noneLabel: g,
61
+ useSingleColumn: d,
62
+ enableTextSearch: y,
63
+ filterType: h,
64
+ showNoDataOption: x,
65
+ closeOnSelect: O,
66
+ allNoneSameBehaviour: P,
67
+ autoApply: b,
68
+ alphabeticalSort: A,
69
+ ascOrder: N,
70
+ options: C,
71
+ onChange: w
70
72
  }
71
73
  );
72
74
  };
@@ -1,60 +1,60 @@
1
- import { jsxs as ye, jsx as R } from "react/jsx-runtime";
2
- import ue, { useState as h, useMemo as p, useEffect as v } from "react";
3
- import { Container as pe } from "semantic-ui-react";
4
- import { toBoolean as i, toNumber as de } from "../../utils/data.js";
5
- import { useAppDispatch as Fe } from "../../redux/hooks.js";
6
- import { useSelector as me } from "react-redux";
7
- import ge from "./CategoricalFilter.js";
8
- import fe from "./YearFilter.js";
9
- import { injectIntl as Se, useIntl as he } from "react-intl";
10
- const Ce = (D) => {
1
+ import { jsxs as ue, jsx as D } from "react/jsx-runtime";
2
+ import pe, { useState as S, useMemo as p, useEffect as P } from "react";
3
+ import { Container as de } from "semantic-ui-react";
4
+ import { toBoolean as i, toNumber as Fe } from "../../utils/data.js";
5
+ import { useAppDispatch as me } from "../../redux/hooks.js";
6
+ import { useSelector as ge } from "react-redux";
7
+ import fe from "./CategoricalFilter.js";
8
+ import Se from "./YearFilter.js";
9
+ import { injectIntl as he, useIntl as Ce } from "react-intl";
10
+ const Te = (z) => {
11
11
  const {
12
- "data-alphabetical-sort": P,
13
- "data-asc-order": z,
12
+ "data-alphabetical-sort": j,
13
+ "data-asc-order": J,
14
14
  "data-group": s,
15
- "data-placeholder": C,
16
- "data-all-label": T,
17
- "data-none-label": b,
18
- "data-use-single-column": j,
19
- "data-enable-text-search": J,
15
+ "data-placeholder": h,
16
+ "data-all-label": C,
17
+ "data-none-label": T,
18
+ "data-use-single-column": K,
19
+ "data-enable-text-search": M,
20
20
  "data-filter-type": d,
21
- "data-show-no-data-option": K,
22
- "data-close-on-select": M,
23
- "data-all-none-same-behaviour": U,
24
- "data-auto-apply": $,
21
+ "data-show-no-data-option": U,
22
+ "data-close-on-select": $,
23
+ "data-all-none-same-behaviour": k,
24
+ "data-auto-apply": q,
25
25
  "data-taxonomy": c,
26
26
  "data-categories": F = "[]",
27
- "data-is-country-filter": k,
28
- "data-is-year-filter": q,
29
- "data-type": G,
27
+ "data-is-country-filter": G,
28
+ "data-is-year-filter": H,
29
+ "data-type": Q,
30
30
  "data-sort-first-by": O,
31
- "data-default-values": H = "[]",
32
- "data-wordpress-source-type": Te,
33
- "data-wordpress-source": x,
34
- editing: N = !1
35
- } = D, u = Fe(), { locale: Q } = he(), t = me((e) => e.getIn(["data", "posts", s])) || {}, o = d === "multi-select", [V, Oe] = h(0), A = (e) => N ? e : decodeURIComponent(e), B = (e) => {
31
+ "data-default-values": W = "[]",
32
+ "data-wordpress-source-type": Oe,
33
+ "data-wordpress-source": b,
34
+ editing: x = !1
35
+ } = z, u = me(), { locale: X } = Ce(), t = ge((e) => e.getIn(["data", "posts", s])) || {}, o = d === "multi-select", [V, xe] = S(0), N = (e) => x ? e : decodeURIComponent(e), A = (e) => {
36
36
  try {
37
- return JSON.parse(A(e));
37
+ return JSON.parse(N(e));
38
38
  } catch (a) {
39
- return console.warn("JSON parsing failed for value:", e, "- treating as plain string. Error:", a), A(e);
39
+ return console.warn("JSON parsing failed for value:", e, "- treating as plain string. Error:", a), N(e);
40
40
  }
41
41
  };
42
- let l = B(H);
42
+ let l = A(W);
43
43
  l || (l = []), typeof l == "string" && (l = l.split(",").map(Number)), typeof l == "number" && (l = [l]);
44
- const W = i(P), X = i(z), I = i(K), w = i(M), Y = i(U), _ = i($), r = i(k), n = i(q), E = i(j), L = i(J), m = O !== "none" ? de(O) : null, [y, Z] = h([]), [g, ee] = h(!1), f = (e, a) => a ? Array.isArray(e) ? e : e != null ? [e] : [] : e || void 0, te = p(
44
+ const Z = i(j), ee = i(J), I = i(U), B = i($), w = i(k), Y = i(q), r = i(G), n = i(H), _ = i(K), E = i(M), m = O !== "none" ? Fe(O) : null, [y, te] = S([]), [g, re] = S(!1), f = (e, a) => a ? Array.isArray(e) ? e : e != null ? [e] : [] : e || void 0, ae = p(
45
45
  () => f(t.countryFilter, o),
46
46
  [t.countryFilter, o]
47
- ), re = p(
47
+ ), oe = p(
48
48
  () => f(t.categoryFilter, o),
49
49
  [t.categoryFilter, o]
50
- ), ae = p(
50
+ ), le = p(
51
51
  () => n ? f(t.yearFilter, o) : void 0,
52
52
  [t.yearFilter, o, n]
53
- ), S = p(() => {
53
+ ), L = p(() => {
54
54
  if (!F) return [];
55
- const e = B(F);
56
- return Array.isArray(e) ? e : typeof e == "string" || typeof e == "number" ? e.toString().split(",").filter(Boolean) : [];
57
- }, [F, N]), oe = (e) => {
55
+ const e = A(F);
56
+ return Array.isArray(e) ? e : typeof e == "string" || typeof e == "number" ? e.toString().split(",").filter((a) => a.trim() !== "") : [];
57
+ }, [F, x]), ne = (e) => {
58
58
  u({
59
59
  type: "SET_POSTS_FILTER",
60
60
  group: s,
@@ -66,7 +66,7 @@ const Ce = (D) => {
66
66
  countryFilter: t.countryFilter,
67
67
  sortFirstBy: m
68
68
  });
69
- }, le = (e) => {
69
+ }, ie = (e) => {
70
70
  u({
71
71
  type: "SET_POSTS_FILTER",
72
72
  group: s,
@@ -84,24 +84,24 @@ const Ce = (D) => {
84
84
  countryTaxonomy: r ? c : t.countryTaxonomy
85
85
  });
86
86
  };
87
- return v(() => {
88
- const e = l.length > 0, a = o ? l : l[0], ne = r ? t.categoryFilter : e ? a : o ? S.map(Number) : t.categoryFilter, ie = r ? e ? a : o ? S.map(Number) : t.countryFilter : t.countryFilter, se = n && o ? y.length > 0 ? y.map((ce) => ce.value) : [] : t.yearFilter;
87
+ return P(() => {
88
+ const e = l.length > 0, a = o ? l : l[0], R = L.map(Number), v = r ? t.categoryFilter : e ? a : o ? R : t.categoryFilter, se = r ? e ? a : o ? R : t.countryFilter : t.countryFilter, ce = n && o ? y.length > 0 ? y.map((ye) => ye.value) : [] : t.yearFilter;
89
89
  u({
90
90
  type: "SET_INITIAL_POSTS_FILTER",
91
91
  group: s,
92
- categoryFilter: ne,
93
- countryFilter: ie,
92
+ categoryFilter: v,
93
+ countryFilter: se,
94
94
  isYearFilter: n,
95
95
  isCountryFilter: r,
96
96
  sortFirstBy: m,
97
- yearFilter: n ? se : null,
98
- categoryCategory: r ? null : t.categoryCategory,
97
+ yearFilter: n ? ce : null,
98
+ categoryCategory: r ? null : v,
99
99
  categoryTaxonomy: r ? null : c,
100
100
  countryCategory: r ? c : null,
101
101
  countryTaxonomy: r ? c : null,
102
102
  page: 1
103
103
  });
104
- }, []), v(() => {
104
+ }, []), P(() => {
105
105
  if (n && !g && o && y.length > 0) {
106
106
  const e = y.map((a) => a.value);
107
107
  u({
@@ -111,65 +111,65 @@ const Ce = (D) => {
111
111
  yearFilter: e
112
112
  });
113
113
  }
114
- }, [g]), /* @__PURE__ */ ye(pe, { fluid: !0, className: "filter post-filter", children: [
115
- n && /* @__PURE__ */ R(
116
- fe,
114
+ }, [g]), /* @__PURE__ */ ue(de, { fluid: !0, className: "filter post-filter", children: [
115
+ n && /* @__PURE__ */ D(
116
+ Se,
117
117
  {
118
118
  group: s,
119
- placeholder: C,
120
- allLabel: T,
121
- noneLabel: b,
122
- useSingleColumn: E,
123
- enableTextSearch: L,
119
+ placeholder: h,
120
+ allLabel: C,
121
+ noneLabel: T,
122
+ useSingleColumn: _,
123
+ enableTextSearch: E,
124
124
  filterType: d,
125
125
  showNoDataOption: I,
126
- closeOnSelect: w,
127
- allNoneSameBehaviour: Y,
128
- autoApply: _,
129
- alphabeticalSort: W,
130
- ascOrder: X,
126
+ closeOnSelect: B,
127
+ allNoneSameBehaviour: w,
128
+ autoApply: Y,
129
+ alphabeticalSort: Z,
130
+ ascOrder: ee,
131
131
  options: y,
132
- value: ae,
132
+ value: le,
133
133
  yearOptions: y,
134
- setYearOptions: Z,
134
+ setYearOptions: te,
135
135
  yearFilterLoading: g,
136
- setYearFilterLoading: ee,
136
+ setYearFilterLoading: re,
137
137
  onChange: (e, a) => {
138
- oe(a);
138
+ ne(a);
139
139
  },
140
140
  resetKey: V,
141
- wpApiBase: x ?? void 0
141
+ wpApiBase: b ?? void 0
142
142
  }
143
143
  ),
144
- !n && /* @__PURE__ */ R(
145
- ge,
144
+ !n && /* @__PURE__ */ D(
145
+ fe,
146
146
  {
147
147
  group: s,
148
- placeholder: C,
149
- allLabel: T,
150
- noneLabel: b,
151
- useSingleColumn: E,
152
- enableTextSearch: L,
148
+ placeholder: h,
149
+ allLabel: C,
150
+ noneLabel: T,
151
+ useSingleColumn: _,
152
+ enableTextSearch: E,
153
153
  filterType: d,
154
154
  showNoDataOption: I,
155
- closeOnSelect: w,
156
- allNoneSameBehaviour: Y,
157
- autoApply: _,
155
+ closeOnSelect: B,
156
+ allNoneSameBehaviour: w,
157
+ autoApply: Y,
158
158
  taxonomy: c,
159
- type: G,
160
- value: r ? te : re,
159
+ type: Q,
160
+ value: r ? ae : oe,
161
161
  onChange: (e, a) => {
162
- le(a);
162
+ ie(a);
163
163
  },
164
- categories: S,
164
+ categories: L,
165
165
  resetKey: V,
166
- wpApiBase: x ?? void 0,
167
- locale: Q
166
+ wpApiBase: b ?? void 0,
167
+ locale: X
168
168
  },
169
169
  `cat-${s}`
170
170
  )
171
171
  ] });
172
- }, Ee = Se(ue.memo(Ce));
172
+ }, Re = he(pe.memo(Te));
173
173
  export {
174
- Ee as default
174
+ Re as default
175
175
  };
@@ -1,40 +1,46 @@
1
- import { jsxs as p, jsx as n } from "react/jsx-runtime";
2
- import d from "react";
3
- import { useDispatch as u, useSelector as a } from "react-redux";
4
- import { Container as m, Icon as f } from "semantic-ui-react";
5
- import I from "lodash.isequal";
6
- import { injectIntl as g } from "react-intl";
7
- const F = (i) => {
1
+ import { jsxs as d, jsx as p } from "react/jsx-runtime";
2
+ import f from "react";
3
+ import { useDispatch as m, useSelector as l } from "react-redux";
4
+ import { Container as u, Icon as g } from "semantic-ui-react";
5
+ import y from "lodash.isequal";
6
+ import { injectIntl as b } from "react-intl";
7
+ const a = (t) => t == null ? t : Array.isArray(t) ? [...t].map(a).sort((r, e) => {
8
+ const o = JSON.stringify(r), n = JSON.stringify(e);
9
+ return o < n ? -1 : o > n ? 1 : 0;
10
+ }) : typeof t == "object" ? Object.keys(t).sort().reduce((r, e) => (r[e] = a(t[e]), r), {}) : typeof t == "number" || typeof t == "string" ? String(t) : t, I = (t) => {
8
11
  const {
9
- "data-group": s,
10
- "data-reset-label": l = "Reset All Filters"
11
- } = i, c = u(), o = a((r) => r.getIn(["data", "posts", s])), t = a((r) => r.getIn(["data", "posts", "initialFilters", s])), e = d.useMemo(() => o && t ? !I(o, t) : !1, [o, t]);
12
- return /* @__PURE__ */ p(
13
- m,
12
+ "data-group": r,
13
+ "data-reset-label": e = "Reset All Filters"
14
+ } = t, o = m(), n = l((c) => c.getIn(["data", "posts", r])), i = l((c) => c.getIn(["data", "posts", "initialFilters", r])), s = f.useMemo(() => n && i ? !y(
15
+ a(n),
16
+ a(i)
17
+ ) : !1, [n, i]);
18
+ return /* @__PURE__ */ d(
19
+ u,
14
20
  {
15
21
  fluid: !0,
16
22
  style: {
17
- pointerEvents: e ? "auto" : "none",
18
- cursor: e ? "pointer" : "not-allowed",
19
- opacity: e ? 1 : 0.5
23
+ pointerEvents: s ? "auto" : "none",
24
+ cursor: s ? "pointer" : "not-allowed",
25
+ opacity: s ? 1 : 0.5
20
26
  },
21
- className: `data-filters-reset ignore ${e ? "" : "disabled"}`,
27
+ className: `data-filters-reset ignore ${s ? "" : "disabled"}`,
22
28
  onClick: () => {
23
- c({
29
+ o({
24
30
  type: "SET_INITIAL_POSTS_FILTER",
25
- group: s,
26
- ...t,
31
+ group: r,
32
+ ...i,
27
33
  reset: !0,
28
34
  page: 1
29
35
  });
30
36
  },
31
37
  children: [
32
- /* @__PURE__ */ n("span", { children: l }),
33
- /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(f, { disabled: !e, name: "undo alternate", className: "custom-undo-icon" }) })
38
+ /* @__PURE__ */ p("span", { children: e }),
39
+ /* @__PURE__ */ p("span", { children: /* @__PURE__ */ p(g, { disabled: !s, name: "undo alternate", className: "custom-undo-icon" }) })
34
40
  ]
35
41
  }
36
42
  );
37
- }, T = g(F);
43
+ }, A = b(I);
38
44
  export {
39
- T as default
45
+ A as default
40
46
  };
@@ -1,31 +1,31 @@
1
1
  import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { Menu as d, Container as b, Flag as P, Image as U } from "semantic-ui-react";
3
- import L, { useEffect as _, useState as p, useRef as y } from "react";
4
- import { utils as j, MenuProvider as H, MediaProvider as A, MediaConsumer as V, MenuConsumer as E } from "@devgateway/wp-react-lib";
5
- import { injectIntl as R } from "react-intl";
6
- import { useParams as $ } from "react-router";
7
- import B from "./SearchControl.js";
8
- import K from "./LangSwitcher.js";
9
- const W = (r, s) => {
2
+ import { Menu as d, Container as N, Flag as U, Image as j } from "semantic-ui-react";
3
+ import E, { useEffect as p, useState as g, useRef as W } from "react";
4
+ import { utils as H, MenuProvider as A, MediaProvider as V, MediaConsumer as B, MenuConsumer as b } from "@devgateway/wp-react-lib";
5
+ import { injectIntl as T } from "react-intl";
6
+ import { useParams as y } from "react-router";
7
+ import K from "./SearchControl.js";
8
+ import q from "./LangSwitcher.js";
9
+ const F = (r, l) => {
10
10
  const t = [];
11
11
  return r.items.forEach((i) => {
12
12
  i.child_items ? i.child_items.forEach((a) => {
13
- a.slug == s.slug && (t.push(i), t.push(a));
14
- }) : i.slug == s.slug && i.url != "/" && t.push(i);
13
+ a.slug == l.slug && (t.push(i), t.push(a));
14
+ }) : i.slug == l.slug && i.url != "/" && t.push(i);
15
15
  }), t;
16
- }, x = (r, s) => {
16
+ }, S = (r, l) => {
17
17
  if (r) {
18
18
  const t = r.indexOf("/wp");
19
19
  if (t !== -1) {
20
20
  const i = r.substr(t + 3);
21
- return i.startsWith("/" + s) ? i : "/" + s + i;
21
+ return i.startsWith("/" + l) ? i : "/" + l + i;
22
22
  } else
23
- return r.startsWith("/" + s) ? r : "/" + s + r;
23
+ return r.startsWith("/" + l) ? r : "/" + l + r;
24
24
  }
25
25
  return "";
26
- }, q = R(({ menu: r, intl: s }) => {
27
- const t = $(), i = W(r, t);
28
- return /* @__PURE__ */ e(L.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
26
+ }, G = T(({ menu: r, intl: l }) => {
27
+ const t = y(), i = F(r, t);
28
+ return /* @__PURE__ */ e(E.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
29
29
  (a) => a.child_items ? /* @__PURE__ */ u("span", { children: [
30
30
  a.post_title,
31
31
  " "
@@ -33,7 +33,7 @@ const W = (r, s) => {
33
33
  "a",
34
34
  {
35
35
  className: a.slug == t.slug ? "active" : "",
36
- href: j.replaceLink(a.url, s.locale),
36
+ href: H.replaceLink(a.url, l.locale),
37
37
  children: [
38
38
  " ",
39
39
  a.post_title
@@ -41,53 +41,53 @@ const W = (r, s) => {
41
41
  }
42
42
  )
43
43
  ) });
44
- }), C = R(
44
+ }), O = T(
45
45
  ({
46
46
  settings: r,
47
- withIcons: s,
47
+ withIcons: l,
48
48
  active: t,
49
49
  menu: i,
50
50
  onSetSelected: a,
51
51
  selected: o,
52
- intl: { locale: g },
53
- isSmallScreen: D
52
+ intl: { locale: f },
53
+ isSmallScreen: L
54
54
  }) => {
55
- const z = $();
56
- _(
55
+ const z = y();
56
+ p(
57
57
  (n) => {
58
- const l = W(i, z).filter((f) => f.menu_item_parent == 0);
59
- l && l.length > 0 ? a(l[0]) : a(null);
58
+ const s = F(i, z).filter((_) => _.menu_item_parent == 0);
59
+ s && s.length > 0 ? a(s[0]) : a(null);
60
60
  },
61
61
  [i, a, z.slug]
62
62
  );
63
- const [v, I] = p(null);
64
- _(() => {
65
- I(i);
66
- }, [i]), _(() => {
63
+ const [v, w] = g(null);
64
+ p(() => {
65
+ w(i);
66
+ }, [i]), p(() => {
67
67
  if (r && r.menu_settings && v) {
68
- const n = [], h = i.items.map((l) => (r.menu_settings && r.menu_settings["nav_menu_item[" + l.ID + "]"] === !1 && n.push(l.ID), r.menu_settings && r.menu_settings["nav_menu_item[" + l.ID + "]"] ? (r.menu_settings["nav_menu_item[" + l.ID + "]"], {
69
- ...l,
70
- ...r.menu_settings["nav_menu_item[" + l.ID + "]"]
71
- }) : l));
72
- Object.keys(r.menu_settings).map((l) => {
73
- const f = r.menu_settings[l];
74
- if (f.type == "nav_menu_item") {
75
- const S = /(-)?[0-9]+/g.exec(l), k = parseInt(S[0]);
76
- h.find((c) => c.ID == k) || h.push(f.value);
68
+ const n = [], m = i.items.map((s) => (r.menu_settings && r.menu_settings["nav_menu_item[" + s.ID + "]"] === !1 && n.push(s.ID), r.menu_settings && r.menu_settings["nav_menu_item[" + s.ID + "]"] ? (r.menu_settings["nav_menu_item[" + s.ID + "]"], {
69
+ ...s,
70
+ ...r.menu_settings["nav_menu_item[" + s.ID + "]"]
71
+ }) : s));
72
+ Object.keys(r.menu_settings).map((s) => {
73
+ const _ = r.menu_settings[s];
74
+ if (_.type == "nav_menu_item") {
75
+ const D = /(-)?[0-9]+/g.exec(s), C = parseInt(D[0]);
76
+ m.find(($) => $.ID == C) || m.push(_.value);
77
77
  }
78
- }), I({
78
+ }), w({
79
79
  ...i,
80
- items: h.filter((l) => n.indexOf(l.ID) === -1)
80
+ items: m.filter((s) => n.indexOf(s.ID) === -1)
81
81
  });
82
82
  }
83
83
  }, [r]);
84
- const [w, M] = p(!1);
85
- return _(() => {
84
+ const [k, I] = g(!1);
85
+ return p(() => {
86
86
  const n = () => {
87
- M(window.innerWidth <= 1200);
87
+ I(window.innerWidth <= 1200);
88
88
  };
89
89
  return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
90
- }, []), v && /* @__PURE__ */ e(L.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(L.Fragment, { children: [
90
+ }, []), v && /* @__PURE__ */ e(E.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, m) => /* @__PURE__ */ u(E.Fragment, { children: [
91
91
  /* @__PURE__ */ u(
92
92
  d.Item,
93
93
  {
@@ -95,84 +95,84 @@ const W = (r, s) => {
95
95
  ${o && o.ID === n.ID ? "selected" : ""}
96
96
  ${t === n.slug ? "active" : ""}`,
97
97
  children: [
98
- s && /* @__PURE__ */ e("a", { href: x(n.url, g), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
99
- D ? n.child_items ? /* @__PURE__ */ e(
98
+ l && /* @__PURE__ */ e("a", { href: S(n.url, f), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
99
+ L ? n.child_items ? /* @__PURE__ */ e(
100
100
  "span",
101
101
  {
102
102
  onClick: () => a(o === n ? null : n),
103
103
  children: n.title
104
104
  }
105
- ) : /* @__PURE__ */ e("a", { href: x(n.url, g), children: n.title }) : n.child_items ? /* @__PURE__ */ e(
105
+ ) : /* @__PURE__ */ e("a", { href: S(n.url, f), children: n.title }) : n.child_items ? /* @__PURE__ */ e(
106
106
  "span",
107
107
  {
108
- onMouseOver: (l) => a(n),
108
+ onMouseOver: (s) => a(n),
109
109
  onClick: () => a(o === n ? null : n),
110
110
  children: n.title
111
111
  }
112
112
  ) : /* @__PURE__ */ e(
113
113
  "a",
114
114
  {
115
- onMouseOut: (l) => a(null),
116
- onMouseOver: (l) => a(n),
117
- href: x(n.url, g),
115
+ onMouseOut: (s) => a(null),
116
+ onMouseOver: (s) => a(n),
117
+ href: S(n.url, f),
118
118
  children: n.title
119
119
  }
120
120
  )
121
121
  ]
122
122
  }
123
123
  ),
124
- w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(L.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
124
+ k && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(E.Fragment, { children: o.child_items.map((s) => /* @__PURE__ */ u(
125
125
  d.Item,
126
126
  {
127
- className: `divided child-item ${t === l.slug ? "active" : ""}`,
127
+ className: `divided child-item ${t === s.slug ? "active" : ""}`,
128
128
  children: [
129
129
  /* @__PURE__ */ e("div", { className: "mark" }),
130
- /* @__PURE__ */ e("a", { href: x(l.url, g), children: l.title })
130
+ /* @__PURE__ */ e("a", { href: S(s.url, f), children: s.title })
131
131
  ]
132
132
  },
133
- l.ID
133
+ s.ID
134
134
  )) })
135
135
  ] }, n.ID)) });
136
136
  }
137
- ), G = ({ intl: r, settings: s }) => {
138
- const [t, i] = p(), [a, o] = p(!1), [g, D] = p(!1), [z, v] = p(!1), [I, w] = p(!1), { slug: M } = $(), n = y(null), h = y(null), l = () => {
139
- w(!I), o(!a);
137
+ ), J = ({ intl: r, settings: l, logoSmallSrc: t = "/logo_small.png" }) => {
138
+ const [i, a] = g(), [o, f] = g(!1), [L, z] = g(!1), [v, w] = g(!1), [k, I] = g(!1), { slug: n } = y(), m = W(null), s = W(null), _ = () => {
139
+ I(!k), f(!o);
140
140
  };
141
- _(() => {
142
- const c = (m) => {
143
- (n.current && !n.current.contains(m.target) && !h.current.contains(m.target) || m.target.closest(".desktop") || m.target.closest(".breadcrumbs")) && (o(!1), w(!1));
144
- }, N = (m) => {
145
- m.key === "Escape" && (o(!1), w(!1));
141
+ p(() => {
142
+ const c = (h) => {
143
+ (m.current && !m.current.contains(h.target) && !s.current.contains(h.target) || h.target.closest(".desktop") || h.target.closest(".breadcrumbs")) && (f(!1), I(!1));
144
+ }, M = (h) => {
145
+ h.key === "Escape" && (f(!1), I(!1));
146
146
  };
147
- return document.addEventListener("mousedown", c), document.addEventListener("keydown", N), () => {
148
- document.removeEventListener("mousedown", c), document.removeEventListener("keydown", N);
147
+ return document.addEventListener("mousedown", c), document.addEventListener("keydown", M), () => {
148
+ document.removeEventListener("mousedown", c), document.removeEventListener("keydown", M);
149
149
  };
150
- }, []), _(() => {
150
+ }, []), p(() => {
151
151
  let c;
152
- const N = () => {
153
- const F = window.innerWidth <= 1200;
154
- D(F), v(!1);
155
- }, m = () => {
156
- v(!0), clearTimeout(c), c = setTimeout(N, 300);
152
+ const M = () => {
153
+ const P = window.innerWidth <= 1200;
154
+ z(P), w(!1);
155
+ }, h = () => {
156
+ w(!0), clearTimeout(c), c = setTimeout(M, 300);
157
157
  };
158
- return N(), window.addEventListener("resize", m), () => {
159
- clearTimeout(c), window.removeEventListener("resize", m);
158
+ return M(), window.addEventListener("resize", h), () => {
159
+ clearTimeout(c), window.removeEventListener("resize", h);
160
160
  };
161
161
  }, []);
162
- const [f, T] = p(!1);
163
- _(() => {
162
+ const [x, D] = g(!1);
163
+ p(() => {
164
164
  const c = () => {
165
- T(window.innerWidth <= 1364);
165
+ D(window.innerWidth <= 1364);
166
166
  };
167
167
  return c(), window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
168
168
  }, []);
169
- const S = ({ media: c }) => c ? /* @__PURE__ */ e(U, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), k = (s == null ? void 0 : s.landing_page_url) && s.landing_page_url !== !1 && s.landing_page_url !== void 0 && s.landing_page_url !== "", O = k ? s.landing_page_url : `/${r.locale}`;
170
- return /* @__PURE__ */ e(L.Fragment, { children: /* @__PURE__ */ u(H, { slug: "main", locale: r.locale, children: [
171
- /* @__PURE__ */ u(b, { fluid: !0, className: "header", children: [
172
- /* @__PURE__ */ e(b, { fluid: !0, className: "background", ref: n, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
173
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${O}`, target: k ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
174
- s.site_logo !== 0 && !f && /* @__PURE__ */ e(A, { id: s.site_logo, children: /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(S, {}, "logo") }) }),
175
- s.site_logo === 0 && !f && /* @__PURE__ */ e(
169
+ const C = ({ media: c }) => c ? /* @__PURE__ */ e(j, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), R = (l == null ? void 0 : l.landing_page_url) && l.landing_page_url !== !1 && l.landing_page_url !== void 0 && l.landing_page_url !== "", $ = R ? l.landing_page_url : `/${r.locale}`;
170
+ return /* @__PURE__ */ e(E.Fragment, { children: /* @__PURE__ */ u(A, { slug: "main", locale: r.locale, children: [
171
+ /* @__PURE__ */ u(N, { fluid: !0, className: "header", children: [
172
+ /* @__PURE__ */ e(N, { fluid: !0, className: "background", ref: m, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
173
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${$}`, target: R ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
174
+ l.site_logo !== 0 && !x && /* @__PURE__ */ e(V, { id: l.site_logo, children: /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(C, {}, "logo") }) }),
175
+ l.site_logo === 0 && !x && /* @__PURE__ */ e(
176
176
  "img",
177
177
  {
178
178
  className: "brand logo",
@@ -180,60 +180,60 @@ const W = (r, s) => {
180
180
  src: "/logo_full.png"
181
181
  }
182
182
  ),
183
- f && /* @__PURE__ */ e(
183
+ x && /* @__PURE__ */ e(
184
184
  "img",
185
185
  {
186
186
  className: "brand logo small",
187
187
  size: "small",
188
- src: "/wp-media/TCDI-Icon-small_02.png"
188
+ src: t
189
189
  }
190
190
  )
191
191
  ] }) }),
192
192
  /* @__PURE__ */ e(d.Item, { className: "divider", children: /* @__PURE__ */ e("div", {}) }),
193
193
  /* @__PURE__ */ u(d.Item, { fitted: !0, href: "/", children: [
194
- /* @__PURE__ */ e(P, { name: "za" }),
195
- /* @__PURE__ */ e("div", { className: "site name", children: s.name })
194
+ /* @__PURE__ */ e(U, { name: "za" }),
195
+ /* @__PURE__ */ e("div", { className: "site name", children: l.name })
196
196
  ] }),
197
- !z && (g ? /* @__PURE__ */ e(d, { className: `pages ${a ? "show" : ""}`, children: /* @__PURE__ */ e(b, { fluid: !0, children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
198
- C,
197
+ !v && (L ? /* @__PURE__ */ e(d, { className: `pages ${o ? "show" : ""}`, children: /* @__PURE__ */ e(N, { fluid: !0, children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
198
+ O,
199
199
  {
200
- settings: s,
201
- active: M,
202
- selected: t,
203
- onSetSelected: i,
204
- isSmallScreen: g
200
+ settings: l,
201
+ active: n,
202
+ selected: i,
203
+ onSetSelected: a,
204
+ isSmallScreen: L
205
205
  },
206
206
  "items"
207
- ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
208
- C,
207
+ ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
208
+ O,
209
209
  {
210
- settings: s,
211
- active: M,
212
- selected: t,
213
- onSetSelected: i
210
+ settings: l,
211
+ active: n,
212
+ selected: i,
213
+ onSetSelected: a
214
214
  },
215
215
  "items"
216
216
  ) }) })),
217
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
218
- K,
217
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
218
+ q,
219
219
  {
220
220
  locale: r.locale
221
221
  },
222
222
  "lang"
223
223
  ) }) }),
224
- /* @__PURE__ */ e(d.Item, { fitted: !0, children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
225
- B,
224
+ /* @__PURE__ */ e(d.Item, { fitted: !0, children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
225
+ K,
226
226
  {
227
- onSetSelected: i,
228
- settings: s
227
+ onSetSelected: a,
228
+ settings: l
229
229
  }
230
230
  ) }) }),
231
231
  /* @__PURE__ */ u(
232
232
  "div",
233
233
  {
234
- ref: h,
235
- className: `hamburger-menu ${I ? "animate" : ""} ${a ? "open" : "close"}`,
236
- onClick: l,
234
+ ref: s,
235
+ className: `hamburger-menu ${k ? "animate" : ""} ${o ? "open" : "close"}`,
236
+ onClick: _,
237
237
  children: [
238
238
  /* @__PURE__ */ e("div", {}),
239
239
  /* @__PURE__ */ e("div", { className: "middle-line" }),
@@ -242,20 +242,20 @@ const W = (r, s) => {
242
242
  }
243
243
  )
244
244
  ] }) }),
245
- /* @__PURE__ */ e(b, { fluid: !0, className: "child", children: t && t.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
246
- C,
245
+ /* @__PURE__ */ e(N, { fluid: !0, className: "child", children: i && i.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
246
+ O,
247
247
  {
248
- active: M,
248
+ active: n,
249
249
  locale: r.locale,
250
250
  withIcons: !0,
251
251
  onSetSelected: (c) => null,
252
- menu: { items: t.child_items }
252
+ menu: { items: i.child_items }
253
253
  }
254
254
  ) }) })
255
255
  ] }, "header-container"),
256
- /* @__PURE__ */ e(b, { className: "url breadcrumbs", children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(q, {}) }) })
256
+ /* @__PURE__ */ e(N, { className: "url breadcrumbs", children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(G, {}) }) })
257
257
  ] }) });
258
- }, se = R(G);
258
+ }, le = T(J);
259
259
  export {
260
- se as default
260
+ le as default
261
261
  };
@@ -2,10 +2,12 @@ import { default as React } from 'react';
2
2
  declare const _default: React.FC<import('react-intl').WithIntlProps<{
3
3
  intl: any;
4
4
  settings: any;
5
+ logoSmallSrc?: string | undefined;
5
6
  }>> & {
6
7
  WrappedComponent: React.ComponentType<{
7
8
  intl: any;
8
9
  settings: any;
10
+ logoSmallSrc?: string | undefined;
9
11
  }>;
10
12
  };
11
13
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.16",
3
+ "version": "1.8.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -20,8 +20,11 @@
20
20
  "react-ui-library",
21
21
  "react-ui-components"
22
22
  ],
23
- "author": "Timothy Mugo",
24
- "license": "MIT",
23
+ "author": "Sebastian Dimunzio <sdimunzio@gmail.com>",
24
+ "contributors": [
25
+ "Timothy Gachengo (https://github.com/timothygachengo)"
26
+ ],
27
+ "license": "Apache-2.0",
25
28
  "description": "A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.",
26
29
  "repository": {
27
30
  "type": "git",