@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,65 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
-
8
- /*
9
- * 15px circle, same box as Checkbox — the only difference is the shape, which
10
- * is the whole point: round means "one of these", square means "any of these".
11
- * Checked fills with `primary` (neutral), matching Checkbox; a radio records a
12
- * choice, not an affirmation, so it does not get brand.
13
- */
14
- function RadioGroup({
15
- className,
16
- ...props
17
- }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
18
- return (
19
- <RadioGroupPrimitive.Root
20
- data-slot="radio-group"
21
- className={cn('grid gap-2', className)}
22
- {...props}
23
- />
24
- );
25
- }
26
-
27
- function Radio({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
28
- return (
29
- <RadioGroupPrimitive.Item
30
- data-slot="radio"
31
- className={cn(
32
- 'peer grid size-[15px] shrink-0 place-items-center rounded-full border border-input bg-card transition-[background-color,border-color] duration-100 outline-none',
33
- 'focus-visible:ring-3 focus-visible:ring-ring-control/35',
34
- 'disabled:cursor-not-allowed disabled:opacity-45',
35
- 'aria-invalid:border-error aria-invalid:ring-3 aria-invalid:ring-error/20',
36
- 'data-checked:border-primary data-checked:bg-primary',
37
- className,
38
- )}
39
- {...props}
40
- >
41
- <RadioGroupPrimitive.Indicator
42
- data-slot="radio-indicator"
43
- className="block size-[7px] rounded-full bg-primary-foreground"
44
- />
45
- </RadioGroupPrimitive.Item>
46
- );
47
- }
48
-
49
- /* Checkbox/radio with a label and optional helper line. The row is the click
50
- * target, and the helper sits under the label rather than beside it so a long
51
- * explanation does not push the control off-centre. */
52
- function ChoiceRow({ className, ...props }: React.ComponentProps<'label'>) {
53
- return (
54
- <label
55
- data-slot="choice-row"
56
- className={cn(
57
- 'flex cursor-pointer items-start gap-2 text-ui [&>*:first-child]:mt-[3px] [&_small]:block [&_small]:text-micro [&_small]:text-subtle',
58
- className,
59
- )}
60
- {...props}
61
- />
62
- );
63
- }
64
-
65
- export { RadioGroup, Radio, ChoiceRow };
@@ -1,40 +0,0 @@
1
- import * as ResizablePrimitive from 'react-resizable-panels';
2
-
3
- import { cn } from '@rise-x/ui/lib/utils';
4
-
5
- function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps) {
6
- return (
7
- <ResizablePrimitive.Group
8
- data-slot="resizable-panel-group"
9
- className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
10
- {...props}
11
- />
12
- );
13
- }
14
-
15
- function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
16
- return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
17
- }
18
-
19
- function ResizableHandle({
20
- withHandle,
21
- className,
22
- ...props
23
- }: ResizablePrimitive.SeparatorProps & {
24
- withHandle?: boolean;
25
- }) {
26
- return (
27
- <ResizablePrimitive.Separator
28
- data-slot="resizable-handle"
29
- className={cn(
30
- 'relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',
31
- className,
32
- )}
33
- {...props}
34
- >
35
- {withHandle && <div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />}
36
- </ResizablePrimitive.Separator>
37
- );
38
- }
39
-
40
- export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
@@ -1,55 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
-
8
- function ScrollArea({
9
- className,
10
- children,
11
- ...props
12
- }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
13
- return (
14
- <ScrollAreaPrimitive.Root
15
- data-slot="scroll-area"
16
- className={cn('relative', className)}
17
- {...props}
18
- >
19
- <ScrollAreaPrimitive.Viewport
20
- data-slot="scroll-area-viewport"
21
- className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
22
- >
23
- {children}
24
- </ScrollAreaPrimitive.Viewport>
25
- <ScrollBar />
26
- <ScrollAreaPrimitive.Corner />
27
- </ScrollAreaPrimitive.Root>
28
- );
29
- }
30
-
31
- function ScrollBar({
32
- className,
33
- orientation = 'vertical',
34
- ...props
35
- }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
36
- return (
37
- <ScrollAreaPrimitive.ScrollAreaScrollbar
38
- data-slot="scroll-area-scrollbar"
39
- data-orientation={orientation}
40
- orientation={orientation}
41
- className={cn(
42
- 'flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent',
43
- className,
44
- )}
45
- {...props}
46
- >
47
- <ScrollAreaPrimitive.ScrollAreaThumb
48
- data-slot="scroll-area-thumb"
49
- className="relative flex-1 rounded-full bg-border"
50
- />
51
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
52
- );
53
- }
54
-
55
- export { ScrollArea, ScrollBar };
@@ -1,45 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
-
5
- import { cn } from '@rise-x/ui/lib/utils';
6
-
7
- /*
8
- * iOS-style segmented control: a filled track with a white thumb floating on a
9
- * tight shadow. No border — the fill IS the container, and a border around a
10
- * filled track is the same statement twice.
11
- */
12
- function Segmented({ className, ...props }: React.ComponentProps<'div'>) {
13
- return (
14
- <div
15
- data-slot="segmented"
16
- role="group"
17
- className={cn('inline-flex gap-0.5 rounded-lg border-0 bg-fill-1 p-0.5', className)}
18
- {...props}
19
- />
20
- );
21
- }
22
-
23
- function SegmentedItem({
24
- className,
25
- selected,
26
- ...props
27
- }: React.ComponentProps<'button'> & { selected?: boolean }) {
28
- return (
29
- <button
30
- type="button"
31
- data-slot="segmented-item"
32
- aria-pressed={selected}
33
- className={cn(
34
- 'inline-flex h-control-xs items-center gap-1.5 rounded-md border-0 bg-transparent px-2.5 text-xs text-muted-foreground transition-[background-color,color] duration-200 ease-decelerate outline-none',
35
- 'focus-visible:ring-3 focus-visible:ring-ring-control/35',
36
- 'aria-pressed:bg-card aria-pressed:font-medium aria-pressed:text-foreground aria-pressed:shadow-[0_1px_3px_rgb(16_24_40/0.12),0_1px_1px_rgb(16_24_40/0.06)]',
37
- '[&_svg]:size-3 [&_svg]:shrink-0',
38
- className,
39
- )}
40
- {...props}
41
- />
42
- );
43
- }
44
-
45
- export { Segmented, SegmentedItem };
@@ -1,188 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { Select as SelectPrimitive } from 'radix-ui';
5
-
6
- import { cn } from '@rise-x/ui/lib/utils';
7
- import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from 'lucide-react';
8
-
9
- function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
10
- return <SelectPrimitive.Root data-slot="select" {...props} />;
11
- }
12
-
13
- function SelectGroup({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
14
- return (
15
- <SelectPrimitive.Group
16
- data-slot="select-group"
17
- className={cn('scroll-my-1.5', className)}
18
- {...props}
19
- />
20
- );
21
- }
22
-
23
- function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
24
- return <SelectPrimitive.Value data-slot="select-value" {...props} />;
25
- }
26
-
27
- function SelectTrigger({
28
- className,
29
- size = 'default',
30
- children,
31
- ...props
32
- }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
33
- size?: 'sm' | 'default';
34
- }) {
35
- return (
36
- <SelectPrimitive.Trigger
37
- data-slot="select-trigger"
38
- data-size={size}
39
- className={cn(
40
- "flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-card px-2.5 text-ui whitespace-nowrap transition-[color,box-shadow,background-color] outline-none focus-visible:border-brand focus-visible:ring-3 focus-visible:ring-brand/12 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-control data-[size=sm]:h-control-sm *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
41
- className,
42
- )}
43
- {...props}
44
- >
45
- {children}
46
- <SelectPrimitive.Icon asChild>
47
- <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
48
- </SelectPrimitive.Icon>
49
- </SelectPrimitive.Trigger>
50
- );
51
- }
52
-
53
- function SelectContent({
54
- className,
55
- children,
56
- /* popper, not radix's item-aligned default: every other menu in the kit
57
- * (dropdown, combobox, date picker) opens BELOW its trigger — a select that
58
- * overlays its own trigger and the labels around it is the odd one out. */
59
- position = 'popper',
60
- align = 'start',
61
- ...props
62
- }: React.ComponentProps<typeof SelectPrimitive.Content>) {
63
- return (
64
- <SelectPrimitive.Portal>
65
- <SelectPrimitive.Content
66
- data-slot="select-content"
67
- data-align-trigger={position === 'item-aligned'}
68
- className={cn(
69
- /* p-1.5 matches every other menu surface (dropdown, context,
70
- * menubar, command) — without it the rounded-md items sit flush
71
- * against the rounded-xl edge and clip at the corners. */
72
- 'relative z-50 max-h-(--radix-select-content-available-height) w-(--radix-select-trigger-width) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-1.5 text-popover-foreground shadow-pop duration-100 data-[align-trigger=true]:animate-none 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',
73
- position === 'popper' &&
74
- 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
75
- className,
76
- )}
77
- position={position}
78
- align={align}
79
- {...props}
80
- >
81
- <SelectScrollUpButton />
82
- <SelectPrimitive.Viewport
83
- data-position={position}
84
- className="data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)"
85
- >
86
- {children}
87
- </SelectPrimitive.Viewport>
88
- <SelectScrollDownButton />
89
- </SelectPrimitive.Content>
90
- </SelectPrimitive.Portal>
91
- );
92
- }
93
-
94
- function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
95
- return (
96
- <SelectPrimitive.Label
97
- data-slot="select-label"
98
- className={cn('px-3 py-2.5 text-xs text-muted-foreground', className)}
99
- {...props}
100
- />
101
- );
102
- }
103
-
104
- function SelectItem({
105
- className,
106
- children,
107
- ...props
108
- }: React.ComponentProps<typeof SelectPrimitive.Item>) {
109
- return (
110
- <SelectPrimitive.Item
111
- data-slot="select-item"
112
- className={cn(
113
- "relative flex w-full 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 not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
114
- className,
115
- )}
116
- {...props}
117
- >
118
- <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
119
- <SelectPrimitive.ItemIndicator>
120
- <CheckIcon className="pointer-events-none" />
121
- </SelectPrimitive.ItemIndicator>
122
- </span>
123
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
124
- </SelectPrimitive.Item>
125
- );
126
- }
127
-
128
- function SelectSeparator({
129
- className,
130
- ...props
131
- }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
132
- return (
133
- <SelectPrimitive.Separator
134
- data-slot="select-separator"
135
- className={cn('pointer-events-none -mx-1.5 my-1.5 h-px bg-border', className)}
136
- {...props}
137
- />
138
- );
139
- }
140
-
141
- function SelectScrollUpButton({
142
- className,
143
- ...props
144
- }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
145
- return (
146
- <SelectPrimitive.ScrollUpButton
147
- data-slot="select-scroll-up-button"
148
- className={cn(
149
- "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
150
- className,
151
- )}
152
- {...props}
153
- >
154
- <ChevronUpIcon />
155
- </SelectPrimitive.ScrollUpButton>
156
- );
157
- }
158
-
159
- function SelectScrollDownButton({
160
- className,
161
- ...props
162
- }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
163
- return (
164
- <SelectPrimitive.ScrollDownButton
165
- data-slot="select-scroll-down-button"
166
- className={cn(
167
- "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
168
- className,
169
- )}
170
- {...props}
171
- >
172
- <ChevronDownIcon />
173
- </SelectPrimitive.ScrollDownButton>
174
- );
175
- }
176
-
177
- export {
178
- Select,
179
- SelectContent,
180
- SelectGroup,
181
- SelectItem,
182
- SelectLabel,
183
- SelectScrollDownButton,
184
- SelectScrollUpButton,
185
- SelectSeparator,
186
- SelectTrigger,
187
- SelectValue,
188
- };
@@ -1,26 +0,0 @@
1
- import * as React from 'react';
2
- import { Separator as SeparatorPrimitive } from 'radix-ui';
3
-
4
- import { cn } from '@rise-x/ui/lib/utils';
5
-
6
- function Separator({
7
- className,
8
- orientation = 'horizontal',
9
- decorative = true,
10
- ...props
11
- }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
12
- return (
13
- <SeparatorPrimitive.Root
14
- data-slot="separator"
15
- decorative={decorative}
16
- orientation={orientation}
17
- className={cn(
18
- 'shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch',
19
- className,
20
- )}
21
- {...props}
22
- />
23
- );
24
- }
25
-
26
- export { Separator };
@@ -1,184 +0,0 @@
1
- import * as React from 'react';
2
- import { Dialog as SheetPrimitive } 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
- * SheetContent puts <SheetOverlay /> inside the portal, and radix's Portal wraps
15
- * each child in Presence + `Primitive.div asChild`, whose Slot hands the child a
16
- * composed ref. Under React 18 a plain-function overlay drops it, so Presence
17
- * never sees the overlay node and closes it without its exit animation — plus a
18
- * "Function components cannot be given refs" warning on every open. Only Sheet
19
- * (Root) and SheetPortal are left as plain functions: neither renders a DOM
20
- * node, and radix's own are plain too.
21
- *
22
- * WHEN. The Sheet is the surface for ON-DEMAND supplementary content — the
23
- * activity log, an asset render, any "show me more about this" data. It opens
24
- * from an affordance in the page header (the activity icon button is the
25
- * canonical case), slides in from the right and dims the page behind it, with
26
- * any filter or search living inside the panel. The docked Panel (nav.tsx) is
27
- * only for surfaces that are part of the page's own layout — a persistent
28
- * master-detail pane or a filter rail — where the page must stay interactive.
29
- */
30
-
31
- function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
32
- return <SheetPrimitive.Root data-slot="sheet" {...props} />;
33
- }
34
-
35
- const SheetTrigger = React.forwardRef<
36
- HTMLButtonElement,
37
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Trigger>
38
- >(function SheetTrigger({ ...props }, ref) {
39
- return <SheetPrimitive.Trigger ref={ref} data-slot="sheet-trigger" {...props} />;
40
- });
41
-
42
- const SheetClose = React.forwardRef<
43
- HTMLButtonElement,
44
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Close>
45
- >(function SheetClose({ ...props }, ref) {
46
- return <SheetPrimitive.Close ref={ref} data-slot="sheet-close" {...props} />;
47
- });
48
-
49
- function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
50
- return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
51
- }
52
-
53
- const SheetOverlay = React.forwardRef<
54
- HTMLDivElement,
55
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
56
- >(function SheetOverlay({ className, ...props }, ref) {
57
- return (
58
- <SheetPrimitive.Overlay
59
- ref={ref}
60
- data-slot="sheet-overlay"
61
- className={cn(
62
- 'fixed inset-0 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',
63
- className,
64
- )}
65
- {...props}
66
- />
67
- );
68
- });
69
-
70
- const SheetContent = React.forwardRef<
71
- HTMLDivElement,
72
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content> & {
73
- side?: 'top' | 'right' | 'bottom' | 'left';
74
- showCloseButton?: boolean;
75
- }
76
- >(function SheetContent(
77
- { className, children, side = 'right', showCloseButton = true, ...props },
78
- ref,
79
- ) {
80
- return (
81
- <SheetPortal>
82
- <SheetOverlay />
83
- <SheetPrimitive.Content
84
- ref={ref}
85
- data-slot="sheet-content"
86
- data-side={side}
87
- className={cn(
88
- /* FLOATS with a margin on every side, rather than butting against the
89
- * window edge. Butted against the edge a drawer becomes part of the
90
- * window frame and the fact that it is dismissible stops being
91
- * legible; inset, the page shows through on all four sides and it
92
- * reads as a separate object you could close. Radius is 18px — the
93
- * grouped-surface step — because it is the largest surface on screen. */
94
- 'fixed z-50 flex flex-col overflow-hidden rounded-2xl bg-popover bg-clip-padding text-ui text-popover-foreground shadow-pop transition duration-200 ease-in-out',
95
- /* Matches the inset-3 gutter on both sides — derived from --spacing
96
- * rather than written as 24px, so it tracks inset-3 by construction
97
- * instead of relying on this comment to stay true. */
98
- 'data-[side=right]:inset-y-3 data-[side=right]:right-3 data-[side=right]:w-[calc(100%-(var(--spacing)*6))] data-[side=right]:sm:max-w-md',
99
- 'data-[side=left]:inset-y-3 data-[side=left]:left-3 data-[side=left]:w-[calc(100%-(var(--spacing)*6))] data-[side=left]:sm:max-w-md',
100
- 'data-[side=bottom]:inset-x-3 data-[side=bottom]:bottom-3 data-[side=bottom]:h-auto',
101
- 'data-[side=top]:inset-x-3 data-[side=top]:top-3 data-[side=top]:h-auto',
102
- 'data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10',
103
- className,
104
- )}
105
- {...props}
106
- >
107
- {children}
108
- {showCloseButton && (
109
- <SheetPrimitive.Close data-slot="sheet-close" asChild>
110
- <Button variant="ghost" className="absolute top-4 right-4 bg-secondary" size="icon-sm">
111
- <XIcon />
112
- <span className="sr-only">Close</span>
113
- </Button>
114
- </SheetPrimitive.Close>
115
- )}
116
- </SheetPrimitive.Content>
117
- </SheetPortal>
118
- );
119
- });
120
-
121
- const SheetHeader = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
122
- function SheetHeader({ className, ...props }, ref) {
123
- return (
124
- <div
125
- ref={ref}
126
- data-slot="sheet-header"
127
- className={cn('flex flex-col gap-1.5 p-6', className)}
128
- {...props}
129
- />
130
- );
131
- },
132
- );
133
-
134
- const SheetFooter = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
135
- function SheetFooter({ className, ...props }, ref) {
136
- return (
137
- <div
138
- ref={ref}
139
- data-slot="sheet-footer"
140
- className={cn('mt-auto flex flex-col gap-2 p-6', className)}
141
- {...props}
142
- />
143
- );
144
- },
145
- );
146
-
147
- const SheetTitle = React.forwardRef<
148
- HTMLHeadingElement,
149
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
150
- >(function SheetTitle({ className, ...props }, ref) {
151
- return (
152
- <SheetPrimitive.Title
153
- ref={ref}
154
- data-slot="sheet-title"
155
- className={cn('text-ui font-medium text-foreground', className)}
156
- {...props}
157
- />
158
- );
159
- });
160
-
161
- const SheetDescription = React.forwardRef<
162
- HTMLParagraphElement,
163
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
164
- >(function SheetDescription({ className, ...props }, ref) {
165
- return (
166
- <SheetPrimitive.Description
167
- ref={ref}
168
- data-slot="sheet-description"
169
- className={cn('text-ui text-muted-foreground', className)}
170
- {...props}
171
- />
172
- );
173
- });
174
-
175
- export {
176
- Sheet,
177
- SheetTrigger,
178
- SheetClose,
179
- SheetContent,
180
- SheetHeader,
181
- SheetFooter,
182
- SheetTitle,
183
- SheetDescription,
184
- };
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from '@rise-x/ui/lib/utils';
4
-
5
- function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
6
- return (
7
- <div
8
- data-slot="skeleton"
9
- className={cn('animate-pulse rounded-[4px] bg-border-subtle', className)}
10
- {...props}
11
- />
12
- );
13
- }
14
-
15
- export { Skeleton };