@dust-tt/sparkle 0.5.12 → 0.5.13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
6
6
  "tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
@@ -48,6 +48,7 @@
48
48
  "@babel/preset-react": "^7.22.5",
49
49
  "@babel/preset-typescript": "^7.22.5",
50
50
  "@chromatic-com/storybook": "^3.2.5",
51
+ "@radix-ui/react-focus-scope": "^1.0.3",
51
52
  "@storybook/addon-essentials": "^8.6.4",
52
53
  "@storybook/addon-interactions": "^8.6.4",
53
54
  "@storybook/addon-links": "^8.6.4",
@@ -68,14 +69,12 @@
68
69
  "@types/uuid": "^9.0.6",
69
70
  "@typescript-eslint/eslint-plugin": "^8.48.0",
70
71
  "@typescript-eslint/parser": "^8.48.0",
71
- "@typescript/native-preview": "^7.0.0-dev.20251201.1",
72
- "@tanstack/react-virtual": "^3.5.0",
73
- "@radix-ui/react-focus-scope": "^1.0.3",
74
- "autoprefixer": "^10.4.14",
72
+ "@typescript/native-preview": "^7.0.0-dev.20260105.1",
73
+ "autoprefixer": "^10.4.23",
75
74
  "babel-loader": "^9.1.3",
76
75
  "babel-preset-react-app": "^10.0.1",
77
76
  "copyfiles": "^2.4.1",
78
- "esbuild": "^0.25.0",
77
+ "esbuild": "^0.25.12",
79
78
  "esbuild-plugin-postcss2": "^0.1.2",
80
79
  "eslint": "^9.18.0",
81
80
  "eslint-config-prettier": "^9.1.0",
@@ -89,10 +88,10 @@
89
88
  "react-dom": "^18.3.1",
90
89
  "sass-loader": "^13.3.2",
91
90
  "storybook": "^8.6.4",
92
- "tailwindcss": "^3.2.4",
91
+ "tailwindcss": "^3.4.19",
93
92
  "tailwindcss-animate": "^1.0.7",
94
93
  "tsc-alias": "^1.8.10",
95
- "typescript": "^5.4.5",
94
+ "typescript": "^5.9.3",
96
95
  "typescript-eslint": "^8.48.0",
97
96
  "typescript-transform-paths": "^3.4.7",
98
97
  "uuid": "^9.0.1"
@@ -130,6 +129,7 @@
130
129
  "@radix-ui/react-tabs": "^1.1.1",
131
130
  "@radix-ui/react-tooltip": "^1.1.3",
132
131
  "@tanstack/react-table": "^8.13.0",
132
+ "@tanstack/react-virtual": "^3.5.0",
133
133
  "class-variance-authority": "^0.7.1",
134
134
  "clsx": "^2.1.1",
135
135
  "emoji-mart": "^5.5.2",
@@ -14,6 +14,7 @@ const ANIMATED_TEXT_VARIANTS = [
14
14
  "blue",
15
15
  "rose",
16
16
  "golden",
17
+ "white",
17
18
  ] as const;
18
19
 
19
20
  type AnimatedTextVariantType = (typeof ANIMATED_TEXT_VARIANTS)[number];
@@ -59,6 +60,10 @@ const animatedVariants: Record<AnimatedTextVariantType, string> = {
59
60
  "s-from-golden-800 s-via-golden-950 s-via-50% s-to-golden-800",
60
61
  "dark:s-from-golden-800-night dark:s-via-golden-950-night dark:s-via-50% dark:s-to-golden-800-night"
61
62
  ),
63
+ white: cn(
64
+ "s-from-primary-800 s-via-primary-950 s-via-50% s-to-primary-800",
65
+ "dark:s-from-primary-800-night dark:s-via-primary-950-night dark:s-via-50% dark:s-to-primary-800-night"
66
+ ),
62
67
  };
63
68
 
