@campxdev/react-blueprint 3.0.0-alpha.8 → 3.0.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 (43) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/types/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.d.ts +3 -1
  3. package/dist/cjs/types/src/components/Charts/TreeMap/TreeMap.d.ts +1 -2
  4. package/dist/cjs/types/src/components/DataDisplay/DataTable/components/TableHeaders/TableActionHeader.d.ts +2 -1
  5. package/dist/cjs/types/src/components/Input/MultiSelect/MultiSelect.d.ts +5 -1
  6. package/dist/cjs/types/src/components/Input/MultiSelect/components/MultiSelectInput.d.ts +1 -1
  7. package/dist/cjs/types/src/components/Input/SingleSelect/SingleSelect.d.ts +5 -1
  8. package/dist/cjs/types/src/components/Input/SingleSelect/components/SingleInput.d.ts +1 -1
  9. package/dist/cjs/types/src/components/Layout/AppLayout/AppLayout.d.ts +0 -1
  10. package/dist/cjs/types/src/shadcn-components/Charts/Chart.d.ts +8 -8
  11. package/dist/cjs/types/src/shadcn-components/Input/Command/Command.d.ts +1 -1
  12. package/dist/esm/index.js +2 -2
  13. package/dist/esm/types/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.d.ts +3 -1
  14. package/dist/esm/types/src/components/Charts/TreeMap/TreeMap.d.ts +1 -2
  15. package/dist/esm/types/src/components/DataDisplay/DataTable/components/TableHeaders/TableActionHeader.d.ts +2 -1
  16. package/dist/esm/types/src/components/Input/MultiSelect/MultiSelect.d.ts +5 -1
  17. package/dist/esm/types/src/components/Input/MultiSelect/components/MultiSelectInput.d.ts +1 -1
  18. package/dist/esm/types/src/components/Input/SingleSelect/SingleSelect.d.ts +5 -1
  19. package/dist/esm/types/src/components/Input/SingleSelect/components/SingleInput.d.ts +1 -1
  20. package/dist/esm/types/src/components/Layout/AppLayout/AppLayout.d.ts +0 -1
  21. package/dist/esm/types/src/shadcn-components/Charts/Chart.d.ts +8 -8
  22. package/dist/esm/types/src/shadcn-components/Input/Command/Command.d.ts +1 -1
  23. package/dist/index.d.ts +63 -4
  24. package/dist/styles.css +6 -4
  25. package/package.json +1 -1
  26. package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +134 -19
  27. package/src/components/Charts/TreeMap/TreeMap.tsx +1 -3
  28. package/src/components/DataDisplay/DataTable/DataTable.tsx +1 -0
  29. package/src/components/DataDisplay/DataTable/components/CardsView.tsx +1 -1
  30. package/src/components/DataDisplay/DataTable/components/TableHeaders/TableActionHeader.tsx +23 -20
  31. package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
  32. package/src/components/Input/MultiSelect/MultiSelect.tsx +18 -8
  33. package/src/components/Input/MultiSelect/components/MultiSelectInput.tsx +2 -3
  34. package/src/components/Input/SingleSelect/SingleSelect.tsx +23 -12
  35. package/src/components/Input/SingleSelect/components/SingleInput.tsx +2 -1
  36. package/src/components/Layout/AppLayout/AppLayout.tsx +0 -4
  37. package/src/components/Layout/PageContent/PageContent.tsx +1 -1
  38. package/src/components/Navigation/Dialog/Dialog.tsx +2 -1
  39. package/src/components/Navigation/DialogButton/DialogButton.tsx +2 -1
  40. package/src/shadcn-components/Charts/Chart.tsx +106 -106
  41. package/src/shadcn-components/DataDisplay/Card/Card.tsx +1 -1
  42. package/src/shadcn-components/Input/Command/Command.tsx +5 -0
  43. package/src/shadcn-components/Input/Label/Label.tsx +1 -1
@@ -1,35 +1,35 @@
1
- import * as React from "react"
2
- import * as RechartsPrimitive from "recharts"
1
+ import * as React from 'react';
2
+ import * as RechartsPrimitive from 'recharts';
3
3
 
4
- import { cn } from "@/lib/utils"
4
+ import { cn } from '@/lib/utils';
5
5
 
6
6
  // Format: { THEME_NAME: CSS_SELECTOR }
7
- const THEMES = { light: "", dark: ".dark" } as const
7
+ const THEMES = { light: '', dark: '.dark' } as const;
8
8
 
9
9
  export type ChartConfig = {
10
10
  [k in string]: {
11
- label?: React.ReactNode
12
- icon?: React.ComponentType
11
+ label?: React.ReactNode;
12
+ icon?: React.ComponentType;
13
13
  } & (
14
14
  | { color?: string; theme?: never }
15
15
  | { color?: never; theme: Record<keyof typeof THEMES, string> }
16
- )
17
- }
16
+ );
17
+ };
18
18
 
