@peak-ai/canvas 1.4.23 → 1.4.24

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 (209) hide show
  1. package/.babelrc +14 -0
  2. package/.eslintcache +1 -0
  3. package/.eslintignore +5 -0
  4. package/.eslintrc.js +29 -0
  5. package/dist/package.json +62 -0
  6. package/package.json +45 -7
  7. package/scripts/build.ts +120 -0
  8. package/src/GrapesjsCanvas.tsx +494 -0
  9. package/src/constants/index.ts +25 -0
  10. package/src/declaration.d.ts +1 -0
  11. package/src/helpers/compiled-table.css +2429 -0
  12. package/src/helpers/css.ts +2667 -0
  13. package/src/helpers/date-picker.ts +807 -0
  14. package/src/helpers/filter-placeholder.ts +18 -0
  15. package/src/helpers/index.ts +13 -0
  16. package/src/helpers/merge-json.ts +106 -0
  17. package/src/index.styles.ts +58 -0
  18. package/src/index.ts +9 -0
  19. package/src/plugins/grapejs-plugin.tsx +196 -0
  20. package/src/plugins/helpers/custom-modal.tsx +123 -0
  21. package/src/plugins/helpers/data-table.tsx +300 -0
  22. package/src/plugins/helpers/extra.tsx +164 -0
  23. package/src/plugins/helpers/query-cache-context.tsx +154 -0
  24. package/src/plugins/helpers/query-cache-singleton.ts +176 -0
  25. package/src/plugins/helpers/query-cache-utils.ts +226 -0
  26. package/src/plugins/helpers/query-details-modal.tsx +400 -0
  27. package/src/plugins/helpers/query-heading-formatter.ts +24 -0
  28. package/src/plugins/helpers/query-loading-modal.tsx +94 -0
  29. package/src/plugins/helpers/render-components.tsx +1450 -0
  30. package/src/plugins/helpers/styled-info-button.tsx +504 -0
  31. package/src/public/canvas.css +42 -0
  32. package/src/public/components-css/table/table-output.css +2436 -0
  33. package/src/public/components-css/table/table.css +30 -0
  34. package/src/public/output.css +2465 -0
  35. package/src/public/table.css +135 -0
  36. package/src/shadcn/components/icons/AiAvatarIcon.tsx +47 -0
  37. package/src/shadcn/components/icons/Co_driver Expanding button copy.svg +21 -0
  38. package/src/shadcn/components/icons/ai-avatar.svg +7 -0
  39. package/src/shadcn/components/icons/thinking.gif +0 -0
  40. package/src/shadcn/components/ui/button.tsx +132 -0
  41. package/src/shadcn/components/ui/card.tsx +92 -0
  42. package/src/shadcn/components/ui/chart.tsx +324 -0
  43. package/src/shadcn/components/ui/checkbox.tsx +27 -0
  44. package/src/shadcn/components/ui/component-wrapper.tsx +61 -0
  45. package/src/shadcn/components/ui/date-filter.tsx +816 -0
  46. package/src/shadcn/components/ui/error-container.tsx +125 -0
  47. package/src/shadcn/components/ui/error-wrapper.tsx +99 -0
  48. package/src/shadcn/components/ui/filter.tsx +368 -0
  49. package/src/shadcn/components/ui/hover-card.tsx +36 -0
  50. package/src/shadcn/components/ui/input.tsx +20 -0
  51. package/src/shadcn/components/ui/label.tsx +24 -0
  52. package/src/shadcn/components/ui/pagination.tsx +213 -0
  53. package/src/shadcn/components/ui/scroll-area.tsx +59 -0
  54. package/src/shadcn/components/ui/search.tsx +150 -0
  55. package/src/shadcn/components/ui/separator.tsx +26 -0
  56. package/src/shadcn/components/ui/skeleton.tsx +69 -0
  57. package/src/shadcn/components/ui/table.tsx +196 -0
  58. package/src/shadcn/components/ui/tabs.tsx +55 -0
  59. package/src/shadcn/components/ui/textarea.tsx +18 -0
  60. package/src/shadcn/components/ui/tooltip.tsx +87 -0
  61. package/src/shadcn/utils.ts +6 -0
  62. package/src/types/grapesjs-tailwind.d.ts +61 -0
  63. package/src/types/images.d.ts +1 -0
  64. package/tailwind.config.js +5 -0
  65. package/tooling/tailwind-compiler/index.js +99 -0
  66. package/tooling/tailwind-compiler/package.json +11 -0
  67. package/tooling/tailwind-compiler/yarn.lock +123 -0
  68. package/tsconfig.build.json +15 -0
  69. package/tsconfig.json +8 -0
  70. /package/{GrapesjsCanvas.d.ts → dist/GrapesjsCanvas.d.ts} +0 -0
  71. /package/{GrapesjsCanvas.js → dist/GrapesjsCanvas.js} +0 -0
  72. /package/{GrapesjsCanvas.js.map → dist/GrapesjsCanvas.js.map} +0 -0
  73. /package/{constants → dist/constants}/index.d.ts +0 -0
  74. /package/{constants → dist/constants}/index.js +0 -0
  75. /package/{constants → dist/constants}/index.js.map +0 -0
  76. /package/{declaration.d.js → dist/declaration.d.js} +0 -0
  77. /package/{declaration.d.js.map → dist/declaration.d.js.map} +0 -0
  78. /package/{helpers → dist/helpers}/compiled-table.css +0 -0
  79. /package/{helpers → dist/helpers}/css.d.ts +0 -0
  80. /package/{helpers → dist/helpers}/css.js +0 -0
  81. /package/{helpers → dist/helpers}/css.js.map +0 -0
  82. /package/{helpers → dist/helpers}/date-picker.d.ts +0 -0
  83. /package/{helpers → dist/helpers}/date-picker.js +0 -0
  84. /package/{helpers → dist/helpers}/date-picker.js.map +0 -0
  85. /package/{helpers → dist/helpers}/filter-placeholder.d.ts +0 -0
  86. /package/{helpers → dist/helpers}/filter-placeholder.js +0 -0
  87. /package/{helpers → dist/helpers}/filter-placeholder.js.map +0 -0
  88. /package/{helpers → dist/helpers}/index.d.ts +0 -0
  89. /package/{helpers → dist/helpers}/index.js +0 -0
  90. /package/{helpers → dist/helpers}/index.js.map +0 -0
  91. /package/{helpers → dist/helpers}/merge-json.d.ts +0 -0
  92. /package/{helpers → dist/helpers}/merge-json.js +0 -0
  93. /package/{helpers → dist/helpers}/merge-json.js.map +0 -0
  94. /package/{index.d.ts → dist/index.d.ts} +0 -0
  95. /package/{index.js → dist/index.js} +0 -0
  96. /package/{index.js.map → dist/index.js.map} +0 -0
  97. /package/{index.styles.d.ts → dist/index.styles.d.ts} +0 -0
  98. /package/{index.styles.js → dist/index.styles.js} +0 -0
  99. /package/{index.styles.js.map → dist/index.styles.js.map} +0 -0
  100. /package/{plugins → dist/plugins}/grapejs-plugin.d.ts +0 -0
  101. /package/{plugins → dist/plugins}/grapejs-plugin.js +0 -0
  102. /package/{plugins → dist/plugins}/grapejs-plugin.js.map +0 -0
  103. /package/{plugins → dist/plugins}/helpers/custom-modal.d.ts +0 -0
  104. /package/{plugins → dist/plugins}/helpers/custom-modal.js +0 -0
  105. /package/{plugins → dist/plugins}/helpers/custom-modal.js.map +0 -0
  106. /package/{plugins → dist/plugins}/helpers/data-table.d.ts +0 -0
  107. /package/{plugins → dist/plugins}/helpers/data-table.js +0 -0
  108. /package/{plugins → dist/plugins}/helpers/data-table.js.map +0 -0
  109. /package/{plugins → dist/plugins}/helpers/extra.d.ts +0 -0
  110. /package/{plugins → dist/plugins}/helpers/extra.js +0 -0
  111. /package/{plugins → dist/plugins}/helpers/extra.js.map +0 -0
  112. /package/{plugins → dist/plugins}/helpers/query-cache-context.d.ts +0 -0
  113. /package/{plugins → dist/plugins}/helpers/query-cache-context.js +0 -0
  114. /package/{plugins → dist/plugins}/helpers/query-cache-context.js.map +0 -0
  115. /package/{plugins → dist/plugins}/helpers/query-cache-singleton.d.ts +0 -0
  116. /package/{plugins → dist/plugins}/helpers/query-cache-singleton.js +0 -0
  117. /package/{plugins → dist/plugins}/helpers/query-cache-singleton.js.map +0 -0
  118. /package/{plugins → dist/plugins}/helpers/query-cache-utils.d.ts +0 -0
  119. /package/{plugins → dist/plugins}/helpers/query-cache-utils.js +0 -0
  120. /package/{plugins → dist/plugins}/helpers/query-cache-utils.js.map +0 -0
  121. /package/{plugins → dist/plugins}/helpers/query-details-modal.d.ts +0 -0
  122. /package/{plugins → dist/plugins}/helpers/query-details-modal.js +0 -0
  123. /package/{plugins → dist/plugins}/helpers/query-details-modal.js.map +0 -0
  124. /package/{plugins → dist/plugins}/helpers/query-heading-formatter.d.ts +0 -0
  125. /package/{plugins → dist/plugins}/helpers/query-heading-formatter.js +0 -0
  126. /package/{plugins → dist/plugins}/helpers/query-heading-formatter.js.map +0 -0
  127. /package/{plugins → dist/plugins}/helpers/query-loading-modal.d.ts +0 -0
  128. /package/{plugins → dist/plugins}/helpers/query-loading-modal.js +0 -0
  129. /package/{plugins → dist/plugins}/helpers/query-loading-modal.js.map +0 -0
  130. /package/{plugins → dist/plugins}/helpers/render-components.d.ts +0 -0
  131. /package/{plugins → dist/plugins}/helpers/render-components.js +0 -0
  132. /package/{plugins → dist/plugins}/helpers/render-components.js.map +0 -0
  133. /package/{plugins → dist/plugins}/helpers/styled-info-button.d.ts +0 -0
  134. /package/{plugins → dist/plugins}/helpers/styled-info-button.js +0 -0
  135. /package/{plugins → dist/plugins}/helpers/styled-info-button.js.map +0 -0
  136. /package/{shadcn → dist/shadcn}/components/icons/AiAvatarIcon.d.ts +0 -0
  137. /package/{shadcn → dist/shadcn}/components/icons/AiAvatarIcon.js +0 -0
  138. /package/{shadcn → dist/shadcn}/components/icons/AiAvatarIcon.js.map +0 -0
  139. /package/{shadcn → dist/shadcn}/components/icons/thinking.gif +0 -0
  140. /package/{shadcn → dist/shadcn}/components/ui/button.d.ts +0 -0
  141. /package/{shadcn → dist/shadcn}/components/ui/button.js +0 -0
  142. /package/{shadcn → dist/shadcn}/components/ui/button.js.map +0 -0
  143. /package/{shadcn → dist/shadcn}/components/ui/card.d.ts +0 -0
  144. /package/{shadcn → dist/shadcn}/components/ui/card.js +0 -0
  145. /package/{shadcn → dist/shadcn}/components/ui/card.js.map +0 -0
  146. /package/{shadcn → dist/shadcn}/components/ui/chart.d.ts +0 -0
  147. /package/{shadcn → dist/shadcn}/components/ui/chart.js +0 -0
  148. /package/{shadcn → dist/shadcn}/components/ui/chart.js.map +0 -0
  149. /package/{shadcn → dist/shadcn}/components/ui/checkbox.d.ts +0 -0
  150. /package/{shadcn → dist/shadcn}/components/ui/checkbox.js +0 -0
  151. /package/{shadcn → dist/shadcn}/components/ui/checkbox.js.map +0 -0
  152. /package/{shadcn → dist/shadcn}/components/ui/component-wrapper.d.ts +0 -0
  153. /package/{shadcn → dist/shadcn}/components/ui/component-wrapper.js +0 -0
  154. /package/{shadcn → dist/shadcn}/components/ui/component-wrapper.js.map +0 -0
  155. /package/{shadcn → dist/shadcn}/components/ui/date-filter.d.ts +0 -0
  156. /package/{shadcn → dist/shadcn}/components/ui/date-filter.js +0 -0
  157. /package/{shadcn → dist/shadcn}/components/ui/date-filter.js.map +0 -0
  158. /package/{shadcn → dist/shadcn}/components/ui/error-container.d.ts +0 -0
  159. /package/{shadcn → dist/shadcn}/components/ui/error-container.js +0 -0
  160. /package/{shadcn → dist/shadcn}/components/ui/error-container.js.map +0 -0
  161. /package/{shadcn → dist/shadcn}/components/ui/error-wrapper.d.ts +0 -0
  162. /package/{shadcn → dist/shadcn}/components/ui/error-wrapper.js +0 -0
  163. /package/{shadcn → dist/shadcn}/components/ui/error-wrapper.js.map +0 -0
  164. /package/{shadcn → dist/shadcn}/components/ui/filter.d.ts +0 -0
  165. /package/{shadcn → dist/shadcn}/components/ui/filter.js +0 -0
  166. /package/{shadcn → dist/shadcn}/components/ui/filter.js.map +0 -0
  167. /package/{shadcn → dist/shadcn}/components/ui/hover-card.d.ts +0 -0
  168. /package/{shadcn → dist/shadcn}/components/ui/hover-card.js +0 -0
  169. /package/{shadcn → dist/shadcn}/components/ui/hover-card.js.map +0 -0
  170. /package/{shadcn → dist/shadcn}/components/ui/input.d.ts +0 -0
  171. /package/{shadcn → dist/shadcn}/components/ui/input.js +0 -0
  172. /package/{shadcn → dist/shadcn}/components/ui/input.js.map +0 -0
  173. /package/{shadcn → dist/shadcn}/components/ui/label.d.ts +0 -0
  174. /package/{shadcn → dist/shadcn}/components/ui/label.js +0 -0
  175. /package/{shadcn → dist/shadcn}/components/ui/label.js.map +0 -0
  176. /package/{shadcn → dist/shadcn}/components/ui/pagination.d.ts +0 -0
  177. /package/{shadcn → dist/shadcn}/components/ui/pagination.js +0 -0
  178. /package/{shadcn → dist/shadcn}/components/ui/pagination.js.map +0 -0
  179. /package/{shadcn → dist/shadcn}/components/ui/scroll-area.d.ts +0 -0
  180. /package/{shadcn → dist/shadcn}/components/ui/scroll-area.js +0 -0
  181. /package/{shadcn → dist/shadcn}/components/ui/scroll-area.js.map +0 -0
  182. /package/{shadcn → dist/shadcn}/components/ui/search.d.ts +0 -0
  183. /package/{shadcn → dist/shadcn}/components/ui/search.js +0 -0
  184. /package/{shadcn → dist/shadcn}/components/ui/search.js.map +0 -0
  185. /package/{shadcn → dist/shadcn}/components/ui/separator.d.ts +0 -0
  186. /package/{shadcn → dist/shadcn}/components/ui/separator.js +0 -0
  187. /package/{shadcn → dist/shadcn}/components/ui/separator.js.map +0 -0
  188. /package/{shadcn → dist/shadcn}/components/ui/skeleton.d.ts +0 -0
  189. /package/{shadcn → dist/shadcn}/components/ui/skeleton.js +0 -0
  190. /package/{shadcn → dist/shadcn}/components/ui/skeleton.js.map +0 -0
  191. /package/{shadcn → dist/shadcn}/components/ui/table.d.ts +0 -0
  192. /package/{shadcn → dist/shadcn}/components/ui/table.js +0 -0
  193. /package/{shadcn → dist/shadcn}/components/ui/table.js.map +0 -0
  194. /package/{shadcn → dist/shadcn}/components/ui/tabs.d.ts +0 -0
  195. /package/{shadcn → dist/shadcn}/components/ui/tabs.js +0 -0
  196. /package/{shadcn → dist/shadcn}/components/ui/tabs.js.map +0 -0
  197. /package/{shadcn → dist/shadcn}/components/ui/textarea.d.ts +0 -0
  198. /package/{shadcn → dist/shadcn}/components/ui/textarea.js +0 -0
  199. /package/{shadcn → dist/shadcn}/components/ui/textarea.js.map +0 -0
  200. /package/{shadcn → dist/shadcn}/components/ui/tooltip.d.ts +0 -0
  201. /package/{shadcn → dist/shadcn}/components/ui/tooltip.js +0 -0
  202. /package/{shadcn → dist/shadcn}/components/ui/tooltip.js.map +0 -0
  203. /package/{shadcn → dist/shadcn}/utils.d.ts +0 -0
  204. /package/{shadcn → dist/shadcn}/utils.js +0 -0
  205. /package/{shadcn → dist/shadcn}/utils.js.map +0 -0
  206. /package/{types → dist/types}/grapesjs-tailwind.d.js +0 -0
  207. /package/{types → dist/types}/grapesjs-tailwind.d.js.map +0 -0
  208. /package/{types → dist/types}/images.d.js +0 -0
  209. /package/{types → dist/types}/images.d.js.map +0 -0
