@rise-x/apps-sdk 0.6.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/LICENSE +1 -0
- package/README.md +553 -0
- package/build/_internal.d.ts +2 -0
- package/build/_internal.js +23 -0
- package/build/accessors.d.ts +8 -0
- package/build/accessors.js +40 -0
- package/build/cli/index.d.ts +13 -0
- package/build/cli/index.js +54 -0
- package/build/cli/init.d.ts +6 -0
- package/build/cli/init.js +179 -0
- package/build/cli/templating.d.ts +2 -0
- package/build/cli/templating.js +84 -0
- package/build/connectors/agents.d.ts +85 -0
- package/build/connectors/agents.js +404 -0
- package/build/connectors/assets.d.ts +76 -0
- package/build/connectors/assets.js +204 -0
- package/build/connectors/deps.d.ts +4 -0
- package/build/connectors/deps.js +2 -0
- package/build/connectors/errors.d.ts +11 -0
- package/build/connectors/errors.js +67 -0
- package/build/connectors/flows.d.ts +37 -0
- package/build/connectors/flows.js +191 -0
- package/build/connectors/index.d.ts +8 -0
- package/build/connectors/index.js +50 -0
- package/build/connectors/sse.d.ts +12 -0
- package/build/connectors/sse.js +157 -0
- package/build/connectors/types.d.ts +285 -0
- package/build/connectors/types.js +419 -0
- package/build/connectors/work.d.ts +84 -0
- package/build/connectors/work.js +224 -0
- package/build/hooks.d.ts +4 -0
- package/build/hooks.js +28 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +34 -0
- package/build/lifecycle.d.ts +23 -0
- package/build/lifecycle.js +6 -0
- package/build/mockShell.d.ts +10 -0
- package/build/mockShell.js +55 -0
- package/build/query/agents.d.ts +80 -0
- package/build/query/agents.js +143 -0
- package/build/query/assets.d.ts +73 -0
- package/build/query/assets.js +152 -0
- package/build/query/client.d.ts +5 -0
- package/build/query/client.js +68 -0
- package/build/query/context.d.ts +2 -0
- package/build/query/context.js +34 -0
- package/build/query/flows.d.ts +54 -0
- package/build/query/flows.js +81 -0
- package/build/query/index.d.ts +10 -0
- package/build/query/index.js +85 -0
- package/build/query/keys.d.ts +51 -0
- package/build/query/keys.js +79 -0
- package/build/query/layer.d.ts +175 -0
- package/build/query/layer.js +35 -0
- package/build/query/shared.d.ts +43 -0
- package/build/query/shared.js +116 -0
- package/build/query/work.d.ts +75 -0
- package/build/query/work.js +172 -0
- package/build/shell/index.d.ts +1 -0
- package/build/shell/index.js +6 -0
- package/build/shell/installShellBridge.d.ts +11 -0
- package/build/shell/installShellBridge.js +104 -0
- package/build/shellBridge.d.ts +36 -0
- package/build/shellBridge.js +10 -0
- package/build/topBar.d.ts +25 -0
- package/build/topBar.js +17 -0
- package/build/ui/components/ai.d.ts +49 -0
- package/build/ui/components/alert-dialog.d.ts +27 -0
- package/build/ui/components/alert.d.ts +14 -0
- package/build/ui/components/avatar.d.ts +17 -0
- package/build/ui/components/badge.d.ts +19 -0
- package/build/ui/components/button.d.ts +13 -0
- package/build/ui/components/calendar.d.ts +21 -0
- package/build/ui/components/card.d.ts +16 -0
- package/build/ui/components/chart.d.ts +124 -0
- package/build/ui/components/checkbox.d.ts +4 -0
- package/build/ui/components/data-table.d.ts +70 -0
- package/build/ui/components/dialog.d.ts +17 -0
- package/build/ui/components/dropdown-menu.d.ts +29 -0
- package/build/ui/components/empty-state.d.ts +7 -0
- package/build/ui/components/file-upload.d.ts +17 -0
- package/build/ui/components/input.d.ts +8 -0
- package/build/ui/components/label.d.ts +4 -0
- package/build/ui/components/list.d.ts +24 -0
- package/build/ui/components/map.d.ts +26 -0
- package/build/ui/components/message.d.ts +24 -0
- package/build/ui/components/nav.d.ts +12 -0
- package/build/ui/components/page-header.d.ts +27 -0
- package/build/ui/components/popover.d.ts +10 -0
- package/build/ui/components/progress.d.ts +4 -0
- package/build/ui/components/radio.d.ts +6 -0
- package/build/ui/components/resizable.d.ts +7 -0
- package/build/ui/components/scroll-area.d.ts +5 -0
- package/build/ui/components/segmented.d.ts +6 -0
- package/build/ui/components/select.d.ts +15 -0
- package/build/ui/components/separator.d.ts +4 -0
- package/build/ui/components/sheet.d.ts +14 -0
- package/build/ui/components/skeleton.d.ts +3 -0
- package/build/ui/components/slider.d.ts +15 -0
- package/build/ui/components/snackbar.d.ts +3 -0
- package/build/ui/components/sonner.d.ts +4 -0
- package/build/ui/components/spinner.d.ts +5 -0
- package/build/ui/components/statistic.d.ts +19 -0
- package/build/ui/components/stepper.d.ts +12 -0
- package/build/ui/components/switch.d.ts +6 -0
- package/build/ui/components/table.d.ts +24 -0
- package/build/ui/components/textarea.d.ts +3 -0
- package/build/ui/components/timeline.d.ts +15 -0
- package/build/ui/components/toggle-group.d.ts +10 -0
- package/build/ui/components/toggle.d.ts +9 -0
- package/build/ui/components/tooltip.d.ts +7 -0
- package/build/ui/index.d.ts +46 -0
- package/build/ui/index.js +8 -0
- package/build/ui/lib/utils.d.ts +2 -0
- package/build/ui/reference/README.md +11 -0
- package/build/ui/reference/components/ai.tsx +291 -0
- package/build/ui/reference/components/alert-dialog.tsx +208 -0
- package/build/ui/reference/components/alert.tsx +112 -0
- package/build/ui/reference/components/avatar.tsx +158 -0
- package/build/ui/reference/components/badge.tsx +160 -0
- package/build/ui/reference/components/button.tsx +100 -0
- package/build/ui/reference/components/calendar.tsx +119 -0
- package/build/ui/reference/components/card.tsx +144 -0
- package/build/ui/reference/components/chart.tsx +1394 -0
- package/build/ui/reference/components/checkbox.tsx +44 -0
- package/build/ui/reference/components/data-table.tsx +480 -0
- package/build/ui/reference/components/dialog.tsx +172 -0
- package/build/ui/reference/components/dropdown-menu.tsx +245 -0
- package/build/ui/reference/components/empty-state.tsx +63 -0
- package/build/ui/reference/components/file-upload.tsx +116 -0
- package/build/ui/reference/components/input.tsx +114 -0
- package/build/ui/reference/components/label.tsx +19 -0
- package/build/ui/reference/components/list.tsx +191 -0
- package/build/ui/reference/components/map.css +251 -0
- package/build/ui/reference/components/map.tsx +294 -0
- package/build/ui/reference/components/message.tsx +171 -0
- package/build/ui/reference/components/nav.tsx +113 -0
- package/build/ui/reference/components/page-header.tsx +213 -0
- package/build/ui/reference/components/popover.tsx +76 -0
- package/build/ui/reference/components/progress.tsx +31 -0
- package/build/ui/reference/components/radio.tsx +65 -0
- package/build/ui/reference/components/resizable.tsx +40 -0
- package/build/ui/reference/components/scroll-area.tsx +55 -0
- package/build/ui/reference/components/segmented.tsx +45 -0
- package/build/ui/reference/components/select.tsx +185 -0
- package/build/ui/reference/components/separator.tsx +26 -0
- package/build/ui/reference/components/sheet.tsx +173 -0
- package/build/ui/reference/components/skeleton.tsx +15 -0
- package/build/ui/reference/components/slider.tsx +161 -0
- package/build/ui/reference/components/snackbar.tsx +27 -0
- package/build/ui/reference/components/sonner.tsx +43 -0
- package/build/ui/reference/components/spinner.tsx +27 -0
- package/build/ui/reference/components/statistic.tsx +122 -0
- package/build/ui/reference/components/stepper.tsx +138 -0
- package/build/ui/reference/components/switch.tsx +47 -0
- package/build/ui/reference/components/table.tsx +233 -0
- package/build/ui/reference/components/textarea.tsx +28 -0
- package/build/ui/reference/components/timeline.tsx +94 -0
- package/build/ui/reference/components/toggle-group.tsx +86 -0
- package/build/ui/reference/components/toggle.tsx +46 -0
- package/build/ui/reference/components/tooltip.tsx +53 -0
- package/build/ui/reference/index.ts +49 -0
- package/build/ui/reference/lib/utils.ts +34 -0
- package/build/ui/standalone-stub.js +5 -0
- package/build/ui/standalone.js +135 -0
- package/build/ui/styles.css +3 -0
- package/connectors/package.json +8 -0
- package/package.json +114 -0
- package/query/package.json +8 -0
- package/shell/package.json +8 -0
- package/template/AGENTS.md +70 -0
- package/template/CLAUDE.md +4 -0
- package/template/README.md +102 -0
- package/template/_gitignore +6 -0
- package/template/commitlint.config.js +12 -0
- package/template/package.json +31 -0
- package/template/public/index.html +13 -0
- package/template/src/App.tsx +171 -0
- package/template/src/bootstrap.tsx +13 -0
- package/template/src/index.tsx +1 -0
- package/template/src/lifecycle.ts +20 -0
- package/template/tsconfig.json +31 -0
- package/template/webpack.config.js +112 -0
- package/template/webpack.local.config.js +68 -0
- package/ui/package.json +8 -0
|
@@ -0,0 +1,185 @@
|
|
|
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 p-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
|
+
position = 'item-aligned',
|
|
57
|
+
align = 'center',
|
|
58
|
+
...props
|
|
59
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
60
|
+
return (
|
|
61
|
+
<SelectPrimitive.Portal>
|
|
62
|
+
<SelectPrimitive.Content
|
|
63
|
+
data-slot="select-content"
|
|
64
|
+
data-align-trigger={position === 'item-aligned'}
|
|
65
|
+
className={cn(
|
|
66
|
+
'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 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 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',
|
|
67
|
+
position === 'popper' &&
|
|
68
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
69
|
+
className,
|
|
70
|
+
)}
|
|
71
|
+
position={position}
|
|
72
|
+
align={align}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
<SelectScrollUpButton />
|
|
76
|
+
<SelectPrimitive.Viewport
|
|
77
|
+
data-position={position}
|
|
78
|
+
className={cn(
|
|
79
|
+
'data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)',
|
|
80
|
+
position === 'popper' && '',
|
|
81
|
+
)}
|
|
82
|
+
>
|
|
83
|
+
{children}
|
|
84
|
+
</SelectPrimitive.Viewport>
|
|
85
|
+
<SelectScrollDownButton />
|
|
86
|
+
</SelectPrimitive.Content>
|
|
87
|
+
</SelectPrimitive.Portal>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
92
|
+
return (
|
|
93
|
+
<SelectPrimitive.Label
|
|
94
|
+
data-slot="select-label"
|
|
95
|
+
className={cn('px-3 py-2.5 text-xs text-muted-foreground', className)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function SelectItem({
|
|
102
|
+
className,
|
|
103
|
+
children,
|
|
104
|
+
...props
|
|
105
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
106
|
+
return (
|
|
107
|
+
<SelectPrimitive.Item
|
|
108
|
+
data-slot="select-item"
|
|
109
|
+
className={cn(
|
|
110
|
+
"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",
|
|
111
|
+
className,
|
|
112
|
+
)}
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
|
|
116
|
+
<SelectPrimitive.ItemIndicator>
|
|
117
|
+
<CheckIcon className="pointer-events-none" />
|
|
118
|
+
</SelectPrimitive.ItemIndicator>
|
|
119
|
+
</span>
|
|
120
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
121
|
+
</SelectPrimitive.Item>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function SelectSeparator({
|
|
126
|
+
className,
|
|
127
|
+
...props
|
|
128
|
+
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
129
|
+
return (
|
|
130
|
+
<SelectPrimitive.Separator
|
|
131
|
+
data-slot="select-separator"
|
|
132
|
+
className={cn('pointer-events-none -mx-1.5 my-1.5 h-px bg-border', className)}
|
|
133
|
+
{...props}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function SelectScrollUpButton({
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
142
|
+
return (
|
|
143
|
+
<SelectPrimitive.ScrollUpButton
|
|
144
|
+
data-slot="select-scroll-up-button"
|
|
145
|
+
className={cn(
|
|
146
|
+
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
147
|
+
className,
|
|
148
|
+
)}
|
|
149
|
+
{...props}
|
|
150
|
+
>
|
|
151
|
+
<ChevronUpIcon />
|
|
152
|
+
</SelectPrimitive.ScrollUpButton>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function SelectScrollDownButton({
|
|
157
|
+
className,
|
|
158
|
+
...props
|
|
159
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
160
|
+
return (
|
|
161
|
+
<SelectPrimitive.ScrollDownButton
|
|
162
|
+
data-slot="select-scroll-down-button"
|
|
163
|
+
className={cn(
|
|
164
|
+
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
165
|
+
className,
|
|
166
|
+
)}
|
|
167
|
+
{...props}
|
|
168
|
+
>
|
|
169
|
+
<ChevronDownIcon />
|
|
170
|
+
</SelectPrimitive.ScrollDownButton>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
Select,
|
|
176
|
+
SelectContent,
|
|
177
|
+
SelectGroup,
|
|
178
|
+
SelectItem,
|
|
179
|
+
SelectLabel,
|
|
180
|
+
SelectScrollDownButton,
|
|
181
|
+
SelectScrollUpButton,
|
|
182
|
+
SelectSeparator,
|
|
183
|
+
SelectTrigger,
|
|
184
|
+
SelectValue,
|
|
185
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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 };
|
|
@@ -0,0 +1,173 @@
|
|
|
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
|
+
|
|
23
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
24
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const SheetTrigger = React.forwardRef<
|
|
28
|
+
HTMLButtonElement,
|
|
29
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Trigger>
|
|
30
|
+
>(function SheetTrigger({ ...props }, ref) {
|
|
31
|
+
return <SheetPrimitive.Trigger ref={ref} data-slot="sheet-trigger" {...props} />;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const SheetClose = React.forwardRef<
|
|
35
|
+
HTMLButtonElement,
|
|
36
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Close>
|
|
37
|
+
>(function SheetClose({ ...props }, ref) {
|
|
38
|
+
return <SheetPrimitive.Close ref={ref} data-slot="sheet-close" {...props} />;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
42
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const SheetOverlay = React.forwardRef<
|
|
46
|
+
HTMLDivElement,
|
|
47
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
48
|
+
>(function SheetOverlay({ className, ...props }, ref) {
|
|
49
|
+
return (
|
|
50
|
+
<SheetPrimitive.Overlay
|
|
51
|
+
ref={ref}
|
|
52
|
+
data-slot="sheet-overlay"
|
|
53
|
+
className={cn(
|
|
54
|
+
'fixed inset-0 z-50 bg-black/30 duration-100 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 SheetContent = React.forwardRef<
|
|
63
|
+
HTMLDivElement,
|
|
64
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content> & {
|
|
65
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
66
|
+
showCloseButton?: boolean;
|
|
67
|
+
}
|
|
68
|
+
>(function SheetContent(
|
|
69
|
+
{ className, children, side = 'right', showCloseButton = true, ...props },
|
|
70
|
+
ref,
|
|
71
|
+
) {
|
|
72
|
+
return (
|
|
73
|
+
<SheetPortal>
|
|
74
|
+
<SheetOverlay />
|
|
75
|
+
<SheetPrimitive.Content
|
|
76
|
+
ref={ref}
|
|
77
|
+
data-slot="sheet-content"
|
|
78
|
+
data-side={side}
|
|
79
|
+
className={cn(
|
|
80
|
+
/* FLOATS with a margin on every side, rather than butting against the
|
|
81
|
+
* window edge. Butted against the edge a drawer becomes part of the
|
|
82
|
+
* window frame and the fact that it is dismissible stops being
|
|
83
|
+
* legible; inset, the page shows through on all four sides and it
|
|
84
|
+
* reads as a separate object you could close. Radius is 18px — the
|
|
85
|
+
* grouped-surface step — because it is the largest surface on screen. */
|
|
86
|
+
'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',
|
|
87
|
+
'data-[side=right]:inset-y-3 data-[side=right]:right-3 data-[side=right]:w-[calc(100%-1.5rem)] data-[side=right]:sm:max-w-md',
|
|
88
|
+
'data-[side=left]:inset-y-3 data-[side=left]:left-3 data-[side=left]:w-[calc(100%-1.5rem)] data-[side=left]:sm:max-w-md',
|
|
89
|
+
'data-[side=bottom]:inset-x-3 data-[side=bottom]:bottom-3 data-[side=bottom]:h-auto',
|
|
90
|
+
'data-[side=top]:inset-x-3 data-[side=top]:top-3 data-[side=top]:h-auto',
|
|
91
|
+
'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',
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
{showCloseButton && (
|
|
98
|
+
<SheetPrimitive.Close data-slot="sheet-close" asChild>
|
|
99
|
+
<Button variant="ghost" className="absolute top-4 right-4 bg-secondary" size="icon-sm">
|
|
100
|
+
<XIcon />
|
|
101
|
+
<span className="sr-only">Close</span>
|
|
102
|
+
</Button>
|
|
103
|
+
</SheetPrimitive.Close>
|
|
104
|
+
)}
|
|
105
|
+
</SheetPrimitive.Content>
|
|
106
|
+
</SheetPortal>
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const SheetHeader = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
|
|
111
|
+
function SheetHeader({ className, ...props }, ref) {
|
|
112
|
+
return (
|
|
113
|
+
<div
|
|
114
|
+
ref={ref}
|
|
115
|
+
data-slot="sheet-header"
|
|
116
|
+
className={cn('flex flex-col gap-1.5 p-6', className)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const SheetFooter = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
|
|
124
|
+
function SheetFooter({ className, ...props }, ref) {
|
|
125
|
+
return (
|
|
126
|
+
<div
|
|
127
|
+
ref={ref}
|
|
128
|
+
data-slot="sheet-footer"
|
|
129
|
+
className={cn('mt-auto flex flex-col gap-2 p-6', className)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const SheetTitle = React.forwardRef<
|
|
137
|
+
HTMLHeadingElement,
|
|
138
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
139
|
+
>(function SheetTitle({ className, ...props }, ref) {
|
|
140
|
+
return (
|
|
141
|
+
<SheetPrimitive.Title
|
|
142
|
+
ref={ref}
|
|
143
|
+
data-slot="sheet-title"
|
|
144
|
+
className={cn('text-ui font-medium text-foreground', className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const SheetDescription = React.forwardRef<
|
|
151
|
+
HTMLParagraphElement,
|
|
152
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
153
|
+
>(function SheetDescription({ className, ...props }, ref) {
|
|
154
|
+
return (
|
|
155
|
+
<SheetPrimitive.Description
|
|
156
|
+
ref={ref}
|
|
157
|
+
data-slot="sheet-description"
|
|
158
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
Sheet,
|
|
166
|
+
SheetTrigger,
|
|
167
|
+
SheetClose,
|
|
168
|
+
SheetContent,
|
|
169
|
+
SheetHeader,
|
|
170
|
+
SheetFooter,
|
|
171
|
+
SheetTitle,
|
|
172
|
+
SheetDescription,
|
|
173
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* 5px track, 20px floating thumb on a two-layer shadow, filled portion in
|
|
10
|
+
* brand. The filled range is an affirmative reading of the value, which is the
|
|
11
|
+
* one place a slider earns brand; the thumb stays white so it reads as a
|
|
12
|
+
* physical control on any track colour.
|
|
13
|
+
*/
|
|
14
|
+
function Slider({ className, ...props }: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
|
15
|
+
return (
|
|
16
|
+
<SliderPrimitive.Root
|
|
17
|
+
data-slot="slider"
|
|
18
|
+
className={cn('relative flex w-full touch-none items-center select-none', className)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<SliderPrimitive.Track
|
|
22
|
+
data-slot="slider-track"
|
|
23
|
+
className="relative h-[5px] w-full grow overflow-hidden rounded-full bg-fill-2"
|
|
24
|
+
>
|
|
25
|
+
<SliderPrimitive.Range data-slot="slider-range" className="absolute h-full bg-brand" />
|
|
26
|
+
</SliderPrimitive.Track>
|
|
27
|
+
<SliderPrimitive.Thumb
|
|
28
|
+
data-slot="slider-thumb"
|
|
29
|
+
className="block size-5 rounded-full border-0 bg-white shadow-[0_1px_4px_rgb(0_0_0/0.2),0_3px_10px_rgb(0_0_0/0.12)] outline-none focus-visible:ring-3 focus-visible:ring-ring-control/35"
|
|
30
|
+
/>
|
|
31
|
+
</SliderPrimitive.Root>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Rating. Read-only by default: a star row that accepts clicks is rare in an
|
|
36
|
+
* enterprise tool and an interactive-looking control that does nothing is
|
|
37
|
+
* worse than a static one. */
|
|
38
|
+
function Rating({
|
|
39
|
+
value,
|
|
40
|
+
max = 5,
|
|
41
|
+
className,
|
|
42
|
+
onRate,
|
|
43
|
+
...props
|
|
44
|
+
}: Omit<React.ComponentProps<'span'>, 'children'> & {
|
|
45
|
+
value: number;
|
|
46
|
+
max?: number;
|
|
47
|
+
onRate?: (value: number) => void;
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<span
|
|
51
|
+
data-slot="rating"
|
|
52
|
+
role={onRate ? 'radiogroup' : 'img'}
|
|
53
|
+
aria-label={`${value} out of ${max}`}
|
|
54
|
+
className={cn('inline-flex gap-0.5', className)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{Array.from({ length: max }, (_, i) => {
|
|
58
|
+
const on = i < value;
|
|
59
|
+
const star = (
|
|
60
|
+
<svg viewBox="0 0 24 24" fill="currentColor" className="size-4">
|
|
61
|
+
<path d="M12 2.5l2.9 6.1 6.6.9-4.8 4.6 1.2 6.6-5.9-3.2-5.9 3.2 1.2-6.6L2.5 9.5l6.6-.9z" />
|
|
62
|
+
</svg>
|
|
63
|
+
);
|
|
64
|
+
return onRate ? (
|
|
65
|
+
// role=radio + aria-checked, because the wrapper claims radiogroup: a
|
|
66
|
+
// radiogroup whose children are plain buttons owns no radios, so the
|
|
67
|
+
// current rating was conveyed by colour alone
|
|
68
|
+
<button
|
|
69
|
+
key={i}
|
|
70
|
+
type="button"
|
|
71
|
+
role="radio"
|
|
72
|
+
aria-checked={i + 1 === value}
|
|
73
|
+
aria-label={`${i + 1}`}
|
|
74
|
+
onClick={() => onRate(i + 1)}
|
|
75
|
+
className={cn(
|
|
76
|
+
'outline-none focus-visible:ring-3 focus-visible:ring-ring-control/35',
|
|
77
|
+
on ? 'text-warning' : 'text-border-strong',
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{star}
|
|
81
|
+
</button>
|
|
82
|
+
) : (
|
|
83
|
+
<span key={i} className={on ? 'text-warning' : 'text-border-strong'}>
|
|
84
|
+
{star}
|
|
85
|
+
</span>
|
|
86
|
+
);
|
|
87
|
+
})}
|
|
88
|
+
</span>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Numeric stepper. One filled track with hairline dividers and no outer
|
|
93
|
+
* border — the fill is the container, so the group reads as a single control
|
|
94
|
+
* instead of three adjacent buttons. */
|
|
95
|
+
function StepperInput({
|
|
96
|
+
className,
|
|
97
|
+
value,
|
|
98
|
+
onValueChange,
|
|
99
|
+
min,
|
|
100
|
+
max,
|
|
101
|
+
...props
|
|
102
|
+
}: Omit<React.ComponentProps<'span'>, 'children' | 'onChange'> & {
|
|
103
|
+
value: number;
|
|
104
|
+
onValueChange?: (value: number) => void;
|
|
105
|
+
min?: number;
|
|
106
|
+
max?: number;
|
|
107
|
+
}) {
|
|
108
|
+
const step = (delta: number) => {
|
|
109
|
+
const next = value + delta;
|
|
110
|
+
if (min !== undefined && next < min) return;
|
|
111
|
+
if (max !== undefined && next > max) return;
|
|
112
|
+
onValueChange?.(next);
|
|
113
|
+
};
|
|
114
|
+
return (
|
|
115
|
+
<span
|
|
116
|
+
data-slot="stepper-input"
|
|
117
|
+
className={cn('inline-flex items-center overflow-hidden rounded-lg bg-fill-1', className)}
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
<button
|
|
121
|
+
type="button"
|
|
122
|
+
aria-label="Decrease"
|
|
123
|
+
onClick={() => step(-1)}
|
|
124
|
+
className="grid size-control place-items-center text-muted-foreground transition-colors hover:bg-fill-2 hover:text-foreground [&>svg]:size-3"
|
|
125
|
+
>
|
|
126
|
+
<svg
|
|
127
|
+
viewBox="0 0 24 24"
|
|
128
|
+
fill="none"
|
|
129
|
+
stroke="currentColor"
|
|
130
|
+
strokeWidth={2.5}
|
|
131
|
+
strokeLinecap="round"
|
|
132
|
+
>
|
|
133
|
+
<path d="M5 12h14" />
|
|
134
|
+
</svg>
|
|
135
|
+
</button>
|
|
136
|
+
<span aria-hidden className="h-4 w-px self-center bg-fill-3" />
|
|
137
|
+
<span className="grid h-control min-w-9 place-items-center px-1 text-ui tabular-nums">
|
|
138
|
+
{value}
|
|
139
|
+
</span>
|
|
140
|
+
<span aria-hidden className="h-4 w-px self-center bg-fill-3" />
|
|
141
|
+
<button
|
|
142
|
+
type="button"
|
|
143
|
+
aria-label="Increase"
|
|
144
|
+
onClick={() => step(1)}
|
|
145
|
+
className="grid size-control place-items-center text-muted-foreground transition-colors hover:bg-fill-2 hover:text-foreground [&>svg]:size-3"
|
|
146
|
+
>
|
|
147
|
+
<svg
|
|
148
|
+
viewBox="0 0 24 24"
|
|
149
|
+
fill="none"
|
|
150
|
+
stroke="currentColor"
|
|
151
|
+
strokeWidth={2.5}
|
|
152
|
+
strokeLinecap="round"
|
|
153
|
+
>
|
|
154
|
+
<path d="M12 5v14M5 12h14" />
|
|
155
|
+
</svg>
|
|
156
|
+
</button>
|
|
157
|
+
</span>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export { Slider, Rating, StepperInput };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Snackbar — inverted surface, one line, one action. Distinct from Toast on
|
|
7
|
+
* purpose: a toast reports something that happened and stacks; a snackbar is a
|
|
8
|
+
* single transient acknowledgement with an undo, so it is a bar rather than a
|
|
9
|
+
* card and only ever one is on screen.
|
|
10
|
+
*/
|
|
11
|
+
function Snackbar({ className, ...props }: React.ComponentProps<'div'>) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
data-slot="snackbar"
|
|
15
|
+
role="status"
|
|
16
|
+
className={cn(
|
|
17
|
+
'flex h-10 items-center gap-3 rounded-lg bg-foreground pr-2 pl-3.5 text-xs text-background',
|
|
18
|
+
// the action inherits the inverted surface rather than the page one
|
|
19
|
+
'[&_[data-slot=button]]:text-background [&_[data-slot=button]]:hover:bg-white/12',
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Snackbar };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Toaster as Sonner, type ToasterProps } from 'sonner';
|
|
3
|
+
import {
|
|
4
|
+
CircleCheckIcon,
|
|
5
|
+
InfoIcon,
|
|
6
|
+
TriangleAlertIcon,
|
|
7
|
+
OctagonXIcon,
|
|
8
|
+
Loader2Icon,
|
|
9
|
+
} from 'lucide-react';
|
|
10
|
+
|
|
11
|
+
// Theme is injected by the host (the shell passes its resolved theme) so the
|
|
12
|
+
// package stays decoupled from any particular ThemeProvider implementation.
|
|
13
|
+
const Toaster = ({ theme = 'system', ...props }: ToasterProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<Sonner
|
|
16
|
+
theme={theme}
|
|
17
|
+
className="toaster group"
|
|
18
|
+
icons={{
|
|
19
|
+
success: <CircleCheckIcon className="size-4" />,
|
|
20
|
+
info: <InfoIcon className="size-4" />,
|
|
21
|
+
warning: <TriangleAlertIcon className="size-4" />,
|
|
22
|
+
error: <OctagonXIcon className="size-4" />,
|
|
23
|
+
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
24
|
+
}}
|
|
25
|
+
style={
|
|
26
|
+
{
|
|
27
|
+
'--normal-bg': 'var(--popover)',
|
|
28
|
+
'--normal-text': 'var(--popover-foreground)',
|
|
29
|
+
'--normal-border': 'var(--border)',
|
|
30
|
+
'--border-radius': 'var(--radius)',
|
|
31
|
+
} as React.CSSProperties
|
|
32
|
+
}
|
|
33
|
+
toastOptions={{
|
|
34
|
+
classNames: {
|
|
35
|
+
toast: 'cn-toast',
|
|
36
|
+
},
|
|
37
|
+
}}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { Toaster };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@rise-x/ui/lib/utils';
|
|
4
|
+
|
|
5
|
+
/* One ring, one weight. `prefers-reduced-motion` stops the rotation — a static
|
|
6
|
+
* ring still reads as "waiting". */
|
|
7
|
+
function Spinner({
|
|
8
|
+
className,
|
|
9
|
+
size = 16,
|
|
10
|
+
...props
|
|
11
|
+
}: Omit<React.ComponentProps<'span'>, 'children'> & { size?: number }) {
|
|
12
|
+
return (
|
|
13
|
+
<span
|
|
14
|
+
data-slot="spinner"
|
|
15
|
+
role="status"
|
|
16
|
+
aria-label="Loading"
|
|
17
|
+
style={{ width: size, height: size, borderWidth: size <= 14 ? 1.5 : 2 }}
|
|
18
|
+
className={cn(
|
|
19
|
+
'inline-block shrink-0 rounded-full border-border border-t-muted-foreground motion-safe:animate-spin',
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Spinner };
|