@rise-x/apps-sdk 0.6.0 → 0.8.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/README.md +192 -10
- package/build/connectors/agents.js +1 -1
- package/build/connectors/assets.d.ts +9 -3
- package/build/connectors/assets.js +32 -1
- package/build/connectors/index.d.ts +3 -2
- package/build/connectors/index.js +4 -1
- package/build/connectors/search.d.ts +34 -0
- package/build/connectors/search.js +63 -0
- package/build/connectors/types.d.ts +51 -0
- package/build/connectors/types.js +71 -0
- package/build/connectors/work.d.ts +7 -1
- package/build/connectors/work.js +13 -0
- package/build/index.d.ts +1 -1
- package/build/mockShell.d.ts +11 -0
- package/build/mockShell.js +159 -2
- package/build/query/assets.d.ts +19 -6
- package/build/query/assets.js +35 -3
- package/build/query/context.d.ts +14 -0
- package/build/query/context.js +16 -0
- package/build/query/index.d.ts +4 -3
- package/build/query/index.js +14 -2
- package/build/query/keys.d.ts +4 -0
- package/build/query/keys.js +7 -0
- package/build/query/layer.d.ts +25 -3
- package/build/query/work.d.ts +14 -1
- package/build/query/work.js +32 -1
- package/build/shellBridge.d.ts +1 -1
- package/build/ui/components/accordion.d.ts +7 -0
- package/build/ui/components/aspect-ratio.d.ts +4 -0
- package/build/ui/components/button-group.d.ts +7 -0
- package/build/ui/components/carousel.d.ts +18 -0
- package/build/ui/components/chart.d.ts +45 -94
- package/build/ui/components/collapsible.d.ts +6 -0
- package/build/ui/components/combobox.d.ts +19 -0
- package/build/ui/components/command.d.ts +18 -0
- package/build/ui/components/context-menu.d.ts +29 -0
- package/build/ui/components/data-table.d.ts +13 -2
- package/build/ui/components/date-picker.d.ts +16 -0
- package/build/ui/components/direction.d.ts +6 -0
- package/build/ui/components/field.d.ts +25 -0
- package/build/ui/components/hover-card.d.ts +6 -0
- package/build/ui/components/input-group.d.ts +13 -0
- package/build/ui/components/input-otp.d.ts +34 -0
- package/build/ui/components/input.d.ts +1 -3
- package/build/ui/components/item.d.ts +23 -0
- package/build/ui/components/kbd.d.ts +4 -0
- package/build/ui/components/menubar.d.ts +26 -0
- package/build/ui/components/message-scroller.d.ts +15 -0
- package/build/ui/components/navigation-menu.d.ts +13 -0
- package/build/ui/components/page-header.d.ts +7 -1
- package/build/ui/components/table.d.ts +7 -1
- package/build/ui/index.d.ts +19 -0
- package/build/ui/reference/components/accordion.tsx +85 -0
- package/build/ui/reference/components/alert-dialog.tsx +7 -2
- package/build/ui/reference/components/aspect-ratio.tsx +28 -0
- package/build/ui/reference/components/button-group.tsx +77 -0
- package/build/ui/reference/components/button.tsx +8 -1
- package/build/ui/reference/components/carousel.tsx +248 -0
- package/build/ui/reference/components/chart.tsx +441 -1131
- package/build/ui/reference/components/collapsible.tsx +43 -0
- package/build/ui/reference/components/combobox.tsx +141 -0
- package/build/ui/reference/components/command.tsx +181 -0
- package/build/ui/reference/components/context-menu.tsx +243 -0
- package/build/ui/reference/components/data-table.tsx +199 -29
- package/build/ui/reference/components/date-picker.tsx +218 -0
- package/build/ui/reference/components/dialog.tsx +2 -2
- package/build/ui/reference/components/direction.tsx +22 -0
- package/build/ui/reference/components/dropdown-menu.tsx +2 -2
- package/build/ui/reference/components/field.tsx +252 -0
- package/build/ui/reference/components/hover-card.tsx +64 -0
- package/build/ui/reference/components/input-group.tsx +157 -0
- package/build/ui/reference/components/input-otp.tsx +106 -0
- package/build/ui/reference/components/input.tsx +4 -32
- package/build/ui/reference/components/item.tsx +188 -0
- package/build/ui/reference/components/kbd.tsx +43 -0
- package/build/ui/reference/components/label.tsx +1 -1
- package/build/ui/reference/components/menubar.tsx +275 -0
- package/build/ui/reference/components/message-scroller.tsx +141 -0
- package/build/ui/reference/components/nav.tsx +9 -0
- package/build/ui/reference/components/navigation-menu.tsx +191 -0
- package/build/ui/reference/components/page-header.tsx +32 -0
- package/build/ui/reference/components/popover.tsx +2 -2
- package/build/ui/reference/components/select.tsx +11 -8
- package/build/ui/reference/components/sheet.tsx +14 -3
- package/build/ui/reference/components/table.tsx +15 -2
- package/build/ui/reference/components/timeline.tsx +7 -0
- package/build/ui/reference/components/toggle.tsx +1 -1
- package/build/ui/reference/index.ts +19 -0
- package/build/ui/standalone.js +167 -28
- package/build/ui/styles.css +1 -1
- package/package.json +15 -9
- package/template/README.md +6 -0
- package/template/src/App.tsx +10 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Menubar as MenubarPrimitive } from 'radix-ui';
|
|
3
|
+
declare function Menubar({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function MenubarMenu({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Menu>): React.JSX.Element;
|
|
5
|
+
declare function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>): React.JSX.Element;
|
|
6
|
+
declare function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>): React.JSX.Element;
|
|
7
|
+
declare function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>): React.JSX.Element;
|
|
8
|
+
declare function MenubarSub({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Sub>): React.JSX.Element;
|
|
9
|
+
declare function MenubarTrigger({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
declare function MenubarContent({ className, align, alignOffset, sideOffset, ...props }: React.ComponentProps<typeof MenubarPrimitive.Content>): React.JSX.Element;
|
|
11
|
+
declare function MenubarItem({ className, inset, variant, ...props }: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
12
|
+
inset?: boolean;
|
|
13
|
+
variant?: 'default' | 'destructive';
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
declare function MenubarCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>): React.JSX.Element;
|
|
16
|
+
declare function MenubarRadioItem({ className, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>): React.JSX.Element;
|
|
17
|
+
declare function MenubarLabel({ className, inset, ...props }: React.ComponentProps<typeof MenubarPrimitive.Label> & {
|
|
18
|
+
inset?: boolean;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare function MenubarSeparator({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Separator>): React.JSX.Element;
|
|
21
|
+
declare function MenubarShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
22
|
+
declare function MenubarSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
|
|
23
|
+
inset?: boolean;
|
|
24
|
+
}): React.JSX.Element;
|
|
25
|
+
declare function MenubarSubContent({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.SubContent>): React.JSX.Element;
|
|
26
|
+
export { Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarGroup, MenubarPortal, MenubarLabel, MenubarItem, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubTrigger, MenubarSubContent, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const MessageScroller: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
/** Bump this whenever a message is appended — it is what triggers the stick. */
|
|
4
|
+
revision?: number | string;
|
|
5
|
+
/** Shown on the jump affordance while the reader is away from the bottom. */
|
|
6
|
+
unreadCount?: number;
|
|
7
|
+
/** Label for the jump affordance when no count is given. */
|
|
8
|
+
jumpLabel?: string;
|
|
9
|
+
/** Label when `unreadCount` is set. Override to localise — the built-in
|
|
10
|
+
* default is English with an English plural rule, and it is the form that
|
|
11
|
+
* actually shows once a count exists, so `jumpLabel` alone cannot carry a
|
|
12
|
+
* translation. */
|
|
13
|
+
formatUnread?: (count: number) => string;
|
|
14
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export { MessageScroller };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
|
|
3
|
+
declare function NavigationMenu({ className, children, viewport, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
|
|
4
|
+
viewport?: boolean;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function NavigationMenuList({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.List>): React.JSX.Element;
|
|
7
|
+
declare function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>): React.JSX.Element;
|
|
8
|
+
declare function NavigationMenuTrigger({ className, children, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>): React.JSX.Element;
|
|
9
|
+
declare function NavigationMenuContent({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>): React.JSX.Element;
|
|
10
|
+
declare function NavigationMenuViewport({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>): React.JSX.Element;
|
|
11
|
+
declare function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>): React.JSX.Element;
|
|
12
|
+
declare function NavigationMenuIndicator({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>): React.JSX.Element;
|
|
13
|
+
export { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuContent, NavigationMenuTrigger, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, };
|
|
@@ -15,6 +15,12 @@ declare function PageHeaderBack({ className, children, ...props }: React.Compone
|
|
|
15
15
|
declare function PageHeaderTitle({ className, ...props }: React.ComponentProps<'h1'>): React.JSX.Element;
|
|
16
16
|
declare function PageHeaderSubtitle({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
|
|
17
17
|
declare function PageHeaderActions({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
18
|
+
declare const PageHeaderActivity: React.ForwardRefExoticComponent<Omit<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & import("class-variance-authority").VariantProps<(props?: ({
|
|
19
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "tint" | "tint-brand" | "destructive" | "destructive-solid" | "brand" | "dashed" | "pill" | null | undefined;
|
|
20
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
21
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
22
|
+
asChild?: boolean;
|
|
23
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
24
|
declare function PageHeaderTabs({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
19
25
|
declare function PageHeaderTab({ className, selected, ...props }: React.ComponentProps<'button'> & {
|
|
20
26
|
selected?: boolean;
|
|
@@ -24,4 +30,4 @@ declare function ToolbarEnd({ className, ...props }: React.ComponentProps<'div'>
|
|
|
24
30
|
declare function ToolbarSeparator({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
25
31
|
declare function Breadcrumbs({ className, ...props }: React.ComponentProps<'nav'>): React.JSX.Element;
|
|
26
32
|
declare function BreadcrumbSeparator({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
27
|
-
export { PageHeader, PageHeaderRow, PageHeaderBack, PageHeaderTitle, PageHeaderSubtitle, PageHeaderActions, PageHeaderTabs, PageHeaderTab, Toolbar, ToolbarEnd, ToolbarSeparator, Breadcrumbs, BreadcrumbSeparator, };
|
|
33
|
+
export { PageHeader, PageHeaderRow, PageHeaderBack, PageHeaderTitle, PageHeaderSubtitle, PageHeaderActions, PageHeaderActivity, PageHeaderTabs, PageHeaderTab, Toolbar, ToolbarEnd, ToolbarSeparator, Breadcrumbs, BreadcrumbSeparator, };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
declare function Table({ className, ...props }: React.ComponentProps<'table'>
|
|
2
|
+
declare function Table({ className, containerClassName, ...props }: React.ComponentProps<'table'> & {
|
|
3
|
+
/** Extends the scroll container the table always renders inside. Sticky
|
|
4
|
+
* headers pin to THIS element, so a vertically scrolling table puts its
|
|
5
|
+
* max-height + overflow-y here — an outer scroll div never receives the
|
|
6
|
+
* stick. */
|
|
7
|
+
containerClassName?: string;
|
|
8
|
+
}): React.JSX.Element;
|
|
3
9
|
declare function TableWrap({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
4
10
|
declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): React.JSX.Element;
|
|
5
11
|
declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): React.JSX.Element;
|
package/build/ui/index.d.ts
CHANGED
|
@@ -1,24 +1,43 @@
|
|
|
1
|
+
export * from './components/accordion';
|
|
1
2
|
export * from './components/ai';
|
|
2
3
|
export * from './components/alert';
|
|
3
4
|
export * from './components/alert-dialog';
|
|
5
|
+
export * from './components/aspect-ratio';
|
|
4
6
|
export * from './components/avatar';
|
|
5
7
|
export * from './components/badge';
|
|
6
8
|
export * from './components/button';
|
|
9
|
+
export * from './components/button-group';
|
|
7
10
|
export * from './components/calendar';
|
|
8
11
|
export * from './components/card';
|
|
12
|
+
export * from './components/carousel';
|
|
9
13
|
export * from './components/chart';
|
|
10
14
|
export * from './components/checkbox';
|
|
15
|
+
export * from './components/collapsible';
|
|
16
|
+
export * from './components/combobox';
|
|
17
|
+
export * from './components/command';
|
|
18
|
+
export * from './components/context-menu';
|
|
11
19
|
export * from './components/data-table';
|
|
20
|
+
export * from './components/date-picker';
|
|
12
21
|
export * from './components/dialog';
|
|
22
|
+
export * from './components/direction';
|
|
13
23
|
export * from './components/dropdown-menu';
|
|
14
24
|
export * from './components/empty-state';
|
|
25
|
+
export * from './components/field';
|
|
15
26
|
export * from './components/file-upload';
|
|
27
|
+
export * from './components/hover-card';
|
|
16
28
|
export * from './components/input';
|
|
29
|
+
export * from './components/input-group';
|
|
30
|
+
export * from './components/input-otp';
|
|
31
|
+
export * from './components/item';
|
|
32
|
+
export * from './components/kbd';
|
|
17
33
|
export * from './components/label';
|
|
18
34
|
export * from './components/list';
|
|
19
35
|
export * from './components/map';
|
|
36
|
+
export * from './components/menubar';
|
|
20
37
|
export * from './components/message';
|
|
38
|
+
export * from './components/message-scroller';
|
|
21
39
|
export * from './components/nav';
|
|
40
|
+
export * from './components/navigation-menu';
|
|
22
41
|
export * from './components/page-header';
|
|
23
42
|
export * from './components/popover';
|
|
24
43
|
export * from './components/progress';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Accordion as AccordionPrimitive } from 'radix-ui';
|
|
5
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Progressive disclosure for a list of sections. The trigger is the whole row —
|
|
11
|
+
* a chevron you have to hit is a target the size of a full stop.
|
|
12
|
+
*
|
|
13
|
+
* THE CONTAINER OWNS THE DIVIDERS, drawn between items rather than as a border
|
|
14
|
+
* on every row: a top-and-bottom border doubles up at every seam. Same rule as
|
|
15
|
+
* List, and the same reason.
|
|
16
|
+
*
|
|
17
|
+
* NO SURFACE OF ITS OWN by default. An accordion inside a card is already on a
|
|
18
|
+
* surface, and wrapping each item in another one produces a box in a box. Pass
|
|
19
|
+
* `bordered` for the standalone case where the group needs to read as one object.
|
|
20
|
+
*/
|
|
21
|
+
function Accordion({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
22
|
+
return <AccordionPrimitive.Root data-slot="accordion" className={cn(className)} {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function AccordionItem({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
29
|
+
return (
|
|
30
|
+
<AccordionPrimitive.Item
|
|
31
|
+
data-slot="accordion-item"
|
|
32
|
+
className={cn('border-t border-border-subtle first:border-t-0', className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function AccordionTrigger({
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
43
|
+
return (
|
|
44
|
+
<AccordionPrimitive.Header className="flex">
|
|
45
|
+
<AccordionPrimitive.Trigger
|
|
46
|
+
data-slot="accordion-trigger"
|
|
47
|
+
className={cn(
|
|
48
|
+
'flex flex-1 cursor-pointer items-center gap-2.5 border-0 bg-transparent py-3 text-left text-ui font-medium outline-none transition-colors duration-150 ease-decelerate',
|
|
49
|
+
'hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring-control/35',
|
|
50
|
+
// the chevron turns rather than swapping glyph: one mark, one meaning
|
|
51
|
+
'[&>svg]:size-3.5 [&>svg]:shrink-0 [&>svg]:text-muted-foreground [&>svg]:transition-transform [&>svg]:duration-200 [&>svg]:ease-decelerate',
|
|
52
|
+
'data-open:[&>svg]:rotate-180',
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
<span className="min-w-0 flex-1">{children}</span>
|
|
58
|
+
<ChevronDownIcon aria-hidden />
|
|
59
|
+
</AccordionPrimitive.Trigger>
|
|
60
|
+
</AccordionPrimitive.Header>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function AccordionContent({
|
|
65
|
+
className,
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
69
|
+
return (
|
|
70
|
+
<AccordionPrimitive.Content
|
|
71
|
+
data-slot="accordion-content"
|
|
72
|
+
className={cn(
|
|
73
|
+
'overflow-hidden text-xs text-muted-foreground',
|
|
74
|
+
'data-open:animate-accordion-down data-closed:animate-accordion-up',
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{/* padding on an inner element, not the animated one — animating a box
|
|
79
|
+
whose own padding is part of the measured height stutters at both ends */}
|
|
80
|
+
<div className={cn('pb-3', className)}>{children}</div>
|
|
81
|
+
</AccordionPrimitive.Content>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -67,7 +67,12 @@ const AlertDialogContent = React.forwardRef<
|
|
|
67
67
|
data-slot="alert-dialog-content"
|
|
68
68
|
data-size={size}
|
|
69
69
|
className={cn(
|
|
70
|
-
'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-2xl bg-popover p-6 text-popover-foreground shadow-pop duration-100 outline-none data-
|
|
70
|
+
'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-2xl bg-popover p-6 text-popover-foreground shadow-pop duration-100 outline-none 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',
|
|
71
|
+
/* min() folds dialog.tsx's viewport-gutter clamp into the size cap —
|
|
72
|
+
* a separate bare max-w-* would lose to these data-variants on
|
|
73
|
+
* specificity, and without it the xs cap sits flush against the
|
|
74
|
+
* screen edge on viewports at or under 320px. */
|
|
75
|
+
'data-[size=default]:max-w-[min(var(--container-xs),calc(100%-(var(--spacing)*8)))] data-[size=sm]:max-w-[min(var(--container-xs),calc(100%-(var(--spacing)*8)))] data-[size=default]:sm:max-w-md',
|
|
71
76
|
className,
|
|
72
77
|
)}
|
|
73
78
|
{...props}
|
|
@@ -150,7 +155,7 @@ const AlertDialogDescription = React.forwardRef<
|
|
|
150
155
|
ref={ref}
|
|
151
156
|
data-slot="alert-dialog-description"
|
|
152
157
|
className={cn(
|
|
153
|
-
'text-
|
|
158
|
+
'text-ui text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
|
|
154
159
|
className,
|
|
155
160
|
)}
|
|
156
161
|
{...props}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AspectRatio as AspectRatioPrimitive } from 'radix-ui';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Holds a box at a fixed ratio so media cannot shift the layout while it loads.
|
|
8
|
+
* Deliberately carries no surface, radius or border of its own — the caller
|
|
9
|
+
* decides whether the thing inside is a thumbnail (10px) or a card (14px), and a
|
|
10
|
+
* radius here would clip at the wrong step.
|
|
11
|
+
*
|
|
12
|
+
* Use `MediaThumb` instead for a fixed-size square in a gallery; this is for the
|
|
13
|
+
* responsive case where the width is unknown and only the ratio is fixed.
|
|
14
|
+
*/
|
|
15
|
+
function AspectRatio({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
19
|
+
return (
|
|
20
|
+
<AspectRatioPrimitive.Root
|
|
21
|
+
data-slot="aspect-ratio"
|
|
22
|
+
className={cn('[&>img]:size-full [&>img]:object-cover [&>video]:size-full', className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { AspectRatio };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Buttons that act as ONE control — a split action, or a segmented set of
|
|
7
|
+
* commands. Distinct from ToggleGroup, which records a selection: a button group
|
|
8
|
+
* fires actions and remembers nothing.
|
|
9
|
+
*
|
|
10
|
+
* BORDERS ARE SHARED, NOT DOUBLED. The group collapses the edge where two
|
|
11
|
+
* children meet and keeps the radius only on the outer corners, so a row of three
|
|
12
|
+
* reads as one object rather than three adjacent buttons — the same arithmetic
|
|
13
|
+
* InputGroup uses for its affixes, and the same reason.
|
|
14
|
+
*
|
|
15
|
+
* The children keep their own variant. A group of `outline` buttons and a group
|
|
16
|
+
* of `secondary` ones both work; mixing variants inside one group does not, and
|
|
17
|
+
* that is a call site problem rather than something to guard here.
|
|
18
|
+
*/
|
|
19
|
+
function ButtonGroup({
|
|
20
|
+
className,
|
|
21
|
+
orientation = 'horizontal',
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<'div'> & { orientation?: 'horizontal' | 'vertical' }) {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
data-slot="button-group"
|
|
27
|
+
data-orientation={orientation}
|
|
28
|
+
role="group"
|
|
29
|
+
className={cn(
|
|
30
|
+
'inline-flex w-fit',
|
|
31
|
+
'data-horizontal:flex-row data-vertical:flex-col data-vertical:items-stretch',
|
|
32
|
+
// inner radii collapse; only the outer corners survive
|
|
33
|
+
'data-horizontal:[&>*:not(:first-child)]:rounded-l-none data-horizontal:[&>*:not(:last-child)]:rounded-r-none',
|
|
34
|
+
'data-vertical:[&>*:not(:first-child)]:rounded-t-none data-vertical:[&>*:not(:last-child)]:rounded-b-none',
|
|
35
|
+
// and the shared edge is drawn once
|
|
36
|
+
'data-horizontal:[&>*:not(:first-child)]:border-l-0 data-vertical:[&>*:not(:first-child)]:border-t-0',
|
|
37
|
+
// a focused member has to sit above its neighbour or the ring is clipped
|
|
38
|
+
'[&>*]:relative [&>*:focus-visible]:z-10',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
* A non-interactive label inside the group — a unit, a count, a static prefix.
|
|
48
|
+
* Matches the control height so the group keeps one baseline, and takes the muted
|
|
49
|
+
* tone because it is not pressable and must not look it.
|
|
50
|
+
*/
|
|
51
|
+
function ButtonGroupText({ className, ...props }: React.ComponentProps<'span'>) {
|
|
52
|
+
return (
|
|
53
|
+
<span
|
|
54
|
+
data-slot="button-group-text"
|
|
55
|
+
className={cn(
|
|
56
|
+
'inline-flex h-control shrink-0 items-center border border-border-strong bg-muted px-2.5 text-ui text-muted-foreground',
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Hairline between two members of a FILLED group, where there are no borders to
|
|
65
|
+
* share. Owned by the group, like every other separator in the system. */
|
|
66
|
+
function ButtonGroupSeparator({ className, ...props }: React.ComponentProps<'span'>) {
|
|
67
|
+
return (
|
|
68
|
+
<span
|
|
69
|
+
data-slot="button-group-separator"
|
|
70
|
+
aria-hidden
|
|
71
|
+
className={cn('w-px shrink-0 self-stretch bg-fill-3', className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { ButtonGroup, ButtonGroupText, ButtonGroupSeparator };
|
|
@@ -43,8 +43,15 @@ const buttonVariants = cva(
|
|
|
43
43
|
/* Filter trigger. Two states that must be told apart at a glance:
|
|
44
44
|
* empty = dashed outline + muted label ("a slot you could fill"),
|
|
45
45
|
* applied = solid fill, no dash, full-strength label. */
|
|
46
|
+
/* The applied state has TWO hooks on purpose. `aria-pressed` fits a
|
|
47
|
+
* filter trigger, which is genuinely a toggle. `data-filled` is for
|
|
48
|
+
* slots that are filled rather than pressed — a file picker opens a
|
|
49
|
+
* dialog, so claiming a pressed state there announces a control that
|
|
50
|
+
* does not exist. One deliberate difference: `data-filled` keeps the
|
|
51
|
+
* leading glyph. A filter's "+" stops making sense once applied; an
|
|
52
|
+
* upload glyph still describes the control after a file is chosen. */
|
|
46
53
|
dashed:
|
|
47
|
-
'border-dashed border-border-strong text-muted-foreground hover:bg-fill-1 hover:text-foreground aria-pressed:border-solid aria-pressed:border-transparent aria-pressed:bg-fill-2 aria-pressed:text-foreground aria-pressed:hover:bg-fill-3 aria-pressed:[&>svg:first-child]:hidden',
|
|
54
|
+
'border-dashed border-border-strong text-muted-foreground hover:bg-fill-1 hover:text-foreground aria-pressed:border-solid aria-pressed:border-transparent aria-pressed:bg-fill-2 aria-pressed:text-foreground aria-pressed:hover:bg-fill-3 aria-pressed:[&>svg:first-child]:hidden data-filled:border-solid data-filled:border-transparent data-filled:bg-fill-2 data-filled:text-foreground data-filled:hover:bg-fill-3',
|
|
48
55
|
/* Rise-X wireframe pill — white surface, soft shadow, fully rounded. */
|
|
49
56
|
pill: 'rounded-full border-border/60 bg-card text-card-foreground shadow-pill hover:shadow-card aria-expanded:shadow-card',
|
|
50
57
|
},
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
|
|
5
|
+
import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
8
|
+
import { Button } from '@rise-x/ui/components/button';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* A horizontal (or vertical) slider for media and cards.
|
|
12
|
+
*
|
|
13
|
+
* READ THIS BEFORE USING IT IN AN ENTERPRISE VIEW. A carousel hides content
|
|
14
|
+
* behind an interaction, which is the opposite of data-first: anything the reader
|
|
15
|
+
* needs to compare must not be in one. It earns its place for media — product
|
|
16
|
+
* photos, scanned pages, a document preview — and for a genuinely browsable strip
|
|
17
|
+
* where seeing everything at once is not the point. For a set of records, a
|
|
18
|
+
* wrapping grid or a table is the right answer and this is the wrong one.
|
|
19
|
+
*
|
|
20
|
+
* NO AUTOPLAY, DELIBERATELY. Content that moves on its own competes for attention
|
|
21
|
+
* with the work, and it is a documented accessibility failure for anyone who reads
|
|
22
|
+
* slowly. If a caller wants it they can pass the Embla plugin themselves and own
|
|
23
|
+
* that decision.
|
|
24
|
+
*
|
|
25
|
+
* THE ARROWS ARE ALWAYS RENDERED AND DISABLE AT THE ENDS rather than disappearing.
|
|
26
|
+
* A control that vanishes tells the reader nothing about why; a disabled one says
|
|
27
|
+
* "this is the end". Same reason the filter trigger keeps its shape when empty.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
31
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
32
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
33
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
34
|
+
|
|
35
|
+
type CarouselContextValue = {
|
|
36
|
+
carouselRef: UseEmblaCarouselType[0];
|
|
37
|
+
api: CarouselApi;
|
|
38
|
+
orientation: 'horizontal' | 'vertical';
|
|
39
|
+
scrollPrev: () => void;
|
|
40
|
+
scrollNext: () => void;
|
|
41
|
+
canScrollPrev: boolean;
|
|
42
|
+
canScrollNext: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const CarouselContext = React.createContext<CarouselContextValue | null>(null);
|
|
46
|
+
|
|
47
|
+
function useCarousel() {
|
|
48
|
+
const context = React.useContext(CarouselContext);
|
|
49
|
+
if (!context) {
|
|
50
|
+
throw new Error('useCarousel must be used within a <Carousel />');
|
|
51
|
+
}
|
|
52
|
+
return context;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const Carousel = React.forwardRef<
|
|
56
|
+
HTMLDivElement,
|
|
57
|
+
React.ComponentProps<'div'> & {
|
|
58
|
+
opts?: CarouselOptions;
|
|
59
|
+
plugins?: CarouselPlugin;
|
|
60
|
+
orientation?: 'horizontal' | 'vertical';
|
|
61
|
+
setApi?: (api: CarouselApi) => void;
|
|
62
|
+
}
|
|
63
|
+
>(function Carousel(
|
|
64
|
+
{ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props },
|
|
65
|
+
ref,
|
|
66
|
+
) {
|
|
67
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
68
|
+
{ ...opts, axis: orientation === 'horizontal' ? 'x' : 'y' },
|
|
69
|
+
plugins,
|
|
70
|
+
);
|
|
71
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
72
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
73
|
+
|
|
74
|
+
const onSelect = React.useCallback((emblaApi: CarouselApi) => {
|
|
75
|
+
if (!emblaApi) return;
|
|
76
|
+
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
77
|
+
setCanScrollNext(emblaApi.canScrollNext());
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
const scrollPrev = React.useCallback(() => api?.scrollPrev(), [api]);
|
|
81
|
+
const scrollNext = React.useCallback(() => api?.scrollNext(), [api]);
|
|
82
|
+
|
|
83
|
+
/* The arrow keys match the AXIS — left/right for a horizontal strip, up/down
|
|
84
|
+
* for a vertical one — and a control inside a slide keeps its own arrows: on
|
|
85
|
+
* the capture phase an unconditional preventDefault would take the caret keys
|
|
86
|
+
* away from a text field and the option keys away from a select. */
|
|
87
|
+
const handleKeyDown = React.useCallback(
|
|
88
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
89
|
+
const target = event.target as HTMLElement | null;
|
|
90
|
+
if (target?.closest('input, textarea, select, [contenteditable=""], [contenteditable=true]'))
|
|
91
|
+
return;
|
|
92
|
+
const [prevKey, nextKey] =
|
|
93
|
+
orientation === 'horizontal' ? ['ArrowLeft', 'ArrowRight'] : ['ArrowUp', 'ArrowDown'];
|
|
94
|
+
if (event.key === prevKey) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
scrollPrev();
|
|
97
|
+
} else if (event.key === nextKey) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
scrollNext();
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[orientation, scrollPrev, scrollNext],
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
if (api && setApi) setApi(api);
|
|
107
|
+
}, [api, setApi]);
|
|
108
|
+
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
if (!api) return;
|
|
111
|
+
onSelect(api);
|
|
112
|
+
api.on('reInit', onSelect);
|
|
113
|
+
api.on('select', onSelect);
|
|
114
|
+
return () => {
|
|
115
|
+
api.off('reInit', onSelect);
|
|
116
|
+
api.off('select', onSelect);
|
|
117
|
+
};
|
|
118
|
+
}, [api, onSelect]);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<CarouselContext.Provider
|
|
122
|
+
value={{
|
|
123
|
+
carouselRef,
|
|
124
|
+
api,
|
|
125
|
+
orientation,
|
|
126
|
+
scrollPrev,
|
|
127
|
+
scrollNext,
|
|
128
|
+
canScrollPrev,
|
|
129
|
+
canScrollNext,
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
<div
|
|
133
|
+
ref={ref}
|
|
134
|
+
data-slot="carousel"
|
|
135
|
+
onKeyDownCapture={handleKeyDown}
|
|
136
|
+
className={cn('relative', className)}
|
|
137
|
+
role="region"
|
|
138
|
+
aria-roledescription="carousel"
|
|
139
|
+
{...props}
|
|
140
|
+
>
|
|
141
|
+
{children}
|
|
142
|
+
</div>
|
|
143
|
+
</CarouselContext.Provider>
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
148
|
+
const { carouselRef, orientation } = useCarousel();
|
|
149
|
+
return (
|
|
150
|
+
<div ref={carouselRef} data-slot="carousel-viewport" className="overflow-hidden">
|
|
151
|
+
<div
|
|
152
|
+
data-slot="carousel-content"
|
|
153
|
+
className={cn(
|
|
154
|
+
'flex',
|
|
155
|
+
// negative margin plus per-item padding is how Embla spaces slides —
|
|
156
|
+
// a gap would be measured into the scroll distance and drift
|
|
157
|
+
orientation === 'horizontal' ? '-ml-2.5' : '-mt-2.5 flex-col',
|
|
158
|
+
className,
|
|
159
|
+
)}
|
|
160
|
+
{...props}
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
|
167
|
+
const { orientation } = useCarousel();
|
|
168
|
+
return (
|
|
169
|
+
<div
|
|
170
|
+
data-slot="carousel-item"
|
|
171
|
+
role="group"
|
|
172
|
+
aria-roledescription="slide"
|
|
173
|
+
className={cn(
|
|
174
|
+
'min-w-0 shrink-0 grow-0 basis-full',
|
|
175
|
+
orientation === 'horizontal' ? 'pl-2.5' : 'pt-2.5',
|
|
176
|
+
className,
|
|
177
|
+
)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function CarouselPrevious({
|
|
184
|
+
className,
|
|
185
|
+
variant = 'outline',
|
|
186
|
+
size = 'icon-sm',
|
|
187
|
+
...props
|
|
188
|
+
}: React.ComponentProps<typeof Button>) {
|
|
189
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
190
|
+
return (
|
|
191
|
+
<Button
|
|
192
|
+
data-slot="carousel-previous"
|
|
193
|
+
variant={variant}
|
|
194
|
+
size={size}
|
|
195
|
+
className={cn(
|
|
196
|
+
'absolute rounded-full',
|
|
197
|
+
orientation === 'horizontal'
|
|
198
|
+
? 'top-1/2 -left-3.5 -translate-y-1/2'
|
|
199
|
+
: '-top-3.5 left-1/2 -translate-x-1/2 rotate-90',
|
|
200
|
+
className,
|
|
201
|
+
)}
|
|
202
|
+
disabled={!canScrollPrev}
|
|
203
|
+
onClick={scrollPrev}
|
|
204
|
+
{...props}
|
|
205
|
+
>
|
|
206
|
+
<ArrowLeftIcon />
|
|
207
|
+
<span className="sr-only">Previous slide</span>
|
|
208
|
+
</Button>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function CarouselNext({
|
|
213
|
+
className,
|
|
214
|
+
variant = 'outline',
|
|
215
|
+
size = 'icon-sm',
|
|
216
|
+
...props
|
|
217
|
+
}: React.ComponentProps<typeof Button>) {
|
|
218
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
219
|
+
return (
|
|
220
|
+
<Button
|
|
221
|
+
data-slot="carousel-next"
|
|
222
|
+
variant={variant}
|
|
223
|
+
size={size}
|
|
224
|
+
className={cn(
|
|
225
|
+
'absolute rounded-full',
|
|
226
|
+
orientation === 'horizontal'
|
|
227
|
+
? 'top-1/2 -right-3.5 -translate-y-1/2'
|
|
228
|
+
: '-bottom-3.5 left-1/2 -translate-x-1/2 rotate-90',
|
|
229
|
+
className,
|
|
230
|
+
)}
|
|
231
|
+
disabled={!canScrollNext}
|
|
232
|
+
onClick={scrollNext}
|
|
233
|
+
{...props}
|
|
234
|
+
>
|
|
235
|
+
<ArrowRightIcon />
|
|
236
|
+
<span className="sr-only">Next slide</span>
|
|
237
|
+
</Button>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export {
|
|
242
|
+
type CarouselApi,
|
|
243
|
+
Carousel,
|
|
244
|
+
CarouselContent,
|
|
245
|
+
CarouselItem,
|
|
246
|
+
CarouselPrevious,
|
|
247
|
+
CarouselNext,
|
|
248
|
+
};
|