@brightlocal/ui-components 2.23.0 → 2.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/AI_USAGE.md +1 -1
  2. package/README.md +3 -2
  3. package/component-meta.json +116 -25
  4. package/deprecations.json +22 -0
  5. package/dist/alert.cjs +1 -1
  6. package/dist/alert.d.ts.map +1 -1
  7. package/dist/alert.js +6 -9
  8. package/dist/blocks/sidebar.cjs +1 -1
  9. package/dist/blocks/sidebar.d.ts.map +1 -1
  10. package/dist/blocks/sidebar.js +151 -156
  11. package/dist/brand-illustration-motif.cjs +1 -0
  12. package/dist/brand-illustration-motif.d.ts +55 -0
  13. package/dist/brand-illustration-motif.d.ts.map +1 -0
  14. package/dist/brand-illustration-motif.js +67 -0
  15. package/dist/chart.cjs +7 -7
  16. package/dist/chart.d.ts +287 -2
  17. package/dist/chart.d.ts.map +1 -1
  18. package/dist/chart.js +408 -152
  19. package/dist/combobox.cjs +3 -3
  20. package/dist/combobox.d.ts +14 -1
  21. package/dist/combobox.d.ts.map +1 -1
  22. package/dist/combobox.js +387 -376
  23. package/dist/data-table.cjs +1 -0
  24. package/dist/{blocks/data-table.d.ts → data-table.d.ts} +159 -4
  25. package/dist/data-table.d.ts.map +1 -0
  26. package/dist/data-table.js +721 -0
  27. package/dist/field.cjs +1 -1
  28. package/dist/field.d.ts +16 -1
  29. package/dist/field.d.ts.map +1 -1
  30. package/dist/field.js +23 -7
  31. package/dist/global-layout.cjs +1 -1
  32. package/dist/global-layout.d.ts +32 -2
  33. package/dist/global-layout.d.ts.map +1 -1
  34. package/dist/global-layout.js +179 -109
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.d.ts +2 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +526 -511
  39. package/dist/label.cjs +1 -1
  40. package/dist/label.d.ts +9 -0
  41. package/dist/label.d.ts.map +1 -1
  42. package/dist/label.js +26 -22
  43. package/dist/lib/spring-settle.cjs +1 -0
  44. package/dist/lib/spring-settle.d.ts +20 -0
  45. package/dist/lib/spring-settle.d.ts.map +1 -0
  46. package/dist/lib/spring-settle.js +4 -0
  47. package/dist/link.cjs +1 -1
  48. package/dist/link.d.ts +3 -2
  49. package/dist/link.d.ts.map +1 -1
  50. package/dist/link.js +22 -11
  51. package/dist/loading.cjs +1 -1
  52. package/dist/loading.d.ts +2 -1
  53. package/dist/loading.d.ts.map +1 -1
  54. package/dist/loading.js +106 -85
  55. package/dist/select.cjs +2 -2
  56. package/dist/select.d.ts +16 -1
  57. package/dist/select.d.ts.map +1 -1
  58. package/dist/select.js +112 -79
  59. package/dist/table.cjs +1 -1
  60. package/dist/table.d.ts +29 -0
  61. package/dist/table.d.ts.map +1 -1
  62. package/dist/table.js +2 -2
  63. package/dist/text-reveal-motion.cjs +1 -1
  64. package/dist/text-reveal-motion.d.ts.map +1 -1
  65. package/dist/text-reveal-motion.js +236 -219
  66. package/dist/typography.cjs +1 -1
  67. package/dist/typography.d.ts +20 -4
  68. package/dist/typography.d.ts.map +1 -1
  69. package/dist/typography.js +263 -228
  70. package/package.json +2 -14
  71. package/src/blocks/sidebar.tsx +11 -23
  72. package/src/components/alert.tsx +1 -4
  73. package/src/components/brand-illustration-motif.tsx +143 -0
  74. package/src/components/chart.tsx +632 -1
  75. package/src/components/combobox.tsx +47 -0
  76. package/src/{blocks → components}/data-table.tsx +270 -16
  77. package/src/components/field.tsx +31 -0
  78. package/src/components/global-layout.tsx +144 -5
  79. package/src/components/label.tsx +13 -1
  80. package/src/components/link.tsx +13 -1
  81. package/src/components/loading.tsx +71 -38
  82. package/src/components/select.tsx +82 -2
  83. package/src/components/table.tsx +31 -2
  84. package/src/components/text-reveal-motion.tsx +90 -64
  85. package/src/components/typography.tsx +74 -18
  86. package/src/index.ts +2 -1
  87. package/src/lib/spring-settle.ts +19 -0
  88. package/dist/blocks/data-table.cjs +0 -1
  89. package/dist/blocks/data-table.d.ts.map +0 -1
  90. package/dist/blocks/data-table.js +0 -654
