@rise-x/apps-sdk 0.8.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +209 -21
  2. package/build/rsbuild/index.d.ts +36 -0
  3. package/build/rsbuild/index.js +225 -0
  4. package/build/ui/classes.json +209 -0
  5. package/build/ui/components/ai.d.ts +33 -1
  6. package/build/ui/components/app-frame.d.ts +19 -0
  7. package/build/ui/components/chat-input.d.ts +28 -0
  8. package/build/ui/components/message-scroller.d.ts +34 -10
  9. package/build/ui/components/nav.d.ts +2 -1
  10. package/build/ui/components/sheet.d.ts +10 -0
  11. package/build/ui/components/thinking-rings.d.ts +4 -0
  12. package/build/ui/demo.html +26794 -0
  13. package/build/ui/index.d.ts +3 -0
  14. package/build/ui/standalone.js +59 -58
  15. package/build/ui/styles.css +1 -1
  16. package/package.json +24 -3
  17. package/rsbuild/package.json +8 -0
  18. package/template/AGENTS.md +18 -10
  19. package/template/README.md +5 -5
  20. package/template/package.json +8 -9
  21. package/template/rsbuild.config.mts +17 -0
  22. package/template/src/App.tsx +21 -11
  23. package/template/tsconfig.json +3 -1
  24. package/build/ui/reference/README.md +0 -11
  25. package/build/ui/reference/components/accordion.tsx +0 -85
  26. package/build/ui/reference/components/ai.tsx +0 -291
  27. package/build/ui/reference/components/alert-dialog.tsx +0 -213
  28. package/build/ui/reference/components/alert.tsx +0 -112
  29. package/build/ui/reference/components/aspect-ratio.tsx +0 -28
  30. package/build/ui/reference/components/avatar.tsx +0 -158
  31. package/build/ui/reference/components/badge.tsx +0 -160
  32. package/build/ui/reference/components/button-group.tsx +0 -77
  33. package/build/ui/reference/components/button.tsx +0 -107
  34. package/build/ui/reference/components/calendar.tsx +0 -119
  35. package/build/ui/reference/components/card.tsx +0 -144
  36. package/build/ui/reference/components/carousel.tsx +0 -248
  37. package/build/ui/reference/components/chart.tsx +0 -704
  38. package/build/ui/reference/components/checkbox.tsx +0 -44
  39. package/build/ui/reference/components/collapsible.tsx +0 -43
  40. package/build/ui/reference/components/combobox.tsx +0 -141
  41. package/build/ui/reference/components/command.tsx +0 -181
  42. package/build/ui/reference/components/context-menu.tsx +0 -243
  43. package/build/ui/reference/components/data-table.tsx +0 -650
  44. package/build/ui/reference/components/date-picker.tsx +0 -218
  45. package/build/ui/reference/components/dialog.tsx +0 -172
  46. package/build/ui/reference/components/direction.tsx +0 -22
  47. package/build/ui/reference/components/dropdown-menu.tsx +0 -245
  48. package/build/ui/reference/components/empty-state.tsx +0 -63
  49. package/build/ui/reference/components/field.tsx +0 -252
  50. package/build/ui/reference/components/file-upload.tsx +0 -116
  51. package/build/ui/reference/components/hover-card.tsx +0 -64
  52. package/build/ui/reference/components/input-group.tsx +0 -157
  53. package/build/ui/reference/components/input-otp.tsx +0 -106
  54. package/build/ui/reference/components/input.tsx +0 -86
  55. package/build/ui/reference/components/item.tsx +0 -188
  56. package/build/ui/reference/components/kbd.tsx +0 -43
  57. package/build/ui/reference/components/label.tsx +0 -19
  58. package/build/ui/reference/components/list.tsx +0 -191
  59. package/build/ui/reference/components/map.css +0 -251
  60. package/build/ui/reference/components/map.tsx +0 -294
  61. package/build/ui/reference/components/menubar.tsx +0 -275
  62. package/build/ui/reference/components/message-scroller.tsx +0 -141
  63. package/build/ui/reference/components/message.tsx +0 -171
  64. package/build/ui/reference/components/nav.tsx +0 -122
  65. package/build/ui/reference/components/navigation-menu.tsx +0 -191
  66. package/build/ui/reference/components/page-header.tsx +0 -245
  67. package/build/ui/reference/components/popover.tsx +0 -76
  68. package/build/ui/reference/components/progress.tsx +0 -31
  69. package/build/ui/reference/components/radio.tsx +0 -65
  70. package/build/ui/reference/components/resizable.tsx +0 -40
  71. package/build/ui/reference/components/scroll-area.tsx +0 -55
  72. package/build/ui/reference/components/segmented.tsx +0 -45
  73. package/build/ui/reference/components/select.tsx +0 -188
  74. package/build/ui/reference/components/separator.tsx +0 -26
  75. package/build/ui/reference/components/sheet.tsx +0 -184
  76. package/build/ui/reference/components/skeleton.tsx +0 -15
  77. package/build/ui/reference/components/slider.tsx +0 -161
  78. package/build/ui/reference/components/snackbar.tsx +0 -27
  79. package/build/ui/reference/components/sonner.tsx +0 -43
  80. package/build/ui/reference/components/spinner.tsx +0 -27
  81. package/build/ui/reference/components/statistic.tsx +0 -122
  82. package/build/ui/reference/components/stepper.tsx +0 -138
  83. package/build/ui/reference/components/switch.tsx +0 -47
  84. package/build/ui/reference/components/table.tsx +0 -246
  85. package/build/ui/reference/components/textarea.tsx +0 -28
  86. package/build/ui/reference/components/timeline.tsx +0 -101
  87. package/build/ui/reference/components/toggle-group.tsx +0 -86
  88. package/build/ui/reference/components/toggle.tsx +0 -46
  89. package/build/ui/reference/components/tooltip.tsx +0 -53
  90. package/build/ui/reference/index.ts +0 -68
  91. package/build/ui/reference/lib/utils.ts +0 -34
  92. package/template/webpack.config.js +0 -112
  93. package/template/webpack.local.config.js +0 -68
