@rise-x/apps-sdk 0.7.0 → 0.8.1

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 (59) hide show
  1. package/build/ui/components/accordion.d.ts +7 -0
  2. package/build/ui/components/aspect-ratio.d.ts +4 -0
  3. package/build/ui/components/button-group.d.ts +7 -0
  4. package/build/ui/components/carousel.d.ts +18 -0
  5. package/build/ui/components/chart.d.ts +45 -94
  6. package/build/ui/components/collapsible.d.ts +6 -0
  7. package/build/ui/components/combobox.d.ts +19 -0
  8. package/build/ui/components/command.d.ts +18 -0
  9. package/build/ui/components/context-menu.d.ts +29 -0
  10. package/build/ui/components/date-picker.d.ts +16 -0
  11. package/build/ui/components/direction.d.ts +6 -0
  12. package/build/ui/components/field.d.ts +25 -0
  13. package/build/ui/components/hover-card.d.ts +6 -0
  14. package/build/ui/components/input-group.d.ts +13 -0
  15. package/build/ui/components/input-otp.d.ts +34 -0
  16. package/build/ui/components/input.d.ts +1 -3
  17. package/build/ui/components/item.d.ts +23 -0
  18. package/build/ui/components/kbd.d.ts +4 -0
  19. package/build/ui/components/menubar.d.ts +26 -0
  20. package/build/ui/components/message-scroller.d.ts +15 -0
  21. package/build/ui/components/navigation-menu.d.ts +13 -0
  22. package/build/ui/components/page-header.d.ts +7 -1
  23. package/build/ui/index.d.ts +19 -0
  24. package/build/ui/reference/components/accordion.tsx +85 -0
  25. package/build/ui/reference/components/alert-dialog.tsx +1 -1
  26. package/build/ui/reference/components/aspect-ratio.tsx +28 -0
  27. package/build/ui/reference/components/button-group.tsx +77 -0
  28. package/build/ui/reference/components/carousel.tsx +248 -0
  29. package/build/ui/reference/components/chart.tsx +441 -1131
  30. package/build/ui/reference/components/collapsible.tsx +43 -0
  31. package/build/ui/reference/components/combobox.tsx +141 -0
  32. package/build/ui/reference/components/command.tsx +181 -0
  33. package/build/ui/reference/components/context-menu.tsx +243 -0
  34. package/build/ui/reference/components/data-table.tsx +3 -3
  35. package/build/ui/reference/components/date-picker.tsx +218 -0
  36. package/build/ui/reference/components/dialog.tsx +2 -2
  37. package/build/ui/reference/components/direction.tsx +22 -0
  38. package/build/ui/reference/components/field.tsx +252 -0
  39. package/build/ui/reference/components/hover-card.tsx +64 -0
  40. package/build/ui/reference/components/input-group.tsx +157 -0
  41. package/build/ui/reference/components/input-otp.tsx +106 -0
  42. package/build/ui/reference/components/input.tsx +4 -32
  43. package/build/ui/reference/components/item.tsx +188 -0
  44. package/build/ui/reference/components/kbd.tsx +43 -0
  45. package/build/ui/reference/components/label.tsx +1 -1
  46. package/build/ui/reference/components/menubar.tsx +275 -0
  47. package/build/ui/reference/components/message-scroller.tsx +141 -0
  48. package/build/ui/reference/components/nav.tsx +6 -0
  49. package/build/ui/reference/components/navigation-menu.tsx +191 -0
  50. package/build/ui/reference/components/page-header.tsx +32 -0
  51. package/build/ui/reference/components/popover.tsx +2 -2
  52. package/build/ui/reference/components/select.tsx +11 -8
  53. package/build/ui/reference/components/sheet.tsx +9 -1
  54. package/build/ui/reference/components/timeline.tsx +7 -0
  55. package/build/ui/reference/components/toggle.tsx +1 -1
  56. package/build/ui/reference/index.ts +19 -0
  57. package/build/ui/standalone.js +168 -28
  58. package/build/ui/styles.css +1 -1
  59. package/package.json +6 -1