64
69
  const animVariants = cva(
@@ -84,6 +89,7 @@ const animatedTextVariants: Record<AnimatedTextVariantType, string> = {
84
89
  blue: "s-text-sky-800 dark:s-text-sky-800-night",
85
90
  rose: "s-text-rose-800 dark:s-text-rose-800-night",
86
91
  golden: "s-text-golden-800 dark:s-text-rose-golden-night",
92
+ white: "s-text-primary-800 dark:s-text-primary-800-night",
87
93
  };
88
94
 
89
95
  const textVariants = cva("s-absolute s-inset-0", {
@@ -25,6 +25,7 @@ export const CHIP_COLORS = [
25
25
  "blue",
26
26
  "rose",
27
27
  "golden",
28
+ "white",
28
29
  ] as const;
29
30
 
30
31
  type ChipColorType = (typeof CHIP_COLORS)[number];
@@ -91,6 +92,12 @@ const chipVariants = cva("s-inline-flex s-box-border s-items-center", {
91
92
  "dark:s-bg-golden-100-night dark:s-border-golden-200-night",
92
93
  "dark:s-text-golden-900-night"
93
94
  ),
95
+ white: cn(
96
+ "s-border s-bg-white s-border-border",
97
+ "s-text-primary-900",
98
+ "dark:s-bg-background-night dark:s-border-border-night",
99
+ "dark:s-text-primary-900-night"
100
+ ),
94
101
  },
95
102
  },
96
103
  defaultVariants: {
@@ -136,8 +143,40 @@ const closeIconVariants: Record<ChipColorType, string> = {
136
143
  "s-text-golden-900 hover:s-text-golden-700 active:s-text-golden-950",
137
144
  "dark:s-text-golden-900-night dark:hover:s-text-golden-700-night dark:active:s-text-golden-950-night"
138
145
  ),
146
+ white: cn(
147
+ "s-text-primary-700 hover:s-text-primary-500 active:s-text-primary-950",
148
+ "dark:s-text-primary-700-night dark:hover:s-text-primary-500-night dark:active:s-text-primary-950-night"
149
+ ),
139
150
  };
140
151
 
152
+ interface ChipInternalButtonProps {
153
+ icon: ComponentType;
154
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
155
+ className?: string;
156
+ size?: "xs" | "sm";
157
+ "aria-label"?: string;
158
+ }
159
+
160
+ const ChipButton = React.forwardRef<HTMLButtonElement, ChipInternalButtonProps>(
161
+ ({ icon, onClick, className, size = "xs", "aria-label": ariaLabel }, ref) => (
162
+ <button
163
+ ref={ref}
164
+ type="button"
165
+ onClick={onClick}
166
+ aria-label={ariaLabel}
167
+ className={cn(
168
+ "s-rounded-md s-p-0.5",
169
+ "s-transition-colors s-duration-200",
170
+ "focus-visible:s-outline-none focus-visible:s-ring-2 focus-visible:s-ring-ring",
171
+ className
172
+ )}
173
+ >
174
+ <Icon visual={icon} size={size} />
175
+ </button>
176
+ )
177
+ );
178
+ ChipButton.displayName = "ChipButton";
179
+
141
180
  type ChipBaseProps = {
142
181
  size?: ChipSizeType;
143
182
  color?: ChipColorType;
@@ -225,21 +264,16 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
225
264
  </span>
226
265
  )}
227
266
  {onRemove && (
228
- <button
267
+ <ChipButton
268
+ icon={XMarkIcon}
269
+ size={size === "mini" ? "xs" : "sm"}
270
+ className={cn("-s-mr-1", closeIconVariants[color || "primary"])}
271
+ aria-label="Remove"
229
272
  onClick={(e) => {
230
273
  e.stopPropagation();
231
274
  onRemove();
232
275
  }}
233
- >
234
- <Icon
235
- visual={XMarkIcon}
236
- size={size === "mini" ? "xs" : (size as IconProps["size"])}
237
- className={cn(
238
- "s-transition-color -s-mr-1 s-duration-200",
239
- closeIconVariants[color || "primary"]
240
- )}
241
- />
242
- </button>
276
+ />
243
277
  )}
244
278
  </div>
245
279
  );
