@peak-ai/canvas 1.4.22 → 1.4.23-rc.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 (212) hide show
  1. package/helpers/filter-placeholder.js.map +1 -0
  2. package/package.json +6 -44
  3. package/plugins/helpers/render-components.js +15 -0
  4. package/plugins/helpers/render-components.js.map +1 -0
  5. package/.babelrc +0 -14
  6. package/.eslintcache +0 -1
  7. package/.eslintignore +0 -5
  8. package/.eslintrc.js +0 -29
  9. package/dist/helpers/filter-placeholder.js.map +0 -1
  10. package/dist/package.json +0 -62
  11. package/dist/plugins/helpers/render-components.js +0 -10
  12. package/dist/plugins/helpers/render-components.js.map +0 -1
  13. package/scripts/build.ts +0 -120
  14. package/src/GrapesjsCanvas.tsx +0 -494
  15. package/src/constants/index.ts +0 -25
  16. package/src/declaration.d.ts +0 -1
  17. package/src/helpers/compiled-table.css +0 -2429
  18. package/src/helpers/css.ts +0 -2667
  19. package/src/helpers/date-picker.ts +0 -807
  20. package/src/helpers/filter-placeholder.ts +0 -18
  21. package/src/helpers/index.ts +0 -13
  22. package/src/helpers/merge-json.ts +0 -106
  23. package/src/index.styles.ts +0 -58
  24. package/src/index.ts +0 -9
  25. package/src/plugins/grapejs-plugin.tsx +0 -196
  26. package/src/plugins/helpers/custom-modal.tsx +0 -123
  27. package/src/plugins/helpers/data-table.tsx +0 -300
  28. package/src/plugins/helpers/extra.tsx +0 -164
  29. package/src/plugins/helpers/query-cache-context.tsx +0 -154
  30. package/src/plugins/helpers/query-cache-singleton.ts +0 -176
  31. package/src/plugins/helpers/query-cache-utils.ts +0 -226
  32. package/src/plugins/helpers/query-details-modal.tsx +0 -400
  33. package/src/plugins/helpers/query-heading-formatter.ts +0 -24
  34. package/src/plugins/helpers/query-loading-modal.tsx +0 -94
  35. package/src/plugins/helpers/render-components.tsx +0 -1450
  36. package/src/plugins/helpers/styled-info-button.tsx +0 -504
  37. package/src/public/canvas.css +0 -42
  38. package/src/public/components-css/table/table-output.css +0 -2436
  39. package/src/public/components-css/table/table.css +0 -30
  40. package/src/public/output.css +0 -2465
  41. package/src/public/table.css +0 -135
  42. package/src/shadcn/components/icons/AiAvatarIcon.tsx +0 -47
  43. package/src/shadcn/components/icons/Co_driver Expanding button copy.svg +0 -21
  44. package/src/shadcn/components/icons/ai-avatar.svg +0 -7
  45. package/src/shadcn/components/icons/thinking.gif +0 -0
  46. package/src/shadcn/components/ui/button.tsx +0 -132
  47. package/src/shadcn/components/ui/card.tsx +0 -92
  48. package/src/shadcn/components/ui/chart.tsx +0 -324
  49. package/src/shadcn/components/ui/checkbox.tsx +0 -27
  50. package/src/shadcn/components/ui/component-wrapper.tsx +0 -61
  51. package/src/shadcn/components/ui/date-filter.tsx +0 -816
  52. package/src/shadcn/components/ui/error-container.tsx +0 -125
  53. package/src/shadcn/components/ui/error-wrapper.tsx +0 -99
  54. package/src/shadcn/components/ui/filter.tsx +0 -368
  55. package/src/shadcn/components/ui/hover-card.tsx +0 -36
  56. package/src/shadcn/components/ui/input.tsx +0 -20
  57. package/src/shadcn/components/ui/label.tsx +0 -24
  58. package/src/shadcn/components/ui/pagination.tsx +0 -213
  59. package/src/shadcn/components/ui/scroll-area.tsx +0 -59
  60. package/src/shadcn/components/ui/search.tsx +0 -150
  61. package/src/shadcn/components/ui/separator.tsx +0 -26
  62. package/src/shadcn/components/ui/skeleton.tsx +0 -69
  63. package/src/shadcn/components/ui/table.tsx +0 -196
  64. package/src/shadcn/components/ui/tabs.tsx +0 -55
  65. package/src/shadcn/components/ui/textarea.tsx +0 -18
  66. package/src/shadcn/components/ui/tooltip.tsx +0 -87
  67. package/src/shadcn/utils.ts +0 -6
  68. package/src/types/grapesjs-tailwind.d.ts +0 -61
  69. package/src/types/images.d.ts +0 -1
  70. package/tailwind.config.js +0 -5
  71. package/tooling/tailwind-compiler/index.js +0 -99
  72. package/tooling/tailwind-compiler/package.json +0 -11
  73. package/tooling/tailwind-compiler/yarn.lock +0 -123
  74. package/tsconfig.build.json +0 -15
  75. package/tsconfig.json +0 -8
  76. /package/{dist/GrapesjsCanvas.d.ts → GrapesjsCanvas.d.ts} +0 -0
  77. /package/{dist/GrapesjsCanvas.js → GrapesjsCanvas.js} +0 -0
  78. /package/{dist/GrapesjsCanvas.js.map → GrapesjsCanvas.js.map} +0 -0
  79. /package/{dist/constants → constants}/index.d.ts +0 -0
  80. /package/{dist/constants → constants}/index.js +0 -0
  81. /package/{dist/constants → constants}/index.js.map +0 -0
  82. /package/{dist/declaration.d.js → declaration.d.js} +0 -0
  83. /package/{dist/declaration.d.js.map → declaration.d.js.map} +0 -0
  84. /package/{dist/helpers → helpers}/compiled-table.css +0 -0
  85. /package/{dist/helpers → helpers}/css.d.ts +0 -0
  86. /package/{dist/helpers → helpers}/css.js +0 -0
  87. /package/{dist/helpers → helpers}/css.js.map +0 -0
  88. /package/{dist/helpers → helpers}/date-picker.d.ts +0 -0
  89. /package/{dist/helpers → helpers}/date-picker.js +0 -0
  90. /package/{dist/helpers → helpers}/date-picker.js.map +0 -0
  91. /package/{dist/helpers → helpers}/filter-placeholder.d.ts +0 -0
  92. /package/{dist/helpers → helpers}/filter-placeholder.js +0 -0
  93. /package/{dist/helpers → helpers}/index.d.ts +0 -0
  94. /package/{dist/helpers → helpers}/index.js +0 -0
  95. /package/{dist/helpers → helpers}/index.js.map +0 -0
  96. /package/{dist/helpers → helpers}/merge-json.d.ts +0 -0
  97. /package/{dist/helpers → helpers}/merge-json.js +0 -0
  98. /package/{dist/helpers → helpers}/merge-json.js.map +0 -0
  99. /package/{dist/index.d.ts → index.d.ts} +0 -0
  100. /package/{dist/index.js → index.js} +0 -0
  101. /package/{dist/index.js.map → index.js.map} +0 -0
  102. /package/{dist/index.styles.d.ts → index.styles.d.ts} +0 -0
  103. /package/{dist/index.styles.js → index.styles.js} +0 -0
  104. /package/{dist/index.styles.js.map → index.styles.js.map} +0 -0
  105. /package/{dist/plugins → plugins}/grapejs-plugin.d.ts +0 -0
  106. /package/{dist/plugins → plugins}/grapejs-plugin.js +0 -0
  107. /package/{dist/plugins → plugins}/grapejs-plugin.js.map +0 -0
  108. /package/{dist/plugins → plugins}/helpers/custom-modal.d.ts +0 -0
  109. /package/{dist/plugins → plugins}/helpers/custom-modal.js +0 -0
  110. /package/{dist/plugins → plugins}/helpers/custom-modal.js.map +0 -0
  111. /package/{dist/plugins → plugins}/helpers/data-table.d.ts +0 -0
  112. /package/{dist/plugins → plugins}/helpers/data-table.js +0 -0
  113. /package/{dist/plugins → plugins}/helpers/data-table.js.map +0 -0
  114. /package/{dist/plugins → plugins}/helpers/extra.d.ts +0 -0
  115. /package/{dist/plugins → plugins}/helpers/extra.js +0 -0
  116. /package/{dist/plugins → plugins}/helpers/extra.js.map +0 -0
  117. /package/{dist/plugins → plugins}/helpers/query-cache-context.d.ts +0 -0
  118. /package/{dist/plugins → plugins}/helpers/query-cache-context.js +0 -0
  119. /package/{dist/plugins → plugins}/helpers/query-cache-context.js.map +0 -0
  120. /package/{dist/plugins → plugins}/helpers/query-cache-singleton.d.ts +0 -0
  121. /package/{dist/plugins → plugins}/helpers/query-cache-singleton.js +0 -0
  122. /package/{dist/plugins → plugins}/helpers/query-cache-singleton.js.map +0 -0
  123. /package/{dist/plugins → plugins}/helpers/query-cache-utils.d.ts +0 -0
  124. /package/{dist/plugins → plugins}/helpers/query-cache-utils.js +0 -0
  125. /package/{dist/plugins → plugins}/helpers/query-cache-utils.js.map +0 -0
  126. /package/{dist/plugins → plugins}/helpers/query-details-modal.d.ts +0 -0
  127. /package/{dist/plugins → plugins}/helpers/query-details-modal.js +0 -0
  128. /package/{dist/plugins → plugins}/helpers/query-details-modal.js.map +0 -0
  129. /package/{dist/plugins → plugins}/helpers/query-heading-formatter.d.ts +0 -0
  130. /package/{dist/plugins → plugins}/helpers/query-heading-formatter.js +0 -0
  131. /package/{dist/plugins → plugins}/helpers/query-heading-formatter.js.map +0 -0
  132. /package/{dist/plugins → plugins}/helpers/query-loading-modal.d.ts +0 -0
  133. /package/{dist/plugins → plugins}/helpers/query-loading-modal.js +0 -0
  134. /package/{dist/plugins → plugins}/helpers/query-loading-modal.js.map +0 -0
  135. /package/{dist/plugins → plugins}/helpers/render-components.d.ts +0 -0
  136. /package/{dist/plugins → plugins}/helpers/styled-info-button.d.ts +0 -0
  137. /package/{dist/plugins → plugins}/helpers/styled-info-button.js +0 -0
  138. /package/{dist/plugins → plugins}/helpers/styled-info-button.js.map +0 -0
  139. /package/{dist/shadcn → shadcn}/components/icons/AiAvatarIcon.d.ts +0 -0
  140. /package/{dist/shadcn → shadcn}/components/icons/AiAvatarIcon.js +0 -0
  141. /package/{dist/shadcn → shadcn}/components/icons/AiAvatarIcon.js.map +0 -0
  142. /package/{dist/shadcn → shadcn}/components/icons/thinking.gif +0 -0
  143. /package/{dist/shadcn → shadcn}/components/ui/button.d.ts +0 -0
  144. /package/{dist/shadcn → shadcn}/components/ui/button.js +0 -0
  145. /package/{dist/shadcn → shadcn}/components/ui/button.js.map +0 -0
  146. /package/{dist/shadcn → shadcn}/components/ui/card.d.ts +0 -0
  147. /package/{dist/shadcn → shadcn}/components/ui/card.js +0 -0
  148. /package/{dist/shadcn → shadcn}/components/ui/card.js.map +0 -0
  149. /package/{dist/shadcn → shadcn}/components/ui/chart.d.ts +0 -0
  150. /package/{dist/shadcn → shadcn}/components/ui/chart.js +0 -0
  151. /package/{dist/shadcn → shadcn}/components/ui/chart.js.map +0 -0
  152. /package/{dist/shadcn → shadcn}/components/ui/checkbox.d.ts +0 -0
  153. /package/{dist/shadcn → shadcn}/components/ui/checkbox.js +0 -0
  154. /package/{dist/shadcn → shadcn}/components/ui/checkbox.js.map +0 -0
  155. /package/{dist/shadcn → shadcn}/components/ui/component-wrapper.d.ts +0 -0
  156. /package/{dist/shadcn → shadcn}/components/ui/component-wrapper.js +0 -0
  157. /package/{dist/shadcn → shadcn}/components/ui/component-wrapper.js.map +0 -0
  158. /package/{dist/shadcn → shadcn}/components/ui/date-filter.d.ts +0 -0
  159. /package/{dist/shadcn → shadcn}/components/ui/date-filter.js +0 -0
  160. /package/{dist/shadcn → shadcn}/components/ui/date-filter.js.map +0 -0
  161. /package/{dist/shadcn → shadcn}/components/ui/error-container.d.ts +0 -0
  162. /package/{dist/shadcn → shadcn}/components/ui/error-container.js +0 -0
  163. /package/{dist/shadcn → shadcn}/components/ui/error-container.js.map +0 -0
  164. /package/{dist/shadcn → shadcn}/components/ui/error-wrapper.d.ts +0 -0
  165. /package/{dist/shadcn → shadcn}/components/ui/error-wrapper.js +0 -0
  166. /package/{dist/shadcn → shadcn}/components/ui/error-wrapper.js.map +0 -0
  167. /package/{dist/shadcn → shadcn}/components/ui/filter.d.ts +0 -0
  168. /package/{dist/shadcn → shadcn}/components/ui/filter.js +0 -0
  169. /package/{dist/shadcn → shadcn}/components/ui/filter.js.map +0 -0
  170. /package/{dist/shadcn → shadcn}/components/ui/hover-card.d.ts +0 -0
  171. /package/{dist/shadcn → shadcn}/components/ui/hover-card.js +0 -0
  172. /package/{dist/shadcn → shadcn}/components/ui/hover-card.js.map +0 -0
  173. /package/{dist/shadcn → shadcn}/components/ui/input.d.ts +0 -0
  174. /package/{dist/shadcn → shadcn}/components/ui/input.js +0 -0
  175. /package/{dist/shadcn → shadcn}/components/ui/input.js.map +0 -0
  176. /package/{dist/shadcn → shadcn}/components/ui/label.d.ts +0 -0
  177. /package/{dist/shadcn → shadcn}/components/ui/label.js +0 -0
  178. /package/{dist/shadcn → shadcn}/components/ui/label.js.map +0 -0
  179. /package/{dist/shadcn → shadcn}/components/ui/pagination.d.ts +0 -0
  180. /package/{dist/shadcn → shadcn}/components/ui/pagination.js +0 -0
  181. /package/{dist/shadcn → shadcn}/components/ui/pagination.js.map +0 -0
  182. /package/{dist/shadcn → shadcn}/components/ui/scroll-area.d.ts +0 -0
  183. /package/{dist/shadcn → shadcn}/components/ui/scroll-area.js +0 -0
  184. /package/{dist/shadcn → shadcn}/components/ui/scroll-area.js.map +0 -0
  185. /package/{dist/shadcn → shadcn}/components/ui/search.d.ts +0 -0
  186. /package/{dist/shadcn → shadcn}/components/ui/search.js +0 -0
  187. /package/{dist/shadcn → shadcn}/components/ui/search.js.map +0 -0
  188. /package/{dist/shadcn → shadcn}/components/ui/separator.d.ts +0 -0
  189. /package/{dist/shadcn → shadcn}/components/ui/separator.js +0 -0
  190. /package/{dist/shadcn → shadcn}/components/ui/separator.js.map +0 -0
  191. /package/{dist/shadcn → shadcn}/components/ui/skeleton.d.ts +0 -0
  192. /package/{dist/shadcn → shadcn}/components/ui/skeleton.js +0 -0
  193. /package/{dist/shadcn → shadcn}/components/ui/skeleton.js.map +0 -0
  194. /package/{dist/shadcn → shadcn}/components/ui/table.d.ts +0 -0
  195. /package/{dist/shadcn → shadcn}/components/ui/table.js +0 -0
  196. /package/{dist/shadcn → shadcn}/components/ui/table.js.map +0 -0
  197. /package/{dist/shadcn → shadcn}/components/ui/tabs.d.ts +0 -0
  198. /package/{dist/shadcn → shadcn}/components/ui/tabs.js +0 -0
  199. /package/{dist/shadcn → shadcn}/components/ui/tabs.js.map +0 -0
  200. /package/{dist/shadcn → shadcn}/components/ui/textarea.d.ts +0 -0
  201. /package/{dist/shadcn → shadcn}/components/ui/textarea.js +0 -0
  202. /package/{dist/shadcn → shadcn}/components/ui/textarea.js.map +0 -0
  203. /package/{dist/shadcn → shadcn}/components/ui/tooltip.d.ts +0 -0
  204. /package/{dist/shadcn → shadcn}/components/ui/tooltip.js +0 -0
  205. /package/{dist/shadcn → shadcn}/components/ui/tooltip.js.map +0 -0
  206. /package/{dist/shadcn → shadcn}/utils.d.ts +0 -0
  207. /package/{dist/shadcn → shadcn}/utils.js +0 -0
  208. /package/{dist/shadcn → shadcn}/utils.js.map +0 -0
  209. /package/{dist/types → types}/grapesjs-tailwind.d.js +0 -0
  210. /package/{dist/types → types}/grapesjs-tailwind.d.js.map +0 -0
  211. /package/{dist/types → types}/images.d.js +0 -0
  212. /package/{dist/types → types}/images.d.js.map +0 -0
@@ -1,324 +0,0 @@
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
- };
@@ -1,27 +0,0 @@
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 };
@@ -1,61 +0,0 @@
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
- `;