@arbidocs/react 0.3.184 → 0.4.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.
- package/dist/chunk-3CLGHHME.js +3882 -0
- package/dist/chunk-3CLGHHME.js.map +1 -0
- package/dist/chunk-6ALMBER7.js +176 -0
- package/dist/chunk-6ALMBER7.js.map +1 -0
- package/dist/chunk-BXP6S34V.cjs +284 -0
- package/dist/chunk-BXP6S34V.cjs.map +1 -0
- package/dist/chunk-EJ2BMHYK.js +272 -0
- package/dist/chunk-EJ2BMHYK.js.map +1 -0
- package/dist/chunk-OU2QLIKS.cjs +4060 -0
- package/dist/chunk-OU2QLIKS.cjs.map +1 -0
- package/dist/chunk-RZQACYNQ.cjs +218 -0
- package/dist/chunk-RZQACYNQ.cjs.map +1 -0
- package/dist/index-CcbVSNSP.d.cts +116 -0
- package/dist/index-CcbVSNSP.d.ts +116 -0
- package/dist/index.cjs +955 -2796
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -901
- package/dist/index.d.ts +13 -901
- package/dist/index.js +312 -2303
- package/dist/index.js.map +1 -1
- package/dist/shell/index.cjs +29 -0
- package/dist/shell/index.cjs.map +1 -0
- package/dist/shell/index.d.cts +4 -0
- package/dist/shell/index.d.ts +4 -0
- package/dist/shell/index.js +4 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/ui/index.cjs +288 -147
- package/dist/ui/index.d.cts +878 -3
- package/dist/ui/index.d.ts +878 -3
- package/dist/ui/index.js +2 -1
- package/dist/viewers/index.cjs +327 -76
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.d.cts +90 -4
- package/dist/viewers/index.d.ts +90 -4
- package/dist/viewers/index.js +316 -78
- package/dist/viewers/index.js.map +1 -1
- package/package.json +12 -3
- package/dist/chunk-FIPS3VPH.cjs +0 -1975
- package/dist/chunk-FIPS3VPH.cjs.map +0 -1
- package/dist/chunk-I256BUCX.js +0 -1819
- package/dist/chunk-I256BUCX.js.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clsx = require('clsx');
|
|
4
|
+
var tailwindMerge = require('tailwind-merge');
|
|
5
|
+
var React2 = require('react');
|
|
6
|
+
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
9
|
+
var lucideReact = require('lucide-react');
|
|
10
|
+
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
30
|
+
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
31
|
+
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
32
|
+
|
|
33
|
+
// src/lib/utils.ts
|
|
34
|
+
function cn(...inputs) {
|
|
35
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
36
|
+
}
|
|
37
|
+
var ScrollArea = React2__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
38
|
+
ScrollAreaPrimitive__namespace.Root,
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
className: cn("relative overflow-hidden", className),
|
|
42
|
+
...props,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, {}),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
));
|
|
50
|
+
ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
|
|
51
|
+
var ScrollBar = React2__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
+
ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
orientation,
|
|
56
|
+
className: cn(
|
|
57
|
+
"flex touch-none select-none transition-colors",
|
|
58
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
59
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...props,
|
|
63
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
64
|
+
}
|
|
65
|
+
));
|
|
66
|
+
ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
|
|
67
|
+
|
|
68
|
+
// src/lib/collision-padding.ts
|
|
69
|
+
function getCollisionPadding() {
|
|
70
|
+
const base = 8;
|
|
71
|
+
if (typeof window === "undefined") return { top: base, right: base, bottom: base, left: base };
|
|
72
|
+
const hidden = Math.max(
|
|
73
|
+
0,
|
|
74
|
+
(document.documentElement?.clientHeight ?? window.innerHeight) - window.innerHeight
|
|
75
|
+
);
|
|
76
|
+
return { top: base, right: base, bottom: base + hidden, left: base };
|
|
77
|
+
}
|
|
78
|
+
var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
79
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
80
|
+
var DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
|
|
81
|
+
var DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
82
|
+
var DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
83
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
84
|
+
var DropdownMenuSubTrigger = React2__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
85
|
+
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
86
|
+
{
|
|
87
|
+
ref,
|
|
88
|
+
className: cn(
|
|
89
|
+
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 pointer-coarse:min-h-11 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
90
|
+
inset && "pl-8",
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
...props,
|
|
94
|
+
children: [
|
|
95
|
+
children,
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ml-auto" })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
));
|
|
100
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
|
|
101
|
+
var DropdownMenuSubContent = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
+
DropdownMenuPrimitive__namespace.SubContent,
|
|
103
|
+
{
|
|
104
|
+
ref,
|
|
105
|
+
collisionPadding: getCollisionPadding(),
|
|
106
|
+
className: cn(
|
|
107
|
+
"z-50 min-w-[8rem] max-w-[calc(100vw-1rem)] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
108
|
+
className
|
|
109
|
+
),
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
));
|
|
113
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
|
|
114
|
+
var DropdownMenuContent = React2__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
115
|
+
DropdownMenuPrimitive__namespace.Content,
|
|
116
|
+
{
|
|
117
|
+
ref,
|
|
118
|
+
sideOffset,
|
|
119
|
+
collisionPadding: getCollisionPadding(),
|
|
120
|
+
className: cn(
|
|
121
|
+
"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] max-w-[calc(100vw-1rem)] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
|
|
122
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
123
|
+
className
|
|
124
|
+
),
|
|
125
|
+
...props
|
|
126
|
+
}
|
|
127
|
+
) }));
|
|
128
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
|
|
129
|
+
var DropdownMenuItem = React2__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
131
|
+
{
|
|
132
|
+
ref,
|
|
133
|
+
className: cn(
|
|
134
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 pointer-coarse:min-h-11 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
135
|
+
inset && "pl-8",
|
|
136
|
+
className
|
|
137
|
+
),
|
|
138
|
+
...props
|
|
139
|
+
}
|
|
140
|
+
));
|
|
141
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
|
|
142
|
+
var DropdownMenuCheckboxItem = React2__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
143
|
+
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
144
|
+
{
|
|
145
|
+
ref,
|
|
146
|
+
className: cn(
|
|
147
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 pointer-coarse:min-h-11 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
148
|
+
className
|
|
149
|
+
),
|
|
150
|
+
checked,
|
|
151
|
+
...props,
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-4 w-4 items-center justify-center rounded border border-border bg-popover", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3.5 w-3.5 text-primary" }) }) }),
|
|
154
|
+
children
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
));
|
|
158
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
|
|
159
|
+
var DropdownMenuRadioItem = React2__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
160
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
161
|
+
{
|
|
162
|
+
ref,
|
|
163
|
+
className: cn(
|
|
164
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 pointer-coarse:min-h-11 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
165
|
+
className
|
|
166
|
+
),
|
|
167
|
+
...props,
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
170
|
+
children
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
));
|
|
174
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
|
|
175
|
+
var DropdownMenuLabel = React2__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
DropdownMenuPrimitive__namespace.Label,
|
|
177
|
+
{
|
|
178
|
+
ref,
|
|
179
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
180
|
+
...props
|
|
181
|
+
}
|
|
182
|
+
));
|
|
183
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
|
|
184
|
+
var DropdownMenuSeparator = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
+
DropdownMenuPrimitive__namespace.Separator,
|
|
186
|
+
{
|
|
187
|
+
ref,
|
|
188
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
189
|
+
...props
|
|
190
|
+
}
|
|
191
|
+
));
|
|
192
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
|
|
193
|
+
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
194
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-sm tracking-widest opacity-60", className), ...props });
|
|
195
|
+
};
|
|
196
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
197
|
+
|
|
198
|
+
exports.DropdownMenu = DropdownMenu;
|
|
199
|
+
exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
|
|
200
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
201
|
+
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
202
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
203
|
+
exports.DropdownMenuLabel = DropdownMenuLabel;
|
|
204
|
+
exports.DropdownMenuPortal = DropdownMenuPortal;
|
|
205
|
+
exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
|
|
206
|
+
exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
|
|
207
|
+
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
208
|
+
exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
209
|
+
exports.DropdownMenuSub = DropdownMenuSub;
|
|
210
|
+
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
211
|
+
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
212
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
213
|
+
exports.ScrollArea = ScrollArea;
|
|
214
|
+
exports.ScrollBar = ScrollBar;
|
|
215
|
+
exports.cn = cn;
|
|
216
|
+
exports.getCollisionPadding = getCollisionPadding;
|
|
217
|
+
//# sourceMappingURL=chunk-RZQACYNQ.cjs.map
|
|
218
|
+
//# sourceMappingURL=chunk-RZQACYNQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/ui/scroll-area.tsx","../src/lib/collision-padding.ts","../src/ui/dropdown-menu.tsx"],"names":["twMerge","clsx","React","jsxs","ScrollAreaPrimitive","jsx","DropdownMenuPrimitive","React2","ChevronRight","Check","Circle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAOA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACNA,IAAM,UAAA,GAAmBC,6BAGvB,CAAC,EAAE,WAAW,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,qBACpCC,eAAA;AAAA,EAAqBC,8BAAA,CAAA,IAAA;AAAA,EAApB;AAAA,IACC,GAAA;AAAA,IACA,SAAA,EAAW,EAAA,CAAG,0BAAA,EAA4B,SAAS,CAAA;AAAA,IAClD,GAAG,KAAA;AAAA,IAEJ,QAAA,EAAA;AAAA,sBAAAC,cAAA,CAAqBD,8BAAA,CAAA,QAAA,EAApB,EAA6B,SAAA,EAAU,iCAAA,EACrC,QAAA,EACH,CAAA;AAAA,qCACC,SAAA,EAAA,EAAU,CAAA;AAAA,sBACXC,cAAA,CAAqBD,uCAApB,EAA2B;AAAA;AAAA;AAC9B,CACD;AACD,UAAA,CAAW,cAAkCA,8BAAA,CAAA,IAAA,CAAK,WAAA;AAElD,IAAM,SAAA,GAAkBF,iBAAA,CAAA,UAAA,CAGtB,CAAC,EAAE,SAAA,EAAW,cAAc,UAAA,EAAY,GAAG,KAAA,EAAM,EAAG,GAAA,qBACpDG,cAAA;AAAA,EAAqBD,8BAAA,CAAA,mBAAA;AAAA,EAApB;AAAA,I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AAA,EAAW,GAAG,OAAM,KAA6C;AAC/F,EAAA,uBAAOD,eAAC,MAAA,EAAA,EAAK,SAAA,EAAW,GAAG,4CAAA,EAA8C,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAAA;AAClG;AACA,oBAAA,CAAqB,WAAA,GAAc,sBAAA","file":"chunk-RZQACYNQ.cjs","sourcesContent":["/**\n * Core utility: `cn()` — merge class names with Tailwind-aware conflict\n * resolution (clsx + tailwind-merge). Copied faithfully from the ARBI app so the\n * promoted \"lego\" components style identically in a consumer app.\n */\n\nimport { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from 'react'\nimport * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'\n\nimport { cn } from '../lib/utils'\n\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn('relative overflow-hidden', className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full rounded-[inherit]\">\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n))\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = 'vertical', ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n 'flex touch-none select-none transition-colors',\n orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]',\n orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]',\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n))\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName\n\nexport { ScrollArea, ScrollBar }\n","/**\n * Collision padding for Radix poppers (menus, popovers, selects, hover cards).\n *\n * 8px on every side, plus, at the bottom, the amount by which the layout viewport is taller than\n * the visible one. Mobile Safari (and its landscape emulation) reports a layout viewport that is\n * larger than `innerHeight` while the toolbars are showing, so Radix would otherwise place a menu\n * under the bottom bar.\n */\nexport function getCollisionPadding(): {\n top: number\n right: number\n bottom: number\n left: number\n} {\n const base = 8\n if (typeof window === 'undefined') return { top: base, right: base, bottom: base, left: base }\n const hidden = Math.max(\n 0,\n (document.documentElement?.clientHeight ?? window.innerHeight) - window.innerHeight\n )\n return { top: base, right: base, bottom: base + hidden, left: base }\n}\n","'use client'\n\nimport * as React from 'react'\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'\nimport { Check, ChevronRight, Circle } from 'lucide-react'\n\nimport { cn } from '../lib/utils'\nimport { getCollisionPadding } from '../lib/collision-padding'\n\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 pointer-coarse:min-h-11 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n collisionPadding={getCollisionPadding()}\n className={cn(\n 'z-50 min-w-[8rem] max-w-[calc(100vw-1rem)] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]',\n className\n )}\n {...props}\n />\n))\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n collisionPadding={getCollisionPadding()}\n className={cn(\n 'z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] max-w-[calc(100vw-1rem)] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]',\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 pointer-coarse:min-h-11 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n inset && 'pl-8',\n className\n )}\n {...props}\n />\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 pointer-coarse:min-h-11 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-4 w-4 items-center justify-center rounded border border-border bg-popover\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-3.5 w-3.5 text-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 pointer-coarse:min-h-11 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-sm tracking-widest opacity-60', className)} {...props} />\n}\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut'\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as zustand from 'zustand';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ReactNode, ReactElement } from 'react';
|
|
4
|
+
import { ToasterProps } from 'sonner';
|
|
5
|
+
|
|
6
|
+
type NotifyVariant = 'success' | 'error' | 'info' | 'warning';
|
|
7
|
+
interface AppNotification {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
variant: NotifyVariant;
|
|
12
|
+
/** Epoch ms the entry was recorded. */
|
|
13
|
+
ts: number;
|
|
14
|
+
read: boolean;
|
|
15
|
+
/** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */
|
|
16
|
+
href?: string;
|
|
17
|
+
/** Optional click action — wins over `href` when both are present. Session
|
|
18
|
+
* history only; entries are never serialized, so a closure is safe here. */
|
|
19
|
+
onSelect?: () => void;
|
|
20
|
+
/** Routine session activity ("Opening workspace…", "Saved") — kept for the
|
|
21
|
+
* log but not something that demands attention: excluded from the unread
|
|
22
|
+
* badge and from the bell's default list (shown under "All activity"). */
|
|
23
|
+
ambient?: boolean;
|
|
24
|
+
/** Where the entry comes from. Session entries (`record`) have none; a
|
|
25
|
+
* backend bridge stamps its own (e.g. 'server') so {@link syncSource} can
|
|
26
|
+
* replace exactly its slice on every refetch without touching the rest. */
|
|
27
|
+
source?: string;
|
|
28
|
+
}
|
|
29
|
+
interface NotifyOptions {
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Also record a persistent notification-centre entry (default true). */
|
|
32
|
+
record?: boolean;
|
|
33
|
+
href?: string;
|
|
34
|
+
duration?: number;
|
|
35
|
+
/** A toast action button (sonner). */
|
|
36
|
+
action?: {
|
|
37
|
+
label: ReactNode;
|
|
38
|
+
onClick: () => void;
|
|
39
|
+
};
|
|
40
|
+
/** Override the toast glyph (sonner). */
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
/** Record as routine session activity (see {@link AppNotification.ambient}). */
|
|
43
|
+
ambient?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface NotifyState {
|
|
46
|
+
notifications: AppNotification[];
|
|
47
|
+
markRead: (id: string) => void;
|
|
48
|
+
markAllRead: () => void;
|
|
49
|
+
removeNotification: (id: string) => void;
|
|
50
|
+
clearNotifications: () => void;
|
|
51
|
+
/** Replace the centre's history (e.g. seed a demo/initial set). */
|
|
52
|
+
seed: (items: AppNotification[]) => void;
|
|
53
|
+
/** Record a centre entry (used by `notify.*`; sonner renders the toast). */
|
|
54
|
+
record: (note: AppNotification) => void;
|
|
55
|
+
/** Reconcile one source's slice with fresh truth (e.g. a backend list on
|
|
56
|
+
* every refetch): entries stamped with `source` are replaced wholesale —
|
|
57
|
+
* including their read state, which the source owns — while entries from
|
|
58
|
+
* other sources (session activity) stay untouched. Newest first. */
|
|
59
|
+
syncSource: (source: string, items: AppNotification[]) => void;
|
|
60
|
+
}
|
|
61
|
+
declare const useNotify: zustand.UseBoundStore<zustand.StoreApi<NotifyState>>;
|
|
62
|
+
declare const notify: {
|
|
63
|
+
success: (title: string, opts?: NotifyOptions) => string;
|
|
64
|
+
error: (title: string, opts?: NotifyOptions) => string;
|
|
65
|
+
info: (title: string, opts?: NotifyOptions) => string;
|
|
66
|
+
warning: (title: string, opts?: NotifyOptions) => string;
|
|
67
|
+
};
|
|
68
|
+
/** Replace the notification centre's history — inject a seed/initial set. */
|
|
69
|
+
declare function seedNotifications(items: AppNotification[]): void;
|
|
70
|
+
/** Unread count selector for the topbar bell — ambient session activity never
|
|
71
|
+
* demands attention, so it never counts. */
|
|
72
|
+
declare const selectUnread: (s: NotifyState) => number;
|
|
73
|
+
/** Default glyph colour per variant (raw palette, override via `toneClassNames`). */
|
|
74
|
+
declare const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string>;
|
|
75
|
+
|
|
76
|
+
/** What a custom bell trigger needs to render itself. */
|
|
77
|
+
interface NotificationBellTriggerState {
|
|
78
|
+
/** Unread count (0 when none). */
|
|
79
|
+
unread: number;
|
|
80
|
+
/** Accessible name, including the count: "Notifications, 2 unread". */
|
|
81
|
+
ariaLabel: string;
|
|
82
|
+
testId: string;
|
|
83
|
+
}
|
|
84
|
+
interface NotificationBellProps {
|
|
85
|
+
/**
|
|
86
|
+
* Replaces the default icon button with the host's own trigger (for example a labelled sidebar
|
|
87
|
+
* row). It must forward its ref and rest props: it is mounted as the dropdown trigger.
|
|
88
|
+
*/
|
|
89
|
+
renderTrigger?: (state: NotificationBellTriggerState) => ReactElement;
|
|
90
|
+
/** Called with an entry's `href` when it's clicked (e.g. router navigate). */
|
|
91
|
+
onNavigate?: (href: string) => void;
|
|
92
|
+
/** Called after an entry is locally marked read — the hook for a backend
|
|
93
|
+
* bridge to propagate read state upstream (filter by the ids it owns). */
|
|
94
|
+
onMarkRead?: (id: string) => void;
|
|
95
|
+
/** Called after "Mark all read" — same upstream-propagation hook. */
|
|
96
|
+
onMarkAllRead?: () => void;
|
|
97
|
+
/** Toast muting — the bell is where notification behaviour is controlled, so
|
|
98
|
+
* the mute switch lives in its header. Omit `onToggleMute` to hide it. */
|
|
99
|
+
muted?: boolean;
|
|
100
|
+
onToggleMute?: () => void;
|
|
101
|
+
/** Override per-variant glyph colours (e.g. brand emerald for success). */
|
|
102
|
+
toneClassNames?: Partial<Record<NotifyVariant, string>>;
|
|
103
|
+
emptyText?: string;
|
|
104
|
+
/** Footer link to the app's full notification surface. Omit to hide. */
|
|
105
|
+
onViewAll?: () => void;
|
|
106
|
+
viewAllLabel?: string;
|
|
107
|
+
testId?: string;
|
|
108
|
+
/** Where the panel opens relative to the bell (a sidebar-footer bell opens upward). */
|
|
109
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
110
|
+
align?: 'start' | 'center' | 'end';
|
|
111
|
+
}
|
|
112
|
+
declare function NotificationBell({ renderTrigger, onNavigate, onMarkRead, onMarkAllRead, muted, onToggleMute, toneClassNames, emptyText, onViewAll, viewAllLabel, testId, side, align, }: NotificationBellProps): React.JSX.Element;
|
|
113
|
+
|
|
114
|
+
declare function Toaster({ toastOptions, ...props }: ToasterProps): React.JSX.Element;
|
|
115
|
+
|
|
116
|
+
export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, NotificationBell as N, Toaster as T, type NotificationBellProps as a, type NotificationBellTriggerState as b, type NotifyOptions as c, type NotifyVariant as d, selectUnread as e, notify as n, seedNotifications as s, useNotify as u };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as zustand from 'zustand';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ReactNode, ReactElement } from 'react';
|
|
4
|
+
import { ToasterProps } from 'sonner';
|
|
5
|
+
|
|
6
|
+
type NotifyVariant = 'success' | 'error' | 'info' | 'warning';
|
|
7
|
+
interface AppNotification {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
variant: NotifyVariant;
|
|
12
|
+
/** Epoch ms the entry was recorded. */
|
|
13
|
+
ts: number;
|
|
14
|
+
read: boolean;
|
|
15
|
+
/** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */
|
|
16
|
+
href?: string;
|
|
17
|
+
/** Optional click action — wins over `href` when both are present. Session
|
|
18
|
+
* history only; entries are never serialized, so a closure is safe here. */
|
|
19
|
+
onSelect?: () => void;
|
|
20
|
+
/** Routine session activity ("Opening workspace…", "Saved") — kept for the
|
|
21
|
+
* log but not something that demands attention: excluded from the unread
|
|
22
|
+
* badge and from the bell's default list (shown under "All activity"). */
|
|
23
|
+
ambient?: boolean;
|
|
24
|
+
/** Where the entry comes from. Session entries (`record`) have none; a
|
|
25
|
+
* backend bridge stamps its own (e.g. 'server') so {@link syncSource} can
|
|
26
|
+
* replace exactly its slice on every refetch without touching the rest. */
|
|
27
|
+
source?: string;
|
|
28
|
+
}
|
|
29
|
+
interface NotifyOptions {
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Also record a persistent notification-centre entry (default true). */
|
|
32
|
+
record?: boolean;
|
|
33
|
+
href?: string;
|
|
34
|
+
duration?: number;
|
|
35
|
+
/** A toast action button (sonner). */
|
|
36
|
+
action?: {
|
|
37
|
+
label: ReactNode;
|
|
38
|
+
onClick: () => void;
|
|
39
|
+
};
|
|
40
|
+
/** Override the toast glyph (sonner). */
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
/** Record as routine session activity (see {@link AppNotification.ambient}). */
|
|
43
|
+
ambient?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface NotifyState {
|
|
46
|
+
notifications: AppNotification[];
|
|
47
|
+
markRead: (id: string) => void;
|
|
48
|
+
markAllRead: () => void;
|
|
49
|
+
removeNotification: (id: string) => void;
|
|
50
|
+
clearNotifications: () => void;
|
|
51
|
+
/** Replace the centre's history (e.g. seed a demo/initial set). */
|
|
52
|
+
seed: (items: AppNotification[]) => void;
|
|
53
|
+
/** Record a centre entry (used by `notify.*`; sonner renders the toast). */
|
|
54
|
+
record: (note: AppNotification) => void;
|
|
55
|
+
/** Reconcile one source's slice with fresh truth (e.g. a backend list on
|
|
56
|
+
* every refetch): entries stamped with `source` are replaced wholesale —
|
|
57
|
+
* including their read state, which the source owns — while entries from
|
|
58
|
+
* other sources (session activity) stay untouched. Newest first. */
|
|
59
|
+
syncSource: (source: string, items: AppNotification[]) => void;
|
|
60
|
+
}
|
|
61
|
+
declare const useNotify: zustand.UseBoundStore<zustand.StoreApi<NotifyState>>;
|
|
62
|
+
declare const notify: {
|
|
63
|
+
success: (title: string, opts?: NotifyOptions) => string;
|
|
64
|
+
error: (title: string, opts?: NotifyOptions) => string;
|
|
65
|
+
info: (title: string, opts?: NotifyOptions) => string;
|
|
66
|
+
warning: (title: string, opts?: NotifyOptions) => string;
|
|
67
|
+
};
|
|
68
|
+
/** Replace the notification centre's history — inject a seed/initial set. */
|
|
69
|
+
declare function seedNotifications(items: AppNotification[]): void;
|
|
70
|
+
/** Unread count selector for the topbar bell — ambient session activity never
|
|
71
|
+
* demands attention, so it never counts. */
|
|
72
|
+
declare const selectUnread: (s: NotifyState) => number;
|
|
73
|
+
/** Default glyph colour per variant (raw palette, override via `toneClassNames`). */
|
|
74
|
+
declare const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string>;
|
|
75
|
+
|
|
76
|
+
/** What a custom bell trigger needs to render itself. */
|
|
77
|
+
interface NotificationBellTriggerState {
|
|
78
|
+
/** Unread count (0 when none). */
|
|
79
|
+
unread: number;
|
|
80
|
+
/** Accessible name, including the count: "Notifications, 2 unread". */
|
|
81
|
+
ariaLabel: string;
|
|
82
|
+
testId: string;
|
|
83
|
+
}
|
|
84
|
+
interface NotificationBellProps {
|
|
85
|
+
/**
|
|
86
|
+
* Replaces the default icon button with the host's own trigger (for example a labelled sidebar
|
|
87
|
+
* row). It must forward its ref and rest props: it is mounted as the dropdown trigger.
|
|
88
|
+
*/
|
|
89
|
+
renderTrigger?: (state: NotificationBellTriggerState) => ReactElement;
|
|
90
|
+
/** Called with an entry's `href` when it's clicked (e.g. router navigate). */
|
|
91
|
+
onNavigate?: (href: string) => void;
|
|
92
|
+
/** Called after an entry is locally marked read — the hook for a backend
|
|
93
|
+
* bridge to propagate read state upstream (filter by the ids it owns). */
|
|
94
|
+
onMarkRead?: (id: string) => void;
|
|
95
|
+
/** Called after "Mark all read" — same upstream-propagation hook. */
|
|
96
|
+
onMarkAllRead?: () => void;
|
|
97
|
+
/** Toast muting — the bell is where notification behaviour is controlled, so
|
|
98
|
+
* the mute switch lives in its header. Omit `onToggleMute` to hide it. */
|
|
99
|
+
muted?: boolean;
|
|
100
|
+
onToggleMute?: () => void;
|
|
101
|
+
/** Override per-variant glyph colours (e.g. brand emerald for success). */
|
|
102
|
+
toneClassNames?: Partial<Record<NotifyVariant, string>>;
|
|
103
|
+
emptyText?: string;
|
|
104
|
+
/** Footer link to the app's full notification surface. Omit to hide. */
|
|
105
|
+
onViewAll?: () => void;
|
|
106
|
+
viewAllLabel?: string;
|
|
107
|
+
testId?: string;
|
|
108
|
+
/** Where the panel opens relative to the bell (a sidebar-footer bell opens upward). */
|
|
109
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
110
|
+
align?: 'start' | 'center' | 'end';
|
|
111
|
+
}
|
|
112
|
+
declare function NotificationBell({ renderTrigger, onNavigate, onMarkRead, onMarkAllRead, muted, onToggleMute, toneClassNames, emptyText, onViewAll, viewAllLabel, testId, side, align, }: NotificationBellProps): React.JSX.Element;
|
|
113
|
+
|
|
114
|
+
declare function Toaster({ toastOptions, ...props }: ToasterProps): React.JSX.Element;
|
|
115
|
+
|
|
116
|
+
export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, NotificationBell as N, Toaster as T, type NotificationBellProps as a, type NotificationBellTriggerState as b, type NotifyOptions as c, type NotifyVariant as d, selectUnread as e, notify as n, seedNotifications as s, useNotify as u };
|