@@ -53,7 +53,7 @@ const Citation = React.forwardRef<HTMLDivElement, CitationProps>(
53
53
  variant={variant}
54
54
  size="sm"
55
55
  className={cn(
56
- "s-min-w-24 s-relative s-flex s-flex-none s-flex-col s-overflow-hidden",
56
+ "s-relative s-flex s-min-w-24 s-flex-none s-flex-col s-overflow-hidden",
57
57
  // Use min() to maintain aspect ratio in grid mode (8% of width) while capping
58
58
  // padding at 3 (0.75rem) for list mode to prevent excessive top padding on wide items.
59
59
  "s-pt-[min(8%,theme(spacing.3))]",
@@ -333,8 +333,9 @@ export function DataTable<TData extends TBaseData>({
333
333
  );
334
334
  }
335
335
 
336
- export interface ScrollableDataTableProps<TData extends TBaseData>
337
- extends DataTableProps<TData> {
336
+ export interface ScrollableDataTableProps<
337
+ TData extends TBaseData,
338
+ > extends DataTableProps<TData> {
338
339
  maxHeight?: string | boolean;
339
340
  onLoadMore?: () => void;
340
341
  isLoading?: boolean;
@@ -871,8 +872,7 @@ interface BaseMenuItem {
871
872
  }
872
873
 
873
874
  interface RegularMenuItem
874
- extends BaseMenuItem,
875
- Omit<DropdownMenuItemProps, "children" | "label"> {
875
+ extends BaseMenuItem, Omit<DropdownMenuItemProps, "children" | "label"> {
876
876
  kind: "item";
877
877
  }
878
878
 
@@ -900,7 +900,7 @@ const renderSubmenuItem = (
900
900
  <DropdownMenuPortal>
901
901
  <DropdownMenuSubContent>
902
902
  <ScrollArea
903
- className="s-min-w-24 s-flex s-max-h-72 s-flex-col"
903
+ className="s-flex s-max-h-72 s-min-w-24 s-flex-col"
904
904
  hideScrollBar
905
905
  >
906
906
  {item.items.map((subItem) => (
@@ -69,7 +69,8 @@ const NavigationList = React.forwardRef<
69
69
  NavigationList.displayName = "NavigationList";
70
70
 
71
71
  interface NavigationListItemProps
72
- extends React.HTMLAttributes<HTMLDivElement>,
72
+ extends
73
+ React.HTMLAttributes<HTMLDivElement>,
73
74
  Omit<LinkWrapperProps, "children" | "className"> {
74
75
  selected?: boolean;
75
76
  label?: string;
@@ -178,8 +179,7 @@ const NavigationListItem = React.forwardRef<
178
179
  );
179
180
  NavigationListItem.displayName = "NavigationListItem";
180
181
 
181
- interface NavigationListItemActionProps
182
- extends React.HTMLAttributes<HTMLDivElement> {
182
+ interface NavigationListItemActionProps extends React.HTMLAttributes<HTMLDivElement> {
183
183
  showOnHover?: boolean;
184
184
  }
185
185
 
@@ -228,7 +228,8 @@ const labelStyles = cva(
228
228
  );
229
229
 
230
230
  interface NavigationListLabelProps
231
- extends React.HTMLAttributes<HTMLDivElement>,
231
+ extends
232
+ React.HTMLAttributes<HTMLDivElement>,
232
233
  VariantProps<typeof variantStyles> {
233
234
  label: string;
234
235
  action?: React.ReactNode;
@@ -257,8 +258,7 @@ const NavigationListLabel = React.forwardRef<
257
258
 
258
259
  NavigationListLabel.displayName = "NavigationListLabel";
259
260
 
260
- interface NavigationListCollapsibleSectionProps
261
- extends React.HTMLAttributes<HTMLDivElement> {
261
+ interface NavigationListCollapsibleSectionProps extends React.HTMLAttributes<HTMLDivElement> {
262
262
  label: string;
263
263
  action?: React.ReactNode;
264
264
  defaultOpen?: boolean;