@acronis-platform/ui-react 0.53.0 → 0.55.0

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 (69) hide show
  1. package/dist/components/ui/avatar/avatar.js +1 -1
  2. package/dist/components/ui/avatar/avatar.js.map +1 -1
  3. package/dist/components/ui/breadcrumb/breadcrumb.js +5 -5
  4. package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
  5. package/dist/components/ui/chip/chip.js +1 -1
  6. package/dist/components/ui/chip/chip.js.map +1 -1
  7. package/dist/components/ui/combobox/combobox.js +51 -47
  8. package/dist/components/ui/combobox/combobox.js.map +1 -1
  9. package/dist/components/ui/data-table/data-table-column-header.js +7 -7
  10. package/dist/components/ui/data-table/data-table-column-header.js.map +1 -1
  11. package/dist/components/ui/data-table/data-table-view-options.js +4 -4
  12. package/dist/components/ui/data-table/data-table-view-options.js.map +1 -1
  13. package/dist/components/ui/data-table/data-table.js +1 -1
  14. package/dist/components/ui/data-table/data-table.js.map +1 -1
  15. package/dist/components/ui/dialog/dialog.js +36 -35
  16. package/dist/components/ui/dialog/dialog.js.map +1 -1
  17. package/dist/components/ui/dropdown-menu/dropdown-menu.js +55 -54
  18. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  19. package/dist/components/ui/filter-search/filter-search.js +28 -0
  20. package/dist/components/ui/filter-search/filter-search.js.map +1 -0
  21. package/dist/components/ui/input-date-picker/input-date-picker.js +8 -8
  22. package/dist/components/ui/input-date-picker/input-date-picker.js.map +1 -1
  23. package/dist/components/ui/input-search/input-search.js +11 -12
  24. package/dist/components/ui/input-search/input-search.js.map +1 -1
  25. package/dist/components/ui/input-select/input-select.js +72 -68
  26. package/dist/components/ui/input-select/input-select.js.map +1 -1
  27. package/dist/components/ui/input-text/input-text.js +6 -6
  28. package/dist/components/ui/input-text/input-text.js.map +1 -1
  29. package/dist/components/ui/popover/popover.js +18 -17
  30. package/dist/components/ui/popover/popover.js.map +1 -1
  31. package/dist/components/ui/resizable/resizable.js +24 -32
  32. package/dist/components/ui/resizable/resizable.js.map +1 -1
  33. package/dist/components/ui/scroll-area/scroll-area.js +61 -0
  34. package/dist/components/ui/scroll-area/scroll-area.js.map +1 -0
  35. package/dist/components/ui/sheet/sheet.js +38 -37
  36. package/dist/components/ui/sheet/sheet.js.map +1 -1
  37. package/dist/components/ui/sidebar-primary/sidebar-primary.js +203 -141
  38. package/dist/components/ui/sidebar-primary/sidebar-primary.js.map +1 -1
  39. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js +509 -351
  40. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
  41. package/dist/components/ui/switch/switch.js +6 -6
  42. package/dist/components/ui/switch/switch.js.map +1 -1
  43. package/dist/components/ui/table/table.js +7 -7
  44. package/dist/components/ui/table/table.js.map +1 -1
  45. package/dist/components/ui/tabs/tabs.js +11 -11
  46. package/dist/components/ui/tabs/tabs.js.map +1 -1
  47. package/dist/components/ui/toast/toast.js +35 -33
  48. package/dist/components/ui/toast/toast.js.map +1 -1
  49. package/dist/components/ui/tooltip/tooltip.js +41 -37
  50. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  51. package/dist/index.js +353 -349
  52. package/dist/index.js.map +1 -1
  53. package/dist/lib/portal-container.js +14 -0
  54. package/dist/lib/portal-container.js.map +1 -0
  55. package/dist/react.js +353 -349
  56. package/dist/react.js.map +1 -1
  57. package/dist/src/components/ui/filter-search/filter-search.d.ts +6 -0
  58. package/dist/src/components/ui/filter-search/index.d.ts +2 -0
  59. package/dist/src/components/ui/resizable/index.d.ts +2 -1
  60. package/dist/src/components/ui/resizable/resizable.d.ts +2 -5
  61. package/dist/src/components/ui/scroll-area/index.d.ts +1 -0
  62. package/dist/src/components/ui/scroll-area/scroll-area.d.ts +10 -0
  63. package/dist/src/components/ui/sidebar-primary/sidebar-primary.d.ts +48 -3
  64. package/dist/src/components/ui/sidebar-secondary/index.d.ts +1 -1
  65. package/dist/src/components/ui/sidebar-secondary/sidebar-secondary.d.ts +38 -33
  66. package/dist/src/index.d.ts +3 -0
  67. package/dist/src/lib/portal-container.d.ts +36 -0
  68. package/dist/ui-react.css +1 -1
  69. package/package.json +2 -3
