@rise-x/apps-sdk 0.8.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +209 -21
  2. package/build/rsbuild/index.d.ts +36 -0
  3. package/build/rsbuild/index.js +225 -0
  4. package/build/ui/classes.json +209 -0
  5. package/build/ui/components/ai.d.ts +33 -1
  6. package/build/ui/components/app-frame.d.ts +19 -0
  7. package/build/ui/components/chat-input.d.ts +28 -0
  8. package/build/ui/components/message-scroller.d.ts +34 -10
  9. package/build/ui/components/nav.d.ts +2 -1
  10. package/build/ui/components/sheet.d.ts +10 -0
  11. package/build/ui/components/thinking-rings.d.ts +4 -0
  12. package/build/ui/demo.html +26794 -0
  13. package/build/ui/index.d.ts +3 -0
  14. package/build/ui/standalone.js +59 -58
  15. package/build/ui/styles.css +1 -1
  16. package/package.json +24 -3
  17. package/rsbuild/package.json +8 -0
  18. package/template/AGENTS.md +18 -10
  19. package/template/README.md +5 -5
  20. package/template/package.json +8 -9
  21. package/template/rsbuild.config.mts +17 -0
  22. package/template/src/App.tsx +21 -11
  23. package/template/tsconfig.json +3 -1
  24. package/build/ui/reference/README.md +0 -11
  25. package/build/ui/reference/components/accordion.tsx +0 -85
  26. package/build/ui/reference/components/ai.tsx +0 -291
  27. package/build/ui/reference/components/alert-dialog.tsx +0 -213
  28. package/build/ui/reference/components/alert.tsx +0 -112
  29. package/build/ui/reference/components/aspect-ratio.tsx +0 -28
  30. package/build/ui/reference/components/avatar.tsx +0 -158
  31. package/build/ui/reference/components/badge.tsx +0 -160
  32. package/build/ui/reference/components/button-group.tsx +0 -77
  33. package/build/ui/reference/components/button.tsx +0 -107
  34. package/build/ui/reference/components/calendar.tsx +0 -119
  35. package/build/ui/reference/components/card.tsx +0 -144
  36. package/build/ui/reference/components/carousel.tsx +0 -248
  37. package/build/ui/reference/components/chart.tsx +0 -704
  38. package/build/ui/reference/components/checkbox.tsx +0 -44
  39. package/build/ui/reference/components/collapsible.tsx +0 -43
  40. package/build/ui/reference/components/combobox.tsx +0 -141
  41. package/build/ui/reference/components/command.tsx +0 -181
  42. package/build/ui/reference/components/context-menu.tsx +0 -243
  43. package/build/ui/reference/components/data-table.tsx +0 -650
  44. package/build/ui/reference/components/date-picker.tsx +0 -218
  45. package/build/ui/reference/components/dialog.tsx +0 -172
  46. package/build/ui/reference/components/direction.tsx +0 -22
  47. package/build/ui/reference/components/dropdown-menu.tsx +0 -245
  48. package/build/ui/reference/components/empty-state.tsx +0 -63
  49. package/build/ui/reference/components/field.tsx +0 -252
  50. package/build/ui/reference/components/file-upload.tsx +0 -116
  51. package/build/ui/reference/components/hover-card.tsx +0 -64
  52. package/build/ui/reference/components/input-group.tsx +0 -157
  53. package/build/ui/reference/components/input-otp.tsx +0 -106
  54. package/build/ui/reference/components/input.tsx +0 -86
  55. package/build/ui/reference/components/item.tsx +0 -188
  56. package/build/ui/reference/components/kbd.tsx +0 -43
  57. package/build/ui/reference/components/label.tsx +0 -19
  58. package/build/ui/reference/components/list.tsx +0 -191
  59. package/build/ui/reference/components/map.css +0 -251
  60. package/build/ui/reference/components/map.tsx +0 -294
  61. package/build/ui/reference/components/menubar.tsx +0 -275
  62. package/build/ui/reference/components/message-scroller.tsx +0 -141
  63. package/build/ui/reference/components/message.tsx +0 -171
  64. package/build/ui/reference/components/nav.tsx +0 -122
  65. package/build/ui/reference/components/navigation-menu.tsx +0 -191
  66. package/build/ui/reference/components/page-header.tsx +0 -245
  67. package/build/ui/reference/components/popover.tsx +0 -76
  68. package/build/ui/reference/components/progress.tsx +0 -31
  69. package/build/ui/reference/components/radio.tsx +0 -65
  70. package/build/ui/reference/components/resizable.tsx +0 -40
  71. package/build/ui/reference/components/scroll-area.tsx +0 -55
  72. package/build/ui/reference/components/segmented.tsx +0 -45
  73. package/build/ui/reference/components/select.tsx +0 -188
  74. package/build/ui/reference/components/separator.tsx +0 -26
  75. package/build/ui/reference/components/sheet.tsx +0 -184
  76. package/build/ui/reference/components/skeleton.tsx +0 -15
  77. package/build/ui/reference/components/slider.tsx +0 -161
  78. package/build/ui/reference/components/snackbar.tsx +0 -27
  79. package/build/ui/reference/components/sonner.tsx +0 -43
  80. package/build/ui/reference/components/spinner.tsx +0 -27
  81. package/build/ui/reference/components/statistic.tsx +0 -122
  82. package/build/ui/reference/components/stepper.tsx +0 -138
  83. package/build/ui/reference/components/switch.tsx +0 -47
  84. package/build/ui/reference/components/table.tsx +0 -246
  85. package/build/ui/reference/components/textarea.tsx +0 -28
  86. package/build/ui/reference/components/timeline.tsx +0 -101
  87. package/build/ui/reference/components/toggle-group.tsx +0 -86
  88. package/build/ui/reference/components/toggle.tsx +0 -46
  89. package/build/ui/reference/components/tooltip.tsx +0 -53
  90. package/build/ui/reference/index.ts +0 -68
  91. package/build/ui/reference/lib/utils.ts +0 -34
  92. package/template/webpack.config.js +0 -112
  93. package/template/webpack.local.config.js +0 -68
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rise-x/apps-sdk",
3
- "version": "0.8.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
+ }
@@ -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 in `webpack.config.js` is load-bearing; don't touch the
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, `webpack.local.config.js`'s
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). App navigation is a left rail built from the `Nav` primitives,
41
- directly on the page background — never inside a Card, never a top bar;
42
- the host renders its own above the app. **No user/account UI in the app**
43
- (no avatar, name, or sign-out) — the host top bar owns identity. On mobile
44
- widths a bottom tab bar is the native pattern (see `APP.md` for this app's
45
- mobile UX level). This app scaffolded from the canonical layout — it lives
46
- in `src/App.tsx`; preserve its chrome composition as you build.
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), webpack 5 Module Federation
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
 
