impact-nova 1.5.14 → 1.6.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.
Files changed (149) hide show
  1. package/dist/components/ui/accordion.d.ts +4 -1
  2. package/dist/components/ui/accordion.js +28 -22
  3. package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +11 -11
  4. package/dist/components/ui/ag-grid-react/cell-renderers/checkbox-display-renderer.js +12 -12
  5. package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +13 -13
  6. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +13 -13
  7. package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +30 -30
  8. package/dist/components/ui/ag-grid-react/cell-renderers/editors/percent-progress-cell-editor.js +13 -13
  9. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +16 -16
  10. package/dist/components/ui/ag-grid-react/cell-renderers/editors/textarea-cell-editor.js +17 -17
  11. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +11 -11
  12. package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +2 -2
  13. package/dist/components/ui/ag-grid-react/cell-renderers/percent-progress-display-renderer.js +11 -13
  14. package/dist/components/ui/ag-grid-react/cell-renderers/select-display-renderer.js +8 -8
  15. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +6 -6
  16. package/dist/components/ui/ag-grid-react/cell-renderers/status-badge-renderer.d.ts +1 -1
  17. package/dist/components/ui/ag-grid-react/cell-renderers/status-badge-renderer.js +14 -14
  18. package/dist/components/ui/ag-grid-react/cell-renderers/switch-display-renderer.js +18 -18
  19. package/dist/components/ui/ag-grid-react/cell-renderers/textarea-display-renderer.js +6 -6
  20. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +14 -14
  21. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +35 -35
  22. package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +49 -49
  23. package/dist/components/ui/ag-grid-react/headers/components/header-info.js +29 -29
  24. package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +9 -9
  25. package/dist/components/ui/ag-grid-react/headers/components/section-renderers.js +20 -20
  26. package/dist/components/ui/ag-grid-react/headers/custom-header-group.js +10 -10
  27. package/dist/components/ui/ag-grid-react/headers/custom-header.js +76 -76
  28. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +118 -118
  29. package/dist/components/ui/ag-grid-react/index.js +121 -102
  30. package/dist/components/ui/alert-dialog.js +6 -6
  31. package/dist/components/ui/alert.d.ts +4 -3
  32. package/dist/components/ui/alert.js +182 -64
  33. package/dist/components/ui/avatar.js +5 -5
  34. package/dist/components/ui/badge.d.ts +7 -2
  35. package/dist/components/ui/badge.js +105 -32
  36. package/dist/components/ui/breadcrumb.js +26 -21
  37. package/dist/components/ui/button-group.d.ts +7 -0
  38. package/dist/components/ui/button-group.js +116 -91
  39. package/dist/components/ui/button-variants.d.ts +7 -2
  40. package/dist/components/ui/button-variants.js +31 -16
  41. package/dist/components/ui/button.d.ts +2 -2
  42. package/dist/components/ui/button.js +10 -10
  43. package/dist/components/ui/calendar.js +185 -184
  44. package/dist/components/ui/card.js +24 -24
  45. package/dist/components/ui/chart/chart.js +27 -27
  46. package/dist/components/ui/chart/chart.utils.js +50 -50
  47. package/dist/components/ui/checkbox.js +22 -22
  48. package/dist/components/ui/chips.d.ts +19 -3
  49. package/dist/components/ui/chips.js +140 -41
  50. package/dist/components/ui/command-palette/command-palette-layout.d.ts +28 -0
  51. package/dist/components/ui/command-palette/command-palette-layout.js +59 -0
  52. package/dist/components/ui/command-palette/command-palette.js +254 -264
  53. package/dist/components/ui/command-palette/index.d.ts +1 -1
  54. package/dist/components/ui/command-palette/index.js +42 -41
  55. package/dist/components/ui/command-palette/kbd.js +18 -18
  56. package/dist/components/ui/command-palette/shortcut-settings.d.ts +3 -3
  57. package/dist/components/ui/command-palette/shortcut-settings.js +105 -111
  58. package/dist/components/ui/command-palette/utils.d.ts +6 -1
  59. package/dist/components/ui/command-palette/utils.js +81 -74
  60. package/dist/components/ui/data-table/data-table-column-list.js +31 -31
  61. package/dist/components/ui/data-table/data-table-constants.d.ts +6 -0
  62. package/dist/components/ui/data-table/data-table-constants.js +4 -0
  63. package/dist/components/ui/data-table/data-table-context.d.ts +4 -0
  64. package/dist/components/ui/data-table/data-table-format-options.js +35 -35
  65. package/dist/components/ui/data-table/data-table-sheet.d.ts +4 -4
  66. package/dist/components/ui/data-table/data-table-sheet.js +91 -58
  67. package/dist/components/ui/data-table/data-table-view-options.js +29 -29
  68. package/dist/components/ui/data-table/data-table.js +84 -52
  69. package/dist/components/ui/data-table/index.d.ts +1 -0
  70. package/dist/components/ui/data-table/index.js +15 -13
  71. package/dist/components/ui/date-picker/date-picker.js +35 -35
  72. package/dist/components/ui/date-picker/date-range-picker.js +166 -164
  73. package/dist/components/ui/date-picker/month-picker.js +14 -14
  74. package/dist/components/ui/date-picker/month-range-picker.js +198 -189
  75. package/dist/components/ui/date-picker/multi-date-picker.js +14 -14
  76. package/dist/components/ui/date-picker/multi-month-picker.js +1 -1
  77. package/dist/components/ui/date-picker/multi-week-picker.js +1 -1
  78. package/dist/components/ui/date-picker/week-picker.js +2 -2
  79. package/dist/components/ui/date-picker/week-range-picker.js +164 -162
  80. package/dist/components/ui/dialog.js +25 -28
  81. package/dist/components/ui/drawer.js +40 -40
  82. package/dist/components/ui/dropdown-menu.js +72 -72
  83. package/dist/components/ui/empty-container.js +73 -69
  84. package/dist/components/ui/file-upload.js +137 -135
  85. package/dist/components/ui/filter-panel/filter-panel.d.ts +2 -2
  86. package/dist/components/ui/filter-panel/filter-panel.js +175 -97
  87. package/dist/components/ui/filter-strip/filter-strip.d.ts +1 -1
  88. package/dist/components/ui/filter-strip/filter-strip.js +63 -50
  89. package/dist/components/ui/filter-strip/filter-summary.d.ts +4 -1
  90. package/dist/components/ui/filter-strip/filter-summary.js +230 -146
  91. package/dist/components/ui/filter-strip/filter-tag-list.js +125 -91
  92. package/dist/components/ui/header.d.ts +7 -3
  93. package/dist/components/ui/header.js +87 -79
  94. package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +44 -44
  95. package/dist/components/ui/hover-card.js +10 -10
  96. package/dist/components/ui/input.js +79 -70
  97. package/dist/components/ui/loader.js +16 -16
  98. package/dist/components/ui/nested-list/components/NestedListCategoryFilters.js +16 -16
  99. package/dist/components/ui/nested-list/components/NestedListHeader.js +27 -27
  100. package/dist/components/ui/nested-list/components/SortableItem.js +58 -58
  101. package/dist/components/ui/notification-panel/notification-item.js +32 -32
  102. package/dist/components/ui/notification-panel/notification-list.js +24 -24
  103. package/dist/components/ui/notification-panel/notification-panel.js +26 -26
  104. package/dist/components/ui/popover.js +22 -22
  105. package/dist/components/ui/progress.js +34 -34
  106. package/dist/components/ui/prompt.js +48 -48
  107. package/dist/components/ui/radio-group.js +63 -54
  108. package/dist/components/ui/select/components/LabelWithSequence.js +6 -6
  109. package/dist/components/ui/select/components/Submenu.js +33 -33
  110. package/dist/components/ui/select/select.js +425 -376
  111. package/dist/components/ui/sheet.js +88 -66
  112. package/dist/components/ui/sidebar.js +342 -296
  113. package/dist/components/ui/skeleton.js +6 -6
  114. package/dist/components/ui/slider.js +17 -17
  115. package/dist/components/ui/statistics-card.d.ts +86 -0
  116. package/dist/components/ui/statistics-card.hooks.d.ts +150 -0
  117. package/dist/components/ui/statistics-card.hooks.js +100 -0
  118. package/dist/components/ui/statistics-card.js +259 -0
  119. package/dist/components/ui/stepper.js +51 -51
  120. package/dist/components/ui/switch.js +7 -7
  121. package/dist/components/ui/tabs.js +70 -70
  122. package/dist/components/ui/tag-group.d.ts +1 -0
  123. package/dist/components/ui/tag-group.js +14 -13
  124. package/dist/components/ui/tag.js +43 -43
  125. package/dist/components/ui/textarea.js +86 -58
  126. package/dist/components/ui/toast.js +39 -39
  127. package/dist/components/ui/tooltip.js +23 -23
  128. package/dist/components/ui/types/date-picker.types.d.ts +1 -0
  129. package/dist/components/ui/types/filter-panel.types.d.ts +3 -0
  130. package/dist/components/ui/types/filter-strip.types.d.ts +14 -0
  131. package/dist/components/ui/types/horizontal-scroller.types.d.ts +1 -1
  132. package/dist/components/ui/types/statistics-card.types.d.ts +1 -0
  133. package/dist/i18n/defaultMessages.d.ts +8 -0
  134. package/dist/i18n/defaultMessages.js +15 -9
  135. package/dist/i18n/locales/de.js +7 -1
  136. package/dist/i18n/locales/es.js +7 -1
  137. package/dist/i18n/locales/hi.js +7 -1
  138. package/dist/i18n/locales/kn.js +7 -1
  139. package/dist/icons/assets/bulk-edit.svg.js +5 -0
  140. package/dist/icons/assets/clock.svg.js +5 -0
  141. package/dist/icons/assets/statistics.svg.js +5 -0
  142. package/dist/icons/index.d.ts +3 -0
  143. package/dist/icons/index.js +254 -206
  144. package/dist/impact-nova.css +1 -1
  145. package/dist/index.d.ts +1 -0
  146. package/dist/index.js +361 -347
  147. package/package.json +3 -2
  148. package/tailwind.config.js +259 -152
  149. /package/dist/icons/assets/{PivotMode.svg.js → pivotMode.svg.js} +0 -0
