@rise-x/apps-sdk 0.8.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +209 -21
- package/build/rsbuild/index.d.ts +36 -0
- package/build/rsbuild/index.js +225 -0
- package/build/ui/classes.json +209 -0
- package/build/ui/components/ai.d.ts +33 -1
- package/build/ui/components/app-frame.d.ts +19 -0
- package/build/ui/components/chat-input.d.ts +28 -0
- package/build/ui/components/message-scroller.d.ts +34 -10
- package/build/ui/components/nav.d.ts +2 -1
- package/build/ui/components/sheet.d.ts +10 -0
- package/build/ui/components/thinking-rings.d.ts +4 -0
- package/build/ui/demo.html +26794 -0
- package/build/ui/index.d.ts +3 -0
- package/build/ui/standalone.js +59 -58
- package/build/ui/styles.css +1 -1
- package/package.json +24 -3
- package/rsbuild/package.json +8 -0
- package/template/AGENTS.md +18 -10
- package/template/README.md +5 -5
- package/template/package.json +8 -9
- package/template/rsbuild.config.mts +17 -0
- package/template/src/App.tsx +21 -11
- package/template/tsconfig.json +3 -1
- package/build/ui/reference/README.md +0 -11
- package/build/ui/reference/components/accordion.tsx +0 -85
- package/build/ui/reference/components/ai.tsx +0 -291
- package/build/ui/reference/components/alert-dialog.tsx +0 -213
- package/build/ui/reference/components/alert.tsx +0 -112
- package/build/ui/reference/components/aspect-ratio.tsx +0 -28
- package/build/ui/reference/components/avatar.tsx +0 -158
- package/build/ui/reference/components/badge.tsx +0 -160
- package/build/ui/reference/components/button-group.tsx +0 -77
- package/build/ui/reference/components/button.tsx +0 -107
- package/build/ui/reference/components/calendar.tsx +0 -119
- package/build/ui/reference/components/card.tsx +0 -144
- package/build/ui/reference/components/carousel.tsx +0 -248
- package/build/ui/reference/components/chart.tsx +0 -704
- package/build/ui/reference/components/checkbox.tsx +0 -44
- package/build/ui/reference/components/collapsible.tsx +0 -43
- package/build/ui/reference/components/combobox.tsx +0 -141
- package/build/ui/reference/components/command.tsx +0 -181
- package/build/ui/reference/components/context-menu.tsx +0 -243
- package/build/ui/reference/components/data-table.tsx +0 -650
- package/build/ui/reference/components/date-picker.tsx +0 -218
- package/build/ui/reference/components/dialog.tsx +0 -172
- package/build/ui/reference/components/direction.tsx +0 -22
- package/build/ui/reference/components/dropdown-menu.tsx +0 -245
- package/build/ui/reference/components/empty-state.tsx +0 -63
- package/build/ui/reference/components/field.tsx +0 -252
- package/build/ui/reference/components/file-upload.tsx +0 -116
- package/build/ui/reference/components/hover-card.tsx +0 -64
- package/build/ui/reference/components/input-group.tsx +0 -157
- package/build/ui/reference/components/input-otp.tsx +0 -106
- package/build/ui/reference/components/input.tsx +0 -86
- package/build/ui/reference/components/item.tsx +0 -188
- package/build/ui/reference/components/kbd.tsx +0 -43
- package/build/ui/reference/components/label.tsx +0 -19
- package/build/ui/reference/components/list.tsx +0 -191
- package/build/ui/reference/components/map.css +0 -251
- package/build/ui/reference/components/map.tsx +0 -294
- package/build/ui/reference/components/menubar.tsx +0 -275
- package/build/ui/reference/components/message-scroller.tsx +0 -141
- package/build/ui/reference/components/message.tsx +0 -171
- package/build/ui/reference/components/nav.tsx +0 -122
- package/build/ui/reference/components/navigation-menu.tsx +0 -191
- package/build/ui/reference/components/page-header.tsx +0 -245
- package/build/ui/reference/components/popover.tsx +0 -76
- package/build/ui/reference/components/progress.tsx +0 -31
- package/build/ui/reference/components/radio.tsx +0 -65
- package/build/ui/reference/components/resizable.tsx +0 -40
- package/build/ui/reference/components/scroll-area.tsx +0 -55
- package/build/ui/reference/components/segmented.tsx +0 -45
- package/build/ui/reference/components/select.tsx +0 -188
- package/build/ui/reference/components/separator.tsx +0 -26
- package/build/ui/reference/components/sheet.tsx +0 -184
- package/build/ui/reference/components/skeleton.tsx +0 -15
- package/build/ui/reference/components/slider.tsx +0 -161
- package/build/ui/reference/components/snackbar.tsx +0 -27
- package/build/ui/reference/components/sonner.tsx +0 -43
- package/build/ui/reference/components/spinner.tsx +0 -27
- package/build/ui/reference/components/statistic.tsx +0 -122
- package/build/ui/reference/components/stepper.tsx +0 -138
- package/build/ui/reference/components/switch.tsx +0 -47
- package/build/ui/reference/components/table.tsx +0 -246
- package/build/ui/reference/components/textarea.tsx +0 -28
- package/build/ui/reference/components/timeline.tsx +0 -101
- package/build/ui/reference/components/toggle-group.tsx +0 -86
- package/build/ui/reference/components/toggle.tsx +0 -46
- package/build/ui/reference/components/tooltip.tsx +0 -53
- package/build/ui/reference/index.ts +0 -68
- package/build/ui/reference/lib/utils.ts +0 -34
- package/template/webpack.config.js +0 -112
- package/template/webpack.local.config.js +0 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rise-x/apps-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "SDK for building federated apps on top of the Rise-X Diana shell. Includes a CLI for scaffolding new apps.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rise-X",
|
|
@@ -43,13 +43,19 @@
|
|
|
43
43
|
"default": "./build/ui/index.js"
|
|
44
44
|
},
|
|
45
45
|
"./ui/standalone": "./build/ui/standalone.js",
|
|
46
|
-
"./ui/standalone-stub": "./build/ui/standalone-stub.js"
|
|
46
|
+
"./ui/standalone-stub": "./build/ui/standalone-stub.js",
|
|
47
|
+
"./rsbuild": {
|
|
48
|
+
"types": "./build/rsbuild/index.d.ts",
|
|
49
|
+
"default": "./build/rsbuild/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./package.json": "./package.json"
|
|
47
52
|
},
|
|
48
53
|
"files": [
|
|
49
54
|
"build",
|
|
50
55
|
"shell",
|
|
51
56
|
"connectors",
|
|
52
57
|
"query",
|
|
58
|
+
"rsbuild",
|
|
53
59
|
"template",
|
|
54
60
|
"ui"
|
|
55
61
|
],
|
|
@@ -59,18 +65,30 @@
|
|
|
59
65
|
"scripts": {
|
|
60
66
|
"clean": "shx rm -rf build",
|
|
61
67
|
"test": "jest",
|
|
62
|
-
"build:package": "pnpm clean && tsc -p tsconfig.package.json && tsc -p tsconfig.ui.json && node scripts/build-ui.js && shx chmod +x build/cli/index.js",
|
|
68
|
+
"build:package": "pnpm clean && tsc -p tsconfig.package.json && tsc -p tsconfig.ui.json && node scripts/build-ui.js && node scripts/build-classes.js && node scripts/prerender-demo.js && shx chmod +x build/cli/index.js",
|
|
63
69
|
"build": "pnpm build:package",
|
|
64
70
|
"start:package": "tsc-watch -p ./tsconfig.package.json",
|
|
65
71
|
"prepack": "pnpm --filter @rise-x/ui build && pnpm build:package"
|
|
66
72
|
},
|
|
67
73
|
"peerDependencies": {
|
|
74
|
+
"@rsbuild/core": "^1.7.6",
|
|
75
|
+
"@rsbuild/plugin-react": "^1.4.6",
|
|
76
|
+
"@rsbuild/plugin-type-check": "^1.3.6",
|
|
68
77
|
"@tanstack/react-query": "^5.0.0",
|
|
69
78
|
"axios": "^1.0.0",
|
|
70
79
|
"react": "^18.0.0 || ^19.0.0",
|
|
71
80
|
"react-router-dom": "^6.0.0"
|
|
72
81
|
},
|
|
73
82
|
"peerDependenciesMeta": {
|
|
83
|
+
"@rsbuild/core": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@rsbuild/plugin-react": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@rsbuild/plugin-type-check": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
74
92
|
"@tanstack/react-query": {
|
|
75
93
|
"optional": true
|
|
76
94
|
},
|
|
@@ -96,6 +114,9 @@
|
|
|
96
114
|
},
|
|
97
115
|
"devDependencies": {
|
|
98
116
|
"@fontsource-variable/inter": "^5.3.0",
|
|
117
|
+
"@rsbuild/core": "^1.7.6",
|
|
118
|
+
"@rsbuild/plugin-react": "^1.4.6",
|
|
119
|
+
"@rsbuild/plugin-type-check": "^1.3.6",
|
|
99
120
|
"@tanstack/react-query": "^5.59.20",
|
|
100
121
|
"@testing-library/dom": "^10.4.0",
|
|
101
122
|
"@testing-library/react": "^16.1.0",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rise-x/apps-sdk/rsbuild",
|
|
3
|
+
"description": "Legacy-resolution stub for the rsbuild subpath. See parent package.json `exports` for the canonical wiring.",
|
|
4
|
+
"main": "../build/rsbuild/index.js",
|
|
5
|
+
"module": "../build/rsbuild/index.js",
|
|
6
|
+
"types": "../build/rsbuild/index.d.ts",
|
|
7
|
+
"private": true
|
|
8
|
+
}
|
package/template/AGENTS.md
CHANGED
|
@@ -20,7 +20,7 @@ Rise-X host (the Diana app):
|
|
|
20
20
|
(`onInstall` / `onUpdate` / `onUninstall`) best-effort.
|
|
21
21
|
- `react`, `react-dom`, and the `@rise-x/ui` design-system runtime come
|
|
22
22
|
**from the host** via the MF share scope. Never bundle your own copies —
|
|
23
|
-
the `shared` block
|
|
23
|
+
the `shared` block the preset builds is load-bearing; don't override the
|
|
24
24
|
react-family or `@rise-x/ui` entries.
|
|
25
25
|
- **The host's React wins at runtime, and hosts run React 18 or 19**
|
|
26
26
|
depending on their generation — the same bundle must work on both. Author
|
|
@@ -30,24 +30,32 @@ Rise-X host (the Diana app):
|
|
|
30
30
|
- In a pnpm-workspace checkout, icon/UI deps (lucide-react, radix-ui, sonner)
|
|
31
31
|
may nest their own `react@19` / `@types/react@19` copies alongside the
|
|
32
32
|
workspace's hoisted `react@18`. The scaffold pins both to the app's own
|
|
33
|
-
copy — `tsconfig.json`'s `paths` for types,
|
|
33
|
+
copy — `tsconfig.json`'s `paths` for types, the preset's standalone
|
|
34
34
|
`resolve.alias` for the runtime — don't remove those pins.
|
|
35
35
|
- All platform access goes through `@rise-x/apps-sdk`: shell hooks/accessors,
|
|
36
36
|
typed connectors (`@rise-x/apps-sdk/connectors`), cached react-query hooks
|
|
37
37
|
(`@rise-x/apps-sdk/query`). Never instantiate your own axios, wire your own
|
|
38
38
|
auth, or call backend services directly.
|
|
39
39
|
- UI is built exclusively from `@rise-x/apps-sdk/ui` (the Rise-X design
|
|
40
|
-
system).
|
|
41
|
-
directly on the page background — never inside a
|
|
42
|
-
the host renders its own above the app
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
system). The root layout is the `AppFrame` primitives: `AppRail` (fixed
|
|
41
|
+
left rail of `Nav` items, directly on the page background — never inside a
|
|
42
|
+
Card, never a top bar; the host renders its own above the app) beside
|
|
43
|
+
`AppContent` (the app's ONE scroll container — it slides under the host's
|
|
44
|
+
floating top bar by padding with the host-published `--topbar-h` CSS
|
|
45
|
+
variable; never hardcode a bar height or add another page scroller).
|
|
46
|
+
Rendering an `AppFrame` is also the signal that the app owns its layout —
|
|
47
|
+
the next-gen shell detects it and hands over the full-bleed region
|
|
48
|
+
(apps without one get a host-padded scroller instead), so keep it at the
|
|
49
|
+
app root, always mounted.
|
|
50
|
+
**No user/account UI in the app** (no avatar, name, or sign-out) — the
|
|
51
|
+
host top bar owns identity. On mobile widths a bottom tab bar is the
|
|
52
|
+
native pattern (see `APP.md` for this app's mobile UX level). This app
|
|
53
|
+
scaffolded from the canonical layout — it lives in `src/App.tsx`; preserve
|
|
54
|
+
its chrome composition as you build.
|
|
47
55
|
|
|
48
56
|
## Stack
|
|
49
57
|
|
|
50
|
-
- TypeScript + React (host-provided at runtime),
|
|
58
|
+
- TypeScript + React (host-provided at runtime), Rspack Module Federation
|
|
51
59
|
- `@rise-x/apps-sdk` — shell bridge, connectors, query layer, design system
|
|
52
60
|
- `@tanstack/react-query` v5 — shared singleton with the host
|
|
53
61
|
|
package/template/README.md
CHANGED
|
@@ -22,10 +22,10 @@ Rise-X federated app scaffolded from `@rise-x/apps-sdk`.
|
|
|
22
22
|
## Run standalone
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
pnpm start # standalone dev server on port __APP_PORT__
|
|
25
|
+
pnpm start # standalone dev server on port __APP_PORT__ — open it yourself
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Uses `
|
|
28
|
+
Uses the preset's standalone branch (`rsbuild dev --env-mode standalone`): bundles React directly (no Module Federation) and installs `createMockShell()` via `src/bootstrap.tsx` so shell hooks resolve against the mock. The design system renders for real here too — `@rise-x/ui` is aliased to the SDK's compiled standalone bundle (self-contained, CSS injected); `getShellApi` / `getShellApiV4` still throw with no host behind them — run `pnpm start:federated` alongside a host for backend access.
|
|
29
29
|
|
|
30
30
|
## Build for the shell
|
|
31
31
|
|
|
@@ -57,7 +57,7 @@ import { useFlows, useWorkRows, useSubmitWork } from '@rise-x/apps-sdk/query';
|
|
|
57
57
|
|
|
58
58
|
The query hooks need **no provider**: inside the shell they use the per-app
|
|
59
59
|
`QueryClient` the shell mounts around this app; standalone they fall back to
|
|
60
|
-
the SDK's own client.
|
|
60
|
+
the SDK's own client. The `@tanstack/react-query` share lives in the SDK's
|
|
61
61
|
`shared` block (already configured) so the shell-managed client can reach the
|
|
62
62
|
app.
|
|
63
63
|
|
|
@@ -75,8 +75,8 @@ import { Button, Input, Dialog, cn } from '@rise-x/apps-sdk/ui';
|
|
|
75
75
|
|
|
76
76
|
The Rise-X design system. Typings come from the SDK. Federated, the runtime
|
|
77
77
|
is the host's copy, delivered via the Module Federation share scope
|
|
78
|
-
(`@rise-x/ui`
|
|
79
|
-
host provides it. Standalone (`pnpm start`),
|
|
78
|
+
(`@rise-x/ui` is shared by the preset, already wired) — the Diana
|
|
79
|
+
host provides it. Standalone (`pnpm start`), the preset
|
|
80
80
|
aliases `@rise-x/ui` to the SDK's compiled bundle instead — a self-contained
|
|
81
81
|
snapshot with its own CSS injected, so components render for real without a
|
|
82
82
|
host. It's a snapshot, not the source of truth: verify in a host (or
|
package/template/package.json
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
7
|
-
"start": "
|
|
8
|
-
"start:federated": "
|
|
6
|
+
"build": "rsbuild build",
|
|
7
|
+
"start": "rsbuild dev --env-mode standalone",
|
|
8
|
+
"start:federated": "rsbuild dev",
|
|
9
|
+
"typecheck": "tsc --noEmit"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
11
12
|
"@rise-x/apps-sdk": "__SDK_VERSION__",
|
|
@@ -15,17 +16,15 @@
|
|
|
15
16
|
"devDependencies": {
|
|
16
17
|
"@commitlint/cli": "^21.2.1",
|
|
17
18
|
"@commitlint/config-conventional": "^21.2.0",
|
|
19
|
+
"@rsbuild/core": "^1.7.6",
|
|
20
|
+
"@rsbuild/plugin-react": "^1.4.6",
|
|
21
|
+
"@rsbuild/plugin-type-check": "^1.3.6",
|
|
18
22
|
"@types/react": "^18.2.0",
|
|
19
23
|
"@types/react-dom": "^18.2.0",
|
|
20
24
|
"axios": "^1.7.7",
|
|
21
|
-
"html-webpack-plugin": "^5.5.3",
|
|
22
25
|
"react": "^18.2.0",
|
|
23
26
|
"react-dom": "^18.2.0",
|
|
24
27
|
"react-router-dom": "^6.19.0",
|
|
25
|
-
"
|
|
26
|
-
"typescript": "^5.3.0",
|
|
27
|
-
"webpack": "^5.90.0",
|
|
28
|
-
"webpack-cli": "^5.1.4",
|
|
29
|
-
"webpack-dev-server": "^4.15.1"
|
|
28
|
+
"typescript": "^5.3.0"
|
|
30
29
|
}
|
|
31
30
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from '@rsbuild/core';
|
|
2
|
+
import { defineAppConfig } from '@rise-x/apps-sdk/rsbuild';
|
|
3
|
+
import pkg from './package.json';
|
|
4
|
+
|
|
5
|
+
// The Module Federation contract with the shell lives in the preset, not here —
|
|
6
|
+
// you upgrade it by upgrading the SDK.
|
|
7
|
+
//
|
|
8
|
+
// pnpm build federated bundle for the shell -> dist/
|
|
9
|
+
// pnpm start:federated same, served for a host to load
|
|
10
|
+
// pnpm start standalone dev, no shell -> dist-local/
|
|
11
|
+
//
|
|
12
|
+
// `--env-mode local` is rejected by Rsbuild; standalone uses `standalone`.
|
|
13
|
+
// .mts, not .ts: it marks the file ESM, which a plain .ts warns about on every
|
|
14
|
+
// build. Do not use "type": "module" instead — it breaks commitlint.config.js.
|
|
15
|
+
export default defineConfig(({ envMode }) =>
|
|
16
|
+
defineAppConfig({ pkg, port: __APP_PORT__, standalone: envMode === 'standalone' }),
|
|
17
|
+
);
|
package/template/src/App.tsx
CHANGED
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
} from "lucide-react";
|
|
11
11
|
import { AppQueryProvider } from "@rise-x/apps-sdk/query";
|
|
12
12
|
import {
|
|
13
|
+
AppContent,
|
|
14
|
+
AppFrame,
|
|
15
|
+
AppRail,
|
|
13
16
|
Badge,
|
|
14
17
|
Button,
|
|
15
18
|
Nav,
|
|
@@ -28,7 +31,14 @@ import {
|
|
|
28
31
|
* · The HOST renders the top bar above the app (navigation, user menu,
|
|
29
32
|
* ecosystem switcher). Never render a top bar and NEVER any user/account
|
|
30
33
|
* UI in the app — no avatar, no user name, no sign-out.
|
|
31
|
-
* ·
|
|
34
|
+
* · The AppFrame primitives ARE the layout contract: AppRail stays fixed on
|
|
35
|
+
* the left while AppContent owns the scroll and slides under the host's
|
|
36
|
+
* floating top bar (they pad by the host-published --topbar-h variable —
|
|
37
|
+
* never hardcode a bar height, and never add another page scroller).
|
|
38
|
+
* · mobileNav="tabs" turns the rail into a bottom tab bar once the frame is
|
|
39
|
+
* narrow — the native phone pattern. Past five destinations it keeps four
|
|
40
|
+
* and folds the rest behind More on its own. Never hand-roll a tab bar.
|
|
41
|
+
* · App navigation is the LEFT RAIL (AppRail + Nav primitives), sitting
|
|
32
42
|
* directly on the page background — never wrapped in a Card or Panel.
|
|
33
43
|
* Cards are for content, not chrome.
|
|
34
44
|
* · No app logo or name in the rail — the host already identifies the app;
|
|
@@ -68,13 +78,13 @@ function Shell() {
|
|
|
68
78
|
const current = SCREENS.find((s) => s.id === screen) ?? SCREENS[0];
|
|
69
79
|
|
|
70
80
|
return (
|
|
71
|
-
// The host paints the page background and
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
<
|
|
81
|
+
// The host paints the page background and hands the app a full-height
|
|
82
|
+
// region. NOTE: the host ships only the utility classes used inside the
|
|
83
|
+
// design system itself; app-specific values go in inline styles or your
|
|
84
|
+
// own CSS — the AppFrame primitives carry their own classes.
|
|
85
|
+
<AppFrame mobileNav="tabs">
|
|
76
86
|
{/* Left rail: a borderless list on the page background — NOT a Card. */}
|
|
77
|
-
<
|
|
87
|
+
<AppRail>
|
|
78
88
|
<Nav>
|
|
79
89
|
<NavItem
|
|
80
90
|
current={screen === "home"}
|
|
@@ -115,9 +125,9 @@ function Shell() {
|
|
|
115
125
|
</NavItem>
|
|
116
126
|
</Nav>
|
|
117
127
|
{/* Nothing below the nav — the host top bar owns user identity. */}
|
|
118
|
-
</
|
|
128
|
+
</AppRail>
|
|
119
129
|
|
|
120
|
-
<
|
|
130
|
+
<AppContent>
|
|
121
131
|
<PageHeader variant="bare">
|
|
122
132
|
<PageHeaderRow>
|
|
123
133
|
<div>
|
|
@@ -174,7 +184,7 @@ function Shell() {
|
|
|
174
184
|
stubs with your app.
|
|
175
185
|
</div>
|
|
176
186
|
</div>
|
|
177
|
-
</
|
|
178
|
-
</
|
|
187
|
+
</AppContent>
|
|
188
|
+
</AppFrame>
|
|
179
189
|
);
|
|
180
190
|
}
|
package/template/tsconfig.json
CHANGED
|
@@ -27,5 +27,7 @@
|
|
|
27
27
|
"react-dom": ["./node_modules/@types/react-dom", "../../node_modules/@types/react-dom"]
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
// rsbuild.config.mts is included so `pnpm typecheck` covers it — a wrong
|
|
31
|
+
// defineAppConfig option would otherwise only surface on a real build.
|
|
32
|
+
"include": ["src", "rsbuild.config.mts"]
|
|
31
33
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Reference only — NOT runtime code.
|
|
2
|
-
|
|
3
|
-
These are the @rise-x/ui design-system sources, shipped so agents and tools
|
|
4
|
-
can read component APIs, variants, and markup/class strings — e.g. to build
|
|
5
|
-
static single-file HTML design mocks: inline ../styles.css (the compiled
|
|
6
|
-
design-system stylesheet, Inter font embedded) and reuse the markup from
|
|
7
|
-
these sources. The canonical app layout (left-rail chrome, screen
|
|
8
|
-
composition) lives in the scaffold template: <package>/template/src/App.tsx.
|
|
9
|
-
|
|
10
|
-
At runtime the components come from the HOST's Module Federation share scope
|
|
11
|
-
via @rise-x/apps-sdk/ui — never import these files from app code.
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Accordion as AccordionPrimitive } from 'radix-ui';
|
|
5
|
-
import { ChevronDownIcon } from 'lucide-react';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Progressive disclosure for a list of sections. The trigger is the whole row —
|
|
11
|
-
* a chevron you have to hit is a target the size of a full stop.
|
|
12
|
-
*
|
|
13
|
-
* THE CONTAINER OWNS THE DIVIDERS, drawn between items rather than as a border
|
|
14
|
-
* on every row: a top-and-bottom border doubles up at every seam. Same rule as
|
|
15
|
-
* List, and the same reason.
|
|
16
|
-
*
|
|
17
|
-
* NO SURFACE OF ITS OWN by default. An accordion inside a card is already on a
|
|
18
|
-
* surface, and wrapping each item in another one produces a box in a box. Pass
|
|
19
|
-
* `bordered` for the standalone case where the group needs to read as one object.
|
|
20
|
-
*/
|
|
21
|
-
function Accordion({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
22
|
-
return <AccordionPrimitive.Root data-slot="accordion" className={cn(className)} {...props} />;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function AccordionItem({
|
|
26
|
-
className,
|
|
27
|
-
...props
|
|
28
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
29
|
-
return (
|
|
30
|
-
<AccordionPrimitive.Item
|
|
31
|
-
data-slot="accordion-item"
|
|
32
|
-
className={cn('border-t border-border-subtle first:border-t-0', className)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function AccordionTrigger({
|
|
39
|
-
className,
|
|
40
|
-
children,
|
|
41
|
-
...props
|
|
42
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
43
|
-
return (
|
|
44
|
-
<AccordionPrimitive.Header className="flex">
|
|
45
|
-
<AccordionPrimitive.Trigger
|
|
46
|
-
data-slot="accordion-trigger"
|
|
47
|
-
className={cn(
|
|
48
|
-
'flex flex-1 cursor-pointer items-center gap-2.5 border-0 bg-transparent py-3 text-left text-ui font-medium outline-none transition-colors duration-150 ease-decelerate',
|
|
49
|
-
'hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring-control/35',
|
|
50
|
-
// the chevron turns rather than swapping glyph: one mark, one meaning
|
|
51
|
-
'[&>svg]:size-3.5 [&>svg]:shrink-0 [&>svg]:text-muted-foreground [&>svg]:transition-transform [&>svg]:duration-200 [&>svg]:ease-decelerate',
|
|
52
|
-
'data-open:[&>svg]:rotate-180',
|
|
53
|
-
className,
|
|
54
|
-
)}
|
|
55
|
-
{...props}
|
|
56
|
-
>
|
|
57
|
-
<span className="min-w-0 flex-1">{children}</span>
|
|
58
|
-
<ChevronDownIcon aria-hidden />
|
|
59
|
-
</AccordionPrimitive.Trigger>
|
|
60
|
-
</AccordionPrimitive.Header>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function AccordionContent({
|
|
65
|
-
className,
|
|
66
|
-
children,
|
|
67
|
-
...props
|
|
68
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
69
|
-
return (
|
|
70
|
-
<AccordionPrimitive.Content
|
|
71
|
-
data-slot="accordion-content"
|
|
72
|
-
className={cn(
|
|
73
|
-
'overflow-hidden text-xs text-muted-foreground',
|
|
74
|
-
'data-open:animate-accordion-down data-closed:animate-accordion-up',
|
|
75
|
-
)}
|
|
76
|
-
{...props}
|
|
77
|
-
>
|
|
78
|
-
{/* padding on an inner element, not the animated one — animating a box
|
|
79
|
-
whose own padding is part of the measured height stutters at both ends */}
|
|
80
|
-
<div className={cn('pb-3', className)}>{children}</div>
|
|
81
|
-
</AccordionPrimitive.Content>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|