@automattic/charts 0.56.0 → 0.56.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 (87) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/charts/bar-chart/index.cjs +3 -3
  3. package/dist/charts/bar-chart/index.css +6 -1
  4. package/dist/charts/bar-chart/index.css.map +1 -1
  5. package/dist/charts/bar-chart/index.js +2 -2
  6. package/dist/charts/bar-list-chart/index.cjs +4 -4
  7. package/dist/charts/bar-list-chart/index.css +6 -1
  8. package/dist/charts/bar-list-chart/index.css.map +1 -1
  9. package/dist/charts/bar-list-chart/index.js +3 -3
  10. package/dist/charts/conversion-funnel-chart/index.css +0 -1
  11. package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
  12. package/dist/charts/geo-chart/index.cjs +3 -3
  13. package/dist/charts/geo-chart/index.css +6 -1
  14. package/dist/charts/geo-chart/index.css.map +1 -1
  15. package/dist/charts/geo-chart/index.js +2 -2
  16. package/dist/charts/leaderboard-chart/index.cjs +3 -3
  17. package/dist/charts/leaderboard-chart/index.css +6 -1
  18. package/dist/charts/leaderboard-chart/index.css.map +1 -1
  19. package/dist/charts/leaderboard-chart/index.js +2 -2
  20. package/dist/charts/line-chart/index.cjs +3 -3
  21. package/dist/charts/line-chart/index.css +6 -1
  22. package/dist/charts/line-chart/index.css.map +1 -1
  23. package/dist/charts/line-chart/index.js +2 -2
  24. package/dist/charts/pie-chart/index.cjs +3 -3
  25. package/dist/charts/pie-chart/index.css +6 -1
  26. package/dist/charts/pie-chart/index.css.map +1 -1
  27. package/dist/charts/pie-chart/index.js +2 -2
  28. package/dist/charts/pie-semi-circle-chart/index.cjs +3 -3
  29. package/dist/charts/pie-semi-circle-chart/index.css +6 -1
  30. package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
  31. package/dist/charts/pie-semi-circle-chart/index.js +2 -2
  32. package/dist/charts/sparkline/index.cjs +4 -4
  33. package/dist/charts/sparkline/index.css +6 -1
  34. package/dist/charts/sparkline/index.css.map +1 -1
  35. package/dist/charts/sparkline/index.js +3 -3
  36. package/dist/{chunk-R2CNVHX4.js → chunk-2VPPTJS2.js} +2 -2
  37. package/dist/{chunk-B3DFLK2K.cjs → chunk-7UJPVCMB.cjs} +3 -3
  38. package/dist/{chunk-B3DFLK2K.cjs.map → chunk-7UJPVCMB.cjs.map} +1 -1
  39. package/dist/{chunk-VKXEGONO.js → chunk-C33AQZEC.js} +9 -1
  40. package/dist/chunk-C33AQZEC.js.map +1 -0
  41. package/dist/{chunk-272NNCPI.js → chunk-COOC2TVQ.js} +3 -3
  42. package/dist/{chunk-PG2PMWB4.js → chunk-EJHLLXBV.js} +2 -2
  43. package/dist/{chunk-4GZN73UT.js → chunk-FWMJ2FR2.js} +2 -2
  44. package/dist/{chunk-CG33WKLC.cjs → chunk-IZWC33YN.cjs} +3 -3
  45. package/dist/{chunk-CG33WKLC.cjs.map → chunk-IZWC33YN.cjs.map} +1 -1
  46. package/dist/{chunk-MHPM4VM6.cjs → chunk-KOF32DBL.cjs} +3 -3
  47. package/dist/{chunk-MHPM4VM6.cjs.map → chunk-KOF32DBL.cjs.map} +1 -1
  48. package/dist/{chunk-KCTWZVS7.cjs → chunk-LHWRZMF7.cjs} +3 -3
  49. package/dist/{chunk-KCTWZVS7.cjs.map → chunk-LHWRZMF7.cjs.map} +1 -1
  50. package/dist/{chunk-MZIJOH7W.cjs → chunk-MFRS2PEY.cjs} +3 -3
  51. package/dist/{chunk-MZIJOH7W.cjs.map → chunk-MFRS2PEY.cjs.map} +1 -1
  52. package/dist/{chunk-HOTYXYXV.cjs → chunk-NW3RUYK2.cjs} +9 -1
  53. package/dist/chunk-NW3RUYK2.cjs.map +1 -0
  54. package/dist/{chunk-XYRHRIOW.cjs → chunk-ODF5O5PV.cjs} +3 -3
  55. package/dist/{chunk-XYRHRIOW.cjs.map → chunk-ODF5O5PV.cjs.map} +1 -1
  56. package/dist/{chunk-M6EUGS3O.js → chunk-SBRMWDWM.js} +2 -2
  57. package/dist/{chunk-27SM4IQP.js → chunk-T4J6TI55.js} +3 -3
  58. package/dist/{chunk-QPSI3WAI.js → chunk-TNRKEBTA.js} +2 -2
  59. package/dist/{chunk-EKCJKLOF.cjs → chunk-XVMXWV3C.cjs} +5 -5
  60. package/dist/{chunk-EKCJKLOF.cjs.map → chunk-XVMXWV3C.cjs.map} +1 -1
  61. package/dist/{chunk-FLF337K7.cjs → chunk-YYQ4IK5V.cjs} +5 -5
  62. package/dist/{chunk-FLF337K7.cjs.map → chunk-YYQ4IK5V.cjs.map} +1 -1
  63. package/dist/{chunk-6MRFBHMH.js → chunk-ZDNCF642.js} +2 -2
  64. package/dist/components/legend/index.css +0 -1
  65. package/dist/components/legend/index.css.map +1 -1
  66. package/dist/hooks/index.css +0 -1
  67. package/dist/hooks/index.css.map +1 -1
  68. package/dist/index.cjs +10 -10
  69. package/dist/index.css +6 -1
  70. package/dist/index.css.map +1 -1
  71. package/dist/index.js +9 -9
  72. package/dist/providers/index.css +0 -1
  73. package/dist/providers/index.css.map +1 -1
  74. package/package.json +4 -4
  75. package/src/charts/private/with-responsive/with-responsive.module.scss +5 -0
  76. package/src/charts/private/with-responsive/with-responsive.tsx +2 -0
  77. package/src/components/legend/private/base-legend.module.scss +0 -1
  78. package/dist/chunk-HOTYXYXV.cjs.map +0 -1
  79. package/dist/chunk-VKXEGONO.js.map +0 -1
  80. /package/dist/{chunk-R2CNVHX4.js.map → chunk-2VPPTJS2.js.map} +0 -0
  81. /package/dist/{chunk-272NNCPI.js.map → chunk-COOC2TVQ.js.map} +0 -0
  82. /package/dist/{chunk-PG2PMWB4.js.map → chunk-EJHLLXBV.js.map} +0 -0
  83. /package/dist/{chunk-4GZN73UT.js.map → chunk-FWMJ2FR2.js.map} +0 -0
  84. /package/dist/{chunk-M6EUGS3O.js.map → chunk-SBRMWDWM.js.map} +0 -0
  85. /package/dist/{chunk-27SM4IQP.js.map → chunk-T4J6TI55.js.map} +0 -0
  86. /package/dist/{chunk-QPSI3WAI.js.map → chunk-TNRKEBTA.js.map} +0 -0
  87. /package/dist/{chunk-6MRFBHMH.js.map → chunk-ZDNCF642.js.map} +0 -0
