@rise-x/apps-sdk 0.8.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +209 -21
  2. package/build/rsbuild/index.d.ts +36 -0
  3. package/build/rsbuild/index.js +225 -0
  4. package/build/ui/classes.json +209 -0
  5. package/build/ui/components/ai.d.ts +33 -1
  6. package/build/ui/components/app-frame.d.ts +19 -0
  7. package/build/ui/components/chat-input.d.ts +28 -0
  8. package/build/ui/components/message-scroller.d.ts +34 -10
  9. package/build/ui/components/nav.d.ts +2 -1
  10. package/build/ui/components/sheet.d.ts +10 -0
  11. package/build/ui/components/thinking-rings.d.ts +4 -0
  12. package/build/ui/demo.html +26794 -0
  13. package/build/ui/index.d.ts +3 -0
  14. package/build/ui/standalone.js +59 -58
  15. package/build/ui/styles.css +1 -1
  16. package/package.json +24 -3
  17. package/rsbuild/package.json +8 -0
  18. package/template/AGENTS.md +18 -10
  19. package/template/README.md +5 -5
  20. package/template/package.json +8 -9
  21. package/template/rsbuild.config.mts +17 -0
  22. package/template/src/App.tsx +21 -11
  23. package/template/tsconfig.json +3 -1
  24. package/build/ui/reference/README.md +0 -11
  25. package/build/ui/reference/components/accordion.tsx +0 -85
  26. package/build/ui/reference/components/ai.tsx +0 -291
  27. package/build/ui/reference/components/alert-dialog.tsx +0 -213
  28. package/build/ui/reference/components/alert.tsx +0 -112
  29. package/build/ui/reference/components/aspect-ratio.tsx +0 -28
  30. package/build/ui/reference/components/avatar.tsx +0 -158
  31. package/build/ui/reference/components/badge.tsx +0 -160
  32. package/build/ui/reference/components/button-group.tsx +0 -77
  33. package/build/ui/reference/components/button.tsx +0 -107
  34. package/build/ui/reference/components/calendar.tsx +0 -119
  35. package/build/ui/reference/components/card.tsx +0 -144
  36. package/build/ui/reference/components/carousel.tsx +0 -248
  37. package/build/ui/reference/components/chart.tsx +0 -704
  38. package/build/ui/reference/components/checkbox.tsx +0 -44
  39. package/build/ui/reference/components/collapsible.tsx +0 -43
  40. package/build/ui/reference/components/combobox.tsx +0 -141
  41. package/build/ui/reference/components/command.tsx +0 -181
  42. package/build/ui/reference/components/context-menu.tsx +0 -243
  43. package/build/ui/reference/components/data-table.tsx +0 -650
  44. package/build/ui/reference/components/date-picker.tsx +0 -218
  45. package/build/ui/reference/components/dialog.tsx +0 -172
  46. package/build/ui/reference/components/direction.tsx +0 -22
  47. package/build/ui/reference/components/dropdown-menu.tsx +0 -245
  48. package/build/ui/reference/components/empty-state.tsx +0 -63
  49. package/build/ui/reference/components/field.tsx +0 -252
  50. package/build/ui/reference/components/file-upload.tsx +0 -116
  51. package/build/ui/reference/components/hover-card.tsx +0 -64
  52. package/build/ui/reference/components/input-group.tsx +0 -157
  53. package/build/ui/reference/components/input-otp.tsx +0 -106
  54. package/build/ui/reference/components/input.tsx +0 -86
  55. package/build/ui/reference/components/item.tsx +0 -188
  56. package/build/ui/reference/components/kbd.tsx +0 -43
  57. package/build/ui/reference/components/label.tsx +0 -19
  58. package/build/ui/reference/components/list.tsx +0 -191
  59. package/build/ui/reference/components/map.css +0 -251
  60. package/build/ui/reference/components/map.tsx +0 -294
  61. package/build/ui/reference/components/menubar.tsx +0 -275
  62. package/build/ui/reference/components/message-scroller.tsx +0 -141
  63. package/build/ui/reference/components/message.tsx +0 -171
  64. package/build/ui/reference/components/nav.tsx +0 -122
  65. package/build/ui/reference/components/navigation-menu.tsx +0 -191
  66. package/build/ui/reference/components/page-header.tsx +0 -245
  67. package/build/ui/reference/components/popover.tsx +0 -76
  68. package/build/ui/reference/components/progress.tsx +0 -31
  69. package/build/ui/reference/components/radio.tsx +0 -65
  70. package/build/ui/reference/components/resizable.tsx +0 -40
  71. package/build/ui/reference/components/scroll-area.tsx +0 -55
  72. package/build/ui/reference/components/segmented.tsx +0 -45
  73. package/build/ui/reference/components/select.tsx +0 -188
  74. package/build/ui/reference/components/separator.tsx +0 -26
  75. package/build/ui/reference/components/sheet.tsx +0 -184
  76. package/build/ui/reference/components/skeleton.tsx +0 -15
  77. package/build/ui/reference/components/slider.tsx +0 -161
  78. package/build/ui/reference/components/snackbar.tsx +0 -27
  79. package/build/ui/reference/components/sonner.tsx +0 -43
  80. package/build/ui/reference/components/spinner.tsx +0 -27
  81. package/build/ui/reference/components/statistic.tsx +0 -122
  82. package/build/ui/reference/components/stepper.tsx +0 -138
  83. package/build/ui/reference/components/switch.tsx +0 -47
  84. package/build/ui/reference/components/table.tsx +0 -246
  85. package/build/ui/reference/components/textarea.tsx +0 -28
  86. package/build/ui/reference/components/timeline.tsx +0 -101
  87. package/build/ui/reference/components/toggle-group.tsx +0 -86
  88. package/build/ui/reference/components/toggle.tsx +0 -46
  89. package/build/ui/reference/components/tooltip.tsx +0 -53
  90. package/build/ui/reference/index.ts +0 -68
  91. package/build/ui/reference/lib/utils.ts +0 -34
  92. package/template/webpack.config.js +0 -112
  93. package/template/webpack.local.config.js +0 -68