@@ -1,52 +1,53 @@
1
- import { jsx as s, jsxs as l } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
2
2
  import { Toast as o } from "@base-ui/react/toast";
3
- import { TimesIcon as d, CircleTimesIcon as m, TriangleWarningIcon as u, CircleInfoIcon as f, CircleCheckIcon as g } from "@acronis-platform/icons-react/stroke-mono";
4
- import { cn as x } from "../../../lib/utils.js";
5
- import { Spinner as p } from "../spinner/spinner.js";
6
- const r = o.createToastManager();
7
- function n(t, e, a = {}) {
8
- const { action: i, ...c } = a;
9
- return r.add({
3
+ import { TimesIcon as d, CircleTimesIcon as m, TriangleWarningIcon as u, CircleInfoIcon as f, CircleCheckIcon as x } from "@acronis-platform/icons-react/stroke-mono";
4
+ import { cn as g } from "../../../lib/utils.js";
5
+ import { usePortalContainer as p } from "../../../lib/portal-container.js";
6
+ import { Spinner as v } from "../spinner/spinner.js";
7
+ const i = o.createToastManager();
8
+ function a(t, e, n = {}) {
9
+ const { action: r, ...l } = n;
10
+ return i.add({
10
11
  title: t,
11
12
  type: e,
12
- actionProps: i ? { children: i.label, onClick: i.onClick } : void 0,
13
- ...c
13
+ actionProps: r ? { children: r.label, onClick: r.onClick } : void 0,
14
+ ...l
14
15
  });
15
16
  }
16
- const C = Object.assign(
17
- (t, e) => n(t, void 0, e),
17
+ const I = Object.assign(
18
+ (t, e) => a(t, void 0, e),
18
19
  {
19
- success: (t, e) => n(t, "success", e),
20
- info: (t, e) => n(t, "info", e),
21
- warning: (t, e) => n(t, "warning", e),
22
- error: (t, e) => n(t, "error", e),
23
- loading: (t, e) => n(t, "loading", { timeout: 0, ...e }),
24
- dismiss: (t) => r.close(t),
25
- promise: r.promise
20
+ success: (t, e) => a(t, "success", e),
21
+ info: (t, e) => a(t, "info", e),
22
+ warning: (t, e) => a(t, "warning", e),
23
+ error: (t, e) => a(t, "error", e),
24
+ loading: (t, e) => a(t, "loading", { timeout: 0, ...e }),
25
+ dismiss: (t) => i.close(t),
26
+ promise: i.promise
26
27
  }
27
- ), v = {
28
- success: /* @__PURE__ */ s(g, { className: "size-4 text-[var(--ui-text-on-status-success)]" }),
28
+ ), N = {
29
+ success: /* @__PURE__ */ s(x, { className: "size-4 text-[var(--ui-text-on-status-success)]" }),
29
30
  info: /* @__PURE__ */ s(f, { className: "size-4 text-[var(--ui-text-on-status-info)]" }),
30
31
  warning: /* @__PURE__ */ s(u, { className: "size-4 text-[var(--ui-text-on-status-warning)]" }),
31
32
  error: /* @__PURE__ */ s(m, { className: "size-4 text-[var(--ui-text-on-status-danger)]" }),
32
- loading: /* @__PURE__ */ s(p, { size: "sm", className: "size-4" })
33
+ loading: /* @__PURE__ */ s(v, { size: "sm", className: "size-4" })
33
34
  };
34
- function h() {
35
+ function b() {
35
36
  const { toasts: t } = o.useToastManager();
36
37
  return t.map((e) => {
37
- const a = v[e.type];
38
- return /* @__PURE__ */ l(
38
+ const n = N[e.type];
39
+ return /* @__PURE__ */ c(
39
40
  o.Root,
40
41
  {
41
42
  toast: e,
42
- className: x(
43
+ className: g(
43
44
  "relative flex w-full items-start gap-3 rounded border border-border bg-background p-4 shadow-md",
44
45
  "transition-all data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",
45
46
  "data-[starting-style]:translate-x-4 data-[ending-style]:translate-x-4"
46
47
  ),
47
48
  children: [
48
- a ? /* @__PURE__ */ s("span", { className: "mt-0.5 shrink-0", children: a }) : null,
49
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
49
+ n ? /* @__PURE__ */ s("span", { className: "mt-0.5 shrink-0", children: n }) : null,
50
+ /* @__PURE__ */ c("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
50
51
  /* @__PURE__ */ s(o.Title, { className: "text-sm font-semibold leading-5 text-foreground" }),
51
52
  /* @__PURE__ */ s(o.Description, { className: "text-sm leading-5 text-muted-foreground" }),
52
53
  e.actionProps ? /* @__PURE__ */ s(o.Action, { className: "mt-1 self-start text-sm font-semibold text-secondary hover:underline" }) : null
@@ -65,19 +66,20 @@ function h() {
65
66
  );
66
67
  });
67
68
  }
68
- function z({ timeout: t, limit: e, portalContainer: a }) {
69
+ function k({ timeout: t, limit: e, portalContainer: n }) {
70
+ const r = p(), l = n ?? r;
69
71
  return /* @__PURE__ */ s(
70
72
  o.Provider,
71
73
  {
72
- toastManager: r,
74
+ toastManager: i,
73
75
  timeout: t,
74
76
  limit: e,
75
- children: /* @__PURE__ */ s(o.Portal, { container: a, children: /* @__PURE__ */ s(o.Viewport, { className: "fixed bottom-4 right-4 z-[100] flex w-[384px] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none", children: /* @__PURE__ */ s(h, {}) }) })
77
+ children: /* @__PURE__ */ s(o.Portal, { container: l, children: /* @__PURE__ */ s(o.Viewport, { className: "fixed bottom-4 end-4 z-[100] flex w-[384px] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none", children: /* @__PURE__ */ s(b, {}) }) })
76
78
  }
77
79
  );
78
80
  }
79
81
  export {
80
- z as Toaster,
81
- C as toast
82
+ k as Toaster,
83
+ I as toast
82
84
  };
83
85
  //# sourceMappingURL=toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast';\nimport {\n CircleCheckIcon,\n CircleInfoIcon,\n CircleTimesIcon,\n TimesIcon,\n TriangleWarningIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { Spinner } from '../spinner';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `sonner`\n// (packages/ui-legacy/src/components/ui/sonner.tsx), which wrapped the Sonner\n// library. Rebuilt on the Base UI toast primitive (the ui-react convention), so\n// no Sonner dependency. The contract is preserved: drop a single `<Toaster />`\n// at the app root and call the imperative `toast(...)` / `toast.success(...)`\n// API from anywhere. No `--ui-toast-*` tier yet, so this design-pending v1 is a\n// neutral surface (bg-background + border-border + shadow) with the status\n// conveyed by a colored leading icon (`--ui-text-on-status-*`); per-status\n// surface tinting is design-pending. Auto-dismiss after `timeout` (default\n// 5000ms); `loading` toasts persist until updated or dismissed.\n\n// A module-level manager so `toast(...)` works outside React (like Sonner's\n// `toast`). `<Toaster />` subscribes this manager to its provider.\nconst toastManager = ToastPrimitive.createToastManager();\n\nexport type ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading';\n\nexport interface ToastOptions {\n /** Secondary line under the title. */\n description?: React.ReactNode;\n /** Auto-dismiss delay in ms; `0` keeps the toast until dismissed. */\n timeout?: number;\n /** A single inline action button (e.g. Undo). */\n action?: { label: React.ReactNode; onClick?: () => void };\n /** Stable id — re-adding with the same id updates the toast in place. */\n id?: string;\n}\n\nfunction add(title: React.ReactNode, type?: ToastType, options: ToastOptions = {}) {\n const { action, ...rest } = options;\n return toastManager.add({\n title,\n type,\n actionProps: action\n ? { children: action.label, onClick: action.onClick }\n : undefined,\n ...rest,\n });\n}\n\n/**\n * Imperative toast API. `toast(title, options)` shows a neutral toast;\n * `toast.success` / `info` / `warning` / `error` / `loading` set the variant.\n * `toast.dismiss(id?)` closes one (or all) and `toast.promise` ties a toast to a\n * promise's lifecycle.\n */\nconst toast = Object.assign(\n (title: React.ReactNode, options?: ToastOptions) => add(title, undefined, options),\n {\n success: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'success', options),\n info: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'info', options),\n warning: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'warning', options),\n error: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'error', options),\n loading: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'loading', { timeout: 0, ...options }),\n dismiss: (id?: string) => toastManager.close(id),\n promise: toastManager.promise,\n }\n);\n\nconst ICON_BY_TYPE: Record<ToastType, React.ReactNode> = {\n success: (\n <CircleCheckIcon className=\"size-4 text-[var(--ui-text-on-status-success)]\" />\n ),\n info: (\n <CircleInfoIcon className=\"size-4 text-[var(--ui-text-on-status-info)]\" />\n ),\n warning: (\n <TriangleWarningIcon className=\"size-4 text-[var(--ui-text-on-status-warning)]\" />\n ),\n error: (\n <CircleTimesIcon className=\"size-4 text-[var(--ui-text-on-status-danger)]\" />\n ),\n loading: <Spinner size=\"sm\" className=\"size-4\" />,\n};\n\nfunction ToastList() {\n const { toasts } = ToastPrimitive.useToastManager();\n return toasts.map((item) => {\n const icon = ICON_BY_TYPE[item.type as ToastType];\n return (\n <ToastPrimitive.Root\n key={item.id}\n toast={item}\n className={cn(\n 'relative flex w-full items-start gap-3 rounded border border-border bg-background p-4 shadow-md',\n 'transition-all data-[ending-style]:opacity-0 data-[starting-style]:opacity-0',\n 'data-[starting-style]:translate-x-4 data-[ending-style]:translate-x-4'\n )}\n >\n {icon ? <span className=\"mt-0.5 shrink-0\">{icon}</span> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <ToastPrimitive.Title className=\"text-sm font-semibold leading-5 text-foreground\" />\n <ToastPrimitive.Description className=\"text-sm leading-5 text-muted-foreground\" />\n {item.actionProps ? (\n <ToastPrimitive.Action className=\"mt-1 self-start text-sm font-semibold text-secondary hover:underline\" />\n ) : null}\n </div>\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className=\"shrink-0 rounded text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-focus-primary)]\"\n >\n <TimesIcon className=\"size-4\" />\n </ToastPrimitive.Close>\n </ToastPrimitive.Root>\n );\n });\n}\n\nexport interface ToasterProps {\n /** Default auto-dismiss delay in ms for toasts that don't set one. */\n timeout?: number;\n /** Max toasts shown at once; the oldest is dropped past the limit. */\n limit?: number;\n /**\n * Portal container for the toast stack. Pass a shadow-root mount for\n * isolated-style previews (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: ToastPrimitive.Portal.Props['container'];\n}\n\n/**\n * The toast region. Render once near the app root; it portals a bottom-right\n * stack and renders every queued toast. Trigger toasts with the `toast` API.\n */\nfunction Toaster({ timeout, limit, portalContainer }: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n toastManager={toastManager}\n timeout={timeout}\n limit={limit}\n >\n <ToastPrimitive.Portal container={portalContainer}>\n <ToastPrimitive.Viewport className=\"fixed bottom-4 right-4 z-[100] flex w-[384px] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none\">\n <ToastList />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n );\n}\n\nexport { toast, Toaster };\n"],"names":["toastManager","ToastPrimitive","add","title","type","options","action","rest","toast","id","ICON_BY_TYPE","jsx","CircleCheckIcon","CircleInfoIcon","TriangleWarningIcon","CircleTimesIcon","Spinner","ToastList","toasts","item","icon","jsxs","cn","TimesIcon","Toaster","timeout","limit","portalContainer"],"mappings":";;;;;AA4BA,MAAMA,IAAeC,EAAe,mBAAA;AAepC,SAASC,EAAIC,GAAwBC,GAAkBC,IAAwB,CAAA,GAAI;AACjF,QAAM,EAAE,QAAAC,GAAQ,GAAGC,EAAA,IAASF;AAC5B,SAAOL,EAAa,IAAI;AAAA,IACtB,OAAAG;AAAA,IACA,MAAAC;AAAA,IACA,aAAaE,IACT,EAAE,UAAUA,EAAO,OAAO,SAASA,EAAO,QAAA,IAC1C;AAAA,IACJ,GAAGC;AAAA,EAAA,CACJ;AACH;AAQA,MAAMC,IAAQ,OAAO;AAAA,EACnB,CAACL,GAAwBE,MAA2BH,EAAIC,GAAO,QAAWE,CAAO;AAAA,EACjF;AAAA,IACE,SAAS,CAACF,GAAwBE,MAChCH,EAAIC,GAAO,WAAWE,CAAO;AAAA,IAC/B,MAAM,CAACF,GA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A,YAClF,gBAAAU,EAACV,EAAe,aAAf,EAA2B,WAAU,0CAAA,CAA0C;AAAA,YAC/EkB,EAAK,cACJ,gBAAAR,EAACV,EAAe,QAAf,EAAsB,WAAU,wEAAuE,IACtG;AAAA,UAAA,GACN;AAAA,UACA,gBAAAU;AAAA,YAACV,EAAe;AAAA,YAAf;AAAA,cACC,cAAW;AAAA,cACX,WAAU;AAAA,cAEV,UAAA,gBAAAU,EAACY,GAAA,EAAU,WAAU,SAAA,CAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QAChC;AAAA,MAAA;AAAA,MArBKJ,EAAK;AAAA,IAAA;AAAA,EAwBhB,CAAC;AACH;AAkBA,SAASK,EAAQ,EAAE,SAAAC,GAAS,OAAAC,GAAO,iBAAAC,KAAiC;AAClE,SACE,gBAAAhB;AAAA,IAACV,EAAe;AAAA,IAAf;AAAA,MACC,cAAAD;AAAA,MACA,SAAAyB;AAAA,MACA,OAAAC;AAAA,MAEA,UAAA,gBAAAf,EAACV,EAAe,QAAf,EAAsB,WAAW0B,GAChC,UAAA,gBAAAhB,EAACV,EAAe,UAAf,EAAwB,WAAU,sGACjC,UAAA,gBAAAU,EAACM,GAAA,CAAA,CAAU,GACb,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"toast.js","sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast';\nimport {\n CircleCheckIcon,\n CircleInfoIcon,\n CircleTimesIcon,\n TimesIcon,\n TriangleWarningIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\nimport { Spinner } from '../spinner';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `sonner`\n// (packages/ui-legacy/src/components/ui/sonner.tsx), which wrapped the Sonner\n// library. Rebuilt on the Base UI toast primitive (the ui-react convention), so\n// no Sonner dependency. The contract is preserved: drop a single `<Toaster />`\n// at the app root and call the imperative `toast(...)` / `toast.success(...)`\n// API from anywhere. No `--ui-toast-*` tier yet, so this design-pending v1 is a\n// neutral surface (bg-background + border-border + shadow) with the status\n// conveyed by a colored leading icon (`--ui-text-on-status-*`); per-status\n// surface tinting is design-pending. Auto-dismiss after `timeout` (default\n// 5000ms); `loading` toasts persist until updated or dismissed.\n\n// A module-level manager so `toast(...)` works outside React (like Sonner's\n// `toast`). `<Toaster />` subscribes this manager to its provider.\nconst toastManager = ToastPrimitive.createToastManager();\n\nexport type ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading';\n\nexport interface ToastOptions {\n /** Secondary line under the title. */\n description?: React.ReactNode;\n /** Auto-dismiss delay in ms; `0` keeps the toast until dismissed. */\n timeout?: number;\n /** A single inline action button (e.g. Undo). */\n action?: { label: React.ReactNode; onClick?: () => void };\n /** Stable id — re-adding with the same id updates the toast in place. */\n id?: string;\n}\n\nfunction add(title: React.ReactNode, type?: ToastType, options: ToastOptions = {}) {\n const { action, ...rest } = options;\n return toastManager.add({\n title,\n type,\n actionProps: action\n ? { children: action.label, onClick: action.onClick }\n : undefined,\n ...rest,\n });\n}\n\n/**\n * Imperative toast API. `toast(title, options)` shows a neutral toast;\n * `toast.success` / `info` / `warning` / `error` / `loading` set the variant.\n * `toast.dismiss(id?)` closes one (or all) and `toast.promise` ties a toast to a\n * promise's lifecycle.\n */\nconst toast = Object.assign(\n (title: React.ReactNode, options?: ToastOptions) => add(title, undefined, options),\n {\n success: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'success', options),\n info: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'info', options),\n warning: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'warning', options),\n error: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'error', options),\n loading: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'loading', { timeout: 0, ...options }),\n dismiss: (id?: string) => toastManager.close(id),\n promise: toastManager.promise,\n }\n);\n\nconst ICON_BY_TYPE: Record<ToastType, React.ReactNode> = {\n success: (\n <CircleCheckIcon className=\"size-4 text-[var(--ui-text-on-status-success)]\" />\n ),\n info: (\n <CircleInfoIcon className=\"size-4 text-[var(--ui-text-on-status-info)]\" />\n ),\n warning: (\n <TriangleWarningIcon className=\"size-4 text-[var(--ui-text-on-status-warning)]\" />\n ),\n error: (\n <CircleTimesIcon className=\"size-4 text-[var(--ui-text-on-status-danger)]\" />\n ),\n loading: <Spinner size=\"sm\" className=\"size-4\" />,\n};\n\nfunction ToastList() {\n const { toasts } = ToastPrimitive.useToastManager();\n return toasts.map((item) => {\n const icon = ICON_BY_TYPE[item.type as ToastType];\n return (\n <ToastPrimitive.Root\n key={item.id}\n toast={item}\n className={cn(\n 'relative flex w-full items-start gap-3 rounded border border-border bg-background p-4 shadow-md',\n 'transition-all data-[ending-style]:opacity-0 data-[starting-style]:opacity-0',\n 'data-[starting-style]:translate-x-4 data-[ending-style]:translate-x-4'\n )}\n >\n {icon ? <span className=\"mt-0.5 shrink-0\">{icon}</span> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <ToastPrimitive.Title className=\"text-sm font-semibold leading-5 text-foreground\" />\n <ToastPrimitive.Description className=\"text-sm leading-5 text-muted-foreground\" />\n {item.actionProps ? (\n <ToastPrimitive.Action className=\"mt-1 self-start text-sm font-semibold text-secondary hover:underline\" />\n ) : null}\n </div>\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className=\"shrink-0 rounded text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-focus-primary)]\"\n >\n <TimesIcon className=\"size-4\" />\n </ToastPrimitive.Close>\n </ToastPrimitive.Root>\n );\n });\n}\n\nexport interface ToasterProps {\n /** Default auto-dismiss delay in ms for toasts that don't set one. */\n timeout?: number;\n /** Max toasts shown at once; the oldest is dropped past the limit. */\n limit?: number;\n /**\n * Portal container for the toast stack. Pass a shadow-root mount for\n * isolated-style previews (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: ToastPrimitive.Portal.Props['container'];\n}\n\n/**\n * The toast region. Render once near the app root; it portals a bottom-right\n * stack and renders every queued toast. Trigger toasts with the `toast` API.\n */\nfunction Toaster({ timeout, limit, portalContainer }: ToasterProps) {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n return (\n <ToastPrimitive.Provider\n toastManager={toastManager}\n timeout={timeout}\n limit={limit}\n >\n <ToastPrimitive.Portal container={resolvedContainer}>\n <ToastPrimitive.Viewport className=\"fixed bottom-4 end-4 z-[100] flex w-[384px] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none\">\n <ToastList />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n );\n}\n\nexport { toast, Toaster };\n"],"names":["toastManager","ToastPrimitive","add","title","type","options","action","rest","toast","id","ICON_BY_TYPE","jsx","CircleCheckIcon","CircleInfoIcon","TriangleWarningIcon","CircleTimesIcon","Spinner","ToastList","toasts","item","icon","jsxs","cn","TimesIcon","Toaster","timeout","limit","portalContainer","ctxContainer","usePortalContainer","resolvedContainer"],"mappings":";;;;;;AA6BA,MAAMA,IAAeC,EAAe,mBAAA;AAepC,SAASC,EAAIC,GAAwBC,GAAkBC,IAAwB,CAAA,GAAI;AACjF,QAAM,EAAE,QAAAC,GAAQ,GAAGC,EAAA,IAASF;AAC5B,SAAOL,EAAa,IAAI;AAAA,IACtB,OAAAG;AAAA,IACA,MAAAC;AAAA,IACA,aAAaE,IACT,EAAE,UAAUA,EAAO,OAAO,SAASA,EAAO,QAAA,IAC1C;AAAA,IACJ,GAAGC;AAAA,EAAA,CACJ;AACH;AAQA,MAAMC,IAAQ,OAAO;AAAA,EACnB,CAACL,GAAwBE,MAA2BH,EAAIC,GAAO,QAAWE,CAAO;AAAA,EACjF;AAAA,IACE,SAAS,CAACF,GAAwBE,MAChCH,EAAIC,GAA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EAAe,OAAf,EAAqB,WAAU,kDAAA,CAAkD;AAAA,YAClF,gBAAAU,EAACV,EAAe,aAAf,EAA2B,WAAU,0CAAA,CAA0C;AAAA,YAC/EkB,EAAK,cACJ,gBAAAR,EAACV,EAAe,QAAf,EAAsB,WAAU,wEAAuE,IACtG;AAAA,UAAA,GACN;AAAA,UACA,gBAAAU;AAAA,YAACV,EAAe;AAAA,YAAf;AAAA,cACC,cAAW;AAAA,cACX,WAAU;AAAA,cAEV,UAAA,gBAAAU,EAACY,GAAA,EAAU,WAAU,SAAA,CAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QAChC;AAAA,MAAA;AAAA,MArBKJ,EAAK;AAAA,IAAA;AAAA,EAwBhB,CAAC;AACH;AAkBA,SAASK,EAAQ,EAAE,SAAAC,GAAS,OAAAC,GAAO,iBAAAC,KAAiC;AAClE,QAAMC,IAAeC,EAAA,GACfC,IAAoBH,KAAmBC;AAE7C,SACE,gBAAAjB;AAAA,IAACV,EAAe;AAAA,IAAf;AAAA,MACC,cAAAD;AAAA,MACA,SAAAyB;AAAA,MACA,OAAAC;AAAA,MAEA,UAAA,gBAAAf,EAACV,EAAe,QAAf,EAAsB,WAAW6B,GAChC,UAAA,gBAAAnB,EAACV,EAAe,UAAf,EAAwB,WAAU,oGACjC,UAAA,gBAAAU,EAACM,GAAA,CAAA,CAAU,GACb,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,49 +1,53 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import * as d from "react";
2
+ import * as s from "react";
3
3
  import { Tooltip as o } from "@base-ui/react/tooltip";
4
- import { cn as m } from "../../../lib/utils.js";
5
- const T = o.Provider, g = o.Root, f = o.Trigger, s = d.forwardRef(
4
+ import { cn as u } from "../../../lib/utils.js";
5
+ import { usePortalContainer as v } from "../../../lib/portal-container.js";
6
+ const w = o.Provider, C = o.Root, h = o.Trigger, x = s.forwardRef(
6
7
  ({
7
8
  className: i,
8
9
  sideOffset: r = 6,
9
10
  side: n = "top",
10
- align: a = "center",
11
- portalContainer: e,
11
+ align: e = "center",
12
+ portalContainer: a,
12
13
  keepMounted: p,
13
14
  ...l
14
- }, c) => /* @__PURE__ */ t(
15
- o.Portal,
16
- {
17
- container: e,
18
- keepMounted: p,
19
- children: /* @__PURE__ */ t(
20
- o.Positioner,
21
- {
22
- sideOffset: r,
23
- side: n,
24
- align: a,
25
- className: "z-50",
26
- children: /* @__PURE__ */ t(
27
- o.Popup,
28
- {
29
- ref: c,
30
- className: m(
31
- "max-w-[var(--ui-tooltip-container-width-max)] min-w-[var(--ui-tooltip-container-width-min)] rounded-[var(--ui-tooltip-container-border-radius)] bg-[var(--ui-tooltip-container-color)] px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs font-medium leading-4 text-[var(--ui-tooltip-label-color)]",
32
- i
33
- ),
34
- ...l
35
- }
36
- )
37
- }
38
- )
39
- }
40
- )
15
+ }, c) => {
16
+ const d = v(), m = a ?? d;
17
+ return /* @__PURE__ */ t(
18
+ o.Portal,
19
+ {
20
+ container: m,
21
+ keepMounted: p,
22
+ children: /* @__PURE__ */ t(
23
+ o.Positioner,
24
+ {
25
+ sideOffset: r,
26
+ side: n,
27
+ align: e,
28
+ className: "z-50",
29
+ children: /* @__PURE__ */ t(
30
+ o.Popup,
31
+ {
32
+ ref: c,
33
+ className: u(
34
+ "max-w-[var(--ui-tooltip-container-width-max)] min-w-[var(--ui-tooltip-container-width-min)] rounded-[var(--ui-tooltip-container-border-radius)] bg-[var(--ui-tooltip-container-color)] px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs font-medium leading-4 text-[var(--ui-tooltip-label-color)]",
35
+ i
36
+ ),
37
+ ...l
38
+ }
39
+ )
40
+ }
41
+ )
42
+ }
43
+ );
44
+ }
41
45
  );
42
- s.displayName = "TooltipContent";
46
+ x.displayName = "TooltipContent";
43
47
  export {
44
- g as Tooltip,
45
- s as TooltipContent,
46
- T as TooltipProvider,
47
- f as TooltipTrigger
48
+ C as Tooltip,
49
+ x as TooltipContent,
50
+ w as TooltipProvider,
51
+ h as TooltipTrigger
48
52
  };
49
53
  //# sourceMappingURL=tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../../../src/components/ui/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';\n\nimport { cn } from '@/lib/utils';\n\n// A contextual hint shown on hover/focus of its trigger. Wraps the Base UI\n// Tooltip primitive; the popup is themed with the `--ui-tooltip-*` token tier\n// (a dark, ~90%-opaque bubble with a light label, 12/8px padding, 4px radius,\n// 48–256px width). No arrow — matching the Figma design. Wrap the whole app (or\n// a region) in `TooltipProvider` to share open/close delays across tooltips.\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Popup> & {\n sideOffset?: number;\n side?: TooltipPrimitive.Positioner.Props['side'];\n align?: TooltipPrimitive.Positioner.Props['align'];\n portalContainer?: TooltipPrimitive.Portal.Props['container'];\n keepMounted?: TooltipPrimitive.Portal.Props['keepMounted'];\n }\n>(\n (\n {\n className,\n sideOffset = 6,\n side = 'top',\n align = 'center',\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => (\n <TooltipPrimitive.Portal\n container={portalContainer}\n keepMounted={keepMounted}\n >\n <TooltipPrimitive.Positioner\n sideOffset={sideOffset}\n side={side}\n align={align}\n className=\"z-50\"\n >\n <TooltipPrimitive.Popup\n ref={ref}\n className={cn(\n 'max-w-[var(--ui-tooltip-container-width-max)] min-w-[var(--ui-tooltip-container-width-min)] rounded-[var(--ui-tooltip-container-border-radius)] bg-[var(--ui-tooltip-container-color)] px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs font-medium leading-4 text-[var(--ui-tooltip-label-color)]',\n className\n )}\n {...props}\n />\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n )\n);\nTooltipContent.displayName = 'TooltipContent';\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n"],"names":["TooltipProvider","TooltipPrimitive","Tooltip","TooltipTrigger","TooltipContent","React","className","sideOffset","side","align","portalContainer","keepMounted","props","ref","jsx","cn"],"mappings":";;;;AAWA,MAAMA,IAAkBC,EAAiB,UAEnCC,IAAUD,EAAiB,MAE3BE,IAAiBF,EAAiB,SAElCG,IAAiBC,EAAM;AAAA,EAU3B,CACE;AAAA,IACE,WAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MAEA,gBAAAC;AAAA,IAACb,EAAiB;AAAA,IAAjB;AAAA,MACC,WAAWS;AAAA,MACX,aAAAC;AAAA,MAEA,UAAA,gBAAAG;AAAA,QAACb,EAAiB;AAAA,QAAjB;AAAA,UACC,YAAAM;AAAA,UACA,MAAAC;AAAA,UACA,OAAAC;AAAA,UACA,WAAU;AAAA,UAEV,UAAA,gBAAAK;AAAA,YAACb,EAAiB;AAAA,YAAjB;AAAA,cACC,KAAAY;AAAA,cACA,WAAWE;AAAA,gBACT;AAAA,gBACAT;AAAA,cAAA;AAAA,cAED,GAAGM;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;AACAR,EAAe,cAAc;"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../../../src/components/ui/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// A contextual hint shown on hover/focus of its trigger. Wraps the Base UI\n// Tooltip primitive; the popup is themed with the `--ui-tooltip-*` token tier\n// (a dark, ~90%-opaque bubble with a light label, 12/8px padding, 4px radius,\n// 48–256px width). No arrow — matching the Figma design. Wrap the whole app (or\n// a region) in `TooltipProvider` to share open/close delays across tooltips.\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Popup> & {\n sideOffset?: number;\n side?: TooltipPrimitive.Positioner.Props['side'];\n align?: TooltipPrimitive.Positioner.Props['align'];\n portalContainer?: TooltipPrimitive.Portal.Props['container'];\n keepMounted?: TooltipPrimitive.Portal.Props['keepMounted'];\n }\n>(\n (\n {\n className,\n sideOffset = 6,\n side = 'top',\n align = 'center',\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n return (\n <TooltipPrimitive.Portal\n container={resolvedContainer}\n keepMounted={keepMounted}\n >\n <TooltipPrimitive.Positioner\n sideOffset={sideOffset}\n side={side}\n align={align}\n className=\"z-50\"\n >\n <TooltipPrimitive.Popup\n ref={ref}\n className={cn(\n 'max-w-[var(--ui-tooltip-container-width-max)] min-w-[var(--ui-tooltip-container-width-min)] rounded-[var(--ui-tooltip-container-border-radius)] bg-[var(--ui-tooltip-container-color)] px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs font-medium leading-4 text-[var(--ui-tooltip-label-color)]',\n className\n )}\n {...props}\n />\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n );\n }\n);\nTooltipContent.displayName = 'TooltipContent';\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n"],"names":["TooltipProvider","TooltipPrimitive","Tooltip","TooltipTrigger","TooltipContent","React","className","sideOffset","side","align","portalContainer","keepMounted","props","ref","ctxContainer","usePortalContainer","resolvedContainer","jsx","cn"],"mappings":";;;;;AAYA,MAAMA,IAAkBC,EAAiB,UAEnCC,IAAUD,EAAiB,MAE3BE,IAAiBF,EAAiB,SAElCG,IAAiBC,EAAM;AAAA,EAU3B,CACE;AAAA,IACE,WAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAeC,EAAA,GACfC,IAAoBN,KAAmBI;AAE7C,WACA,gBAAAG;AAAA,MAAChB,EAAiB;AAAA,MAAjB;AAAA,QACC,WAAWe;AAAA,QACX,aAAAL;AAAA,QAEA,UAAA,gBAAAM;AAAA,UAAChB,EAAiB;AAAA,UAAjB;AAAA,YACC,YAAAM;AAAA,YACA,MAAAC;AAAA,YACA,OAAAC;AAAA,YACA,WAAU;AAAA,YAEV,UAAA,gBAAAQ;AAAA,cAAChB,EAAiB;AAAA,cAAjB;AAAA,gBACC,KAAAY;AAAA,gBACA,WAAWK;AAAA,kBACT;AAAA,kBACAZ;AAAA,gBAAA;AAAA,gBAED,GAAGM;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGJ;AACF;AACAR,EAAe,cAAc;"}