@arbidocs/react 0.3.117 → 0.3.118

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.cjs CHANGED
@@ -35,6 +35,7 @@ var ReactMarkdown = require('react-markdown');
35
35
  var remarkGfm = require('remark-gfm');
36
36
  var rehypeRaw = require('rehype-raw');
37
37
  var framerMotion = require('framer-motion');
38
+ var sonner = require('sonner');
38
39
  var Cropper = require('react-easy-crop');
39
40
  var agGridReact = require('ag-grid-react');
40
41
  var agGridCommunity = require('ag-grid-community');
@@ -5784,41 +5785,38 @@ function ActivityFeed({
5784
5785
  var seq = 0;
5785
5786
  var uid = () => `n${Date.now().toString(36)}${(seq++).toString(36)}`;
5786
5787
  var useNotify = zustand.create((set) => ({
5787
- toasts: [],
5788
5788
  notifications: [],
5789
- push: (variant, title, opts = {}) => {
5790
- const id = uid();
5791
- const duration = opts.duration ?? (variant === "error" ? 7e3 : 4500);
5792
- set((s) => {
5793
- const toast = { id, title, description: opts.description, variant, duration };
5794
- const next = { toasts: [...s.toasts, toast] };
5795
- if (opts.record !== false) {
5796
- const note = {
5797
- id,
5798
- title,
5799
- description: opts.description,
5800
- variant,
5801
- ts: Date.now(),
5802
- read: false,
5803
- href: opts.href
5804
- };
5805
- next.notifications = [note, ...s.notifications].slice(0, 50);
5806
- }
5807
- return next;
5808
- });
5809
- return id;
5810
- },
5811
- dismiss: (id) => set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })),
5812
5789
  markRead: (id) => set((s) => ({
5813
5790
  notifications: s.notifications.map((n) => n.id === id ? { ...n, read: true } : n)
5814
5791
  })),
5815
5792
  markAllRead: () => set((s) => ({ notifications: s.notifications.map((n) => ({ ...n, read: true })) })),
5816
5793
  removeNotification: (id) => set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),
5817
5794
  clearNotifications: () => set({ notifications: [] }),
5818
- seed: (items) => set({ notifications: items })
5795
+ seed: (items) => set({ notifications: items }),
5796
+ record: (note) => set((s) => ({ notifications: [note, ...s.notifications].slice(0, 50) }))
5819
5797
  }));
5820
5798
  function make(variant) {
5821
- return (title, opts) => useNotify.getState().push(variant, title, opts);
5799
+ return (title, opts = {}) => {
5800
+ sonner.toast[variant](title, {
5801
+ description: opts.description,
5802
+ duration: opts.duration,
5803
+ action: opts.action,
5804
+ icon: opts.icon
5805
+ });
5806
+ const id = uid();
5807
+ if (opts.record !== false) {
5808
+ useNotify.getState().record({
5809
+ id,
5810
+ title,
5811
+ description: opts.description,
5812
+ variant,
5813
+ ts: Date.now(),
5814
+ read: false,
5815
+ href: opts.href
5816
+ });
5817
+ }
5818
+ return id;
5819
+ };
5822
5820
  }
5823
5821
  var notify = {
5824
5822
  success: make("success"),
@@ -5955,69 +5953,21 @@ function NotificationBell({
5955
5953
  ] })
5956
5954
  ] });
5957
5955
  }
5958
- var GLYPH2 = {
5959
- success: lucideReact.CheckCircle2,
5960
- error: lucideReact.XCircle,
5961
- warning: lucideReact.AlertTriangle,
5962
- info: lucideReact.Info
5956
+ var DEFAULT_TOAST_OPTIONS = {
5957
+ classNames: {
5958
+ toast: "group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg",
5959
+ description: "group-[.toast]:text-muted-foreground",
5960
+ actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
5961
+ cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
5962
+ }
5963
5963
  };
5964
- function Toaster({ className, toneClassNames, testId = "toaster" }) {
5965
- const toasts = useNotify((s) => s.toasts);
5964
+ function Toaster({ toastOptions, ...props }) {
5966
5965
  return /* @__PURE__ */ jsxRuntime.jsx(
5967
- "div",
5966
+ sonner.Toaster,
5968
5967
  {
5969
- className: cn(
5970
- "pointer-events-none fixed bottom-4 right-4 z-[100] flex w-[min(92vw,380px)] flex-col gap-2.5",
5971
- className
5972
- ),
5973
- "data-testid": testId,
5974
- "aria-live": "polite",
5975
- "aria-atomic": "false",
5976
- children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: toasts.map((t) => /* @__PURE__ */ jsxRuntime.jsx(ToastCard, { toast: t, toneClassNames }, t.id)) })
5977
- }
5978
- );
5979
- }
5980
- function ToastCard({
5981
- toast,
5982
- toneClassNames
5983
- }) {
5984
- const dismiss = useNotify((s) => s.dismiss);
5985
- const Glyph = GLYPH2[toast.variant];
5986
- const tone = toneClassNames?.[toast.variant] ?? DEFAULT_NOTIFY_TONE[toast.variant];
5987
- React.useEffect(() => {
5988
- if (!toast.duration) return;
5989
- const timer = setTimeout(() => dismiss(toast.id), toast.duration);
5990
- return () => clearTimeout(timer);
5991
- }, [toast.id, toast.duration, dismiss]);
5992
- return /* @__PURE__ */ jsxRuntime.jsxs(
5993
- framerMotion.motion.div,
5994
- {
5995
- layout: true,
5996
- initial: { opacity: 0, y: 16, scale: 0.97 },
5997
- animate: { opacity: 1, y: 0, scale: 1 },
5998
- exit: { opacity: 0, x: 24, scale: 0.97, transition: { duration: 0.18 } },
5999
- transition: { type: "spring", stiffness: 380, damping: 30 },
6000
- className: "pointer-events-auto flex items-start gap-3 rounded-lg border border-border bg-card p-3.5 shadow-lg",
6001
- "data-testid": `toast-${toast.variant}`,
6002
- "data-toast": "",
6003
- role: toast.variant === "error" ? "alert" : "status",
6004
- children: [
6005
- /* @__PURE__ */ jsxRuntime.jsx(Glyph, { className: cn("mt-0.5 size-[18px] shrink-0", tone) }),
6006
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
6007
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold leading-snug text-foreground", children: toast.title }),
6008
- toast.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-relaxed text-muted-foreground", children: toast.description })
6009
- ] }),
6010
- /* @__PURE__ */ jsxRuntime.jsx(
6011
- "button",
6012
- {
6013
- onClick: () => dismiss(toast.id),
6014
- className: "shrink-0 rounded p-0.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground",
6015
- "aria-label": "Dismiss",
6016
- "data-testid": "toast-dismiss",
6017
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4" })
6018
- }
6019
- )
6020
- ]
5968
+ className: "toaster group",
5969
+ toastOptions: toastOptions ?? DEFAULT_TOAST_OPTIONS,
5970
+ ...props
6021
5971
  }
6022
5972
  );
6023
5973
  }
@@ -7368,6 +7318,10 @@ Object.defineProperty(exports, "isMessageType", {
7368
7318
  enumerable: true,
7369
7319
  get: function () { return client.isMessageType; }
7370
7320
  });
7321
+ Object.defineProperty(exports, "toast", {
7322
+ enumerable: true,
7323
+ get: function () { return sonner.toast; }
7324
+ });
7371
7325
  exports.ActivityFeed = ActivityFeed;
7372
7326
  exports.AiActionCard = AiActionCard;
7373
7327
  exports.AiAnswer = AiAnswer;