@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.
- package/README.md +209 -21
- package/build/rsbuild/index.d.ts +36 -0
- package/build/rsbuild/index.js +225 -0
- package/build/ui/classes.json +209 -0
- package/build/ui/components/ai.d.ts +33 -1
- package/build/ui/components/app-frame.d.ts +19 -0
- package/build/ui/components/chat-input.d.ts +28 -0
- package/build/ui/components/message-scroller.d.ts +34 -10
- package/build/ui/components/nav.d.ts +2 -1
- package/build/ui/components/sheet.d.ts +10 -0
- package/build/ui/components/thinking-rings.d.ts +4 -0
- package/build/ui/demo.html +26794 -0
- package/build/ui/index.d.ts +3 -0
- package/build/ui/standalone.js +59 -58
- package/build/ui/styles.css +1 -1
- package/package.json +24 -3
- package/rsbuild/package.json +8 -0
- package/template/AGENTS.md +18 -10
- package/template/README.md +5 -5
- package/template/package.json +8 -9
- package/template/rsbuild.config.mts +17 -0
- package/template/src/App.tsx +21 -11
- package/template/tsconfig.json +3 -1
- package/build/ui/reference/README.md +0 -11
- package/build/ui/reference/components/accordion.tsx +0 -85
- package/build/ui/reference/components/ai.tsx +0 -291
- package/build/ui/reference/components/alert-dialog.tsx +0 -213
- package/build/ui/reference/components/alert.tsx +0 -112
- package/build/ui/reference/components/aspect-ratio.tsx +0 -28
- package/build/ui/reference/components/avatar.tsx +0 -158
- package/build/ui/reference/components/badge.tsx +0 -160
- package/build/ui/reference/components/button-group.tsx +0 -77
- package/build/ui/reference/components/button.tsx +0 -107
- package/build/ui/reference/components/calendar.tsx +0 -119
- package/build/ui/reference/components/card.tsx +0 -144
- package/build/ui/reference/components/carousel.tsx +0 -248
- package/build/ui/reference/components/chart.tsx +0 -704
- package/build/ui/reference/components/checkbox.tsx +0 -44
- package/build/ui/reference/components/collapsible.tsx +0 -43
- package/build/ui/reference/components/combobox.tsx +0 -141
- package/build/ui/reference/components/command.tsx +0 -181
- package/build/ui/reference/components/context-menu.tsx +0 -243
- package/build/ui/reference/components/data-table.tsx +0 -650
- package/build/ui/reference/components/date-picker.tsx +0 -218
- package/build/ui/reference/components/dialog.tsx +0 -172
- package/build/ui/reference/components/direction.tsx +0 -22
- package/build/ui/reference/components/dropdown-menu.tsx +0 -245
- package/build/ui/reference/components/empty-state.tsx +0 -63
- package/build/ui/reference/components/field.tsx +0 -252
- package/build/ui/reference/components/file-upload.tsx +0 -116
- package/build/ui/reference/components/hover-card.tsx +0 -64
- package/build/ui/reference/components/input-group.tsx +0 -157
- package/build/ui/reference/components/input-otp.tsx +0 -106
- package/build/ui/reference/components/input.tsx +0 -86
- package/build/ui/reference/components/item.tsx +0 -188
- package/build/ui/reference/components/kbd.tsx +0 -43
- package/build/ui/reference/components/label.tsx +0 -19
- package/build/ui/reference/components/list.tsx +0 -191
- package/build/ui/reference/components/map.css +0 -251
- package/build/ui/reference/components/map.tsx +0 -294
- package/build/ui/reference/components/menubar.tsx +0 -275
- package/build/ui/reference/components/message-scroller.tsx +0 -141
- package/build/ui/reference/components/message.tsx +0 -171
- package/build/ui/reference/components/nav.tsx +0 -122
- package/build/ui/reference/components/navigation-menu.tsx +0 -191
- package/build/ui/reference/components/page-header.tsx +0 -245
- package/build/ui/reference/components/popover.tsx +0 -76
- package/build/ui/reference/components/progress.tsx +0 -31
- package/build/ui/reference/components/radio.tsx +0 -65
- package/build/ui/reference/components/resizable.tsx +0 -40
- package/build/ui/reference/components/scroll-area.tsx +0 -55
- package/build/ui/reference/components/segmented.tsx +0 -45
- package/build/ui/reference/components/select.tsx +0 -188
- package/build/ui/reference/components/separator.tsx +0 -26
- package/build/ui/reference/components/sheet.tsx +0 -184
- package/build/ui/reference/components/skeleton.tsx +0 -15
- package/build/ui/reference/components/slider.tsx +0 -161
- package/build/ui/reference/components/snackbar.tsx +0 -27
- package/build/ui/reference/components/sonner.tsx +0 -43
- package/build/ui/reference/components/spinner.tsx +0 -27
- package/build/ui/reference/components/statistic.tsx +0 -122
- package/build/ui/reference/components/stepper.tsx +0 -138
- package/build/ui/reference/components/switch.tsx +0 -47
- package/build/ui/reference/components/table.tsx +0 -246
- package/build/ui/reference/components/textarea.tsx +0 -28
- package/build/ui/reference/components/timeline.tsx +0 -101
- package/build/ui/reference/components/toggle-group.tsx +0 -86
- package/build/ui/reference/components/toggle.tsx +0 -46
- package/build/ui/reference/components/tooltip.tsx +0 -53
- package/build/ui/reference/index.ts +0 -68
- package/build/ui/reference/lib/utils.ts +0 -34
- package/template/webpack.config.js +0 -112
- package/template/webpack.local.config.js +0 -68
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Avatar as AvatarPrimitive } from 'radix-ui';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
* ONE tonal recipe, not a hand-picked pastel set. Every tone derives from a
|
|
10
|
-
* single hue variable: 16% over the surface for the fill, 58% toward the text
|
|
11
|
-
* colour for the initials, one 24% inset ring. No per-colour tuning, and every
|
|
12
|
-
* tone lands at the same visual weight — pastels chosen by eye always drift.
|
|
13
|
-
*
|
|
14
|
-
* THE 58% IS A CONTRAST FLOOR, NOT A TASTE CALL. At 78% — where this started —
|
|
15
|
-
* the initials sat at 3.11:1 for amber, 3.51:1 for tango and 4.29:1 on blue,
|
|
16
|
-
* i.e. below AA at 10px, because the same recipe has to clear its own 16% tint
|
|
17
|
-
* for every hue. Pulling the mix toward the foreground puts the worst tone at
|
|
18
|
-
* 5.21:1 light / 6.39:1 dark while keeping the hue legible. Re-measure every
|
|
19
|
-
* tone against its own tint before changing it.
|
|
20
|
-
*
|
|
21
|
-
* SHAPE carries "who vs what": people are circles, organisations are rounded
|
|
22
|
-
* squares. Shape survives greyscale and never collides with status colour,
|
|
23
|
-
* which a colour-coded distinction would.
|
|
24
|
-
*
|
|
25
|
-
* TINT HAS AN INFORMATION RULE. Tint only when the avatar is the sole
|
|
26
|
-
* identifier — a stack, a bare list, a comment thread. When a name sits right
|
|
27
|
-
* beside it the colour carries nothing, so use the default `neutral`; a table
|
|
28
|
-
* of tinted avatars next to their own labels is just confetti. That is why
|
|
29
|
-
* `tone` is an explicit prop rather than hashed from the initials.
|
|
30
|
-
*/
|
|
31
|
-
const AVATAR_TONES = ['neutral', 'blue', 'tango', 'amber', 'red', 'slate', 'ai'] as const;
|
|
32
|
-
|
|
33
|
-
type AvatarTone = (typeof AVATAR_TONES)[number];
|
|
34
|
-
|
|
35
|
-
function Avatar({
|
|
36
|
-
className,
|
|
37
|
-
size = 'default',
|
|
38
|
-
tone = 'neutral',
|
|
39
|
-
shape = 'circle',
|
|
40
|
-
style,
|
|
41
|
-
...props
|
|
42
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Root> & {
|
|
43
|
-
size?: 'default' | 'sm' | 'lg';
|
|
44
|
-
/** Only tint when the avatar is the sole identifier — see the note above. */
|
|
45
|
-
tone?: AvatarTone;
|
|
46
|
-
/** `org` renders a rounded square. People are circles. */
|
|
47
|
-
shape?: 'circle' | 'org';
|
|
48
|
-
}) {
|
|
49
|
-
return (
|
|
50
|
-
<AvatarPrimitive.Root
|
|
51
|
-
data-slot="avatar"
|
|
52
|
-
data-size={size}
|
|
53
|
-
data-tone={tone}
|
|
54
|
-
data-shape={shape}
|
|
55
|
-
style={
|
|
56
|
-
{
|
|
57
|
-
'--av-h': tone === 'ai' ? 'var(--ai)' : `var(--${tone === 'neutral' ? 'slate' : tone})`,
|
|
58
|
-
...style,
|
|
59
|
-
} as React.CSSProperties
|
|
60
|
-
}
|
|
61
|
-
className={cn(
|
|
62
|
-
/* 24 / 20 / 32px. Smaller than the kit's old 32/24/40 — these sit inside
|
|
63
|
-
* 52px table rows and next to 13px labels, where a 32px default reads as
|
|
64
|
-
* a photo rather than an identifier. */
|
|
65
|
-
'group/avatar relative grid size-6 shrink-0 place-items-center overflow-hidden rounded-full text-[10px] font-medium tracking-[0.01em] select-none',
|
|
66
|
-
'data-[size=sm]:size-5 data-[size=sm]:text-[9px] data-[size=lg]:size-8 data-[size=lg]:text-xs',
|
|
67
|
-
/* rounded square for organisations, stepped with the box so the corner
|
|
68
|
-
* stays proportional: 6px at sm, 8px default, 10px at lg */
|
|
69
|
-
'data-[shape=org]:rounded-md data-[shape=org]:data-[size=sm]:rounded-sm data-[shape=org]:data-[size=lg]:rounded-lg',
|
|
70
|
-
// neutral is the default and spends no colour at all
|
|
71
|
-
'data-[tone=neutral]:bg-muted data-[tone=neutral]:text-muted-foreground data-[tone=neutral]:shadow-[inset_0_0_0_1px_var(--border)]',
|
|
72
|
-
'not-data-[tone=neutral]:bg-[color-mix(in_oklab,var(--av-h)_16%,var(--card))]',
|
|
73
|
-
'not-data-[tone=neutral]:text-[color-mix(in_oklab,var(--av-h)_58%,var(--foreground))]',
|
|
74
|
-
'not-data-[tone=neutral]:shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--av-h)_24%,transparent)]',
|
|
75
|
-
className,
|
|
76
|
-
)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
83
|
-
return (
|
|
84
|
-
<AvatarPrimitive.Image
|
|
85
|
-
data-slot="avatar-image"
|
|
86
|
-
className={cn('aspect-square size-full object-cover', className)}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function AvatarFallback({
|
|
93
|
-
className,
|
|
94
|
-
...props
|
|
95
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
96
|
-
return (
|
|
97
|
-
<AvatarPrimitive.Fallback
|
|
98
|
-
data-slot="avatar-fallback"
|
|
99
|
-
className={cn('grid size-full place-items-center bg-transparent text-inherit', className)}
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) {
|
|
106
|
-
return (
|
|
107
|
-
<span
|
|
108
|
-
data-slot="avatar-badge"
|
|
109
|
-
className={cn(
|
|
110
|
-
'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-card select-none',
|
|
111
|
-
'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
|
|
112
|
-
'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
|
|
113
|
-
'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
|
|
114
|
-
className,
|
|
115
|
-
)}
|
|
116
|
-
{...props}
|
|
117
|
-
/>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
122
|
-
return (
|
|
123
|
-
<div
|
|
124
|
-
data-slot="avatar-group"
|
|
125
|
-
className={cn(
|
|
126
|
-
'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-card',
|
|
127
|
-
className,
|
|
128
|
-
)}
|
|
129
|
-
{...props}
|
|
130
|
-
/>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>) {
|
|
135
|
-
return (
|
|
136
|
-
<div
|
|
137
|
-
data-slot="avatar-group-count"
|
|
138
|
-
className={cn(
|
|
139
|
-
/* Same 24 / 20 / 32 ramp as Avatar itself — the overflow bubble sits in
|
|
140
|
-
* the row with the avatars, so any other scale makes it a step mid-row. */
|
|
141
|
-
'relative grid size-6 shrink-0 place-items-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground ring-2 ring-card group-has-data-[size=lg]/avatar-group:size-8 group-has-data-[size=lg]/avatar-group:text-xs group-has-data-[size=sm]/avatar-group:size-5 group-has-data-[size=sm]/avatar-group:text-[9px] [&>svg]:size-3',
|
|
142
|
-
className,
|
|
143
|
-
)}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export {
|
|
150
|
-
Avatar,
|
|
151
|
-
AvatarImage,
|
|
152
|
-
AvatarFallback,
|
|
153
|
-
AvatarGroup,
|
|
154
|
-
AvatarGroupCount,
|
|
155
|
-
AvatarBadge,
|
|
156
|
-
AVATAR_TONES,
|
|
157
|
-
type AvatarTone,
|
|
158
|
-
};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { Slot } from 'radix-ui';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Badges are FILLED, never outlined — the tint alone carries the state, and a
|
|
9
|
-
* border on a 20px chip is pure noise. Same treatment as Tag; only the radius
|
|
10
|
-
* separates them (badge 6px, tag pill).
|
|
11
|
-
*
|
|
12
|
-
* The five status tones are one recipe — a translucent fill of the hue plus its
|
|
13
|
-
* darkened `-text` variant. The text tones are darker than the raw hue on
|
|
14
|
-
* purpose: measured over their own 12–15% fill, the undarkened values came in
|
|
15
|
-
* at 3.7–4.5:1 and failed AA.
|
|
16
|
-
*/
|
|
17
|
-
const badgeVariants = cva(
|
|
18
|
-
'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1.5 overflow-hidden rounded-sm border-0 px-[7px] text-micro leading-none font-medium whitespace-nowrap transition-colors duration-150 ease-decelerate focus-visible:ring-3 focus-visible:ring-ring-control/35 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!',
|
|
19
|
-
{
|
|
20
|
-
variants: {
|
|
21
|
-
variant: {
|
|
22
|
-
/* neutral is the default: most badges are labels, not alarms */
|
|
23
|
-
default: 'bg-fill-1 text-muted-foreground [a]:hover:bg-fill-2',
|
|
24
|
-
neutral: 'bg-fill-1 text-muted-foreground [a]:hover:bg-fill-2',
|
|
25
|
-
solid: 'bg-primary text-primary-foreground [a]:hover:bg-primary/85',
|
|
26
|
-
success: 'bg-success/13 text-success-text',
|
|
27
|
-
warning: 'bg-warning/15 text-warning-text',
|
|
28
|
-
error: 'bg-error/12 text-error-text',
|
|
29
|
-
info: 'bg-info/12 text-info-text',
|
|
30
|
-
/* AI provenance — flat berry, and only for "Diana produced this".
|
|
31
|
-
* Never on a finished answer; see the AI message component. */
|
|
32
|
-
ai: 'bg-ai/12 text-ai-text',
|
|
33
|
-
outline: 'border border-border text-foreground [a]:hover:bg-muted',
|
|
34
|
-
ghost: 'text-muted-foreground hover:bg-muted hover:text-foreground',
|
|
35
|
-
/* Kept for existing call sites. `secondary` was already a grey fill and
|
|
36
|
-
* `destructive` a red tint, so both map onto the new recipe without
|
|
37
|
-
* changing what they meant — destructive just gains AA-safe text. */
|
|
38
|
-
secondary: 'bg-fill-1 text-muted-foreground [a]:hover:bg-fill-2',
|
|
39
|
-
destructive: 'bg-error/12 text-error-text',
|
|
40
|
-
link: 'text-foreground underline decoration-border-strong underline-offset-[3px]',
|
|
41
|
-
/* count pill: square-ish minimum so "1" and "24" are the same shape */
|
|
42
|
-
count: 'min-w-5 justify-center bg-fill-1 px-1.5 text-muted-foreground tabular-nums',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
defaultVariants: {
|
|
46
|
-
variant: 'default',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
function Badge({
|
|
52
|
-
className,
|
|
53
|
-
variant = 'default',
|
|
54
|
-
asChild = false,
|
|
55
|
-
...props
|
|
56
|
-
}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
57
|
-
const Comp = asChild ? Slot.Root : 'span';
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<Comp
|
|
61
|
-
data-slot="badge"
|
|
62
|
-
data-variant={variant}
|
|
63
|
-
className={cn(badgeVariants({ variant }), className)}
|
|
64
|
-
{...props}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* Tag = categorical label (pill, grey). Chip = a removable token the user put
|
|
70
|
-
* there (pill, grey fill, × button). Indicator = a bare dot plus text, for
|
|
71
|
-
* inline use where even a filled badge is too much. */
|
|
72
|
-
function Tag({ className, ...props }: React.ComponentProps<'span'>) {
|
|
73
|
-
return (
|
|
74
|
-
<span
|
|
75
|
-
data-slot="tag"
|
|
76
|
-
className={cn(
|
|
77
|
-
'inline-flex h-5 w-fit shrink-0 items-center gap-1.5 rounded-full bg-muted px-2 text-micro font-medium whitespace-nowrap text-muted-foreground',
|
|
78
|
-
className,
|
|
79
|
-
)}
|
|
80
|
-
{...props}
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function Chip({
|
|
86
|
-
className,
|
|
87
|
-
children,
|
|
88
|
-
onRemove,
|
|
89
|
-
removeLabel = 'Remove',
|
|
90
|
-
...props
|
|
91
|
-
}: React.ComponentProps<'span'> & { onRemove?: () => void; removeLabel?: string }) {
|
|
92
|
-
return (
|
|
93
|
-
<span
|
|
94
|
-
data-slot="chip"
|
|
95
|
-
className={cn(
|
|
96
|
-
// no outline: a chip lives inside an input, and an outline inside an
|
|
97
|
-
// outline reads as a box in a box
|
|
98
|
-
'inline-flex h-6 w-fit shrink-0 items-center gap-1.5 rounded-full border-0 bg-fill-2 pr-1 pl-2.5 text-xs whitespace-nowrap',
|
|
99
|
-
className,
|
|
100
|
-
)}
|
|
101
|
-
{...props}
|
|
102
|
-
>
|
|
103
|
-
{children}
|
|
104
|
-
{onRemove ? (
|
|
105
|
-
<button
|
|
106
|
-
type="button"
|
|
107
|
-
aria-label={removeLabel}
|
|
108
|
-
onClick={onRemove}
|
|
109
|
-
className="grid size-4 shrink-0 place-items-center rounded-full text-subtle transition-colors hover:bg-fill-3 hover:text-foreground"
|
|
110
|
-
>
|
|
111
|
-
<svg
|
|
112
|
-
viewBox="0 0 24 24"
|
|
113
|
-
fill="none"
|
|
114
|
-
stroke="currentColor"
|
|
115
|
-
strokeWidth={2.4}
|
|
116
|
-
className="size-2.5"
|
|
117
|
-
>
|
|
118
|
-
<path d="M18 6L6 18M6 6l12 12" strokeLinecap="round" />
|
|
119
|
-
</svg>
|
|
120
|
-
</button>
|
|
121
|
-
) : null}
|
|
122
|
-
</span>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const dotVariants = cva('inline-block size-1.5 shrink-0 rounded-full', {
|
|
127
|
-
variants: {
|
|
128
|
-
tone: {
|
|
129
|
-
neutral: 'bg-neutral',
|
|
130
|
-
success: 'bg-success',
|
|
131
|
-
warning: 'bg-warning',
|
|
132
|
-
error: 'bg-error',
|
|
133
|
-
info: 'bg-info',
|
|
134
|
-
ai: 'bg-ai',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
defaultVariants: { tone: 'neutral' },
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
function StatusDot({
|
|
141
|
-
className,
|
|
142
|
-
tone = 'neutral',
|
|
143
|
-
...props
|
|
144
|
-
}: React.ComponentProps<'span'> & VariantProps<typeof dotVariants>) {
|
|
145
|
-
return (
|
|
146
|
-
<span data-slot="status-dot" className={cn(dotVariants({ tone }), className)} {...props} />
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function StatusIndicator({ className, ...props }: React.ComponentProps<'span'>) {
|
|
151
|
-
return (
|
|
152
|
-
<span
|
|
153
|
-
data-slot="status-indicator"
|
|
154
|
-
className={cn('inline-flex items-center gap-1.5 text-xs', className)}
|
|
155
|
-
{...props}
|
|
156
|
-
/>
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export { Badge, badgeVariants, Tag, Chip, StatusDot, StatusIndicator };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Buttons that act as ONE control — a split action, or a segmented set of
|
|
7
|
-
* commands. Distinct from ToggleGroup, which records a selection: a button group
|
|
8
|
-
* fires actions and remembers nothing.
|
|
9
|
-
*
|
|
10
|
-
* BORDERS ARE SHARED, NOT DOUBLED. The group collapses the edge where two
|
|
11
|
-
* children meet and keeps the radius only on the outer corners, so a row of three
|
|
12
|
-
* reads as one object rather than three adjacent buttons — the same arithmetic
|
|
13
|
-
* InputGroup uses for its affixes, and the same reason.
|
|
14
|
-
*
|
|
15
|
-
* The children keep their own variant. A group of `outline` buttons and a group
|
|
16
|
-
* of `secondary` ones both work; mixing variants inside one group does not, and
|
|
17
|
-
* that is a call site problem rather than something to guard here.
|
|
18
|
-
*/
|
|
19
|
-
function ButtonGroup({
|
|
20
|
-
className,
|
|
21
|
-
orientation = 'horizontal',
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<'div'> & { orientation?: 'horizontal' | 'vertical' }) {
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
data-slot="button-group"
|
|
27
|
-
data-orientation={orientation}
|
|
28
|
-
role="group"
|
|
29
|
-
className={cn(
|
|
30
|
-
'inline-flex w-fit',
|
|
31
|
-
'data-horizontal:flex-row data-vertical:flex-col data-vertical:items-stretch',
|
|
32
|
-
// inner radii collapse; only the outer corners survive
|
|
33
|
-
'data-horizontal:[&>*:not(:first-child)]:rounded-l-none data-horizontal:[&>*:not(:last-child)]:rounded-r-none',
|
|
34
|
-
'data-vertical:[&>*:not(:first-child)]:rounded-t-none data-vertical:[&>*:not(:last-child)]:rounded-b-none',
|
|
35
|
-
// and the shared edge is drawn once
|
|
36
|
-
'data-horizontal:[&>*:not(:first-child)]:border-l-0 data-vertical:[&>*:not(:first-child)]:border-t-0',
|
|
37
|
-
// a focused member has to sit above its neighbour or the ring is clipped
|
|
38
|
-
'[&>*]:relative [&>*:focus-visible]:z-10',
|
|
39
|
-
className,
|
|
40
|
-
)}
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/*
|
|
47
|
-
* A non-interactive label inside the group — a unit, a count, a static prefix.
|
|
48
|
-
* Matches the control height so the group keeps one baseline, and takes the muted
|
|
49
|
-
* tone because it is not pressable and must not look it.
|
|
50
|
-
*/
|
|
51
|
-
function ButtonGroupText({ className, ...props }: React.ComponentProps<'span'>) {
|
|
52
|
-
return (
|
|
53
|
-
<span
|
|
54
|
-
data-slot="button-group-text"
|
|
55
|
-
className={cn(
|
|
56
|
-
'inline-flex h-control shrink-0 items-center border border-border-strong bg-muted px-2.5 text-ui text-muted-foreground',
|
|
57
|
-
className,
|
|
58
|
-
)}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* Hairline between two members of a FILLED group, where there are no borders to
|
|
65
|
-
* share. Owned by the group, like every other separator in the system. */
|
|
66
|
-
function ButtonGroupSeparator({ className, ...props }: React.ComponentProps<'span'>) {
|
|
67
|
-
return (
|
|
68
|
-
<span
|
|
69
|
-
data-slot="button-group-separator"
|
|
70
|
-
aria-hidden
|
|
71
|
-
className={cn('w-px shrink-0 self-stretch bg-fill-3', className)}
|
|
72
|
-
{...props}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export { ButtonGroup, ButtonGroupText, ButtonGroupSeparator };
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { Slot } from 'radix-ui';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* 32px tall, 10px radius, 13px/500 label. Two things worth knowing:
|
|
9
|
-
*
|
|
10
|
-
* · `default` is NEUTRAL, not brand. Theme Neutral is the system preset
|
|
11
|
-
* because every ecosystem carries its own brand colour, so the default call
|
|
12
|
-
* to action is near-black and green is complementary. Use `brand` only where
|
|
13
|
-
* the green genuinely IS the message.
|
|
14
|
-
* · Focus is the neutral ring, not the brand ring. A control you OPERATE gets
|
|
15
|
-
* a grey ring; only a field you ENTER DATA INTO gets brand affirmation
|
|
16
|
-
* (see input.tsx). Mixing the two makes brand meaningless.
|
|
17
|
-
*/
|
|
18
|
-
const buttonVariants = cva(
|
|
19
|
-
"group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-transparent bg-clip-padding text-ui leading-none font-medium whitespace-nowrap transition-[background-color,border-color,color,transform] duration-150 ease-decelerate outline-none select-none focus-visible:ring-3 focus-visible:ring-ring-control/35 active:scale-[0.975] disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none aria-disabled:opacity-45 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
20
|
-
{
|
|
21
|
-
variants: {
|
|
22
|
-
variant: {
|
|
23
|
-
default: 'bg-primary text-primary-foreground hover:bg-primary/85',
|
|
24
|
-
outline:
|
|
25
|
-
'border-border-strong bg-card hover:bg-muted aria-expanded:bg-muted dark:bg-transparent',
|
|
26
|
-
secondary: 'bg-muted text-foreground hover:bg-fill-2 aria-expanded:bg-fill-2',
|
|
27
|
-
ghost:
|
|
28
|
-
'text-muted-foreground hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
29
|
-
/* Tinted secondary: fill plus coloured label. Reads as an action
|
|
30
|
-
* without competing with the solid one next to it. */
|
|
31
|
-
tint: 'bg-fill-1 text-foreground hover:bg-fill-2',
|
|
32
|
-
'tint-brand': 'bg-brand-tint text-brand-text hover:bg-brand/20',
|
|
33
|
-
/* Destructive is a TEXT action by default — a red block is rarely what
|
|
34
|
-
* you want next to a cancel button. `destructive-solid` is the
|
|
35
|
-
* confirm-in-a-dialog case. */
|
|
36
|
-
destructive: 'text-error-text hover:bg-error/10',
|
|
37
|
-
'destructive-solid': 'bg-error-solid text-white hover:bg-error-solid/90',
|
|
38
|
-
brand: 'bg-brand text-[#0a0a0a] hover:bg-brand/90',
|
|
39
|
-
/* A text link, so it has no box: the height and padding reset live in
|
|
40
|
-
* compoundVariants below, not here — cva emits `size` AFTER `variant`,
|
|
41
|
-
* so `h-auto p-0` written here loses to `h-control px-3` every time. */
|
|
42
|
-
link: 'text-foreground underline decoration-border-strong underline-offset-[3px] hover:decoration-foreground active:scale-100',
|
|
43
|
-
/* Filter trigger. Two states that must be told apart at a glance:
|
|
44
|
-
* empty = dashed outline + muted label ("a slot you could fill"),
|
|
45
|
-
* applied = solid fill, no dash, full-strength label. */
|
|
46
|
-
/* The applied state has TWO hooks on purpose. `aria-pressed` fits a
|
|
47
|
-
* filter trigger, which is genuinely a toggle. `data-filled` is for
|
|
48
|
-
* slots that are filled rather than pressed — a file picker opens a
|
|
49
|
-
* dialog, so claiming a pressed state there announces a control that
|
|
50
|
-
* does not exist. One deliberate difference: `data-filled` keeps the
|
|
51
|
-
* leading glyph. A filter's "+" stops making sense once applied; an
|
|
52
|
-
* upload glyph still describes the control after a file is chosen. */
|
|
53
|
-
dashed:
|
|
54
|
-
'border-dashed border-border-strong text-muted-foreground hover:bg-fill-1 hover:text-foreground aria-pressed:border-solid aria-pressed:border-transparent aria-pressed:bg-fill-2 aria-pressed:text-foreground aria-pressed:hover:bg-fill-3 aria-pressed:[&>svg:first-child]:hidden data-filled:border-solid data-filled:border-transparent data-filled:bg-fill-2 data-filled:text-foreground data-filled:hover:bg-fill-3',
|
|
55
|
-
/* Rise-X wireframe pill — white surface, soft shadow, fully rounded. */
|
|
56
|
-
pill: 'rounded-full border-border/60 bg-card text-card-foreground shadow-pill hover:shadow-card aria-expanded:shadow-card',
|
|
57
|
-
},
|
|
58
|
-
size: {
|
|
59
|
-
default:
|
|
60
|
-
'h-control px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5',
|
|
61
|
-
xs: "h-control-xs gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
62
|
-
sm: 'h-control-sm rounded-md px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
63
|
-
lg: 'h-control-lg px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
|
|
64
|
-
icon: 'size-control px-0',
|
|
65
|
-
'icon-xs': "size-control-xs rounded-md px-0 [&_svg:not([class*='size-'])]:size-3",
|
|
66
|
-
'icon-sm': 'size-control-sm rounded-md px-0',
|
|
67
|
-
'icon-lg': 'size-control-lg px-0',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
/* Applied last, so it wins the merge against whichever `size` is in play. */
|
|
71
|
-
compoundVariants: [{ variant: 'link', class: 'h-auto p-0' }],
|
|
72
|
-
defaultVariants: {
|
|
73
|
-
variant: 'default',
|
|
74
|
-
size: 'default',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
// forwardRef (not React 19 ref-as-prop): the classic React 18 host also renders
|
|
80
|
-
// these components, and it strips `ref` from plain function components — which
|
|
81
|
-
// breaks Radix's own ref injection when Button is the child of an asChild Slot
|
|
82
|
-
// (Dialog/Sheet close buttons).
|
|
83
|
-
const Button = React.forwardRef<
|
|
84
|
-
HTMLButtonElement,
|
|
85
|
-
React.ComponentProps<'button'> &
|
|
86
|
-
VariantProps<typeof buttonVariants> & {
|
|
87
|
-
asChild?: boolean;
|
|
88
|
-
}
|
|
89
|
-
>(function Button(
|
|
90
|
-
{ className, variant = 'default', size = 'default', asChild = false, ...props },
|
|
91
|
-
ref,
|
|
92
|
-
) {
|
|
93
|
-
const Comp = asChild ? Slot.Root : 'button';
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<Comp
|
|
97
|
-
ref={ref}
|
|
98
|
-
data-slot="button"
|
|
99
|
-
data-variant={variant}
|
|
100
|
-
data-size={size}
|
|
101
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
export { Button, buttonVariants };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Date grid. Range selection is drawn as ONE continuous shape, not three
|
|
7
|
-
* separate pills: the endpoints keep their radius on the outer edge only and the
|
|
8
|
-
* days between lose it entirely, so a range reads as a span rather than as
|
|
9
|
-
* "these days are individually selected".
|
|
10
|
-
*
|
|
11
|
-
* Brand is used here because a chosen date is an affirmative commitment — same
|
|
12
|
-
* rule as a checked switch.
|
|
13
|
-
*/
|
|
14
|
-
const DOW = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
15
|
-
|
|
16
|
-
export interface CalendarDay {
|
|
17
|
-
label: number;
|
|
18
|
-
/** Outside the displayed month. */
|
|
19
|
-
outside?: boolean;
|
|
20
|
-
today?: boolean;
|
|
21
|
-
/** Position within a selected range. */
|
|
22
|
-
range?: 'start' | 'in' | 'end';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function Calendar({
|
|
26
|
-
className,
|
|
27
|
-
title,
|
|
28
|
-
days,
|
|
29
|
-
onPrev,
|
|
30
|
-
onNext,
|
|
31
|
-
onSelectDay,
|
|
32
|
-
footer,
|
|
33
|
-
...props
|
|
34
|
-
}: Omit<React.ComponentProps<'div'>, 'children'> & {
|
|
35
|
-
title: React.ReactNode;
|
|
36
|
-
days: CalendarDay[];
|
|
37
|
-
onPrev?: () => void;
|
|
38
|
-
onNext?: () => void;
|
|
39
|
-
/** Picks a day. Without it the grid is a read-only display and the days stop
|
|
40
|
-
* pretending to be pressable — an interactive-looking control that does
|
|
41
|
-
* nothing is worse than a static one. */
|
|
42
|
-
onSelectDay?: (day: CalendarDay, index: number) => void;
|
|
43
|
-
footer?: React.ReactNode;
|
|
44
|
-
}) {
|
|
45
|
-
return (
|
|
46
|
-
<div
|
|
47
|
-
data-slot="calendar"
|
|
48
|
-
className={cn('w-[294px] rounded-2xl bg-card p-3.5 shadow-pop', className)}
|
|
49
|
-
{...props}
|
|
50
|
-
>
|
|
51
|
-
<div className="mb-2 flex items-center justify-between">
|
|
52
|
-
<NavBtn label="Previous month" onClick={onPrev} d="M15 6l-6 6 6 6" />
|
|
53
|
-
<span className="text-ui font-medium">{title}</span>
|
|
54
|
-
<NavBtn label="Next month" onClick={onNext} d="M9 6l6 6-6 6" />
|
|
55
|
-
</div>
|
|
56
|
-
<div className="grid grid-cols-7 gap-x-0 gap-y-0.5">
|
|
57
|
-
{DOW.map((d) => (
|
|
58
|
-
<span key={d} className="grid h-6 place-items-center text-[10px] text-subtle">
|
|
59
|
-
{d}
|
|
60
|
-
</span>
|
|
61
|
-
))}
|
|
62
|
-
{days.map((d, i) => {
|
|
63
|
-
// Same rule as GroupedListRow: a day is a control only when there is
|
|
64
|
-
// something to hook, otherwise it is a span and is not focusable.
|
|
65
|
-
const Comp = onSelectDay ? 'button' : ('span' as React.ElementType);
|
|
66
|
-
return (
|
|
67
|
-
<Comp
|
|
68
|
-
key={i}
|
|
69
|
-
type={onSelectDay ? 'button' : undefined}
|
|
70
|
-
aria-current={d.today ? 'date' : undefined}
|
|
71
|
-
aria-pressed={onSelectDay && d.range ? true : undefined}
|
|
72
|
-
onClick={onSelectDay ? () => onSelectDay(d, i) : undefined}
|
|
73
|
-
className={cn(
|
|
74
|
-
'grid h-[30px] place-items-center rounded-md text-xs transition-colors',
|
|
75
|
-
onSelectDay && 'cursor-pointer',
|
|
76
|
-
!d.range && onSelectDay && 'hover:bg-muted',
|
|
77
|
-
d.outside && 'text-subtle',
|
|
78
|
-
d.today && !d.range && 'shadow-[inset_0_0_0_1px_var(--border-strong)]',
|
|
79
|
-
// the middle of a range has no radius at all — that is what makes
|
|
80
|
-
// the span continuous
|
|
81
|
-
d.range === 'in' && 'rounded-none bg-brand-tint',
|
|
82
|
-
d.range === 'start' && 'rounded-r-none bg-brand font-medium text-[#0a0a0a]',
|
|
83
|
-
d.range === 'end' && 'rounded-l-none bg-brand font-medium text-[#0a0a0a]',
|
|
84
|
-
)}
|
|
85
|
-
>
|
|
86
|
-
{d.label}
|
|
87
|
-
</Comp>
|
|
88
|
-
);
|
|
89
|
-
})}
|
|
90
|
-
</div>
|
|
91
|
-
{footer ? (
|
|
92
|
-
<div className="mt-3 flex gap-1 border-t border-border-subtle pt-2.5">{footer}</div>
|
|
93
|
-
) : null}
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function NavBtn({ label, onClick, d }: { label: string; onClick?: () => void; d: string }) {
|
|
99
|
-
return (
|
|
100
|
-
<button
|
|
101
|
-
type="button"
|
|
102
|
-
aria-label={label}
|
|
103
|
-
onClick={onClick}
|
|
104
|
-
className="grid size-6 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&>svg]:size-3.5"
|
|
105
|
-
>
|
|
106
|
-
<svg
|
|
107
|
-
viewBox="0 0 24 24"
|
|
108
|
-
fill="none"
|
|
109
|
-
stroke="currentColor"
|
|
110
|
-
strokeWidth={2.5}
|
|
111
|
-
strokeLinecap="round"
|
|
112
|
-
>
|
|
113
|
-
<path d={d} />
|
|
114
|
-
</svg>
|
|
115
|
-
</button>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export { Calendar };
|