@rise-x/apps-sdk 0.7.0 → 0.9.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 (72) hide show
  1. package/README.md +104 -1
  2. package/build/rsbuild/index.d.ts +31 -0
  3. package/build/rsbuild/index.js +204 -0
  4. package/build/ui/components/accordion.d.ts +7 -0
  5. package/build/ui/components/app-frame.d.ts +13 -0
  6. package/build/ui/components/aspect-ratio.d.ts +4 -0
  7. package/build/ui/components/button-group.d.ts +7 -0
  8. package/build/ui/components/carousel.d.ts +18 -0
  9. package/build/ui/components/chart.d.ts +45 -94
  10. package/build/ui/components/collapsible.d.ts +6 -0
  11. package/build/ui/components/combobox.d.ts +19 -0
  12. package/build/ui/components/command.d.ts +18 -0
  13. package/build/ui/components/context-menu.d.ts +29 -0
  14. package/build/ui/components/date-picker.d.ts +16 -0
  15. package/build/ui/components/direction.d.ts +6 -0
  16. package/build/ui/components/field.d.ts +25 -0
  17. package/build/ui/components/hover-card.d.ts +6 -0
  18. package/build/ui/components/input-group.d.ts +13 -0
  19. package/build/ui/components/input-otp.d.ts +34 -0
  20. package/build/ui/components/input.d.ts +1 -3
  21. package/build/ui/components/item.d.ts +23 -0
  22. package/build/ui/components/kbd.d.ts +4 -0
  23. package/build/ui/components/menubar.d.ts +26 -0
  24. package/build/ui/components/message-scroller.d.ts +15 -0
  25. package/build/ui/components/nav.d.ts +2 -1
  26. package/build/ui/components/navigation-menu.d.ts +13 -0
  27. package/build/ui/components/page-header.d.ts +7 -1
  28. package/build/ui/index.d.ts +20 -0
  29. package/build/ui/reference/components/accordion.tsx +85 -0
  30. package/build/ui/reference/components/ai.tsx +3 -1
  31. package/build/ui/reference/components/alert-dialog.tsx +10 -16
  32. package/build/ui/reference/components/app-frame.tsx +71 -0
  33. package/build/ui/reference/components/aspect-ratio.tsx +28 -0
  34. package/build/ui/reference/components/button-group.tsx +77 -0
  35. package/build/ui/reference/components/button.tsx +4 -2
  36. package/build/ui/reference/components/carousel.tsx +248 -0
  37. package/build/ui/reference/components/chart.tsx +441 -1131
  38. package/build/ui/reference/components/collapsible.tsx +43 -0
  39. package/build/ui/reference/components/combobox.tsx +146 -0
  40. package/build/ui/reference/components/command.tsx +181 -0
  41. package/build/ui/reference/components/context-menu.tsx +243 -0
  42. package/build/ui/reference/components/data-table.tsx +3 -3
  43. package/build/ui/reference/components/date-picker.tsx +218 -0
  44. package/build/ui/reference/components/dialog.tsx +3 -3
  45. package/build/ui/reference/components/direction.tsx +22 -0
  46. package/build/ui/reference/components/dropdown-menu.tsx +1 -1
  47. package/build/ui/reference/components/field.tsx +252 -0
  48. package/build/ui/reference/components/hover-card.tsx +64 -0
  49. package/build/ui/reference/components/input-group.tsx +157 -0
  50. package/build/ui/reference/components/input-otp.tsx +106 -0
  51. package/build/ui/reference/components/input.tsx +4 -32
  52. package/build/ui/reference/components/item.tsx +188 -0
  53. package/build/ui/reference/components/kbd.tsx +43 -0
  54. package/build/ui/reference/components/label.tsx +1 -1
  55. package/build/ui/reference/components/menubar.tsx +275 -0
  56. package/build/ui/reference/components/message-scroller.tsx +141 -0
  57. package/build/ui/reference/components/message.tsx +12 -6
  58. package/build/ui/reference/components/nav.tsx +14 -3
  59. package/build/ui/reference/components/navigation-menu.tsx +191 -0
  60. package/build/ui/reference/components/page-header.tsx +32 -0
  61. package/build/ui/reference/components/popover.tsx +2 -2
  62. package/build/ui/reference/components/select.tsx +11 -8
  63. package/build/ui/reference/components/sheet.tsx +10 -2
  64. package/build/ui/reference/components/timeline.tsx +7 -0
  65. package/build/ui/reference/components/toggle.tsx +1 -1
  66. package/build/ui/reference/index.ts +20 -0
  67. package/build/ui/standalone.js +167 -28
  68. package/build/ui/styles.css +1 -1
  69. package/package.json +27 -2
  70. package/rsbuild/package.json +8 -0
  71. package/template/AGENTS.md +15 -7
  72. package/template/src/App.tsx +18 -11
