@rise-x/apps-sdk 0.9.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 (92) hide show
  1. package/README.md +116 -31
  2. package/build/rsbuild/index.d.ts +6 -1
  3. package/build/rsbuild/index.js +23 -2
  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 +16 -10
  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/sheet.d.ts +10 -0
  10. package/build/ui/components/thinking-rings.d.ts +4 -0
  11. package/build/ui/demo.html +26794 -0
  12. package/build/ui/index.d.ts +2 -0
  13. package/build/ui/standalone.js +59 -58
  14. package/build/ui/styles.css +1 -1
  15. package/package.json +4 -3
  16. package/template/AGENTS.md +3 -3
  17. package/template/README.md +5 -5
  18. package/template/package.json +8 -9
  19. package/template/rsbuild.config.mts +17 -0
  20. package/template/src/App.tsx +4 -1
  21. package/template/tsconfig.json +3 -1
  22. package/build/ui/reference/README.md +0 -11
  23. package/build/ui/reference/components/accordion.tsx +0 -85
  24. package/build/ui/reference/components/ai.tsx +0 -293
  25. package/build/ui/reference/components/alert-dialog.tsx +0 -207
  26. package/build/ui/reference/components/alert.tsx +0 -112
  27. package/build/ui/reference/components/app-frame.tsx +0 -71
  28. package/build/ui/reference/components/aspect-ratio.tsx +0 -28
  29. package/build/ui/reference/components/avatar.tsx +0 -158
  30. package/build/ui/reference/components/badge.tsx +0 -160
  31. package/build/ui/reference/components/button-group.tsx +0 -77
  32. package/build/ui/reference/components/button.tsx +0 -109
  33. package/build/ui/reference/components/calendar.tsx +0 -119
  34. package/build/ui/reference/components/card.tsx +0 -144
  35. package/build/ui/reference/components/carousel.tsx +0 -248
  36. package/build/ui/reference/components/chart.tsx +0 -704
  37. package/build/ui/reference/components/checkbox.tsx +0 -44
  38. package/build/ui/reference/components/collapsible.tsx +0 -43
  39. package/build/ui/reference/components/combobox.tsx +0 -146
  40. package/build/ui/reference/components/command.tsx +0 -181
  41. package/build/ui/reference/components/context-menu.tsx +0 -243
  42. package/build/ui/reference/components/data-table.tsx +0 -650
  43. package/build/ui/reference/components/date-picker.tsx +0 -218
  44. package/build/ui/reference/components/dialog.tsx +0 -172
  45. package/build/ui/reference/components/direction.tsx +0 -22
  46. package/build/ui/reference/components/dropdown-menu.tsx +0 -245
  47. package/build/ui/reference/components/empty-state.tsx +0 -63
  48. package/build/ui/reference/components/field.tsx +0 -252
  49. package/build/ui/reference/components/file-upload.tsx +0 -116
  50. package/build/ui/reference/components/hover-card.tsx +0 -64
  51. package/build/ui/reference/components/input-group.tsx +0 -157
  52. package/build/ui/reference/components/input-otp.tsx +0 -106
  53. package/build/ui/reference/components/input.tsx +0 -86
  54. package/build/ui/reference/components/item.tsx +0 -188
  55. package/build/ui/reference/components/kbd.tsx +0 -43
  56. package/build/ui/reference/components/label.tsx +0 -19
  57. package/build/ui/reference/components/list.tsx +0 -191
  58. package/build/ui/reference/components/map.css +0 -251
  59. package/build/ui/reference/components/map.tsx +0 -294
  60. package/build/ui/reference/components/menubar.tsx +0 -275
  61. package/build/ui/reference/components/message-scroller.tsx +0 -141
  62. package/build/ui/reference/components/message.tsx +0 -177
  63. package/build/ui/reference/components/nav.tsx +0 -127
  64. package/build/ui/reference/components/navigation-menu.tsx +0 -191
  65. package/build/ui/reference/components/page-header.tsx +0 -245
  66. package/build/ui/reference/components/popover.tsx +0 -76
  67. package/build/ui/reference/components/progress.tsx +0 -31
  68. package/build/ui/reference/components/radio.tsx +0 -65
  69. package/build/ui/reference/components/resizable.tsx +0 -40
  70. package/build/ui/reference/components/scroll-area.tsx +0 -55
  71. package/build/ui/reference/components/segmented.tsx +0 -45
  72. package/build/ui/reference/components/select.tsx +0 -188
  73. package/build/ui/reference/components/separator.tsx +0 -26
  74. package/build/ui/reference/components/sheet.tsx +0 -184
  75. package/build/ui/reference/components/skeleton.tsx +0 -15
  76. package/build/ui/reference/components/slider.tsx +0 -161
  77. package/build/ui/reference/components/snackbar.tsx +0 -27
  78. package/build/ui/reference/components/sonner.tsx +0 -43
  79. package/build/ui/reference/components/spinner.tsx +0 -27
  80. package/build/ui/reference/components/statistic.tsx +0 -122
  81. package/build/ui/reference/components/stepper.tsx +0 -138
  82. package/build/ui/reference/components/switch.tsx +0 -47
  83. package/build/ui/reference/components/table.tsx +0 -246
  84. package/build/ui/reference/components/textarea.tsx +0 -28
  85. package/build/ui/reference/components/timeline.tsx +0 -101
  86. package/build/ui/reference/components/toggle-group.tsx +0 -86
  87. package/build/ui/reference/components/toggle.tsx +0 -46
  88. package/build/ui/reference/components/tooltip.tsx +0 -53
  89. package/build/ui/reference/index.ts +0 -69
  90. package/build/ui/reference/lib/utils.ts +0 -34
  91. package/template/webpack.config.js +0 -112
  92. package/template/webpack.local.config.js +0 -68