@@ -1,144 +0,0 @@
1
- import * as React from 'react';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
-
4
- import { cn } from '@rise-x/ui/lib/utils';
5
-
6
- /*
7
- * One container, five intents — and NO outline on any of them. A card is
8
- * defined by its surface plus a whisper of depth; an outline around a white box
9
- * on a grey page is saying something the surface already said, and an outline
10
- * inside an outline is a box in a box.
11
- *
12
- * Status is carried by a TINTED LEADING GLYPH plus a badge, never by a coloured
13
- * edge. An edge stripe reads as something stuck to the card; a glyph reads as
14
- * part of it.
15
- */
16
- const cardVariants = cva('rounded-xl border-0 bg-card text-card-foreground shadow-card', {
17
- variants: {
18
- variant: {
19
- default: '',
20
- /* metric/summary carry numerals, so they get tighter padding via slots */
21
- metric: '',
22
- summary: '',
23
- /* interactive lifts 1px on hover — enough to read as pressable without
24
- * animating a shadow the size of the card */
25
- interactive:
26
- 'cursor-pointer transition-[box-shadow,transform] duration-200 ease-decelerate hover:-translate-y-px hover:shadow-[0_6px_18px_-5px_rgb(16_24_40/0.14),0_1px_3px_rgb(16_24_40/0.07)]',
27
- status: '',
28
- },
29
- },
30
- defaultVariants: { variant: 'default' },
31
- });
32
-
33
- function Card({
34
- className,
35
- variant = 'default',
36
- ...props
37
- }: React.ComponentProps<'div'> & VariantProps<typeof cardVariants>) {
38
- return (
39
- <div
40
- data-slot="card"
41
- data-variant={variant}
42
- className={cn(cardVariants({ variant }), className)}
43
- {...props}
44
- />
45
- );
46
- }
47
-
48
- function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
49
- return (
50
- <div
51
- data-slot="card-header"
52
- className={cn('flex items-start gap-3 px-4 pt-3.5 pb-3', className)}
53
- {...props}
54
- />
55
- );
56
- }
57
-
58
- /* The tinted glyph that carries status. Tone is on the glyph, not the card. */
59
- const cardGlyphVariants = cva(
60
- 'grid size-7 shrink-0 place-items-center rounded-md [&_svg]:size-3.5',
61
- {
62
- variants: {
63
- tone: {
64
- neutral: 'bg-fill-1 text-muted-foreground',
65
- success: 'bg-success/13 text-success-text',
66
- warning: 'bg-warning/15 text-warning-text',
67
- error: 'bg-error/12 text-error-text',
68
- info: 'bg-info/12 text-info-text',
69
- ai: 'bg-ai/12 text-ai-text',
70
- },
71
- },
72
- defaultVariants: { tone: 'neutral' },
73
- },
74
- );
75
-
76
- function CardGlyph({
77
- className,
78
- tone = 'neutral',
79
- ...props
80
- }: React.ComponentProps<'span'> & VariantProps<typeof cardGlyphVariants>) {
81
- return (
82
- <span
83
- data-slot="card-glyph"
84
- className={cn(cardGlyphVariants({ tone }), className)}
85
- {...props}
86
- />
87
- );
88
- }
89
-
90
- function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
91
- return (
92
- <div
93
- data-slot="card-title"
94
- className={cn('text-ui leading-tight font-medium', className)}
95
- {...props}
96
- />
97
- );
98
- }
99
-
100
- function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
101
- return (
102
- <div
103
- data-slot="card-description"
104
- className={cn('mt-0.5 text-xs text-muted-foreground', className)}
105
- {...props}
106
- />
107
- );
108
- }
109
-
110
- function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
111
- return (
112
- <div
113
- data-slot="card-content"
114
- className={cn('px-4 pb-4 [&:first-child]:pt-4', className)}
115
- {...props}
116
- />
117
- );
118
- }
119
-
120
- /* Inset separator: starts where the content starts, not at the container edge,
121
- * so the card reads as one surface rather than stacked bands. */
122
- function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
123
- return (
124
- <div
125
- data-slot="card-footer"
126
- className={cn(
127
- 'mx-4 flex items-center gap-2 border-t border-border-subtle py-3 text-xs text-muted-foreground',
128
- className,
129
- )}
130
- {...props}
131
- />
132
- );
133
- }
134
-
135
- export {
136
- Card,
137
- CardHeader,
138
- CardGlyph,
139
- CardTitle,
140
- CardDescription,
141
- CardContent,
142
- CardFooter,
143
- cardVariants,
144
- };
@@ -1,248 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
5
- import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react';
6
-
7
- import { cn } from '@rise-x/ui/lib/utils';
8
- import { Button } from '@rise-x/ui/components/button';
9
-
10
- /*
11
- * A horizontal (or vertical) slider for media and cards.
12
- *
13
- * READ THIS BEFORE USING IT IN AN ENTERPRISE VIEW. A carousel hides content
14
- * behind an interaction, which is the opposite of data-first: anything the reader
15
- * needs to compare must not be in one. It earns its place for media — product
16
- * photos, scanned pages, a document preview — and for a genuinely browsable strip
17
- * where seeing everything at once is not the point. For a set of records, a
18
- * wrapping grid or a table is the right answer and this is the wrong one.
19
- *
20
- * NO AUTOPLAY, DELIBERATELY. Content that moves on its own competes for attention
21
- * with the work, and it is a documented accessibility failure for anyone who reads
22
- * slowly. If a caller wants it they can pass the Embla plugin themselves and own
23
- * that decision.
24
- *
25
- * THE ARROWS ARE ALWAYS RENDERED AND DISABLE AT THE ENDS rather than disappearing.
26
- * A control that vanishes tells the reader nothing about why; a disabled one says
27
- * "this is the end". Same reason the filter trigger keeps its shape when empty.
28
- */
29
-
30
- type CarouselApi = UseEmblaCarouselType[1];
31
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
32
- type CarouselOptions = UseCarouselParameters[0];
33
- type CarouselPlugin = UseCarouselParameters[1];
34
-
35
- type CarouselContextValue = {
36
- carouselRef: UseEmblaCarouselType[0];
37
- api: CarouselApi;
38
- orientation: 'horizontal' | 'vertical';
39
- scrollPrev: () => void;
40
- scrollNext: () => void;
41
- canScrollPrev: boolean;
42
- canScrollNext: boolean;
43
- };
44
-
45
- const CarouselContext = React.createContext<CarouselContextValue | null>(null);
46
-
47
- function useCarousel() {
48
- const context = React.useContext(CarouselContext);
49
- if (!context) {
50
- throw new Error('useCarousel must be used within a <Carousel />');
51
- }
52
- return context;
53
- }
54
-
55
- const Carousel = React.forwardRef<
56
- HTMLDivElement,
57
- React.ComponentProps<'div'> & {
58
- opts?: CarouselOptions;
59
- plugins?: CarouselPlugin;
60
- orientation?: 'horizontal' | 'vertical';
61
- setApi?: (api: CarouselApi) => void;
62
- }
63
- >(function Carousel(
64
- { orientation = 'horizontal', opts, setApi, plugins, className, children, ...props },
65
- ref,
66
- ) {
67
- const [carouselRef, api] = useEmblaCarousel(
68
- { ...opts, axis: orientation === 'horizontal' ? 'x' : 'y' },
69
- plugins,
70
- );
71
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
72
- const [canScrollNext, setCanScrollNext] = React.useState(false);
73
-
74
- const onSelect = React.useCallback((emblaApi: CarouselApi) => {
75
- if (!emblaApi) return;
76
- setCanScrollPrev(emblaApi.canScrollPrev());
77
- setCanScrollNext(emblaApi.canScrollNext());
78
- }, []);
79
-
80
- const scrollPrev = React.useCallback(() => api?.scrollPrev(), [api]);
81
- const scrollNext = React.useCallback(() => api?.scrollNext(), [api]);
82
-
83
- /* The arrow keys match the AXIS — left/right for a horizontal strip, up/down
84
- * for a vertical one — and a control inside a slide keeps its own arrows: on
85
- * the capture phase an unconditional preventDefault would take the caret keys
86
- * away from a text field and the option keys away from a select. */
87
- const handleKeyDown = React.useCallback(
88
- (event: React.KeyboardEvent<HTMLDivElement>) => {
89
- const target = event.target as HTMLElement | null;
90
- if (target?.closest('input, textarea, select, [contenteditable=""], [contenteditable=true]'))
91
- return;
92
- const [prevKey, nextKey] =
93
- orientation === 'horizontal' ? ['ArrowLeft', 'ArrowRight'] : ['ArrowUp', 'ArrowDown'];
94
- if (event.key === prevKey) {
95
- event.preventDefault();
96
- scrollPrev();
97
- } else if (event.key === nextKey) {
98
- event.preventDefault();
99
- scrollNext();
100
- }
101
- },
102
- [orientation, scrollPrev, scrollNext],
103
- );
104
-
105
- React.useEffect(() => {
106
- if (api && setApi) setApi(api);
107
- }, [api, setApi]);
108
-
109
- React.useEffect(() => {
110
- if (!api) return;
111
- onSelect(api);
112
- api.on('reInit', onSelect);
113
- api.on('select', onSelect);
114
- return () => {
115
- api.off('reInit', onSelect);
116
- api.off('select', onSelect);
117
- };
118
- }, [api, onSelect]);
119
-
120
- return (
121
- <CarouselContext.Provider
122
- value={{
123
- carouselRef,
124
- api,
125
- orientation,
126
- scrollPrev,
127
- scrollNext,
128
- canScrollPrev,
129
- canScrollNext,
130
- }}
131
- >
132
- <div
133
- ref={ref}
134
- data-slot="carousel"
135
- onKeyDownCapture={handleKeyDown}
136
- className={cn('relative', className)}
137
- role="region"
138
- aria-roledescription="carousel"
139
- {...props}
140
- >
141
- {children}
142
- </div>
143
- </CarouselContext.Provider>
144
- );
145
- });
146
-
147
- function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
148
- const { carouselRef, orientation } = useCarousel();
149
- return (
150
- <div ref={carouselRef} data-slot="carousel-viewport" className="overflow-hidden">
151
- <div
152
- data-slot="carousel-content"
153
- className={cn(
154
- 'flex',
155
- // negative margin plus per-item padding is how Embla spaces slides —
156
- // a gap would be measured into the scroll distance and drift
157
- orientation === 'horizontal' ? '-ml-2.5' : '-mt-2.5 flex-col',
158
- className,
159
- )}
160
- {...props}
161
- />
162
- </div>
163
- );
164
- }
165
-
166
- function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
167
- const { orientation } = useCarousel();
168
- return (
169
- <div
170
- data-slot="carousel-item"
171
- role="group"
172
- aria-roledescription="slide"
173
- className={cn(
174
- 'min-w-0 shrink-0 grow-0 basis-full',
175
- orientation === 'horizontal' ? 'pl-2.5' : 'pt-2.5',
176
- className,
177
- )}
178
- {...props}
179
- />
180
- );
181
- }
182
-
183
- function CarouselPrevious({
184
- className,
185
- variant = 'outline',
186
- size = 'icon-sm',
187
- ...props
188
- }: React.ComponentProps<typeof Button>) {
189
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
190
- return (
191
- <Button
192
- data-slot="carousel-previous"
193
- variant={variant}
194
- size={size}
195
- className={cn(
196
- 'absolute rounded-full',
197
- orientation === 'horizontal'
198
- ? 'top-1/2 -left-3.5 -translate-y-1/2'
199
- : '-top-3.5 left-1/2 -translate-x-1/2 rotate-90',
200
- className,
201
- )}
202
- disabled={!canScrollPrev}
203
- onClick={scrollPrev}
204
- {...props}
205
- >
206
- <ArrowLeftIcon />
207
- <span className="sr-only">Previous slide</span>
208
- </Button>
209
- );
210
- }
211
-
212
- function CarouselNext({
213
- className,
214
- variant = 'outline',
215
- size = 'icon-sm',
216
- ...props
217
- }: React.ComponentProps<typeof Button>) {
218
- const { orientation, scrollNext, canScrollNext } = useCarousel();
219
- return (
220
- <Button
221
- data-slot="carousel-next"
222
- variant={variant}
223
- size={size}
224
- className={cn(
225
- 'absolute rounded-full',
226
- orientation === 'horizontal'
227
- ? 'top-1/2 -right-3.5 -translate-y-1/2'
228
- : '-bottom-3.5 left-1/2 -translate-x-1/2 rotate-90',
229
- className,
230
- )}
231
- disabled={!canScrollNext}
232
- onClick={scrollNext}
233
- {...props}
234
- >
235
- <ArrowRightIcon />
236
- <span className="sr-only">Next slide</span>
237
- </Button>
238
- );
239
- }
240
-
241
- export {
242
- type CarouselApi,
243
- Carousel,
244
- CarouselContent,
245
- CarouselItem,
246
- CarouselPrevious,
247
- CarouselNext,
248
- };