@arolariu/components 0.3.1 → 0.4.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 (99) hide show
  1. package/EXAMPLES.md +1035 -1035
  2. package/changelog.md +9 -0
  3. package/dist/components/ui/accordion.js.map +1 -1
  4. package/dist/components/ui/alert-dialog.js.map +1 -1
  5. package/dist/components/ui/alert.js.map +1 -1
  6. package/dist/components/ui/aspect-ratio.js.map +1 -1
  7. package/dist/components/ui/avatar.js.map +1 -1
  8. package/dist/components/ui/background-beams.js.map +1 -1
  9. package/dist/components/ui/badge.js.map +1 -1
  10. package/dist/components/ui/breadcrumb.js.map +1 -1
  11. package/dist/components/ui/bubble-background.js.map +1 -1
  12. package/dist/components/ui/button-group.js.map +1 -1
  13. package/dist/components/ui/button.js.map +1 -1
  14. package/dist/components/ui/calendar.js.map +1 -1
  15. package/dist/components/ui/card.js.map +1 -1
  16. package/dist/components/ui/carousel.js.map +1 -1
  17. package/dist/components/ui/chart.d.ts +19 -41
  18. package/dist/components/ui/chart.d.ts.map +1 -1
  19. package/dist/components/ui/chart.js +34 -35
  20. package/dist/components/ui/chart.js.map +1 -1
  21. package/dist/components/ui/checkbox.js +2 -2
  22. package/dist/components/ui/checkbox.js.map +1 -1
  23. package/dist/components/ui/collapsible.js.map +1 -1
  24. package/dist/components/ui/command.js.map +1 -1
  25. package/dist/components/ui/context-menu.js.map +1 -1
  26. package/dist/components/ui/counting-number.js.map +1 -1
  27. package/dist/components/ui/dialog.js.map +1 -1
  28. package/dist/components/ui/dot-background.js.map +1 -1
  29. package/dist/components/ui/drawer.js.map +1 -1
  30. package/dist/components/ui/dropdown-menu.js.map +1 -1
  31. package/dist/components/ui/dropdrawer.js.map +1 -1
  32. package/dist/components/ui/empty.js.map +1 -1
  33. package/dist/components/ui/field.js +1 -1
  34. package/dist/components/ui/field.js.map +1 -1
  35. package/dist/components/ui/fireworks-background.js.map +1 -1
  36. package/dist/components/ui/flip-button.js.map +1 -1
  37. package/dist/components/ui/form.d.ts.map +1 -1
  38. package/dist/components/ui/form.js +4 -3
  39. package/dist/components/ui/form.js.map +1 -1
  40. package/dist/components/ui/gradient-background.js.map +1 -1
  41. package/dist/components/ui/gradient-text.js.map +1 -1
  42. package/dist/components/ui/highlight-text.js.map +1 -1
  43. package/dist/components/ui/hole-background.js.map +1 -1
  44. package/dist/components/ui/hover-card.js.map +1 -1
  45. package/dist/components/ui/input-group.d.ts.map +1 -1
  46. package/dist/components/ui/input-group.js.map +1 -1
  47. package/dist/components/ui/input-otp.d.ts +2 -2
  48. package/dist/components/ui/input-otp.js.map +1 -1
  49. package/dist/components/ui/input.js.map +1 -1
  50. package/dist/components/ui/item.js.map +1 -1
  51. package/dist/components/ui/kbd.js.map +1 -1
  52. package/dist/components/ui/label.js.map +1 -1
  53. package/dist/components/ui/menubar.js.map +1 -1
  54. package/dist/components/ui/navigation-menu.js.map +1 -1
  55. package/dist/components/ui/pagination.js.map +1 -1
  56. package/dist/components/ui/popover.js.map +1 -1
  57. package/dist/components/ui/progress.js.map +1 -1
  58. package/dist/components/ui/radio-group.js.map +1 -1
  59. package/dist/components/ui/resizable.js.map +1 -1
  60. package/dist/components/ui/ripple-button.js.map +1 -1
  61. package/dist/components/ui/scratcher.js.map +1 -1
  62. package/dist/components/ui/scroll-area.js.map +1 -1
  63. package/dist/components/ui/select.js.map +1 -1
  64. package/dist/components/ui/separator.js.map +1 -1
  65. package/dist/components/ui/sheet.d.ts +1 -1
  66. package/dist/components/ui/sheet.js.map +1 -1
  67. package/dist/components/ui/sidebar.d.ts.map +1 -1
  68. package/dist/components/ui/sidebar.js.map +1 -1
  69. package/dist/components/ui/skeleton.js.map +1 -1
  70. package/dist/components/ui/slider.js.map +1 -1
  71. package/dist/components/ui/sonner.js.map +1 -1
  72. package/dist/components/ui/spinner.js.map +1 -1
  73. package/dist/components/ui/switch.js.map +1 -1
  74. package/dist/components/ui/table.d.ts.map +1 -1
  75. package/dist/components/ui/table.js.map +1 -1
  76. package/dist/components/ui/tabs.js.map +1 -1
  77. package/dist/components/ui/textarea.js.map +1 -1
  78. package/dist/components/ui/toggle-group.js.map +1 -1
  79. package/dist/components/ui/toggle.js.map +1 -1
  80. package/dist/components/ui/tooltip.js.map +1 -1
  81. package/dist/components/ui/typewriter.js +6 -2
  82. package/dist/components/ui/typewriter.js.map +1 -1
  83. package/dist/hooks/useIsMobile.js.map +1 -1
  84. package/dist/hooks/useWindowSize.js.map +1 -1
  85. package/dist/index.css +56 -1804
  86. package/dist/index.css.map +1 -1
  87. package/dist/lib/utilities.js.map +1 -1
  88. package/package.json +2 -15
  89. package/src/components/ui/chart.tsx +163 -162
  90. package/src/components/ui/checkbox.tsx +2 -2
  91. package/src/components/ui/field.tsx +1 -1
  92. package/src/components/ui/form.tsx +8 -4
  93. package/src/components/ui/input-group.tsx +2 -0
  94. package/src/components/ui/sidebar.tsx +2 -0
  95. package/src/components/ui/table.tsx +2 -0
  96. package/src/components/ui/typewriter.tsx +2 -2
  97. package/src/index.css +6 -6
  98. package/dist/components/ui/field.d.ts +0 -26
  99. package/dist/components/ui/field.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"lib\\utilities.js","sources":["webpack://@arolariu/components/./src/lib/utilities.ts"],"sourcesContent":["import {clsx, type ClassValue} from \"clsx\";\r\nimport {twMerge} from \"tailwind-merge\";\r\n\r\n/**\r\n * Helper function that merges tailwindcss\r\n * class names in the given input array.\r\n * @param inputs Array of class names\r\n * @returns Merged class names\r\n */\r\nexport function cn(...inputs: ReadonlyArray<ClassValue>): Readonly<string> {\r\n return twMerge(clsx(inputs));\r\n}\r\n"],"names":["cn","inputs","twMerge","clsx"],"mappings":";;AASO,SAASA,GAAG,GAAGC,MAAiC;IACrD,OAAOC,QAAQC,KAAKF;AACtB"}
