@dust-tt/sparkle 0.2.583-rc-2 → 0.2.583-rc-3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationButton.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,UAAU,uBAAuB;IAC/B,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;IACjD,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,kBAAkB,mGAYtB,CAAC;AAIH,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"NotificationButton.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,UAAU,uBAAuB;IAC/B,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;IACjD,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,QAAA,MAAM,kBAAkB,mGAsBtB,CAAC;AAIH,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,13 +1,15 @@
1
- import { __assign } from "tslib";
1
+ import { __assign, __rest } from "tslib";
2
2
  import React from "react";
3
3
  import { Button } from "../components/Button";
4
4
  import { Counter } from "../components/Counter";
5
5
  import { cn } from "../lib/utils";
6
+ // For compound components to work with asChild, we need to merge props and ref
7
+ // onto the clickable element (Button) while maintaining the wrapper structure
6
8
  var NotificationButton = React.forwardRef(function (_a, ref) {
7
- var className = _a.className, buttonProps = _a.buttonProps, counterProps = _a.counterProps;
9
+ var className = _a.className, buttonProps = _a.buttonProps, counterProps = _a.counterProps, restProps = __rest(_a, ["className", "buttonProps", "counterProps"]);
8
10
  return (React.createElement("div", { className: cn("s-relative", className) },
9
- React.createElement(Button, __assign({ ref: ref }, buttonProps)),
10
- counterProps.value > 0 && (React.createElement(Counter, __assign({}, counterProps, { className: "s-absolute -s-right-2 -s-top-2" })))));
11
+ React.createElement(Button, __assign({ ref: ref }, buttonProps, restProps)),
12
+ counterProps.value > 0 && (React.createElement(Counter, __assign({}, counterProps, { className: cn("s-absolute -s-right-2 -s-top-2", counterProps.className) })))));
11
13
  });
12
14
  NotificationButton.displayName = "NotificationButton";
13
15
  export { NotificationButton };
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationButton.js","sourceRoot":"","sources":["../../../src/components/NotificationButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAQxC,IAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CAGzC,UAAC,EAAwC,EAAE,GAAG;QAA3C,SAAS,eAAA,EAAE,WAAW,iBAAA,EAAE,YAAY,kBAAA;IACvC,OAAO,CACL,6BAAK,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;QACzC,oBAAC,MAAM,aAAC,GAAG,EAAE,GAAG,IAAM,WAAW,EAAI;QACpC,YAAY,CAAC,KAAK,GAAG,CAAC,IAAI,CACzB,oBAAC,OAAO,eAAK,YAAY,IAAE,SAAS,EAAC,gCAAgC,IAAG,CACzE,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"NotificationButton.js","sourceRoot":"","sources":["../../../src/components/NotificationButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAQxC,+EAA+E;AAC/E,8EAA8E;AAC9E,IAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CAGzC,UAAC,EAAsD,EAAE,GAAG;IAAzD,IAAA,SAAS,eAAA,EAAE,WAAW,iBAAA,EAAE,YAAY,kBAAA,EAAK,SAAS,cAApD,4CAAsD,CAAF;IACrD,OAAO,CACL,6BAAK,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;QACzC,oBAAC,MAAM,aACL,GAAG,EAAE,GAAG,IACJ,WAAW,EACX,SAAS,EACb;QACD,YAAY,CAAC,KAAK,GAAG,CAAC,IAAI,CACzB,oBAAC,OAAO,eACF,YAAY,IAChB,SAAS,EAAE,EAAE,CACX,gCAAgC,EAChC,YAAY,CAAC,SAAS,CACvB,IACD,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.583-rc-2",
3
+ "version": "0.2.583-rc-3",
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",
@@ -10,15 +10,27 @@ interface NotificationButtonProps {
10
10
  className?: string;
11
11
  }
12
12
 
13
+ // For compound components to work with asChild, we need to merge props and ref
14
+ // onto the clickable element (Button) while maintaining the wrapper structure
13
15
  const NotificationButton = React.forwardRef<
14
16
  HTMLButtonElement,
15
17
  NotificationButtonProps
16
- >(({ className, buttonProps, counterProps }, ref) => {
18
+ >(({ className, buttonProps, counterProps, ...restProps }, ref) => {
17
19
  return (
18
20
  <div className={cn("s-relative", className)}>
19
- <Button ref={ref} {...buttonProps} />
21
+ <Button
22
+ ref={ref}
23
+ {...buttonProps}
24
+ {...restProps} // Merge any additional props from parent (like onClick from PopoverTrigger)
25
+ />
20
26
  {counterProps.value > 0 && (
21
- <Counter {...counterProps} className="s-absolute -s-right-2 -s-top-2" />
27
+ <Counter
28
+ {...counterProps}
29
+ className={cn(
30
+ "s-absolute -s-right-2 -s-top-2",
31
+ counterProps.className
32
+ )}
33
+ />
22
34
  )}
23
35
  </div>
24
36
  );