@dust-tt/sparkle 0.3.4 → 0.3.6

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 (52) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/components/Avatar.d.ts +4 -2
  3. package/dist/esm/components/Avatar.d.ts.map +1 -1
  4. package/dist/esm/components/Avatar.js +10 -2
  5. package/dist/esm/components/Avatar.js.map +1 -1
  6. package/dist/esm/components/Card.d.ts +2 -2
  7. package/dist/esm/components/Card.d.ts.map +1 -1
  8. package/dist/esm/components/Card.js +11 -13
  9. package/dist/esm/components/Card.js.map +1 -1
  10. package/dist/esm/components/Checkbox.d.ts +1 -0
  11. package/dist/esm/components/Checkbox.d.ts.map +1 -1
  12. package/dist/esm/components/Checkbox.js +4 -5
  13. package/dist/esm/components/Checkbox.js.map +1 -1
  14. package/dist/esm/components/Chip.js +25 -40
  15. package/dist/esm/components/Chip.js.map +1 -1
  16. package/dist/esm/components/IconButton.d.ts +9 -7
  17. package/dist/esm/components/IconButton.d.ts.map +1 -1
  18. package/dist/esm/components/IconButton.js +13 -15
  19. package/dist/esm/components/IconButton.js.map +1 -1
  20. package/dist/esm/components/Label.d.ts +6 -2
  21. package/dist/esm/components/Label.d.ts.map +1 -1
  22. package/dist/esm/components/Label.js +16 -6
  23. package/dist/esm/components/Label.js.map +1 -1
  24. package/dist/esm/components/Notification.js +11 -11
  25. package/dist/esm/components/Notification.js.map +1 -1
  26. package/dist/esm/icons/actions/Frame.d.ts +5 -0
  27. package/dist/esm/icons/actions/Frame.d.ts.map +1 -0
  28. package/dist/esm/icons/actions/Frame.js +6 -0
  29. package/dist/esm/icons/actions/Frame.js.map +1 -0
  30. package/dist/esm/icons/actions/index.d.ts +1 -0
  31. package/dist/esm/icons/actions/index.d.ts.map +1 -1
  32. package/dist/esm/icons/actions/index.js +1 -0
  33. package/dist/esm/icons/actions/index.js.map +1 -1
  34. package/dist/esm/icons/src/actions/frame.svg +3 -0
  35. package/dist/esm/stories/Card.stories.js +2 -2
  36. package/dist/esm/stories/Card.stories.js.map +1 -1
  37. package/dist/esm/stories/IconButton.stories.d.ts +1 -10
  38. package/dist/esm/stories/IconButton.stories.d.ts.map +1 -1
  39. package/dist/esm/styles/global.css +1 -1
  40. package/package.json +1 -1
  41. package/src/components/Avatar.tsx +12 -4
  42. package/src/components/Card.tsx +27 -33
  43. package/src/components/Checkbox.tsx +5 -7
  44. package/src/components/Chip.tsx +70 -70
  45. package/src/components/IconButton.tsx +64 -59
  46. package/src/components/Label.tsx +28 -11
  47. package/src/components/Notification.tsx +12 -12
  48. package/src/icons/actions/Frame.tsx +18 -0
  49. package/src/icons/actions/index.ts +1 -0
  50. package/src/icons/src/actions/frame.svg +3 -0
  51. package/src/stories/Card.stories.tsx +2 -2
  52. package/src/styles/global.css +1 -1
@@ -1,33 +1,50 @@
1
1
  import * as LabelPrimitive from "@radix-ui/react-label";
2
+ import { cva, type VariantProps } from "class-variance-authority";
2
3
  import * as React from "react";
3
4
 
4
5
  import { cn } from "@sparkle/lib/utils";
5
6
 