@@ -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 `webpack.local.config.js`: 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.
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. Keep `@tanstack/react-query` in `webpack.config.js`'s
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` in `webpack.config.js` `shared`, already wired) — the Diana
79
- host provides it. Standalone (`pnpm start`), `webpack.local.config.js`
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
@@ -3,9 +3,10 @@
3
3
  "private": true,
4
4
  "version": "0.1.0",
5
5
  "scripts": {
6
- "build": "webpack --mode=production",
7
- "start": "webpack serve --config webpack.local.config.js --mode=development",
8
- "start:federated": "webpack serve --mode=development"
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
- "ts-loader": "^9.5.1",
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
+ );
@@ -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
- * · App navigation is a LEFT RAIL built from the Nav primitives, sitting
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 owns page height — the app
72
- // fills its outlet. NOTE: the host ships only the utility classes used
73
- // inside the design system itself; app-specific values (like the rail
74
- // width below) go in inline styles or your own CSS.
75
- <div className="flex text-foreground">
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
- <aside className="flex shrink-0 flex-col p-3" style={{ width: 180 }}>
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
- </aside>
128
+ </AppRail>
119
129
 
120
- <main className="min-w-0 flex-1 p-6">
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
- </main>
178
- </div>
187
+ </AppContent>
188
+ </AppFrame>
179
189
  );
180
190
  }
@@ -27,5 +27,7 @@
27
27
  "react-dom": ["./node_modules/@types/react-dom", "../../node_modules/@types/react-dom"]
28
28
  }
29
29
  },
30
- "include": ["src"]
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 };