gf-components 0.1.81 → 0.1.82
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.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -559,5 +559,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
559
559
|
color: var(--gf-color-text-secondary);
|
|
560
560
|
font-size: 10px;
|
|
561
561
|
line-height: ${Cc}px;
|
|
562
|
-
`,oM=(e,C=12)=>{const n=document.createElement("canvas").getContext("2d");return n.font=`${C}px Roboto`,n.measureText(e)},Bo1=(e,C,t=12)=>{const n=e.split(" "),r=[];let i=n[0];for(let o=1;o<n.length;o++){const a=`${i} ${n[o]}`;oM(a,t).width>C?(r.push(i),i=n[o]):i=a}return r.push(i),r},Wo1=({data:e=[],height:C=600,margin:t={},padding:n=.5,keys:r=null,indexBy:i=null,tooltip:o=null,enableLabel:a=!1,label:s=null,keyLabelWidth:l=120,keyLabelPadding:c=20,axisBottom:u={},layers:d=["grid","axes"]})=>{const f=({bar:S})=>{var A;const x=M.useRef(null),[$,O]=M.useState(0),E=((A=S==null?void 0:S.data)==null?void 0:A.indexValue)||"label",_=Bo1(E,l,Ca);M.useEffect(()=>{if(x.current){const H=x.current.getBoundingClientRect();O(H.height)}},[]);const V=l+c,R=S.y+S.height/2-$/2;return w.jsx("g",{ref:x,transform:`translate(-${V}, ${R})`,children:w.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:_.map((H,L)=>w.jsx(Pv,{x:0,dy:L>0?Cc:Ca,children:H},L))})})};let g=null;const v=({bars:S})=>S.map((x,$)=>{var O;if(name=(O=x==null?void 0:x.data)==null?void 0:O.id,!(name!==g&&g!==null))return g=name,w.jsx(f,{bar:x},`bar-label-${$}`)}),h=({bar:S})=>{const $=s==null?void 0:s(S.data),O=oM($,10),E=O.actualBoundingBoxRight+O.actualBoundingBoxLeft,_=O.actualBoundingBoxAscent+O.actualBoundingBoxDescent;if(E>=S.width)return w.jsx(w.Fragment,{});const V=S.x+S.width/2-E/2,R=S.y+S.height/2+_/2;return w.jsx("g",{transform:`translate(${V}, ${R})`,children:w.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:w.jsx(Pv,{style:{fontSize:10},children:$||"label"})})})},b=({bars:S})=>S.map((x,$)=>w.jsx(h,{bar:x},`bar-inner-label-${$}`)),p=({data:S,keys:x})=>{const $=x==null?void 0:x.map(O=>{var E;return{name:O,color:(E=S[0])==null?void 0:E[`${O}Color`]}});return w.jsx(l3,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:$.map((O,E)=>w.jsxs(l3,{gap:8,align:"center",children:[w.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:O.color}}),w.jsx(zo1,{children:O.name})]},`legend-${E}`))})},y=e.slice().reverse();return w.jsxs(l3,{vertical:!0,gap:8,children:[w.jsx("div",{style:{height:C},children:w.jsx(rM,{data:y,colors:({id:S,data:x})=>String(x[`${S}Color`]),keys:r,indexBy:i,margin:{top:-10,right:0,bottom:50,left:140,...t},layout:"horizontal",enableGridY:!1,enableGridX:!1,padding:n,enableLabel:!1,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,...u},axisLeft:null,layers:[...d,
|
|
562
|
+
`,oM=(e,C=12)=>{const n=document.createElement("canvas").getContext("2d");return n.font=`${C}px Roboto`,n.measureText(e)},Bo1=(e,C,t=12)=>{const n=e.split(" "),r=[];let i=n[0];for(let o=1;o<n.length;o++){const a=`${i} ${n[o]}`;oM(a,t).width>C?(r.push(i),i=n[o]):i=a}return r.push(i),r},Wo1=({data:e=[],height:C=600,margin:t={},padding:n=.5,keys:r=null,indexBy:i=null,tooltip:o=null,enableLabel:a=!1,label:s=null,keyLabelWidth:l=120,keyLabelPadding:c=20,axisBottom:u={},layers:d=["grid","axes"]})=>{const f=({bar:S})=>{var A;const x=M.useRef(null),[$,O]=M.useState(0),E=((A=S==null?void 0:S.data)==null?void 0:A.indexValue)||"label",_=Bo1(E,l,Ca);M.useEffect(()=>{if(x.current){const H=x.current.getBoundingClientRect();O(H.height)}},[]);const V=l+c,R=S.y+S.height/2-$/2;return w.jsx("g",{ref:x,transform:`translate(-${V}, ${R})`,children:w.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:_.map((H,L)=>w.jsx(Pv,{x:0,dy:L>0?Cc:Ca,children:H},L))})})};let g=null;const v=({bars:S})=>S.map((x,$)=>{var O;if(name=(O=x==null?void 0:x.data)==null?void 0:O.id,!(name!==g&&g!==null))return g=name,w.jsx(f,{bar:x},`bar-label-${$}`)}),h=({bar:S})=>{const $=s==null?void 0:s(S.data),O=oM($,10),E=O.actualBoundingBoxRight+O.actualBoundingBoxLeft,_=O.actualBoundingBoxAscent+O.actualBoundingBoxDescent;if(E>=S.width)return w.jsx(w.Fragment,{});const V=S.x+S.width/2-E/2,R=S.y+S.height/2+_/2;return w.jsx("g",{transform:`translate(${V}, ${R})`,children:w.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:w.jsx(Pv,{style:{fontSize:10},children:$||"label"})})})},b=({bars:S})=>S.map((x,$)=>w.jsx(h,{bar:x},`bar-inner-label-${$}`)),p=({data:S,keys:x})=>{const $=x==null?void 0:x.map(O=>{var E;return{name:O,color:(E=S[0])==null?void 0:E[`${O}Color`]}});return w.jsx(l3,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:$.map((O,E)=>w.jsxs(l3,{gap:8,align:"center",children:[w.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:O.color}}),w.jsx(zo1,{children:O.name})]},`legend-${E}`))})},y=e.slice().reverse();return d.push("bars"),a&&d.push(b),w.jsxs(l3,{vertical:!0,gap:8,children:[w.jsx("div",{style:{height:C},children:w.jsx(rM,{data:y,colors:({id:S,data:x})=>String(x[`${S}Color`]),keys:r,indexBy:i,margin:{top:-10,right:0,bottom:50,left:140,...t},layout:"horizontal",enableGridY:!1,enableGridX:!1,padding:n,enableLabel:!1,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,...u},axisLeft:null,layers:[...d,v],tooltip:S=>w.jsx(p4,{body:(o==null?void 0:o(S))||w.jsx("span",{children:"Tooltip"})})})}),w.jsx(p,{data:e,keys:r})]})};exports.AddressLink=wN;exports.BarChart=Wo1;exports.BenchmarkSankey=Jn1;exports.ButtonControls=eN;exports.CustomToolTip=p4;exports.Description=EN;exports.DomRawChart=Fo1;exports.DownloadButton=tb;exports.EmailLink=xN;exports.ExpandButton=nb;exports.GFButton=Ja;exports.GFCard=E9;exports.GFMetricsGrid=_N;exports.Link=st;exports.LocationIcon=db;exports.MailIcon=ub;exports.Metrics=lb;exports.NavCard=rN;exports.PhoneIcon=cb;exports.PhoneLink=SN;exports.PieChart=D81;exports.QuickNavCard=uN;exports.Sankey=r81;exports.ScatterPlot=ke1;exports.TabCard=dN;exports.Title=ab;exports.TreeMap=_n1;exports.Trends=Yn1;exports.VisSelectors=Xn1;exports.WasteOverview=Ao1;
|
|
563
563
|
//# sourceMappingURL=index.cjs.js.map
|