7
+ const labelVariants = cva(
8
+ cn(
9
+ "s-heading-sm",
10
+ "peer-disabled:s-cursor-not-allowed peer-disabled:s-opacity-70"
11
+ ),
12
+ {
13
+ variants: {
14
+ variant: {
15
+ default: cn("s-text-foreground", "dark:s-text-foreground-night"),
16
+ muted: cn(
17
+ "s-text-muted-foreground",
18
+ "dark:s-text-muted-foreground-night"
19
+ ),
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ },
25
+ }
26
+ );
27
+
6
28
  export interface LabelProps
7
- extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
29
+ extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,
30
+ VariantProps<typeof labelVariants> {
8
31
  isMuted?: boolean;
9
32
  }
10
33
 
11
34
  const Label = React.forwardRef<
12
35
  React.ElementRef<typeof LabelPrimitive.Root>,
13
36
  LabelProps
14
- >(({ className, isMuted = false, ...props }, ref) => {
15
- const labelVariants = cn(
16
- "s-heading-sm",
17
- isMuted
18
- ? "s-text-muted-foreground dark:s-text-muted-foreground-night"
19
- : "s-text-foreground dark:s-text-foreground-night",
20
- "peer-disabled:s-cursor-not-allowed peer-disabled:s-opacity-70"
21
- );
37
+ >(({ className, variant, isMuted = false, ...props }, ref) => {
38
+ const effectiveVariant = isMuted ? "muted" : variant;
22
39
 
23
40
  return (
24
41
  <LabelPrimitive.Root
25
42
  ref={ref}
26
- className={cn(labelVariants, className)}
43
+ className={cn(labelVariants({ variant: effectiveVariant }), className)}
27
44
  {...props}
28
45
  />
29
46
  );
30
47
  });
31
48
  Label.displayName = LabelPrimitive.Root.displayName;
32
49
 
33
- export { Label };
50
+ export { Label, labelVariants };
@@ -23,6 +23,16 @@ const NotificationsContext = React.createContext<(n: NotificationType) => void>(
23
23
  (n) => n
24
24
  );
25
25
 
26
+ const notificationVariants = cva("s-pt-0.5", {
27
+ variants: {
28
+ type: {
29
+ success: "s-text-success-600 dark:s-text-success-400-night",
30
+ error: "s-text-warning-500 dark:s-text-warning-500-night",
31
+ info: "s-text-info-600 dark:s-text-info-400-night",
32
+ },
33
+ },
34
+ });
35
+
26
36
  function NotificationContent({
27
37
  type,
28
38
  title,
@@ -42,16 +52,6 @@ function NotificationContent({
42
52
  }
43
53
  })();
44
54
 
45
- const variantClassName = cva("s-pt-0.5", {
46
- variants: {
47
- type: {
48
- success: "s-text-success-600 dark:s-text-success-400-night",
49
- error: "s-text-warning-500 dark:s-text-warning-500-night",
50
- info: "s-text-info-600 dark:s-text-info-400-night",
51
- },
52
- },
53
- });
54
-
55
55
  return (
56
56
  <div
57
57
  className={cn(
@@ -65,14 +65,14 @@ function NotificationContent({
65
65
  <Icon
66
66
  size="lg"
67
67
  visual={icon}
68
- className={variantClassName({ type })}
68
+ className={notificationVariants({ type })}
69
69
  aria-hidden="true"
70
70
  />
71
71
  <div className="s-flex s-min-w-0 s-flex-grow s-flex-col">
72
72
  <div
73
73
  className={cn(
74
74
  "s-heading-md s-line-clamp-1 s-h-6 s-grow",
75
- variantClassName({ type })
75
+ notificationVariants({ type })
76
76
  )}
77
77
  >
78
78
  {title || type}
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+ import * as React from "react";
3
+ const SvgFrame = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 24"
10
+ {...props}
11
+ >
12
+ <path
13
+ fill="currentColor"
14
+ d="M21 3.107v18H3v-18h18Zm-9.811 10.158L5 14.355v4.752h7.218l-1.03-5.842ZM19 5.107h-7.219l2.468 14H19v-14Zm-9.25 0H5v7.218l5.841-1.03L9.75 5.108Z"
15
+ />
16
+ </svg>
17
+ );
18
+ export default SvgFrame;
@@ -52,6 +52,7 @@ export { default as ActionFlightTakeoffIcon } from "./FlightTakeoff";
52
52
  export { default as ActionFolderIcon } from "./Folder";
53
53
  export { default as ActionFolderAddIcon } from "./FolderAdd";
54
54
  export { default as ActionFolderOpenIcon } from "./FolderOpen";
55
+ export { default as ActionFrameIcon } from "./Frame";
55
56
  export { default as ActionFullscreenIcon } from "./Fullscreen";
56
57
  export { default as ActionFullscreenExitIcon } from "./FullscreenExit";
57
58
  export { default as ActionGamepadIcon } from "./Gamepad";
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M21 3.10669C21 9.10669 21 15.1067 21 21.1067H3.00003C2.9995 15.1067 2.9995 9.10669 3.00003 3.10669H21ZM11.1888 13.2651L4.99999 14.3557V19.1067H12.218L11.1888 13.2651ZM19 5.10669H11.781L14.249 19.1067H19V5.10669ZM9.74999 5.10669H4.99999V12.3247L10.8415 11.2955L9.74999 5.10669Z" fill="#111418"/>
3
+ </svg>
@@ -3,8 +3,8 @@ import React, { ComponentType } from "react";
3
3
 
4
4
  import { Card, Icon } from "@sparkle/components";
5
5
  import {
6
+ CARD_SIZES,
6
7
  CARD_VARIANTS,
7
- CARD_VARIANTS_SIZES,
8
8
  CardActionButton,
9
9
  CardGrid,
10
10
  } from "@sparkle/components/Card";
@@ -28,7 +28,7 @@ export default meta;
28
28
 
29
29
  export const Demo = () => {
30
30
  const variants = CARD_VARIANTS;
31
- const sizes = CARD_VARIANTS_SIZES;
31
+ const sizes = CARD_SIZES;
32
32
 
33
33
  return (
34
34
  <div className="s-flex s-flex-col s-gap-8 s-text-foreground dark:s-text-foreground-night">
@@ -50,4 +50,4 @@
50
50
  background-color: theme("colors.black"); /* Dark mode base color */
51
51
  --tw-checker-color: theme("colors.slate.950"); /* Dark mode pattern color */
52
52
  }
53
- }
53
+ }