1
+ {"version":3,"file":"lib/utilities.js","sources":["../../src/lib/utilities.ts"],"sourcesContent":["import {clsx, type ClassValue} from \"clsx\";\r\nimport {twMerge} from \"tailwind-merge\";\r\n\r\n/**\r\n * Helper function that merges tailwindcss\r\n * class names in the given input array.\r\n * @param inputs Array of class names\r\n * @returns Merged class names\r\n */\r\nexport function cn(...inputs: ReadonlyArray<ClassValue>): Readonly<string> {\r\n return twMerge(clsx(inputs));\r\n}\r\n"],"names":["cn","inputs","twMerge","clsx"],"mappings":";;AASO,SAASA,GAAG,GAAGC,MAAiC;IACrD,OAAOC,QAAQC,KAAKF;AACtB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arolariu/components",
3
3
  "displayName": "@arolariu/components",
4
- "version": "0.3.1",
4
+ "version": "0.4.1",
5
5
  "description": "🎨 70+ beautiful, accessible React components built on Radix UI. TypeScript-first, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡",
6
6
  "homepage": "https://arolariu.ro",
7
7
  "repository": {
@@ -81,9 +81,7 @@
81
81
  "build:before": "node scripts/beforeBuild.ts",
82
82
  "build:after": "node scripts/afterBuild.ts",
83
83
  "build:clean": "rimraf dist",
84
- "build:exports": "node scripts/generate-exports.ts",
85
- "build:storybook": "storybook build",
86
- "storybook": "storybook dev -p 6006"
84
+ "build:exports": "node scripts/generate-exports.ts"
87
85
  },
88
86
  "dependencies": {
89
87
  "@hookform/resolvers": "*",
@@ -143,13 +141,6 @@
143
141
  "@rsbuild/core": "*",
144
142
  "@rsbuild/plugin-react": "*",
145
143
  "@rslib/core": "*",
146
- "@storybook/addon-a11y": "*",
147
- "@storybook/addon-docs": "*",
148
- "@storybook/addon-essentials": "*",
149
- "@storybook/addon-interactions": "*",
150
- "@storybook/addon-links": "*",
151
- "@storybook/addon-storysource": "*",
152
- "@storybook/addon-themes": "*",
153
144
  "@tailwindcss/postcss": "*",
154
145
  "@types/node": "*",
155
146
  "@types/react": "*",
@@ -160,10 +151,6 @@
160
151
  "react": "*",
161
152
  "react-dom": "*",
162
153
  "rimraf": "*",
163
- "storybook": "*",
164
- "storybook-addon-rslib": "*",
165
- "storybook-builder-rsbuild": "*",
166
- "storybook-react-rsbuild": "*",
167
154
  "tailwindcss": "*",
168
155
  "typescript": "*"
169
156
  },
@@ -2,24 +2,25 @@
2
2
 
3
3
  /* eslint-disable */
4
4
 
5
+ import {cn} from "@/lib/utilities";
5
6
  import * as React from "react";
6
7
  import * as RechartsPrimitive from "recharts";
7
-
8
- import {cn} from "@/lib/utilities";
8
+ import type {NameType, ValueType} from "recharts/types/component/DefaultTooltipContent";
9
9
 
10
10
  // Format: { THEME_NAME: CSS_SELECTOR }
11
11
  const THEMES = {light: "", dark: ".dark"} as const;
12
12
 
13
- export type ChartConfig = {
14
- [k in string]: {
13
+ export type ChartConfig = Record<
14
+ string,
15
+ {
15
16
  label?: React.ReactNode;
16
17
  icon?: React.ComponentType;
17
- } & ({color?: string; theme?: never} | {color?: never; theme: Record<keyof typeof THEMES, string>});
18
- };
18
+ } & ({color?: string; theme?: never} | {color?: never; theme: Record<keyof typeof THEMES, string>})
19
+ >;
19
20
 
20
- type ChartContextProps = {
21
+ interface ChartContextProps {
21
22
  config: ChartConfig;
22
- };
23
+ }
23
24
 
24
25
  const ChartContext = React.createContext<ChartContextProps | null>(null);
25
26
 
@@ -33,23 +34,35 @@ function useChart() {
33
34
  return context;
34
35
  }
35
36
 
36
- const ChartContainer = React.forwardRef<
37
- HTMLDivElement,
38
- React.ComponentProps<"div"> & {
39
- config: ChartConfig;
40
- children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
41
- }
42
- >(({id, className, children, config, ...props}, ref) => {
37
+ interface ChartContainerProps
38
+ extends
39
+ Omit<React.ComponentProps<"div">, "children">,
40
+ Pick<
41
+ React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>,
42
+ "initialDimension" | "aspect" | "debounce" | "minHeight" | "minWidth" | "maxHeight" | "height" | "width" | "onResize" | "children"
43
+ > {
44
+ config: ChartConfig;
45
+ innerResponsiveContainerStyle?: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["style"];
46
+ }
47
+
48
+ function ChartContainer({
49
+ id,
50
+ config,
51
+ initialDimension = {width: 320, height: 200},
52
+ className,
53
+ children,
54
+ ...props
55
+ }: Readonly<ChartContainerProps>) {
43
56
  const uniqueId = React.useId();
44
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
57
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
45
58
 
46
59
  return (
47
60
  <ChartContext.Provider value={{config}}>
48
61
  <div
62
+ data-slot='chart'
49
63
  data-chart={chartId}
50
- ref={ref}
51
64
  className={cn(
52
- "[&_.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-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none",
65
+ "[&_.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",
53
66
  className,
54
67
  )}
55
68
  {...props}>
@@ -57,15 +70,14 @@ const ChartContainer = React.forwardRef<
57
70
  id={chartId}
58
71
  config={config}
59
72
  />
60
- <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
73
+ <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>{children}</RechartsPrimitive.ResponsiveContainer>
61
74
  </div>
62
75
  </ChartContext.Provider>
63
76
  );
64
- });
65
- ChartContainer.displayName = "Chart";
77
+ }
66
78
 
67
79
  const ChartStyle = ({id, config}: {id: string; config: ChartConfig}) => {
68
- const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
80
+ const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
69
81
 
70
82
  if (!colorConfig.length) {
71
83
  return null;
@@ -80,14 +92,14 @@ const ChartStyle = ({id, config}: {id: string; config: ChartConfig}) => {
80
92
  ${prefix} [data-chart=${id}] {
81
93
  ${colorConfig
82
94
  .map(([key, itemConfig]) => {
83
- const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
95
+ const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;
84
96
  return color ? ` --color-${key}: ${color};` : null;
85
97
  })
86
- .join("")}
98
+ .join("\n")}
87
99
  }
88
100
  `,
89
101
  )
90
- .join(""),
102
+ .join("\n"),
91
103
  }}
92
104
  />
93
105
  );
@@ -95,144 +107,136 @@ ${colorConfig
95
107
 
96
108
  const ChartTooltip = RechartsPrimitive.Tooltip;
97
109
 
98
- const ChartTooltipContent = React.forwardRef<
99
- HTMLDivElement,
100
- React.ComponentProps<typeof RechartsPrimitive.Tooltip>
101
- & React.ComponentProps<"div"> & {
102
- hideLabel?: boolean;
103
- hideIndicator?: boolean;
104
- indicator?: "line" | "dot" | "dashed";
105
- nameKey?: string;
106
- labelKey?: string;
110
+ function ChartTooltipContent({
111
+ active,
112
+ payload,
113
+ className,
114
+ indicator = "dot",
115
+ hideLabel = false,
116
+ hideIndicator = false,
117
+ label,
118
+ labelFormatter,
119
+ labelClassName,
120
+ formatter,
121
+ color,
122
+ nameKey,
123
+ labelKey,
124
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip>
125
+ & React.ComponentProps<"div"> & {
126
+ hideLabel?: boolean;
127
+ hideIndicator?: boolean;
128
+ indicator?: "line" | "dot" | "dashed";
129
+ nameKey?: string;
130
+ labelKey?: string;
131
+ } & Omit<RechartsPrimitive.DefaultTooltipContentProps<ValueType, NameType>, "accessibilityLayer">) {
132
+ const {config} = useChart();
133
+
134
+ const tooltipLabel = React.useMemo(() => {
135
+ if (hideLabel || !payload?.length) {
136
+ return null;
107
137
  }
108
- >(
109
- (
110
- {
111
- active,
112
- payload,
113
- className,
114
- indicator = "dot",
115
- hideLabel = false,
116
- hideIndicator = false,
117
- label,
118
- labelFormatter,
119
- labelClassName,
120
- formatter,
121
- color,
122
- nameKey,
123
- labelKey,
124
- },
125
- ref,
126
- ) => {
127
- const {config} = useChart();
128
-
129
- const tooltipLabel = React.useMemo(() => {
130
- if (hideLabel || !payload?.length) {
131
- return null;
132
- }
133
-
134
- const [item] = payload;
135
- const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
136
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
137
- const value = !labelKey && typeof label === "string" ? config[label as keyof typeof config]?.label || label : itemConfig?.label;
138
-
139
- if (labelFormatter) {
140
- return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
141
- }
142
-
143
- if (!value) {
144
- return null;
145
- }
146
-
147
- return <div className={cn("font-medium", labelClassName)}>{value}</div>;
148
- }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
149
-
150
- if (!active || !payload?.length) {
138
+
139
+ const [item] = payload;
140
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
141
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
142
+ const value = !labelKey && typeof label === "string" ? (config[label]?.label ?? label) : itemConfig?.label;
143
+
144
+ if (labelFormatter) {
145
+ return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
146
+ }
147
+
148
+ if (!value) {
151
149
  return null;
152
150
  }
153
151
 
154
- const nestLabel = payload.length === 1 && indicator !== "dot";
152
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>;
153
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
155
154
 
156
- return (
157
- <div
158
- ref={ref}
159
- className={cn(
160
- "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-neutral-200 border-neutral-200/50 bg-white px-2.5 py-1.5 text-xs shadow-xl dark:border-neutral-800 dark:border-neutral-800/50 dark:bg-neutral-950",
161
- className,
162
- )}>
163
- {!nestLabel ? tooltipLabel : null}
164
- <div className='grid gap-1.5'>
165
- {payload
166
- .filter((item) => item.type !== "none")
167
- .map((item, index) => {
168
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
169
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
170
- const indicatorColor = color || item.payload.fill || item.color;
171
-
172
- return (
173
- <div
174
- key={item.dataKey}
175
- className={cn(
176
- "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-neutral-500 dark:[&>svg]:text-neutral-400",
177
- indicator === "dot" && "items-center",
178
- )}>
179
- {formatter && item?.value !== undefined && item.name ? (
180
- formatter(item.value, item.name, item, index, item.payload)
181
- ) : (
182
- <>
183
- {itemConfig?.icon ? (
184
- <itemConfig.icon />
185
- ) : (
186
- !hideIndicator && (
187
- <div
188
- className={cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
189
- "h-2.5 w-2.5": indicator === "dot",
190
- "w-1": indicator === "line",
191
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
192
- "my-0.5": nestLabel && indicator === "dashed",
193
- })}
194
- style={
195
- {
196
- "--color-bg": indicatorColor,
197
- "--color-border": indicatorColor,
198
- } as React.CSSProperties
199
- }
200
- />
201
- )
202
- )}
203
- <div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
204
- <div className='grid gap-1.5'>
205
- {nestLabel ? tooltipLabel : null}
206
- <span className='text-neutral-500 dark:text-neutral-400'>{itemConfig?.label || item.name}</span>
207
- </div>
208
- {item.value && (
209
- <span className='font-mono font-medium text-neutral-950 tabular-nums dark:text-neutral-50'>
210
- {item.value.toLocaleString()}
211
- </span>
212
- )}
155
+ if (!active || !payload?.length) {
156
+ return null;
157
+ }
158
+
159
+ const nestLabel = payload.length === 1 && indicator !== "dot";
160
+
161
+ return (
162
+ <div
163
+ className={cn(
164
+ "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",
165
+ className,
166
+ )}>
167
+ {!nestLabel ? tooltipLabel : null}
168
+ <div className='grid gap-1.5'>
169
+ {payload
170
+ .filter((item) => item.type !== "none")
171
+ .map((item, index) => {
172
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
173
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
174
+ const indicatorColor = color ?? item.payload?.fill ?? item.color;
175
+
176
+ return (
177
+ <div
178
+ key={index}
179
+ className={cn(
180
+ "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
181
+ indicator === "dot" && "items-center",
182
+ )}>
183
+ {formatter && item?.value !== undefined && item.name ? (
184
+ formatter(item.value, item.name, item, index, item.payload)
185
+ ) : (
186
+ <>
187
+ {itemConfig?.icon ? (
188
+ <itemConfig.icon />
189
+ ) : (
190
+ !hideIndicator && (
191
+ <div
192
+ className={cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
193
+ "h-2.5 w-2.5": indicator === "dot",
194
+ "w-1": indicator === "line",
195
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
196
+ "my-0.5": nestLabel && indicator === "dashed",
197
+ })}
198
+ style={
199
+ {
200
+ "--color-bg": indicatorColor,
201
+ "--color-border": indicatorColor,
202
+ } as React.CSSProperties
203
+ }
204
+ />
205
+ )
206
+ )}
207
+ <div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
208
+ <div className='grid gap-1.5'>
209
+ {nestLabel ? tooltipLabel : null}
210
+ <span className='text-muted-foreground'>{itemConfig?.label ?? item.name}</span>
213
211
  </div>
214
- </>
215
- )}
216
- </div>
217
- );
218
- })}
219
- </div>
212
+ {item.value != null && (
213
+ <span className='text-foreground font-mono font-medium tabular-nums'>
214
+ {typeof item.value === "number" ? item.value.toLocaleString() : String(item.value)}
215
+ </span>
216
+ )}
217
+ </div>
218
+ </>
219
+ )}
220
+ </div>
221
+ );
222
+ })}
220
223
  </div>
221
- );
222
- },
223
- );
224
- ChartTooltipContent.displayName = "ChartTooltip";
224
+ </div>
225
+ );
226
+ }
225
227
 
226
228
  const ChartLegend = RechartsPrimitive.Legend;
227
229
 
228
- const ChartLegendContent = React.forwardRef<
229
- HTMLDivElement,
230
- React.ComponentProps<"div">
231
- & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
232
- hideIcon?: boolean;
233
- nameKey?: string;
234
- }
235
- >(({className, hideIcon = false, payload, verticalAlign = "bottom", nameKey}, ref) => {
230
+ function ChartLegendContent({
231
+ className,
232
+ hideIcon = false,
233
+ nameKey,
234
+ payload,
235
+ verticalAlign,
236
+ }: React.ComponentProps<"div"> & {
237
+ hideIcon?: boolean;
238
+ nameKey?: string;
239
+ } & RechartsPrimitive.DefaultLegendContentProps) {
236
240
  const {config} = useChart();
237
241
 
238
242
  if (!payload?.length) {
@@ -240,19 +244,17 @@ const ChartLegendContent = React.forwardRef<
240
244
  }
241
245
 
242
246
  return (
243
- <div
244
- ref={ref}
245
- className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
247
+ <div className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
246
248
  {payload
247
249
  .filter((item) => item.type !== "none")
248
250
  .map((item) => {
249
- const key = `${nameKey || item.dataKey || "value"}`;
251
+ const key = `${nameKey ?? item.dataKey ?? "value"}`;
250
252
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
251
253
 
252
254
  return (
253
255
  <div
254
256
  key={item.value}
255
- className={cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-neutral-500 dark:[&>svg]:text-neutral-400")}>
257
+ className={cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3")}>
256
258
  {itemConfig?.icon && !hideIcon ? (
257
259
  <itemConfig.icon />
258
260
  ) : (
@@ -269,13 +271,12 @@ const ChartLegendContent = React.forwardRef<
269
271
  })}
270
272
  </div>
271
273
  );
272
- });
273
- ChartLegendContent.displayName = "ChartLegend";
274
+ }
274
275
 
275
276
  // Helper to extract item config from a payload.
276
277
  function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
277
278
  if (typeof payload !== "object" || payload === null) {
278
- return;
279
+ return undefined;
279
280
  }
280
281
 
281
282
  const payloadPayload =
@@ -289,7 +290,7 @@ function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key:
289
290
  configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
290
291
  }
291
292
 
292
- return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
293
+ return configLabelKey in config ? config[configLabelKey] : config[key];
293
294
  }
294
295
 
295
296
  export {ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent};
@@ -13,11 +13,11 @@ const Checkbox = React.forwardRef<
13
13
  <CheckboxPrimitive.Root
14
14
  ref={ref}
15
15
  className={cn(
16
- "peer h-4 w-4 shrink-0 rounded-sm border border-neutral-200 border-neutral-900 shadow focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-neutral-900 data-[state=checked]:text-neutral-50 dark:border-neutral-50 dark:border-neutral-800 dark:focus-visible:ring-neutral-300 dark:data-[state=checked]:bg-neutral-50 dark:data-[state=checked]:text-neutral-900",
16
+ "peer grid h-4 w-4 shrink-0 place-content-center rounded-sm border border-neutral-200 border-neutral-900 shadow focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-neutral-900 data-[state=checked]:text-neutral-50 dark:border-neutral-50 dark:border-neutral-800 dark:focus-visible:ring-neutral-300 dark:data-[state=checked]:bg-neutral-50 dark:data-[state=checked]:text-neutral-900",
17
17
  className,
18
18
  )}
19
19
  {...props}>
20
- <CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
20
+ <CheckboxPrimitive.Indicator className={cn("grid place-content-center text-current")}>
21
21
  <Check className='h-4 w-4' />
22
22
  </CheckboxPrimitive.Indicator>
23
23
  </CheckboxPrimitive.Root>
@@ -141,7 +141,7 @@ function FieldSeparator({
141
141
  className={cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className)}
142
142
  {...props}>
143
143
  <Separator className='absolute inset-0 top-1/2' />
144
- {children && (
144
+ {Boolean(children) && (
145
145
  <span
146
146
  className='relative mx-auto block w-fit bg-white px-2 text-neutral-500 dark:bg-neutral-950 dark:text-neutral-400'
147
147
  data-slot='field-separator-content'>
@@ -17,7 +17,7 @@ type FormFieldContextValue<
17
17
  name: TName;
18
18
  };
19
19
 
20
- const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);
20
+ const FormFieldContext = React.createContext<FormFieldContextValue | null>(null);
21
21
 
22
22
  const FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
23
23
  ...props
@@ -34,12 +34,16 @@ const useFormField = () => {
34
34
  const itemContext = React.useContext(FormItemContext);
35
35
  const {getFieldState, formState} = useFormContext();
36
36
 
37
- const fieldState = getFieldState(fieldContext.name, formState);
38
-
39
37
  if (!fieldContext) {
40
38
  throw new Error("useFormField should be used within <FormField>");
41
39
  }
42
40
 
41
+ if (!itemContext) {
42
+ throw new Error("useFormField should be used within <FormItem>");
43
+ }
44
+
45
+ const fieldState = getFieldState(fieldContext.name, formState);
46
+
43
47
  const {id} = itemContext;
44
48
 
45
49
  return {
@@ -56,7 +60,7 @@ type FormItemContextValue = {
56
60
  id: string;
57
61
  };
58
62
 
59
- const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);
63
+ const FormItemContext = React.createContext<FormItemContextValue | null>(null);
60
64
 
61
65
  const FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => {
62
66
  const id = React.useId();
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
 
3
+ /* eslint-disable */
4
+
3
5
  import {cva, type VariantProps} from "class-variance-authority";
4
6
  import * as React from "react";
5
7
 
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
 
3
+ /* eslint-disable */
4
+
3
5
  import {Slot} from "@radix-ui/react-slot";
4
6
  import {VariantProps, cva} from "class-variance-authority";
5
7
  import {PanelLeft} from "lucide-react";
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
 
3
+ /* eslint-disable */
4
+
3
5
  import * as React from "react";
4
6
 
5
7
  import {cn} from "@/lib/utilities";
@@ -20,7 +20,7 @@ export const TypewriterText = ({
20
20
  const wordsArray = words.map((word) => {
21
21
  return {
22
22
  ...word,
23
- text: word.text.split(""),
23
+ text: [...word.text],
24
24
  };
25
25
  });
26
26
 
@@ -105,7 +105,7 @@ export const TypewriterTextSmooth = ({
105
105
  const wordsArray = words.map((word) => {
106
106
  return {
107
107
  ...word,
108
- text: word.text.split(""),
108
+ text: [...word.text],
109
109
  };
110
110
  });
111
111
  const renderWords = () => {
package/src/index.css CHANGED
@@ -1,12 +1,12 @@
1
1
  @import "tailwindcss";
2
2
  @config '../tailwind.config.ts';
3
3
  @custom-variant dark (&:is(.dark *));
4
-
4
+
5
5
  /*
6
6
  The default border color has changed to `currentcolor` in Tailwind CSS v4,
7
7
  so we've added these compatibility styles to make sure everything still
8
8
  looks the same as it did with Tailwind CSS v3.
9
-
9
+
10
10
  If we ever want to remove these styles, we need to add an explicit border
11
11
  color utility to any element that depends on these defaults.
12
12
  */
@@ -19,7 +19,7 @@
19
19
  border-color: var(--color-gray-200, currentcolor);
20
20
  }
21
21
  }
22
-
22
+
23
23
  :root {
24
24
  --sidebar: hsl(0 0% 98%);
25
25
  --sidebar-foreground: hsl(240 5.3% 26.1%);
@@ -40,7 +40,7 @@
40
40
  --sidebar-border: hsl(240 3.7% 15.9%);
41
41
  --sidebar-ring: hsl(217.2 91.2% 59.8%);
42
42
  }
43
-
43
+
44
44
  @theme inline {
45
45
  --color-sidebar: var(--sidebar);
46
46
  --color-sidebar-foreground: var(--sidebar-foreground);
@@ -52,7 +52,7 @@
52
52
  --color-sidebar-ring: var(--sidebar-ring);
53
53
  --animate-accordion-down: accordion-down 0.2s ease-out;
54
54
  --animate-accordion-up: accordion-up 0.2s ease-out;
55
-
55
+
56
56
  @keyframes accordion-down {
57
57
  from {
58
58
  height: 0;
@@ -61,7 +61,7 @@
61
61
  height: var(--radix-accordion-content-height);
62
62
  }
63
63
  }
64
-
64
+
65
65
  @keyframes accordion-up {
66
66
  from {
67
67
  height: var(--radix-accordion-content-height);