@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,106 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { OTPInput, OTPInputContext } from 'input-otp';
5
- import { MinusIcon } from 'lucide-react';
6
-
7
- import { cn } from '@rise-x/ui/lib/utils';
8
-
9
- /*
10
- * One-time-code entry. A row of slots that behaves like a single field: paste
11
- * fills every slot, backspace walks back, and the caret is drawn rather than
12
- * native because there is no real caret to show in an empty box.
13
- *
14
- * IT IS ONE FIELD, SO IT TAKES ONE FOCUS TREATMENT. The active slot gets the
15
- * brand ring — data going in, same as Input — and only the active one, because a
16
- * row of six rings is a row of six fields.
17
- *
18
- * SLOTS SHARE THEIR BORDERS. Same arithmetic as InputGroup and ButtonGroup: the
19
- * inner edge is drawn once and only the outer corners keep the radius, so a group
20
- * of six reads as one control rather than six boxes in a row.
21
- *
22
- * GROUP IN THREES, NOT SIXES. A six-digit code split 3–3 is read as two chunks
23
- * and typed more accurately than an undifferentiated run; `InputOTPSeparator` is
24
- * what marks the split, and it is the container's, not a slot's.
25
- */
26
- const InputOTP = React.forwardRef<
27
- React.ComponentRef<typeof OTPInput>,
28
- React.ComponentProps<typeof OTPInput>
29
- >(function InputOTP({ className, containerClassName, ...props }, ref) {
30
- return (
31
- <OTPInput
32
- ref={ref}
33
- data-slot="input-otp"
34
- containerClassName={cn('flex items-center gap-2 has-disabled:opacity-45', containerClassName)}
35
- className={cn('disabled:cursor-not-allowed', className)}
36
- {...props}
37
- />
38
- );
39
- });
40
-
41
- function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
42
- return (
43
- <div
44
- data-slot="input-otp-group"
45
- className={cn(
46
- 'flex items-center',
47
- // shared edges, outer corners only
48
- '[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0',
49
- '[&>*:not(:last-child)]:rounded-r-none',
50
- className,
51
- )}
52
- {...props}
53
- />
54
- );
55
- }
56
-
57
- const InputOTPSlot = React.forwardRef<
58
- HTMLDivElement,
59
- React.ComponentProps<'div'> & { index: number }
60
- >(function InputOTPSlot({ index, className, ...props }, ref) {
61
- const context = React.useContext(OTPInputContext);
62
- const slot = context?.slots[index];
63
-
64
- return (
65
- <div
66
- ref={ref}
67
- data-slot="input-otp-slot"
68
- data-active={slot?.isActive ? '' : undefined}
69
- className={cn(
70
- 'relative grid h-control-lg w-9 place-items-center border border-input bg-card text-ui tabular-nums transition-[border-color,box-shadow] duration-100 first:rounded-l-lg last:rounded-r-lg',
71
- // the active slot is the focused field, and it has to sit above its
72
- // neighbours or the ring is clipped by the shared edge
73
- 'data-active:z-10 data-active:border-brand data-active:ring-3 data-active:ring-brand/12',
74
- 'aria-invalid:border-error',
75
- className,
76
- )}
77
- {...props}
78
- >
79
- {slot?.char}
80
- {/* a drawn caret: an empty slot has no native one to show */}
81
- {slot?.hasFakeCaret ? (
82
- <div className="pointer-events-none absolute inset-0 grid place-items-center">
83
- {/* no duration utility: --animate-caret-blink already carries 1.25s,
84
- and a duration-* would fight it rather than tune it */}
85
- <div className="h-4 w-px animate-caret-blink bg-foreground" />
86
- </div>
87
- ) : null}
88
- </div>
89
- );
90
- });
91
-
92
- function InputOTPSeparator({ className, ...props }: React.ComponentProps<'div'>) {
93
- return (
94
- <div
95
- data-slot="input-otp-separator"
96
- role="separator"
97
- aria-hidden
98
- className={cn('grid place-items-center text-subtle [&>svg]:size-3', className)}
99
- {...props}
100
- >
101
- <MinusIcon />
102
- </div>
103
- );
104
- }
105
-
106
- export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -1,86 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from '@rise-x/ui/lib/utils';
4
-
5
- /*
6
- * 32px, 10px radius, 13px text, on the card surface with a border a step
7
- * stronger than the page's hairlines — a field has to read as enterable before
8
- * you click it.
9
- *
10
- * Focus is the BRAND ring, unlike Button's neutral one. The distinction is
11
- * deliberate: a control you operate gets grey, a field you commit data into
12
- * gets brand affirmation.
13
- *
14
- * forwardRef (not React 19 ref-as-prop): the classic React 18 host also renders
15
- * these components and strips `ref` from plain function components — imperative
16
- * focus/measure from consumers would silently break there.
17
- */
18
- const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(function Input(
19
- { className, type, ...props },
20
- ref,
21
- ) {
22
- return (
23
- <input
24
- ref={ref}
25
- type={type}
26
- data-slot="input"
27
- className={cn(
28
- 'h-control w-full min-w-0 rounded-lg border border-input bg-card px-2.5 text-ui text-foreground transition-[border-color,box-shadow] duration-100 outline-none',
29
- 'file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-ui file:font-medium file:text-foreground',
30
- 'placeholder:text-subtle',
31
- 'focus-visible:border-brand focus-visible:ring-3 focus-visible:ring-brand/12',
32
- 'disabled:cursor-not-allowed disabled:bg-muted disabled:text-subtle',
33
- 'aria-invalid:border-error aria-invalid:focus-visible:border-error aria-invalid:focus-visible:ring-error/18',
34
- className,
35
- )}
36
- {...props}
37
- />
38
- );
39
- });
40
-
41
- /* Numbers right-align and use tabular figures so decimal points stack. */
42
- function InputNumeric({ className, ...props }: React.ComponentProps<'input'>) {
43
- return <Input className={cn('text-right tabular-nums', className)} {...props} />;
44
- }
45
-
46
- /* Icon-in-field wrapper. The icon is decorative and non-interactive; use
47
- * InputAction for anything clickable (reveal password, clear). */
48
- function InputField({ className, ...props }: React.ComponentProps<'div'>) {
49
- return (
50
- <div
51
- data-slot="input-field"
52
- className={cn(
53
- 'relative flex items-center',
54
- '[&>svg]:pointer-events-none [&>svg]:absolute [&>svg]:left-2.5 [&>svg]:size-3.5 [&>svg]:text-subtle',
55
- // the padding has to follow the icon: `[&>svg~input]:pl-7` on its own
56
- // indented the value away from an empty left edge and let it run under a
57
- // trailing icon
58
- '[&>svg:not([data-position=end])~input]:pl-7',
59
- '[&>svg[data-position=end]~input]:pr-7',
60
- '[&>svg[data-position=end]]:right-2.5 [&>svg[data-position=end]]:left-auto',
61
- className,
62
- )}
63
- {...props}
64
- />
65
- );
66
- }
67
-
68
- function InputAction({ className, ...props }: React.ComponentProps<'button'>) {
69
- return (
70
- <button
71
- type="button"
72
- data-slot="input-action"
73
- className={cn(
74
- 'absolute right-1 grid size-6 place-items-center rounded-md text-subtle transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-3.5',
75
- className,
76
- )}
77
- {...props}
78
- />
79
- );
80
- }
81
-
82
- /* The old InputGroup/InputAffix border-merging pair lived here; superseded by
83
- * components/input-group.tsx, where the GROUP owns the field chrome and addons
84
- * sit inside one border instead of merging two. */
85
-
86
- export { Input, InputNumeric, InputField, InputAction };
@@ -1,188 +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
- import { Separator } from '@rise-x/ui/components/separator';
7
-
8
- /*
9
- * A media + content + actions row for things that are OBJECTS rather than table
10
- * records — an integration, a teammate, a file. Complements GroupedList (dense,
11
- * divider-driven) rather than replacing it: Item rows are self-contained and
12
- * can stand alone, be a link, or sit in a plain stack.
13
- *
14
- * NO SURFACE BY DEFAULT, same rule as Accordion: on a card it is already on a
15
- * surface. `outline` is for the standalone case, `muted` for a soft well —
16
- * fill, not border, per the grey budget.
17
- */
18
- /* No role="list" here. The ARIA list pattern requires every child to be a
19
- * listitem, and Item is `asChild`-friendly — it is routinely a Link or a button
20
- * carrying its own role, which a listitem wrapper would either fight or hide.
21
- * A group of interactive rows is not a list to a screen reader; leaving the
22
- * container generic keeps each row's own semantics intact. */
23
- function ItemGroup({ className, ...props }: React.ComponentProps<'div'>) {
24
- return (
25
- <div
26
- data-slot="item-group"
27
- className={cn('group/item-group flex flex-col', className)}
28
- {...props}
29
- />
30
- );
31
- }
32
-
33
- function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
34
- return (
35
- <Separator
36
- data-slot="item-separator"
37
- orientation="horizontal"
38
- className={cn('my-0', className)}
39
- {...props}
40
- />
41
- );
42
- }
43
-
44
- const itemVariants = cva(
45
- // grey focus ring — an item you operate is chrome, not data entry
46
- 'group/item flex flex-wrap items-center rounded-lg border border-transparent text-ui transition-colors duration-100 outline-none focus-visible:ring-3 focus-visible:ring-ring-control/35 [a]:transition-colors [a]:hover:bg-fill-0',
47
- {
48
- variants: {
49
- variant: {
50
- default: 'bg-transparent',
51
- outline: 'border-border',
52
- muted: 'bg-fill-0',
53
- },
54
- size: {
55
- default: 'gap-4 p-4',
56
- sm: 'gap-2.5 px-4 py-3',
57
- },
58
- },
59
- defaultVariants: {
60
- variant: 'default',
61
- size: 'default',
62
- },
63
- },
64
- );
65
-
66
- function Item({
67
- className,
68
- variant = 'default',
69
- size = 'default',
70
- asChild = false,
71
- ...props
72
- }: React.ComponentProps<'div'> & VariantProps<typeof itemVariants> & { asChild?: boolean }) {
73
- const Comp = asChild ? Slot.Root : 'div';
74
- return (
75
- <Comp
76
- data-slot="item"
77
- data-variant={variant}
78
- data-size={size}
79
- className={cn(itemVariants({ variant, size, className }))}
80
- {...props}
81
- />
82
- );
83
- }
84
-
85
- const itemMediaVariants = cva(
86
- 'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none',
87
- {
88
- variants: {
89
- variant: {
90
- default: 'bg-transparent',
91
- // fill carries the icon tile — no border on a 32px square
92
- icon: 'size-8 rounded-md bg-muted [&_svg:not([class*="size-"])]:size-4',
93
- image: 'size-10 overflow-hidden rounded-md [&_img]:size-full [&_img]:object-cover',
94
- },
95
- },
96
- defaultVariants: {
97
- variant: 'default',
98
- },
99
- },
100
- );
101
-
102
- function ItemMedia({
103
- className,
104
- variant = 'default',
105
- ...props
106
- }: React.ComponentProps<'div'> & VariantProps<typeof itemMediaVariants>) {
107
- return (
108
- <div
109
- data-slot="item-media"
110
- data-variant={variant}
111
- className={cn(itemMediaVariants({ variant, className }))}
112
- {...props}
113
- />
114
- );
115
- }
116
-
117
- function ItemContent({ className, ...props }: React.ComponentProps<'div'>) {
118
- return (
119
- <div
120
- data-slot="item-content"
121
- className={cn('flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none', className)}
122
- {...props}
123
- />
124
- );
125
- }
126
-
127
- function ItemTitle({ className, ...props }: React.ComponentProps<'div'>) {
128
- return (
129
- <div
130
- data-slot="item-title"
131
- className={cn('flex w-fit items-center gap-2 text-ui leading-snug font-medium', className)}
132
- {...props}
133
- />
134
- );
135
- }
136
-
137
- function ItemDescription({ className, ...props }: React.ComponentProps<'p'>) {
138
- return (
139
- <p
140
- data-slot="item-description"
141
- className={cn(
142
- 'line-clamp-2 text-xs leading-normal font-normal text-balance text-muted-foreground',
143
- '[&>a]:underline [&>a]:underline-offset-3 [&>a:hover]:text-foreground',
144
- className,
145
- )}
146
- {...props}
147
- />
148
- );
149
- }
150
-
151
- function ItemActions({ className, ...props }: React.ComponentProps<'div'>) {
152
- return (
153
- <div data-slot="item-actions" className={cn('flex items-center gap-2', className)} {...props} />
154
- );
155
- }
156
-
157
- function ItemHeader({ className, ...props }: React.ComponentProps<'div'>) {
158
- return (
159
- <div
160
- data-slot="item-header"
161
- className={cn('flex basis-full items-center justify-between gap-2', className)}
162
- {...props}
163
- />
164
- );
165
- }
166
-
167
- function ItemFooter({ className, ...props }: React.ComponentProps<'div'>) {
168
- return (
169
- <div
170
- data-slot="item-footer"
171
- className={cn('flex basis-full items-center justify-between gap-2', className)}
172
- {...props}
173
- />
174
- );
175
- }
176
-
177
- export {
178
- Item,
179
- ItemMedia,
180
- ItemContent,
181
- ItemActions,
182
- ItemGroup,
183
- ItemSeparator,
184
- ItemTitle,
185
- ItemDescription,
186
- ItemHeader,
187
- ItemFooter,
188
- };
@@ -1,43 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from '@rise-x/ui/lib/utils';
4
-
5
- /*
6
- * A key cap. Tooltip already styles a `data-slot=kbd` descendant on its inverted
7
- * surface, so this component finally supplies the thing that selector was written
8
- * for — until now every call site hand-rolled it.
9
- *
10
- * INHERITS ITS COLOUR. The cap is a translucent fill plus `currentColor`, never a
11
- * fixed grey on white: a shortcut hint appears in a menu row, in a tooltip on the
12
- * inverted surface, and in body copy, and a hardcoded pair of colours is wrong in
13
- * two of those three. `bg-fill-*` sits on whatever is behind it, which is exactly
14
- * the property needed here.
15
- *
16
- * 6px radius — the badge step. A key cap is the same size class as a badge, and
17
- * anything rounder reads as a pill.
18
- */
19
- function Kbd({ className, ...props }: React.ComponentProps<'kbd'>) {
20
- return (
21
- <kbd
22
- data-slot="kbd"
23
- className={cn(
24
- 'inline-flex h-[18px] min-w-[18px] shrink-0 items-center justify-center gap-0.5 rounded-sm bg-fill-2 px-1 font-sans text-[10px] font-medium text-current select-none',
25
- className,
26
- )}
27
- {...props}
28
- />
29
- );
30
- }
31
-
32
- /* A sequence — ⌘ then K. The separator is the container's, not the caps'. */
33
- function KbdGroup({ className, ...props }: React.ComponentProps<'span'>) {
34
- return (
35
- <span
36
- data-slot="kbd-group"
37
- className={cn('inline-flex items-center gap-1 text-current', className)}
38
- {...props}
39
- />
40
- );
41
- }
42
-
43
- export { Kbd, KbdGroup };
@@ -1,19 +0,0 @@
1
- import * as React from 'react';
2
- import { Label as LabelPrimitive } from 'radix-ui';
3
-
4
- import { cn } from '@rise-x/ui/lib/utils';
5
-
6
- function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
7
- return (
8
- <LabelPrimitive.Root
9
- data-slot="label"
10
- className={cn(
11
- 'flex items-center gap-2 text-ui leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
12
- className,
13
- )}
14
- {...props}
15
- />
16
- );
17
- }
18
-
19
- export { Label };
@@ -1,191 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from '@rise-x/ui/lib/utils';
4
-
5
- /*
6
- * Reach for a list instead of a table when there are fewer than four attributes
7
- * per item, or when the layout has to survive a narrow panel.
8
- *
9
- * Dividers are INSET and drawn between items, never as a border on every row —
10
- * a top-and-bottom border on each row doubles up at every seam, and a divider
11
- * that runs to the container edge makes the list read as stacked bands rather
12
- * than one surface.
13
- */
14
- function List({ className, ...props }: React.ComponentProps<'div'>) {
15
- return <div data-slot="list" className={cn('flex flex-col', className)} {...props} />;
16
- }
17
-
18
- function ListItem({
19
- className,
20
- rich,
21
- ...props
22
- }: React.ComponentProps<'div'> & {
23
- /** Two-line item: aligns to the top and adds room for a description. */
24
- rich?: boolean;
25
- }) {
26
- return (
27
- <div
28
- data-slot="list-item"
29
- data-rich={rich ? '' : undefined}
30
- className={cn(
31
- 'flex items-center gap-2.5 border-t border-border-subtle px-4 py-2.5 first:border-t-0',
32
- rich && 'items-start py-3',
33
- className,
34
- )}
35
- {...props}
36
- />
37
- );
38
- }
39
-
40
- function ListMain({ className, ...props }: React.ComponentProps<'div'>) {
41
- return <div data-slot="list-main" className={cn('min-w-0 flex-1', className)} {...props} />;
42
- }
43
-
44
- function ListName({ className, ...props }: React.ComponentProps<'span'>) {
45
- return <span data-slot="list-name" className={cn('block text-ui', className)} {...props} />;
46
- }
47
-
48
- function ListMeta({ className, ...props }: React.ComponentProps<'span'>) {
49
- return (
50
- <span
51
- data-slot="list-meta"
52
- className={cn('block text-micro text-subtle', className)}
53
- {...props}
54
- />
55
- );
56
- }
57
-
58
- function ListDescription({ className, ...props }: React.ComponentProps<'span'>) {
59
- return (
60
- <span
61
- data-slot="list-description"
62
- className={cn('mt-0.5 block text-xs text-muted-foreground', className)}
63
- {...props}
64
- />
65
- );
66
- }
67
-
68
- function ListValue({ className, ...props }: React.ComponentProps<'span'>) {
69
- return <span data-slot="list-value" className={cn('shrink-0 text-ui', className)} {...props} />;
70
- }
71
-
72
- /*
73
- * Inset grouped list — the settings/detail-panel form. A rounded surface with
74
- * dividers that start at the LABEL rather than the container edge, which is what
75
- * makes a grouped list read as one object instead of a stack of rows. Rows with
76
- * an icon indent their divider further so it starts at the text either way.
77
- */
78
- function GroupedList({ className, ...props }: React.ComponentProps<'div'>) {
79
- return (
80
- <div
81
- data-slot="grouped-list"
82
- className={cn('overflow-hidden rounded-xl bg-card shadow-card', className)}
83
- {...props}
84
- />
85
- );
86
- }
87
-
88
- function GroupedListRow({
89
- className,
90
- icon,
91
- iconClassName,
92
- ...props
93
- }: React.ComponentProps<'button'> & {
94
- /** Just the glyph. The component owns the tile — passing a wrapper of your own
95
- * nests a tile inside a tile and the icon-sizing selector stops matching. */
96
- icon?: React.ReactNode;
97
- /** Tile background, e.g. "bg-chart-1". */
98
- iconClassName?: string;
99
- }) {
100
- // A row with an onClick is a control and renders as a button; without one it
101
- // is a static line of settings and must not be focusable.
102
- const interactive = Boolean(props.onClick);
103
- const Comp = interactive ? 'button' : ('div' as React.ElementType);
104
- return (
105
- <Comp
106
- data-slot="grouped-list-row"
107
- type={interactive ? 'button' : undefined}
108
- className={cn(
109
- 'relative flex w-full items-center gap-2.5 px-3.5 py-2 text-left text-ui',
110
- // divider as a pseudo-element between siblings, inset to the label
111
- 'before:absolute before:top-0 before:right-0 before:left-3.5 before:h-px before:bg-border-subtle first:before:hidden',
112
- icon && 'before:left-[52px]',
113
- interactive && 'cursor-pointer transition-colors hover:bg-fill-1',
114
- className,
115
- )}
116
- {...props}
117
- >
118
- {icon ? (
119
- // descendant selector, not child: the glyph may be wrapped by the caller
120
- <span
121
- className={cn(
122
- 'grid size-[26px] shrink-0 place-items-center rounded-[7px] text-white [&_svg]:size-3.5',
123
- iconClassName ?? 'bg-slate-hue',
124
- )}
125
- >
126
- {icon}
127
- </span>
128
- ) : null}
129
- {props.children}
130
- </Comp>
131
- );
132
- }
133
-
134
- function GroupedListLabel({ className, ...props }: React.ComponentProps<'span'>) {
135
- return (
136
- <span
137
- data-slot="grouped-list-label"
138
- className={cn(
139
- 'min-w-0 flex-1 text-ui [&_small]:block [&_small]:text-micro [&_small]:text-subtle',
140
- className,
141
- )}
142
- {...props}
143
- />
144
- );
145
- }
146
-
147
- function GroupedListValue({ className, ...props }: React.ComponentProps<'span'>) {
148
- return (
149
- <span
150
- data-slot="grouped-list-value"
151
- className={cn('shrink-0 text-ui text-muted-foreground', className)}
152
- {...props}
153
- />
154
- );
155
- }
156
-
157
- function GroupedListHeading({ className, ...props }: React.ComponentProps<'div'>) {
158
- return (
159
- <div
160
- data-slot="grouped-list-heading"
161
- className={cn('px-1 pb-[7px] text-micro tracking-[0.03em] text-subtle uppercase', className)}
162
- {...props}
163
- />
164
- );
165
- }
166
-
167
- function GroupedListFootnote({ className, ...props }: React.ComponentProps<'div'>) {
168
- return (
169
- <div
170
- data-slot="grouped-list-footnote"
171
- className={cn('px-1 pt-2 text-micro leading-[1.45] text-subtle', className)}
172
- {...props}
173
- />
174
- );
175
- }
176
-
177
- export {
178
- List,
179
- ListItem,
180
- ListMain,
181
- ListName,
182
- ListMeta,
183
- ListDescription,
184
- ListValue,
185
- GroupedList,
186
- GroupedListRow,
187
- GroupedListLabel,
188
- GroupedListValue,
189
- GroupedListHeading,
190
- GroupedListFootnote,
191
- };