19
19
  type ChartContextProps = {
20
- config: ChartConfig
21
- }
20
+ config: ChartConfig;
21
+ };
22
22
 
23
- const ChartContext = React.createContext<ChartContextProps | null>(null)
23
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
24
24
 
25
25
  function useChart() {
26
- const context = React.useContext(ChartContext)
26
+ const context = React.useContext(ChartContext);
27
27
 
28
28
  if (!context) {
29
- throw new Error("useChart must be used within a <ChartContainer />")
29
+ throw new Error('useChart must be used within a <ChartContainer />');
30
30
  }
31
31
 
32
- return context
32
+ return context;
33
33
  }
34
34
 
35
35
  function ChartContainer({
@@ -38,14 +38,14 @@ function ChartContainer({
38
38
  children,
39
39
  config,
40
40
  ...props
41
- }: React.ComponentProps<"div"> & {
42
- config: ChartConfig
41
+ }: React.ComponentProps<'div'> & {
42
+ config: ChartConfig;
43
43
  children: React.ComponentProps<
44
44
  typeof RechartsPrimitive.ResponsiveContainer
45
- >["children"]
45
+ >['children'];
46
46
  }) {
47
- const uniqueId = React.useId()
48
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
47
+ const uniqueId = React.useId();
48
+ const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
49
49
 
50
50
  return (
51
51
  <ChartContext.Provider value={{ config }}>
@@ -54,7 +54,7 @@ function ChartContainer({
54
54
  data-chart={chartId}
55
55
  className={cn(
56
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
57
+ className,
58
58
  )}
59
59
  {...props}
60
60
  >
@@ -64,16 +64,16 @@ function ChartContainer({
64
64
  </RechartsPrimitive.ResponsiveContainer>
65
65
  </div>
66
66
  </ChartContext.Provider>
67
- )
67
+ );
68
68
  }
69
69
 
70
70
  const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
71
71
  const colorConfig = Object.entries(config).filter(
72
- ([, config]) => config.theme || config.color
73
- )
72
+ ([, config]) => config.theme || config.color,
73
+ );
74
74
 
75
75
  if (!colorConfig.length) {
76
- return null
76
+ return null;
77
77
  }
78
78
 
79
79
  return (
@@ -87,26 +87,26 @@ ${colorConfig
87
87
  .map(([key, itemConfig]) => {
88
88
  const color =
89
89
  itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
90
- itemConfig.color
91
- return color ? ` --color-${key}: ${color};` : null
90
+ itemConfig.color;
91
+ return color ? ` --color-${key}: ${color};` : null;
92
92
  })
93
- .join("\n")}
93
+ .join('\n')}
94
94
  }
95
- `
95
+ `,
96
96
  )
97
- .join("\n"),
97
+ .join('\n'),
98
98
  }}
99
99
  />
100
- )
101
- }
100
+ );
101
+ };
102
102
 
103
- const ChartTooltip = RechartsPrimitive.Tooltip
103
+ const ChartTooltip = RechartsPrimitive.Tooltip;
104
104
 
