@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.
Files changed (185) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +553 -0
  3. package/build/_internal.d.ts +2 -0
  4. package/build/_internal.js +23 -0
  5. package/build/accessors.d.ts +8 -0
  6. package/build/accessors.js +40 -0
  7. package/build/cli/index.d.ts +13 -0
  8. package/build/cli/index.js +54 -0
  9. package/build/cli/init.d.ts +6 -0
  10. package/build/cli/init.js +179 -0
  11. package/build/cli/templating.d.ts +2 -0
  12. package/build/cli/templating.js +84 -0
  13. package/build/connectors/agents.d.ts +85 -0
  14. package/build/connectors/agents.js +404 -0
  15. package/build/connectors/assets.d.ts +76 -0
  16. package/build/connectors/assets.js +204 -0
  17. package/build/connectors/deps.d.ts +4 -0
  18. package/build/connectors/deps.js +2 -0
  19. package/build/connectors/errors.d.ts +11 -0
  20. package/build/connectors/errors.js +67 -0
  21. package/build/connectors/flows.d.ts +37 -0
  22. package/build/connectors/flows.js +191 -0
  23. package/build/connectors/index.d.ts +8 -0
  24. package/build/connectors/index.js +50 -0
  25. package/build/connectors/sse.d.ts +12 -0
  26. package/build/connectors/sse.js +157 -0
  27. package/build/connectors/types.d.ts +285 -0
  28. package/build/connectors/types.js +419 -0
  29. package/build/connectors/work.d.ts +84 -0
  30. package/build/connectors/work.js +224 -0
  31. package/build/hooks.d.ts +4 -0
  32. package/build/hooks.js +28 -0
  33. package/build/index.d.ts +6 -0
  34. package/build/index.js +34 -0
  35. package/build/lifecycle.d.ts +23 -0
  36. package/build/lifecycle.js +6 -0
  37. package/build/mockShell.d.ts +10 -0
  38. package/build/mockShell.js +55 -0
  39. package/build/query/agents.d.ts +80 -0
  40. package/build/query/agents.js +143 -0
  41. package/build/query/assets.d.ts +73 -0
  42. package/build/query/assets.js +152 -0
  43. package/build/query/client.d.ts +5 -0
  44. package/build/query/client.js +68 -0
  45. package/build/query/context.d.ts +2 -0
  46. package/build/query/context.js +34 -0
  47. package/build/query/flows.d.ts +54 -0
  48. package/build/query/flows.js +81 -0
  49. package/build/query/index.d.ts +10 -0
  50. package/build/query/index.js +85 -0
  51. package/build/query/keys.d.ts +51 -0
  52. package/build/query/keys.js +79 -0
  53. package/build/query/layer.d.ts +175 -0
  54. package/build/query/layer.js +35 -0
  55. package/build/query/shared.d.ts +43 -0
  56. package/build/query/shared.js +116 -0
  57. package/build/query/work.d.ts +75 -0
  58. package/build/query/work.js +172 -0
  59. package/build/shell/index.d.ts +1 -0
  60. package/build/shell/index.js +6 -0
  61. package/build/shell/installShellBridge.d.ts +11 -0
  62. package/build/shell/installShellBridge.js +104 -0
  63. package/build/shellBridge.d.ts +36 -0
  64. package/build/shellBridge.js +10 -0
  65. package/build/topBar.d.ts +25 -0
  66. package/build/topBar.js +17 -0
  67. package/build/ui/components/ai.d.ts +49 -0
  68. package/build/ui/components/alert-dialog.d.ts +27 -0
  69. package/build/ui/components/alert.d.ts +14 -0
  70. package/build/ui/components/avatar.d.ts +17 -0
  71. package/build/ui/components/badge.d.ts +19 -0
  72. package/build/ui/components/button.d.ts +13 -0
  73. package/build/ui/components/calendar.d.ts +21 -0
  74. package/build/ui/components/card.d.ts +16 -0
  75. package/build/ui/components/chart.d.ts +124 -0
  76. package/build/ui/components/checkbox.d.ts +4 -0
  77. package/build/ui/components/data-table.d.ts +70 -0
  78. package/build/ui/components/dialog.d.ts +17 -0
  79. package/build/ui/components/dropdown-menu.d.ts +29 -0
  80. package/build/ui/components/empty-state.d.ts +7 -0
  81. package/build/ui/components/file-upload.d.ts +17 -0
  82. package/build/ui/components/input.d.ts +8 -0
  83. package/build/ui/components/label.d.ts +4 -0
  84. package/build/ui/components/list.d.ts +24 -0
  85. package/build/ui/components/map.d.ts +26 -0
  86. package/build/ui/components/message.d.ts +24 -0
  87. package/build/ui/components/nav.d.ts +12 -0
  88. package/build/ui/components/page-header.d.ts +27 -0
  89. package/build/ui/components/popover.d.ts +10 -0
  90. package/build/ui/components/progress.d.ts +4 -0
  91. package/build/ui/components/radio.d.ts +6 -0
  92. package/build/ui/components/resizable.d.ts +7 -0
  93. package/build/ui/components/scroll-area.d.ts +5 -0
  94. package/build/ui/components/segmented.d.ts +6 -0
  95. package/build/ui/components/select.d.ts +15 -0
  96. package/build/ui/components/separator.d.ts +4 -0
  97. package/build/ui/components/sheet.d.ts +14 -0
  98. package/build/ui/components/skeleton.d.ts +3 -0
  99. package/build/ui/components/slider.d.ts +15 -0
  100. package/build/ui/components/snackbar.d.ts +3 -0
  101. package/build/ui/components/sonner.d.ts +4 -0
  102. package/build/ui/components/spinner.d.ts +5 -0
  103. package/build/ui/components/statistic.d.ts +19 -0
  104. package/build/ui/components/stepper.d.ts +12 -0
  105. package/build/ui/components/switch.d.ts +6 -0
  106. package/build/ui/components/table.d.ts +24 -0
  107. package/build/ui/components/textarea.d.ts +3 -0
  108. package/build/ui/components/timeline.d.ts +15 -0
  109. package/build/ui/components/toggle-group.d.ts +10 -0
  110. package/build/ui/components/toggle.d.ts +9 -0
  111. package/build/ui/components/tooltip.d.ts +7 -0
  112. package/build/ui/index.d.ts +46 -0
  113. package/build/ui/index.js +8 -0
  114. package/build/ui/lib/utils.d.ts +2 -0
  115. package/build/ui/reference/README.md +11 -0
  116. package/build/ui/reference/components/ai.tsx +291 -0
  117. package/build/ui/reference/components/alert-dialog.tsx +208 -0
  118. package/build/ui/reference/components/alert.tsx +112 -0
  119. package/build/ui/reference/components/avatar.tsx +158 -0
  120. package/build/ui/reference/components/badge.tsx +160 -0
  121. package/build/ui/reference/components/button.tsx +100 -0
  122. package/build/ui/reference/components/calendar.tsx +119 -0
  123. package/build/ui/reference/components/card.tsx +144 -0
  124. package/build/ui/reference/components/chart.tsx +1394 -0
  125. package/build/ui/reference/components/checkbox.tsx +44 -0
  126. package/build/ui/reference/components/data-table.tsx +480 -0
  127. package/build/ui/reference/components/dialog.tsx +172 -0
  128. package/build/ui/reference/components/dropdown-menu.tsx +245 -0
  129. package/build/ui/reference/components/empty-state.tsx +63 -0
  130. package/build/ui/reference/components/file-upload.tsx +116 -0
  131. package/build/ui/reference/components/input.tsx +114 -0
  132. package/build/ui/reference/components/label.tsx +19 -0
  133. package/build/ui/reference/components/list.tsx +191 -0
  134. package/build/ui/reference/components/map.css +251 -0
  135. package/build/ui/reference/components/map.tsx +294 -0
  136. package/build/ui/reference/components/message.tsx +171 -0
  137. package/build/ui/reference/components/nav.tsx +113 -0
  138. package/build/ui/reference/components/page-header.tsx +213 -0
  139. package/build/ui/reference/components/popover.tsx +76 -0
  140. package/build/ui/reference/components/progress.tsx +31 -0
  141. package/build/ui/reference/components/radio.tsx +65 -0
  142. package/build/ui/reference/components/resizable.tsx +40 -0
  143. package/build/ui/reference/components/scroll-area.tsx +55 -0
  144. package/build/ui/reference/components/segmented.tsx +45 -0
  145. package/build/ui/reference/components/select.tsx +185 -0
  146. package/build/ui/reference/components/separator.tsx +26 -0
  147. package/build/ui/reference/components/sheet.tsx +173 -0
  148. package/build/ui/reference/components/skeleton.tsx +15 -0
  149. package/build/ui/reference/components/slider.tsx +161 -0
  150. package/build/ui/reference/components/snackbar.tsx +27 -0
  151. package/build/ui/reference/components/sonner.tsx +43 -0
  152. package/build/ui/reference/components/spinner.tsx +27 -0
  153. package/build/ui/reference/components/statistic.tsx +122 -0
  154. package/build/ui/reference/components/stepper.tsx +138 -0
  155. package/build/ui/reference/components/switch.tsx +47 -0
  156. package/build/ui/reference/components/table.tsx +233 -0
  157. package/build/ui/reference/components/textarea.tsx +28 -0
  158. package/build/ui/reference/components/timeline.tsx +94 -0
  159. package/build/ui/reference/components/toggle-group.tsx +86 -0
  160. package/build/ui/reference/components/toggle.tsx +46 -0
  161. package/build/ui/reference/components/tooltip.tsx +53 -0
  162. package/build/ui/reference/index.ts +49 -0
  163. package/build/ui/reference/lib/utils.ts +34 -0
  164. package/build/ui/standalone-stub.js +5 -0
  165. package/build/ui/standalone.js +135 -0
  166. package/build/ui/styles.css +3 -0
  167. package/connectors/package.json +8 -0
  168. package/package.json +114 -0
  169. package/query/package.json +8 -0
  170. package/shell/package.json +8 -0
  171. package/template/AGENTS.md +70 -0
  172. package/template/CLAUDE.md +4 -0
  173. package/template/README.md +102 -0
  174. package/template/_gitignore +6 -0
  175. package/template/commitlint.config.js +12 -0
  176. package/template/package.json +31 -0
  177. package/template/public/index.html +13 -0
  178. package/template/src/App.tsx +171 -0
  179. package/template/src/bootstrap.tsx +13 -0
  180. package/template/src/index.tsx +1 -0
  181. package/template/src/lifecycle.ts +20 -0
  182. package/template/tsconfig.json +31 -0
  183. package/template/webpack.config.js +112 -0
  184. package/template/webpack.local.config.js +68 -0
  185. package/ui/package.json +8 -0