@@ -1,44 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { Checkbox as CheckboxPrimitive } from 'radix-ui';
5
- import { CheckIcon, MinusIcon } from 'lucide-react';
6
-
7
- import { cn } from '@rise-x/ui/lib/utils';
8
-
9
- /*
10
- * 15px box, 4px radius. Checked fills with `primary` — near-black, not brand.
11
- * In a table, twenty checked rows in brand green swamp everything else on
12
- * screen, and "selected" is a neutral fact about the row rather than an
13
- * affirmative one about the data. Focus uses the neutral control ring.
14
- */
15
- function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
16
- return (
17
- <CheckboxPrimitive.Root
18
- data-slot="checkbox"
19
- className={cn(
20
- 'peer size-[15px] shrink-0 rounded-[4px] border border-input bg-card transition-[background-color,border-color] duration-100 outline-none',
21
- 'focus-visible:ring-3 focus-visible:ring-ring-control/35',
22
- 'disabled:cursor-not-allowed disabled:opacity-45',
23
- 'aria-invalid:border-error aria-invalid:ring-3 aria-invalid:ring-error/20',
24
- 'data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground',
25
- 'data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground',
26
- className,
27
- )}
28
- {...props}
29
- >
30
- <CheckboxPrimitive.Indicator
31
- data-slot="checkbox-indicator"
32
- className="grid place-content-center text-current"
33
- >
34
- {props.checked === 'indeterminate' ? (
35
- <MinusIcon className="size-2.5 stroke-[3.5]" />
36
- ) : (
37
- <CheckIcon className="size-2.5 stroke-[3.5]" />
38
- )}
39
- </CheckboxPrimitive.Indicator>
40
- </CheckboxPrimitive.Root>
41
- );
42
- }
43
-
44
- export { Checkbox };
@@ -1,43 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { Collapsible as CollapsiblePrimitive } from 'radix-ui';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
-
8
- /*
9
- * A single disclosure, where Accordion is a set of them. Unstyled on purpose —
10
- * it is a mechanism, not a surface: the trigger is whatever the caller puts in
11
- * it, and adding a border or a fill here would fight every context it lands in.
12
- *
13
- * Reach for `AiExplain` instead when the thing being disclosed is AI reasoning;
14
- * that one is a `<details>` so it survives with JavaScript disabled and carries
15
- * the AI grammar.
16
- */
17
- function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
18
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
19
- }
20
-
21
- function CollapsibleTrigger({
22
- ...props
23
- }: React.ComponentProps<typeof CollapsiblePrimitive.Trigger>) {
24
- return <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />;
25
- }
26
-
27
- function CollapsibleContent({
28
- className,
29
- ...props
30
- }: React.ComponentProps<typeof CollapsiblePrimitive.Content>) {
31
- return (
32
- <CollapsiblePrimitive.Content
33
- data-slot="collapsible-content"
34
- className={cn(
35
- 'overflow-hidden data-open:animate-accordion-down data-closed:animate-accordion-up',
36
- className,
37
- )}
38
- {...props}
39
- />
40
- );
41
- }
42
-
43
- export { Collapsible, CollapsibleTrigger, CollapsibleContent };
@@ -1,141 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { CheckIcon, ChevronDownIcon } from 'lucide-react';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
- import { Popover, PopoverContent, PopoverTrigger } from '@rise-x/ui/components/popover';
8
- import {
9
- Command,
10
- CommandEmpty,
11
- CommandInput,
12
- CommandItem,
13
- CommandList,
14
- } from '@rise-x/ui/components/command';
15
-
16
- /*
17
- * A select you can type into. Composed from Popover plus Command rather than
18
- * built fresh, so the list behaves exactly like the command palette and the
19
- * trigger exactly like a Select.
20
- *
21
- * WHEN TO USE WHICH. Select for a handful of known options — it needs no typing
22
- * and no filtering. Combobox once the list is long enough that scanning it is
23
- * slower than typing, which in practice is somewhere around a dozen. Offering a
24
- * search field over five options is furniture.
25
- *
26
- * THE TRIGGER IS A FIELD, so it takes the brand focus ring, matching Select and
27
- * Input. The tick sits on the right, matching SelectItem — the same mark in the
28
- * same place for the same meaning.
29
- *
30
- * THE POPOVER IS WIDTH-MATCHED TO THE TRIGGER via the Radix CSS var. A menu
31
- * narrower than the field it belongs to reads as a different control, and one
32
- * wider covers the layout beside it.
33
- */
34
-
35
- export interface ComboboxOption {
36
- value: string;
37
- label: string;
38
- /** Extra searchable text — a code, an alias — that is not shown. */
39
- keywords?: string;
40
- disabled?: boolean;
41
- }
42
-
43
- const Combobox = React.forwardRef<
44
- HTMLButtonElement,
45
- Omit<React.ComponentProps<'button'>, 'value' | 'onChange'> & {
46
- options: ComboboxOption[];
47
- value?: string;
48
- onValueChange?: (value: string) => void;
49
- placeholder?: string;
50
- searchPlaceholder?: string;
51
- emptyLabel?: string;
52
- /** Matches Select's trigger sizes. */
53
- size?: 'sm' | 'default';
54
- }
55
- >(function Combobox(
56
- {
57
- className,
58
- options,
59
- value,
60
- onValueChange,
61
- placeholder = 'Select an option',
62
- searchPlaceholder = 'Search',
63
- emptyLabel = 'No match',
64
- size = 'default',
65
- ...props
66
- },
67
- ref,
68
- ) {
69
- const [open, setOpen] = React.useState(false);
70
- const selected = options.find((o) => o.value === value);
71
-
72
- return (
73
- <Popover open={open} onOpenChange={setOpen}>
74
- <PopoverTrigger asChild>
75
- <button
76
- ref={ref}
77
- type="button"
78
- role="combobox"
79
- aria-expanded={open}
80
- data-slot="combobox-trigger"
81
- data-size={size}
82
- data-placeholder={selected ? undefined : ''}
83
- className={cn(
84
- 'flex w-full items-center justify-between gap-1.5 rounded-lg border border-input bg-card px-2.5 text-ui whitespace-nowrap transition-[border-color,box-shadow] duration-100 outline-none',
85
- 'data-[size=default]:h-control data-[size=sm]:h-control-sm',
86
- 'focus-visible:border-brand focus-visible:ring-3 focus-visible:ring-brand/12',
87
- 'disabled:cursor-not-allowed disabled:bg-muted disabled:text-subtle',
88
- 'aria-invalid:border-error aria-invalid:focus-visible:border-error aria-invalid:focus-visible:ring-error/18',
89
- className,
90
- )}
91
- {...props}
92
- >
93
- {/* muted-foreground, matching SelectTrigger's data-placeholder — the
94
- two controls are meant to be indistinguishable when empty */}
95
- <span
96
- className={cn(
97
- 'min-w-0 flex-1 truncate text-left',
98
- !selected && 'text-muted-foreground',
99
- )}
100
- >
101
- {selected?.label ?? placeholder}
102
- </span>
103
- <ChevronDownIcon aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
104
- </button>
105
- </PopoverTrigger>
106
- {/* Command brings its own padding and radius; Popover's would double up. */}
107
- <PopoverContent
108
- align="start"
109
- className="w-(--radix-popover-trigger-width) min-w-48 gap-0 p-0"
110
- >
111
- <Command>
112
- <CommandInput placeholder={searchPlaceholder} />
113
- <CommandList>
114
- <CommandEmpty>{emptyLabel}</CommandEmpty>
115
- {options.map((option) => (
116
- <CommandItem
117
- key={option.value}
118
- value={`${option.label} ${option.keywords ?? ''}`}
119
- disabled={option.disabled}
120
- onSelect={() => {
121
- onValueChange?.(option.value);
122
- setOpen(false);
123
- }}
124
- className="pr-8"
125
- >
126
- {option.label}
127
- {option.value === value ? (
128
- <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
129
- <CheckIcon />
130
- </span>
131
- ) : null}
132
- </CommandItem>
133
- ))}
134
- </CommandList>
135
- </Command>
136
- </PopoverContent>
137
- </Popover>
138
- );
139
- });
140
-
141
- export { Combobox };
@@ -1,181 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { Command as CommandPrimitive } from 'cmdk';
5
- import { SearchIcon } from 'lucide-react';
6
-
7
- import { cn } from '@rise-x/ui/lib/utils';
8
- import { Dialog, DialogContent } from '@rise-x/ui/components/dialog';
9
-
10
- /*
11
- * A filterable command list — the ⌘K palette, and the list half of Combobox.
12
- *
13
- * IT IS A SEARCH FIELD ON A MENU SURFACE, so it borrows from both and invents
14
- * nothing: the input takes the field grammar minus its box (the dialog already
15
- * supplies the boundary, and a bordered field inside a bordered popover is a box
16
- * in a box), and every row is a DropdownMenu item — 28px, 8px radius, the same
17
- * focus fill. Learning the menu teaches you this.
18
- *
19
- * SELECTION IS THE `focus` FILL, NOT BRAND. Moving through the list is keyboard
20
- * traversal, not affirmation — the same reason a checked checkbox is near-black.
21
- *
22
- * THE EMPTY STATE IS NOT OPTIONAL. A palette that filters to nothing and shows
23
- * nothing reads as broken rather than empty; `CommandEmpty` is what the reader
24
- * needs at exactly the moment they mistyped.
25
- */
26
- function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
27
- return (
28
- <CommandPrimitive
29
- data-slot="command"
30
- className={cn(
31
- 'flex h-full w-full flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground',
32
- className,
33
- )}
34
- {...props}
35
- />
36
- );
37
- }
38
-
39
- /*
40
- * The palette in a dialog. Padding is dropped and the radius handed to Command
41
- * itself, so the surface is one object rather than a list inside a panel.
42
- */
43
- function CommandDialog({
44
- title = 'Command palette',
45
- description = 'Search for a command to run',
46
- children,
47
- className,
48
- showCloseButton = false,
49
- ...props
50
- }: React.ComponentProps<typeof Dialog> & {
51
- title?: string;
52
- description?: string;
53
- className?: string;
54
- showCloseButton?: boolean;
55
- }) {
56
- return (
57
- <Dialog {...props}>
58
- <DialogContent
59
- showCloseButton={showCloseButton}
60
- className={cn('gap-0 overflow-hidden p-0 sm:max-w-lg', className)}
61
- >
62
- {/* named for screen readers without occupying a line of the palette */}
63
- <span className="sr-only">
64
- {title}. {description}
65
- </span>
66
- <Command className="rounded-none [&_[data-slot=command-input-wrapper]]:h-11">
67
- {children}
68
- </Command>
69
- </DialogContent>
70
- </Dialog>
71
- );
72
- }
73
-
74
- function CommandInput({
75
- className,
76
- ...props
77
- }: React.ComponentProps<typeof CommandPrimitive.Input>) {
78
- return (
79
- <div
80
- data-slot="command-input-wrapper"
81
- className="flex h-10 shrink-0 items-center gap-2 border-b border-border-subtle px-3"
82
- >
83
- <SearchIcon aria-hidden className="size-3.5 shrink-0 text-subtle" />
84
- <CommandPrimitive.Input
85
- data-slot="command-input"
86
- className={cn(
87
- 'flex h-full w-full min-w-0 border-0 bg-transparent text-ui text-foreground outline-none placeholder:text-subtle disabled:cursor-not-allowed disabled:opacity-50',
88
- className,
89
- )}
90
- {...props}
91
- />
92
- </div>
93
- );
94
- }
95
-
96
- function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
97
- return (
98
- <CommandPrimitive.List
99
- data-slot="command-list"
100
- className={cn('max-h-72 scroll-py-1.5 overflow-x-hidden overflow-y-auto p-1.5', className)}
101
- {...props}
102
- />
103
- );
104
- }
105
-
106
- function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
107
- return (
108
- <CommandPrimitive.Empty
109
- data-slot="command-empty"
110
- className="py-6 text-center text-xs text-muted-foreground"
111
- {...props}
112
- />
113
- );
114
- }
115
-
116
- function CommandGroup({
117
- className,
118
- ...props
119
- }: React.ComponentProps<typeof CommandPrimitive.Group>) {
120
- return (
121
- <CommandPrimitive.Group
122
- data-slot="command-group"
123
- className={cn(
124
- 'overflow-hidden text-popover-foreground',
125
- '[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-micro [&_[cmdk-group-heading]]:tracking-[0.04em] [&_[cmdk-group-heading]]:text-subtle [&_[cmdk-group-heading]]:uppercase',
126
- className,
127
- )}
128
- {...props}
129
- />
130
- );
131
- }
132
-
133
- function CommandSeparator({
134
- className,
135
- ...props
136
- }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
137
- return (
138
- <CommandPrimitive.Separator
139
- data-slot="command-separator"
140
- className={cn('-mx-1.5 my-1.5 h-px bg-border/50', className)}
141
- {...props}
142
- />
143
- );
144
- }
145
-
146
- function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
147
- return (
148
- <CommandPrimitive.Item
149
- data-slot="command-item"
150
- className={cn(
151
- "group/command-item relative flex h-7 cursor-default items-center gap-2 rounded-md px-2 text-ui font-medium outline-hidden select-none data-[selected=true]:bg-accent data-[selected=true]: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 [&_svg:not([class*='text-'])]:text-muted-foreground",
152
- className,
153
- )}
154
- {...props}
155
- />
156
- );
157
- }
158
-
159
- /* Shortcut hint. Uses Kbd rather than plain text so a palette row and a menu row
160
- * show a key the same way. */
161
- function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
162
- return (
163
- <span
164
- data-slot="command-shortcut"
165
- className={cn('ml-auto flex items-center gap-1 text-xs text-muted-foreground', className)}
166
- {...props}
167
- />
168
- );
169
- }
170
-
171
- export {
172
- Command,
173
- CommandDialog,
174
- CommandInput,
175
- CommandList,
176
- CommandEmpty,
177
- CommandGroup,
178
- CommandItem,
179
- CommandShortcut,
180
- CommandSeparator,
181
- };
@@ -1,243 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { ContextMenu as ContextMenuPrimitive } from 'radix-ui';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
- import { CheckIcon, ChevronRightIcon } from 'lucide-react';
8
-
9
- /*
10
- * Right-click menu. Deliberately the same surface as DropdownMenu — 14px radius,
11
- * 6px padding, 28px items at 8px radius, shadow-pop — because they are the same
12
- * object reached two different ways, and a reader who learns one has learned both.
13
- *
14
- * A CONTEXT MENU IS NEVER THE ONLY WAY TO DO SOMETHING. It is not discoverable:
15
- * nothing on screen says "right-click me", and it does not exist at all on touch.
16
- * Every item here must also be reachable from a visible affordance — a kebab, a
17
- * toolbar, a keyboard shortcut. Treat it as an accelerator, not a home.
18
- */
19
- function ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
20
- return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
21
- }
22
-
23
- function ContextMenuTrigger({
24
- ...props
25
- }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
26
- return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />;
27
- }
28
-
29
- function ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
30
- return <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />;
31
- }
32
-
33
- function ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
34
- return <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />;
35
- }
36
-
37
- function ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
38
- return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
39
- }
40
-
41
- function ContextMenuRadioGroup({
42
- ...props
43
- }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
44
- return <ContextMenuPrimitive.RadioGroup data-slot="context-menu-radio-group" {...props} />;
45
- }
46
-
47
- function ContextMenuContent({
48
- className,
49
- ...props
50
- }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
51
- return (
52
- <ContextMenuPrimitive.Portal>
53
- <ContextMenuPrimitive.Content
54
- data-slot="context-menu-content"
55
- className={cn(
56
- 'z-50 max-h-(--radix-context-menu-content-available-height) min-w-48 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto 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',
57
- className,
58
- )}
59
- {...props}
60
- />
61
- </ContextMenuPrimitive.Portal>
62
- );
63
- }
64
-
65
- function ContextMenuItem({
66
- className,
67
- inset,
68
- variant = 'default',
69
- ...props
70
- }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
71
- inset?: boolean;
72
- variant?: 'default' | 'destructive';
73
- }) {
74
- return (
75
- <ContextMenuPrimitive.Item
76
- data-slot="context-menu-item"
77
- data-inset={inset}
78
- data-variant={variant}
79
- className={cn(
80
- "group/context-menu-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",
81
- className,
82
- )}
83
- {...props}
84
- />
85
- );
86
- }
87
-
88
- function ContextMenuCheckboxItem({
89
- className,
90
- children,
91
- checked,
92
- inset,
93
- ...props
94
- }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem> & { inset?: boolean }) {
95
- return (
96
- <ContextMenuPrimitive.CheckboxItem
97
- data-slot="context-menu-checkbox-item"
98
- data-inset={inset}
99
- className={cn(
100
- "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-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
101
- className,
102
- )}
103
- checked={checked}
104
- {...props}
105
- >
106
- <span
107
- className="pointer-events-none absolute right-2 flex items-center justify-center"
108
- data-slot="context-menu-checkbox-item-indicator"
109
- >
110
- <ContextMenuPrimitive.ItemIndicator>
111
- <CheckIcon />
112
- </ContextMenuPrimitive.ItemIndicator>
113
- </span>
114
- {children}
115
- </ContextMenuPrimitive.CheckboxItem>
116
- );
117
- }
118
-
119
- function ContextMenuRadioItem({
120
- className,
121
- children,
122
- inset,
123
- ...props
124
- }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem> & { inset?: boolean }) {
125
- return (
126
- <ContextMenuPrimitive.RadioItem
127
- data-slot="context-menu-radio-item"
128
- data-inset={inset}
129
- className={cn(
130
- "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-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
131
- className,
132
- )}
133
- {...props}
134
- >
135
- <span
136
- className="pointer-events-none absolute right-2 flex items-center justify-center"
137
- data-slot="context-menu-radio-item-indicator"
138
- >
139
- <ContextMenuPrimitive.ItemIndicator>
140
- <CheckIcon />
141
- </ContextMenuPrimitive.ItemIndicator>
142
- </span>
143
- {children}
144
- </ContextMenuPrimitive.RadioItem>
145
- );
146
- }
147
-
148
- function ContextMenuLabel({
149
- className,
150
- inset,
151
- ...props
152
- }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & { inset?: boolean }) {
153
- return (
154
- <ContextMenuPrimitive.Label
155
- data-slot="context-menu-label"
156
- data-inset={inset}
157
- className={cn('px-3 py-2.5 text-xs text-muted-foreground data-inset:pl-9.5', className)}
158
- {...props}
159
- />
160
- );
161
- }
162
-
163
- function ContextMenuSeparator({
164
- className,
165
- ...props
166
- }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
167
- return (
168
- <ContextMenuPrimitive.Separator
169
- data-slot="context-menu-separator"
170
- className={cn('-mx-1.5 my-1.5 h-px bg-border/50', className)}
171
- {...props}
172
- />
173
- );
174
- }
175
-
176
- function ContextMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
177
- return (
178
- <span
179
- data-slot="context-menu-shortcut"
180
- className={cn(
181
- 'ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground',
182
- className,
183
- )}
184
- {...props}
185
- />
186
- );
187
- }
188
-
189
- function ContextMenuSubTrigger({
190
- className,
191
- inset,
192
- children,
193
- ...props
194
- }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & { inset?: boolean }) {
195
- return (
196
- <ContextMenuPrimitive.SubTrigger
197
- data-slot="context-menu-sub-trigger"
198
- data-inset={inset}
199
- className={cn(
200
- "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-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
201
- className,
202
- )}
203
- {...props}
204
- >
205
- {children}
206
- <ChevronRightIcon className="ml-auto" />
207
- </ContextMenuPrimitive.SubTrigger>
208
- );
209
- }
210
-
211
- function ContextMenuSubContent({
212
- className,
213
- ...props
214
- }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
215
- return (
216
- <ContextMenuPrimitive.SubContent
217
- data-slot="context-menu-sub-content"
218
- className={cn(
219
- 'z-50 min-w-36 origin-(--radix-context-menu-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',
220
- className,
221
- )}
222
- {...props}
223
- />
224
- );
225
- }
226
-
227
- export {
228
- ContextMenu,
229
- ContextMenuTrigger,
230
- ContextMenuContent,
231
- ContextMenuGroup,
232
- ContextMenuPortal,
233
- ContextMenuLabel,
234
- ContextMenuItem,
235
- ContextMenuCheckboxItem,
236
- ContextMenuRadioGroup,
237
- ContextMenuRadioItem,
238
- ContextMenuSeparator,
239
- ContextMenuShortcut,
240
- ContextMenuSub,
241
- ContextMenuSubTrigger,
242
- ContextMenuSubContent,
243
- };