@semcore/d3-chart 2.1.0 → 2.2.2

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.
Files changed (114) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +113 -0
  3. package/lib/cjs/Area.js +79 -38
  4. package/lib/cjs/Area.js.map +1 -1
  5. package/lib/cjs/Axis.js +14 -14
  6. package/lib/cjs/Bar.js +14 -12
  7. package/lib/cjs/Bar.js.map +1 -1
  8. package/lib/cjs/Bubble.js +11 -10
  9. package/lib/cjs/Bubble.js.map +1 -1
  10. package/lib/cjs/Donut.js +127 -51
  11. package/lib/cjs/Donut.js.map +1 -1
  12. package/lib/cjs/Dots.js +24 -25
  13. package/lib/cjs/Dots.js.map +1 -1
  14. package/lib/cjs/GroupBar.js +7 -7
  15. package/lib/cjs/GroupBar.js.map +1 -1
  16. package/lib/cjs/HorizontalBar.js +8 -8
  17. package/lib/cjs/Hover.js +4 -4
  18. package/lib/cjs/Line.js +12 -10
  19. package/lib/cjs/Line.js.map +1 -1
  20. package/lib/cjs/Plot.js +3 -3
  21. package/lib/cjs/RadialTree.js +12 -12
  22. package/lib/cjs/ReferenceLine.js +258 -0
  23. package/lib/cjs/ReferenceLine.js.map +1 -0
  24. package/lib/cjs/ResponsiveContainer.js +1 -1
  25. package/lib/cjs/ResponsiveContainer.js.map +1 -1
  26. package/lib/cjs/ScatterPlot.js +8 -7
  27. package/lib/cjs/ScatterPlot.js.map +1 -1
  28. package/lib/cjs/StackBar.js +6 -6
  29. package/lib/cjs/StackedArea.js +7 -7
  30. package/lib/cjs/Tooltip.js +11 -10
  31. package/lib/cjs/Tooltip.js.map +1 -1
  32. package/lib/cjs/Venn.js +7 -7
  33. package/lib/cjs/createElement.js +6 -4
  34. package/lib/cjs/createElement.js.map +1 -1
  35. package/lib/cjs/index.js +8 -0
  36. package/lib/cjs/index.js.map +1 -1
  37. package/lib/cjs/style/dot.shadow.css +10 -5
  38. package/lib/cjs/style/reference-line.shadow.css +37 -0
  39. package/lib/cjs/types/Area.d.ts +1 -0
  40. package/lib/cjs/types/Bar.d.ts +4 -0
  41. package/lib/cjs/types/Bubble.d.ts +6 -1
  42. package/lib/cjs/types/Donut.d.ts +4 -0
  43. package/lib/cjs/types/ReferenceLine.d.ts +31 -0
  44. package/lib/cjs/types/index.d.ts +3 -0
  45. package/lib/es6/Area.js +77 -36
  46. package/lib/es6/Area.js.map +1 -1
  47. package/lib/es6/Axis.js +14 -14
  48. package/lib/es6/Bar.js +14 -12
  49. package/lib/es6/Bar.js.map +1 -1
  50. package/lib/es6/Bubble.js +11 -10
  51. package/lib/es6/Bubble.js.map +1 -1
  52. package/lib/es6/Donut.js +121 -51
  53. package/lib/es6/Donut.js.map +1 -1
  54. package/lib/es6/Dots.js +24 -23
  55. package/lib/es6/Dots.js.map +1 -1
  56. package/lib/es6/GroupBar.js +7 -7
  57. package/lib/es6/GroupBar.js.map +1 -1
  58. package/lib/es6/HorizontalBar.js +8 -8
  59. package/lib/es6/Hover.js +4 -4
  60. package/lib/es6/Line.js +12 -10
  61. package/lib/es6/Line.js.map +1 -1
  62. package/lib/es6/Plot.js +3 -3
  63. package/lib/es6/RadialTree.js +12 -12
  64. package/lib/es6/ReferenceLine.js +244 -0
  65. package/lib/es6/ReferenceLine.js.map +1 -0
  66. package/lib/es6/ResponsiveContainer.js +1 -1
  67. package/lib/es6/ResponsiveContainer.js.map +1 -1
  68. package/lib/es6/ScatterPlot.js +8 -7
  69. package/lib/es6/ScatterPlot.js.map +1 -1
  70. package/lib/es6/StackBar.js +6 -6
  71. package/lib/es6/StackedArea.js +7 -7
  72. package/lib/es6/Tooltip.js +11 -10
  73. package/lib/es6/Tooltip.js.map +1 -1
  74. package/lib/es6/Venn.js +7 -7
  75. package/lib/es6/createElement.js +5 -4
  76. package/lib/es6/createElement.js.map +1 -1
  77. package/lib/es6/index.js +1 -0
  78. package/lib/es6/index.js.map +1 -1
  79. package/lib/es6/style/dot.shadow.css +10 -5
  80. package/lib/es6/style/reference-line.shadow.css +37 -0
  81. package/lib/es6/types/Area.d.ts +1 -0
  82. package/lib/es6/types/Bar.d.ts +4 -0
  83. package/lib/es6/types/Bubble.d.ts +6 -1
  84. package/lib/es6/types/Donut.d.ts +4 -0
  85. package/lib/es6/types/ReferenceLine.d.ts +31 -0
  86. package/lib/es6/types/index.d.ts +3 -0
  87. package/lib/types/Area.d.ts +1 -0
  88. package/lib/types/Bar.d.ts +4 -0
  89. package/lib/types/Bubble.d.ts +6 -1
  90. package/lib/types/Donut.d.ts +4 -0
  91. package/lib/types/ReferenceLine.d.ts +31 -0
  92. package/lib/types/index.d.ts +3 -0
  93. package/package.json +12 -12
  94. package/src/Area.jsx +41 -8
  95. package/src/Bar.jsx +6 -5
  96. package/src/Bubble.jsx +1 -0
  97. package/src/Donut.jsx +96 -29
  98. package/src/Dots.jsx +11 -14
  99. package/src/GroupBar.jsx +1 -1
  100. package/src/Line.jsx +2 -1
  101. package/src/ReferenceLine.jsx +146 -0
  102. package/src/ResponsiveContainer.jsx +1 -1
  103. package/src/ScatterPlot.jsx +1 -0
  104. package/src/Tooltip.jsx +2 -3
  105. package/src/createElement.jsx +6 -4
  106. package/src/index.js +1 -0
  107. package/src/style/dot.shadow.css +10 -5
  108. package/src/style/reference-line.shadow.css +37 -0
  109. package/src/types/Area.d.ts +1 -0
  110. package/src/types/Bar.d.ts +4 -0
  111. package/src/types/Bubble.d.ts +6 -1
  112. package/src/types/Donut.d.ts +4 -0
  113. package/src/types/ReferenceLine.d.ts +31 -0
  114. package/src/types/index.d.ts +3 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/createElement.jsx"],"names":["React","useContext","createComponent","createBaseComponent","CONTEXT_COMPONENT","Plot","assignProps","useForkRef","propsForElement","getOriginChildren","hoistNonReactStatics","createElementRender","Element","forwardRef","ref","render","tag","childrenPosition","xS","x","yS","y","source","props","_children","children","Children","mergedProps","Tag","_child","undefined","Error","__excludeProps","elementEnhancement","init","asProps","WrapperComponent","isFunction","$rootProps","WrapComponent","ElementWithContext","displayName","createElement","ElementRoot","child","options","enhancements","Object","keys","forEach","n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,eAAP,IAA0BC,mBAA1B,EAA+CC,iBAA/C,QAAwE,eAAxE;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,WAAP,MAAwB,gCAAxB;AACA,SAASC,UAAT,QAA2B,wBAA3B;AACA,OAAOC,eAAP,MAA4B,oCAA5B;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;;AAEA,SAASC,mBAAT,GAA+B;AAC7B,MAAMC,OAAO,GAAGZ,KAAK,CAACa,UAAN,CAAiB,WAC/B;AAD+B,QAG/BC,GAH+B,EAI/B;AAAA,QAFEC,MAEF,QAFEA,MAEF;AAAA,QAFUC,GAEV,QAFUA,GAEV;AAAA,qCAFeC,gBAEf;AAAA,QAFeA,gBAEf,sCAFkC,OAElC;AAAA,QAF8CC,EAE9C,QAF2CC,CAE3C;AAAA,QAFqDC,EAErD,QAFkDC,CAElD;AAAA,QAF4DC,MAE5D;;AACA,yBAQIV,OAAO,CAACW,KARZ;AAAA,+CACEV,UADF;AAAA,QACEA,UADF,sCACe,IADf;AAAA,QAGYW,SAHZ,kBAGEC,QAHF;AAAA,QAIEC,QAJF,kBAIEA,QAJF;AAAA,0CAKEP,CALF;AAAA,QAKEA,CALF,iCAKMD,EALN;AAAA,0CAMEG,CANF;AAAA,QAMEA,CANF,iCAMMD,EANN;AAAA,QAOKG,KAPL;;AASA,QAAIE,QAAQ,GAAGhB,iBAAiB,CAACiB,QAAD,CAAhC;AAEA,QAAIC,WAAW,GAAGrB,WAAW;AAEzBa,MAAAA,CAAC,EAAED,EAFsB;AAGzBG,MAAAA,CAAC,EAAED;AAHsB,OAItBG,KAJsB;AAKzBT,MAAAA,GAAG,EAAE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,MAA1BC,KAA0B,uEAAlB,EAAkB;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AAC5D,MAAMjC,OAAO,GAAGV,eAAe,CAACyC,WAAD,EAAcC,KAAd,kCAC1BC,OAD0B;AAE7BC,IAAAA,YAAY,EAAE,CAACb,kBAAD;AAFe,KAA/B;AAKAc,EAAAA,MAAM,CAACC,IAAP,CAAYJ,KAAZ,EAAmBK,OAAnB,CAA2B,UAACC,CAAD,EAAO;AAChCtC,IAAAA,OAAO,CAACsC,CAAD,CAAP,GAAaX,aAAa,CAAC3B,OAAO,CAACsC,CAAD,CAAR,CAA1B;AACD,GAFD;AAIA,SAAOX,aAAa,CAAC3B,OAAD,CAApB;AACD;;AAED,eAAe8B,aAAf","sourcesContent":["import React, { useContext } from 'react';\nimport createComponent, { createBaseComponent, CONTEXT_COMPONENT } from '@semcore/core';\nimport Plot from './Plot';\nimport assignProps from '@semcore/utils/lib/assignProps';\nimport { useForkRef } from '@semcore/utils/lib/ref';\nimport propsForElement from '@semcore/utils/lib/propsForElement';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nfunction createElementRender() {\n const Element = React.forwardRef(function (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { render, tag, childrenPosition = 'below', x: xS, y: yS, ...source },\n ref,\n ) {\n const {\n forwardRef = null,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n children: _children,\n Children,\n x = xS,\n y = yS,\n ...props\n } = Element.props;\n let children = getOriginChildren(Children);\n\n let mergedProps = assignProps(\n {\n x: xS,\n y: yS,\n ...props,\n ref: useForkRef(forwardRef, ref),\n },\n {\n x,\n y,\n ...source,\n },\n );\n\n const Tag = typeof render === 'string' ? mergedProps.tag || render : render;\n\n if (typeof children === 'function') {\n const _child = mergedProps.children;\n mergedProps = assignProps(children(mergedProps), mergedProps);\n children = mergedProps.children;\n mergedProps.children = _child;\n }\n\n if (childrenPosition === 'inside') {\n mergedProps.children = children === undefined ? mergedProps.children : children;\n }\n\n if (!Tag) {\n throw new Error('Element expected render prop to be passed');\n }\n return [\n <React.Fragment key=\"child-above\">\n {childrenPosition === 'above' ? children : null}\n </React.Fragment>,\n <Tag\n {...propsForElement(\n {\n __excludeProps: ['data', 'scale'],\n ...mergedProps,\n },\n Tag,\n )}\n key=\"element\"\n />,\n <React.Fragment key=\"child-below\">\n {childrenPosition === 'below' ? children : null}\n </React.Fragment>,\n ];\n });\n\n Element.props = {};\n return Element;\n}\n\nfunction elementEnhancement() {\n return {\n init: function () {\n this.Element = createElementRender();\n },\n asProps: function ({ $rootProps, ...props }, WrapperComponent, isFunction) {\n if (isFunction) {\n return {\n ...$rootProps,\n ...props,\n Element: this.Element,\n };\n }\n return {\n ...$rootProps,\n ...props,\n };\n },\n render: function (render, props) {\n this.Element.props = props;\n return render;\n },\n };\n}\n\nfunction WrapComponent(Element) {\n function ElementWithContext(props, ref) {\n const { $rootProps } = useContext(Plot[CONTEXT_COMPONENT]);\n return <Element ref={ref} $rootProps={$rootProps} {...props} />;\n }\n\n ElementWithContext.displayName = Element.displayName;\n\n const WrapperComponent = createBaseComponent(ElementWithContext);\n WrapperComponent.displayName = Element.displayName;\n\n return hoistNonReactStatics(WrapperComponent, Element);\n}\n\nfunction createElement(ElementRoot, child = {}, options = {}) {\n const Element = createComponent(ElementRoot, child, {\n ...options,\n enhancements: [elementEnhancement],\n });\n\n Object.keys(child).forEach((n) => {\n Element[n] = WrapComponent(Element[n]);\n });\n\n return WrapComponent(Element);\n}\n\nexport default createElement;\n"],"file":"createElement.js"}
1
+ {"version":3,"sources":["../../src/createElement.jsx"],"names":["React","useContext","createComponent","createBaseComponent","CONTEXT_COMPONENT","Plot","assignProps","useForkRef","propsForElement","getOriginChildren","hoistNonReactStatics","EXCLUDE_PROPS","createElementRender","Element","forwardRef","ref","render","childrenPosition","xS","x","yS","y","source","props","_children","children","Children","mergedProps","_child","Tag","tag","undefined","Error","__excludeProps","elementEnhancement","init","asProps","WrapperComponent","isFunction","$rootProps","WrapComponent","ElementWithContext","displayName","createElement","ElementRoot","child","options","enhancements","Object","keys","forEach","n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,eAAP,IAA0BC,mBAA1B,EAA+CC,iBAA/C,QAAwE,eAAxE;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,WAAP,MAAwB,gCAAxB;AACA,SAASC,UAAT,QAA2B,wBAA3B;AACA,OAAOC,eAAP,MAA4B,oCAA5B;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,IAAMC,aAAa,GAAG,CAAC,MAAD,EAAS,OAAT,CAAtB;;AAEA,SAASC,mBAAT,GAA+B;AAC7B,MAAMC,OAAO,GAAGb,KAAK,CAACc,UAAN,CAAiB,WAC/B;AAD+B,QAG/BC,GAH+B,EAI/B;AAAA,QAFEC,MAEF,QAFEA,MAEF;AAAA,qCAFUC,gBAEV;AAAA,QAFUA,gBAEV,sCAF6B,OAE7B;AAAA,QAFyCC,EAEzC,QAFsCC,CAEtC;AAAA,QAFgDC,EAEhD,QAF6CC,CAE7C;AAAA,QAFuDC,MAEvD;;AACA,yBAQIT,OAAO,CAACU,KARZ;AAAA,+CACET,UADF;AAAA,QACEA,UADF,sCACe,IADf;AAAA,QAGYU,SAHZ,kBAGEC,QAHF;AAAA,QAIEC,QAJF,kBAIEA,QAJF;AAAA,0CAKEP,CALF;AAAA,QAKEA,CALF,iCAKMD,EALN;AAAA,0CAMEG,CANF;AAAA,QAMEA,CANF,iCAMMD,EANN;AAAA,QAOKG,KAPL;;AASA,QAAIE,QAAQ,GAAGhB,iBAAiB,CAACiB,QAAD,CAAhC;AAEA,QAAIC,WAAW,GAAGrB,WAAW;AAEzBa,MAAAA,CAAC,EAAED,EAFsB;AAGzBG,MAAAA,CAAC,EAAED;AAHsB,OAItBG,KAJsB;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A8D;AAAA,MAA1BC,KAA0B,uEAAlB,EAAkB;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AAC5D,MAAMjC,OAAO,GAAGX,eAAe,CAAC0C,WAAD,EAAcC,KAAd,kCAC1BC,OAD0B;AAE7BC,IAAAA,YAAY,EAAE,CAACb,kBAAD;AAFe,KAA/B;AAKAc,EAAAA,MAAM,CAACC,IAAP,CAAYJ,KAAZ,EAAmBK,OAAnB,CAA2B,UAACC,CAAD,EAAO;AAChCtC,IAAAA,OAAO,CAACsC,CAAD,CAAP,GAAaX,aAAa,CAAC3B,OAAO,CAACsC,CAAD,CAAR,CAA1B;AACD,GAFD;AAIA,SAAOX,aAAa,CAAC3B,OAAD,CAApB;AACD;;AAED,eAAe8B,aAAf","sourcesContent":["import React, { useContext } from 'react';\nimport createComponent, { createBaseComponent, CONTEXT_COMPONENT } from '@semcore/core';\nimport Plot from './Plot';\nimport assignProps from '@semcore/utils/lib/assignProps';\nimport { useForkRef } from '@semcore/utils/lib/ref';\nimport propsForElement from '@semcore/utils/lib/propsForElement';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nconst EXCLUDE_PROPS = ['data', 'scale'];\n\nfunction createElementRender() {\n const Element = React.forwardRef(function (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { render, childrenPosition = 'below', x: xS, y: yS, ...source },\n ref,\n ) {\n const {\n forwardRef = null,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n children: _children,\n Children,\n x = xS,\n y = yS,\n ...props\n } = Element.props;\n let children = getOriginChildren(Children);\n\n let mergedProps = assignProps(\n {\n x: xS,\n y: yS,\n ...props,\n ref: useForkRef(forwardRef, ref),\n },\n {\n x,\n y,\n ...source,\n },\n );\n\n if (typeof children === 'function') {\n const _child = mergedProps.children;\n mergedProps = assignProps(children(mergedProps), mergedProps);\n children = mergedProps.children;\n mergedProps.children = _child;\n }\n\n const Tag = typeof render === 'string' ? mergedProps.tag || render : render;\n\n if (childrenPosition === 'inside') {\n mergedProps.children = children === undefined ? mergedProps.children : children;\n }\n\n if (!Tag) {\n throw new Error('Element expected render prop to be passed');\n }\n return [\n <React.Fragment key=\"child-above\">\n {childrenPosition === 'above' ? children : null}\n </React.Fragment>,\n <Tag\n {...propsForElement(\n {\n __excludeProps: EXCLUDE_PROPS,\n ...mergedProps,\n },\n Tag,\n )}\n key=\"element\"\n />,\n <React.Fragment key=\"child-below\">\n {childrenPosition === 'below' ? children : null}\n </React.Fragment>,\n ];\n });\n\n Element.props = {};\n return Element;\n}\n\nfunction elementEnhancement() {\n return {\n init: function () {\n this.Element = createElementRender();\n },\n asProps: function ({ $rootProps, ...props }, WrapperComponent, isFunction) {\n if (isFunction) {\n return {\n ...$rootProps,\n ...props,\n Element: this.Element,\n };\n }\n return {\n ...$rootProps,\n ...props,\n };\n },\n render: function (render, props) {\n this.Element.props = props;\n return render;\n },\n };\n}\n\nfunction WrapComponent(Element) {\n function ElementWithContext(props, ref) {\n const { $rootProps } = useContext(Plot[CONTEXT_COMPONENT]);\n return <Element ref={ref} $rootProps={$rootProps} {...props} />;\n }\n\n ElementWithContext.displayName = Element.displayName;\n\n const WrapperComponent = createBaseComponent(ElementWithContext);\n WrapperComponent.displayName = Element.displayName;\n\n return hoistNonReactStatics(WrapperComponent, Element);\n}\n\nfunction createElement(ElementRoot, child = {}, options = {}) {\n const Element = createComponent(ElementRoot, child, {\n ...options,\n enhancements: [elementEnhancement],\n });\n\n Object.keys(child).forEach((n) => {\n Element[n] = WrapComponent(Element[n]);\n });\n\n return WrapComponent(Element);\n}\n\nexport default createElement;\n"],"file":"createElement.js"}
package/lib/es6/index.js CHANGED
@@ -14,6 +14,7 @@ export { default as Donut } from './Donut';
14
14
  export { default as Venn } from './Venn';
15
15
  export { default as Tooltip } from './Tooltip';
16
16
  export { default as ResponsiveContainer } from './ResponsiveContainer';
17
+ export { default as ReferenceLine } from './ReferenceLine';
17
18
  export { HoverLine, HoverRect } from './Hover';
18
19
  export { minMax } from './utils';
19
20
  export { colors } from './color';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.js"],"names":["default","Plot","XAxis","YAxis","Line","Bar","HorizontalBar","GroupBar","StackBar","Area","StackedArea","ScatterPlot","Bubble","RadialTree","Donut","Venn","Tooltip","ResponsiveContainer","HoverLine","HoverRect","minMax","colors"],"mappings":"AAAA,SAASA,OAAO,IAAIC,IAApB,QAAgC,QAAhC;AAEA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,QAA7B;AAEA,SAASH,OAAO,IAAII,IAApB,QAAgC,QAAhC;AAEA,SAASJ,OAAO,IAAIK,GAApB,QAA+B,OAA/B;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,QAApB,QAAoC,YAApC;AACA,SAASP,OAAO,IAAIQ,QAApB,QAAoC,YAApC;AACA,SAASR,OAAO,IAAIS,IAApB,QAAgC,QAAhC;AACA,SAAST,OAAO,IAAIU,WAApB,QAAuC,eAAvC;AACA,SAASV,OAAO,IAAIW,WAApB,QAAuC,eAAvC;AACA,SAASX,OAAO,IAAIY,MAApB,QAAkC,UAAlC;AACA,SAASZ,OAAO,IAAIa,UAApB,QAAsC,cAAtC;AACA,SAASb,OAAO,IAAIc,KAApB,QAAiC,SAAjC;AACA,SAASd,OAAO,IAAIe,IAApB,QAAgC,QAAhC;AAEA,SAASf,OAAO,IAAIgB,OAApB,QAAmC,WAAnC;AAEA,SAAShB,OAAO,IAAIiB,mBAApB,QAA+C,uBAA/C;AAEA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,SAArC;AAEA,SAASC,MAAT,QAAuB,SAAvB;AACA,SAASC,MAAT,QAAuB,SAAvB","sourcesContent":["export { default as Plot } from './Plot';\n\nexport { XAxis, YAxis } from './Axis';\n\nexport { default as Line } from './Line';\n\nexport { default as Bar } from './Bar';\nexport { default as HorizontalBar } from './HorizontalBar';\nexport { default as GroupBar } from './GroupBar';\nexport { default as StackBar } from './StackBar';\nexport { default as Area } from './Area';\nexport { default as StackedArea } from './StackedArea';\nexport { default as ScatterPlot } from './ScatterPlot';\nexport { default as Bubble } from './Bubble';\nexport { default as RadialTree } from './RadialTree';\nexport { default as Donut } from './Donut';\nexport { default as Venn } from './Venn';\n\nexport { default as Tooltip } from './Tooltip';\n\nexport { default as ResponsiveContainer } from './ResponsiveContainer';\n\nexport { HoverLine, HoverRect } from './Hover';\n\nexport { minMax } from './utils';\nexport { colors } from './color';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.js"],"names":["default","Plot","XAxis","YAxis","Line","Bar","HorizontalBar","GroupBar","StackBar","Area","StackedArea","ScatterPlot","Bubble","RadialTree","Donut","Venn","Tooltip","ResponsiveContainer","ReferenceLine","HoverLine","HoverRect","minMax","colors"],"mappings":"AAAA,SAASA,OAAO,IAAIC,IAApB,QAAgC,QAAhC;AAEA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,QAA7B;AAEA,SAASH,OAAO,IAAII,IAApB,QAAgC,QAAhC;AAEA,SAASJ,OAAO,IAAIK,GAApB,QAA+B,OAA/B;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,QAApB,QAAoC,YAApC;AACA,SAASP,OAAO,IAAIQ,QAApB,QAAoC,YAApC;AACA,SAASR,OAAO,IAAIS,IAApB,QAAgC,QAAhC;AACA,SAAST,OAAO,IAAIU,WAApB,QAAuC,eAAvC;AACA,SAASV,OAAO,IAAIW,WAApB,QAAuC,eAAvC;AACA,SAASX,OAAO,IAAIY,MAApB,QAAkC,UAAlC;AACA,SAASZ,OAAO,IAAIa,UAApB,QAAsC,cAAtC;AACA,SAASb,OAAO,IAAIc,KAApB,QAAiC,SAAjC;AACA,SAASd,OAAO,IAAIe,IAApB,QAAgC,QAAhC;AAEA,SAASf,OAAO,IAAIgB,OAApB,QAAmC,WAAnC;AAEA,SAAShB,OAAO,IAAIiB,mBAApB,QAA+C,uBAA/C;AACA,SAASjB,OAAO,IAAIkB,aAApB,QAAyC,iBAAzC;AAEA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,SAArC;AAEA,SAASC,MAAT,QAAuB,SAAvB;AACA,SAASC,MAAT,QAAuB,SAAvB","sourcesContent":["export { default as Plot } from './Plot';\n\nexport { XAxis, YAxis } from './Axis';\n\nexport { default as Line } from './Line';\n\nexport { default as Bar } from './Bar';\nexport { default as HorizontalBar } from './HorizontalBar';\nexport { default as GroupBar } from './GroupBar';\nexport { default as StackBar } from './StackBar';\nexport { default as Area } from './Area';\nexport { default as StackedArea } from './StackedArea';\nexport { default as ScatterPlot } from './ScatterPlot';\nexport { default as Bubble } from './Bubble';\nexport { default as RadialTree } from './RadialTree';\nexport { default as Donut } from './Donut';\nexport { default as Venn } from './Venn';\n\nexport { default as Tooltip } from './Tooltip';\n\nexport { default as ResponsiveContainer } from './ResponsiveContainer';\nexport { default as ReferenceLine } from './ReferenceLine';\n\nexport { HoverLine, HoverRect } from './Hover';\n\nexport { minMax } from './utils';\nexport { colors } from './color';\n"],"file":"index.js"}
@@ -1,20 +1,21 @@
1
1
  @import '@semcore/utils/style/var.css';
2
2
  @import '@semcore/d3-chart/src/style/var.css';
3
3
 
4
+ SDots {
5
+ & SDot {
6
+ transition-duration: var(--duration);
7
+ }
8
+ }
9
+
4
10
  SDot {
5
11
  stroke-width: 2px;
6
12
  stroke: #fff;
7
13
  r: 6px;
8
14
  fill: var(--blue-03);
9
15
  transition-property: cx, cy;
10
- transition-duration: var(--duration);
11
16
  transition-timing-function: ease-in-out;
12
17
  }
13
18
 
14
- SDot[color] {
15
- fill: var(--color);
16
- }
17
-
18
19
  SDot[hide] {
19
20
  display: none;
20
21
  }
@@ -22,3 +23,7 @@ SDot[hide] {
22
23
  SDot[active] {
23
24
  r: 8px;
24
25
  }
26
+
27
+ SDot[color] {
28
+ fill: var(--color);
29
+ }
@@ -0,0 +1,37 @@
1
+ @import '@semcore/utils/style/var.css';
2
+
3
+ SReferenceLine {
4
+ fill: none;
5
+ stroke: var(--gray-300);
6
+ }
7
+
8
+ STitle {
9
+ font-size: var(--fs-100);
10
+ fill: var(--gray-500);
11
+ transform-origin: var(--transform-origin);
12
+ }
13
+
14
+ STitle[position='top'] {
15
+ text-anchor: middle;
16
+ }
17
+
18
+ STitle[position='bottom'] {
19
+ text-anchor: middle;
20
+ alignment-baseline: hanging;
21
+ }
22
+
23
+ STitle[position='right'] {
24
+ transform: rotate(-90deg);
25
+ alignment-baseline: middle;
26
+ text-anchor: middle;
27
+ }
28
+
29
+ STitle[position='left'] {
30
+ transform: rotate(-90deg);
31
+ text-anchor: middle;
32
+ alignment-baseline: middle;
33
+ }
34
+
35
+ SBackground {
36
+ fill: color-mod(var(--gray-200) a(20%));
37
+ }
@@ -42,6 +42,7 @@ export interface IAreaNullProps extends IContext {
42
42
  declare const Area: (<T>(props: CProps<IAreaProps & T>) => ReturnEl) & {
43
43
  Dots: <T>(props: CProps<IAreaDotsProps & T, IAreaDotsContext>) => ReturnEl;
44
44
  Null: <T>(props: CProps<IAreaNullProps & T>) => ReturnEl;
45
+ Line: <T>(props: CProps<IContext & T>) => ReturnEl;
45
46
  };
46
47
 
47
48
  export default Area;
@@ -19,6 +19,10 @@ export interface IBarProps extends IContext {
19
19
  * @default 2
20
20
  */
21
21
  r?: number | number[];
22
+ /** Minimal height
23
+ * @default 4
24
+ */
25
+ hMin?: number;
22
26
  }
23
27
 
24
28
  export interface IBarContext {
@@ -22,6 +22,11 @@ export interface IBubbleProps extends IContext {
22
22
  duration?: number;
23
23
  }
24
24
 
25
- declare const Bubble: <T>(props: CProps<IBubbleProps & T>) => ReturnEl;
25
+ export interface IBubbleContext {
26
+ /** Index element of data */
27
+ index: number;
28
+ }
29
+
30
+ declare const Bubble: <T>(props: CProps<IBubbleProps & T, IBubbleContext>) => ReturnEl;
26
31
 
27
32
  export default Bubble;
@@ -27,6 +27,10 @@ export interface IPieProps extends IContext {
27
27
  @default #50aef4
28
28
  **/
29
29
  color?: string;
30
+ /**
31
+ * Active sector
32
+ * */
33
+ active?: boolean;
30
34
  }
31
35
 
32
36
  export interface IEmptyDataProps extends IContext {}
@@ -0,0 +1,31 @@
1
+ import { CProps, ReturnEl } from '@semcore/core';
2
+ import IContext from './context';
3
+
4
+ export interface IReferenceLineProps extends IContext {
5
+ /** The position of the title relative reference line
6
+ * @default 'left' */
7
+ position?: 'top' | 'right' | 'bottom' | 'left';
8
+ /** Value element of data */
9
+ value: any;
10
+ }
11
+
12
+ export interface IReferenceLineTitleProps extends IContext {
13
+ /** The position of the axis relative reference line */
14
+ position?: 'top' | 'right' | 'bottom' | 'left';
15
+ /** Value element of data */
16
+ value: any;
17
+ }
18
+
19
+ export interface IReferenceLineBackgroundProps extends IContext {
20
+ /** The position of the axis relative reference line */
21
+ position?: 'top' | 'right' | 'bottom' | 'left';
22
+ /** Value element of data */
23
+ value: any;
24
+ }
25
+
26
+ declare const ReferenceLine: (<T>(props: CProps<IReferenceLineProps & T>) => ReturnEl) & {
27
+ Title: <T>(props: CProps<IReferenceLineTitleProps & T>) => ReturnEl;
28
+ Background: <T>(props: CProps<IReferenceLineBackgroundProps & T>) => ReturnEl;
29
+ };
30
+
31
+ export default ReferenceLine;
@@ -51,3 +51,6 @@ export * from './ScatterPlot';
51
51
 
52
52
  export { default as Bubble } from './Bubble';
53
53
  export * from './Bubble';
54
+
55
+ export { default as ReferenceLine } from './ReferenceLine';
56
+ export * from './ReferenceLine';
@@ -42,6 +42,7 @@ export interface IAreaNullProps extends IContext {
42
42
  declare const Area: (<T>(props: CProps<IAreaProps & T>) => ReturnEl) & {
43
43
  Dots: <T>(props: CProps<IAreaDotsProps & T, IAreaDotsContext>) => ReturnEl;
44
44
  Null: <T>(props: CProps<IAreaNullProps & T>) => ReturnEl;
45
+ Line: <T>(props: CProps<IContext & T>) => ReturnEl;
45
46
  };
46
47
 
47
48
  export default Area;
@@ -19,6 +19,10 @@ export interface IBarProps extends IContext {
19
19
  * @default 2
20
20
  */
21
21
  r?: number | number[];
22
+ /** Minimal height
23
+ * @default 4
24
+ */
25
+ hMin?: number;
22
26
  }
23
27
 
24
28
  export interface IBarContext {
@@ -22,6 +22,11 @@ export interface IBubbleProps extends IContext {
22
22
  duration?: number;
23
23
  }
24
24
 
25
- declare const Bubble: <T>(props: CProps<IBubbleProps & T>) => ReturnEl;
25
+ export interface IBubbleContext {
26
+ /** Index element of data */
27
+ index: number;
28
+ }
29
+
30
+ declare const Bubble: <T>(props: CProps<IBubbleProps & T, IBubbleContext>) => ReturnEl;
26
31
 
27
32
  export default Bubble;
@@ -27,6 +27,10 @@ export interface IPieProps extends IContext {
27
27
  @default #50aef4
28
28
  **/
29
29
  color?: string;
30
+ /**
31
+ * Active sector
32
+ * */
33
+ active?: boolean;
30
34
  }
31
35
 
32
36
  export interface IEmptyDataProps extends IContext {}
@@ -0,0 +1,31 @@
1
+ import { CProps, ReturnEl } from '@semcore/core';
2
+ import IContext from './context';
3
+
4
+ export interface IReferenceLineProps extends IContext {
5
+ /** The position of the title relative reference line
6
+ * @default 'left' */
7
+ position?: 'top' | 'right' | 'bottom' | 'left';
8
+ /** Value element of data */
9
+ value: any;
10
+ }
11
+
12
+ export interface IReferenceLineTitleProps extends IContext {
13
+ /** The position of the axis relative reference line */
14
+ position?: 'top' | 'right' | 'bottom' | 'left';
15
+ /** Value element of data */
16
+ value: any;
17
+ }
18
+
19
+ export interface IReferenceLineBackgroundProps extends IContext {
20
+ /** The position of the axis relative reference line */
21
+ position?: 'top' | 'right' | 'bottom' | 'left';
22
+ /** Value element of data */
23
+ value: any;
24
+ }
25
+
26
+ declare const ReferenceLine: (<T>(props: CProps<IReferenceLineProps & T>) => ReturnEl) & {
27
+ Title: <T>(props: CProps<IReferenceLineTitleProps & T>) => ReturnEl;
28
+ Background: <T>(props: CProps<IReferenceLineBackgroundProps & T>) => ReturnEl;
29
+ };
30
+
31
+ export default ReferenceLine;
@@ -51,3 +51,6 @@ export * from './ScatterPlot';
51
51
 
52
52
  export { default as Bubble } from './Bubble';
53
53
  export * from './Bubble';
54
+
55
+ export { default as ReferenceLine } from './ReferenceLine';
56
+ export * from './ReferenceLine';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@semcore/d3-chart",
3
3
  "description": "SEMRush D3 Chart Component",
4
- "version": "2.1.0",
4
+ "version": "2.2.2",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
8
8
  "sideEffects": false,
9
- "author": "Roman Lysov <r.lysov@semrush.com>",
9
+ "author": "UI-kit team <ui-kit-team@semrush.com>",
10
10
  "license": "MIT",
11
11
  "scripts": {
12
12
  "build": "build --source=js,ts",
@@ -19,12 +19,12 @@
19
19
  "@semcore/utils": "^3.15",
20
20
  "@upsetjs/venn.js": "1.4.1",
21
21
  "d3-array": "3.1.6",
22
- "d3-shape": "3.1.0",
23
- "d3-scale": "3.3.0",
24
22
  "d3-interpolate": "3.0.1",
23
+ "d3-scale": "3.3.0",
24
+ "d3-shape": "3.1.0",
25
25
  "d3-transition": "3.0.1",
26
- "resize-observer-polyfill": "1.5.1",
27
- "hoist-non-react-statics": "3.3.2"
26
+ "hoist-non-react-statics": "3.3.2",
27
+ "resize-observer-polyfill": "1.5.1"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@semcore/core": "^1.11",
@@ -39,14 +39,14 @@
39
39
  "directory": "semcore/d3-chart"
40
40
  },
41
41
  "devDependencies": {
42
+ "@semcore/button": "*",
43
+ "@semcore/checkbox": "*",
44
+ "@semcore/dropdown-menu": "*",
45
+ "@semcore/icon": "*",
42
46
  "@semcore/jest-preset-ui": "1.0.0",
47
+ "@semcore/typography": "*",
43
48
  "@types/d3-array": "^3.0.2",
44
49
  "@types/d3-scale": "^4.0.2",
45
- "@types/d3-transition": "^3.0.1",
46
- "@semcore/typography": "*",
47
- "@semcore/dropdown-menu": "*",
48
- "@semcore/button": "*",
49
- "@semcore/checkbox": "*",
50
- "@semcore/icon": "*"
50
+ "@types/d3-transition": "^3.0.1"
51
51
  }
52
52
  }
package/src/Area.jsx CHANGED
@@ -6,6 +6,7 @@ import createElement from './createElement';
6
6
  import { definedData, scaleOfBandwidth, getNullData, definedNullData } from './utils';
7
7
  import ClipPath from './ClipPath';
8
8
  import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
9
+ import findComponent from '@semcore/utils/lib/findComponent';
9
10
 
10
11
  import style from './style/area.shadow.css';
11
12
 
@@ -55,18 +56,34 @@ class AreaRoot extends Component {
55
56
  };
56
57
  }
57
58
 
59
+ getLineProps() {
60
+ const { duration, color, data, d3Line, uid } = this.asProps;
61
+
62
+ return {
63
+ uid,
64
+ data,
65
+ d3: d3Line,
66
+ color,
67
+ duration,
68
+ };
69
+ }
70
+
58
71
  render() {
59
72
  const SArea = this.Element;
60
73
  const SAreaLine = 'path';
61
- const { styles, hide, d3, d3Line, data, color, uid, size, duration } = this.asProps;
74
+ const { styles, hide, d3, d3Line, data, color, uid, size, duration, Children } = this.asProps;
75
+ const advanceMode = !!findComponent(Children, [Area.Line.displayName]);
76
+
62
77
  return sstyled(styles)(
63
78
  <>
64
- <SAreaLine
65
- clipPath={`url(#${uid})`}
66
- d={d3Line(data)}
67
- color={color}
68
- use:duration={`${duration}ms`}
69
- />
79
+ {!advanceMode && (
80
+ <SAreaLine
81
+ clipPath={`url(#${uid})`}
82
+ d={d3Line(data)}
83
+ color={color}
84
+ use:duration={`${duration}ms`}
85
+ />
86
+ )}
70
87
  <SArea
71
88
  clipPath={`url(#${uid})`}
72
89
  render="path"
@@ -93,12 +110,28 @@ class AreaRoot extends Component {
93
110
  }
94
111
  }
95
112
 
113
+ function Line(props) {
114
+ const { Element: SAreaLine, styles, d3, data, color, duration, uid } = props;
115
+ return sstyled(styles)(
116
+ <SAreaLine
117
+ render="path"
118
+ clipPath={`url(#${uid})`}
119
+ d={d3(data)}
120
+ color={color}
121
+ use:duration={`${duration}ms`}
122
+ />,
123
+ );
124
+ }
125
+
96
126
  function Null(props) {
97
127
  const { Element: SNull, styles, d3, data, hide, color } = props;
98
128
  return sstyled(styles)(<SNull render="path" d={d3(data)} hide={hide} color={color} />);
99
129
  }
100
130
 
101
- export default createElement(AreaRoot, {
131
+ const Area = createElement(AreaRoot, {
102
132
  Dots,
103
133
  Null,
134
+ Line,
104
135
  });
136
+
137
+ export default Area;
package/src/Bar.jsx CHANGED
@@ -17,6 +17,7 @@ class BarRoot extends Component {
17
17
  offset: [0, 0],
18
18
  duration: 500,
19
19
  r: 2,
20
+ hMin: 4,
20
21
  };
21
22
 
22
23
  getBackgroundProps(props, index) {
@@ -58,15 +59,15 @@ class BarRoot extends Component {
58
59
  duration,
59
60
  uid,
60
61
  r,
62
+ hMin,
61
63
  width: widthProps,
62
64
  } = this.asProps;
63
65
 
64
66
  const [xScale, yScale] = scale;
65
- const barY = yScale(Math.max(d[y0] ?? 0, d[y])) + offset[1];
67
+ const barY = yScale(Math.max(d[y0] ?? 0, d[y])) + offset[1] - (Object.is(d[y], 0) ? hMin : 0);
66
68
  const barX = xScale(d[x]) + offset[0];
67
- const height = Math.abs(
68
- yScale(d[y]) - Math.min(yScale(yScale.domain()[0]), yScale(d[y0] ?? 0)),
69
- );
69
+ const height =
70
+ Math.abs(yScale(d[y]) - Math.min(yScale(yScale.domain()[0]), yScale(d[y0] ?? 0))) || hMin;
70
71
  const width = widthProps || getBandwidth(xScale);
71
72
  const dSvg = getRect({
72
73
  x: barX,
@@ -74,7 +75,7 @@ class BarRoot extends Component {
74
75
  width,
75
76
  height,
76
77
  radius: Array.isArray(r) ? r[i] : r,
77
- position: d[y] > 0 ? 'top' : 'bottom',
78
+ position: d[y] > 0 || Object.is(d[y], 0) ? 'top' : 'bottom',
78
79
  });
79
80
 
80
81
  return sstyled(styles)(
package/src/Bubble.jsx CHANGED
@@ -117,6 +117,7 @@ class BubbleRoot extends Component {
117
117
  )}
118
118
  <SBubble
119
119
  id={`${uid}${uid}`}
120
+ index={i}
120
121
  render="circle"
121
122
  clipPath={`url(#${uid})`}
122
123
  cx={xScale(d[x]) + offset[0]}