package/README.md CHANGED
@@ -65,6 +65,36 @@ re-exported for apps:
65
65
  import { Button, Dialog, DialogContent, Input, cn } from '@rise-x/apps-sdk/ui';
66
66
  ```
67
67
 
68
+ #### App layout (`AppFrame` / `AppRail` / `AppContent`)
69
+
70
+ The root layout contract, scaffolded into every new app:
71
+
72
+ ```tsx
73
+ <AppFrame>
74
+ <AppRail>{/* Nav / NavItem rail */}</AppRail>
75
+ <AppContent>{/* screens; the app's ONE scroll container */}</AppContent>
76
+ </AppFrame>
77
+ ```
78
+
79
+ The next-gen shell hands the app a full-height region that extends under its
80
+ floating top bar and publishes the bar's height as `--topbar-h` on the
81
+ document. `AppRail` stays fixed on the left and starts below the bar;
82
+ `AppContent` owns the scroll and slides content **behind** the bar's blur.
83
+ Both pad with `var(--topbar-h, 0px)`, so in hosts without a floating bar
84
+ (the classic shell, standalone dev) the frame degrades to a plain
85
+ rail-plus-content layout. Never hardcode a bar height and never add a second
86
+ page-level scroller.
87
+
88
+ The frame is responsive by default: below the `md` breakpoint it stacks —
89
+ `AppRail` renders as a horizontal, scrollable nav strip under the top bar
90
+ (`NavSection` headers hide) and `AppContent` scrolls beneath it. Don't write
91
+ your own breakpoints around the frame; compose inside it.
92
+
93
+ Rendering an `AppFrame` anywhere in the app is the signal that the app owns
94
+ its layout: the next-gen shell detects it and hands over the full-bleed
95
+ region. Apps without one are compensated — the host pads and scrolls the
96
+ region itself — so pre-frame bundles keep working, minus the fixed rail.
97
+
68
98
  How it works: the SDK ships the **typings**; the **runtime** is the shell's own
69
99
  copy of `@rise-x/ui`, delivered through the Module Federation share scope —
70
100
  exactly how apps already consume React. That is deliberate: the components are
@@ -703,6 +733,79 @@ per-app `QueryClient` (built with `createAppQueryClient` from
703
733
  `@rise-x/apps-sdk/query`), which is what the SDK's query hooks pick up
704
734
  through context in federated apps.
705
735
 
736
+ ## Build config (`@rise-x/apps-sdk/rsbuild`)
737
+
738
+ Apps build with [Rsbuild](https://rsbuild.dev), and the Module Federation
739
+ contract with the shell lives in this preset rather than in each app's config.
740
+
741
+ ```ts
742
+ // rsbuild.config.ts
743
+ import { defineConfig } from '@rsbuild/core';
744
+ import { defineAppConfig } from '@rise-x/apps-sdk/rsbuild';
745
+ import pkg from './package.json';
746
+
747
+ export default defineConfig(({ envMode }) =>
748
+ defineAppConfig({ pkg, port: 5102, standalone: envMode === 'standalone' }),
749
+ );
750
+ ```
751
+
752
+ ```bash
753
+ pnpm rsbuild build # federated bundle -> dist/
754
+ pnpm rsbuild dev # federated, served for a host to load
755
+ pnpm rsbuild dev --env-mode standalone # standalone, no shell -> dist-local/
756
+ ```
757
+
758
+ Requires `@rsbuild/core` and `@rsbuild/plugin-react` in the app (they are
759
+ optional peers here, so hosts that never import this subpath get no unmet-peer
760
+ noise).
761
+
762
+ | Option | Required | Purpose |
763
+ |---|---|---|
764
+ | `pkg` | yes | the app's `package.json`. `name` derives the MF scope (`@rise-x-apps/vendor-hub` → `app_vendor_hub`); `version` is baked as `__APP_VERSION__` |
765
+ | `port` | yes | dev-server port. Must be unique across apps |
766
+ | `standalone` | no | no shell, no MF, React bundled in |
767
+ | `exposes` | no | extra MF exposes, merged over `./App` + `./lifecycle` |
768
+
769
+ `__APP_VERSION__` is a `define`, so TypeScript needs to be told it exists. Add
770
+ `declare const __APP_VERSION__: string;` to the app if you read it.
771
+
772
+ What the federated branch sets, and why it matters:
773
+
774
+ - **`ModuleFederationPluginV1`**, never the enhanced plugin — V1 emits the
775
+ container shape (`window[scope].init/get`) that both hosts' runtime loaders
776
+ speak.
777
+ - **`output.uniqueName = scope`** via `tools.rspack`. Rsbuild has no
778
+ `output.uniqueName` of its own, and it names the chunk-loading global — left
779
+ at the default it collides with the host's.
780
+ - **React, its JSX runtimes and `@rise-x/ui` are consume-only**
781
+ (`import: false`): the host provides the single copy. `@tanstack/react-query`
782
+ deliberately keeps its bundled fallback, so an app still works on a host that
783
+ does not share it.
784
+ - **React is shared as `^18.0.0 || ^19.0.0`**, because the two hosts are on
785
+ different majors (ClientApp 18, Shell 19) and one bundle must load on both.
786
+ That is a build-level permission, not a licence to use React 19 APIs — write
787
+ app code against the **React 18-compatible API surface**, since ClientApp is
788
+ still the production host.
789
+ - **Flat `dist/`** — `remoteEntry.js` beside its chunks, because
790
+ `tools/apps-dev-server` probes `dist/remoteEntry.js` and the deploy zips the
791
+ *contents* of `dist/`.
792
+ - **`assetPrefix: 'auto'` on both `output` and `dev`** so one bundle works on
793
+ the dev port and when the shell loads `remoteEntry.js` from the CDN. Rsbuild
794
+ splits what webpack had as a single `output.publicPath`, and the dev half
795
+ defaults to `/` — a remote served by `rsbuild dev` would otherwise resolve
796
+ its async chunks against the *host's* origin.
797
+ - **Production source maps**, which Rsbuild otherwise defaults off.
798
+
799
+ The preset's own `standalone` specs resolve `@rise-x/apps-sdk/ui/standalone`,
800
+ so run `pnpm build` in this package before `pnpm test` on a clean checkout (CI
801
+ already builds first).
802
+
803
+ Set `APP_SCOPE` to override the derived scope. That is only for registering two
804
+ builds of one app side by side (an old and a redesigned version, to compare
805
+ them) — two registrations may not share a scope, because the shell caches
806
+ loaded remotes by URL and the second `remoteEntry.js` would overwrite the
807
+ first's global. Leave it unset for normal releases.
808
+
706
809
  ## Local development against the SDK
707
810
 
708
811
  In-repo consumers (ClientApp, apps/\*) declare `"@rise-x/apps-sdk": "workspace:*"`,
@@ -722,7 +825,7 @@ pnpm add @rise-x/apps-sdk
722
825
 
723
826
  ## Publishing
724
827
 
725
- Publishes to the public npm registry (`registry.npmjs.org`) under the `rise-x` org, per `publishConfig` in `package.json`. CI publishes automatically when `packages/apps-sdk/**` changes land on `main` and the version in `package.json` is not yet on the registry (`.github/workflows/publish-apps-sdk.yml`).
828
+ Publishes to the public npm registry (`registry.npmjs.org`) under the `rise-x` org, per `publishConfig` in `package.json`. Releases are manual: run the **Publish @rise-x/apps-sdk** workflow (`.github/workflows/publish-apps-sdk.yml`) via workflow dispatch, from `main` or a `release/*` branch — it publishes the version in `package.json`, and fails if that version is already on the registry.
726
829
 
727
830
  To publish manually you need an npmjs account with publish rights in the `rise-x` org (`npm login`), then:
728
831
 
@@ -0,0 +1,31 @@
1
+ import type { RsbuildConfig } from '@rsbuild/core';
2
+ export interface AppPackageJson {
3
+ name: string;
4
+ version?: string;
5
+ }
6
+ export interface DefineAppConfigOptions {
7
+ /** The app's own package.json. `name` derives the Module Federation scope. */
8
+ pkg: AppPackageJson;
9
+ /**
10
+ * Dev-server port. Must be unique across apps — two apps on one port cannot
11
+ * be served side by side during development.
12
+ */
13
+ port: number;
14
+ /**
15
+ * Standalone dev: no shell, no Module Federation, React bundled in.
16
+ * Drive it with `rsbuild dev --env-mode standalone`.
17
+ *
18
+ * Do NOT use `--env-mode local`: Rsbuild rejects that value outright,
19
+ * because `.env.local` is reserved as a temporary local file. The mode
20
+ * name is refused whether or not such a file exists.
21
+ */
22
+ standalone?: boolean;
23
+ /** Extra Module Federation exposes, merged over `./App` + `./lifecycle`. */
24
+ exposes?: Record<string, string>;
25
+ }
26
+ /**
27
+ * Derive an app's Module Federation scope from its package name:
28
+ * `@rise-x-apps/vendor-hub` -> `app_vendor_hub`.
29
+ */
30
+ export declare function deriveAppScope(packageName: string): string;
31
+ export declare function defineAppConfig({ pkg, port, standalone, exposes, }: DefineAppConfigOptions): RsbuildConfig;
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveAppScope = deriveAppScope;
4
+ exports.defineAppConfig = defineAppConfig;
5
+ const node_module_1 = require("node:module");
6
+ const node_path_1 = require("node:path");
7
+ const plugin_react_1 = require("@rsbuild/plugin-react");
8
+ const plugin_type_check_1 = require("@rsbuild/plugin-type-check");
9
+ const lifecycle_1 = require("../lifecycle");
10
+ // The shell validates an app's scope against this, and `uniqueName` (the
11
+ // chunk-loading global) is the same string — so an invalid scope fails at
12
+ // runtime in ways that are hard to trace. Fail at config time instead.
13
+ const SCOPE_PATTERN = /^[a-z][a-z0-9_]*$/;
14
+ // React and its JSX runtimes are CONSUMED from the shell and never bundled.
15
+ // `import: false` prevents the duplicate-React-instance failure where Module
16
+ // Federation's singleton dedup picks the higher version after the host has
17
+ // already bound its react-dom to a lower one. The jsx-runtime entries are
18
+ // required because React 18's automatic JSX transform emits
19
+ // `import 'react/jsx-runtime'`; unshared, the bundled runtime would
20
+ // sync-require('react') and fail. A config with these shares only runs inside
21
+ // a host — standalone dev takes the `standalone` branch below, which bundles
22
+ // React itself.
23
+ //
24
+ // The version range must cover BOTH hosts: ClientApp resolves React 18, Shell
25
+ // resolves 19. Most apps' webpack configs carry a literal '^18.0.0', which Shell
26
+ // does not satisfy — it logs one warning per shared entry on every app load, and
27
+ // it states a constraint the apps do not actually have. Both hosts DERIVE the
28
+ // version they provide from the resolved package precisely so it cannot rot
29
+ // (see ClientApp/webpack.config.js).
30
+ //
31
+ // The range matches this package's own `react` peer range, and
32
+ // apps/medication-identifier already ships it in production. Be precise about
33
+ // what it does: with `singleton` and no `strictVersion` it does NOT reject a
34
+ // host on another React major — the host's copy is consumed either way. The
35
+ // range documents intent and silences the warning. Anyone adding
36
+ // `strictVersion` later is changing that, deliberately.
37
+ //
38
+ // Accepting both majors is a build-level permission, not a licence to use
39
+ // React 19 APIs. ClientApp is still the production host on React 18, so app
40
+ // code must stay on the React 18-compatible API surface (see AGENTS.md).
41
+ const CONSUMED_REACT_SHARE = {
42
+ singleton: true,
43
+ requiredVersion: '^18.0.0 || ^19.0.0',
44
+ import: false,
45
+ };
46
+ /**
47
+ * Derive an app's Module Federation scope from its package name:
48
+ * `@rise-x-apps/vendor-hub` -> `app_vendor_hub`.
49
+ */
50
+ function deriveAppScope(packageName) {
51
+ const slug = packageName.replace(/^@[^/]+\//, '');
52
+ const scope = `app_${slug.replace(/-/g, '_')}`;
53
+ if (!SCOPE_PATTERN.test(scope)) {
54
+ throw new Error(`[apps-sdk] Cannot derive a valid Module Federation scope from package name "${packageName}" ` +
55
+ `(got "${scope}", which must match ${SCOPE_PATTERN}). Rename the package, or set APP_SCOPE.`);
56
+ }
57
+ return scope;
58
+ }
59
+ function defineAppConfig({ pkg, port, standalone = false, exposes, }) {
60
+ // APP_SCOPE overrides the derived scope, for the case where an app must be
61
+ // registered ALONGSIDE another build of itself (e.g. an old and a redesigned
62
+ // version, side by side, to compare them). Two registrations may not share a
63
+ // scope: the shell resolves the container from `window[manifest.scope]` and
64
+ // caches loaded scripts by URL, so once the second remoteEntry.js has
65
+ // overwritten the global, the first registration re-uses the cached script
66
+ // promise and serves the SECOND app's container for both. Leave it unset for
67
+ // normal releases — the derived value is the app's identity.
68
+ const override = process.env.APP_SCOPE;
69
+ if (override && !SCOPE_PATTERN.test(override)) {
70
+ throw new Error(`[apps-sdk] APP_SCOPE="${override}" is not a valid Module Federation scope ` +
71
+ `(it must match ${SCOPE_PATTERN}).`);
72
+ }
73
+ const scope = override || deriveAppScope(pkg.name);
74
+ const base = {
75
+ // pluginTypeCheck is NOT optional polish. The webpack configs this preset
76
+ // replaces used ts-loader, which type-checked on every build, and that pass
77
+ // was each app's ONLY type gate: no workflow runs an app's `tsc` — the PR
78
+ // check builds ClientApp and Shell only, build-workspace-packages
79
+ // deliberately excludes apps/, and the pre-commit hook covers Shell,
80
+ // packages/ui and ClientApp. Rsbuild transpiles with SWC, which strips
81
+ // types without checking them, so without this `pnpm build` would happily
82
+ // produce a deploy artifact from code that does not compile.
83
+ plugins: [(0, plugin_react_1.pluginReact)(), (0, plugin_type_check_1.pluginTypeCheck)()],
84
+ source: {
85
+ entry: { index: './src/index.tsx' },
86
+ define: {
87
+ __APP_VERSION__: JSON.stringify(pkg.version ?? '0.0.0'),
88
+ },
89
+ },
90
+ html: { template: './public/index.html' },
91
+ server: {
92
+ port,
93
+ historyApiFallback: true,
94
+ // `public/` holds only the HTML template, which `html.template` already
95
+ // consumes. Left enabled, Rsbuild would also copy it to the dist root and
96
+ // clobber the generated index.html.
97
+ publicDir: false,
98
+ },
99
+ };
100
+ if (standalone) {
101
+ // Resolve React from the APP, not from the SDK — apps live at varying
102
+ // depths and pnpm hoists unpredictably.
103
+ const appRequire = (0, node_module_1.createRequire)((0, node_path_1.join)(process.cwd(), 'package.json'));
104
+ return {
105
+ ...base,
106
+ output: {
107
+ distPath: { root: 'dist-local' },
108
+ assetPrefix: '/',
109
+ },
110
+ resolve: {
111
+ alias: {
112
+ // No shell means no share scope, so bundle the SDK's own compiled
113
+ // snapshot of the design system (CSS self-injected, Inter included).
114
+ // The federated build still gets the host's copy via the share scope.
115
+ '@rise-x/ui': require.resolve('@rise-x/apps-sdk/ui/standalone'),
116
+ // ONE React copy in the bundle. The workspace hoists react@18 to the
117
+ // root, but lucide-react, radix-ui and sonner all peer on React 19 and
118
+ // pnpm nests react@19 under each of them. The federated build is
119
+ // immune — Module Federation's `shared` rewires every `react` request
120
+ // in the compilation, including those inside node_modules. Standalone
121
+ // dev has no share scope, so without these aliases lucide's icons are
122
+ // built by React 19's createElement and the app's React 18 renderer
123
+ // rejects them outright ("Objects are not valid as a React child").
124
+ react: (0, node_path_1.dirname)(appRequire.resolve('react/package.json')),
125
+ 'react-dom': (0, node_path_1.dirname)(appRequire.resolve('react-dom/package.json')),
126
+ },
127
+ },
128
+ };
129
+ }
130
+ return {
131
+ ...base,
132
+ output: {
133
+ // Flat dist: remoteEntry.js plus its sibling chunks at the archive root.
134
+ // tools/apps-dev-server probes `dist/remoteEntry.js`, and the deploy zips
135
+ // the CONTENTS of dist/ with remoteEntry.js at the top level.
136
+ distPath: { root: 'dist', js: '', jsAsync: '', css: '', cssAsync: '' },
137
+ // 'auto' derives the chunk base URL from document.currentScript.src at
138
+ // runtime, so one bundle works both in dev and when the shell loads
139
+ // remoteEntry.js from the CDN under /apps/<id>/<version>/.
140
+ assetPrefix: 'auto',
141
+ },
142
+ // `output.assetPrefix` above is the PRODUCTION value only — the dev server
143
+ // reads `dev.assetPrefix`, which otherwise defaults to `/`. Without this,
144
+ // a remote served by `rsbuild dev` resolves its async chunks against the
145
+ // HOST's origin and 404s, because webpack's single `output.publicPath`
146
+ // covered both modes and Rsbuild's does not.
147
+ dev: { assetPrefix: 'auto' },
148
+ server: {
149
+ ...base.server,
150
+ // The shell's dev server fetches remoteEntry.js cross-origin.
151
+ headers: { 'Access-Control-Allow-Origin': '*' },
152
+ },
153
+ tools: {
154
+ rspack: (config, { rspack, appendPlugins, isProd }) => {
155
+ // Rsbuild defaults production source maps OFF; the webpack configs this
156
+ // replaces shipped them, and without them a deployed app is unreadable
157
+ // in a devtools stack trace. Set here rather than via
158
+ // `output.sourceMap`, which is mode-agnostic and would also downgrade
159
+ // dev rebuilds to the slowest option.
160
+ if (isProd) {
161
+ config.devtool = 'source-map';
162
+ }
163
+ // Rsbuild has no `output.uniqueName`, and it is load-bearing: it names
164
+ // the chunk-loading global, which must not collide with the host's.
165
+ config.output.uniqueName = scope;
166
+ appendPlugins(
167
+ // V1 = the webpack-aligned Module Federation implementation. It emits
168
+ // the container shape (`window[scope].init/get`) that BOTH hosts'
169
+ // runtime loaders speak. Never the enhanced plugin.
170
+ new rspack.container.ModuleFederationPluginV1({
171
+ name: scope,
172
+ filename: 'remoteEntry.js',
173
+ exposes: {
174
+ './App': './src/App',
175
+ [lifecycle_1.LIFECYCLE_MODULE_NAME]: './src/lifecycle',
176
+ ...exposes,
177
+ },
178
+ shared: {
179
+ react: CONSUMED_REACT_SHARE,
180
+ 'react-dom': CONSUMED_REACT_SHARE,
181
+ 'react/jsx-runtime': CONSUMED_REACT_SHARE,
182
+ 'react/jsx-dev-runtime': CONSUMED_REACT_SHARE,
183
+ // The design system, imported via `@rise-x/apps-sdk/ui`. The host
184
+ // provides the only copy — and the compiled Tailwind CSS that
185
+ // styles it — so never bundle a fallback.
186
+ '@rise-x/ui': {
187
+ singleton: true,
188
+ requiredVersion: false,
189
+ import: false,
190
+ },
191
+ // Unlike react, KEEP the bundled fallback: the app loads through
192
+ // an async MF boundary so there is no eager sync-require hazard,
193
+ // and the fallback keeps the app working on hosts that do not
194
+ // share react-query.
195
+ '@tanstack/react-query': {
196
+ singleton: true,
197
+ requiredVersion: '^5.0.0',
198
+ },
199
+ },
200
+ }));
201
+ },
202
+ },
203
+ };
204
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { Accordion as AccordionPrimitive } from 'radix-ui';
3
+ declare function Accordion({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>): React.JSX.Element;
4
+ declare function AccordionItem({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item>): React.JSX.Element;
5
+ declare function AccordionTrigger({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Trigger>): React.JSX.Element;
6
+ declare function AccordionContent({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Content>): React.JSX.Element;
7
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ declare function AppFrame({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
3
+ /** Fixed left rail from md up (180px, the Nav convention; override via
4
+ * className) — long rails scroll themselves, the page never scrolls them
5
+ * away. Below md it renders as a horizontal nav strip under the top bar. */
6
+ declare function AppRail({ className, ...props }: React.ComponentProps<'aside'>): React.JSX.Element;
7
+ /** The scrolling content column. From md up it spans under the shell top bar —
8
+ * the top padding keeps resting content below it, so only scrolled content
9
+ * passes behind. Below md the rail strip clears the bar and the column
10
+ * scrolls beneath it with plain padding; a rail-less frame (AppContent as
11
+ * the frame's first child) pads itself below the bar instead. */
12
+ declare function AppContent({ className, ...props }: React.ComponentProps<'main'>): React.JSX.Element;
13
+ export { AppFrame, AppRail, AppContent };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { AspectRatio as AspectRatioPrimitive } from 'radix-ui';
3
+ declare function AspectRatio({ className, ...props }: React.ComponentProps<typeof AspectRatioPrimitive.Root>): React.JSX.Element;
4
+ export { AspectRatio };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<'div'> & {
3
+ orientation?: 'horizontal' | 'vertical';
4
+ }): React.JSX.Element;
5
+ declare function ButtonGroupText({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
6
+ declare function ButtonGroupSeparator({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
7
+ export { ButtonGroup, ButtonGroupText, ButtonGroupSeparator };
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
3
+ import { Button } from './button';
4
+ type CarouselApi = UseEmblaCarouselType[1];
5
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
6
+ type CarouselOptions = UseCarouselParameters[0];
7
+ type CarouselPlugin = UseCarouselParameters[1];
8
+ declare const Carousel: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
9
+ opts?: CarouselOptions;
10
+ plugins?: CarouselPlugin;
11
+ orientation?: "horizontal" | "vertical";
12
+ setApi?: (api: CarouselApi) => void;
13
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
+ declare function CarouselContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
15
+ declare function CarouselItem({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
16
+ declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
17
+ declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
18
+ export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import * as RechartsPrimitive from 'recharts';
3
+ import type { TooltipValueType } from 'recharts';
2
4
  declare const CHART_SERIES: readonly ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)", "var(--chart-5)", "var(--chart-6)"];
3
5
  declare const SEMANTIC_SERIES: {
4
6
  readonly success: "var(--success)";
@@ -9,99 +11,52 @@ declare const SEMANTIC_SERIES: {
9
11
  };
10
12
  type SemanticTone = keyof typeof SEMANTIC_SERIES;
11
13
  declare function seriesColor(index: number, tone?: SemanticTone): "var(--chart-1)" | "var(--chart-2)" | "var(--chart-3)" | "var(--chart-4)" | "var(--chart-5)" | "var(--chart-6)" | "var(--success)" | "var(--warning)" | "var(--error)" | "var(--info)" | "var(--neutral)";
14
+ declare const THEMES: {
15
+ readonly light: "";
16
+ readonly dark: ".dark";
17
+ };
18
+ type TooltipNameType = number | string;
19
+ export type ChartConfig = Record<string, {
20
+ label?: React.ReactNode;
21
+ icon?: React.ComponentType;
22
+ } & ({
23
+ color?: string;
24
+ theme?: never;
25
+ } | {
26
+ color?: never;
27
+ theme: Record<keyof typeof THEMES, string>;
28
+ })>;
29
+ declare function ChartContainer({ id, className, children, config, initialDimension, ...props }: React.ComponentProps<'div'> & {
30
+ config: ChartConfig;
31
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
32
+ initialDimension?: {
33
+ width: number;
34
+ height: number;
35
+ };
36
+ }): React.JSX.Element;
37
+ declare const ChartStyle: ({ id, config }: {
38
+ id: string;
39
+ config: ChartConfig;
40
+ }) => React.JSX.Element | null;
41
+ declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
42
+ declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<'div'> & {
43
+ hideLabel?: boolean;
44
+ hideIndicator?: boolean;
45
+ indicator?: 'line' | 'dot' | 'dashed';
46
+ nameKey?: string;
47
+ labelKey?: string;
48
+ } & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>): React.JSX.Element | null;
49
+ declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
50
+ declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<'div'> & {
51
+ hideIcon?: boolean;
52
+ nameKey?: string;
53
+ } & RechartsPrimitive.DefaultLegendContentProps): React.JSX.Element | null;
12
54
  declare function ChartCard({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
13
55
  declare function ChartCardHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
14
56
  declare function ChartCardTitle({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
15
57
  declare function ChartCardDescription({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
16
58
  declare function ChartCardActions({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
17
59
  declare function ChartCardFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
18
- export interface ChartSeries {
19
- label: string;
20
- values: number[];
21
- tone?: SemanticTone;
22
- }
23
- interface AxisChartProps extends Omit<React.ComponentProps<'div'>, 'children'> {
24
- series: ChartSeries[];
25
- labels: string[];
26
- height?: number;
27
- gridLines?: number;
28
- formatValue?: (value: number) => string;
29
- }
30
- declare function LineChart({ series, labels, height, gridLines, formatValue, area, curve, dots, stacked, stackOffset, fill, yAxis, hover, className, ...props }: AxisChartProps & {
31
- area?: boolean;
32
- curve?: 'monotone' | 'linear' | 'step';
33
- dots?: boolean;
34
- /** Stack the series so the top line is the total. */
35
- stacked?: boolean;
36
- /** `expand` normalises each x to 100% — shadcn's `stackOffset="expand"`. Only
37
- * meaningful with `stacked`, since it is a share of the stack. */
38
- stackOffset?: 'none' | 'expand';
39
- /** `gradient`, ramping 0.8 → 0.1, is the default: an area chart is about the
40
- * shape under the line, and a flat block of colour flattens exactly that.
41
- * `flat` is shadcn's `fillOpacity={0.4}`, kept for a single-colour export
42
- * where a gradient would band. */
43
- fill?: 'gradient' | 'flat';
44
- /** Y tick LABELS. ON by default: these charts are read for MAGNITUDE, and a
45
- * tooltip only answers for the point under the pointer, so a chart someone
46
- * has to quote a number from needs the scale on the page. Not strict —
47
- * `yAxis={false}` gives shadcn's axis-less look and reclaims the gutter. */
48
- yAxis?: boolean;
49
- /** Hover bands + tooltip. On by default — see the note above HoverCard. */
50
- hover?: boolean;
51
- }): React.JSX.Element;
52
- declare function AreaChart(props: React.ComponentProps<typeof LineChart>): React.JSX.Element;
53
- declare function BarChart({ series, labels, height, gridLines, stacked, horizontal, radius, yAxis, hover, formatValue, className, ...props }: AxisChartProps & {
54
- stacked?: boolean;
55
- horizontal?: boolean;
56
- radius?: number;
57
- /** Y tick labels, on by default — see LineChart's note. Grid is unaffected. */
58
- yAxis?: boolean;
59
- hover?: boolean;
60
- }): React.JSX.Element;
61
- export interface PieSlice {
62
- label: string;
63
- value: number;
64
- tone?: SemanticTone;
65
- }
66
- declare function PieChart({ slices, size,
67
- /** 0 renders a solid pie; any thickness renders a donut. */
68
- thickness, centerLabel, centerValue, hover, formatValue, className, ...props }: Omit<React.ComponentProps<'div'>, 'children'> & {
69
- slices: PieSlice[];
70
- size?: number;
71
- thickness?: number;
72
- centerLabel?: React.ReactNode;
73
- centerValue?: React.ReactNode;
74
- hover?: boolean;
75
- formatValue?: (v: number) => string;
76
- }): React.JSX.Element;
77
- /** Donut is a pie with a hole — same arithmetic, one default changed. */
78
- declare function DonutChart({ thickness, ...props }: React.ComponentProps<typeof PieChart>): React.JSX.Element;
79
- declare function RadialChart({ series, size, thickness, gap, max, hover, centerLabel, centerValue, formatValue, className, ...props }: Omit<React.ComponentProps<'div'>, 'children'> & {
80
- series: {
81
- label: string;
82
- value: number;
83
- tone?: SemanticTone;
84
- }[];
85
- size?: number;
86
- thickness?: number;
87
- gap?: number;
88
- max?: number;
89
- centerLabel?: React.ReactNode;
90
- centerValue?: React.ReactNode;
91
- hover?: boolean;
92
- formatValue?: (value: number) => string;
93
- }): React.JSX.Element;
94
- declare function RadarChart({ axes, series, size, rings, hover, className, ...props }: Omit<React.ComponentProps<'div'>, 'children'> & {
95
- axes: string[];
96
- series: {
97
- label: string;
98
- values: number[];
99
- tone?: SemanticTone;
100
- }[];
101
- size?: number;
102
- rings?: number;
103
- hover?: boolean;
104
- }): React.JSX.Element;
105
60
  declare function Sparkline({ values, width, height, tone, className, ...props }: Omit<React.ComponentProps<'div'>, 'children'> & {
106
61
  values: number[];
107
62
  width?: number;
@@ -115,10 +70,6 @@ declare function ProgressRing({ value, size, thickness, tone, showValue, classNa
115
70
  tone?: SemanticTone;
116
71
  showValue?: boolean;
117
72
  }): React.JSX.Element;
118
- declare function ChartLegend({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
119
- declare function ChartLegendItem({ className, index, tone, children, ...props }: React.ComponentProps<'span'> & {
120
- index?: number;
121
- tone?: SemanticTone;
122
- }): React.JSX.Element;
123
- declare function ChartTooltip({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
124
- export { ChartCard, ChartCardHeader, ChartCardTitle, ChartCardDescription, ChartCardActions, ChartCardFooter, LineChart, AreaChart, BarChart, PieChart, DonutChart, RadialChart, RadarChart, Sparkline, ProgressRing, ChartLegend, ChartLegendItem, ChartTooltip, CHART_SERIES, seriesColor, type SemanticTone, };
73
+ export { Label as ChartLabel } from 'recharts';
74
+ export { Area, AreaChart, Bar, BarChart, Brush, CartesianGrid, Cell, ComposedChart, Customized, ErrorBar, Funnel, FunnelChart, LabelList, Line, LineChart, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart, RadialBar, RadialBarChart, Rectangle, ReferenceArea, ReferenceDot, ReferenceLine, ResponsiveContainer, Scatter, ScatterChart, Sector, Treemap, XAxis, YAxis, ZAxis, } from 'recharts';
75
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, ChartCard, ChartCardHeader, ChartCardTitle, ChartCardDescription, ChartCardActions, ChartCardFooter, Sparkline, ProgressRing, CHART_SERIES, seriesColor, type SemanticTone, };
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { Collapsible as CollapsiblePrimitive } from 'radix-ui';
3
+ declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): React.JSX.Element;
4
+ declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Trigger>): React.JSX.Element;
5
+ declare function CollapsibleContent({ className, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Content>): React.JSX.Element;
6
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent };
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ export interface ComboboxOption {
3
+ value: string;
4
+ label: string;
5
+ /** Extra searchable text — a code, an alias — that is not shown. */
6
+ keywords?: string;
7
+ disabled?: boolean;
8
+ }
9
+ declare const Combobox: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "onChange" | "value"> & {
10
+ options: ComboboxOption[];
11
+ value?: string;
12
+ onValueChange?: (value: string) => void;
13
+ placeholder?: string;
14
+ searchPlaceholder?: string;
15
+ emptyLabel?: string;
16
+ /** Matches Select's trigger sizes. */
17
+ size?: "sm" | "default";
18
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
19
+ export { Combobox };
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { Command as CommandPrimitive } from 'cmdk';
3
+ import { Dialog } from './dialog';
4
+ declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
5
+ declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
6
+ title?: string;
7
+ description?: string;
8
+ className?: string;
9
+ showCloseButton?: boolean;
10
+ }): React.JSX.Element;
11
+ declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
12
+ declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
13
+ declare function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
14
+ declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
15
+ declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
16
+ declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
17
+ declare function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
18
+ export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };