@polastack/design-system 0.1.25 → 0.1.26

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/dist/index.js CHANGED
@@ -875,16 +875,27 @@ function useToast() {
875
875
  // src/components/toast/toaster.tsx
876
876
  import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
877
877
  function Toaster() {
878
- const { toasts } = useToast();
878
+ const { toasts, dismiss } = useToast();
879
879
  return /* @__PURE__ */ jsxs3(ToastProvider, { children: [
880
- toasts.map(({ id, title, description, action, ...props }) => /* @__PURE__ */ jsxs3(Toast, { ...props, children: [
881
- /* @__PURE__ */ jsxs3("div", { className: "grid gap-1", children: [
882
- title && /* @__PURE__ */ jsx12(ToastTitle, { children: title }),
883
- description && /* @__PURE__ */ jsx12(ToastDescription, { children: description })
884
- ] }),
885
- action,
886
- /* @__PURE__ */ jsx12(ToastClose, {})
887
- ] }, id)),
880
+ toasts.map(({ id, title, description, action, open, ...props }) => /* @__PURE__ */ jsxs3(
881
+ Toast,
882
+ {
883
+ open,
884
+ onOpenChange: (isOpen) => {
885
+ if (!isOpen) dismiss(id);
886
+ },
887
+ ...props,
888
+ children: [
889
+ /* @__PURE__ */ jsxs3("div", { className: "grid gap-1", children: [
890
+ title && /* @__PURE__ */ jsx12(ToastTitle, { children: title }),
891
+ description && /* @__PURE__ */ jsx12(ToastDescription, { children: description })
892
+ ] }),
893
+ action,
894
+ /* @__PURE__ */ jsx12(ToastClose, {})
895
+ ]
896
+ },
897
+ id
898
+ )),
888
899
  /* @__PURE__ */ jsx12(ToastViewport, {})
889
900
  ] });
890
901
  }