@@ -124,7 +124,7 @@ const ChartContainer = React.forwardRef<HTMLDivElement, ChartContainerProps>(
124
124
  <div
125
125
  ref={ref}
126
126
  className={cn(
127
- "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
127
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
128
128
  className
129
129
  )}
130
130
  data-chart={chartId}
@@ -511,6 +511,618 @@ function ChartLegendContent({
511
511
 
512
512
  ChartLegendContent.displayName = "ChartLegendContent";
513
513
 
514
+ // ============================================================================
515
+ // Chart Dot
516
+ // ============================================================================
517
+
518
+ /**
519
+ * Diameter (px) options for {@link ChartDot}.
520
+ */
521
+ type ChartDotSize = 8 | 12;
522
+
523
+ /**
524
+ * Props for the ChartDot component (Figma: "Charts / Dot").
525
+ *
526
+ * Use as the `dot` / `activeDot` of a Recharts `Line`, `Area`, or `Scatter`.
527
+ * Recharts clones the element per data point and injects `cx`, `cy`,
528
+ * `payload`, `stroke`, and `fill`, so a consumer only sets the styling props.
529
+ */
530
+ interface ChartDotProps {
531
+ /**
532
+ * Dot diameter in pixels.
533
+ * @default 8
534
+ */
535
+ size?: ChartDotSize;
536
+ /**
537
+ * Render the hollow "Custom" variant — a background fill with a coloured
538
+ * stroke ring, so the dot reads as an outline sitting on the line.
539
+ * @default false
540
+ */
541
+ custom?: boolean;
542
+ /**
543
+ * Explicit dot colour (any CSS colour or `var(--color-*)` token).
544
+ * Defaults to the series colour Recharts injects.
545
+ */
546
+ color?: string;
547
+ /**
548
+ * Read the colour from this key on the data point (`payload[colorKey]`),
549
+ * giving a different colour per point.
550
+ * @example colorKey="dotColor"
551
+ */
552
+ colorKey?: string;
553
+ /** Injected by Recharts — the dot's x coordinate. */
554
+ cx?: number;
555
+ /** Injected by Recharts — the dot's y coordinate. */
556
+ cy?: number;
557
+ /** Injected by Recharts — the series stroke colour. */
558
+ stroke?: string;
559
+ /** Injected by Recharts — the series fill colour. */
560
+ fill?: string;
561
+ /** Injected by Recharts — the data point for this dot. */
562
+ payload?: Record<string, unknown>;
563
+ }
564
+
565
+ /**
566
+ * Resolves a dot colour from the per-point key, explicit override, or the
567
+ * series colours Recharts injects.
568
+ */
569
+ function resolveDotColor({
570
+ colorKey,
571
+ color,
572
+ fill,
573
+ stroke,
574
+ payload,
575
+ }: Pick<ChartDotProps, "colorKey" | "color" | "fill" | "stroke" | "payload">) {
576
+ const pointColor =
577
+ colorKey && typeof payload?.[colorKey] === "string"
578
+ ? (payload[colorKey] as string)
579
+ : undefined;
580
+ return pointColor ?? color ?? fill ?? stroke ?? "currentColor";
581
+ }
582
+
583
+ /**
584
+ * ChartDot renders a data-point marker for line/area/scatter charts.
585
+ */
586
+ function ChartDot({
587
+ size = 8,
588
+ custom = false,
589
+ color,
590
+ colorKey,
591
+ cx,
592
+ cy,
593
+ stroke,
594
+ fill,
595
+ payload,
596
+ }: ChartDotProps) {
597
+ if (cx == null || cy == null) {
598
+ return null;
599
+ }
600
+
601
+ const resolvedColor = resolveDotColor({
602
+ colorKey,
603
+ color,
604
+ fill,
605
+ stroke,
606
+ payload,
607
+ });
608
+
609
+ return (
610
+ <circle
611
+ className={custom ? "fill-background" : undefined}
612
+ cx={cx}
613
+ cy={cy}
614
+ data-slot="chart-dot"
615
+ fill={custom ? undefined : resolvedColor}
616
+ r={size / 2}
617
+ stroke={custom ? resolvedColor : "none"}
618
+ strokeWidth={custom ? 2 : undefined}
619
+ />
620
+ );
621
+ }
622
+
623
+ ChartDot.displayName = "ChartDot";
624
+
625
+ /**
626
+ * Diameter (px) options for {@link ChartDotOnStroke}.
627
+ */
628
+ type ChartDotOnStrokeSize = 6 | 8 | 10;
629
+
630
+ /**
631
+ * Props for the ChartDotOnStroke component (Figma: "Charts / Dot on Stroke").
632
+ *
633
+ * A solid marker ringed with the background colour so it sits cleanly on top
634
+ * of the series line. Use as the `dot` / `activeDot` of a Recharts series.
635
+ */
636
+ interface ChartDotOnStrokeProps {
637
+ /**
638
+ * Dot diameter in pixels.
639
+ * @default 6
640
+ */
641
+ size?: ChartDotOnStrokeSize;
642
+ /** Explicit dot colour. Defaults to the series colour Recharts injects. */
643
+ color?: string;
644
+ /** Read the colour from `payload[colorKey]` for a per-point colour. */
645
+ colorKey?: string;
646
+ /** Injected by Recharts — the dot's x coordinate. */
647
+ cx?: number;
648
+ /** Injected by Recharts — the dot's y coordinate. */
649
+ cy?: number;
650
+ /** Injected by Recharts — the series stroke colour. */
651
+ stroke?: string;
652
+ /** Injected by Recharts — the series fill colour. */
653
+ fill?: string;
654
+ /** Injected by Recharts — the data point for this dot. */
655
+ payload?: Record<string, unknown>;
656
+ }
657
+
658
+ /**
659
+ * ChartDotOnStroke renders a solid marker ringed with the background colour.
660
+ */
661
+ function ChartDotOnStroke({
662
+ size = 6,
663
+ color,
664
+ colorKey,
665
+ cx,
666
+ cy,
667
+ stroke,
668
+ fill,
669
+ payload,
670
+ }: ChartDotOnStrokeProps) {
671
+ if (cx == null || cy == null) {
672
+ return null;
673
+ }
674
+
675
+ const resolvedColor = resolveDotColor({
676
+ colorKey,
677
+ color,
678
+ fill,
679
+ stroke,
680
+ payload,
681
+ });
682
+
683
+ return (
684
+ <circle
685
+ className="stroke-background"
686
+ cx={cx}
687
+ cy={cy}
688
+ data-slot="chart-dot-on-stroke"
689
+ fill={resolvedColor}
690
+ r={size / 2}
691
+ strokeWidth={2}
692
+ />
693
+ );
694
+ }
695
+
696
+ ChartDotOnStroke.displayName = "ChartDotOnStroke";
697
+
698
+ // ============================================================================
699
+ // Chart Radar Grid
700
+ // ============================================================================
701
+
702
+ /**
703
+ * Grid shape for {@link ChartRadarGrid}. "default" renders a polygon grid,
704
+ * "circle" renders concentric circles.
705
+ */
706
+ type ChartRadarGridType = "default" | "circle";
707
+
708
+ /**
709
+ * Props for the ChartRadarGrid component (Figma: "Charts / Radar Chart / Grid").
710
+ *
711
+ * Wraps Recharts `PolarGrid` and must be rendered inside a `RadarChart` /
712
+ * `RadialBarChart`. Encapsulates the internal Recharts grid styling so
713
+ * consumers never reach into `.recharts-polar-grid-*` classes.
714
+ */
715
+ interface ChartRadarGridProps extends Omit<
716
+ React.ComponentProps<typeof RechartsPrimitive.PolarGrid>,
717
+ "gridType" | "fill"
718
+ > {
719
+ /**
720
+ * Grid shape (Figma "Type"). "default" → polygon, "circle" → concentric
721
+ * circles.
722
+ * @default "default"
723
+ */
724
+ type?: ChartRadarGridType;
725
+ /**
726
+ * Fill the grid rings with a translucent wash and hide the spokes and
727
+ * outlines (Figma "Filled" variant).
728
+ * @default false
729
+ */
730
+ filled?: boolean;
731
+ /**
732
+ * Colour of the filled wash when `filled` is set (any CSS colour or token).
733
+ * Defaults to the Figma grid colour; override to match the chart's series.
734
+ * @default "var(--chart-teal)"
735
+ */
736
+ fillColor?: string;
737
+ /**
738
+ * Opacity of the filled wash when `filled` is set.
739
+ * @default 0.2
740
+ */
741
+ fillOpacity?: number;
742
+ /**
743
+ * Draw only the outermost ring, hiding the inner concentric rings' strokes.
744
+ * @default false
745
+ */
746
+ boundaryOnly?: boolean;
747
+ }
748
+
749
+ /**
750
+ * ChartRadarGrid renders a design-system polar grid for radar / radial charts.
751
+ */
752
+ function ChartRadarGrid({
753
+ type = "default",
754
+ filled = false,
755
+ fillColor = "var(--chart-teal)",
756
+ fillOpacity = 0.2,
757
+ boundaryOnly = false,
758
+ radialLines,
759
+ className,
760
+ ...props
761
+ }: ChartRadarGridProps) {
762
+ const gridType = type === "circle" ? "circle" : "polygon";
763
+ const concentric =
764
+ gridType === "circle"
765
+ ? "recharts-polar-grid-concentric-circle"
766
+ : "recharts-polar-grid-concentric-polygon";
767
+ const boundaryClass = boundaryOnly
768
+ ? `[&_.${concentric}:not(:last-of-type)]:stroke-transparent`
769
+ : undefined;
770
+
771
+ if (filled) {
772
+ return (
773
+ <RechartsPrimitive.PolarGrid
774
+ className={cn(boundaryClass, className)}
775
+ fill={fillColor}
776
+ fillOpacity={fillOpacity}
777
+ gridType={gridType}
778
+ radialLines={radialLines ?? false}
779
+ stroke="none"
780
+ {...props}
781
+ />
782
+ );
783
+ }
784
+
785
+ return (
786
+ <RechartsPrimitive.PolarGrid
787
+ className={cn(boundaryClass, className)}
788
+ gridType={gridType}
789
+ radialLines={radialLines}
790
+ {...props}
791
+ />
792
+ );
793
+ }
794
+
795
+ ChartRadarGrid.displayName = "ChartRadarGrid";
796
+
797
+ // ============================================================================
798
+ // Chart Radar Label Wrapper
799
+ // ============================================================================
800
+
801
+ /**
802
+ * Label style for {@link ChartRadarLabelWrapper} (Figma "Type").
803
+ * "default" shows a primary value above the axis label; "custom" shows the
804
+ * axis label only.
805
+ */
806
+ type ChartRadarLabelWrapperType = "default" | "custom";
807
+
808
+ /**
809
+ * Props for the ChartRadarLabelWrapper component
810
+ * (Figma: "Charts / Radar Chart / Label Wrapper").
811
+ *
812
+ * Use as the `tick` of a Recharts `PolarAngleAxis`. Recharts clones it once per
813
+ * axis point and injects `x`, `y`, `textAnchor`, `payload`, and `index`.
814
+ */
815
+ interface ChartRadarLabelWrapperProps {
816
+ /**
817
+ * Label style. "default" renders a primary value line above the axis label;
818
+ * "custom" renders the axis label only.
819
+ * @default "default"
820
+ */
821
+ type?: ChartRadarLabelWrapperType;
822
+ /**
823
+ * The chart data rows, used to resolve the primary value by tick `index`.
824
+ * Pass the same array given to the chart. Required for the primary line.
825
+ */
826
+ data?: readonly unknown[];
827
+ /** Key on the data row for the primary value (top line). */
828
+ primaryKey?: string;
829
+ /**
830
+ * Optional second key rendered as `primary/secondary`
831
+ * (e.g. actual vs target).
832
+ */
833
+ secondaryKey?: string;
834
+ /** Injected by Recharts — the tick's x coordinate. */
835
+ x?: number;
836
+ /** Injected by Recharts — the tick's y coordinate. */
837
+ y?: number;
838
+ /** Injected by Recharts — horizontal text anchoring for the tick. */
839
+ textAnchor?: "start" | "middle" | "end" | "inherit";
840
+ /** Injected by Recharts — the axis payload (`payload.value` is the label). */
841
+ payload?: { value?: React.ReactNode };
842
+ /** Injected by Recharts — the tick's index within the axis. */
843
+ index?: number;
844
+ }
845
+
846
+ /**
847
+ * ChartRadarLabelWrapper renders a one- or two-line polar axis tick label.
848
+ */
849
+ function ChartRadarLabelWrapper({
850
+ type = "default",
851
+ data,
852
+ primaryKey,
853
+ secondaryKey,
854
+ x,
855
+ y,
856
+ textAnchor,
857
+ payload,
858
+ index,
859
+ }: ChartRadarLabelWrapperProps) {
860
+ const row =
861
+ data != null && index != null
862
+ ? (data[index] as Record<string, unknown> | undefined)
863
+ : undefined;
864
+ const primaryValue = row && primaryKey != null ? row[primaryKey] : undefined;
865
+ const secondaryValue =
866
+ row && secondaryKey != null ? row[secondaryKey] : undefined;
867
+
868
+ const primary =
869
+ type === "default" && primaryValue != null
870
+ ? secondaryValue != null
871
+ ? `${String(primaryValue)}/${String(secondaryValue)}`
872
+ : String(primaryValue)
873
+ : null;
874
+
875
+ return (
876
+ <text
877
+ className="text-xs"
878
+ data-slot="chart-radar-label-wrapper"
879
+ textAnchor={textAnchor}
880
+ x={x}
881
+ y={y}
882
+ >
883
+ {primary != null && (
884
+ <tspan className="fill-card-foreground" dy="-0.5em" x={x}>
885
+ {primary}
886
+ </tspan>
887
+ )}
888
+ <tspan
889
+ className="fill-muted-foreground"
890
+ dy={primary != null ? "1.2em" : undefined}
891
+ x={x}
892
+ >
893
+ {payload?.value}
894
+ </tspan>
895
+ </text>
896
+ );
897
+ }
898
+
899
+ ChartRadarLabelWrapper.displayName = "ChartRadarLabelWrapper";
900
+
901
+ // ============================================================================
902
+ // Chart Pie Labels
903
+ // ============================================================================
904
+
905
+ /**
906
+ * Props for the ChartPieLabelList component
907
+ * (Figma: "Charts / Pie Chart / Label List").
908
+ *
909
+ * The category-name label rendered inside each pie/donut slice. Use as the
910
+ * `label` of a Recharts `Pie`; Recharts injects the slice geometry and payload.
911
+ */
912
+ interface ChartPieLabelListProps {
913
+ /** Key on the data point for the category name. */
914
+ nameKey?: string;
915
+ /** Chart config used to resolve a display label for the name. */
916
+ config?: ChartConfig;
917
+ /**
918
+ * Fraction (0–1) between inner and outer radius at which to place the label.
919
+ * @default 0.5
920
+ */
921
+ radiusRatio?: number;
922
+ /** Injected by Recharts — slice centre x. */
923
+ cx?: number;
924
+ /** Injected by Recharts — slice centre y. */
925
+ cy?: number;
926
+ /** Injected by Recharts — slice mid angle (degrees). */
927
+ midAngle?: number;
928
+ /** Injected by Recharts — slice inner radius. */
929
+ innerRadius?: number;
930
+ /** Injected by Recharts — slice outer radius. */
931
+ outerRadius?: number;
932
+ /** Injected by Recharts — the slice's data point. */
933
+ payload?: Record<string, unknown>;
934
+ /** Injected by Recharts — the slice's resolved name. */
935
+ name?: string;
936
+ }
937
+
938
+ /**
939
+ * ChartPieLabelList renders a category-name label inside a pie slice.
940
+ */
941
+ function ChartPieLabelList({
942
+ nameKey,
943
+ config,
944
+ radiusRatio = 0.5,
945
+ cx,
946
+ cy,
947
+ midAngle = 0,
948
+ innerRadius = 0,
949
+ outerRadius = 0,
950
+ payload,
951
+ name,
952
+ }: ChartPieLabelListProps) {
953
+ if (cx == null || cy == null) {
954
+ return null;
955
+ }
956
+
957
+ const radian = Math.PI / 180;
958
+ const radius = innerRadius + (outerRadius - innerRadius) * radiusRatio;
959
+ const x = cx + radius * Math.cos(-midAngle * radian);
960
+ const y = cy + radius * Math.sin(-midAngle * radian);
961
+
962
+ const resolved =
963
+ nameKey != null && payload != null ? payload[nameKey] : undefined;
964
+ const key = resolved != null ? String(resolved) : name;
965
+ const label = key != null ? (config?.[key]?.label ?? key) : key;
966
+
967
+ return (
968
+ <text
969
+ className="fill-foreground text-xs"
970
+ data-slot="chart-pie-label-list"
971
+ dominantBaseline="middle"
972
+ textAnchor="middle"
973
+ x={x}
974
+ y={y}
975
+ >
976
+ {label as React.ReactNode}
977
+ </text>
978
+ );
979
+ }
980
+
981
+ ChartPieLabelList.displayName = "ChartPieLabelList";
982
+
983
+ /**
984
+ * Props for the ChartPieLabelWrapper component
985
+ * (Figma: "Charts / Pie Chart / Label Wrapper").
986
+ *
987
+ * The value label rendered outside a pie/donut slice, connected by Recharts'
988
+ * `labelLine`. Use as the `label` of a Recharts `Pie`.
989
+ */
990
+ interface ChartPieLabelWrapperProps {
991
+ /** Key on the data point for the value. Defaults to the slice value. */
992
+ valueKey?: string;
993
+ /** Injected by Recharts — the external label x. */
994
+ x?: number;
995
+ /** Injected by Recharts — the external label y. */
996
+ y?: number;
997
+ /** Injected by Recharts — horizontal text anchoring. */
998
+ textAnchor?: "start" | "middle" | "end" | "inherit";
999
+ /** Injected by Recharts — the slice's data point. */
1000
+ payload?: Record<string, unknown>;
1001
+ /** Injected by Recharts — the slice's resolved value. */
1002
+ value?: React.ReactNode;
1003
+ }
1004
+
1005
+ /**
1006
+ * ChartPieLabelWrapper renders a value label outside a pie slice.
1007
+ */
1008
+ function ChartPieLabelWrapper({
1009
+ valueKey,
1010
+ x,
1011
+ y,
1012
+ textAnchor,
1013
+ payload,
1014
+ value,
1015
+ }: ChartPieLabelWrapperProps) {
1016
+ if (x == null || y == null) {
1017
+ return null;
1018
+ }
1019
+
1020
+ const content =
1021
+ valueKey != null && payload != null
1022
+ ? (payload[valueKey] as React.ReactNode)
1023
+ : value;
1024
+
1025
+ return (
1026
+ <text
1027
+ className="fill-foreground text-xs"
1028
+ data-slot="chart-pie-label-wrapper"
1029
+ dominantBaseline="middle"
1030
+ textAnchor={textAnchor}
1031
+ x={x}
1032
+ y={y}
1033
+ >
1034
+ {content}
1035
+ </text>
1036
+ );
1037
+ }
1038
+
1039
+ ChartPieLabelWrapper.displayName = "ChartPieLabelWrapper";
1040
+
1041
+ // ============================================================================
1042
+ // Chart Center Label
1043
+ // ============================================================================
1044
+
1045
+ /** Primary-value text size for {@link ChartCenterLabel}. */
1046
+ type ChartCenterLabelSize = "2xl" | "3xl" | "4xl";
1047
+
1048
+ /**
1049
+ * Props for the ChartCenterLabel component — the centred value + label shown in
1050
+ * the hole of a donut or radial chart. Use as the `content` of a Recharts
1051
+ * `Label`; Recharts injects the `viewBox` (which supplies the centre point).
1052
+ */
1053
+ interface ChartCenterLabelProps {
1054
+ /** Primary (large) value shown in the centre. */
1055
+ primary?: React.ReactNode;
1056
+ /** Secondary label shown beneath the primary value. */
1057
+ secondary?: React.ReactNode;
1058
+ /**
1059
+ * Size of the primary value text.
1060
+ * @default "3xl"
1061
+ */
1062
+ size?: ChartCenterLabelSize;
1063
+ /** Injected by Recharts — the label viewBox (provides `cx`/`cy`). */
1064
+ viewBox?: unknown;
1065
+ }
1066
+
1067
+ const chartCenterLabelPrimarySize: Record<ChartCenterLabelSize, string> = {
1068
+ "2xl": "text-2xl leading-8",
1069
+ "3xl": "text-3xl",
1070
+ "4xl": "text-4xl leading-10",
1071
+ };
1072
+
1073
+ /**
1074
+ * ChartCenterLabel renders a centred primary value with an optional label.
1075
+ */
1076
+ function ChartCenterLabel({
1077
+ primary,
1078
+ secondary,
1079
+ size = "3xl",
1080
+ viewBox,
1081
+ }: ChartCenterLabelProps) {
1082
+ if (
1083
+ viewBox == null ||
1084
+ typeof viewBox !== "object" ||
1085
+ !("cx" in viewBox) ||
1086
+ !("cy" in viewBox)
1087
+ ) {
1088
+ return null;
1089
+ }
1090
+
1091
+ const { cx, cy } = viewBox as { cx: number; cy: number };
1092
+
1093
+ return (
1094
+ <text
1095
+ data-slot="chart-center-label"
1096
+ dominantBaseline="middle"
1097
+ textAnchor="middle"
1098
+ x={cx}
1099
+ y={cy}
1100
+ >
1101
+ <tspan
1102
+ className={cn(
1103
+ "fill-foreground font-sans font-bold",
1104
+ chartCenterLabelPrimarySize[size]
1105
+ )}
1106
+ x={cx}
1107
+ y={cy}
1108
+ >
1109
+ {primary}
1110
+ </tspan>
1111
+ {secondary != null && (
1112
+ <tspan
1113
+ className="fill-muted-foreground font-sans text-xs font-normal"
1114
+ x={cx}
1115
+ y={cy + 24}
1116
+ >
1117
+ {secondary}
1118
+ </tspan>
1119
+ )}
1120
+ </text>
1121
+ );
1122
+ }
1123
+
1124
+ ChartCenterLabel.displayName = "ChartCenterLabel";
1125
+
514
1126
  // ============================================================================
515
1127
  // Exports
516
1128
  // ============================================================================
@@ -522,6 +1134,13 @@ export {
522
1134
  ChartLegend,
523
1135
  ChartLegendContent,
524
1136
  ChartStyle,
1137
+ ChartDot,
1138
+ ChartDotOnStroke,
1139
+ ChartRadarGrid,
1140
+ ChartRadarLabelWrapper,
1141
+ ChartPieLabelList,
1142
+ ChartPieLabelWrapper,
1143
+ ChartCenterLabel,
525
1144
  };
526
1145
 
527
1146
  export type {
@@ -530,6 +1149,18 @@ export type {
530
1149
  ChartTooltipContentProps,
531
1150
  ChartLegendProps,
532
1151
  ChartLegendContentProps,
1152
+ ChartDotProps,
1153
+ ChartDotOnStrokeProps,
1154
+ ChartDotSize,
1155
+ ChartDotOnStrokeSize,
1156
+ ChartRadarGridProps,
1157
+ ChartRadarGridType,
1158
+ ChartRadarLabelWrapperProps,
1159
+ ChartRadarLabelWrapperType,
1160
+ ChartPieLabelListProps,
1161
+ ChartPieLabelWrapperProps,
1162
+ ChartCenterLabelProps,
1163
+ ChartCenterLabelSize,
533
1164
  };
534
1165
 
535
1166
  // Re-export Recharts components with aliases to avoid naming conflicts