@@ -0,0 +1,122 @@
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
+ * KPI / metric / trend. Numerals at 600 with negative tracking, label above in
8
+ * muted 12px, delta as a small coloured run of text.
9
+ *
10
+ * Trend colour is SEMANTIC (success / error), never brand — the same reasoning
11
+ * that keeps brand out of charts: if the company colour means "good", a
12
+ * downward number rendered in it becomes unreadable as a warning.
13
+ */
14
+ function Statistic({ className, ...props }: React.ComponentProps<'div'>) {
15
+ return <div data-slot="statistic" className={cn('flex flex-col', className)} {...props} />;
16
+ }
17
+
18
+ function StatisticLabel({ className, ...props }: React.ComponentProps<'div'>) {
19
+ return (
20
+ <div
21
+ data-slot="statistic-label"
22
+ className={cn('text-xs text-muted-foreground', className)}
23
+ {...props}
24
+ />
25
+ );
26
+ }
27
+
28
+ function StatisticValue({
29
+ className,
30
+ size = 'default',
31
+ ...props
32
+ }: React.ComponentProps<'div'> & { size?: 'sm' | 'default' | 'lg' }) {
33
+ return (
34
+ <div
35
+ data-slot="statistic-value"
36
+ data-size={size}
37
+ className={cn(
38
+ 'mt-0.5 flex items-baseline gap-1.5 font-semibold tracking-[-0.02em] tabular-nums',
39
+ size === 'sm' && 'text-[19px] tracking-[-0.01em]',
40
+ size === 'default' && 'text-[26px]',
41
+ size === 'lg' && 'text-[32px]',
42
+ className,
43
+ )}
44
+ {...props}
45
+ />
46
+ );
47
+ }
48
+
49
+ function StatisticCaption({ className, ...props }: React.ComponentProps<'div'>) {
50
+ return (
51
+ <div
52
+ data-slot="statistic-caption"
53
+ className={cn('mt-1 text-micro text-subtle', className)}
54
+ {...props}
55
+ />
56
+ );
57
+ }
58
+
59
+ const trendVariants = cva(
60
+ 'inline-flex items-center gap-0.5 text-xs font-medium [&>svg]:size-3 [&>svg]:shrink-0',
61
+ {
62
+ variants: {
63
+ direction: {
64
+ up: 'text-success-text',
65
+ down: 'text-error-text',
66
+ flat: 'text-muted-foreground',
67
+ },
68
+ },
69
+ defaultVariants: { direction: 'flat' },
70
+ },
71
+ );
72
+
73
+ function Trend({
74
+ className,
75
+ direction = 'flat',
76
+ ...props
77
+ }: React.ComponentProps<'span'> & VariantProps<typeof trendVariants>) {
78
+ return (
79
+ <span data-slot="trend" className={cn(trendVariants({ direction }), className)} {...props} />
80
+ );
81
+ }
82
+
83
+ /* Meter: a 4px track. Neutral by default — colour it only when the value
84
+ * genuinely encodes a status, not merely to decorate a number. */
85
+ const meterVariants = cva('h-1 overflow-hidden rounded-full bg-border', {
86
+ variants: {
87
+ tone: {
88
+ neutral: '[&>i]:bg-primary',
89
+ success: '[&>i]:bg-success',
90
+ warning: '[&>i]:bg-warning',
91
+ error: '[&>i]:bg-error',
92
+ },
93
+ },
94
+ defaultVariants: { tone: 'neutral' },
95
+ });
96
+
97
+ function Meter({
98
+ className,
99
+ tone = 'neutral',
100
+ value,
101
+ ...props
102
+ }: Omit<React.ComponentProps<'div'>, 'children'> &
103
+ VariantProps<typeof meterVariants> & { value: number }) {
104
+ return (
105
+ <div
106
+ data-slot="meter"
107
+ role="progressbar"
108
+ aria-valuenow={value}
109
+ aria-valuemin={0}
110
+ aria-valuemax={100}
111
+ className={cn(meterVariants({ tone }), className)}
112
+ {...props}
113
+ >
114
+ <i
115
+ className="block h-full rounded-full"
116
+ style={{ width: `${Math.max(0, Math.min(100, value))}%` }}
117
+ />
118
+ </div>
119
+ );
120
+ }
121
+
122
+ export { Statistic, StatisticLabel, StatisticValue, StatisticCaption, Trend, Meter, trendVariants };
@@ -0,0 +1,138 @@
1
+ import * as React from 'react';
2
+
3
+ import { cn } from '@rise-x/ui/lib/utils';
4
+
5
+ /*
6
+ * Progress through a multi-step task. Three states, each carried by a different
7
+ * mechanism rather than three shades of one colour:
8
+ * done → filled brand dot with a tick, and the connector behind it is brand
9
+ * current → outlined in the text colour with a NEUTRAL halo
10
+ * ahead → hairline outline, muted label
11
+ * Brand marks completion because a finished step is affirmative — the same reason
12
+ * a checked switch is brand and a checked checkbox is not. The halo stays grey: a
13
+ * green ring around a black circle reads as two competing marks rather than one
14
+ * emphasised step.
15
+ *
16
+ * THE CONTAINER OWNS THE CONNECTORS, not the steps. When each step carried its
17
+ * own `flex-1` line, the line took whatever width was left after that step's
18
+ * label — so a long label got a 4px stub and a short one got 90px, and the line
19
+ * appeared to hang off the end of the previous label rather than bridging two
20
+ * dots. Interleaved by the container, every connector gets an equal share of the
21
+ * leftover space no matter how uneven the labels are.
22
+ */
23
+ function Steps({ className, children, ...props }: React.ComponentProps<'ol'>) {
24
+ const steps = React.Children.toArray(children).filter(React.isValidElement);
25
+ return (
26
+ <ol data-slot="steps" className={cn('flex list-none items-start p-0', className)} {...props}>
27
+ {steps.map((step, i) => {
28
+ const prev = steps[i - 1] as React.ReactElement<{ state?: StepState }> | undefined;
29
+ return (
30
+ <React.Fragment key={step.key ?? i}>
31
+ {i > 0 ? (
32
+ <li
33
+ aria-hidden
34
+ className={cn(
35
+ 'mx-2 mt-2.5 h-px flex-1',
36
+ // the line behind a completed step is part of the completed run
37
+ prev?.props?.state === 'done' ? 'bg-brand' : 'bg-border',
38
+ )}
39
+ />
40
+ ) : null}
41
+ {step}
42
+ </React.Fragment>
43
+ );
44
+ })}
45
+ </ol>
46
+ );
47
+ }
48
+
49
+ type StepState = 'done' | 'current' | 'ahead';
50
+
51
+ function Step({
52
+ className,
53
+ state = 'ahead',
54
+ index,
55
+ children,
56
+ ...props
57
+ }: React.ComponentProps<'li'> & {
58
+ state?: StepState;
59
+ /** 1-based number shown when the step is not complete. */
60
+ index?: number;
61
+ }) {
62
+ return (
63
+ <li
64
+ data-slot="step"
65
+ data-state={state}
66
+ // shrink-0: the step is as wide as its content, and the connectors take the
67
+ // slack — the reverse leaves the lines at the mercy of label length
68
+ className={cn('flex shrink-0 items-start gap-2', className)}
69
+ {...props}
70
+ >
71
+ <span
72
+ className={cn(
73
+ 'grid size-5 shrink-0 place-items-center rounded-full border text-[10px] font-medium [&>svg]:size-[11px]',
74
+ state === 'done' && 'border-brand bg-brand text-[#0a0a0a]',
75
+ state === 'current' &&
76
+ 'border-foreground text-foreground shadow-[0_0_0_3px_var(--fill-2)]',
77
+ state === 'ahead' && 'border-border-strong bg-card text-muted-foreground',
78
+ )}
79
+ >
80
+ {state === 'done' ? (
81
+ <svg
82
+ viewBox="0 0 24 24"
83
+ fill="none"
84
+ stroke="currentColor"
85
+ strokeWidth={3}
86
+ strokeLinecap="round"
87
+ >
88
+ <path d="M20 6L9 17l-5-5" />
89
+ </svg>
90
+ ) : (
91
+ index
92
+ )}
93
+ </span>
94
+ {/* the dot is 20px and the label line ~16px, so 2px of offset puts the
95
+ label on the dot's optical centre rather than above it */}
96
+ <span
97
+ className={cn(
98
+ 'mt-[2px] text-xs leading-[1.35] whitespace-nowrap',
99
+ state === 'current' ? 'font-medium text-foreground' : 'text-muted-foreground',
100
+ )}
101
+ >
102
+ {children}
103
+ </span>
104
+ </li>
105
+ );
106
+ }
107
+
108
+ /* The bar at the foot of a wizard: where you are on the left, movement on the
109
+ * right. Separate from Steps so a wizard can show progress at the top and
110
+ * navigation at the bottom without either knowing about the other. */
111
+ function WizardBar({ className, ...props }: React.ComponentProps<'div'>) {
112
+ return (
113
+ <div
114
+ data-slot="wizard-bar"
115
+ className={cn(
116
+ 'flex items-center gap-2 border-t border-border-subtle px-5 py-3.5 [&>[data-slot=wizard-end]]:ml-auto',
117
+ className,
118
+ )}
119
+ {...props}
120
+ />
121
+ );
122
+ }
123
+
124
+ function WizardMeta({ className, ...props }: React.ComponentProps<'span'>) {
125
+ return (
126
+ <span
127
+ data-slot="wizard-meta"
128
+ className={cn('text-xs text-muted-foreground', className)}
129
+ {...props}
130
+ />
131
+ );
132
+ }
133
+
134
+ function WizardEnd({ className, ...props }: React.ComponentProps<'div'>) {
135
+ return <div data-slot="wizard-end" className={cn('flex gap-2', className)} {...props} />;
136
+ }
137
+
138
+ export { Steps, Step, WizardBar, WizardMeta, WizardEnd, type StepState };
@@ -0,0 +1,47 @@
1
+ import * as React from 'react';
2
+ import { Switch as SwitchPrimitive } from 'radix-ui';
3
+
4
+ import { cn } from '@rise-x/ui/lib/utils';
5
+
6
+ /*
7
+ * 30×18 track, 14px thumb, 2px inset — so the checked thumb travels exactly
8
+ * 12px. Checked is BRAND, not primary: a switch is an affirmative commitment
9
+ * ("this is on"), which is precisely the complementary role brand keeps in a
10
+ * neutral system. Contrast with Checkbox, where "selected" is a neutral fact
11
+ * about a row and the fill is near-black.
12
+ */
13
+ function Switch({
14
+ className,
15
+ size = 'default',
16
+ ...props
17
+ }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
18
+ size?: 'sm' | 'default';
19
+ }) {
20
+ return (
21
+ <SwitchPrimitive.Root
22
+ data-slot="switch"
23
+ data-size={size}
24
+ className={cn(
25
+ 'peer group/switch relative inline-flex shrink-0 items-center rounded-full border-0 transition-colors duration-150 ease-decelerate outline-none after:absolute after:-inset-x-3 after:-inset-y-2',
26
+ 'focus-visible:ring-3 focus-visible:ring-ring-control/35',
27
+ 'data-[size=default]:h-[18px] data-[size=default]:w-[30px] data-[size=sm]:h-3.5 data-[size=sm]:w-6',
28
+ 'data-checked:bg-brand data-unchecked:bg-border-strong',
29
+ 'aria-invalid:ring-3 aria-invalid:ring-error/20',
30
+ 'data-disabled:cursor-not-allowed data-disabled:opacity-45',
31
+ className,
32
+ )}
33
+ {...props}
34
+ >
35
+ <SwitchPrimitive.Thumb
36
+ data-slot="switch-thumb"
37
+ className={cn(
38
+ 'pointer-events-none block translate-x-0.5 rounded-full bg-white shadow-[0_1px_2px_rgb(0_0_0/0.15)] ring-0 transition-transform duration-150 ease-decelerate',
39
+ 'group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-2.5',
40
+ 'group-data-[size=default]/switch:data-checked:translate-x-[14px] group-data-[size=sm]/switch:data-checked:translate-x-[12px]',
41
+ )}
42
+ />
43
+ </SwitchPrimitive.Root>
44
+ );
45
+ }
46
+
47
+ export { Switch };
@@ -0,0 +1,233 @@
1
+ import * as React from 'react';
2
+
3
+ import { cn } from '@rise-x/ui/lib/utils';
4
+
5
+ /*
6
+ * Roomier than a dense grid — 44px header, 52px rows, 16px cell padding —
7
+ * because Rise-X rows routinely carry two lines of identity. No zebra
8
+ * striping: the hairline divider is enough, and stripes fight with selection
9
+ * and status tints.
10
+ *
11
+ * GREY IS A BUDGET, AND A TABLE IS MOSTLY ROWS. A fill that reads as gentle on
12
+ * a 32px control covers half the screen here, so it is spent only on what the
13
+ * USER is doing to a row: hover 4.5% → press/select 8% → selected-and-hovered
14
+ * 13%. Hover always sits BELOW selection, never level with it, or a transient
15
+ * state gets read as a persistent one.
16
+ *
17
+ * STRUCTURE: the expanded region spends no grey — the turned chevron and the
18
+ * indented detail are already unambiguous, and four open rows would flood.
19
+ * GROUP HEADERS DO get a band (`--muted`), because a group boundary has to be
20
+ * findable while scanning a long table and space alone loses that fight once the
21
+ * rows are dense. It sits BELOW every row-interaction fill, so it still cannot
22
+ * be confused with hover or selection.
23
+ */
24
+
25
+ function Table({ className, ...props }: React.ComponentProps<'table'>) {
26
+ return (
27
+ <div data-slot="table-container" className="relative w-full overflow-x-auto">
28
+ <table
29
+ data-slot="table"
30
+ className={cn('w-full caption-bottom border-separate border-spacing-0 text-ui', className)}
31
+ {...props}
32
+ />
33
+ </div>
34
+ );
35
+ }
36
+
37
+ /* Optional wrapper: the card the table lives in. 18px radius (grouped
38
+ * surface), hairline border, no shadow. */
39
+ function TableWrap({ className, ...props }: React.ComponentProps<'div'>) {
40
+ return (
41
+ <div
42
+ data-slot="table-wrap"
43
+ className={cn('overflow-x-auto rounded-2xl border border-border bg-card', className)}
44
+ {...props}
45
+ />
46
+ );
47
+ }
48
+
49
+ function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
50
+ return <thead data-slot="table-header" className={cn(className)} {...props} />;
51
+ }
52
+
53
+ function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
54
+ return (
55
+ <tbody
56
+ data-slot="table-body"
57
+ className={cn('[&_tr:last-child>td]:border-b-0', className)}
58
+ {...props}
59
+ />
60
+ );
61
+ }
62
+
63
+ function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
64
+ return (
65
+ <tfoot
66
+ data-slot="table-footer"
67
+ className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
68
+ {...props}
69
+ />
70
+ );
71
+ }
72
+
73
+ function TableRow({
74
+ className,
75
+ expanded,
76
+ ...props
77
+ }: React.ComponentProps<'tr'> & {
78
+ /** This row is showing its own TableExpandedRow beneath it. Drops the
79
+ * hairline underneath so the pair reads as one uninterrupted surface. */
80
+ expanded?: boolean;
81
+ }) {
82
+ return (
83
+ <tr
84
+ data-slot="table-row"
85
+ data-expanded={expanded ? '' : undefined}
86
+ className={cn(
87
+ 'transition-colors duration-150 ease-decelerate hover:bg-fill-0 active:bg-fill-1',
88
+ 'data-expanded:[&>td]:border-b-transparent',
89
+ // Selection is a NEUTRAL fill, not brand: at 20 selected rows a green
90
+ // wash swamps the table, and the filled checkbox already says
91
+ // "selected". Brand-as-selection survives only where one thing can be
92
+ // selected at a time (nav item, detail list).
93
+ 'data-[state=selected]:bg-fill-1 data-[state=selected]:hover:bg-fill-2',
94
+ className,
95
+ )}
96
+ {...props}
97
+ />
98
+ );
99
+ }
100
+
101
+ /* Group header: a grey band, opaque so it survives a sticky header. Air above
102
+ * still separates it from the group that ended, and there is no rule below, so
103
+ * it attaches to the group it opens rather than floating between the two. */
104
+ function TableGroupRow({
105
+ className,
106
+ children,
107
+ colSpan,
108
+ cellClassName,
109
+ ...props
110
+ }: React.ComponentProps<'tr'> & {
111
+ colSpan?: number;
112
+ /** Merged onto the inner cell — the band's own size, case and padding live
113
+ * there, not on the row. */
114
+ cellClassName?: string;
115
+ }) {
116
+ return (
117
+ <tr data-slot="table-group-row" className={cn('bg-muted hover:bg-muted', className)} {...props}>
118
+ <td
119
+ colSpan={colSpan}
120
+ className={cn(
121
+ 'border-b-0 bg-muted px-4 py-2.5 align-middle text-micro font-medium tracking-[0.04em] text-muted-foreground uppercase',
122
+ cellClassName,
123
+ )}
124
+ >
125
+ {children}
126
+ </td>
127
+ </tr>
128
+ );
129
+ }
130
+
131
+ /* Expanded detail. On the card surface, deliberately: expansion is not a state
132
+ * the user can be wrong about — the chevron has turned and the detail is
133
+ * plainly detail — so it spends no grey. Belonging is structural instead. Put
134
+ * `data-expanded` on the PARENT row so its hairline drops and the pair reads as
135
+ * one uninterrupted surface. */
136
+ function TableExpandedRow({ className, ...props }: React.ComponentProps<'tr'>) {
137
+ return (
138
+ <tr
139
+ data-slot="table-expanded-row"
140
+ className={cn(
141
+ 'bg-card hover:bg-card [&>td]:h-auto [&>td]:border-b [&>td]:border-border [&>td]:p-0',
142
+ className,
143
+ )}
144
+ {...props}
145
+ />
146
+ );
147
+ }
148
+
149
+ function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
150
+ return (
151
+ <th
152
+ data-slot="table-head"
153
+ className={cn(
154
+ 'h-11 border-b border-border bg-card px-4 text-left align-middle text-xs font-medium tracking-[0.01em] whitespace-nowrap text-muted-foreground [&:has([role=checkbox])]:pr-0',
155
+ className,
156
+ )}
157
+ {...props}
158
+ />
159
+ );
160
+ }
161
+
162
+ function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
163
+ return (
164
+ <td
165
+ data-slot="table-cell"
166
+ className={cn(
167
+ 'h-13 border-b border-border-subtle px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0',
168
+ className,
169
+ )}
170
+ {...props}
171
+ />
172
+ );
173
+ }
174
+
175
+ function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
176
+ return (
177
+ <caption
178
+ data-slot="table-caption"
179
+ className={cn('mt-4 text-ui text-muted-foreground', className)}
180
+ {...props}
181
+ />
182
+ );
183
+ }
184
+
185
+ /* Two-line cell: identity on top, context beneath. The reason rows are 52px. */
186
+ function TableCellStack({ className, ...props }: React.ComponentProps<'span'>) {
187
+ return (
188
+ <span
189
+ data-slot="table-cell-stack"
190
+ className={cn(
191
+ 'flex flex-col leading-[1.35] [&>small]:text-micro [&>small]:leading-[1.35] [&>small]:text-subtle',
192
+ className,
193
+ )}
194
+ {...props}
195
+ />
196
+ );
197
+ }
198
+
199
+ /* Lazy loading, not pagination. The sentinel sits inside the table container so
200
+ * the header stays put and scroll position is never reset. */
201
+ function TableLazySentinel({ className, children, ...props }: React.ComponentProps<'div'>) {
202
+ return (
203
+ <div
204
+ data-slot="table-lazy"
205
+ className={cn(
206
+ // hairline above: the sentinel is chrome, not the next row, and without
207
+ // a rule it reads as a row that failed to render
208
+ 'flex items-center justify-center gap-[9px] border-t border-border-subtle px-4 py-3.5 text-xs text-subtle',
209
+ className,
210
+ )}
211
+ {...props}
212
+ >
213
+ <span className="size-[13px] animate-spin rounded-full border-[1.5px] border-border border-t-muted-foreground" />
214
+ {children ?? 'Loading more…'}
215
+ </div>
216
+ );
217
+ }
218
+
219
+ export {
220
+ Table,
221
+ TableWrap,
222
+ TableHeader,
223
+ TableBody,
224
+ TableFooter,
225
+ TableHead,
226
+ TableRow,
227
+ TableGroupRow,
228
+ TableExpandedRow,
229
+ TableCell,
230
+ TableCellStack,
231
+ TableCaption,
232
+ TableLazySentinel,
233
+ };
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+
3
+ import { cn } from '@rise-x/ui/lib/utils';
4
+
5
+ // forwardRef (not React 19 ref-as-prop): the classic React 18 host also renders
6
+ // these components and strips `ref` from plain function components — imperative
7
+ // focus/measure from consumers would silently break there.
8
+ const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<'textarea'>>(
9
+ function Textarea({ className, ...props }, ref) {
10
+ return (
11
+ <textarea
12
+ ref={ref}
13
+ data-slot="textarea"
14
+ className={cn(
15
+ 'flex field-sizing-content min-h-16 w-full resize-y rounded-lg border border-input bg-card px-2.5 py-2 text-ui text-foreground transition-[border-color,box-shadow] duration-100 outline-none',
16
+ 'placeholder:text-subtle',
17
+ 'focus-visible:border-brand focus-visible:ring-3 focus-visible:ring-brand/12',
18
+ 'disabled:cursor-not-allowed disabled:bg-muted disabled:text-subtle',
19
+ 'aria-invalid:border-error aria-invalid:focus-visible:border-error aria-invalid:focus-visible:ring-error/18',
20
+ className,
21
+ )}
22
+ {...props}
23
+ />
24
+ );
25
+ },
26
+ );
27
+
28
+ export { Textarea };
@@ -0,0 +1,94 @@
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
+ * Timeline / activity log / audit trail / version history are ONE component.
8
+ * They differ in content, not in structure: a rail, a node per entry, and a
9
+ * two-line body. Building four of these would mean four sets of spacing
10
+ * decisions drifting apart.
11
+ *
12
+ * The rail is drawn on the node's ::after rather than as a border on the row,
13
+ * so the last entry has no dangling tail and nothing needs a modifier class.
14
+ */
15
+ function Timeline({ className, ...props }: React.ComponentProps<'ol'>) {
16
+ return <ol data-slot="timeline" className={cn('flex flex-col', className)} {...props} />;
17
+ }
18
+
19
+ const nodeVariants = cva(
20
+ 'relative z-10 grid size-[18px] shrink-0 place-items-center rounded-full [&_svg]:size-2.5',
21
+ {
22
+ variants: {
23
+ tone: {
24
+ neutral: 'bg-fill-2 text-muted-foreground',
25
+ success: 'bg-success/15 text-success-text',
26
+ warning: 'bg-warning/16 text-warning-text',
27
+ error: 'bg-error/14 text-error-text',
28
+ info: 'bg-info/14 text-info-text',
29
+ ai: 'bg-ai/14 text-ai-text',
30
+ },
31
+ },
32
+ defaultVariants: { tone: 'neutral' },
33
+ },
34
+ );
35
+
36
+ function TimelineItem({
37
+ className,
38
+ tone = 'neutral',
39
+ glyph,
40
+ children,
41
+ last,
42
+ ...props
43
+ }: React.ComponentProps<'li'> &
44
+ VariantProps<typeof nodeVariants> & {
45
+ glyph?: React.ReactNode;
46
+ /** Suppresses the connecting rail below the node. */
47
+ last?: boolean;
48
+ }) {
49
+ return (
50
+ <li
51
+ data-slot="timeline-item"
52
+ className={cn('relative flex gap-2.5 pb-4 last:pb-0', className)}
53
+ {...props}
54
+ >
55
+ <div className="relative flex flex-col items-center">
56
+ <span className={cn(nodeVariants({ tone }))}>{glyph}</span>
57
+ {!last && <span aria-hidden className="w-px flex-1 bg-border" />}
58
+ </div>
59
+ <div className="min-w-0 flex-1">{children}</div>
60
+ </li>
61
+ );
62
+ }
63
+
64
+ function TimelineTitle({ className, ...props }: React.ComponentProps<'div'>) {
65
+ return (
66
+ <div
67
+ data-slot="timeline-title"
68
+ className={cn('text-ui leading-[1.35] font-medium', className)}
69
+ {...props}
70
+ />
71
+ );
72
+ }
73
+
74
+ function TimelineMeta({ className, ...props }: React.ComponentProps<'div'>) {
75
+ return (
76
+ <div
77
+ data-slot="timeline-meta"
78
+ className={cn('mt-0.5 text-micro text-subtle', className)}
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ function TimelineBody({ className, ...props }: React.ComponentProps<'div'>) {
85
+ return (
86
+ <div
87
+ data-slot="timeline-body"
88
+ className={cn('mt-1 text-xs text-muted-foreground', className)}
89
+ {...props}
90
+ />
91
+ );
92
+ }
93
+
94
+ export { Timeline, TimelineItem, TimelineTitle, TimelineMeta, TimelineBody, nodeVariants };