@@ -0,0 +1,324 @@
1
+ import * as React from 'react';
2
+ import * as RechartsPrimitive from 'recharts';
3
+
4
+ import { cn } from '../../utils';
5
+
6
+ // Format: { THEME_NAME: CSS_SELECTOR }
7
+ const THEMES = { light: '', dark: '.dark' } as const;
8
+
9
+ export type ChartConfig = {
10
+ [k in string]: {
11
+ label?: React.ReactNode;
12
+ icon?: React.ComponentType;
13
+ } & (
14
+ | { color?: string; theme?: never }
15
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
16
+ );
17
+ };
18
+
19
+ type ChartContextProps = {
20
+ config: ChartConfig;
21
+ };
22
+
23
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
24
+
25
+ function useChart() {
26
+ const context = React.useContext(ChartContext);
27
+
28
+ if (!context) {
29
+ throw new Error('useChart must be used within a <ChartContainer />');
30
+ }
31
+
32
+ return context;
33
+ }
34
+
35
+ function ChartContainer({
36
+ id,
37
+ className,
38
+ children,
39
+ config,
40
+ isEditable,
41
+ ...props
42
+ }: React.ComponentProps<'div'> & {
43
+ config: ChartConfig;
44
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
45
+ isEditable?: boolean;
46
+ }) {
47
+ const uniqueId = id || `id-${Math.random().toString(36).substring(2, 9)}`;
48
+ const chartId = `chart-${uniqueId}`;
49
+
50
+ return (
51
+ <ChartContext.Provider value={{ config }}>
52
+ <div
53
+ data-slot="chart"
54
+ data-chart={chartId}
55
+ className={cn(
56
+ "[&_.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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
57
+ className,
58
+ )}
59
+ contentEditable={isEditable}
60
+ {...props}
61
+ >
62
+ <ChartStyle id={chartId} config={config} />
63
+ <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
64
+ </div>
65
+ </ChartContext.Provider>
66
+ );
67
+ }
68
+
69
+ function ChartStyle({ id, config }: { id: string; config: ChartConfig }) {
70
+ const colorConfig = Object.entries(config).filter(([, conf]) => conf.theme || conf.color);
71
+
72
+ if (!colorConfig.length) {
73
+ return null;
74
+ }
75
+
76
+ return (
77
+ <style
78
+ dangerouslySetInnerHTML={{
79
+ __html: Object.entries(THEMES)
80
+ .map(
81
+ ([theme, prefix]) => `
82
+ ${prefix} [data-chart=${id}] {
83
+ ${colorConfig
84
+ .map(([key, itemConfig]) => {
85
+ const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
86
+
87
+ return color ? ` --color-${key}: ${color};` : null;
88
+ })
89
+ .join('\n')}
90
+ }
91
+ `,
92
+ )
93
+ .join('\n'),
94
+ }}
95
+ />
96
+ );
97
+ }
98
+
99
+ const ChartTooltip = RechartsPrimitive.Tooltip;
100
+
101
+ function ChartTooltipContent({
102
+ active,
103
+ payload,
104
+ className,
105
+ indicator = 'dot',
106
+ hideLabel = false,
107
+ hideIndicator = false,
108
+ label,
109
+ labelFormatter,
110
+ labelClassName,
111
+ formatter,
112
+ color,
113
+ nameKey,
114
+ labelKey,
115
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
116
+ React.ComponentProps<'div'> & {
117
+ hideLabel?: boolean;
118
+ hideIndicator?: boolean;
119
+ indicator?: 'line' | 'dot' | 'dashed';
120
+ nameKey?: string;
121
+ labelKey?: string;
122
+ }) {
123
+ const { config } = useChart();
124
+
125
+ const tooltipLabel = React.useMemo(() => {
126
+ if (hideLabel || !payload?.length) {
127
+ return null;
128
+ }
129
+
130
+ const [item] = payload;
131
+ const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
132
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
133
+ const value =
134
+ !labelKey && typeof label === 'string'
135
+ ? config[label as keyof typeof config]?.label || label
136
+ : itemConfig?.label;
137
+
138
+ if (labelFormatter) {
139
+ return (
140
+ <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>
141
+ );
142
+ }
143
+
144
+ if (!value) {
145
+ return null;
146
+ }
147
+
148
+ return <div className={cn('font-medium', labelClassName)}>{value}</div>;
149
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
150
+
151
+ if (!active || !payload?.length) {
152
+ return null;
153
+ }
154
+
155
+ const nestLabel = payload.length === 1 && indicator !== 'dot';
156
+
157
+ return (
158
+ <div
159
+ className={cn(
160
+ 'border-border/50 bg-white grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
161
+ className,
162
+ )}
163
+ >
164
+ {!nestLabel ? tooltipLabel : null}
165
+ <div className="grid gap-1.5">
166
+ {payload.map((item, index) => {
167
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`;
168
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
169
+ const indicatorColor = color || item.payload.fill || item.color;
170
+
171
+ return (
172
+ <div
173
+ key={`${item.dataKey}-${index}`}
174
+ className={cn(
175
+ '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
176
+ indicator === 'dot' && 'items-center',
177
+ )}
178
+ >
179
+ {formatter && item?.value !== undefined && item.name ? (
180
+ formatter(item.value, item.name, item, index, item.payload)
181
+ ) : (
182
+ <React.Fragment>
183
+ {itemConfig?.icon ? (
184
+ <itemConfig.icon />
185
+ ) : (
186
+ !hideIndicator && (
187
+ <div
188
+ className={cn(
189
+ 'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
190
+ {
191
+ 'h-2.5 w-2.5': indicator === 'dot',
192
+ 'w-1': indicator === 'line',
193
+ 'w-0 border-[1.5px] border-dashed bg-transparent':
194
+ indicator === 'dashed',
195
+ 'my-0.5': nestLabel && indicator === 'dashed',
196
+ },
197
+ )}
198
+ style={
199
+ {
200
+ '--color-bg': indicatorColor,
201
+ '--color-border': indicatorColor,
202
+ } as React.CSSProperties
203
+ }
204
+ />
205
+ )
206
+ )}
207
+ <div
208
+ className={cn(
209
+ 'flex flex-1 justify-between leading-none',
210
+ nestLabel ? 'items-end' : 'items-center',
211
+ )}
212
+ >
213
+ <div className="grid gap-1.5">
214
+ {nestLabel ? tooltipLabel : null}
215
+ <span className="text-muted-foreground mr-2">
216
+ {itemConfig?.label || item.name}
217
+ </span>
218
+ </div>
219
+ {item.value && (
220
+ <span className="text-foreground font-mono font-medium tabular-nums">
221
+ {item.value.toLocaleString()}
222
+ </span>
223
+ )}
224
+ </div>
225
+ </React.Fragment>
226
+ )}
227
+ </div>
228
+ );
229
+ })}
230
+ </div>
231
+ </div>
232
+ );
233
+ }
234
+
235
+ const ChartLegend = RechartsPrimitive.Legend;
236
+
237
+ function ChartLegendContent({
238
+ className,
239
+ hideIcon = false,
240
+ payload,
241
+ verticalAlign = 'bottom',
242
+ nameKey,
243
+ }: React.ComponentProps<'div'> &
244
+ Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
245
+ hideIcon?: boolean;
246
+ nameKey?: string;
247
+ }) {
248
+ const { config } = useChart();
249
+
250
+ if (!payload?.length) {
251
+ return null;
252
+ }
253
+
254
+ return (
255
+ <div
256
+ className={cn(
257
+ 'flex items-center justify-center gap-4',
258
+ verticalAlign === 'top' ? 'pb-3' : 'pt-3',
259
+ className,
260
+ )}
261
+ >
262
+ {payload.map((item, index) => {
263
+ const key = `${nameKey || 'value'}`;
264
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
265
+
266
+ return (
267
+ <div
268
+ key={`${item.value}-${index}`}
269
+ className={cn(
270
+ '[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3',
271
+ )}
272
+ >
273
+ {itemConfig?.icon && !hideIcon ? (
274
+ <itemConfig.icon />
275
+ ) : (
276
+ <div
277
+ className="h-2 w-2 shrink-0 rounded-[2px]"
278
+ style={{
279
+ backgroundColor: item.color,
280
+ }}
281
+ />
282
+ )}
283
+ {itemConfig?.label}
284
+ </div>
285
+ );
286
+ })}
287
+ </div>
288
+ );
289
+ }
290
+
291
+ // Helper to extract item config from a payload.
292
+ function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
293
+ if (typeof payload !== 'object' || payload === null) {
294
+ return undefined;
295
+ }
296
+
297
+ const payloadPayload =
298
+ 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null
299
+ ? payload.payload
300
+ : undefined;
301
+
302
+ let configLabelKey: string = key;
303
+
304
+ if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {
305
+ configLabelKey = payload[key as keyof typeof payload] as string;
306
+ } else if (
307
+ payloadPayload &&
308
+ key in payloadPayload &&
309
+ typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
310
+ ) {
311
+ configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
312
+ }
313
+
314
+ return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
315
+ }
316
+
317
+ export {
318
+ ChartContainer,
319
+ ChartTooltip,
320
+ ChartTooltipContent,
321
+ ChartLegend,
322
+ ChartLegendContent,
323
+ ChartStyle,
324
+ };
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ import { CheckIcon } from 'lucide-react';
4
+
5
+ import { cn } from '../../utils';
6
+
7
+ function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
8
+ return (
9
+ <CheckboxPrimitive.Root
10
+ data-slot="checkbox"
11
+ className={cn(
12
+ 'peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
13
+ className,
14
+ )}
15
+ {...props}
16
+ >
17
+ <CheckboxPrimitive.Indicator
18
+ data-slot="checkbox-indicator"
19
+ className="flex items-center justify-center text-current transition-none"
20
+ >
21
+ <CheckIcon className="size-3.5" />
22
+ </CheckboxPrimitive.Indicator>
23
+ </CheckboxPrimitive.Root>
24
+ );
25
+ }
26
+
27
+ export { Checkbox };
@@ -0,0 +1,61 @@
1
+ import styled from 'styled-components';
2
+
3
+ type Size = 'small' | 'medium' | 'large';
4
+ type IssueType = 'error' | 'missing';
5
+
6
+ export const ComponentWrapper = styled.div<{ hasIssue: boolean; issueType: IssueType }>`
7
+ position: relative;
8
+ width: 100%;
9
+ height: 100%;
10
+ border-radius: 6px;
11
+ overflow: hidden;
12
+ `;
13
+
14
+ export const IssueBanner = styled.div<{ size: Size; issueType: IssueType }>`
15
+ background: #f8f9fa;
16
+ border: 1px solid #e9ecef;
17
+ border-radius: 4px;
18
+ color: #495057;
19
+ display: flex;
20
+ align-items: center;
21
+ gap: 8px;
22
+ font-weight: 500;
23
+ margin-bottom: 8px;
24
+ padding: 8px 12px;
25
+ font-size: 14px;
26
+ `;
27
+
28
+ export const IssueIcon = styled.div<{ size: Size }>`
29
+ font-size: 16px;
30
+ flex-shrink: 0;
31
+ `;
32
+
33
+ export const IssueContent = styled.div`
34
+ flex: 1;
35
+ min-width: 0;
36
+ `;
37
+
38
+ export const IssueMessage = styled.div<{ size: Size }>`
39
+ font-weight: 500;
40
+ line-height: 1.4;
41
+ `;
42
+
43
+ export const IssueType = styled.div<{ size: Size }>`
44
+ opacity: 0.9;
45
+ font-size: ${({ size }) => {
46
+ switch (size) {
47
+ case 'small': return '9px';
48
+ case 'medium': return '10px';
49
+ case 'large': return '11px';
50
+ default: return '10px';
51
+ }
52
+ }};
53
+ text-transform: uppercase;
54
+ letter-spacing: ${({ size }) => (size === 'small' ? '0.2px' : '0.3px')};
55
+ `;
56
+
57
+ export const ComponentContent = styled.div<{ hasIssue: boolean; issueType: IssueType; size: Size }>`
58
+ flex: 1;
59
+ display: flex;
60
+ flex-direction: column;
61
+ `;