@automattic/charts 0.56.7 → 0.58.0
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/AGENTS.md +28 -98
- package/CHANGELOG.md +30 -0
- package/dist/charts/bar-chart/index.cjs +7 -6
- package/dist/charts/bar-chart/index.cjs.map +1 -1
- package/dist/charts/bar-chart/index.css +12 -24
- package/dist/charts/bar-chart/index.css.map +1 -1
- package/dist/charts/bar-chart/index.d.cts +3 -4
- package/dist/charts/bar-chart/index.d.ts +3 -4
- package/dist/charts/bar-chart/index.js +6 -5
- package/dist/charts/bar-list-chart/index.cjs +8 -7
- package/dist/charts/bar-list-chart/index.cjs.map +1 -1
- package/dist/charts/bar-list-chart/index.css +12 -24
- package/dist/charts/bar-list-chart/index.css.map +1 -1
- package/dist/charts/bar-list-chart/index.d.cts +3 -3
- package/dist/charts/bar-list-chart/index.d.ts +3 -3
- package/dist/charts/bar-list-chart/index.js +7 -6
- package/dist/charts/conversion-funnel-chart/index.cjs +5 -6
- package/dist/charts/conversion-funnel-chart/index.cjs.map +1 -1
- package/dist/charts/conversion-funnel-chart/index.css +0 -94
- package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
- package/dist/charts/conversion-funnel-chart/index.d.cts +1 -1
- package/dist/charts/conversion-funnel-chart/index.d.ts +1 -1
- package/dist/charts/conversion-funnel-chart/index.js +4 -5
- package/dist/charts/geo-chart/index.cjs +4 -4
- package/dist/charts/geo-chart/index.css +0 -94
- package/dist/charts/geo-chart/index.css.map +1 -1
- package/dist/charts/geo-chart/index.d.cts +1 -1
- package/dist/charts/geo-chart/index.d.ts +1 -1
- package/dist/charts/geo-chart/index.js +3 -3
- package/dist/charts/leaderboard-chart/index.cjs +7 -6
- package/dist/charts/leaderboard-chart/index.cjs.map +1 -1
- package/dist/charts/leaderboard-chart/index.css +20 -33
- package/dist/charts/leaderboard-chart/index.css.map +1 -1
- package/dist/charts/leaderboard-chart/index.d.cts +3 -3
- package/dist/charts/leaderboard-chart/index.d.ts +3 -3
- package/dist/charts/leaderboard-chart/index.js +6 -5
- package/dist/charts/line-chart/index.cjs +7 -6
- package/dist/charts/line-chart/index.cjs.map +1 -1
- package/dist/charts/line-chart/index.css +12 -24
- package/dist/charts/line-chart/index.css.map +1 -1
- package/dist/charts/line-chart/index.d.cts +3 -4
- package/dist/charts/line-chart/index.d.ts +3 -4
- package/dist/charts/line-chart/index.js +6 -5
- package/dist/charts/pie-chart/index.cjs +7 -7
- package/dist/charts/pie-chart/index.css +12 -24
- package/dist/charts/pie-chart/index.css.map +1 -1
- package/dist/charts/pie-chart/index.d.cts +7 -13
- package/dist/charts/pie-chart/index.d.ts +7 -13
- package/dist/charts/pie-chart/index.js +6 -6
- package/dist/charts/pie-semi-circle-chart/index.cjs +7 -7
- package/dist/charts/pie-semi-circle-chart/index.css +12 -24
- package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
- package/dist/charts/pie-semi-circle-chart/index.d.cts +7 -13
- package/dist/charts/pie-semi-circle-chart/index.d.ts +7 -13
- package/dist/charts/pie-semi-circle-chart/index.js +6 -6
- package/dist/charts/sparkline/index.cjs +8 -7
- package/dist/charts/sparkline/index.cjs.map +1 -1
- package/dist/charts/sparkline/index.css +12 -24
- package/dist/charts/sparkline/index.css.map +1 -1
- package/dist/charts/sparkline/index.js +7 -6
- package/dist/{chunk-RFSHE3HL.js → chunk-2I67QUIV.js} +84 -431
- package/dist/chunk-2I67QUIV.js.map +1 -0
- package/dist/{chunk-OMS5QIJN.js → chunk-2ICEEQOC.js} +31 -25
- package/dist/chunk-2ICEEQOC.js.map +1 -0
- package/dist/{chunk-GWBS65VC.js → chunk-4B7BL2DD.js} +3 -3
- package/dist/{chunk-7FDQGBY7.js → chunk-4OXMTKAL.js} +24 -24
- package/dist/chunk-4OXMTKAL.js.map +1 -0
- package/dist/{chunk-SSFFCBCF.js → chunk-B6NLZFRW.js} +32 -26
- package/dist/chunk-B6NLZFRW.js.map +1 -0
- package/dist/{chunk-3EXJP67N.cjs → chunk-BBAUQOW6.cjs} +9 -9
- package/dist/{chunk-3EXJP67N.cjs.map → chunk-BBAUQOW6.cjs.map} +1 -1
- package/dist/{chunk-NQJE2CC7.cjs → chunk-CMMHCTBX.cjs} +45 -45
- package/dist/chunk-CMMHCTBX.cjs.map +1 -0
- package/dist/{chunk-O2JIANHK.cjs → chunk-CPPXJATQ.cjs} +51 -45
- package/dist/chunk-CPPXJATQ.cjs.map +1 -0
- package/dist/{chunk-MDRCAGKZ.js → chunk-DKU775VC.js} +3 -3
- package/dist/{chunk-BXFD7JIG.cjs → chunk-GRA7Y2ZG.cjs} +46 -46
- package/dist/chunk-GRA7Y2ZG.cjs.map +1 -0
- package/dist/{chunk-TE63Y5PX.js → chunk-JJIMABHT.js} +10 -3
- package/dist/chunk-JJIMABHT.js.map +1 -0
- package/dist/{chunk-KHQPN77E.js → chunk-KJHWXOCZ.js} +4 -4
- package/dist/{chunk-6CCZL2JJ.js → chunk-KRWGSOJ2.js} +30 -2
- package/dist/chunk-KRWGSOJ2.js.map +1 -0
- package/dist/{chunk-VPAEBI2F.js → chunk-LTFH7SEG.js} +24 -24
- package/dist/chunk-LTFH7SEG.js.map +1 -0
- package/dist/{chunk-E62LCBGD.js → chunk-MUNOKLLE.js} +3 -3
- package/dist/{chunk-ZVGEDXDP.cjs → chunk-MXGLYWVP.cjs} +10 -3
- package/dist/chunk-MXGLYWVP.cjs.map +1 -0
- package/dist/{chunk-55ZCOYDF.cjs → chunk-OYC34VTO.cjs} +252 -827
- package/dist/chunk-OYC34VTO.cjs.map +1 -0
- package/dist/{chunk-CAFJRZPZ.cjs → chunk-PQL5I3F6.cjs} +17 -17
- package/dist/{chunk-CAFJRZPZ.cjs.map → chunk-PQL5I3F6.cjs.map} +1 -1
- package/dist/{chunk-UFRBUT2D.cjs → chunk-REZTQ4PH.cjs} +87 -24
- package/dist/chunk-REZTQ4PH.cjs.map +1 -0
- package/dist/{chunk-RCY6XLGU.cjs → chunk-TZRUHQOH.cjs} +36 -8
- package/dist/chunk-TZRUHQOH.cjs.map +1 -0
- package/dist/{chunk-XD2HV7M5.js → chunk-UTYVIOWZ.js} +226 -801
- package/dist/chunk-UTYVIOWZ.js.map +1 -0
- package/dist/{chunk-YAXY5L7I.cjs → chunk-W2LDIX26.cjs} +5 -5
- package/dist/{chunk-YAXY5L7I.cjs.map → chunk-W2LDIX26.cjs.map} +1 -1
- package/dist/{chunk-K6TGILHX.cjs → chunk-WSG64BVN.cjs} +6 -6
- package/dist/{chunk-K6TGILHX.cjs.map → chunk-WSG64BVN.cjs.map} +1 -1
- package/dist/chunk-WTQYGUNF.js +400 -0
- package/dist/chunk-WTQYGUNF.js.map +1 -0
- package/dist/{chunk-YDVHT7GS.cjs → chunk-WYK7EL5R.cjs} +100 -447
- package/dist/chunk-WYK7EL5R.cjs.map +1 -0
- package/dist/{chunk-X7JL2NYJ.cjs → chunk-XC4KHJYX.cjs} +51 -45
- package/dist/chunk-XC4KHJYX.cjs.map +1 -0
- package/dist/chunk-XVBH5XHE.cjs +400 -0
- package/dist/chunk-XVBH5XHE.cjs.map +1 -0
- package/dist/{chunk-IS5YYLTV.js → chunk-YAFQVVDI.js} +85 -22
- package/dist/chunk-YAFQVVDI.js.map +1 -0
- package/dist/components/legend/index.cjs +4 -3
- package/dist/components/legend/index.cjs.map +1 -1
- package/dist/components/legend/index.css +12 -24
- package/dist/components/legend/index.css.map +1 -1
- package/dist/components/legend/index.d.cts +4 -4
- package/dist/components/legend/index.d.ts +4 -4
- package/dist/components/legend/index.js +3 -2
- package/dist/components/tooltip/index.d.cts +1 -1
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/hooks/index.cjs +3 -5
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.css +0 -94
- package/dist/hooks/index.css.map +1 -1
- package/dist/hooks/index.d.cts +9 -13
- package/dist/hooks/index.d.ts +9 -13
- package/dist/hooks/index.js +2 -4
- package/dist/index.cjs +18 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +20 -33
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +17 -16
- package/dist/{leaderboard-chart-COtgamhe.d.cts → leaderboard-chart-BSbg0ufV.d.cts} +3 -11
- package/dist/{leaderboard-chart-BSgEw_Um.d.ts → leaderboard-chart-odEYxxEC.d.ts} +3 -11
- package/dist/{legend-C9ahiwOt.d.cts → legend-DFkosEvC.d.cts} +1 -1
- package/dist/{legend-jjMmhSg3.d.ts → legend-DLswHhOk.d.ts} +1 -1
- package/dist/providers/index.cjs +3 -3
- package/dist/providers/index.css +0 -94
- package/dist/providers/index.css.map +1 -1
- package/dist/providers/index.d.cts +3 -3
- package/dist/providers/index.d.ts +3 -3
- package/dist/providers/index.js +2 -2
- package/dist/{themes-CVR5rmIs.d.cts → themes-D0qc5JaW.d.cts} +2 -2
- package/dist/{themes-DQzmaSze.d.ts → themes-itO4Ht5g.d.ts} +2 -2
- package/dist/{types-BBwg4Evw.d.cts → types-B5f6XQ7Q.d.cts} +1 -1
- package/dist/{types-DQNnq5Fr.d.ts → types-BsHooDbM.d.ts} +1 -1
- package/dist/{types-C05PdDJa.d.cts → types-BuSrRM4p.d.ts} +15 -23
- package/dist/{types-CzdN7rUe.d.cts → types-ChOUI9-N.d.cts} +90 -46
- package/dist/{types-CzdN7rUe.d.ts → types-ChOUI9-N.d.ts} +90 -46
- package/dist/{types-C05PdDJa.d.ts → types-Dfw9VOKI.d.cts} +15 -23
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +10 -8
- package/src/charts/bar-chart/bar-chart.tsx +19 -19
- package/src/charts/bar-chart/test/bar-chart.test.tsx +78 -31
- package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +2 -2
- package/src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts +0 -2
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +9 -10
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +124 -102
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +61 -33
- package/src/charts/leaderboard-chart/test/use-leaderboard-legend-items.test.tsx +2 -5
- package/src/charts/leaderboard-chart/types.ts +2 -15
- package/src/charts/line-chart/line-chart.tsx +18 -17
- package/src/charts/line-chart/test/line-chart.test.tsx +49 -27
- package/src/charts/line-chart/types.ts +0 -1
- package/src/charts/pie-chart/pie-chart.tsx +23 -23
- package/src/charts/pie-chart/test/composition-api.test.tsx +41 -0
- package/src/charts/pie-chart/test/pie-chart.test.tsx +9 -9
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +21 -24
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +33 -5
- package/src/charts/private/chart-composition/index.ts +2 -0
- package/src/charts/private/chart-composition/render-legend-slot.ts +22 -0
- package/src/charts/private/chart-composition/test/render-legend-slot.test.tsx +60 -0
- package/src/charts/private/chart-composition/test/use-chart-children.test.tsx +91 -0
- package/src/charts/private/chart-composition/use-chart-children.ts +34 -2
- package/src/components/legend/private/base-legend.module.scss +19 -37
- package/src/components/legend/private/base-legend.tsx +32 -24
- package/src/components/legend/test/legend.test.tsx +148 -52
- package/src/components/legend/types.ts +23 -24
- package/src/hooks/index.ts +0 -1
- package/src/hooks/test/use-zero-value-display.test.tsx +206 -0
- package/src/hooks/use-zero-value-display.ts +52 -23
- package/src/providers/chart-context/test/chart-context.test.tsx +12 -6
- package/src/providers/chart-context/themes.ts +6 -4
- package/src/types.ts +93 -44
- package/src/utils/date-parsing.ts +10 -1
- package/src/utils/get-styles.ts +1 -1
- package/src/utils/test/date-parsing.test.ts +12 -0
- package/src/utils/test/get-styles.test.ts +12 -10
- package/src/utils/test/resolve-css-var.test.ts +2 -2
- package/tsup.config.ts +1 -1
- package/dist/chunk-55ZCOYDF.cjs.map +0 -1
- package/dist/chunk-6CCZL2JJ.js.map +0 -1
- package/dist/chunk-7FDQGBY7.js.map +0 -1
- package/dist/chunk-BXFD7JIG.cjs.map +0 -1
- package/dist/chunk-IS5YYLTV.js.map +0 -1
- package/dist/chunk-KNIMXN6Z.js +0 -51
- package/dist/chunk-KNIMXN6Z.js.map +0 -1
- package/dist/chunk-NQJE2CC7.cjs.map +0 -1
- package/dist/chunk-O2JIANHK.cjs.map +0 -1
- package/dist/chunk-OMS5QIJN.js.map +0 -1
- package/dist/chunk-RCY6XLGU.cjs.map +0 -1
- package/dist/chunk-RFSHE3HL.js.map +0 -1
- package/dist/chunk-SSFFCBCF.js.map +0 -1
- package/dist/chunk-SUDERBUA.cjs +0 -51
- package/dist/chunk-SUDERBUA.cjs.map +0 -1
- package/dist/chunk-TE63Y5PX.js.map +0 -1
- package/dist/chunk-UFRBUT2D.cjs.map +0 -1
- package/dist/chunk-VPAEBI2F.js.map +0 -1
- package/dist/chunk-X7JL2NYJ.cjs.map +0 -1
- package/dist/chunk-XD2HV7M5.js.map +0 -1
- package/dist/chunk-YDVHT7GS.cjs.map +0 -1
- package/dist/chunk-ZVGEDXDP.cjs.map +0 -1
- package/src/hooks/use-has-legend-child.ts +0 -22
- /package/dist/{chunk-GWBS65VC.js.map → chunk-4B7BL2DD.js.map} +0 -0
- /package/dist/{chunk-MDRCAGKZ.js.map → chunk-DKU775VC.js.map} +0 -0
- /package/dist/{chunk-KHQPN77E.js.map → chunk-KJHWXOCZ.js.map} +0 -0
- /package/dist/{chunk-E62LCBGD.js.map → chunk-MUNOKLLE.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-YDVHT7GS.cjs","../src/hooks/use-deep-memo.ts","../src/hooks/use-chart-mouse-handler.ts","../src/hooks/use-xychart-theme.ts","../src/providers/chart-context/global-charts-provider.tsx","../src/hooks/use-tooltip-portal-relocator.ts","../src/hooks/use-tooltip-portal-relocator.module.scss","../src/providers/chart-context/private/get-chart-color.ts","../src/providers/chart-context/themes.ts","../src/providers/chart-context/hooks/use-global-charts-context.ts","../src/providers/chart-context/hooks/use-chart-id.ts","../src/providers/chart-context/hooks/use-chart-registration.ts","../src/providers/chart-context/hooks/use-global-charts-theme.ts","../src/hooks/use-chart-data-transform.ts","../src/hooks/use-chart-margin.tsx","../src/hooks/use-element-size.ts","../src/hooks/use-has-legend-child.ts","../src/components/legend/legend.tsx","../src/charts/private/single-chart-context/single-chart-context.tsx","../src/charts/private/single-chart-context/use-single-chart-context.ts","../src/components/legend/private/base-legend.tsx","../src/components/legend/utils/value-or-identity.ts","../src/components/legend/utils/label-transform-factory.ts","../src/components/legend/private/base-legend.module.scss","../src/components/legend/hooks/use-chart-legend-items.ts","../src/hooks/use-text-truncation.ts","../src/hooks/use-zero-value-display.ts","../src/hooks/use-interactive-legend-data.ts","../src/hooks/use-prefers-reduced-motion.ts"],"names":["useRef","d3Hsl","useEffect","useCallback","useMemo","useContext","useState","createContext"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACZA,8GAAoB;AACpB,8BAAuB;AAShB,IAAM,YAAA,EAAc,CAAO,KAAA,EAAA,GAAiB;AAClD,EAAA,MAAM,IAAA,EAAM,2BAAA,KAAmB,CAAA;AAE/B,EAAA,GAAA,CAAK,CAAE,qCAAA,GAAS,CAAI,OAAA,EAAS,KAAM,CAAA,EAAI;AACtC,IAAA,GAAA,CAAI,QAAA,EAAU,KAAA;AAAA,EACf;AAEA,EAAA,OAAO,GAAA,CAAI,OAAA;AACZ,CAAA;ADIA;AACA;AEvBA,oCAA2B;AAC3B,wCAA2B;AAC3B;AAmDO,IAAM,qBAAA,EAAuB,CAAE;AAAA,EACrC,YAAA;AAAA,EACA,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU,CAAA;AACX,CAAA,EAAA,GAA8D;AAC7D,EAAA,MAAM,E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AA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACgF;AAE1E,EAAA;AAEE,IAAA;AACN,MAAA;AACD,IAAA;AAGM,IAAA;AAGD,IAAA;AACJ,MAAA;AACD,IAAA;AAGM,IAAA;AAEC,IAAA;AACH,MAAA;AACH,MAAA;AACG,IAAA;AACA,EAAA;AAGC,EAAA;AACE,IAAA;AACH,EAAA;AAIC,EAAA;AACE,IAAA;AACN,MAAA;AACD,IAAA;AAGO,IAAA;AACN,MAAA;AACO,MAAA;AAEN,QAAA;AACD,MAAA;AAGA,MAAA;AACA,MAAA;AACC,IAAA;AACE,EAAA;AAEI,EAAA;AACV;A3BmiCW;AACA;A4B7qCF;AAIH;AAEA;AAMU;AACP,EAAA;AAERF,EAAAA;AACO,IAAA;AAEA,IAAA;AACL,MAAA;AACD,IAAA;AAEA,IAAA;AAEO,IAAA;AACN,MAAA;AACD,IAAA;AACK,EAAA;AAEC,EAAA;AACR;A5BiqCW;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-YDVHT7GS.cjs","sourcesContent":[null,"import isEqual from 'fast-deep-equal';\nimport { useRef } from 'react';\n\n/**\n * Custom hook to memoize a value using deep equality comparison.\n * Prevents unnecessary re-renders when objects have the same content but different references.\n *\n * @param value - The value to memoize with deep equality comparison\n * @return The memoized value that only changes when deeply different\n */\nexport const useDeepMemo = < T >( value: T ): T => {\n\tconst ref = useRef< T >( value );\n\n\tif ( ! isEqual( ref.current, value ) ) {\n\t\tref.current = value;\n\t}\n\n\treturn ref.current;\n};\n","import { localPoint } from '@visx/event';\nimport { useTooltip } from '@visx/tooltip';\nimport { useCallback, type MouseEvent } from 'react';\nimport type { DataPoint } from '../types';\n\ntype UseChartMouseHandlerProps = {\n\t/**\n\t * Whether tooltips are enabled\n\t */\n\twithTooltips: boolean;\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\toffsetX?: number;\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -10)\n\t */\n\toffsetY?: number;\n};\n\ntype UseChartMouseHandlerReturn = {\n\t/**\n\t * Handler for mouse move events\n\t */\n\tonMouseMove: ( event: MouseEvent< SVGElement >, data: DataPoint ) => void;\n\t/**\n\t * Handler for mouse leave events\n\t */\n\tonMouseLeave: () => void;\n\t/**\n\t * Whether the tooltip is currently open\n\t */\n\ttooltipOpen: boolean;\n\t/**\n\t * The current tooltip data\n\t */\n\ttooltipData: DataPoint | null;\n\t/**\n\t * The current tooltip left position\n\t */\n\ttooltipLeft: number | undefined;\n\t/**\n\t * The current tooltip top position\n\t */\n\ttooltipTop: number | undefined;\n};\n\n/**\n * Hook to handle mouse interactions for chart components\n *\n * @param {UseChartMouseHandlerProps} props - Hook configuration\n * @return {UseChartMouseHandlerReturn} Object containing handlers and tooltip state\n */\nexport const useChartMouseHandler = ( {\n\twithTooltips,\n\toffsetX = 0,\n\toffsetY = -10,\n}: UseChartMouseHandlerProps ): UseChartMouseHandlerReturn => {\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPoint >();\n\n\tconst onMouseMove = useCallback(\n\t\t( event: MouseEvent< SVGElement >, data: DataPoint ) => {\n\t\t\tif ( ! withTooltips ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst coords = localPoint( event );\n\t\t\tif ( ! coords ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: data,\n\t\t\t\ttooltipLeft: coords.x + offsetX,\n\t\t\t\ttooltipTop: coords.y + offsetY,\n\t\t\t} );\n\t\t},\n\t\t[ withTooltips, showTooltip, offsetX, offsetY ]\n\t);\n\n\tconst onMouseLeave = useCallback( () => {\n\t\tif ( ! withTooltips ) {\n\t\t\treturn;\n\t\t}\n\t\thideTooltip();\n\t}, [ withTooltips, hideTooltip ] );\n\n\treturn {\n\t\tonMouseMove,\n\t\tonMouseLeave,\n\t\ttooltipOpen,\n\t\ttooltipData: tooltipData || null,\n\t\ttooltipLeft,\n\t\ttooltipTop,\n\t};\n};\n","import { buildChartTheme } from '@visx/xychart';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../providers';\nimport type { SeriesData } from '../types';\n\nexport const useXYChartTheme = ( data: SeriesData[] ) => {\n\tconst theme = useGlobalChartsTheme();\n\n\treturn useMemo( () => {\n\t\tconst seriesColors = ( data ?? [] )\n\t\t\t.map( series => series.options?.stroke )\n\t\t\t.filter( ( color ): color is string => Boolean( color ) );\n\n\t\treturn buildChartTheme( {\n\t\t\t...theme,\n\t\t\tcolors: [ ...seriesColors, ...( theme.colors ?? [] ) ],\n\t\t} );\n\t}, [ theme, data ] );\n};\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport { createContext, useCallback, useMemo, useState, useEffect, useLayoutEffect, useRef } from 'react';\nimport { useTooltipPortalRelocator } from '../../hooks/use-tooltip-portal-relocator';\nimport { getItemShapeStyles, getSeriesLineStyles, mergeThemes, resolveCssVariable, normalizeColorToHex } from '../../utils';\nimport { getChartColor } from './private/get-chart-color';\nimport { defaultTheme } from './themes';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const GlobalChartsContext = /*#__PURE__*/createContext(null);\nexport const GlobalChartsProvider = ({\n children,\n theme,\n portalContainer\n}) => {\n const [charts, setCharts] = useState(() => new Map());\n // Track hidden series per chart: chartId -> Set<seriesLabel>\n const [hiddenSeries, setHiddenSeries] = useState(() => new Map());\n\n // Ref to the wrapper element for resolving scoped CSS variables\n const wrapperRef = useRef(null);\n\n // Relocate tooltip portals into the wrapper (or a consumer-provided container) for z-index control.\n useTooltipPortalRelocator(portalContainer ?? wrapperRef);\n const providerTheme = useMemo(() => {\n return theme ? mergeThemes(defaultTheme, theme) : defaultTheme;\n }, [theme]);\n\n // Cache expensive color computations that only change when theme colors change\n // Using useState + useLayoutEffect instead of useMemo to ensure CSS variables\n // in <style> tags are applied to the DOM before we try to resolve them\n const [colorCache, setColorCache] = useState(() => ({\n colors: [],\n hues: [],\n existingHslColors: [],\n minHue: 360,\n maxHue: 0\n }));\n\n // Compute color cache after DOM is updated (so CSS variables are available)\n // Resolves CSS variables from the wrapper element's scope to handle scoped variables\n // Note: Only re-runs when providerTheme changes, not when wrapper element changes.\n // This is intentional, as wrapperRef is expected to be stable for the lifetime of the provider.\n useLayoutEffect(() => {\n const {\n colors\n } = providerTheme;\n const resolvedColors = [];\n const hues = [];\n const existingHslColors = [];\n let minHue = 360;\n let maxHue = 0;\n\n // Process all colors once and cache the results\n if (Array.isArray(colors)) {\n for (const color of colors) {\n if (color && typeof color === 'string') {\n let colorValue = color;\n\n // Handle CSS custom properties - resolve them to actual values\n // Supports both '--var-name' and 'var(--var-name)' formats\n // Use wrapper element to resolve scoped CSS variables\n if (color.startsWith('--') || color.startsWith('var(')) {\n const resolved = resolveCssVariable(color, wrapperRef.current);\n if (resolved === null || resolved === '') {\n continue;\n }\n colorValue = resolved;\n }\n\n // Process hex colors\n if (colorValue.startsWith('#')) {\n resolvedColors.push(colorValue);\n const hslColor = d3Hsl(colorValue);\n // d3Hsl returns NaN values for invalid colors\n if (!isNaN(hslColor.h)) {\n const hslTuple = [hslColor.h, hslColor.s * 100, hslColor.l * 100];\n hues.push(hslTuple[0]);\n existingHslColors.push(hslTuple);\n minHue = Math.min(minHue, hslTuple[0]);\n maxHue = Math.max(maxHue, hslTuple[0]);\n }\n }\n }\n }\n }\n setColorCache({\n colors: resolvedColors,\n hues,\n existingHslColors,\n minHue,\n maxHue\n });\n }, [providerTheme]);\n const [groupToColorMap, setGroupToColorMap] = useState(() => new Map());\n\n // Reset group color mappings when theme colors change\n useEffect(() => {\n // Create a completely new Map instance to trigger dependencies, e.g. useChartLegendItems\n setGroupToColorMap(new Map());\n }, [providerTheme.colors]);\n const registerChart = useCallback((id, data) => {\n setCharts(prev => new Map(prev).set(id, data));\n }, []);\n const unregisterChart = useCallback(id => {\n setCharts(prev => {\n const newMap = new Map(prev);\n newMap.delete(id);\n return newMap;\n });\n }, []);\n const getChartData = useCallback(id => {\n return charts.get(id);\n }, [charts]);\n const resolveColor = useCallback(({\n group,\n index,\n overrideColor\n }) => {\n // Highest precedence: eg. explicit series stroke or chart color prop\n if (overrideColor) {\n return normalizeColorToHex(overrideColor, wrapperRef.current, resolveCssVariable);\n }\n\n // If group provided, maintain a stable assignment\n if (group) {\n const existing = groupToColorMap.get(group);\n if (existing) {\n return existing;\n }\n\n // Use map size as index to assign colors sequentially (0, 1, 2...)\n // ensuring each new group gets the next available palette color\n const assignedCount = groupToColorMap.size;\n const color = getChartColor(assignedCount, colorCache);\n groupToColorMap.set(group, color);\n return color;\n }\n return getChartColor(index, colorCache);\n }, [colorCache, groupToColorMap]);\n const getElementStyles = useCallback(({\n data,\n index,\n overrideColor,\n legendShape\n }) => {\n const isSeriesData = data && typeof data === 'object' && 'data' in data && 'options' in data;\n const isPointPercentageData = data && typeof data === 'object' && 'percentage' in data;\n return {\n color: resolveColor({\n group: data?.group,\n index,\n overrideColor: overrideColor || isSeriesData && data?.options?.stroke || isPointPercentageData && data?.color\n }),\n lineStyles: isSeriesData ? getSeriesLineStyles(data, index, providerTheme) : {},\n glyph: providerTheme.glyphs?.[index],\n shapeStyles: isSeriesData ? getItemShapeStyles(data, index, providerTheme, legendShape) : {}\n };\n }, [providerTheme, resolveColor]);\n\n // Series visibility management methods\n const toggleSeriesVisibility = useCallback((chartId, seriesLabel) => {\n setHiddenSeries(prev => {\n const newMap = new Map(prev);\n const chartHidden = newMap.get(chartId) || new Set();\n const newSet = new Set(chartHidden);\n if (newSet.has(seriesLabel)) {\n newSet.delete(seriesLabel);\n } else {\n newSet.add(seriesLabel);\n }\n if (newSet.size === 0) {\n newMap.delete(chartId);\n } else {\n newMap.set(chartId, newSet);\n }\n return newMap;\n });\n }, []);\n const isSeriesVisible = useCallback((chartId, seriesLabel) => {\n const chartHidden = hiddenSeries.get(chartId);\n return !chartHidden || !chartHidden.has(seriesLabel);\n }, [hiddenSeries]);\n const getHiddenSeries = useCallback(chartId => {\n const set = hiddenSeries.get(chartId);\n return set ? new Set(set) : new Set();\n }, [hiddenSeries]);\n const value = useMemo(() => ({\n charts,\n registerChart,\n unregisterChart,\n getChartData,\n theme: providerTheme,\n getElementStyles,\n toggleSeriesVisibility,\n isSeriesVisible,\n getHiddenSeries\n }), [charts, registerChart, unregisterChart, getChartData, providerTheme, getElementStyles, toggleSeriesVisibility, isSeriesVisible, getHiddenSeries]);\n return /*#__PURE__*/_jsx(GlobalChartsContext.Provider, {\n value: value,\n children: /*#__PURE__*/_jsx(\"div\", {\n ref: wrapperRef,\n style: {\n display: 'contents'\n },\n children: children\n })\n });\n};","import { useEffect } from 'react';\nimport styles from './use-tooltip-portal-relocator.module.scss';\nimport type { RefObject } from 'react';\n\n/**\n * Detects whether a DOM node is a visx chart tooltip portal.\n *\n * visx renders tooltips via `ReactDOM.createPortal` into plain `<div>` elements\n * appended to `document.body`. These portals have no id or className and contain\n * a child element with the class `visx-tooltip`.\n * @param node - The DOM node to check.\n * @return Whether the node is a visx tooltip portal div.\n */\nfunction isVisxPortalNode( node: Node ): node is HTMLDivElement {\n\treturn (\n\t\tnode instanceof HTMLDivElement &&\n\t\tnode.parentElement === document.body &&\n\t\t! node.id &&\n\t\t! node.className &&\n\t\tnode.querySelector( '.visx-tooltip' ) !== null\n\t);\n}\n\n// Shared state for the document.body.removeChild patch.\n// Reference-counted so multiple hook instances can coexist safely.\nlet patchRefCount = 0;\nlet origRemoveChild: typeof document.body.removeChild | null = null;\nlet patchedRemoveChild: typeof document.body.removeChild | null = null;\nconst relocatedNodes = new WeakSet< Node >();\n\n/**\n * Installs (or increments the ref count of) the shared removeChild patch.\n */\nfunction installRemoveChildPatch() {\n\tif ( patchRefCount++ > 0 ) {\n\t\treturn;\n\t}\n\torigRemoveChild = document.body.removeChild;\n\tpatchedRemoveChild = function < T extends Node >( this: HTMLElement, child: T ): T {\n\t\tif ( relocatedNodes.has( child ) && child.parentNode !== this ) {\n\t\t\trelocatedNodes.delete( child );\n\t\t\tchild.parentNode?.removeChild( child );\n\t\t\treturn child;\n\t\t}\n\t\treturn origRemoveChild!.call( this, child );\n\t};\n\tdocument.body.removeChild = patchedRemoveChild;\n}\n\n/**\n * Decrements the ref count and removes the patch when no instances remain.\n * If another library has since wrapped our patch, we leave it in place to\n * avoid breaking their chain — our function becomes a transparent pass-through\n * once all relocated nodes have been cleaned up.\n */\nfunction uninstallRemoveChildPatch() {\n\tif ( --patchRefCount > 0 ) {\n\t\treturn;\n\t}\n\t// Only revert if removeChild is still our function. If something else\n\t// has wrapped it, reverting would break their patch.\n\tif ( document.body.removeChild === patchedRemoveChild ) {\n\t\tdocument.body.removeChild = origRemoveChild!;\n\t}\n\torigRemoveChild = null;\n\tpatchedRemoveChild = null;\n}\n\n/**\n * Relocates visx chart tooltip portals from `document.body` into a target\n * container element. This allows the tooltips to participate in the same CSS\n * stacking context as other elements in the container (e.g. a sticky header),\n * so z-index ordering works correctly between them.\n *\n * The relocated portal divs use `position: fixed` at the viewport origin to\n * preserve the tooltip coordinate system (visx calculates positions relative\n * to the viewport).\n *\n * Because the visx Portal class calls `document.body.removeChild(node)` during\n * unmount, we patch `document.body.removeChild` to gracefully handle nodes that\n * were moved out of body. Without this, React throws a \"not a child of this\n * node\" error when tooltips unmount.\n *\n * **Important:** The container and its ancestors must not have CSS `transform`,\n * `perspective`, or `filter` properties set, as these create a new containing\n * block for `position: fixed` children, breaking viewport-relative positioning.\n *\n * @param containerRef - Ref to the element that portals should be relocated into.\n * The element referenced here, or one of its ancestors,\n * should establish the desired stacking context (for example\n * by using position and z-index).\n */\nexport function useTooltipPortalRelocator(\n\tcontainerRef: RefObject< HTMLElement | null > | undefined\n) {\n\tuseEffect( () => {\n\t\tconst container = containerRef?.current;\n\t\tif ( ! container ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Track nodes relocated by this instance so we can move them back on cleanup.\n\t\tconst instanceNodes = new Set< Node >();\n\n\t\tconst relocateNode = ( node: Node ) => {\n\t\t\tif ( ! isVisxPortalNode( node ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Hide the portal immediately to prevent the tooltip from\n\t\t\t// flashing at (0,0) before visx calculates the correct position.\n\t\t\tnode.style.opacity = '0';\n\n\t\t\t// Position the portal at the viewport origin so visx's\n\t\t\t// absolute-positioned tooltip coordinates remain correct.\n\t\t\t// Zero-size with overflow: visible so it doesn't affect layout\n\t\t\t// but tooltip content still renders. pointerEvents: none on the\n\t\t\t// wrapper is intentional — tooltip inner elements manage their own.\n\t\t\tnode.classList.add( styles.relocatedPortal );\n\n\t\t\t// Remember the focused element before moving the node — relocating\n\t\t\t// a DOM subtree causes the browser to blur any focused descendants.\n\t\t\tconst { activeElement } = node.ownerDocument;\n\t\t\tconst focusedElement =\n\t\t\t\tactiveElement instanceof HTMLElement && node.contains( activeElement )\n\t\t\t\t\t? activeElement\n\t\t\t\t\t: null;\n\n\t\t\t// Insert at the start of the container (before header and content).\n\t\t\tcontainer.insertBefore( node, container.firstChild );\n\t\t\trelocatedNodes.add( node );\n\t\t\tinstanceNodes.add( node );\n\n\t\t\t// Restore focus that was lost due to the DOM move.\n\t\t\tif ( focusedElement ) {\n\t\t\t\tfocusedElement.focus();\n\t\t\t}\n\n\t\t\t// Reveal after two animation frames so visx has positioned the tooltip.\n\t\t\trequestAnimationFrame( () => {\n\t\t\t\trequestAnimationFrame( () => {\n\t\t\t\t\tnode.style.opacity = '';\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\n\t\t// Patch document.body.removeChild so visx Portal unmount doesn't throw\n\t\t// when it tries to remove a node we already moved out of body.\n\t\tinstallRemoveChildPatch();\n\n\t\t// Relocate any portals that already exist.\n\t\tfor ( const child of Array.from( document.body.children ) ) {\n\t\t\trelocateNode( child );\n\t\t}\n\n\t\t// Watch for new portals being appended to body.\n\t\tconst observer = new MutationObserver( mutations => {\n\t\t\tfor ( const mutation of mutations ) {\n\t\t\t\tfor ( const node of mutation.addedNodes ) {\n\t\t\t\t\trelocateNode( node );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\tobserver.observe( document.body, { childList: true } );\n\n\t\treturn () => {\n\t\t\t// Disconnect first to avoid the observer re-relocating nodes\n\t\t\t// as we move them back to body.\n\t\t\tobserver.disconnect();\n\n\t\t\t// Move relocated nodes back to body so visx can clean them up\n\t\t\t// normally with the original removeChild.\n\t\t\tfor ( const node of instanceNodes ) {\n\t\t\t\tif ( node instanceof HTMLElement ) {\n\t\t\t\t\tnode.classList.remove( styles.relocatedPortal );\n\t\t\t\t}\n\t\t\t\tif ( node.parentNode === container ) {\n\t\t\t\t\tdocument.body.appendChild( node );\n\t\t\t\t}\n\t\t\t\trelocatedNodes.delete( node );\n\t\t\t}\n\t\t\tinstanceNodes.clear();\n\n\t\t\tuninstallRemoveChildPatch();\n\t\t};\n\t}, [ containerRef ] );\n}\n","import 'css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss';export default {\n \"relocatedPortal\": \"a8ccharts-jCw5dQ\"\n};","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport { getColorDistance } from '../../../utils';\n\nexport interface ColorCache {\n\tcolors: string[];\n\thues: number[];\n\texistingHslColors: Array< [ number, number, number ] >;\n\tminHue: number;\n\tmaxHue: number;\n}\n\n/**\n * Golden ratio for mathematically pleasing color distribution\n * Used to generate evenly spaced hues that are visually distinct\n */\nconst GOLDEN_RATIO = 0.618033988749;\n\n/**\n * Minimum perceptual distance between colors to ensure visual distinction\n * Based on weighted HSL distance calculation optimized for chart readability\n */\nconst MIN_COLOR_DISTANCE = 25;\n\n/**\n * Maximum attempts to find a sufficiently different color\n * Prevents infinite loops while allowing reasonable search space\n */\nconst MAX_COLOR_GENERATION_ATTEMPTS = 50;\n\n/**\n * Color variation attempt offset\n * Small increment to explore slightly different color variations per attempt\n */\nconst VARIATION_ATTEMPT_OFFSET = 0.1;\n\n// Saturation configuration for generated colors\n\n/**\n * Base saturation percentage for generated colors\n * 45% provides muted, professional colors without being washed out\n */\nconst BASE_SATURATION = 45;\n\n/**\n * Number of saturation variation steps\n * Creates 3 different saturation levels for variety\n */\nconst SATURATION_VARIATION_STEPS = 3;\n\n/**\n * Saturation increment per variation step\n * 10% increments provide subtle variation while keeping colors muted\n * Results in saturation levels: 45%, 55%, 65%\n */\nconst SATURATION_INCREMENT = 10;\n\n// Lightness configuration for WCAG AA accessibility compliance\n\n/**\n * Base lightness percentage for generated colors\n * 35% ensures sufficient contrast against white backgrounds for WCAG AA compliance\n * WCAG AA requires 4.5:1 contrast ratio for normal text\n */\nconst BASE_LIGHTNESS = 35;\n\n/**\n * Number of lightness variation steps\n * Creates 4 different lightness levels for variety\n */\nconst LIGHTNESS_VARIATION_STEPS = 4;\n\n/**\n * Lightness increment per variation step\n * 8% increments provide subtle lightness variation while maintaining accessibility\n * Results in lightness levels: 35%, 43%, 51%, 59%\n * All levels maintain WCAG AA compliance against white backgrounds\n */\nconst LIGHTNESS_INCREMENT = 8;\n\n// Hue range expansion and constraints\n\n/**\n * Minimum hue range in degrees to ensure sufficient color variety\n * 60 degrees provides reasonable color spread even for narrow palettes\n */\nconst MIN_HUE_RANGE_DEGREES = 60;\n\n/**\n * Hue range expansion factor\n * 1.3x expansion provides slightly more variety than the original palette\n */\nconst HUE_RANGE_EXPANSION_FACTOR = 1.3;\n\n/**\n * Threshold for detecting hue wrap-around (color wheel boundary crossing)\n * 180 degrees indicates the colors span more than half the color wheel\n */\nconst HUE_WRAP_THRESHOLD_DEGREES = 180;\n\n/**\n * Full color wheel rotation in degrees\n */\nconst FULL_HUE_ROTATION_DEGREES = 360;\n\n/**\n * Factor for single color hue range\n */\nconst SINGLE_COLOR_HUE_RANGE_FACTOR = 0.33;\n\n/**\n * Get a color from the colors array or generate a new color using the golden ratio\n *\n * @param index - the index of the color to get\n * @param colorCache - pre-computed color data for performance\n * @return a color from the colors array or a new color using the golden ratio\n */\nexport const getChartColor = ( index: number, colorCache: ColorCache ): string => {\n\tconst {\n\t\tcolors,\n\t\thues,\n\t\texistingHslColors,\n\t\tminHue: cachedMinHue,\n\t\tmaxHue: cachedMaxHue,\n\t} = colorCache;\n\n\tif ( index < colors.length ) {\n\t\treturn colors[ index ];\n\t}\n\n\tlet minHue = cachedMinHue;\n\tlet maxHue = cachedMaxHue;\n\n\t// Generate additional colors using golden ratio, avoiding similar colors\n\tfor ( let attempt = 0; attempt < MAX_COLOR_GENERATION_ATTEMPTS; attempt++ ) {\n\t\t// Calculate hue using golden ratio distribution with variation per attempt\n\t\t// Formula: ((base_index + attempt_variation) * golden_ratio * 360°) mod 360°\n\t\t// This ensures mathematically pleasing spacing while allowing slight shifts per attempt\n\t\tlet hue =\n\t\t\t( ( index - colors.length + attempt * VARIATION_ATTEMPT_OFFSET ) *\n\t\t\t\tGOLDEN_RATIO *\n\t\t\t\tFULL_HUE_ROTATION_DEGREES ) %\n\t\t\tFULL_HUE_ROTATION_DEGREES;\n\n\t\t// If we have existing colors, constrain new colors to their hue range\n\t\tif ( hues.length > 0 ) {\n\t\t\t// Handle hue wrap-around (e.g., if colors span across 0 degrees)\n\t\t\tlet hueRange = maxHue - minHue;\n\n\t\t\t// If there's only one color, use a set hue range for limited variety\n\t\t\tif ( hues.length === 1 ) {\n\t\t\t\thueRange = FULL_HUE_ROTATION_DEGREES * SINGLE_COLOR_HUE_RANGE_FACTOR;\n\t\t\t} else if ( hueRange > HUE_WRAP_THRESHOLD_DEGREES ) {\n\t\t\t\t// If the range is very large, it might be wrapping around the color wheel\n\t\t\t\t// Check if a smaller range exists when considering wrap-around\n\t\t\t\tconst altMinHue = Math.min( ...hues.filter( h => h > HUE_WRAP_THRESHOLD_DEGREES ) );\n\t\t\t\tconst altMaxHue =\n\t\t\t\t\tMath.max( ...hues.filter( h => h < HUE_WRAP_THRESHOLD_DEGREES ) ) +\n\t\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t\t\tconst altRange = altMaxHue - altMinHue;\n\n\t\t\t\tif ( altRange < hueRange ) {\n\t\t\t\t\tminHue = altMinHue;\n\t\t\t\t\tmaxHue = altMaxHue;\n\t\t\t\t\thueRange = altRange;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Expand the range slightly to provide some variation\n\t\t\tconst expandedRange = Math.max(\n\t\t\t\thueRange * HUE_RANGE_EXPANSION_FACTOR,\n\t\t\t\tMIN_HUE_RANGE_DEGREES\n\t\t\t);\n\t\t\tconst rangeCenter = ( minHue + maxHue ) / 2;\n\t\t\tconst expandedMin = rangeCenter - expandedRange / 2;\n\n\t\t\t// Map the generated hue to the expanded range\n\t\t\thue = expandedMin + ( hue / FULL_HUE_ROTATION_DEGREES ) * expandedRange;\n\n\t\t\t// Normalize to 0-360 range\n\t\t\thue =\n\t\t\t\t( ( hue % FULL_HUE_ROTATION_DEGREES ) + FULL_HUE_ROTATION_DEGREES ) %\n\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t}\n\n\t\tconst saturation =\n\t\t\tBASE_SATURATION + ( ( index + attempt ) % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\t\tconst lightness =\n\t\t\tBASE_LIGHTNESS + ( ( index + attempt ) % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\n\t\tconst candidateHsl: [ number, number, number ] = [ hue, saturation, lightness ];\n\n\t\t// Check if this color is sufficiently different from existing colors\n\t\tlet isSufficientlyDifferent = true;\n\t\tfor ( const existingHsl of existingHslColors ) {\n\t\t\tif ( getColorDistance( candidateHsl, existingHsl ) < MIN_COLOR_DISTANCE ) {\n\t\t\t\tisSufficientlyDifferent = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( isSufficientlyDifferent ) {\n\t\t\t// d3-color uses 0-1 scale for saturation and lightness\n\t\t\treturn d3Hsl( Math.round( hue ), saturation / 100, lightness / 100 ).formatHex();\n\t\t}\n\t}\n\n\t// Fallback if we couldn't find a sufficiently different color\n\t// Formula: ((base_index) * golden_ratio * 360°) mod 360°\n\t// This ensures mathematically pleasing spacing while maintaining consistency\n\tconst fallbackHue =\n\t\t( ( index - colors.length ) * GOLDEN_RATIO * FULL_HUE_ROTATION_DEGREES ) %\n\t\tFULL_HUE_ROTATION_DEGREES;\n\tconst fallbackSaturation =\n\t\tBASE_SATURATION + ( index % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\tconst fallbackLightness =\n\t\tBASE_LIGHTNESS + ( index % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\t// d3-color uses 0-1 scale for saturation and lightness\n\treturn d3Hsl(\n\t\tMath.round( fallbackHue ),\n\t\tfallbackSaturation / 100,\n\t\tfallbackLightness / 100\n\t).formatHex();\n};\n","import type { CompleteChartTheme } from '../../types';\n\n/**\n * Default theme configuration\n */\nconst defaultTheme: CompleteChartTheme = {\n\tbackgroundColor: '#FFFFFF', // chart background color\n\tlabelBackgroundColor: 'transparent', // label background color (transparent by default)\n\tlabelTextColor: '#FFFFFF', // label text color (white to match original behavior)\n\tcolors: [ '#98C8DF', '#006DAB', '#A6DC80', '#1F9828', '#FF8C8F' ],\n\tgridStyles: {\n\t\tstroke: '#DCDCDE',\n\t\tstrokeWidth: 1,\n\t},\n\ttickLength: 4,\n\tgridColor: '',\n\tgridColorDark: '',\n\txTickLineStyles: { stroke: 'black' },\n\txAxisLineStyles: { stroke: '#DCDCDE', strokeWidth: 1 },\n\tlegendLabelStyles: {\n\t\tcolor: 'var(--jp-gray-80, #2c3338)',\n\t},\n\tlegendContainerStyles: {},\n\tseriesLineStyles: [],\n\tlegendShapeStyles: [],\n\tglyphs: [],\n\tsvgLabelSmall: { fill: 'var(--jp-gray-80, #2c3338)' },\n\tannotationStyles: {\n\t\tlabel: {\n\t\t\tanchorLineStroke: 'var(--jp-gray-80, #2c3338)',\n\t\t\tbackgroundFill: '#fff',\n\t\t},\n\t\tconnector: {\n\t\t\tstroke: 'var(--jp-gray-80, #2c3338)',\n\t\t},\n\t\tcircleSubject: {\n\t\t\tstroke: 'transparent',\n\t\t\tfill: 'var(--jp-gray-80, #2c3338)',\n\t\t\tradius: 5,\n\t\t},\n\t},\n\tgeoChart: {\n\t\tfeatureFillColor: 'var(--jp-gray-0, #f6f7f7)',\n\t},\n\tleaderboardChart: {\n\t\trowGap: 12,\n\t\tcolumnGap: 4,\n\t\tlabelSpacing: 1.5,\n\t\tdeltaColors: [ '#FF8C8F', '#757575', '#1F9828' ], // [negative, neutral, positive]\n\t},\n\tconversionFunnelChart: {\n\t\tbackgroundColor: '#F3F4F6',\n\t\tpositiveChangeColor: '#1F9828',\n\t\tnegativeChangeColor: '#FF8C8F',\n\t},\n\tlineChart: {\n\t\tlineStyles: {\n\t\t\tcomparison: {\n\t\t\t\tstrokeDasharray: '4 4',\n\t\t\t\tstrokeLinecap: 'square',\n\t\t\t},\n\t\t},\n\t},\n\tsparkline: {\n\t\tmargin: { top: 2, right: 2, bottom: 2, left: 2 },\n\t\tstrokeWidth: 1.5,\n\t},\n};\n\nexport { defaultTheme };\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport type { GlobalChartsContextValue } from '../types';\n\nexport const useGlobalChartsContext = (): GlobalChartsContextValue => {\n\tconst context = useContext( GlobalChartsContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useGlobalChartsContext must be used within a GlobalChartsProvider' );\n\t}\n\treturn context;\n};\n","import { useId } from 'react';\n\nexport const useChartId = ( providedId?: string ): string => {\n\tconst generatedId = useId();\n\treturn providedId || generatedId;\n};\n","import { useEffect, useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { useGlobalChartsContext } from './use-global-charts-context';\nimport type { BaseLegendItem } from '../../../components/legend';\n\nexport const useChartRegistration = ( {\n\tchartId,\n\tlegendItems,\n\tchartType,\n\tisDataValid,\n\tmetadata,\n}: {\n\tchartId: string;\n\tlegendItems: BaseLegendItem[];\n\tchartType: string;\n\tisDataValid: boolean;\n\tmetadata?: Record< string, unknown >;\n} ): void => {\n\tconst { registerChart, unregisterChart } = useGlobalChartsContext();\n\n\t// Memoize legendItems with deep comparison to prevent infinite loops\n\tconst stableLegendItems = useDeepMemo( legendItems );\n\n\t// Memoize metadata to prevent unnecessary re-renders\n\tconst memoizedMetadata = useMemo( () => metadata, [ metadata ] );\n\n\tuseEffect( () => {\n\t\t// Only register if data is valid\n\t\tif ( isDataValid ) {\n\t\t\tregisterChart( chartId, {\n\t\t\t\tlegendItems: stableLegendItems,\n\t\t\t\tchartType,\n\t\t\t\tmetadata: memoizedMetadata,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tunregisterChart( chartId );\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchartId,\n\t\tstableLegendItems,\n\t\tchartType,\n\t\tmemoizedMetadata,\n\t\tisDataValid,\n\t\t// Removed registerChart and unregisterChart from dependencies\n\t\t// They are stable functions created with useCallback and empty deps\n\t] );\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n/**\n * Hook to get the global chart theme from GlobalChartsProvider\n *\n * @return The global chart theme\n */\nexport const useGlobalChartsTheme = (): CompleteChartTheme => {\n\t// Get context but don't throw if it doesn't exist (for testing or standalone usage)\n\tconst context = useContext( GlobalChartsContext );\n\tconst globalTheme = context?.theme;\n\n\treturn globalTheme ?? defaultTheme;\n};\n","import { useMemo } from 'react';\nimport { parseAsLocalDate } from '../utils';\nimport type { SeriesData } from '../types';\n\n/**\n * Hook that transforms and sorts chart data, handling date parsing and sorting\n *\n * This hook extracts the common data transformation logic used in both line-chart\n * and bar-chart components. It:\n * 1. Parses date strings into Date objects using parseAsLocalDate\n * 2. Sorts data points by date when date properties are present\n * 3. Returns the original data unchanged when no date properties are found\n *\n * @param {SeriesData[]} data - The raw chart data to transform\n * @return {SeriesData[]} The transformed and sorted data\n */\nexport const useChartDataTransform = ( data: SeriesData[] ) => {\n\treturn useMemo( () => {\n\t\t// Check if the first data point has date or dateString properties\n\t\tconst firstPoint = data?.[ 0 ]?.data?.[ 0 ];\n\t\tconst hasDateProperties = firstPoint && ( 'date' in firstPoint || 'dateString' in firstPoint );\n\n\t\t// If no date properties found, return data unchanged\n\t\tif ( ! hasDateProperties ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Transform and sort data with date properties\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data\n\t\t\t\t.map( point => {\n\t\t\t\t\tlet date: Date | undefined;\n\n\t\t\t\t\tif ( 'date' in point && point.date ) {\n\t\t\t\t\t\tdate = point.date;\n\t\t\t\t\t} else if ( 'dateString' in point && point.dateString ) {\n\t\t\t\t\t\tdate = parseAsLocalDate( point.dateString );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.sort( ( a, b ) => {\n\t\t\t\t\tif ( ! a.date || ! b.date ) return 0;\n\t\t\t\t\treturn a.date.getTime() - b.date.getTime();\n\t\t\t\t} ),\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { createScale, getTicks } from '@visx/scale';\nimport { useMemo } from 'react';\nimport { getLongestTickWidth } from '../utils';\n/**\n * Base top margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_TOP = 10;\n\n/**\n * Base right margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_RIGHT = 20;\n\n/**\n * Base bottom margin used for charts with a bottom X-axis.\n * This is large enough for typical font sizes and will be increased\n * dynamically when tick labels require more space.\n */\nconst DEFAULT_MARGIN_BOTTOM = 20;\n\n/**\n * Base left margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_LEFT = 20;\n\n/**\n * Bottom margin to use when the X-axis is rendered at the top.\n * We only need a small buffer below the chart in that case.\n */\nconst DEFAULT_BOTTOM_FOR_TOP_AXIS = 10;\n\n/**\n * Fallback font size used when we cannot derive a font size\n * from the theme or axis styles for X-axis tick labels.\n */\nconst DEFAULT_FONT_SIZE = 12;\n\n/**\n * Fallback tick length used when tickLength is not provided\n * by the theme for either axis.\n */\nconst DEFAULT_TICK_LENGTH = 8;\n\n/**\n * Fallback width used for Y-axis tick labels when we cannot\n * measure them via getLongestTickWidth.\n */\nconst DEFAULT_Y_TICK_WIDTH = 40;\nconst resolveFontSize = val => {\n if (typeof val === 'number' && !isNaN(val)) {\n return val;\n }\n if (typeof val === 'string') {\n const parsed = parseFloat(val);\n return isNaN(parsed) ? undefined : parsed;\n }\n return undefined;\n};\nconst getXAxisLabelMetrics = (theme, orientation) => {\n const xAxisStyles = orientation === 'top' ? theme.axisStyles?.x?.top : theme.axisStyles?.x?.bottom;\n const fontSize = resolveFontSize(xAxisStyles?.axisLabel?.fontSize) || resolveFontSize(theme.svgLabelSmall?.fontSize) || DEFAULT_FONT_SIZE;\n const tickLength = xAxisStyles?.tickLength ?? DEFAULT_TICK_LENGTH;\n return {\n fontSize,\n tickLength\n };\n};\nexport const useChartMargin = (height, options, data, theme, horizontal = false) => {\n const yTicks = useMemo(() => {\n const allDataPoints = data.flatMap(series => series.data);\n if (horizontal) {\n // When horizontal, y ticks renders fixed tick labels.\n return allDataPoints.map(d => d.label || options.axis?.y?.tickFormat(d.date.getTime(), 0, []));\n }\n const minY = Math.min(...allDataPoints.map(d => d.value));\n const maxY = Math.max(...allDataPoints.map(d => d.value));\n const yScale = createScale({\n ...options.yScale,\n domain: [minY, maxY],\n range: [height, 0]\n });\n return getTicks(yScale, options.axis?.y?.numTicks);\n }, [options, data, height, horizontal]);\n return useMemo(() => {\n // Default margin is for bottom axis labels.\n const defaultMargin = {\n top: DEFAULT_MARGIN_TOP,\n right: DEFAULT_MARGIN_RIGHT,\n bottom: DEFAULT_MARGIN_BOTTOM,\n left: DEFAULT_MARGIN_LEFT\n };\n\n // Auto-calculate margin for y axis labels based on orientation and tick width.\n const yAxisOrientation = options.axis?.y?.orientation;\n const yAxisStyles = yAxisOrientation === 'right' ? theme.axisStyles.y.right : theme.axisStyles.y.left;\n const yTickWidth = getLongestTickWidth(yTicks, options.axis?.y?.tickFormat, yAxisStyles.axisLabel);\n const yMarginValue = (yTickWidth ?? DEFAULT_Y_TICK_WIDTH) + (yAxisStyles?.tickLength ?? 0);\n if (yAxisOrientation === 'right') {\n defaultMargin.right = yMarginValue;\n } else {\n defaultMargin.left = yMarginValue;\n }\n\n // Dynamically compute X-axis margin (bottom by default, or top if orientation is 'top').\n // This mirrors Y-axis behavior where margin is based on label size and tick length,\n // but keeps the padding minimal so consumers can control container spacing themselves.\n const xOrientation = options.axis?.x?.orientation === 'top' ? 'top' : 'bottom';\n const {\n fontSize,\n tickLength\n } = getXAxisLabelMetrics(theme, xOrientation);\n const computedXMargin = fontSize + tickLength;\n if (xOrientation === 'top') {\n defaultMargin.top = Math.max(defaultMargin.top, computedXMargin);\n defaultMargin.bottom = DEFAULT_BOTTOM_FOR_TOP_AXIS;\n } else {\n defaultMargin.bottom = Math.max(defaultMargin.bottom, computedXMargin);\n }\n return defaultMargin;\n }, [options, theme, yTicks]);\n};","import { useState, useCallback, useRef } from 'react';\n\n/**\n * Hook to measure the width and height of a DOM element.\n * Returns a ref callback to attach to the element and the current dimensions in pixels.\n *\n * @param {object} props - Optional props.\n * @param {number} props.initialWidth - The initial width to use.\n * @param {number} props.initialHeight - The initial height to use.\n *\n * @return {[Function, number, number]} A tuple containing a ref callback, width, and height in pixels\n */\nexport function useElementSize< T extends HTMLElement = HTMLDivElement >( {\n\tinitialWidth = 0,\n\tinitialHeight = 0,\n}: {\n\tinitialWidth?: number;\n\tinitialHeight?: number;\n} = {} ): [ ( node: T | null ) => void, number, number ] {\n\tconst [ width, setWidth ] = useState( initialWidth );\n\tconst [ height, setHeight ] = useState( initialHeight );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback( ( node: T | null ) => {\n\t\tif ( observerRef.current ) {\n\t\t\tobserverRef.current.disconnect();\n\t\t\tobserverRef.current = null;\n\t\t}\n\t\tif ( node ) {\n\t\t\tconst handleResize = () => {\n\t\t\t\tconst rect = node.getBoundingClientRect();\n\t\t\t\tsetWidth( rect.width || 0 );\n\t\t\t\tsetHeight( rect.height || 0 );\n\t\t\t};\n\t\t\thandleResize();\n\t\t\tconst resizeObserver = new ResizeObserver( handleResize );\n\t\t\tresizeObserver.observe( node );\n\t\t\tobserverRef.current = resizeObserver;\n\t\t}\n\t}, [] );\n\n\treturn [ refCallback, width, height ];\n}\n","import { Children, isValidElement, useMemo, type ReactNode } from 'react';\nimport { Legend } from '../components/legend';\n\n/**\n * Hook to detect if children contain a Legend component (composition pattern).\n *\n * @param {ReactNode} children - React children to search through\n * @return {boolean} Whether a Legend component is present in children\n */\nexport function useHasLegendChild( children: ReactNode ): boolean {\n\treturn useMemo( () => {\n\t\tlet found = false;\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) && child.type === Legend ) {\n\t\t\t\tfound = true;\n\t\t\t}\n\t\t} );\n\n\t\treturn found;\n\t}, [ children ] );\n}\n","import { useContext, useMemo, forwardRef } from 'react';\nimport { SingleChartContext } from '../../charts/private/single-chart-context';\nimport { GlobalChartsContext } from '../../providers';\nimport { BaseLegend } from './private';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const Legend = /*#__PURE__*/forwardRef(({\n chartId,\n items,\n ...props\n}, ref) => {\n // Get context but don't throw if it doesn't exist\n const context = useContext(GlobalChartsContext);\n const singleChartContext = useContext(SingleChartContext);\n\n // When chartId is used, it is standalone mode\n // When chartId is not provided, we use the context's chartId, meaning it is in a single chart context\n const contextChartId = chartId ?? singleChartContext?.chartId;\n\n // Use useMemo to ensure re-rendering when context changes\n const contextItems = useMemo(() => {\n return contextChartId && context ? context.getChartData(contextChartId)?.legendItems : undefined;\n }, [contextChartId, context]);\n\n // Provided items take precedence over context items\n const legendItems = items || contextItems;\n if (!legendItems) {\n return null;\n }\n return /*#__PURE__*/_jsx(BaseLegend, {\n ref: ref,\n items: legendItems,\n ...props,\n chartId: contextChartId\n });\n});","import { createContext } from 'react';\n\n// Local context for chart implicit state sharing\n\nexport const ChartInstanceContext = /*#__PURE__*/createContext(null);\n\n// Backward compatibility exports\nexport const SingleChartContext = ChartInstanceContext;","import { useContext } from 'react';\nimport { ChartInstanceContext, type ChartInstanceContextValue } from './single-chart-context';\n\nexport const useChartInstanceContext = (): ChartInstanceContextValue => {\n\tconst context = useContext( ChartInstanceContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useChartInstanceContext must be used within a Chart component' );\n\t}\n\treturn context;\n};\n\nexport const useSingleChartContext = useChartInstanceContext;\n","import { Group } from '@visx/group';\nimport { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legend';\nimport { scaleOrdinal } from '@visx/scale';\nimport clsx from 'clsx';\nimport { forwardRef, useCallback, useContext } from 'react';\nimport { useTextTruncation } from '../../../hooks';\nimport { GlobalChartsContext, useGlobalChartsTheme } from '../../../providers';\nimport { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from '../utils';\nimport styles from './base-legend.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst orientationToFlexDirection = {\n horizontal: 'row',\n vertical: 'column'\n};\n\n// Component for legend text with truncation detection\n// Moved outside BaseLegend to prevent recreation on every render\nconst LegendText = ({\n text,\n textOverflow,\n maxWidth\n}) => {\n const isEllipsis = maxWidth != null && textOverflow === 'ellipsis';\n const [textRef, isTruncated] = useTextTruncation(Boolean(isEllipsis));\n return /*#__PURE__*/_jsx(\"span\", {\n ref: textRef,\n className: clsx(styles['legend-item-text'], maxWidth != null && styles[`legend-item-text--${textOverflow}`]),\n style: {\n ...(maxWidth != null && {\n maxWidth,\n minWidth: 0\n })\n },\n title: isEllipsis && isTruncated ? text : undefined,\n children: text\n });\n};\n\n/*\n * Base legend component that displays color-coded items with labels based on visx LegendOrdinal.\n * We avoid using LegendOrdinal directly to enable support for advanced features such as interactivity.\n */\nexport const BaseLegend = /*#__PURE__*/forwardRef(({\n items,\n className,\n orientation = 'horizontal',\n position = 'bottom',\n alignment = 'center',\n maxWidth,\n textOverflow = 'wrap',\n shape = 'rect',\n fill = valueOrIdentityString,\n size = valueOrIdentityString,\n labelFormat = valueOrIdentity,\n labelTransform = labelTransformFactory,\n shapeWidth = 16,\n shapeHeight = 16,\n shapeMargin = '2px 4px 2px 0',\n labelAlign = 'left',\n labelFlex = '0 0 auto',\n // Use natural width instead of expanding to fill space\n labelMargin = '0 4px',\n itemMargin = '0',\n itemDirection = 'row',\n legendLabelProps,\n legendItemClassName,\n render,\n interactive = false,\n chartId,\n ...legendItemProps\n}, ref) => {\n const theme = useGlobalChartsTheme();\n const context = useContext(GlobalChartsContext);\n const legendScale = scaleOrdinal({\n domain: items.map(item => item.label),\n range: items.map(item => item.color)\n });\n const domain = legendScale.domain();\n const getShapeStyle = useCallback(({\n index\n }) => items[index]?.shapeStyle, [items]);\n\n // Handle legend item clicks for interactive mode\n const handleLegendClick = useCallback(seriesLabel => {\n if (interactive && chartId && context) {\n context.toggleSeriesVisibility(chartId, seriesLabel);\n }\n }, [interactive, chartId, context]);\n\n // Check if a series is visible\n const isSeriesVisible = useCallback(seriesLabel => {\n if (!interactive || !chartId || !context) {\n return true;\n }\n return context.isSeriesVisible(chartId, seriesLabel);\n }, [interactive, chartId, context]);\n\n // Create event handlers to avoid inline arrow functions\n const createClickHandler = useCallback(labelText => {\n if (!interactive) {\n return undefined;\n }\n return () => handleLegendClick(labelText);\n }, [interactive, handleLegendClick]);\n const createKeyDownHandler = useCallback(labelText => {\n if (!interactive) {\n return undefined;\n }\n return event => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleLegendClick(labelText);\n }\n };\n }, [interactive, handleLegendClick]);\n return render ? render(items) : /*#__PURE__*/_jsx(LegendOrdinal, {\n scale: legendScale,\n labelFormat: labelFormat,\n labelTransform: labelTransform,\n children: labels => /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"list\",\n className: clsx(styles.legend, styles[`legend--${orientation}`], styles[`legend--alignment-${alignment}`], styles[`legend--position-${position}`], className),\n style: {\n flexDirection: orientationToFlexDirection[orientation],\n ...theme.legendContainerStyles\n },\n children: labels.map((label, i) => {\n const visible = isSeriesVisible(label.text);\n const handleClick = createClickHandler(label.text);\n const handleKeyDown = createKeyDownHandler(label.text);\n return /*#__PURE__*/_jsxs(LegendItem, {\n className: clsx('visx-legend-item', styles['legend-item'], interactive && styles['legend-item--interactive'], !visible && styles['legend-item--inactive'], legendItemClassName),\n margin: itemMargin,\n flexDirection: orientation === 'vertical' && alignment === 'end' ? 'row-reverse' : itemDirection,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n role: interactive ? 'button' : undefined,\n tabIndex: interactive ? 0 : undefined,\n \"aria-pressed\": interactive ? visible : undefined,\n \"aria-label\": interactive ? `${label.text}: ${visible ? 'visible' : 'hidden'}. Toggle visibility.` : undefined,\n ...legendItemProps,\n children: [items[i]?.renderGlyph ? /*#__PURE__*/_jsx(\"svg\", {\n width: items[i]?.glyphSize * 2,\n height: items[i]?.glyphSize * 2,\n children: /*#__PURE__*/_jsx(Group, {\n children: items[i]?.renderGlyph({\n key: `legend-glyph-${label.text}`,\n datum: {},\n index: i,\n color: fill(label),\n size: items[i]?.glyphSize,\n x: items[i]?.glyphSize,\n y: items[i]?.glyphSize\n })\n })\n }) : /*#__PURE__*/_jsx(LegendShape, {\n shape: shape,\n height: shapeHeight,\n width: shapeWidth,\n margin: shapeMargin,\n item: domain[i],\n itemIndex: i,\n label: label,\n fill: fill,\n size: size,\n shapeStyle: getShapeStyle\n }), /*#__PURE__*/_jsxs(LegendLabel, {\n className: clsx('visx-legend-label', styles['legend-item-label']),\n style: {\n justifyContent: labelAlign,\n flex: labelFlex,\n margin: labelMargin,\n ...theme.legendLabelStyles\n },\n ...legendLabelProps,\n children: [/*#__PURE__*/_jsx(LegendText, {\n text: label.text,\n textOverflow: textOverflow,\n maxWidth: maxWidth\n }), items.find(item => item.label === label.text)?.value && /*#__PURE__*/_jsxs(\"span\", {\n className: styles['legend-item-value'],\n children: ['\\u00A0', items.find(item => item.label === label.text)?.value]\n })]\n })]\n }, `legend-${label.text}-${i}`);\n })\n })\n });\n});","export type ValueOrIdentity< T > = T | { value?: T };\n\n/**\n * Returns an object's value if defined, or the object.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentity< T >( _: ValueOrIdentity< T > ): T {\n\tif ( _ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined' )\n\t\treturn _.value;\n\treturn _ as T;\n}\n\n/**\n * Returns an object's value if defined, or the object, coerced to a string.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentityString< T >( _: ValueOrIdentity< T > ): string {\n\treturn String( valueOrIdentity( _ ) );\n}\n","import type { ItemTransformer, LabelFormatter } from '@visx/legend/lib/types';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns a function which takes a Datum and index as input, and returns a formatted label object.\n * @param {object} root0 - The object to return the value of.\n * @param {AnyD3Scale} root0.scale - The scale to use.\n * @param {LabelFormatter<ScaleInput<Scale>>} root0.labelFormat - The label format to use.\n * @return {ItemTransformer<ScaleInput<Scale>, ReturnType<Scale>>} The label transform factory.\n */\nexport function labelTransformFactory< Scale extends AnyD3Scale >( {\n\tscale,\n\tlabelFormat,\n}: {\n\tscale: Scale;\n\tlabelFormat: LabelFormatter< ScaleInput< Scale > >;\n} ): ItemTransformer< ScaleInput< Scale >, ReturnType< Scale > > {\n\treturn ( d, i ) => ( {\n\t\tdatum: d,\n\t\tindex: i,\n\t\ttext: `${ labelFormat( d, i ) }`,\n\t\tvalue: scale( d ),\n\t} );\n}\n","import 'css-chunk:src/components/legend/private/base-legend.module.scss';export default {\n \"legend--horizontal\": \"a8ccharts-AELBvX\",\n \"legend--vertical\": \"a8ccharts-fX8uQe\",\n \"legend--alignment-start\": \"a8ccharts-DEe0wg\",\n \"legend--alignment-center\": \"a8ccharts-WBKF9I\",\n \"legend--alignment-end\": \"a8ccharts-JfwMng\",\n \"legend--position-top\": \"a8ccharts-8Y73Kh\",\n \"legend--position-bottom\": \"a8ccharts-TVM-IY\",\n \"legend-item\": \"a8ccharts-Vflwq8\",\n \"legend-item--interactive\": \"a8ccharts-qGsavM\",\n \"legend-item--inactive\": \"a8ccharts-ZtDY-Q\",\n \"legend-item-label\": \"a8ccharts-2H65Kr\",\n \"legend-item-text--wrap\": \"a8ccharts-faSDBI\",\n \"legend-item-text--ellipsis\": \"a8ccharts-FISUIO\",\n \"legend-item-value\": \"a8ccharts-DTZlT-\"\n};","import { formatNumber } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport {\n\tuseGlobalChartsContext,\n\ttype GetElementStylesParams,\n\ttype ElementStyles,\n} from '../../../providers';\nimport { formatPercentage } from '../../../utils';\nimport type { SeriesData, DataPointDate, DataPointPercentage } from '../../../types';\nimport type { BaseLegendItem } from '../types';\nimport type { LegendShape } from '@visx/legend/lib/types';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { ReactNode } from 'react';\n\nexport type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';\n\nexport interface ChartLegendOptions {\n\twithGlyph?: boolean;\n\tglyphSize?: number;\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode;\n\tshowValues?: boolean;\n\tlegendValueDisplay?: LegendValueDisplay;\n\tlegendShape?: LegendShape< SeriesData[], number >;\n}\n\n/**\n * Formats the value for a data point based on its type and display preference\n * @param point - The data point to format\n * @param showValues - Whether to show values or return empty string\n * @param legendValueDisplay - What type of value to display\n * @return Formatted value string\n */\nfunction formatPointValue(\n\tpoint: DataPointDate | DataPointPercentage,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay = 'percentage'\n): string {\n\tif ( ! showValues || legendValueDisplay === 'none' ) {\n\t\treturn '';\n\t}\n\n\t// Handle DataPointPercentage (pie chart data)\n\tif ( 'percentage' in point ) {\n\t\tconst percentagePoint = point as DataPointPercentage;\n\t\tswitch ( legendValueDisplay ) {\n\t\t\tcase 'percentage':\n\t\t\t\treturn formatPercentage( percentagePoint.percentage );\n\t\t\tcase 'value':\n\t\t\t\treturn formatNumber( percentagePoint.value );\n\t\t\tcase 'valueDisplay':\n\t\t\t\treturn percentagePoint.valueDisplay || formatNumber( percentagePoint.value );\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\t// Handle DataPointDate (time series data)\n\tif ( 'value' in point ) {\n\t\treturn point.value !== null ? formatNumber( point.value ) : '';\n\t}\n\n\treturn '';\n}\n\n/**\n * Applies glyph configuration to a legend item if needed\n * @param baseItem - The base legend item\n * @param withGlyph - Whether to include glyph rendering\n * @param glyph - Glyph component from theme\n * @param renderGlyph - Custom glyph render function\n * @param glyphSize - Size of the glyph\n * @return The legend item with glyph configuration applied if applicable\n */\nfunction applyGlyphToLegendItem(\n\tbaseItem: BaseLegendItem,\n\twithGlyph: boolean,\n\tglyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tglyphSize?: number\n): BaseLegendItem {\n\tif ( withGlyph ) {\n\t\tconst glyphToUse = glyph || renderGlyph;\n\t\tif ( glyphToUse ) {\n\t\t\treturn {\n\t\t\t\t...baseItem,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph: glyphToUse,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseItem;\n}\n\n/**\n * Processes SeriesData into legend items\n * @param seriesData - The series data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processSeriesData(\n\tseriesData: SeriesData[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( series: SeriesData, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: series,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: series.label,\n\t\t\tvalue: showValues ? series.data?.length?.toString() || '0' : '',\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn seriesData.map( mapper );\n}\n\n/**\n * Processes point data into legend items\n * @param pointData - The point data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param legendValueDisplay - What type of value to display\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processPointData(\n\tpointData: ( DataPointDate | DataPointPercentage )[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( point: DataPointDate | DataPointPercentage, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: point as DataPointPercentage,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: point.label,\n\t\t\tvalue: formatPointValue( point, showValues, legendValueDisplay ),\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn pointData.map( mapper );\n}\n\n/**\n * Hook to transform chart data into legend items\n * @param data - The chart data to transform\n * @param options - Configuration options for legend generation\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of legend items ready for display\n */\nexport function useChartLegendItems<\n\tT extends SeriesData[] | DataPointDate[] | DataPointPercentage[],\n>(\n\tdata: T,\n\toptions: ChartLegendOptions = {},\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst {\n\t\tshowValues = false,\n\t\tlegendValueDisplay = 'percentage',\n\t\twithGlyph = false,\n\t\tglyphSize = 8,\n\t\trenderGlyph,\n\t} = options;\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || ! Array.isArray( data ) || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Handle SeriesData (multiple series with data points)\n\t\tif ( 'data' in data[ 0 ] ) {\n\t\t\treturn processSeriesData(\n\t\t\t\tdata as SeriesData[],\n\t\t\t\tgetElementStyles,\n\t\t\t\tshowValues,\n\t\t\t\twithGlyph,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph,\n\t\t\t\tlegendShape\n\t\t\t);\n\t\t}\n\n\t\t// Handle DataPointDate or DataPointPercentage (single data points)\n\t\treturn processPointData(\n\t\t\tdata as ( DataPointDate | DataPointPercentage )[],\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\tlegendValueDisplay,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\t}, [\n\t\tdata,\n\t\tgetElementStyles,\n\t\tshowValues,\n\t\tlegendValueDisplay,\n\t\twithGlyph,\n\t\tglyphSize,\n\t\trenderGlyph,\n\t\tlegendShape,\n\t] );\n}\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * Hook to detect if text content is truncated within its container.\n * Uses ResizeObserver to dynamically track changes in element size.\n *\n * @param enabled - Whether truncation detection should be active. Defaults to true.\n * @return A tuple containing:\n * - [0] refCallback: Function to attach to the text element as a ref\n * - [1] isTruncated: Boolean indicating if the text is currently truncated\n *\n * @example\n * ```tsx\n * const [textRef, isTruncated] = useTextTruncation(true);\n *\n * return (\n * <span ref={textRef} title={isTruncated ? fullText : undefined}>\n * {text}\n * </span>\n * );\n * ```\n */\nexport function useTextTruncation(\n\tenabled: boolean = true\n): [ ( node: HTMLElement | null ) => void, boolean ] {\n\tconst [ isTruncated, setIsTruncated ] = useState( false );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\t// Cleanup existing observer\n\t\t\tif ( observerRef.current ) {\n\t\t\t\tobserverRef.current.disconnect();\n\t\t\t\tobserverRef.current = null;\n\t\t\t}\n\n\t\t\tif ( node && enabled ) {\n\t\t\t\tconst checkTruncation = () => {\n\t\t\t\t\t// Check if content width exceeds container width (indicates truncation)\n\t\t\t\t\tconst truncated = node.scrollWidth > node.clientWidth;\n\t\t\t\t\tsetIsTruncated( truncated );\n\t\t\t\t};\n\n\t\t\t\t// Initial check\n\t\t\t\tcheckTruncation();\n\n\t\t\t\t// Watch for size changes\n\t\t\t\tconst resizeObserver = new ResizeObserver( checkTruncation );\n\t\t\t\tresizeObserver.observe( node );\n\t\t\t\tobserverRef.current = resizeObserver;\n\t\t\t} else {\n\t\t\t\tsetIsTruncated( false );\n\t\t\t}\n\t\t},\n\t\t[ enabled ]\n\t);\n\n\treturn [ refCallback, isTruncated ];\n}\n","import { useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../types';\n\nexport type EnhancedDataPoint = DataPointDate & {\n\tvisualValue?: number;\n};\n\nexport interface EnhancedSeriesData extends Omit< SeriesData, 'data' > {\n\tdata: EnhancedDataPoint[];\n}\n\nexport interface UseZeroValueDisplayOptions {\n\tenabled: boolean;\n\tminValueRatio?: number;\n\tmaxValueRatio?: number;\n}\n\nexport const useZeroValueDisplay = (\n\tdata: SeriesData[],\n\toptions: UseZeroValueDisplayOptions = { enabled: false }\n): SeriesData[] | EnhancedSeriesData[] => {\n\tconst { enabled, minValueRatio = 0.6, maxValueRatio = 0.008 } = options;\n\n\treturn useMemo( () => {\n\t\tif ( ! enabled ) return data;\n\n\t\t// Collect all non-zero, non-null values (both positive and negative)\n\t\tconst nonZeroValues: number[] = [];\n\n\t\tfor ( const series of data ) {\n\t\t\tfor ( const point of series.data ) {\n\t\t\t\tif ( point.value !== null && point.value !== 0 ) {\n\t\t\t\t\tnonZeroValues.push( point.value );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( nonZeroValues.length === 0 ) return data;\n\n\t\t// Convert to absolute values to find the range\n\t\tconst absoluteValues = nonZeroValues.map( Math.abs );\n\n\t\t// Calculate min and max based on absolute values\n\t\tconst minAbsoluteValue = Math.min( ...absoluteValues );\n\t\tconst maxAbsoluteValue = Math.max( ...absoluteValues );\n\n\t\t// Calculate minimum visible value using absolute range\n\t\tconst minVisibleValue = Math.min(\n\t\t\tminAbsoluteValue * minValueRatio,\n\t\t\tmaxAbsoluteValue * maxValueRatio\n\t\t);\n\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data.map( ( point ): EnhancedDataPoint => {\n\t\t\t\tif ( point.value === 0 ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: minVisibleValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn point;\n\t\t\t} ),\n\t\t} ) );\n\t}, [ data, enabled, minValueRatio, maxValueRatio ] );\n};\n","import { useMemo } from 'react';\n\n/**\n * Data point interface for charts with interactive legends.\n * Requires label for series identification, value for calculations, and percentage for display.\n */\ninterface DataPointWithPercentage {\n\tlabel: string;\n\tvalue: number;\n\tpercentage: number;\n}\n\n/**\n * Parameters for the useInteractiveLegendData hook.\n */\ninterface UseInteractiveLegendDataParams< T extends DataPointWithPercentage > {\n\t/** The chart data to filter based on legend visibility */\n\tdata: T[];\n\t/** Unique chart identifier, required for interactive legends */\n\tchartId: string | undefined;\n\t/** Whether interactive legend filtering is enabled */\n\tlegendInteractive: boolean;\n\t/** Function to check if a series is visible in the legend */\n\tisSeriesVisible: ( chartId: string, label: string ) => boolean;\n}\n\n/**\n * Return value from the useInteractiveLegendData hook.\n */\ninterface UseInteractiveLegendDataResult< T extends DataPointWithPercentage > {\n\t/** Filtered data array containing only visible segments with recalculated percentages */\n\tvisibleData: T[];\n\t/** Boolean indicating if all segments are hidden */\n\tallSegmentsHidden: boolean;\n\t/**\n\t * Legend data with recalculated percentages for visible items.\n\t * Uses original data for hidden items, but shows recalculated percentages for visible ones.\n\t * This ensures the legend displays accurate percentages while maintaining all entries.\n\t */\n\tlegendData: T[];\n}\n\n/**\n * Custom hook to filter and recalculate chart data for interactive legends.\n *\n * When interactive legends are enabled, this hook:\n * 1. Filters data to show only visible series based on legend selection\n * 2. Recalculates percentages so visible segments total 100%\n * 3. Tracks whether all segments are hidden to show empty state\n *\n * This is particularly useful for pie charts, donut charts, and semi-circle charts\n * where segment visibility and percentages need to be dynamically adjusted.\n *\n * @example\n * ```tsx\n * const { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData({\n * data: chartData,\n * chartId: 'my-pie-chart',\n * legendInteractive: true,\n * isSeriesVisible: (id, label) => context.isSeriesVisible(id, label),\n * });\n *\n * // Use legendData for creating legend items (shows recalculated percentages)\n * const legendItems = useChartLegendItems(legendData, legendOptions);\n *\n * if (allSegmentsHidden) {\n * return <EmptyState />;\n * }\n *\n * // Use visibleData for rendering the chart (only visible segments)\n * return <PieChart data={visibleData} />;\n * ```\n *\n * @param params - Configuration object for the hook\n * @param params.data - The chart data to filter\n * @param params.chartId - Unique identifier for the chart (required for interactive mode)\n * @param params.legendInteractive - Whether to enable interactive filtering\n * @param params.isSeriesVisible - Function to check series visibility\n * @return Object containing visibleData, allSegmentsHidden flag, and legendData with recalculated percentages\n */\nexport const useInteractiveLegendData = < T extends DataPointWithPercentage >( {\n\tdata,\n\tchartId,\n\tlegendInteractive,\n\tisSeriesVisible,\n}: UseInteractiveLegendDataParams< T > ): UseInteractiveLegendDataResult< T > => {\n\t// Filter and recalculate data for interactive legends\n\tconst visibleData = useMemo( () => {\n\t\t// If interactive mode is disabled or no chartId, return all data unchanged\n\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Filter to only visible segments based on legend state\n\t\tconst filtered = data.filter( segment => isSeriesVisible( chartId, segment.label ) );\n\n\t\t// If no segments are visible, return empty array\n\t\tif ( filtered.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Recalculate percentages so visible segments total 100%\n\t\tconst totalValue = filtered.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\n\t\treturn filtered.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data, chartId, isSeriesVisible, legendInteractive ] );\n\n\t// Check if all segments are hidden (only relevant in interactive mode)\n\tconst allSegmentsHidden = useMemo( () => {\n\t\treturn legendInteractive && visibleData.length === 0;\n\t}, [ legendInteractive, visibleData ] );\n\n\t// Prepare legend data with recalculated percentages for visible items\n\t// This maintains all legend entries but shows updated percentages for visible segments\n\tconst legendData = useMemo( () => {\n\t\tif ( ! legendInteractive || ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Map original data to show recalculated percentages for visible items\n\t\treturn data.map( segment => {\n\t\t\tconst isVisible = isSeriesVisible( chartId, segment.label );\n\t\t\tif ( ! isVisible ) {\n\t\t\t\t// Return original data for hidden items\n\t\t\t\treturn segment;\n\t\t\t}\n\n\t\t\t// For visible items, find the recalculated percentage from visibleData\n\t\t\tconst recalculated = visibleData.find( d => d.label === segment.label );\n\t\t\treturn recalculated || segment;\n\t\t} );\n\t}, [ data, visibleData, legendInteractive, chartId, isSeriesVisible ] );\n\n\treturn { visibleData, allSegmentsHidden, legendData };\n};\n","import { useState, useEffect } from 'react';\n\n// 'no-preference' returns false in unsupported browsers,\n// causing a safe fallback to reduced motion instead of animating.\nconst QUERY = '(prefers-reduced-motion: no-preference)';\n\nconst getInitialState = () => ! window.matchMedia( QUERY ).matches;\n\n/**\n * Custom hook to determine if the user prefers reduced motion.\n * @return {boolean} A boolean indicating the user's preference for reduced motion.\n */\nexport function usePrefersReducedMotion() {\n\tconst [ prefersReducedMotion, setPrefersReducedMotion ] = useState( getInitialState );\n\n\tuseEffect( () => {\n\t\tconst mediaQueryList = window.matchMedia( QUERY );\n\n\t\tconst listener = event => {\n\t\t\tsetPrefersReducedMotion( ! event.matches );\n\t\t};\n\n\t\tmediaQueryList.addEventListener( 'change', listener );\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener( 'change', listener );\n\t\t};\n\t}, [] );\n\n\treturn prefersReducedMotion;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-ZVGEDXDP.cjs","../src/utils/create-composition.ts","../src/utils/date-parsing.ts","../src/utils/format-metric-value.ts","../src/utils/format-percentage.ts","../src/utils/get-longest-tick-width.ts","../src/utils/get-styles.ts","../src/utils/is-safari.ts","../src/utils/merge-themes.ts","../src/utils/color-utils.ts","../src/utils/resolve-css-var.ts"],"names":["formatNumber","varName"],"mappings":"AAAA;ACUO,SAAS,mBAAA,CACf,K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yB,EAAA;AACjB,IAAA;AACR,EAAA;AAEsB,EAAA;AAGC,EAAA;AACD,IAAA;AACA,IAAA;AACA,IAAA;AACS,IAAA;AAC/B,EAAA;AAGyB,EAAA;AACN,IAAA;AACA,MAAA;AACD,MAAA;AAER,QAAA;AACR,MAAA;AACD,IAAA;AAEO,IAAA;AACR,EAAA;AAGyB,EAAA;AAEC,IAAA;AACjB,MAAA;AACR,IAAA;AACwB,IAAA;AACV,IAAA;AACC,MAAA;AACf,IAAA;AACO,IAAA;AACR,EAAA;AAGO,EAAA;AACR;AAWiC;AACV,EAAA;AAEE,EAAA;AACA,EAAA;AACA,EAAA;AAGC,EAAA;AACA,EAAA;AACA,EAAA;AAEE,EAAA;AAG5B;ATgD2B;AACA;AU5QE;AAe5B;AAGe,EAAA;AACP,IAAA;AACR,EAAA;AAIuB,EAAA;AACP,IAAA;AAED,IAAA;AACI,MAAA;AAEE,MAAA;AACpB,IAAA;AACD,EAAA;AAG4B,EAAA;AACpB,IAAA;AACR,EAAA;AAGO,EAAA;AACR;AASS;AAEkB,EAAA;AAED,EAAA;AACjB,IAAA;AACR,EAAA;AAGyB,EAAA;AAEA,EAAA;AAEF,IAAA;AAEf,IAAA;AACC,MAAA;AACR,IAAA;AAESC,IAAAA;AACV,EAAA;AAGsB,EAAA;AAGf,EAAA;AACC,IAAA;AACR,EAAA;AAEuB,EAAA;AAEL,EAAA;AACnB;AASS;AACe,EAAA;AACf,IAAA;AACR,EAAA;AAEI,EAAA;AACmB,IAAA;AACA,IAAA;AAEf,IAAA;AACA,EAAA;AAEA,IAAA;AACR,EAAA;AACD;AVoN2B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-ZVGEDXDP.cjs","sourcesContent":[null,"/**\n * Utility function to create chart components with composition API.\n *\n * This function attaches subcomponents to a chart component to enable\n * dot notation access like <Chart.Legend />, <Chart.Tooltip />, etc.\n *\n * @param Chart - The main chart component\n * @param subComponents - Object containing subcomponents to attach\n * @return Chart component with attached subcomponents\n */\nexport function attachSubComponents< TChart, TSubComponents extends Record< string, unknown > >(\n\tChart: TChart,\n\tsubComponents: TSubComponents\n): TChart & TSubComponents {\n\treturn Object.assign( Chart, subComponents );\n}\n","/**\n * @file Date parsing utilities using date-fns for local timezone handling\n *\n * This module provides utilities for parsing various date string formats and converting\n * them to local timezone dates using the battle-tested date-fns library. For formats\n * without timezone info, they're treated as local. For formats with timezone info,\n * they're converted to the equivalent local time.\n *\n * Note: And specifically it prevents format `YYYY-MM-DD` being parsed as UTC date.\n *\n * Key Features:\n * - All parsed dates are in local timezone\n * - Converts timezone-aware strings to local equivalent\n * - Robust input validation and error handling using date-fns\n * - TypeScript type safety\n * - Much smaller codebase than custom parsing\n *\n * Supported Formats:\n * - YYYY-MM-DD (treated as local)\n * - YYYY-MM-DD HH:mm:ss (treated as local)\n * - YYYY-MM-DD HH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ss (treated as local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (treated as local)\n * - YYYY-MM-DDTHH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ssZ (converted to local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (converted to local)\n *\n * @example\n * ```typescript\n * parseAsLocalDate(\"2025-01-01\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30:00\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:45.123\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:00Z\"); // UTC 14:30 → Local equivalent\n * parseAsLocalDate(\"2025-01-01T14:30:00+05:00\"); // +05:00 14:30 → Local equivalent\n * ```\n */\n\nimport { parse, parseISO, isValid } from 'date-fns';\n\n/**\n * Checks if a date string contains timezone information\n * @param {string} dateString - The date string to check for timezone information\n * @return {boolean} True if the date string contains timezone information, false otherwise\n */\nconst hasTimezone = ( dateString: string ): boolean => {\n\treturn /T.*[Z]$|T.*[+-]\\d{2}:?\\d{2}$/.test( dateString );\n};\n\n/**\n * Parses any supported date string format and returns a local timezone date\n *\n * Uses date-fns for robust parsing and validation. For strings without timezone\n * info, treats as local timezone. For strings with timezone info, converts to\n * local timezone equivalent.\n *\n * Supports:\n * - YYYY-MM-DD (local)\n * - YYYY-MM-DD HH:mm:ss (local)\n * - YYYY-MM-DD HH:mm (local)\n * - YYYY-MM-DDTHH:mm:ss (local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n * - YYYY-MM-DDTHH:mm (local)\n * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n * @param {string} dateString - The date string to parse into a local timezone date\n * @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails\n */\nexport const parseAsLocalDate = ( dateString: string ): Date => {\n\tconst trimmedString = dateString.trim();\n\n\t// If it has timezone information, parse as ISO and convert to local\n\tif ( hasTimezone( trimmedString ) ) {\n\t\tconst isoDate = parseISO( trimmedString );\n\n\t\tif ( ! isValid( isoDate ) ) {\n\t\t\treturn new Date( NaN );\n\t\t}\n\n\t\t// parseISO automatically converts to local timezone\n\t\treturn isoDate;\n\t}\n\n\t// For naive strings, try different local formats\n\tconst formats = [\n\t\t'yyyy-MM-dd', // 2025-01-01\n\t\t'yyyy-MM-dd HH:mm:ss', // 2025-01-01 14:30:45\n\t\t'yyyy-MM-dd HH:mm', // 2025-01-01 14:30\n\t\t\"yyyy-MM-dd'T'HH:mm:ss\", // 2025-01-01T14:30:45\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSS\", // 2025-01-01T14:30:45.123\n\t\t\"yyyy-MM-dd'T'HH:mm\", // 2025-01-01T14:30\n\t];\n\n\tfor ( const format of formats ) {\n\t\tconst result = parse( trimmedString, format, new Date() );\n\t\tif ( isValid( result ) ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// If no format matched, return invalid date\n\treturn new Date( NaN );\n};\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\n\n/**\n * Types for formatMetricValue\n */\nexport type MetricValueType = 'number' | 'average' | 'currency';\n\ntype FormatMetricValueOptions = {\n\tdecimals?: number;\n\tuseMultipliers?: boolean;\n\tsignDisplay?: Intl.NumberFormatOptions[ 'signDisplay' ];\n};\n\n/**\n * Format a numeric metric value based on type, precision and scale.\n * Supports currency, number and percentage, using `@automattic/number-formatters`.\n *\n * @param value - The value to format\n * @param type - The type of formatting to apply\n * @param options - Formatting options\n * @param options.decimals - Number of decimal places to show\n * @param options.useMultipliers - Whether to use K, M, B suffixes for large numbers\n * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)\n * @return Formatted string\n */\nexport const formatMetricValue = (\n\tvalue: string | number,\n\ttype: MetricValueType = 'number',\n\t{ decimals, useMultipliers = false, signDisplay }: FormatMetricValueOptions = {}\n): string => {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\n\tconst numericValue = Number( value );\n\tif ( isNaN( numericValue ) ) {\n\t\treturn '';\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'currency': {\n\t\t\t// Basic currency formatting - can be enhanced with full currency support\n\t\t\tconst formatted = useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 2,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t\treturn `$${ formatted }`;\n\t\t}\n\n\t\tcase 'average': {\n\t\t\tif ( ! Number.isFinite( numericValue ) ) {\n\t\t\t\treturn '—';\n\t\t\t}\n\n\t\t\treturn formatNumber( numericValue, {\n\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\tstyle: 'percent',\n\t\t\t\t\tsignDisplay: signDisplay ?? 'exceptZero',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcase 'number':\n\t\tdefault: {\n\t\t\treturn useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 0,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t}\n\t}\n};\n","import { formatNumber } from '@automattic/number-formatters';\n\n/**\n * Format a percentage value with smart decimal handling.\n * Uses `@automattic/number-formatters` for consistent formatting.\n * Removes unnecessary trailing zeros and caps at 2 decimal places.\n *\n * @param value - The percentage value (0-100 range)\n * @return Formatted percentage string (e.g., \"30%\", \"30.1%\", \"30.25%\")\n */\nexport const formatPercentage = ( value: number ): string => {\n\t// Use formatNumber with percentage style, but convert from 0-100 range to 0-1 range\n\treturn formatNumber( value / 100, {\n\t\tnumberFormatOptions: {\n\t\t\tstyle: 'percent',\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t},\n\t} );\n};\n","import { getStringWidth } from '@visx/text';\nimport type { TickFormatter } from '@visx/axis';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns the width of the longest tick.\n *\n * @param ticks - Ticks to get the width of.\n * @param formatTick - Function to format the tick.\n * @param {object} labelStyle - Style object for the label.\n * @return {number} - Width of the longest tick.\n */\nexport const getLongestTickWidth = < T extends AnyD3Scale >(\n\tticks: ScaleInput< T >[],\n\tformatTick: TickFormatter< ScaleInput< T > >,\n\tlabelStyle?: object\n) => {\n\tconst formattedTicks = ticks.map( tick => formatTick( tick, 0, [] ) );\n\tconst longestTick = formattedTicks.reduce(\n\t\t( longest, current ) => ( longest.length >= current.length ? longest : current ),\n\t\tformattedTicks[ 0 ]\n\t);\n\n\treturn getStringWidth( longestTick, labelStyle );\n};\n","import type { ChartTheme, SeriesData } from '../types';\nimport type { LegendShape } from '@visx/legend/lib/types';\nimport type { LineStyles } from '@visx/xychart';\n\n/**\n * Utility function to get consolidated line styles for a series\n * This consolidates the logic used by both LineChart and Legend components\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {LineStyles} The consolidated line styles for the series\n */\nexport function getSeriesLineStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): LineStyles {\n\t// Get theme-based line styles for line type\n\tconst themeSemanticLineStyle = providerTheme?.lineChart?.lineStyles?.[ seriesData.options?.type ];\n\n\t// Get theme-based line styles for index of series data\n\tconst themeSeriesLineStyle =\n\t\tproviderTheme?.seriesLineStyles?.[ index % providerTheme.seriesLineStyles.length ];\n\n\t// Priority order: custom series style > theme line type style > default theme series style\n\treturn (\n\t\tseriesData.options?.seriesLineStyle ?? themeSemanticLineStyle ?? themeSeriesLineStyle ?? {}\n\t);\n}\n\n/**\n * Utility function to get stroke color for a series\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {string[]} themeColors - Array of theme colors\n * @return {string} The stroke color for the series\n */\nexport function getSeriesStroke(\n\tseriesData: SeriesData,\n\tindex: number,\n\tthemeColors: string[]\n): string {\n\treturn seriesData.options?.stroke ?? themeColors[ index % themeColors.length ];\n}\n\n/**\n * Utility function to get shape styles for a legend item\n *\n * @param {SeriesData} series - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} theme - The chart theme configuration\n * @param {LegendShape} legendShape - The shape to use for the item (optional)\n * @return {Record< string, unknown >} The shape styles for the item\n */\nexport function getItemShapeStyles(\n\tseries: SeriesData,\n\tindex: number,\n\ttheme: ChartTheme,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): Record< string, unknown > {\n\tconst seriesShapeStyles = series.options?.legendShapeStyle ?? {};\n\tconst lineStyles = legendShape === 'line' ? getSeriesLineStyles( series, index, theme ) : {};\n\tconst themeShapeStyles = theme.legendShapeStyles?.[ index ];\n\n\tconst itemShapeStyles = {\n\t\t...seriesShapeStyles,\n\t\t...lineStyles,\n\t};\n\n\t// Return item shape styles if they are not empty\n\tif (\n\t\tObject.values( itemShapeStyles ).some(\n\t\t\tvalue => value !== undefined && value !== null && value !== ''\n\t\t)\n\t) {\n\t\treturn itemShapeStyles;\n\t}\n\n\t// Fallback to theme shape styles if defined\n\treturn themeShapeStyles ?? {};\n}\n","export const isSafari = () => {\n\tif ( typeof navigator !== 'undefined' && navigator.userAgent ) {\n\t\treturn /^((?!chrome|android).)*safari/i.test( navigator.userAgent );\n\t}\n\treturn false;\n};\n","import deepmerge from 'deepmerge';\nimport type { ChartTheme, CompleteChartTheme } from '../types';\n\n/**\n * Merges chart themes with proper precedence.\n * The second theme (override) takes precedence over the first theme (base).\n *\n * @param baseTheme - Base theme object\n * @param overrideTheme - Theme to override base with (takes precedence)\n * @return Merged theme with overrideTheme values taking precedence\n */\nexport function mergeThemes(\n\tbaseTheme: CompleteChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): CompleteChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme {\n\t// Use deepmerge to properly merge nested objects, with overrideTheme taking precedence\n\treturn deepmerge( baseTheme, overrideTheme, {\n\t\t// Ensure arrays are replaced rather than concatenated\n\t\tarrayMerge: ( _destinationArray, sourceArray ) => sourceArray,\n\t} ) as ChartTheme;\n}\n","import { color as d3Color, hsl as d3Hsl } from '@visx/vendor/d3-color';\n\n/**\n * Check if a value is a valid 6-digit hex color\n * @param hex - The value to check\n * @return true if valid hex color format (e.g., '#ff0000')\n */\nexport const isValidHexColor = ( hex: unknown ): hex is string => {\n\treturn typeof hex === 'string' && /^#[0-9a-fA-F]{6}$/.test( hex );\n};\n\n/**\n * Validate hex color format, throwing descriptive errors if invalid\n * @param hex - The hex color string to validate\n * @throws {Error} if hex string is malformed\n */\nexport const validateHexColor = ( hex: unknown ): void => {\n\tif ( isValidHexColor( hex ) ) {\n\t\treturn;\n\t}\n\n\t// Provide specific error messages for common issues\n\tif ( typeof hex !== 'string' ) {\n\t\tthrow new Error( 'Hex color must be a string' );\n\t}\n\tif ( ! hex.startsWith( '#' ) ) {\n\t\tthrow new Error( 'Hex color must start with #' );\n\t}\n\tif ( hex.length !== 7 ) {\n\t\tthrow new Error( 'Hex color must be 7 characters long (e.g., #ff0000)' );\n\t}\n\tthrow new Error( 'Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed' );\n};\n\n/**\n * Convert hex color to rgba with specified opacity.\n * This is genuinely reusable across chart components.\n * @param hex - The hex color string (e.g., '#ff0000')\n * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.\n * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')\n * @throws {Error} if hex string is malformed or alpha is not a valid number\n */\nexport const hexToRgba = ( hex: string, alpha: number ): string => {\n\tvalidateHexColor( hex );\n\n\tif ( typeof alpha !== 'number' || isNaN( alpha ) ) {\n\t\tthrow new Error( 'Alpha must be a number' );\n\t}\n\n\t// Safe to use non-null assertion since validateHexColor ensures valid hex\n\treturn d3Color( hex )!.copy( { opacity: alpha } ).formatRgb();\n};\n\n/**\n * Calculate the perceptual distance between two HSL colors\n * @param hsl1 - first color in HSL format [h, s, l]\n * @param hsl2 - second color in HSL format [h, s, l]\n * @return distance value (0-100+, lower means more similar)\n */\nexport const getColorDistance = (\n\thsl1: [ number, number, number ],\n\thsl2: [ number, number, number ]\n): number => {\n\tconst [ h1, s1, l1 ] = hsl1;\n\tconst [ h2, s2, l2 ] = hsl2;\n\n\t// Calculate hue difference, accounting for circular nature (0° = 360°)\n\tlet hueDiff = Math.abs( h1 - h2 );\n\thueDiff = Math.min( hueDiff, 360 - hueDiff );\n\n\t// Weight the differences: hue is most important, then lightness, then saturation\n\tconst hueWeight = 2;\n\tconst lightnessWeight = 1;\n\tconst saturationWeight = 0.5;\n\n\treturn Math.sqrt(\n\t\tMath.pow( hueDiff * hueWeight, 2 ) +\n\t\t\tMath.pow( ( l1 - l2 ) * lightnessWeight, 2 ) +\n\t\t\tMath.pow( ( s1 - s2 ) * saturationWeight, 2 )\n\t);\n};\n\n/**\n * Parse an HSL string like 'hsl(120, 50%, 50%)' into an HSL tuple.\n *\n * @param hslString - HSL color string\n * @return HSL tuple [h, s, l] or null if invalid\n */\nexport const parseHslString = ( hslString: string ): [ number, number, number ] | null => {\n\tconst lower = hslString.toLowerCase().trim();\n\n\t// Check prefix - d3-color handles the parsing\n\tif ( ! lower.startsWith( 'hsl(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Hsl( lower );\n\n\t// d3Hsl returns NaN values for invalid colors\n\tif ( isNaN( parsed.h ) && isNaN( parsed.s ) && isNaN( parsed.l ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize hue to 0-360 range (d3 may return NaN for achromatic colors)\n\tconst h = isNaN( parsed.h ) ? 0 : ( ( parsed.h % 360 ) + 360 ) % 360;\n\n\t// d3-color uses 0-1 scale, convert to 0-100\n\treturn [ h, parsed.s * 100, parsed.l * 100 ];\n};\n\n/**\n * Parse an RGB string like 'rgb(255, 0, 0)' into a hex color.\n *\n * @param rgbString - RGB color string\n * @return hex color string or null if invalid\n */\nexport const parseRgbString = ( rgbString: string ): string | null => {\n\tconst lower = rgbString.toLowerCase().trim();\n\n\t// Check prefix - only handle rgb(), not rgba()\n\tif ( ! lower.startsWith( 'rgb(' ) || lower.startsWith( 'rgba(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Color( lower );\n\n\t// d3Color returns null for invalid colors\n\tif ( ! parsed ) {\n\t\treturn null;\n\t}\n\n\t// d3-color clamps values automatically\n\treturn parsed.formatHex();\n};\n\n/**\n * Normalize any CSS color value to a hex color string.\n * Handles hex colors, HSL strings, RGB strings, and CSS variables.\n *\n * @param color - Any CSS color value\n * @param element - Optional DOM element for resolving CSS variables\n * @param resolveCss - Function to resolve CSS variables (injected for testability)\n * @return hex color string, or the original value if conversion fails\n */\nexport const normalizeColorToHex = (\n\tcolor: string,\n\telement?: HTMLElement | null,\n\tresolveCss?: ( value: string, el?: HTMLElement | null ) => string | null\n): string => {\n\tif ( ! color || typeof color !== 'string' ) {\n\t\treturn '';\n\t}\n\n\t// Already a valid hex color (6-digit format)\n\tif ( /^#[0-9a-fA-F]{6}$/.test( color ) ) {\n\t\treturn color;\n\t}\n\n\tconst trimmed = color.trim().toLowerCase();\n\n\t// Handle 3-digit hex colors - expand to 6-digit\n\tif ( /^#[0-9a-f]{3}$/i.test( trimmed ) ) {\n\t\tconst r = trimmed[ 1 ];\n\t\tconst g = trimmed[ 2 ];\n\t\tconst b = trimmed[ 3 ];\n\t\treturn `#${ r }${ r }${ g }${ g }${ b }${ b }`;\n\t}\n\n\t// Handle CSS variables - must be resolved before d3-color can parse\n\tif ( trimmed.startsWith( '--' ) || trimmed.startsWith( 'var(' ) ) {\n\t\tif ( resolveCss ) {\n\t\t\tconst resolved = resolveCss( color, element );\n\t\t\tif ( resolved ) {\n\t\t\t\t// Recursively normalize the resolved value\n\t\t\t\treturn normalizeColorToHex( resolved, element, resolveCss );\n\t\t\t}\n\t\t}\n\t\t// Can't resolve CSS variable, return original\n\t\treturn color;\n\t}\n\n\t// Handle HSL and RGB strings using d3-color\n\tif ( trimmed.startsWith( 'hsl(' ) || trimmed.startsWith( 'rgb(' ) ) {\n\t\t// Reject rgba() - we only handle rgb()\n\t\tif ( trimmed.startsWith( 'rgba(' ) ) {\n\t\t\treturn color;\n\t\t}\n\t\tconst parsed = d3Color( trimmed );\n\t\tif ( parsed ) {\n\t\t\treturn parsed.formatHex();\n\t\t}\n\t\treturn color;\n\t}\n\n\t// Unknown format, return as-is\n\treturn color;\n};\n\n/**\n * Lighten a hex color by blending it with white.\n * Useful for creating color gradients or lighter variants.\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @param blend - Blend amount with white (0 = original color, 1 = white)\n * @return Lightened hex color string (e.g., '#cce4ef')\n * @throws {Error} if hex string is malformed\n */\nexport const lightenHexColor = ( hex: string, blend: number ): string => {\n\tvalidateHexColor( hex );\n\n\tconst r = parseInt( hex.slice( 1, 3 ), 16 );\n\tconst g = parseInt( hex.slice( 3, 5 ), 16 );\n\tconst b = parseInt( hex.slice( 5, 7 ), 16 );\n\n\t// Blend with white (255, 255, 255)\n\tconst newR = Math.round( r + ( 255 - r ) * blend );\n\tconst newG = Math.round( g + ( 255 - g ) * blend );\n\tconst newB = Math.round( b + ( 255 - b ) * blend );\n\n\treturn `#${ newR.toString( 16 ).padStart( 2, '0' ) }${ newG\n\t\t.toString( 16 )\n\t\t.padStart( 2, '0' ) }${ newB.toString( 16 ).padStart( 2, '0' ) }`;\n};\n","/**\n * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')\n */\nconst CSS_VAR_NAME_PATTERN = /^--[\\w-]+$/;\n\n/**\n * Resolves a CSS custom property (variable) to its computed value.\n * Handles multiple formats:\n * - Plain variable names: '--my-color'\n * - CSS var() syntax: 'var(--my-color)'\n * - CSS var() with fallback: 'var(--my-color, #ffffff)'\n * - Regular values (returned as-is): '#ffffff', 'red'\n *\n * @param value - A CSS variable name, var() expression, or regular value\n * @param element - Optional DOM element to resolve the variable from (defaults to document.documentElement)\n * @return The resolved value, fallback value, or null if unresolvable\n */\nexport const resolveCssVariable = (\n\tvalue: string,\n\telement?: HTMLElement | null\n): string | null => {\n\tif ( ! value ) {\n\t\treturn null;\n\t}\n\n\t// Check if it's a var() expression: var(--name) or var(--name, fallback)\n\t// Parse manually to avoid regex backtracking vulnerabilities\n\tif ( value.startsWith( 'var(' ) && value.endsWith( ')' ) ) {\n\t\tconst parsed = parseVarExpression( value );\n\n\t\tif ( parsed ) {\n\t\t\tconst resolved = resolveVariableName( parsed.varName, element );\n\n\t\t\treturn resolved || parsed.fallback;\n\t\t}\n\t}\n\n\t// Check if it's a plain variable name (starts with --)\n\tif ( value.startsWith( '--' ) ) {\n\t\treturn resolveVariableName( value, element );\n\t}\n\n\t// Return regular values as-is (e.g., '#ffffff', 'red')\n\treturn value;\n};\n\n/**\n * Parses a var() expression into its variable name and optional fallback.\n * Uses string manipulation instead of complex regex to avoid ReDoS.\n *\n * @param expr - A var() expression like 'var(--name)' or 'var(--name, fallback)'\n * @return Parsed result or null if invalid\n */\nfunction parseVarExpression( expr: string ): { varName: string; fallback: string | null } | null {\n\t// Remove 'var(' prefix and ')' suffix\n\tconst inner = expr.slice( 4, -1 ).trim();\n\n\tif ( ! inner.startsWith( '--' ) ) {\n\t\treturn null;\n\t}\n\n\t// Find the comma separator (if any)\n\tconst commaIndex = inner.indexOf( ',' );\n\n\tif ( commaIndex === -1 ) {\n\t\t// No fallback: var(--name)\n\t\tconst varName = inner.trim();\n\t\t// Validate variable name format\n\t\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { varName, fallback: null };\n\t}\n\n\t// Has fallback: var(--name, fallback)\n\tconst varName = inner.slice( 0, commaIndex ).trim();\n\n\t// Validate variable name format\n\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\treturn null;\n\t}\n\n\tconst fallback = inner.slice( commaIndex + 1 ).trim();\n\n\treturn { varName, fallback: fallback || null };\n}\n\n/**\n * Resolves a plain CSS variable name to its computed value.\n *\n * @param varName - A CSS variable name like '--my-color'\n * @param element - Optional DOM element to resolve from\n * @return The computed value or null\n */\nfunction resolveVariableName( varName: string, element?: HTMLElement | null ): string | null {\n\tif ( typeof window === 'undefined' || typeof document === 'undefined' ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst targetElement = element || document.documentElement;\n\t\tconst computedValue = getComputedStyle( targetElement ).getPropertyValue( varName ).trim();\n\n\t\treturn computedValue || null;\n\t} catch {\n\t\t// Return null if getComputedStyle throws (e.g., detached element)\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Children, isValidElement, useMemo, type ReactNode } from 'react';
|
|
2
|
-
import { Legend } from '../components/legend';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Hook to detect if children contain a Legend component (composition pattern).
|
|
6
|
-
*
|
|
7
|
-
* @param {ReactNode} children - React children to search through
|
|
8
|
-
* @return {boolean} Whether a Legend component is present in children
|
|
9
|
-
*/
|
|
10
|
-
export function useHasLegendChild( children: ReactNode ): boolean {
|
|
11
|
-
return useMemo( () => {
|
|
12
|
-
let found = false;
|
|
13
|
-
|
|
14
|
-
Children.forEach( children, child => {
|
|
15
|
-
if ( isValidElement( child ) && child.type === Legend ) {
|
|
16
|
-
found = true;
|
|
17
|
-
}
|
|
18
|
-
} );
|
|
19
|
-
|
|
20
|
-
return found;
|
|
21
|
-
}, [ children ] );
|
|
22
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|