105
105
  function ChartTooltipContent({
106
106
  active,
107
107
  payload,
108
108
  className,
109
- indicator = "dot",
109
+ indicator = 'dot',
110
110
  hideLabel = false,
111
111
  hideIndicator = false,
112
112
  label,
@@ -117,41 +117,41 @@ function ChartTooltipContent({
117
117
  nameKey,
118
118
  labelKey,
119
119
  }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
120
- React.ComponentProps<"div"> & {
121
- hideLabel?: boolean
122
- hideIndicator?: boolean
123
- indicator?: "line" | "dot" | "dashed"
124
- nameKey?: string
125
- labelKey?: string
120
+ React.ComponentProps<'div'> & {
121
+ hideLabel?: boolean;
122
+ hideIndicator?: boolean;
123
+ indicator?: 'line' | 'dot' | 'dashed';
124
+ nameKey?: string;
125
+ labelKey?: string;
126
126
  }) {
127
- const { config } = useChart()
127
+ const { config } = useChart();
128
128
 
129
129
  const tooltipLabel = React.useMemo(() => {
130
130
  if (hideLabel || !payload?.length) {
131
- return null
131
+ return null;
132
132
  }
133
133
 
134
- const [item] = payload
135
- const key = `${labelKey || item?.dataKey || item?.name || "value"}`
136
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
134
+ const [item] = payload;
135
+ const key = `${item?.name || labelKey || item?.dataKey || 'value'}`;
136
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
137
137
  const value =
138
- !labelKey && typeof label === "string"
138
+ !labelKey && typeof label === 'string'
139
139
  ? config[label as keyof typeof config]?.label || label
140
- : itemConfig?.label
140
+ : itemConfig?.label;
141
141
 
142
142
  if (labelFormatter) {
143
143
  return (
144
- <div className={cn("font-medium", labelClassName)}>
144
+ <div className={cn('font-medium', labelClassName)}>
145
145
  {labelFormatter(value, payload)}
146
146
  </div>
147
- )
147
+ );
148
148
  }
149
149
 
150
150
  if (!value) {
151
- return null
151
+ return null;
152
152
  }
153
153
 
154
- return <div className={cn("font-medium", labelClassName)}>{value}</div>
154
+ return <div className={cn('font-medium', labelClassName)}>{value}</div>;
155
155
  }, [
156
156
  label,
157
157
  labelFormatter,
@@ -160,36 +160,36 @@ function ChartTooltipContent({
160
160
  labelClassName,
161
161
  config,
162
162
  labelKey,
163
- ])
163
+ ]);
164
164
 
165
165
  if (!active || !payload?.length) {
166
- return null
166
+ return null;
167
167
  }
168
168
 
169
- const nestLabel = payload.length === 1 && indicator !== "dot"
169
+ const nestLabel = payload.length === 1 && indicator !== 'dot';
170
170
 
171
171
  return (
172
172
  <div
173
173
  className={cn(
174
- "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
175
- className
174
+ 'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
175
+ className,
176
176
  )}
177
177
  >
178
178
  {!nestLabel ? tooltipLabel : null}
179
179
  <div className="grid gap-1.5">
180
180
  {payload
181
- .filter((item) => item.type !== "none")
181
+ .filter((item) => item.type !== 'none')
182
182
  .map((item, index) => {
183
- const key = `${nameKey || item.name || item.dataKey || "value"}`
184
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
185
- const indicatorColor = color || item.payload.fill || item.color
183
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`;
184
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
185
+ const indicatorColor = color || item.payload.fill || item.color;
186
186
 
187
187
  return (
188
188
  <div
189
189
  key={item.dataKey}
190
190
  className={cn(
191
- "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
192
- indicator === "dot" && "items-center"
191
+ '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
192
+ indicator === 'dot' && 'items-center',
193
193
  )}
194
194
  >
195
195
  {formatter && item?.value !== undefined && item.name ? (
@@ -202,19 +202,19 @@ function ChartTooltipContent({
202
202
  !hideIndicator && (
203
203
  <div
204
204
  className={cn(
205
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
205
+ 'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
206
206
  {
207
- "h-2.5 w-2.5": indicator === "dot",
208
- "w-1": indicator === "line",
209
- "w-0 border-[1.5px] border-dashed bg-transparent":
210
- indicator === "dashed",
211
- "my-0.5": nestLabel && indicator === "dashed",
212
- }
207
+ 'h-2.5 w-2.5': indicator === 'dot',
208
+ 'w-1': indicator === 'line',
209
+ 'w-0 border-[1.5px] border-dashed bg-transparent':
210
+ indicator === 'dashed',
211
+ 'my-0.5': nestLabel && indicator === 'dashed',
212
+ },
213
213
  )}
214
214
  style={
215
215
  {
216
- "--color-bg": indicatorColor,
217
- "--color-border": indicatorColor,
216
+ '--color-bg': indicatorColor,
217
+ '--color-border': indicatorColor,
218
218
  } as React.CSSProperties
219
219
  }
220
220
  />
@@ -222,8 +222,8 @@ function ChartTooltipContent({
222
222
  )}
223
223
  <div
224
224
  className={cn(
225
- "flex flex-1 justify-between leading-none",
226
- nestLabel ? "items-end" : "items-center"
225
+ 'flex flex-1 justify-between leading-none',
226
+ nestLabel ? 'items-end' : 'items-center',
227
227
  )}
228
228
  >
229
229
  <div className="grid gap-1.5">
@@ -241,51 +241,51 @@ function ChartTooltipContent({
241
241
  </>
242
242
  )}
243
243
  </div>
244
- )
244
+ );
245
245
  })}
246
246
  </div>
247
247
  </div>
248
- )
248
+ );
249
249
  }
250
250
 
251
- const ChartLegend = RechartsPrimitive.Legend
251
+ const ChartLegend = RechartsPrimitive.Legend;
252
252
 
253
253
  function ChartLegendContent({
254
254
  className,
255
255
  hideIcon = false,
256
256
  payload,
257
- verticalAlign = "bottom",
257
+ verticalAlign = 'bottom',
258
258
  nameKey,
259
- }: React.ComponentProps<"div"> &
260
- Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
261
- hideIcon?: boolean
262
- nameKey?: string
259
+ }: React.ComponentProps<'div'> &
260
+ Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
261
+ hideIcon?: boolean;
262
+ nameKey?: string;
263
263
  }) {
264
- const { config } = useChart()
264
+ const { config } = useChart();
265
265
 
266
266
  if (!payload?.length) {
267
- return null
267
+ return null;
268
268
  }
269
269
 
270
270
  return (
271
271
  <div
272
272
  className={cn(
273
- "flex flex-wrap items-center justify-center gap-4",
274
- verticalAlign === "top" ? "pb-3" : "pt-3",
275
- className
273
+ 'flex flex-wrap items-center justify-center gap-4',
274
+ verticalAlign === 'top' ? 'pb-3' : 'pt-3',
275
+ className,
276
276
  )}
277
277
  >
278
278
  {payload
279
- .filter((item) => item.type !== "none")
279
+ .filter((item) => item.type !== 'none')
280
280
  .map((item) => {
281
- const key = `${nameKey || item.dataKey || "value"}`
282
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
281
+ const key = `${nameKey || item.dataKey || 'value'}`;
282
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
283
283
 
284
284
  return (
285
285
  <div
286
286
  key={item.value}
287
287
  className={cn(
288
- "[&>svg]:text-muted-foreground flex items-center gap-1.5 whitespace-nowrap [&>svg]:h-3 [&>svg]:w-3"
288
+ '[&>svg]:text-muted-foreground flex items-center gap-1.5 whitespace-nowrap [&>svg]:h-3 [&>svg]:w-3',
289
289
  )}
290
290
  >
291
291
  {itemConfig?.icon && !hideIcon ? (
@@ -300,56 +300,56 @@ function ChartLegendContent({
300
300
  )}
301
301
  {itemConfig?.label}
302
302
  </div>
303
- )
303
+ );
304
304
  })}
305
305
  </div>
306
- )
306
+ );
307
307
  }
308
308
 
309
309
  // Helper to extract item config from a payload.
310
310
  function getPayloadConfigFromPayload(
311
311
  config: ChartConfig,
312
312
  payload: unknown,
313
- key: string
313
+ key: string,
314
314
  ) {
315
- if (typeof payload !== "object" || payload === null) {
316
- return undefined
315
+ if (typeof payload !== 'object' || payload === null) {
316
+ return undefined;
317
317
  }
318
318
 
319
319
  const payloadPayload =
320
- "payload" in payload &&
321
- typeof payload.payload === "object" &&
320
+ 'payload' in payload &&
321
+ typeof payload.payload === 'object' &&
322
322
  payload.payload !== null
323
323
  ? payload.payload
324
- : undefined
324
+ : undefined;
325
325
 
326
- let configLabelKey: string = key
326
+ let configLabelKey: string = key;
327
327
 
328
328
  if (
329
329
  key in payload &&
330
- typeof payload[key as keyof typeof payload] === "string"
330
+ typeof payload[key as keyof typeof payload] === 'string'
331
331
  ) {
332
- configLabelKey = payload[key as keyof typeof payload] as string
332
+ configLabelKey = payload[key as keyof typeof payload] as string;
333
333
  } else if (
334
334
  payloadPayload &&
335
335
  key in payloadPayload &&
336
- typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
336
+ typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
337
337
  ) {
338
338
  configLabelKey = payloadPayload[
339
339
  key as keyof typeof payloadPayload
340
- ] as string
340
+ ] as string;
341
341
  }
342
342
 
343
343
  return configLabelKey in config
344
344
  ? config[configLabelKey]
345
- : config[key as keyof typeof config]
345
+ : config[key as keyof typeof config];
346
346
  }
347
347
 
348
348
  export {
349
349
  ChartContainer,
350
- ChartTooltip,
351
- ChartTooltipContent,
352
350
  ChartLegend,
353
351
  ChartLegendContent,
354
352
  ChartStyle,
355
- }
353
+ ChartTooltip,
354
+ ChartTooltipContent,
355
+ };
@@ -7,7 +7,7 @@ function Card({ className, ...props }: React.ComponentProps<'div'>) {
7
7
  <div
8
8
  data-slot="card"
9
9
  className={cn(
10
- 'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
10
+ 'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 ',
11
11
  className,
12
12
  )}
13
13
  {...props}
@@ -82,11 +82,16 @@ function CommandInput({
82
82
 
83
83
  function CommandList({
84
84
  className,
85
+ onWheel,
85
86
  ...props
86
87
  }: React.ComponentProps<typeof CommandPrimitive.List>) {
87
88
  return (
88
89
  <CommandPrimitive.List
89
90
  data-slot="command-list"
91
+ onWheel={(e) => {
92
+ e.stopPropagation();
93
+ onWheel?.(e);
94
+ }}
90
95
  className={cn(
91
96
  'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto',
92
97
  className,
@@ -11,7 +11,7 @@ function Label({
11
11
  <LabelPrimitive.Root
12
12
  data-slot="label"
13
13
  className={cn(
14
- 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
14
+ 'flex items-center text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
15
15
  className,
16
16
  )}
17
17
  {...props}