@@ -1,13 +1,13 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import * as r from "react";
3
- import { cn as t } from "../../lib/utils.js";
4
- const n = r.forwardRef(
5
- ({ className: e, ...o }, a) => /* @__PURE__ */ m(
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { cn as r } from "../../lib/utils.js";
4
+ const n = m.forwardRef(
5
+ ({ className: e, ...o }, a) => /* @__PURE__ */ t(
6
6
  "div",
7
7
  {
8
8
  ref: a,
9
9
  "data-component": "skeleton",
10
- className: t("animate-pulse rounded-md bg-primary/10", e),
10
+ className: r("animate-pulse rounded-md bg-brand/10", e),
11
11
  ...o
12
12
  }
13
13
  )
@@ -1,50 +1,50 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
3
  import * as e from "@radix-ui/react-slider";
4
- import { cn as t } from "../../lib/utils.js";
5
- const d = s.forwardRef(({ className: a, ...o }, i) => /* @__PURE__ */ n(
4
+ import { cn as d } from "../../lib/utils.js";
5
+ const t = s.forwardRef(({ className: r, ...o }, l) => /* @__PURE__ */ n(
6
6
  e.Root,
7
7
  {
8
- ref: i,
9
- className: t(
8
+ ref: l,
9
+ className: d(
10
10
  "relative flex w-full touch-none select-none items-center",
11
- a
11
+ r
12
12
  ),
13
13
  "data-component": "slider-root",
14
14
  ...o,
15
15
  children: [
16
- /* @__PURE__ */ r(
16
+ /* @__PURE__ */ a(
17
17
  e.Track,
18
18
  {
19
- className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",
19
+ className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-brand/20",
20
20
  "data-component": "slider-track",
21
- children: /* @__PURE__ */ r(
21
+ children: /* @__PURE__ */ a(
22
22
  e.Range,
23
23
  {
24
- className: "absolute h-full bg-primary",
24
+ className: "absolute h-full bg-brand",
25
25
  "data-component": "slider-range"
26
26
  }
27
27
  )
28
28
  }
29
29
  ),
30
- Array.isArray(o.value || o.defaultValue) ? (o.value || o.defaultValue || []).map((c, l) => /* @__PURE__ */ r(
30
+ Array.isArray(o.value || o.defaultValue) ? (o.value || o.defaultValue || []).map((c, i) => /* @__PURE__ */ a(
31
31
  e.Thumb,
32
32
  {
33
- className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
33
+ className: "block h-4 w-4 rounded-full border border-brand/50 bg-canvas shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:pointer-events-none disabled:opacity-50",
34
34
  "data-component": "slider-thumb"
35
35
  },
36
- l
37
- )) : /* @__PURE__ */ r(
36
+ i
37
+ )) : /* @__PURE__ */ a(
38
38
  e.Thumb,
39
39
  {
40
- className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
40
+ className: "block h-4 w-4 rounded-full border border-brand/50 bg-canvas shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:pointer-events-none disabled:opacity-50",
41
41
  "data-component": "slider-thumb"
42
42
  }
43
43
  )
44
44
  ]
45
45
  }
46
46
  ));
47
- d.displayName = e.Root.displayName;
47
+ t.displayName = e.Root.displayName;
48
48
  export {
49
- d as Slider
49
+ t as Slider
50
50
  };
@@ -0,0 +1,86 @@
1
+ import * as React from "react";
2
+ export interface StatisticsCardItem {
3
+ label: string;
4
+ value: number;
5
+ borderColor: string;
6
+ checked?: boolean;
7
+ }
8
+ export interface StatisticsCardConfig {
9
+ colors?: {
10
+ background?: string;
11
+ text?: string;
12
+ border?: string;
13
+ outlineChecked?: string;
14
+ unchecked?: string;
15
+ tooltipBg?: string;
16
+ tooltipBorder?: string;
17
+ };
18
+ spacing?: {
19
+ rootWidth?: string;
20
+ rootPadding?: string;
21
+ rootGap?: string;
22
+ legendWidth?: string;
23
+ itemPadding?: string;
24
+ itemGap?: string;
25
+ };
26
+ }
27
+ interface StatisticsCardRootProps<T = StatisticsCardItem> extends React.HTMLAttributes<HTMLDivElement> {
28
+ items: T[];
29
+ onItemToggle?: (index: number, checked: boolean) => void;
30
+ chartSize?: number;
31
+ config?: StatisticsCardConfig;
32
+ mapItem?: (item: T, index: number) => StatisticsCardItem;
33
+ }
34
+ declare const StatisticsCardRoot: React.ForwardRefExoticComponent<StatisticsCardRootProps<StatisticsCardItem> & React.RefAttributes<HTMLDivElement>>;
35
+ declare const StatisticsCardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
36
+ interface StatisticsCardTitleProps extends React.HTMLAttributes<HTMLDivElement> {
37
+ }
38
+ declare const StatisticsCardTitle: React.ForwardRefExoticComponent<StatisticsCardTitleProps & React.RefAttributes<HTMLDivElement>>;
39
+ interface StatisticsCardTitleIconProps extends React.HTMLAttributes<HTMLDivElement> {
40
+ icon: React.ReactNode;
41
+ className?: string;
42
+ }
43
+ declare const StatisticsCardTitleIcon: React.ForwardRefExoticComponent<StatisticsCardTitleIconProps & React.RefAttributes<HTMLDivElement>>;
44
+ interface StatisticsCardTitleTextProps extends React.HTMLAttributes<HTMLSpanElement> {
45
+ }
46
+ declare const StatisticsCardTitleText: React.ForwardRefExoticComponent<StatisticsCardTitleTextProps & React.RefAttributes<HTMLSpanElement>>;
47
+ interface StatisticsCardTitleTooltipProps extends React.HTMLAttributes<HTMLDivElement> {
48
+ content: string;
49
+ icon?: React.ReactNode;
50
+ }
51
+ declare const StatisticsCardTitleTooltip: React.ForwardRefExoticComponent<StatisticsCardTitleTooltipProps & React.RefAttributes<HTMLDivElement>>;
52
+ export interface StatisticsCardChartConfig {
53
+ type?: "pie" | "donut";
54
+ name?: string;
55
+ innerSize?: string | number;
56
+ uncheckedColor?: string;
57
+ borderColor?: string;
58
+ borderWidth?: number;
59
+ borderRadius?: number;
60
+ enableHover?: boolean;
61
+ enableClick?: boolean;
62
+ }
63
+ interface StatisticsCardChartProps extends React.HTMLAttributes<HTMLDivElement> {
64
+ centerLabel?: string;
65
+ chartConfig?: StatisticsCardChartConfig;
66
+ chartSize?: number;
67
+ className?: string;
68
+ }
69
+ declare const StatisticsCardChart: React.ForwardRefExoticComponent<StatisticsCardChartProps & React.RefAttributes<HTMLDivElement>>;
70
+ declare const StatisticsCardLegend: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
71
+ interface StatisticsCardLegendItemProps extends React.HTMLAttributes<HTMLDivElement> {
72
+ index?: number;
73
+ item?: StatisticsCardItem;
74
+ }
75
+ declare const StatisticsCardLegendItem: React.ForwardRefExoticComponent<StatisticsCardLegendItemProps & React.RefAttributes<HTMLDivElement>>;
76
+ interface StatisticsCardSummaryProps extends React.HTMLAttributes<HTMLDivElement> {
77
+ }
78
+ declare const StatisticsCardSummary: React.ForwardRefExoticComponent<StatisticsCardSummaryProps & React.RefAttributes<HTMLDivElement>>;
79
+ interface StatisticsCardSummaryItemProps extends React.HTMLAttributes<HTMLDivElement> {
80
+ label: string;
81
+ count: number | string | React.ReactNode;
82
+ color?: string;
83
+ }
84
+ declare const StatisticsCardSummaryItem: React.ForwardRefExoticComponent<StatisticsCardSummaryItemProps & React.RefAttributes<HTMLDivElement>>;
85
+ export { StatisticsCardRoot, StatisticsCardHeader, StatisticsCardTitle, StatisticsCardTitleIcon, StatisticsCardTitleText, StatisticsCardTitleTooltip, StatisticsCardChart, StatisticsCardLegend, StatisticsCardLegendItem, StatisticsCardSummary, StatisticsCardSummaryItem, };
86
+ export type { StatisticsCardRootProps, StatisticsCardTitleProps, StatisticsCardTitleIconProps, StatisticsCardTitleTextProps, StatisticsCardTitleTooltipProps, StatisticsCardChartProps, StatisticsCardLegendItemProps, StatisticsCardSummaryProps, StatisticsCardSummaryItemProps };
@@ -0,0 +1,150 @@
1
+ import { StatisticsCardItem, StatisticsCardChartConfig } from './statistics-card';
2
+ /**
3
+ * Hook: useStatisticsChartData
4
+ * Extracts calculation logic for chart data
5
+ *
6
+ * Calculates:
7
+ * - Total sum of all items
8
+ * - Sum of checked items
9
+ * - Whether any items are checked
10
+ */
11
+ export declare const useStatisticsChartData: (items: StatisticsCardItem[]) => {
12
+ total: number;
13
+ checkedTotal: number;
14
+ hasChecked: boolean;
15
+ };
16
+ /**
17
+ * Hook: useStatisticsChartSeries
18
+ * Extracts chart series generation logic
19
+ *
20
+ * Generates pie chart data with:
21
+ * - Item labels and values
22
+ * - Dynamic coloring based on checked state
23
+ * - Faded color (same color, lower opacity) for unchecked items when some are checked
24
+ */
25
+ export declare const useStatisticsChartSeries: (items: StatisticsCardItem[], hasChecked: boolean) => {
26
+ type: "pie";
27
+ name: string;
28
+ innerSize: string;
29
+ data: {
30
+ name: string;
31
+ y: number;
32
+ color: string;
33
+ }[];
34
+ }[];
35
+ /**
36
+ * Hook: useStatisticsChartLabel
37
+ * Extracts chart center label logic
38
+ *
39
+ * Returns:
40
+ * - Custom label if provided
41
+ * - Checked total if any items are checked
42
+ * - Total otherwise
43
+ */
44
+ export declare const useStatisticsChartLabel: (centerLabel: string | undefined, hasChecked: boolean, checkedTotal: number, total: number) => string;
45
+ /**
46
+ * Hook: useStatisticsChartTooltip
47
+ * Extracts tooltip configuration logic
48
+ *
49
+ * Returns tooltip options for Highcharts with:
50
+ * - Custom HTML formatting
51
+ * - Color indicators
52
+ * - Proper styling
53
+ */
54
+ export declare const useStatisticsChartTooltip: () => {
55
+ enabled: boolean;
56
+ useHTML: boolean;
57
+ outside: boolean;
58
+ backgroundColor: string;
59
+ borderWidth: number;
60
+ borderRadius: number;
61
+ shadow: boolean;
62
+ style: {
63
+ fontFamily: string;
64
+ fontSize: string;
65
+ };
66
+ formatter: () => string;
67
+ };
68
+ /**
69
+ * Hook: useStatisticsChartPlotOptions
70
+ * Extracts chart plot options configuration
71
+ *
72
+ * Returns pie chart options with:
73
+ * - Border and styling (customizable via chartConfig)
74
+ * - Hover effects (customizable)
75
+ * - Click event handling for slice interaction (customizable)
76
+ */
77
+ export declare const useStatisticsChartPlotOptions: (items: StatisticsCardItem[], onItemToggle?: (index: number, checked: boolean) => void, chartConfig?: StatisticsCardChartConfig) => {
78
+ pie: {
79
+ borderWidth: number;
80
+ borderColor: string;
81
+ borderRadius: number;
82
+ dataLabels: {
83
+ enabled: boolean;
84
+ };
85
+ showInLegend: boolean;
86
+ states: {
87
+ hover: {
88
+ enabled: boolean;
89
+ brightness: number;
90
+ };
91
+ };
92
+ point: {
93
+ events: {
94
+ click: (this: any) => void;
95
+ };
96
+ };
97
+ };
98
+ };
99
+ /**
100
+ * Hook: useStatisticsChartOptions
101
+ * Master hook that combines all chart configuration
102
+ *
103
+ * Returns complete Highcharts options object with:
104
+ * - Chart spacing and margins
105
+ * - Tooltip configuration
106
+ * - Plot options with click handling
107
+ * - Customizable chart behavior
108
+ */
109
+ export declare const useStatisticsChartOptions: (items: StatisticsCardItem[], onItemToggle?: (index: number, checked: boolean) => void, chartConfig?: StatisticsCardChartConfig) => {
110
+ chart: {
111
+ margin: number[];
112
+ spacing: number[];
113
+ };
114
+ tooltip: {
115
+ enabled: boolean;
116
+ useHTML: boolean;
117
+ outside: boolean;
118
+ backgroundColor: string;
119
+ borderWidth: number;
120
+ borderRadius: number;
121
+ shadow: boolean;
122
+ style: {
123
+ fontFamily: string;
124
+ fontSize: string;
125
+ };
126
+ formatter: () => string;
127
+ };
128
+ plotOptions: {
129
+ pie: {
130
+ borderWidth: number;
131
+ borderColor: string;
132
+ borderRadius: number;
133
+ dataLabels: {
134
+ enabled: boolean;
135
+ };
136
+ showInLegend: boolean;
137
+ states: {
138
+ hover: {
139
+ enabled: boolean;
140
+ brightness: number;
141
+ };
142
+ };
143
+ point: {
144
+ events: {
145
+ click: (this: any) => void;
146
+ };
147
+ };
148
+ };
149
+ };
150
+ };
@@ -0,0 +1,100 @@
1
+ import * as a from "react";
2
+ const f = (e) => {
3
+ const s = a.useMemo(
4
+ () => e.reduce((o, n) => o + n.value, 0),
5
+ [e]
6
+ ), t = a.useMemo(
7
+ () => e.reduce((o, n) => o + (n.checked ? n.value : 0), 0),
8
+ [e]
9
+ ), r = e.some((o) => o.checked);
10
+ return { total: s, checkedTotal: t, hasChecked: r };
11
+ }, p = (e, s = 0.4) => {
12
+ const t = e.replace("#", ""), r = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), n = parseInt(t.substring(4, 6), 16);
13
+ return `rgba(${r}, ${o}, ${n}, ${s})`;
14
+ }, x = (e, s) => a.useMemo(
15
+ () => [
16
+ {
17
+ type: "pie",
18
+ name: "Statistics",
19
+ innerSize: "72%",
20
+ data: e.map((t) => ({
21
+ name: t.label,
22
+ y: t.value,
23
+ color: s ? t.checked ? t.borderColor : p(t.borderColor, 0.4) : t.borderColor
24
+ }))
25
+ }
26
+ ],
27
+ [e, s]
28
+ ), y = (e, s, t, r) => a.useMemo(
29
+ () => e ?? String(s ? t : r),
30
+ [e, s, t, r]
31
+ ), b = () => a.useMemo(
32
+ () => ({
33
+ enabled: !0,
34
+ useHTML: !0,
35
+ outside: !0,
36
+ backgroundColor: "#FFFFFF",
37
+ borderWidth: 0,
38
+ borderRadius: 8,
39
+ shadow: !0,
40
+ style: {
41
+ fontFamily: "Manrope, sans-serif",
42
+ fontSize: "12px"
43
+ },
44
+ formatter: function() {
45
+ const e = this;
46
+ return `<div style="display:flex;align-items:center;gap:6px;padding:4px 8px;">
47
+ <span style="width:8px;height:8px;border-radius:50%;background:${e.color ?? "#000"};flex-shrink:0;display:inline-block;"></span>
48
+ <span style="color:#0D152C;font-weight:500;white-space:nowrap;">${e.key ?? e.name}</span>
49
+ <span style="color:#1F2B4D;font-weight:700;margin-left:4px;">${e.y}</span>
50
+ </div>`;
51
+ }
52
+ }),
53
+ []
54
+ ), h = (e, s, t) => {
55
+ const r = t?.borderWidth ?? 2, o = t?.borderColor ?? "#F8F9FB", n = t?.borderRadius ?? 4, i = t?.enableHover ?? !0, l = t?.enableClick ?? !0;
56
+ return a.useMemo(
57
+ () => ({
58
+ pie: {
59
+ borderWidth: r,
60
+ borderColor: o,
61
+ borderRadius: n,
62
+ dataLabels: { enabled: !1 },
63
+ showInLegend: !1,
64
+ states: { hover: { enabled: i, brightness: 0.05 } },
65
+ // Handle slice click to toggle corresponding legend item
66
+ point: {
67
+ events: {
68
+ click: function() {
69
+ if (!l) return;
70
+ const u = this.name, c = e.findIndex((d) => d.label === u);
71
+ c !== -1 && s && s(c, !e[c].checked);
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }),
77
+ [e, s, r, o, n, i, l]
78
+ );
79
+ }, g = (e, s, t) => {
80
+ const r = b(), o = h(e, s, t);
81
+ return a.useMemo(
82
+ () => ({
83
+ chart: {
84
+ margin: [0, 0, 0, 0],
85
+ spacing: [0, 0, 0, 0]
86
+ },
87
+ tooltip: r,
88
+ plotOptions: o
89
+ }),
90
+ [r, o]
91
+ );
92
+ };
93
+ export {
94
+ f as useStatisticsChartData,
95
+ y as useStatisticsChartLabel,
96
+ g as useStatisticsChartOptions,
97
+ h as useStatisticsChartPlotOptions,
98
+ x as useStatisticsChartSeries,
99
+ b as useStatisticsChartTooltip
100
+ };
@@ -0,0 +1,259 @@
1
+ import { jsxs as h, jsx as r } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { cn as d } from "../../lib/utils.js";
4
+ import { Checkbox as T } from "./checkbox.js";
5
+ import { Tooltip as R, TooltipTrigger as I, TooltipContent as D } from "./tooltip.js";
6
+ import { Info as B } from "../../icons/index.js";
7
+ import * as P from "highcharts";
8
+ import j from "highcharts-react-official";
9
+ import { useStatisticsChartData as L, useStatisticsChartLabel as G, useStatisticsChartSeries as O, useStatisticsChartOptions as W } from "./statistics-card.hooks.js";
10
+ const N = n.createContext(null), y = () => {
11
+ const e = n.useContext(N);
12
+ if (!e)
13
+ throw new Error("StatisticsCard.* components must be used within a StatisticsCardRoot");
14
+ return e;
15
+ }, $ = n.forwardRef(
16
+ ({ className: e, items: t, onItemToggle: s, chartSize: a = 110, config: o, mapItem: l, children: m, ...c }, i) => {
17
+ const p = n.useMemo(
18
+ () => l ? t.map((v, k) => l(v, k)) : t,
19
+ [t, l]
20
+ ), f = "#f8f9fb", x = "px-5 py-4", u = "gap-4 md:gap-6 lg:gap-8", w = "w-full min-w-0 max-w-[439px]", g = o?.colors?.background || f, b = o?.spacing?.rootPadding || x, S = o?.spacing?.rootGap || u, C = o?.spacing?.rootWidth || w;
21
+ return /* @__PURE__ */ r(N.Provider, { value: { items: p, onItemToggle: s, chartSize: a, config: o }, children: /* @__PURE__ */ r(
22
+ "div",
23
+ {
24
+ ref: i,
25
+ role: "region",
26
+ "aria-roledescription": "statistics card",
27
+ "data-component": "statistics-card",
28
+ className: d(
29
+ "flex flex-row flex-wrap md:flex-nowrap items-center justify-between rounded-lg box-border min-w-0 overflow-hidden",
30
+ C,
31
+ b,
32
+ S,
33
+ e
34
+ ),
35
+ style: {
36
+ backgroundColor: g
37
+ },
38
+ ...c,
39
+ children: m
40
+ }
41
+ ) });
42
+ }
43
+ );
44
+ $.displayName = "StatisticsCardRoot";
45
+ const E = n.forwardRef(({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
46
+ "div",
47
+ {
48
+ ref: a,
49
+ className: d("flex flex-col items-start gap-4 flex-shrink-0 min-w-0", e),
50
+ ...s,
51
+ children: t
52
+ }
53
+ ));
54
+ E.displayName = "StatisticsCardHeader";
55
+ const F = n.forwardRef(
56
+ ({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
57
+ "div",
58
+ {
59
+ ref: a,
60
+ className: d("flex flex-row items-center gap-1.5 min-w-0 max-w-[150px]", e),
61
+ ...s,
62
+ children: t
63
+ }
64
+ )
65
+ );
66
+ F.displayName = "StatisticsCardTitle";
67
+ const H = n.forwardRef(
68
+ ({ icon: e, className: t, ...s }, a) => /* @__PURE__ */ r(
69
+ "div",
70
+ {
71
+ ref: a,
72
+ className: d("flex items-center justify-center w-6 h-6 p-1.5 bg-[#ECEEFD] rounded-full shrink-0", t),
73
+ ...s,
74
+ children: e
75
+ }
76
+ )
77
+ );
78
+ H.displayName = "StatisticsCardTitleIcon";
79
+ const M = n.forwardRef(
80
+ ({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
81
+ "span",
82
+ {
83
+ ref: a,
84
+ className: d("font-semibold text-base leading-[1.5em] text-[#777980] truncate line-clamp-1", e),
85
+ ...s,
86
+ children: t
87
+ }
88
+ )
89
+ );
90
+ M.displayName = "StatisticsCardTitleText";
91
+ const q = n.forwardRef(
92
+ ({ content: e, icon: t, ...s }, a) => /* @__PURE__ */ r("div", { ref: a, ...s, children: /* @__PURE__ */ h(R, { children: [
93
+ /* @__PURE__ */ r(I, { asChild: !0, children: t || /* @__PURE__ */ r(B, { size: "sm", className: "text-[#60697D] cursor-pointer shrink-0" }) }),
94
+ /* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: e })
95
+ ] }) })
96
+ );
97
+ q.displayName = "StatisticsCardTitleTooltip";
98
+ const A = n.forwardRef(
99
+ ({ className: e, centerLabel: t, chartConfig: s, chartSize: a = 104, ...o }, l) => {
100
+ const { items: m, onItemToggle: c } = y(), { total: i, checkedTotal: p, hasChecked: f } = L(m), x = G(t, f, p, i), u = O(m, f), g = {
101
+ ...W(m, c, s),
102
+ chart: {
103
+ type: "pie",
104
+ height: a,
105
+ width: a,
106
+ margin: [0, 0, 0, 0],
107
+ spacing: [0, 0, 0, 0],
108
+ backgroundColor: "transparent"
109
+ },
110
+ title: { text: "" },
111
+ credits: { enabled: !1 },
112
+ exporting: { enabled: !1 },
113
+ navigation: { buttonOptions: { enabled: !1 } },
114
+ series: u
115
+ };
116
+ return /* @__PURE__ */ h(
117
+ "div",
118
+ {
119
+ ref: l,
120
+ className: d("relative flex items-center justify-center flex-shrink-0", e),
121
+ style: { width: `${a}px`, height: `${a}px` },
122
+ ...o,
123
+ children: [
124
+ /* @__PURE__ */ r(
125
+ j,
126
+ {
127
+ highcharts: P,
128
+ options: g,
129
+ containerProps: { style: { width: "100%", height: "100%" } }
130
+ }
131
+ ),
132
+ x && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ r("span", { className: "font-black text-[12px] leading-[9.536px] text-[#1F2B4D]", children: x }) })
133
+ ]
134
+ }
135
+ );
136
+ }
137
+ );
138
+ A.displayName = "StatisticsCardChart";
139
+ const J = n.forwardRef(({ className: e, children: t, ...s }, a) => {
140
+ const { config: o } = y(), l = "w-full md:w-auto md:min-w-[190px] md:max-w-[208px]", m = "gap-2", c = o?.spacing?.legendWidth || l, i = o?.spacing?.itemGap || m;
141
+ return /* @__PURE__ */ r(
142
+ "div",
143
+ {
144
+ ref: a,
145
+ role: "list",
146
+ className: d(
147
+ "flex flex-col justify-center min-w-0 flex-1 md:flex-none",
148
+ c,
149
+ i,
150
+ e
151
+ ),
152
+ ...s,
153
+ children: t
154
+ }
155
+ );
156
+ });
157
+ J.displayName = "StatisticsCardLegend";
158
+ const K = n.forwardRef(
159
+ ({ className: e, index: t, item: s, ...a }, o) => {
160
+ const { items: l, onItemToggle: m, config: c } = y();
161
+ let i = s, p = -1;
162
+ if (!i && t !== void 0 ? (i = l[t], p = t) : i && (p = l.findIndex((C) => C === i)), !i || p === -1) return null;
163
+ const f = "bg-white", x = "px-3 py-1.5", u = "#E7CDF9", w = "#0D152C", g = c?.colors?.background || f, b = c?.spacing?.itemPadding || x;
164
+ c?.colors?.outlineChecked;
165
+ const S = c?.colors?.text || w;
166
+ return /* @__PURE__ */ h(
167
+ "div",
168
+ {
169
+ ref: o,
170
+ role: "listitem",
171
+ "aria-label": `${i.label}: ${i.value}`,
172
+ className: d(
173
+ "flex flex-row items-center gap-2 rounded-md border-l-2 transition-all",
174
+ g,
175
+ b,
176
+ e
177
+ ),
178
+ style: {
179
+ borderLeftColor: i.borderColor,
180
+ boxShadow: i.checked ? `0 0 0 2px ${i.borderColor}` : "0px 0px 4px 0px rgba(0,0,0,0.12)",
181
+ "--item-color": i.borderColor
182
+ },
183
+ ...a,
184
+ children: [
185
+ /* @__PURE__ */ h("div", { className: "flex flex-row items-center gap-2 flex-1 min-w-0", children: [
186
+ /* @__PURE__ */ r(
187
+ T,
188
+ {
189
+ checked: i.checked ?? !1,
190
+ onCheckedChange: (C) => m?.(p, C === !0),
191
+ "aria-label": `Select ${i.label}`,
192
+ className: "shrink-0"
193
+ }
194
+ ),
195
+ /* @__PURE__ */ r("span", { className: "flex-1 font-medium text-xs leading-[1.25em] truncate", style: { color: S }, children: i.label })
196
+ ] }),
197
+ /* @__PURE__ */ r(
198
+ "span",
199
+ {
200
+ className: "shrink-0 font-semibold text-sm leading-[1.5em] text-right min-w-[27px] text-[#1F2B4D]",
201
+ children: i.value
202
+ }
203
+ )
204
+ ]
205
+ }
206
+ );
207
+ }
208
+ );
209
+ K.displayName = "StatisticsCardLegendItem";
210
+ const Q = n.forwardRef(
211
+ ({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
212
+ "div",
213
+ {
214
+ ref: a,
215
+ className: d("flex flex-wrap items-center gap-3 self-center text-[11px] font-medium text-[#60697D]", e),
216
+ ...s,
217
+ children: t
218
+ }
219
+ )
220
+ );
221
+ Q.displayName = "StatisticsCardSummary";
222
+ const U = n.forwardRef(
223
+ ({ className: e, label: t, count: s, color: a = "#60697D", ...o }, l) => /* @__PURE__ */ h(
224
+ "div",
225
+ {
226
+ ref: l,
227
+ className: d("flex items-center gap-1", e),
228
+ style: { "--summary-color": a },
229
+ ...o,
230
+ children: [
231
+ /* @__PURE__ */ r(
232
+ "span",
233
+ {
234
+ className: "w-1.5 h-1.5 rounded-full shrink-0 bg-[var(--summary-color)]"
235
+ }
236
+ ),
237
+ /* @__PURE__ */ h("span", { children: [
238
+ t,
239
+ ": ",
240
+ s
241
+ ] })
242
+ ]
243
+ }
244
+ )
245
+ );
246
+ U.displayName = "StatisticsCardSummaryItem";
247
+ export {
248
+ A as StatisticsCardChart,
249
+ E as StatisticsCardHeader,
250
+ J as StatisticsCardLegend,
251
+ K as StatisticsCardLegendItem,
252
+ $ as StatisticsCardRoot,
253
+ Q as StatisticsCardSummary,
254
+ U as StatisticsCardSummaryItem,
255
+ F as StatisticsCardTitle,
256
+ H as StatisticsCardTitleIcon,
257
+ M as StatisticsCardTitleText,
258
+ q as StatisticsCardTitleTooltip
259
+ };