@@ -1,218 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { CalendarIcon, ChevronDownIcon } from 'lucide-react';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
- import { Calendar, type CalendarDay } from '@rise-x/ui/components/calendar';
8
- import { Popover, PopoverContent, PopoverTrigger } from '@rise-x/ui/components/popover';
9
-
10
- /*
11
- * Calendar plus Popover plus a field trigger. Calendar is deliberately dumb — it
12
- * renders whatever days it is handed — so the month arithmetic lives here, once,
13
- * instead of in every app that needs a date.
14
- *
15
- * DATES ARE BUILT FROM PARTS, NEVER PARSED FROM A DATE-ONLY STRING.
16
- * `new Date("2027-08-31")` is parsed as UTC midnight, so anywhere west of London
17
- * it renders as the 30th. Every Date in this file is constructed with
18
- * `new Date(y, m, d)` (local midnight) and compared on its local parts. If you
19
- * add a formatter, keep it on the parts too.
20
- *
21
- * The trigger is a FIELD, so it takes the brand focus ring like Input and Select —
22
- * a control you commit data into, not one you merely operate.
23
- */
24
-
25
- const MONTHS = [
26
- 'January',
27
- 'February',
28
- 'March',
29
- 'April',
30
- 'May',
31
- 'June',
32
- 'July',
33
- 'August',
34
- 'September',
35
- 'October',
36
- 'November',
37
- 'December',
38
- ];
39
-
40
- /** Monday-first, matching Calendar's own day-of-week header. */
41
- function startOffset(year: number, month: number) {
42
- const jsDay = new Date(year, month, 1).getDay(); // 0 = Sunday
43
- return (jsDay + 6) % 7;
44
- }
45
-
46
- function daysInMonth(year: number, month: number) {
47
- // day 0 of the next month is the last day of this one
48
- return new Date(year, month + 1, 0).getDate();
49
- }
50
-
51
- /* Normalise the parts before comparing: buildDays pushes outside days with
52
- * unnormalised indexes (month - 1 is -1 in January, month + 1 is 12 in
53
- * December) and the year of the VIEW, while getMonth() only returns 0-11. Raw
54
- * comparison therefore misses the selection and today ring on the adjacent
55
- * month's cells at a year boundary — the same class as the trailing-day
56
- * numbering bug. new Date(y, m, d) rolls both into range, which is why the
57
- * range highlight (via dayValue) was never affected. */
58
- function sameDay(a: Date | undefined, y: number, m: number, d: number) {
59
- if (!a) return false;
60
- const b = new Date(y, m, d);
61
- return (
62
- a.getFullYear() === b.getFullYear() &&
63
- a.getMonth() === b.getMonth() &&
64
- a.getDate() === b.getDate()
65
- );
66
- }
67
-
68
- /** Local-midnight comparison, so a time component can never flip the answer. */
69
- function dayValue(y: number, m: number, d: number) {
70
- return new Date(y, m, d).setHours(0, 0, 0, 0);
71
- }
72
-
73
- export interface DatePickerRange {
74
- from?: Date;
75
- to?: Date;
76
- }
77
-
78
- function buildDays(
79
- year: number,
80
- month: number,
81
- selected: Date | undefined,
82
- range: DatePickerRange | undefined,
83
- ): Array<CalendarDay & { y: number; m: number; d: number }> {
84
- const out: Array<CalendarDay & { y: number; m: number; d: number }> = [];
85
- const lead = startOffset(year, month);
86
- const prevCount = daysInMonth(year, month - 1);
87
- const today = new Date();
88
-
89
- const push = (y: number, m: number, d: number, outside: boolean) => {
90
- const v = dayValue(y, m, d);
91
- let position: CalendarDay['range'];
92
- if (range?.from && range?.to) {
93
- const from = dayValue(range.from.getFullYear(), range.from.getMonth(), range.from.getDate());
94
- const to = dayValue(range.to.getFullYear(), range.to.getMonth(), range.to.getDate());
95
- if (v === from) position = 'start';
96
- else if (v === to) position = 'end';
97
- else if (v > from && v < to) position = 'in';
98
- } else if (
99
- range?.from &&
100
- dayValue(range.from.getFullYear(), range.from.getMonth(), range.from.getDate()) === v
101
- ) {
102
- position = 'start';
103
- } else if (sameDay(selected, y, m, d)) {
104
- // a single selected date is drawn as a one-day span, so selection looks the
105
- // same whether the picker is in single or range mode
106
- position = 'start';
107
- }
108
- out.push({
109
- label: d,
110
- outside: outside || undefined,
111
- today: sameDay(today, y, m, d) || undefined,
112
- range: position,
113
- y,
114
- m,
115
- d,
116
- });
117
- };
118
-
119
- for (let i = lead; i > 0; i--) push(year, month - 1, prevCount - i + 1, true);
120
- for (let d = 1; d <= daysInMonth(year, month); d++) push(year, month, d, false);
121
- // fill to a whole number of weeks so the grid never reflows between months.
122
- // The trailing days count from 1, so they need their own counter — deriving
123
- // the number from out.length numbered them by grid position instead.
124
- for (let d = 1; out.length % 7 !== 0; d++) push(year, month + 1, d, true);
125
- return out;
126
- }
127
-
128
- const DatePicker = React.forwardRef<
129
- HTMLButtonElement,
130
- Omit<React.ComponentProps<'button'>, 'value' | 'onChange'> & {
131
- value?: Date;
132
- onValueChange?: (date: Date) => void;
133
- /** Renders a range span instead of a single day. Selection stays the caller's. */
134
- range?: DatePickerRange;
135
- placeholder?: string;
136
- /** Formats the trigger label. Keep it on the date's local parts. */
137
- format?: (date: Date) => string;
138
- footer?: React.ReactNode;
139
- }
140
- >(function DatePicker(
141
- { className, value, onValueChange, range, placeholder = 'Pick a date', format, footer, ...props },
142
- ref,
143
- ) {
144
- const [open, setOpen] = React.useState(false);
145
- const anchor = value ?? range?.from ?? new Date();
146
- const [view, setView] = React.useState({ y: anchor.getFullYear(), m: anchor.getMonth() });
147
-
148
- /* Follow the selection when it changes from outside — a preset button or a
149
- * form reset writes a new value while the popover is closed, and reopening
150
- * on the month captured at first render hides the day that was just picked.
151
- * Only the anchor's month is a dependency, so paging stays the user's. */
152
- const anchorMonth = `${anchor.getFullYear()}-${anchor.getMonth()}`;
153
- React.useEffect(() => {
154
- const [y, m] = anchorMonth.split('-').map(Number);
155
- setView({ y, m });
156
- }, [anchorMonth]);
157
-
158
- const label = React.useMemo(() => {
159
- const show = (d: Date) =>
160
- format ? format(d) : `${d.getDate()} ${MONTHS[d.getMonth()].slice(0, 3)} ${d.getFullYear()}`;
161
- if (range?.from && range?.to) return `${show(range.from)} – ${show(range.to)}`;
162
- if (value) return show(value);
163
- return null;
164
- }, [value, range?.from, range?.to, format]);
165
-
166
- const days = buildDays(view.y, view.m, value, range);
167
- const step = (delta: number) => {
168
- const next = new Date(view.y, view.m + delta, 1);
169
- setView({ y: next.getFullYear(), m: next.getMonth() });
170
- };
171
-
172
- return (
173
- <Popover open={open} onOpenChange={setOpen}>
174
- <PopoverTrigger asChild>
175
- <button
176
- ref={ref}
177
- type="button"
178
- data-slot="date-picker-trigger"
179
- data-placeholder={label ? undefined : ''}
180
- className={cn(
181
- 'flex h-control w-full items-center 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',
182
- 'focus-visible:border-brand focus-visible:ring-3 focus-visible:ring-brand/12',
183
- 'disabled:cursor-not-allowed disabled:bg-muted disabled:text-subtle',
184
- 'aria-invalid:border-error aria-invalid:focus-visible:border-error aria-invalid:focus-visible:ring-error/18',
185
- '[&>svg]:pointer-events-none [&>svg]:size-3.5 [&>svg]:shrink-0 [&>svg]:text-subtle',
186
- className,
187
- )}
188
- {...props}
189
- >
190
- <CalendarIcon />
191
- {/* muted-foreground, the same placeholder tone as Select and Combobox */}
192
- <span className={cn('min-w-0 flex-1 text-left', !label && 'text-muted-foreground')}>
193
- {label ?? placeholder}
194
- </span>
195
- <ChevronDownIcon className="text-muted-foreground!" />
196
- </button>
197
- </PopoverTrigger>
198
- {/* Popover's own padding and width would fight the calendar, which brings
199
- its own 14px padding and fixed 294px width. */}
200
- <PopoverContent align="start" className="w-auto gap-0 p-0 shadow-none">
201
- <Calendar
202
- title={`${MONTHS[view.m]} ${view.y}`}
203
- days={days}
204
- onPrev={() => step(-1)}
205
- onNext={() => step(1)}
206
- onSelectDay={(_day, index) => {
207
- const picked = days[index];
208
- onValueChange?.(new Date(picked.y, picked.m, picked.d));
209
- setOpen(false);
210
- }}
211
- footer={footer}
212
- />
213
- </PopoverContent>
214
- </Popover>
215
- );
216
- });
217
-
218
- export { DatePicker };
@@ -1,172 +0,0 @@
1
- import * as React from 'react';
2
- import { Dialog as DialogPrimitive } from 'radix-ui';
3
-
4
- import { cn } from '@rise-x/ui/lib/utils';
5
- import { Button } from '@rise-x/ui/components/button';
6
- import { XIcon } from 'lucide-react';
7
-
8
- /*
9
- * forwardRef throughout, for the same reason button.tsx and alert-dialog.tsx use
10
- * it: the classic React 18 host renders these components too, and React 18
11
- * strips `ref` from a plain function component instead of passing it as a prop.
12
- *
13
- * This is not only about refs a caller passes. Radix refs the overlay ITSELF:
14
- * DialogContent puts <DialogOverlay /> inside the portal, and radix's Portal
15
- * wraps each child in Presence + `Primitive.div asChild`, whose Slot hands the
16
- * child a composed ref. Under React 18 a plain-function overlay drops it, so
17
- * Presence never sees the overlay node and closes it without its exit
18
- * animation — plus a "Function components cannot be given refs" warning on
19
- * every open. Only Dialog (Root) and DialogPortal are left as plain functions:
20
- * neither renders a DOM node, and radix's own are plain too.
21
- */
22
-
23
- function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
24
- return <DialogPrimitive.Root data-slot="dialog" {...props} />;
25
- }
26
-
27
- const DialogTrigger = React.forwardRef<
28
- HTMLButtonElement,
29
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>
30
- >(function DialogTrigger({ ...props }, ref) {
31
- return <DialogPrimitive.Trigger ref={ref} data-slot="dialog-trigger" {...props} />;
32
- });
33
-
34
- function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
35
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
36
- }
37
-
38
- const DialogClose = React.forwardRef<
39
- HTMLButtonElement,
40
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>
41
- >(function DialogClose({ ...props }, ref) {
42
- return <DialogPrimitive.Close ref={ref} data-slot="dialog-close" {...props} />;
43
- });
44
-
45
- const DialogOverlay = React.forwardRef<
46
- HTMLDivElement,
47
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
48
- >(function DialogOverlay({ className, ...props }, ref) {
49
- return (
50
- <DialogPrimitive.Overlay
51
- ref={ref}
52
- data-slot="dialog-overlay"
53
- className={cn(
54
- 'fixed inset-0 isolate z-50 bg-black/30 duration-100 dark:bg-black/60 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
55
- className,
56
- )}
57
- {...props}
58
- />
59
- );
60
- });
61
-
62
- const DialogContent = React.forwardRef<
63
- HTMLDivElement,
64
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
65
- showCloseButton?: boolean;
66
- }
67
- >(function DialogContent({ className, children, showCloseButton = true, ...props }, ref) {
68
- return (
69
- <DialogPortal>
70
- <DialogOverlay />
71
- <DialogPrimitive.Content
72
- ref={ref}
73
- data-slot="dialog-content"
74
- className={cn(
75
- 'fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-(var(--spacing)*8))] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-2xl bg-popover p-6 text-ui text-popover-foreground shadow-pop duration-100 outline-none sm:max-w-md 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',
76
- className,
77
- )}
78
- {...props}
79
- >
80
- {children}
81
- {showCloseButton && (
82
- <DialogPrimitive.Close data-slot="dialog-close" asChild>
83
- <Button variant="ghost" className="absolute top-4 right-4 bg-secondary" size="icon-sm">
84
- <XIcon />
85
- <span className="sr-only">Close</span>
86
- </Button>
87
- </DialogPrimitive.Close>
88
- )}
89
- </DialogPrimitive.Content>
90
- </DialogPortal>
91
- );
92
- });
93
-
94
- const DialogHeader = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
95
- function DialogHeader({ className, ...props }, ref) {
96
- return (
97
- <div
98
- ref={ref}
99
- data-slot="dialog-header"
100
- className={cn('flex flex-col gap-1.5', className)}
101
- {...props}
102
- />
103
- );
104
- },
105
- );
106
-
107
- const DialogFooter = React.forwardRef<
108
- HTMLDivElement,
109
- React.ComponentPropsWithoutRef<'div'> & {
110
- showCloseButton?: boolean;
111
- }
112
- >(function DialogFooter({ className, showCloseButton = false, children, ...props }, ref) {
113
- return (
114
- <div
115
- ref={ref}
116
- data-slot="dialog-footer"
117
- className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
118
- {...props}
119
- >
120
- {children}
121
- {showCloseButton && (
122
- <DialogPrimitive.Close asChild>
123
- <Button variant="outline">Close</Button>
124
- </DialogPrimitive.Close>
125
- )}
126
- </div>
127
- );
128
- });
129
-
130
- const DialogTitle = React.forwardRef<
131
- HTMLHeadingElement,
132
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
133
- >(function DialogTitle({ className, ...props }, ref) {
134
- return (
135
- <DialogPrimitive.Title
136
- ref={ref}
137
- data-slot="dialog-title"
138
- className={cn('text-ui font-medium leading-none', className)}
139
- {...props}
140
- />
141
- );
142
- });
143
-
144
- const DialogDescription = React.forwardRef<
145
- HTMLParagraphElement,
146
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
147
- >(function DialogDescription({ className, ...props }, ref) {
148
- return (
149
- <DialogPrimitive.Description
150
- ref={ref}
151
- data-slot="dialog-description"
152
- className={cn(
153
- 'text-ui text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
154
- className,
155
- )}
156
- {...props}
157
- />
158
- );
159
- });
160
-
161
- export {
162
- Dialog,
163
- DialogClose,
164
- DialogContent,
165
- DialogDescription,
166
- DialogFooter,
167
- DialogHeader,
168
- DialogOverlay,
169
- DialogPortal,
170
- DialogTitle,
171
- DialogTrigger,
172
- };
@@ -1,22 +0,0 @@
1
- import * as React from 'react';
2
- import { Direction as DirectionPrimitive } from 'radix-ui';
3
-
4
- /*
5
- * Reading direction for every Radix primitive beneath it. Not a visual component
6
- * — it renders no DOM node at all — but it is the switch that makes the whole kit
7
- * behave in RTL: menus align from the other edge, sliders fill the other way,
8
- * and arrow keys reverse.
9
- *
10
- * WHY IT HAS TO BE EXPLICIT. Radix reads direction from this provider, not from
11
- * the `dir` attribute on `<html>`, so setting `dir="rtl"` on the document flips
12
- * CSS but leaves every popper anchored and every arrow key pointing the wrong
13
- * way. The host owns the document attribute; this owns the primitives. Set both.
14
- *
15
- * Mount it once, above the app — a federated app inherits it from the host along
16
- * with everything else, so an app should not normally render its own.
17
- */
18
- function DirectionProvider({ dir, children }: { dir: 'ltr' | 'rtl'; children?: React.ReactNode }) {
19
- return <DirectionPrimitive.Provider dir={dir}>{children}</DirectionPrimitive.Provider>;
20
- }
21
-
22
- export { DirectionProvider };
@@ -1,245 +0,0 @@
1
- import * as React from 'react';
2
- import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
3
-
4
- import { cn } from '@rise-x/ui/lib/utils';
5
- import { CheckIcon, ChevronRightIcon } from 'lucide-react';
6
-
7
- function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
8
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
9
- }
10
-
11
- function DropdownMenuPortal({
12
- ...props
13
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
14
- return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
15
- }
16
-
17
- function DropdownMenuTrigger({
18
- ...props
19
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
20
- return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
21
- }
22
-
23
- function DropdownMenuContent({
24
- className,
25
- align = 'start',
26
- sideOffset = 4,
27
- ...props
28
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
29
- return (
30
- <DropdownMenuPrimitive.Portal>
31
- <DropdownMenuPrimitive.Content
32
- data-slot="dropdown-menu-content"
33
- sideOffset={sideOffset}
34
- align={align}
35
- className={cn(
36
- 'z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-48 origin-(--radix-dropdown-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 data-[state=closed]:overflow-hidden 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',
37
- className,
38
- )}
39
- {...props}
40
- />
41
- </DropdownMenuPrimitive.Portal>
42
- );
43
- }
44
-
45
- function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
46
- return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
47
- }
48
-
49
- function DropdownMenuItem({
50
- className,
51
- inset,
52
- variant = 'default',
53
- ...props
54
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
55
- inset?: boolean;
56
- variant?: 'default' | 'destructive';
57
- }) {
58
- return (
59
- <DropdownMenuPrimitive.Item
60
- data-slot="dropdown-menu-item"
61
- data-inset={inset}
62
- data-variant={variant}
63
- className={cn(
64
- "group/dropdown-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",
65
- className,
66
- )}
67
- {...props}
68
- />
69
- );
70
- }
71
-
72
- function DropdownMenuCheckboxItem({
73
- className,
74
- children,
75
- checked,
76
- inset,
77
- ...props
78
- }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
79
- inset?: boolean;
80
- }) {
81
- return (
82
- <DropdownMenuPrimitive.CheckboxItem
83
- data-slot="dropdown-menu-checkbox-item"
84
- data-inset={inset}
85
- className={cn(
86
- "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",
87
- className,
88
- )}
89
- checked={checked}
90
- {...props}
91
- >
92
- <span
93
- className="pointer-events-none absolute right-2 flex items-center justify-center"
94
- data-slot="dropdown-menu-checkbox-item-indicator"
95
- >
96
- <DropdownMenuPrimitive.ItemIndicator>
97
- <CheckIcon />
98
- </DropdownMenuPrimitive.ItemIndicator>
99
- </span>
100
- {children}
101
- </DropdownMenuPrimitive.CheckboxItem>
102
- );
103
- }
104
-
105
- function DropdownMenuRadioGroup({
106
- ...props
107
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
108
- return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
109
- }
110
-
111
- function DropdownMenuRadioItem({
112
- className,
113
- children,
114
- inset,
115
- ...props
116
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
117
- inset?: boolean;
118
- }) {
119
- return (
120
- <DropdownMenuPrimitive.RadioItem
121
- data-slot="dropdown-menu-radio-item"
122
- data-inset={inset}
123
- className={cn(
124
- "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",
125
- className,
126
- )}
127
- {...props}
128
- >
129
- <span
130
- className="pointer-events-none absolute right-2 flex items-center justify-center"
131
- data-slot="dropdown-menu-radio-item-indicator"
132
- >
133
- <DropdownMenuPrimitive.ItemIndicator>
134
- <CheckIcon />
135
- </DropdownMenuPrimitive.ItemIndicator>
136
- </span>
137
- {children}
138
- </DropdownMenuPrimitive.RadioItem>
139
- );
140
- }
141
-
142
- function DropdownMenuLabel({
143
- className,
144
- inset,
145
- ...props
146
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
147
- inset?: boolean;
148
- }) {
149
- return (
150
- <DropdownMenuPrimitive.Label
151
- data-slot="dropdown-menu-label"
152
- data-inset={inset}
153
- className={cn('px-2 py-2.5 text-xs text-muted-foreground data-inset:pl-9.5', className)}
154
- {...props}
155
- />
156
- );
157
- }
158
-
159
- function DropdownMenuSeparator({
160
- className,
161
- ...props
162
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
163
- return (
164
- <DropdownMenuPrimitive.Separator
165
- data-slot="dropdown-menu-separator"
166
- className={cn('-mx-1.5 my-1.5 h-px bg-border/50', className)}
167
- {...props}
168
- />
169
- );
170
- }
171
-
172
- function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
173
- return (
174
- <span
175
- data-slot="dropdown-menu-shortcut"
176
- className={cn(
177
- 'ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground',
178
- className,
179
- )}
180
- {...props}
181
- />
182
- );
183
- }
184
-
185
- function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
186
- return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
187
- }
188
-
189
- function DropdownMenuSubTrigger({
190
- className,
191
- inset,
192
- children,
193
- ...props
194
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
195
- inset?: boolean;
196
- }) {
197
- return (
198
- <DropdownMenuPrimitive.SubTrigger
199
- data-slot="dropdown-menu-sub-trigger"
200
- data-inset={inset}
201
- className={cn(
202
- "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",
203
- className,
204
- )}
205
- {...props}
206
- >
207
- {children}
208
- <ChevronRightIcon className="ml-auto" />
209
- </DropdownMenuPrimitive.SubTrigger>
210
- );
211
- }
212
-
213
- function DropdownMenuSubContent({
214
- className,
215
- ...props
216
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
217
- return (
218
- <DropdownMenuPrimitive.SubContent
219
- data-slot="dropdown-menu-sub-content"
220
- className={cn(
221
- 'z-50 min-w-36 origin-(--radix-dropdown-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 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',
222
- className,
223
- )}
224
- {...props}
225
- />
226
- );
227
- }
228
-
229
- export {
230
- DropdownMenu,
231
- DropdownMenuPortal,
232
- DropdownMenuTrigger,
233
- DropdownMenuContent,
234
- DropdownMenuGroup,
235
- DropdownMenuLabel,
236
- DropdownMenuItem,
237
- DropdownMenuCheckboxItem,
238
- DropdownMenuRadioGroup,
239
- DropdownMenuRadioItem,
240
- DropdownMenuSeparator,
241
- DropdownMenuShortcut,
242
- DropdownMenuSub,
243
- DropdownMenuSubTrigger,
244
- DropdownMenuSubContent,
245
- };