@@ -1,4 +1,5 @@
1
1
  import { useParentSize } from '@visx/responsive';
2
+ import styles from './with-responsive.module.scss';
2
3
  import type { BaseChartProps } from '../../../types';
3
4
  import type { ComponentType } from 'react';
4
5
 
@@ -96,6 +97,7 @@ export function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'o
96
97
  <div
97
98
  ref={ parentRef }
98
99
  data-testid="responsive-wrapper"
100
+ className={ styles.container }
99
101
  style={ {
100
102
  width: size ?? width ?? '100%',
101
103
  height: size ?? height ?? defaultHeight,
@@ -104,7 +104,6 @@
104
104
  .legend-item-text {
105
105
 
106
106
  &--wrap {
107
- word-wrap: break-word;
108
107
  overflow-wrap: break-word;
109
108
  white-space: normal;
110
109
  hyphens: auto;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-HOTYXYXV.cjs","../src/charts/private/with-responsive/with-responsive.tsx"],"names":[],"mappings":"AAAA;ACAA,8CAA8B;AAuG1B,+CAAA;AA5EJ,IAAM,wBAAA,EAA0B,CAAE;AAAA,EACjC,mBAAA,EAAqB,GAAA;AAAA,EACrB,SAAA,EAAW,IAAA;AAAA,EACX;AACD,CAAA,EAAA,GAAyB;AACxB,EAAA,MAAM;AAAA,IACL,SAAA;AAAA,IACA,KAAA,EAAO,WAAA;AAAA,IACP,MAAA,EAAQ;AAAA,EACT,EAAA,EAAI,uCAAA;AAAe,IAClB,YAAA,EAAc,kBAAA;AAAA,IACd,yBAAA,EAA2B;AAAA,EAC5B,CAAE,CAAA;AAEF,EAAA,MAAM,eAAA,EAAiB,YAAA,EAAc,EAAA,EAAI,IAAA,CAAK,GAAA,CAAK,WAAA,EAAa,QAAS,EAAA,EAAI,CAAA;AAC7E,EAAA,MAAM,gBAAA,EAAkB,YAAA,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,UAAC,gBAAA;AAAA,UAAA;AAAA,YACA,KAAA,EAAQ,cAAA;AAAA,YACR,MAAA,EAAS,eAAA;AAAA,YACT,IAAA,EAAO,cAAA;AAAA,YACL,GAAK;AAAA,UAAA;AAAA,QACR;AAAA,MAAA;AAAA,IACD,CAAA;AAAA,EAEF,CAAA;AACD;ADrCA;AACA;AACE;AACF,wCAAC","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-HOTYXYXV.cjs","sourcesContent":[null,"import { useParentSize } from '@visx/responsive';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, height is calculated from width.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\nconst useResponsiveDimensions = ( {\n\tresizeDebounceTime = 300,\n\tmaxWidth = 1200,\n\taspectRatio,\n}: ResponsiveConfig ) => {\n\tconst {\n\t\tparentRef,\n\t\twidth: parentWidth,\n\t\theight: parentHeight,\n\t} = useParentSize( {\n\t\tdebounceTime: resizeDebounceTime,\n\t\tenableDebounceLeadingCall: true,\n\t} );\n\n\tconst containerWidth = parentWidth > 0 ? Math.min( parentWidth, maxWidth ) : 0;\n\tconst containerHeight = aspectRatio !== undefined ? containerWidth * aspectRatio : parentHeight;\n\n\treturn {\n\t\tparentRef,\n\t\twidth: containerWidth,\n\t\theight: containerHeight,\n\t\t/**\n\t\t * Whether an aspectRatio was provided. Used to determine container\n\t\t * height styling: 'auto' when true (height derived from width),\n\t\t * '100%' when false (fill parent container).\n\t\t */\n\t\thasAspectRatio: aspectRatio !== undefined,\n\t};\n};\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: measuredWidth,\n\t\t\theight: measuredHeight,\n\t\t\thasAspectRatio,\n\t\t} = useResponsiveDimensions( {\n\t\t\tresizeDebounceTime,\n\t\t\tmaxWidth,\n\t\t\taspectRatio,\n\t\t} );\n\n\t\t// Use measured dimensions, but fall back to explicit props if measurement returns 0\n\t\t// (e.g., during initial render or in test environments without DOM measurement)\n\t\tconst effectiveWidth = measuredWidth || size || width || 0;\n\t\tconst effectiveHeight = measuredHeight || size || height || 0;\n\n\t\tconst defaultHeight = hasAspectRatio ? 'auto' : '100%';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ parentRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: size ?? width ?? '100%',\n\t\t\t\t\theight: size ?? height ?? defaultHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WrappedComponent\n\t\t\t\t\twidth={ effectiveWidth }\n\t\t\t\t\theight={ effectiveHeight }\n\t\t\t\t\tsize={ effectiveWidth }\n\t\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/private/with-responsive/with-responsive.tsx"],"sourcesContent":["import { useParentSize } from '@visx/responsive';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, height is calculated from width.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\nconst useResponsiveDimensions = ( {\n\tresizeDebounceTime = 300,\n\tmaxWidth = 1200,\n\taspectRatio,\n}: ResponsiveConfig ) => {\n\tconst {\n\t\tparentRef,\n\t\twidth: parentWidth,\n\t\theight: parentHeight,\n\t} = useParentSize( {\n\t\tdebounceTime: resizeDebounceTime,\n\t\tenableDebounceLeadingCall: true,\n\t} );\n\n\tconst containerWidth = parentWidth > 0 ? Math.min( parentWidth, maxWidth ) : 0;\n\tconst containerHeight = aspectRatio !== undefined ? containerWidth * aspectRatio : parentHeight;\n\n\treturn {\n\t\tparentRef,\n\t\twidth: containerWidth,\n\t\theight: containerHeight,\n\t\t/**\n\t\t * Whether an aspectRatio was provided. Used to determine container\n\t\t * height styling: 'auto' when true (height derived from width),\n\t\t * '100%' when false (fill parent container).\n\t\t */\n\t\thasAspectRatio: aspectRatio !== undefined,\n\t};\n};\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: measuredWidth,\n\t\t\theight: measuredHeight,\n\t\t\thasAspectRatio,\n\t\t} = useResponsiveDimensions( {\n\t\t\tresizeDebounceTime,\n\t\t\tmaxWidth,\n\t\t\taspectRatio,\n\t\t} );\n\n\t\t// Use measured dimensions, but fall back to explicit props if measurement returns 0\n\t\t// (e.g., during initial render or in test environments without DOM measurement)\n\t\tconst effectiveWidth = measuredWidth || size || width || 0;\n\t\tconst effectiveHeight = measuredHeight || size || height || 0;\n\n\t\tconst defaultHeight = hasAspectRatio ? 'auto' : '100%';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ parentRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: size ?? width ?? '100%',\n\t\t\t\t\theight: size ?? height ?? defaultHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WrappedComponent\n\t\t\t\t\twidth={ effectiveWidth }\n\t\t\t\t\theight={ effectiveHeight }\n\t\t\t\t\tsize={ effectiveWidth }\n\t\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAuG1B;AA5EJ,IAAM,0BAA0B,CAAE;AAAA,EACjC,qBAAqB;AAAA,EACrB,WAAW;AAAA,EACX;AACD,MAAyB;AACxB,QAAM;AAAA,IACL;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,EACT,IAAI,cAAe;AAAA,IAClB,cAAc;AAAA,IACd,2BAA2B;AAAA,EAC5B,CAAE;AAEF,QAAM,iBAAiB,cAAc,IAAI,KAAK,IAAK,aAAa,QAAS,IAAI;AAC7E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