@@ -0,0 +1,275 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Menubar as MenubarPrimitive } from 'radix-ui';
5
+
6
+ import { cn } from '@rise-x/ui/lib/utils';
7
+ import { CheckIcon, ChevronRightIcon } from 'lucide-react';
8
+
9
+ /*
10
+ * A desktop-application menu bar — File / Edit / View. Included for the few
11
+ * surfaces that genuinely are applications (an editor, a modelling tool), and it
12
+ * carries a warning with it:
13
+ *
14
+ * NOT FOR APP NAVIGATION, AND NEVER IN A FEDERATED APP. The host already renders
15
+ * top-bar navigation above every app, and app navigation is a left rail. A menu
16
+ * bar is for COMMANDS, not places — if the items would navigate somewhere, this is
17
+ * the wrong component and `Nav` is the right one.
18
+ *
19
+ * The bar itself is a filled track with no border, matching Segmented: the fill is
20
+ * the container, and a border around a filled track is the same statement twice.
21
+ * The menus that drop out of it are DropdownMenu's surface exactly.
22
+ */
23
+ function Menubar({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Root>) {
24
+ return (
25
+ <MenubarPrimitive.Root
26
+ data-slot="menubar"
27
+ className={cn(
28
+ 'flex h-control items-center gap-0.5 rounded-lg border-0 bg-fill-1 p-0.5',
29
+ className,
30
+ )}
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function MenubarMenu({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
37
+ return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />;
38
+ }
39
+
40
+ function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
41
+ return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />;
42
+ }
43
+
44
+ function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
45
+ return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />;
46
+ }
47
+
48
+ function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
49
+ return <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />;
50
+ }
51
+
52
+ function MenubarSub({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
53
+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
54
+ }
55
+
56
+ /* The open trigger takes the same white thumb as a selected Segmented item — one
57
+ * grammar for "this is the active one in a filled track". */
58
+ function MenubarTrigger({
59
+ className,
60
+ ...props
61
+ }: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
62
+ return (
63
+ <MenubarPrimitive.Trigger
64
+ data-slot="menubar-trigger"
65
+ className={cn(
66
+ 'inline-flex h-control-xs shrink-0 cursor-pointer items-center rounded-md border-0 bg-transparent px-2.5 text-xs text-muted-foreground transition-[background-color,color] duration-200 ease-decelerate outline-none select-none',
67
+ 'focus-visible:ring-3 focus-visible:ring-ring-control/35',
68
+ 'data-open:bg-card data-open:font-medium data-open:text-foreground data-open:shadow-[0_1px_3px_rgb(16_24_40/0.12),0_1px_1px_rgb(16_24_40/0.06)]',
69
+ className,
70
+ )}
71
+ {...props}
72
+ />
73
+ );
74
+ }
75
+
76
+ function MenubarContent({
77
+ className,
78
+ align = 'start',
79
+ alignOffset = -4,
80
+ sideOffset = 6,
81
+ ...props
82
+ }: React.ComponentProps<typeof MenubarPrimitive.Content>) {
83
+ return (
84
+ <MenubarPrimitive.Portal>
85
+ <MenubarPrimitive.Content
86
+ data-slot="menubar-content"
87
+ align={align}
88
+ alignOffset={alignOffset}
89
+ sideOffset={sideOffset}
90
+ className={cn(
91
+ 'z-50 min-w-48 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-xl bg-popover p-1.5 text-popover-foreground shadow-pop duration-100 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 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
92
+ className,
93
+ )}
94
+ {...props}
95
+ />
96
+ </MenubarPrimitive.Portal>
97
+ );
98
+ }
99
+
100
+ function MenubarItem({
101
+ className,
102
+ inset,
103
+ variant = 'default',
104
+ ...props
105
+ }: React.ComponentProps<typeof MenubarPrimitive.Item> & {
106
+ inset?: boolean;
107
+ variant?: 'default' | 'destructive';
108
+ }) {
109
+ return (
110
+ <MenubarPrimitive.Item
111
+ data-slot="menubar-item"
112
+ data-inset={inset}
113
+ data-variant={variant}
114
+ className={cn(
115
+ "group/menubar-item relative flex cursor-default items-center gap-2 rounded-md h-7 px-2 text-ui font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-error-text data-[variant=destructive]:focus:bg-error/10 data-[variant=destructive]:focus:text-error-text dark:data-[variant=destructive]:focus:bg-error/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-error-text",
116
+ className,
117
+ )}
118
+ {...props}
119
+ />
120
+ );
121
+ }
122
+
123
+ function MenubarCheckboxItem({
124
+ className,
125
+ children,
126
+ checked,
127
+ ...props
128
+ }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {
129
+ return (
130
+ <MenubarPrimitive.CheckboxItem
131
+ data-slot="menubar-checkbox-item"
132
+ className={cn(
133
+ "relative flex cursor-default items-center gap-2 rounded-md h-7 pr-8 pl-2 text-ui font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
134
+ className,
135
+ )}
136
+ checked={checked}
137
+ {...props}
138
+ >
139
+ <span
140
+ className="pointer-events-none absolute right-2 flex items-center justify-center"
141
+ data-slot="menubar-checkbox-item-indicator"
142
+ >
143
+ <MenubarPrimitive.ItemIndicator>
144
+ <CheckIcon />
145
+ </MenubarPrimitive.ItemIndicator>
146
+ </span>
147
+ {children}
148
+ </MenubarPrimitive.CheckboxItem>
149
+ );
150
+ }
151
+
152
+ function MenubarRadioItem({
153
+ className,
154
+ children,
155
+ ...props
156
+ }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {
157
+ return (
158
+ <MenubarPrimitive.RadioItem
159
+ data-slot="menubar-radio-item"
160
+ className={cn(
161
+ "relative flex cursor-default items-center gap-2 rounded-md h-7 pr-8 pl-2 text-ui font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
162
+ className,
163
+ )}
164
+ {...props}
165
+ >
166
+ <span
167
+ className="pointer-events-none absolute right-2 flex items-center justify-center"
168
+ data-slot="menubar-radio-item-indicator"
169
+ >
170
+ <MenubarPrimitive.ItemIndicator>
171
+ <CheckIcon />
172
+ </MenubarPrimitive.ItemIndicator>
173
+ </span>
174
+ {children}
175
+ </MenubarPrimitive.RadioItem>
176
+ );
177
+ }
178
+
179
+ function MenubarLabel({
180
+ className,
181
+ inset,
182
+ ...props
183
+ }: React.ComponentProps<typeof MenubarPrimitive.Label> & { inset?: boolean }) {
184
+ return (
185
+ <MenubarPrimitive.Label
186
+ data-slot="menubar-label"
187
+ data-inset={inset}
188
+ className={cn('px-3 py-2.5 text-xs text-muted-foreground data-inset:pl-9.5', className)}
189
+ {...props}
190
+ />
191
+ );
192
+ }
193
+
194
+ function MenubarSeparator({
195
+ className,
196
+ ...props
197
+ }: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
198
+ return (
199
+ <MenubarPrimitive.Separator
200
+ data-slot="menubar-separator"
201
+ className={cn('-mx-1.5 my-1.5 h-px bg-border/50', className)}
202
+ {...props}
203
+ />
204
+ );
205
+ }
206
+
207
+ function MenubarShortcut({ className, ...props }: React.ComponentProps<'span'>) {
208
+ return (
209
+ <span
210
+ data-slot="menubar-shortcut"
211
+ className={cn(
212
+ 'ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground',
213
+ className,
214
+ )}
215
+ {...props}
216
+ />
217
+ );
218
+ }
219
+
220
+ function MenubarSubTrigger({
221
+ className,
222
+ inset,
223
+ children,
224
+ ...props
225
+ }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & { inset?: boolean }) {
226
+ return (
227
+ <MenubarPrimitive.SubTrigger
228
+ data-slot="menubar-sub-trigger"
229
+ data-inset={inset}
230
+ className={cn(
231
+ "flex cursor-default items-center gap-2 rounded-md h-7 px-2 text-ui font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-9.5 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
232
+ className,
233
+ )}
234
+ {...props}
235
+ >
236
+ {children}
237
+ <ChevronRightIcon className="ml-auto" />
238
+ </MenubarPrimitive.SubTrigger>
239
+ );
240
+ }
241
+
242
+ function MenubarSubContent({
243
+ className,
244
+ ...props
245
+ }: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
246
+ return (
247
+ <MenubarPrimitive.SubContent
248
+ data-slot="menubar-sub-content"
249
+ className={cn(
250
+ 'z-50 min-w-36 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-xl bg-popover p-1.5 text-popover-foreground shadow-pop duration-100 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
251
+ className,
252
+ )}
253
+ {...props}
254
+ />
255
+ );
256
+ }
257
+
258
+ export {
259
+ Menubar,
260
+ MenubarMenu,
261
+ MenubarTrigger,
262
+ MenubarContent,
263
+ MenubarGroup,
264
+ MenubarPortal,
265
+ MenubarLabel,
266
+ MenubarItem,
267
+ MenubarCheckboxItem,
268
+ MenubarRadioGroup,
269
+ MenubarRadioItem,
270
+ MenubarSeparator,
271
+ MenubarShortcut,
272
+ MenubarSub,
273
+ MenubarSubTrigger,
274
+ MenubarSubContent,
275
+ };
@@ -0,0 +1,141 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { ArrowDownIcon } from 'lucide-react';
5
+
6
+ import { cn } from '@rise-x/ui/lib/utils';
7
+
8
+ /*
9
+ * The scroll container for a conversation. Sounds trivial; it is the piece every
10
+ * chat surface rebuilds slightly wrong, in the same two ways:
11
+ *
12
+ * 1. IT PINS TO THE BOTTOM ONLY WHILE THE READER IS ALREADY THERE. Scrolling to
13
+ * the newest message unconditionally yanks the view away from someone reading
14
+ * back through history — which is exactly when they are least able to tell
15
+ * what moved. So "stick" is a state, not an action: it is true while the
16
+ * reader sits within a threshold of the bottom and false the moment they
17
+ * leave, and only the sticky case auto-scrolls.
18
+ * 2. WHEN NOT STUCK, NEW MESSAGES ANNOUNCE THEMSELVES INSTEAD OF ARRIVING.
19
+ * Same rule the live-data guidance applies to tables: content may accumulate,
20
+ * but it may not move under the cursor. The jump button carries the count, so
21
+ * "3 new" is a decision the reader makes rather than a surprise.
22
+ *
23
+ * THE THRESHOLD IS NOT ZERO. Sub-pixel scroll heights, rubber-banding and a
24
+ * growing last message all make an exact bottom comparison flicker between true
25
+ * and false. 32px is far enough to be stable and near enough to read as "at the
26
+ * bottom".
27
+ */
28
+ const STICK_THRESHOLD = 32;
29
+
30
+ function atBottom(el: HTMLElement) {
31
+ return el.scrollHeight - el.scrollTop - el.clientHeight <= STICK_THRESHOLD;
32
+ }
33
+
34
+ const MessageScroller = React.forwardRef<
35
+ HTMLDivElement,
36
+ React.ComponentProps<'div'> & {
37
+ /** Bump this whenever a message is appended — it is what triggers the stick. */
38
+ revision?: number | string;
39
+ /** Shown on the jump affordance while the reader is away from the bottom. */
40
+ unreadCount?: number;
41
+ /** Label for the jump affordance when no count is given. */
42
+ jumpLabel?: string;
43
+ /** Label when `unreadCount` is set. Override to localise — the built-in
44
+ * default is English with an English plural rule, and it is the form that
45
+ * actually shows once a count exists, so `jumpLabel` alone cannot carry a
46
+ * translation. */
47
+ formatUnread?: (count: number) => string;
48
+ }
49
+ >(function MessageScroller(
50
+ {
51
+ className,
52
+ children,
53
+ revision,
54
+ unreadCount,
55
+ jumpLabel = 'New messages',
56
+ formatUnread = (count) => `${count} ${count === 1 ? 'new message' : 'new messages'}`,
57
+ onScroll: onScrollProp,
58
+ ...props
59
+ },
60
+ ref,
61
+ ) {
62
+ const inner = React.useRef<HTMLDivElement | null>(null);
63
+ // a ref, not state: the scroll handler and the append effect both read it, and
64
+ // an effect that ran against a stale `stuck` would scroll when it must not
65
+ const stuck = React.useRef(true);
66
+ const [showJump, setShowJump] = React.useState(false);
67
+
68
+ const setNode = React.useCallback(
69
+ (node: HTMLDivElement | null) => {
70
+ inner.current = node;
71
+ if (typeof ref === 'function') ref(node);
72
+ else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;
73
+ },
74
+ [ref],
75
+ );
76
+
77
+ const toBottom = React.useCallback((behavior: ScrollBehavior = 'auto') => {
78
+ const el = inner.current;
79
+ if (!el) return;
80
+ el.scrollTo({ top: el.scrollHeight, behavior });
81
+ stuck.current = true;
82
+ setShowJump(false);
83
+ }, []);
84
+
85
+ /* A caller's onScroll runs ALONGSIDE the stick tracking, never instead of it:
86
+ * this used to sit before `{...props}`, so passing onScroll — plausible for a
87
+ * surface that reports read position — silently replaced the handler and left
88
+ * `stuck` true forever, yanking the reader to the newest message. */
89
+ const onScroll = React.useCallback(
90
+ (event: React.UIEvent<HTMLDivElement>) => {
91
+ const el = inner.current;
92
+ if (el) {
93
+ stuck.current = atBottom(el);
94
+ setShowJump(!stuck.current);
95
+ }
96
+ onScrollProp?.(event);
97
+ },
98
+ [onScrollProp],
99
+ );
100
+
101
+ // start at the newest message rather than the oldest
102
+ React.useEffect(() => {
103
+ toBottom();
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
105
+ }, []);
106
+
107
+ React.useEffect(() => {
108
+ if (stuck.current) toBottom();
109
+ }, [revision, toBottom]);
110
+
111
+ return (
112
+ <div data-slot="message-scroller" className={cn('relative min-h-0', className)}>
113
+ <div
114
+ ref={setNode}
115
+ data-slot="message-scroller-viewport"
116
+ onScroll={onScroll}
117
+ className="h-full overflow-y-auto overscroll-contain"
118
+ {...props}
119
+ >
120
+ {children}
121
+ </div>
122
+ {showJump ? (
123
+ <div
124
+ data-slot="message-scroller-jump"
125
+ className="pointer-events-none absolute inset-x-0 bottom-2.5 flex justify-center"
126
+ >
127
+ <button
128
+ type="button"
129
+ onClick={() => toBottom('smooth')}
130
+ className="pointer-events-auto inline-flex h-control-sm cursor-pointer items-center gap-1.5 rounded-full border-0 bg-foreground px-3 text-xs font-medium text-background shadow-pop outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring-control/35 [&>svg]:size-3"
131
+ >
132
+ <ArrowDownIcon aria-hidden />
133
+ {unreadCount ? formatUnread(unreadCount) : jumpLabel}
134
+ </button>
135
+ </div>
136
+ ) : null}
137
+ </div>
138
+ );
139
+ });
140
+
141
+ export { MessageScroller };
@@ -60,6 +60,12 @@ function NavSection({ className, ...props }: React.ComponentProps<'div'>) {
60
60
  * SIDEBAR PANEL — the detail pane beside a list. Floats with a margin rather
61
61
  * than butting against the window edge, so the page background shows through on
62
62
  * all four sides and the panel reads as a separate object.
63
+ *
64
+ * This is for surfaces that are PART OF THE PAGE's layout — a persistent
65
+ * master-detail pane, a filter rail — where the rest of the page stays
66
+ * interactive. For on-demand context (the activity log, an asset render, any
67
+ * supplementary data) do not dock a Panel into the layout: open a Sheet from
68
+ * the page header instead (see sheet.tsx).
63
69
  */
64
70
  function Panel({ className, ...props }: React.ComponentProps<'aside'>) {
65
71
  return (
@@ -0,0 +1,191 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
5
+ import { ChevronDownIcon } from 'lucide-react';
6
+
7
+ import { cn } from '@rise-x/ui/lib/utils';
8
+
9
+ /*
10
+ * A horizontal navigation menu with drop-down panels — the marketing-site and
11
+ * portal-landing shape.
12
+ *
13
+ * READ THIS BEFORE REACHING FOR IT. This is NOT how a Rise-X app navigates.
14
+ * App navigation is a LEFT RAIL built from `Nav`, and a federated app must never
15
+ * render a top bar at any width, because the host already renders one above every
16
+ * app. Two nav bars stacked is the exact thing that rule exists to prevent.
17
+ *
18
+ * So this component is for the surfaces that are not apps: a public site, a
19
+ * sign-in shell, a documentation portal. If you are inside an app and you want
20
+ * this, you want `Nav` plus `PageHeaderTabs`.
21
+ *
22
+ * The trigger keeps the ghost-button grammar and the panel is Popover's surface,
23
+ * so it belongs to the same system even though its use is narrow.
24
+ */
25
+ function NavigationMenu({
26
+ className,
27
+ children,
28
+ viewport = true,
29
+ ...props
30
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & { viewport?: boolean }) {
31
+ return (
32
+ <NavigationMenuPrimitive.Root
33
+ data-slot="navigation-menu"
34
+ data-viewport={viewport}
35
+ className={cn(
36
+ 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',
37
+ className,
38
+ )}
39
+ {...props}
40
+ >
41
+ {children}
42
+ {viewport && <NavigationMenuViewport />}
43
+ </NavigationMenuPrimitive.Root>
44
+ );
45
+ }
46
+
47
+ function NavigationMenuList({
48
+ className,
49
+ ...props
50
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
51
+ return (
52
+ <NavigationMenuPrimitive.List
53
+ data-slot="navigation-menu-list"
54
+ className={cn(
55
+ 'group flex flex-1 list-none items-center justify-center gap-0.5 p-0',
56
+ className,
57
+ )}
58
+ {...props}
59
+ />
60
+ );
61
+ }
62
+
63
+ function NavigationMenuItem({
64
+ className,
65
+ ...props
66
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
67
+ return (
68
+ <NavigationMenuPrimitive.Item
69
+ data-slot="navigation-menu-item"
70
+ className={cn('relative', className)}
71
+ {...props}
72
+ />
73
+ );
74
+ }
75
+
76
+ function NavigationMenuTrigger({
77
+ className,
78
+ children,
79
+ ...props
80
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
81
+ return (
82
+ <NavigationMenuPrimitive.Trigger
83
+ data-slot="navigation-menu-trigger"
84
+ className={cn(
85
+ 'group inline-flex h-control cursor-pointer items-center justify-center gap-1.5 rounded-lg border-0 bg-transparent px-3 text-ui font-medium text-muted-foreground transition-colors duration-150 ease-decelerate outline-none select-none',
86
+ 'hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring-control/35',
87
+ 'data-open:bg-muted data-open:text-foreground',
88
+ className,
89
+ )}
90
+ {...props}
91
+ >
92
+ {children}
93
+ <ChevronDownIcon
94
+ aria-hidden
95
+ className="size-3 shrink-0 transition-transform duration-200 ease-decelerate group-data-open:rotate-180"
96
+ />
97
+ </NavigationMenuPrimitive.Trigger>
98
+ );
99
+ }
100
+
101
+ function NavigationMenuContent({
102
+ className,
103
+ ...props
104
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
105
+ return (
106
+ <NavigationMenuPrimitive.Content
107
+ data-slot="navigation-menu-content"
108
+ className={cn(
109
+ 'top-0 left-0 w-full p-2.5 md:absolute md:w-auto',
110
+ // without a viewport the content is its own popover surface
111
+ 'group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:min-w-48 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-xl group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow-pop group-data-[viewport=false]/navigation-menu:duration-100 group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95',
112
+ className,
113
+ )}
114
+ {...props}
115
+ />
116
+ );
117
+ }
118
+
119
+ /*
120
+ * The viewport is one shared panel every menu animates INTO, sized to whichever
121
+ * content is open. That is what makes the panel appear to resize between menus
122
+ * rather than one closing and another opening — and it is why the panel radius
123
+ * lives here and not on the content.
124
+ */
125
+ function NavigationMenuViewport({
126
+ className,
127
+ ...props
128
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
129
+ return (
130
+ <div className="absolute top-full left-0 isolate z-50 flex justify-center">
131
+ <NavigationMenuPrimitive.Viewport
132
+ data-slot="navigation-menu-viewport"
133
+ className={cn(
134
+ 'relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full origin-top-center overflow-hidden rounded-xl bg-popover text-popover-foreground shadow-pop duration-200 md:w-(--radix-navigation-menu-viewport-width) dark:ring-foreground/10 data-open:animate-in data-open:zoom-in-90 data-closed:animate-out data-closed:zoom-out-95',
135
+ className,
136
+ )}
137
+ {...props}
138
+ />
139
+ </div>
140
+ );
141
+ }
142
+
143
+ function NavigationMenuLink({
144
+ className,
145
+ ...props
146
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
147
+ return (
148
+ <NavigationMenuPrimitive.Link
149
+ data-slot="navigation-menu-link"
150
+ className={cn(
151
+ 'flex flex-col gap-0.5 rounded-md p-2 text-ui outline-none transition-colors duration-150 ease-decelerate',
152
+ 'hover:bg-accent hover:text-accent-foreground focus-visible:ring-3 focus-visible:ring-ring-control/35',
153
+ // the current page is not muted — it is the one you are on
154
+ 'data-[active=true]:bg-accent data-[active=true]:font-medium data-[active=true]:text-accent-foreground',
155
+ '[&_p]:text-xs [&_p]:font-normal [&_p]:text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0',
156
+ className,
157
+ )}
158
+ {...props}
159
+ />
160
+ );
161
+ }
162
+
163
+ /* The little arrow that tracks which trigger is open. */
164
+ function NavigationMenuIndicator({
165
+ className,
166
+ ...props
167
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
168
+ return (
169
+ <NavigationMenuPrimitive.Indicator
170
+ data-slot="navigation-menu-indicator"
171
+ className={cn(
172
+ 'top-full z-50 flex h-1.5 items-end justify-center overflow-hidden duration-200 data-visible:animate-in data-visible:fade-in data-hidden:animate-out data-hidden:fade-out',
173
+ className,
174
+ )}
175
+ {...props}
176
+ >
177
+ <div className="relative top-[60%] size-2 rotate-45 rounded-tl-[2px] bg-popover shadow-pop" />
178
+ </NavigationMenuPrimitive.Indicator>
179
+ );
180
+ }
181
+
182
+ export {
183
+ NavigationMenu,
184
+ NavigationMenuList,
185
+ NavigationMenuItem,
186
+ NavigationMenuContent,
187
+ NavigationMenuTrigger,
188
+ NavigationMenuLink,
189
+ NavigationMenuIndicator,
190
+ NavigationMenuViewport,
191
+ };
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
+ import { ClockIcon } from 'lucide-react';
2
3
 
3
4
  import { cn } from '@rise-x/ui/lib/utils';
5
+ import { Button } from '@rise-x/ui/components/button';
4
6
 
5
7
  /*
6
8
  * PAGE HEADER. Title, optional back-link, subtitle, actions, and tabs that sit
@@ -102,6 +104,35 @@ function PageHeaderActions({ className, ...props }: React.ComponentProps<'div'>)
102
104
  return <div data-slot="page-header-actions" className={cn('flex gap-2', className)} {...props} />;
103
105
  }
104
106
 
107
+ /* The activity affordance every app ships: one icon button, always the same
108
+ * glyph, first in PageHeaderActions. It opens the activity log as a Sheet
109
+ * sliding in from the right over the dimmed page, with its filter and search
110
+ * inside — never an inline column beside the content (see timeline.tsx).
111
+ * icon-sm because header actions are sm across the system: the header is
112
+ * chrome, and 30px keeps it denser than the content it introduces.
113
+ *
114
+ * forwardRef for the same reason button.tsx uses it: the canonical usage is
115
+ * `<SheetTrigger asChild><PageHeaderActivity /></SheetTrigger>`, and radix's
116
+ * Slot injects a ref the React 18 host would strip from a plain function. */
117
+ const PageHeaderActivity = React.forwardRef<
118
+ HTMLButtonElement,
119
+ React.ComponentPropsWithoutRef<typeof Button>
120
+ >(function PageHeaderActivity({ className, ...props }, ref) {
121
+ return (
122
+ <Button
123
+ ref={ref}
124
+ variant="outline"
125
+ size="icon-sm"
126
+ aria-label="Activity"
127
+ data-slot="page-header-activity"
128
+ className={className}
129
+ {...props}
130
+ >
131
+ <ClockIcon />
132
+ </Button>
133
+ );
134
+ });
135
+
105
136
  /* Tabs as an underline on the header rule, not a segmented control. A segmented
106
137
  * control says "filter this view"; an underlined tab says "this is a different
107
138
  * view of the same thing", which is what a page-level tab is. */
@@ -203,6 +234,7 @@ export {
203
234
  PageHeaderTitle,
204
235
  PageHeaderSubtitle,
205
236
  PageHeaderActions,
237
+ PageHeaderActivity,
206
238
  PageHeaderTabs,
207
239
  PageHeaderTab,
208
240
  Toolbar,
@@ -26,7 +26,7 @@ function PopoverContent({
26
26
  align={align}
27
27
  sideOffset={sideOffset}
28
28
  className={cn(
29
- 'z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground shadow-pop outline-hidden duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
29
+ 'z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-4 rounded-xl bg-popover p-4 text-ui text-popover-foreground shadow-pop outline-hidden duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
30
30
  className,
31
31
  )}
32
32
  {...props}
@@ -43,7 +43,7 @@ function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
43
43
  return (
44
44
  <div
45
45
  data-slot="popover-header"
46
- className={cn('flex flex-col gap-1 text-sm', className)}
46
+ className={cn('flex flex-col gap-1 text-ui', className)}
47
47
  {...props}
48
48
  />
49
49
  );