@nadicodeai/ui 0.19.2 → 0.21.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 (69) hide show
  1. package/AGENTS.md +3 -1
  2. package/README.md +0 -2
  3. package/dist/components/brand-icons/apple.d.ts +18 -0
  4. package/dist/components/brand-icons/apple.d.ts.map +1 -0
  5. package/dist/components/brand-icons/apple.js +22 -0
  6. package/dist/components/brand-icons/brand-icon.d.ts +22 -0
  7. package/dist/components/brand-icons/brand-icon.d.ts.map +1 -0
  8. package/dist/components/brand-icons/brand-icon.js +26 -0
  9. package/dist/components/brand-icons/linux.d.ts +18 -0
  10. package/dist/components/brand-icons/linux.d.ts.map +1 -0
  11. package/dist/components/brand-icons/linux.js +25 -0
  12. package/dist/components/brand-icons/windows.d.ts +18 -0
  13. package/dist/components/brand-icons/windows.d.ts.map +1 -0
  14. package/dist/components/brand-icons/windows.js +22 -0
  15. package/dist/components/brand-icons.d.ts +5 -0
  16. package/dist/components/brand-icons.d.ts.map +1 -0
  17. package/dist/components/brand-icons.js +10 -0
  18. package/dist/components/button.js +1 -1
  19. package/dist/components/card-marketing.js +2 -2
  20. package/dist/components/card.d.ts +4 -3
  21. package/dist/components/card.d.ts.map +1 -1
  22. package/dist/components/card.js +12 -2
  23. package/dist/components/chart-breakdown-table.js +1 -1
  24. package/dist/components/chart-bullet-bar.d.ts +18 -2
  25. package/dist/components/chart-bullet-bar.d.ts.map +1 -1
  26. package/dist/components/chart-bullet-bar.js +62 -9
  27. package/dist/components/chart-date-range-control.d.ts +11 -1
  28. package/dist/components/chart-date-range-control.d.ts.map +1 -1
  29. package/dist/components/chart-date-range-control.js +13 -3
  30. package/dist/components/chart-entity-colors.d.ts +7 -1
  31. package/dist/components/chart-entity-colors.d.ts.map +1 -1
  32. package/dist/components/chart-entity-colors.js +7 -1
  33. package/dist/components/chart-kpi-stat.d.ts.map +1 -1
  34. package/dist/components/chart-kpi-stat.js +1 -1
  35. package/dist/components/chart-time-series.d.ts.map +1 -1
  36. package/dist/components/chart-time-series.js +62 -4
  37. package/dist/components/chart.js +2 -2
  38. package/dist/components/code-editor-mockup.js +1 -1
  39. package/dist/components/nav-bar.js +1 -1
  40. package/dist/components/radio-group.d.ts +1 -1
  41. package/dist/components/radio-group.d.ts.map +1 -1
  42. package/dist/components/radio-group.js +2 -2
  43. package/dist/components/theme-mode-switcher.d.ts +10 -3
  44. package/dist/components/theme-mode-switcher.d.ts.map +1 -1
  45. package/dist/components/theme-mode-switcher.js +14 -7
  46. package/dist/eslint/index.js +91 -0
  47. package/dist/eslint/rules/jsx-class-utility.js +231 -0
  48. package/dist/eslint/rules/no-deprecated-zod-api.js +156 -0
  49. package/dist/eslint/rules/no-design-system-src-import.js +11 -0
  50. package/dist/eslint/rules/no-invalid-token-utility.js +46 -0
  51. package/dist/eslint/rules/no-native-visible-control.js +86 -0
  52. package/dist/eslint/rules/no-raw-color-utility.js +109 -0
  53. package/dist/eslint/rules/no-raw-focus-ring-width.js +30 -0
  54. package/dist/eslint/rules/no-raw-logo-import.js +41 -0
  55. package/dist/eslint/rules/no-shadcn-appearance-override.js +191 -0
  56. package/dist/eslint/rules/no-token-category-bypass.js +53 -0
  57. package/dist/eslint/rules/no-ui-src-import.js +10 -0
  58. package/dist/eslint/rules/no-unpinned-vercel-functions-import.js +100 -0
  59. package/dist/eslint/rules/src-import-boundary.js +207 -0
  60. package/dist/index.d.ts +1 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +1 -0
  63. package/docs/agents/nadicodeai-ui.md +0 -2
  64. package/docs/consuming-cross-repo.md +31 -3
  65. package/docs/contract.md +11 -1
  66. package/llms.txt +0 -1
  67. package/package.json +9 -3
  68. package/skills/nadicodeai-ui/SKILL.md +1 -1
  69. package/docs/migration/nadia-consumer-readiness.md +0 -180
@@ -42,9 +42,37 @@ partials beside it. The package declares its own built component sources; Tailwi
42
42
  normal automatic detection covers the consumer application. The app still owns
43
43
  its PostCSS configuration, theme provider, and persisted mode preference.
44
44
 
45
- If the app needs bundled Geist files rather than its framework's font loader,
46
- that asset import is one of the intentional direct-API cases described above.
47
- Font loading is an asset decision, not a second design stylesheet.
45
+ That stylesheet also delivers the brand typeface. The design-system CSS module
46
+ declares the `@font-face` rules for Geist and Geist Mono and loads the packaged
47
+ woff2 files, so a consuming app must not add its own font loader for those two
48
+ families. A framework loader on top registers a second, differently sourced face
49
+ for the same family names, which downloads the fonts twice and leaves no defined
50
+ winner. Import files under `@nadicodeai/design-system/assets/fonts/*` only when
51
+ the consumer wants the faces without the CSS module; that is one of the
52
+ intentional direct-API cases described above.
53
+
54
+ ## Strict ESLint interface
55
+
56
+ The package exports the same design-system rules used by this repository. Add
57
+ the flat config after the consumer's framework and TypeScript configs:
58
+
59
+ ```js
60
+ import nadicodeai from "@nadicodeai/ui/eslint";
61
+
62
+ export default [
63
+ // Framework, parser, and TypeScript configs first.
64
+ ...nadicodeai.configs["flat/strict"],
65
+ ];
66
+ ```
67
+
68
+ Every rule in this config is an error. The config rejects generated `nc-*`
69
+ utilities that do not exist in the installed design-system release, arbitrary
70
+ radius values that exactly duplicate a generated token, source deep imports,
71
+ raw design values, native visible controls, and appearance overrides on shared
72
+ UI primitives. An arbitrary radius remains valid when no generated radius has
73
+ the same value. Consumers may compose domain-specific components from the
74
+ public UI package; the rules govern package boundaries and design values, not
75
+ the shape of a consumer's JSX tree.
48
76
 
49
77
  ## NadicodeAI logo
50
78
 
package/docs/contract.md CHANGED
@@ -26,6 +26,7 @@ Agent work surfaces (chat, composer, tool approval, artifacts, threads, diffs, t
26
26
  - **Auth routes are consumer-owned shadcn block work.** Login, signup, OTP, two-factor, magic-link, and provider-button flows start from the selected shadcn block/example in the consuming app, with app-owned Better Auth behavior. Do not ship generic auth, signup, OTP, federated-login, or provider abstractions from this package unless a later explicit boundary decision replaces the selected shadcn block.
27
27
  - **Reusable sections and compositions live here after proof.** Bento grids, media mounts, demo surfaces, page frames, section intros, CTA bands, proof slots, benefits grids, generic shells, and homepage/use-case sections belong in `@nadicodeai/ui` when a second concrete consumer, a plan-approved shared component, or a named validation slice proves the package boundary. Website, portal, and sibling Nadia routes pass data and media children into existing compositions instead of rebuilding layout locally.
28
28
  - **Brand renderers live here for React consumers.** Logo geometry, asset generation, and usage semantics are owned by [`design-system/DESIGN.md`, "Brand media authority"](../../../design-system/DESIGN.md#brand-media-authority). `BrandLockup` supplies the approved horizontal lockup. `BrandMark` serves tight spaces and `BrandWordmark` serves placements where the name must read by itself. All three render the package's public neutral geometry seam with React-scoped SVG ids, dynamic theme paint, and accessible names. Consuming routes use these adapters; they never import raw logo assets, draw brand SVG inline, mask or recolor assets, or create another lockup rule.
29
+ - **Third-party brand marks are generated, never hand-drawn and never hand-edited.** Other companies' marks live in `@nadicodeai/ui/src/components/brand-icons/`, emitted from an explicit allow-list by `@nadicodeai/ui/scripts/build-brand-icons.mjs` and exported through the `@nadicodeai/ui/components/brand-icons` subpath. They are identity images, not UI icons: a brand mark is exempt from the currentColor stroke system and from the raw-literal rule, it never stands in for a UI icon, and a UI icon never stands in for a brand. Marks drawn as one silhouette are stripped to `currentColor` by the generator; every other mark keeps its official colors verbatim. To add a brand, edit the generator's allow-list and run `npm run generate:brand-icons -w @nadicodeai/ui`; hand edits to the generated directory are lost and `@nadicodeai/ui/tests/guards/brand-icons-codegen.test.ts` fails on them. Use is nominative only — naming a platform, an integration, or a provider — never adjacent to endorsement or partnership wording. The full decision, including the licensing and trademark posture, is [ADR 0042](../../../docs/adr/0042-third-party-brand-marks-are-generated-identity-images.md).
29
30
  - **No fake proof APIs.** Components may support future testimonials, logos, stats, and proof slots, but they must render nothing public when the proof is absent. Do not ship placeholder customer names, metrics, or logos.
30
31
 
31
32
  ## Accessibility Invariant
@@ -38,8 +39,17 @@ The source tree, barrels, and package exports own the current reusable section v
38
39
 
39
40
  ## Consumer Boundary
40
41
 
41
- Consumers own routing, auth, app data, server actions, runtime adapters, permission decisions, analytics, and app-specific copy. The package owns the presentational structure and state vocabulary only. [`migration/nadia-consumer-readiness.md`](migration/nadia-consumer-readiness.md) owns migration order and readiness; [`terminal-tui-semantics.md`](terminal-tui-semantics.md) owns TUI semantics.
42
+ Consumers own routing, auth, app data, server actions, runtime adapters, permission decisions, analytics, and app-specific copy. The package owns the presentational structure and state vocabulary only. [`terminal-tui-semantics.md`](terminal-tui-semantics.md) owns TUI semantics.
42
43
 
43
44
  App source composes layout, data, behavior, and semantic content around package components. It does not restyle an imported component root: appearance changes enter through the component's typed variant or are added to the owning package component. App `className` values on package components are limited to structural layout and sizing. App source uses semantic roles such as `bg-background` and `text-foreground`; raw Tailwind palette colors and canonical `nc-*` color utilities stay behind package-owned primitives such as `BrandField`. Visible controls come from `@nadicodeai/ui`, while hidden inputs remain valid form transport. The root ESLint rules `nadicodeai/no-shadcn-appearance-override`, `nadicodeai/no-raw-color-utility`, and `nadicodeai/no-native-visible-control` enforce this boundary.
44
45
 
45
46
  When this package is read from an installed npm package, follow the [consumer setup guide](consuming-cross-repo.md) for setup and public import paths. The styling invariant above remains the authority for component implementation.
47
+
48
+ The public strict ESLint config enforces only properties that can be decided
49
+ from one source file and the installed generated tokens. It does not infer
50
+ that two JSX trees represent the same product pattern. Repeated patterns stay
51
+ governed by a named owning component, typed variants or slots, and explicit
52
+ package or Portal-kit imports. A new repeated pattern is consolidated at its
53
+ owner and pinned with a focused source or rendering test; generic JSX
54
+ similarity warnings are outside this contract because they cannot distinguish
55
+ valid domain composition from a fork without false positives.
package/llms.txt CHANGED
@@ -15,7 +15,6 @@ Use this file as a map; read the owning document before changing behavior.
15
15
  - Agent work surfaces: `docs/agent-work-surfaces.md`.
16
16
  - Product compositions and sections: `docs/product-compositions.md` and
17
17
  `docs/product-sections.md`.
18
- - Consumer migration: `docs/migration/nadia-consumer-readiness.md`.
19
18
  - Terminal and TUI semantics: `docs/terminal-tui-semantics.md`.
20
19
  - Maintenance workflow and live shadcn or AI Elements discovery:
21
20
  `docs/agents/nadicodeai-ui.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadicodeai/ui",
3
- "version": "0.19.2",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,6 +14,7 @@
14
14
  "import": "./dist/index.js"
15
15
  },
16
16
  "./globals.css": "./dist/styles/globals.css",
17
+ "./eslint": "./dist/eslint/index.js",
17
18
  "./ai-elements": {
18
19
  "types": "./dist/ai-elements.d.ts",
19
20
  "import": "./dist/ai-elements.js"
@@ -53,8 +54,9 @@
53
54
  ],
54
55
  "scripts": {
55
56
  "dev": "node scripts/dev-build.mjs --watch",
56
- "build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/fix-dist-imports.mjs && node scripts/build-styles.mjs",
57
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/fix-dist-imports.mjs && node scripts/build-styles.mjs && node scripts/build-eslint.mjs",
57
58
  "build:fast": "node scripts/dev-build.mjs",
59
+ "generate:brand-icons": "node scripts/build-brand-icons.mjs",
58
60
  "prepack": "npm run build",
59
61
  "lint": "eslint --max-warnings=0",
60
62
  "typecheck": "tsc --noEmit",
@@ -63,7 +65,7 @@
63
65
  },
64
66
  "dependencies": {
65
67
  "@base-ui/react": "^1.6.0",
66
- "@nadicodeai/design-system": "0.19.2",
68
+ "@nadicodeai/design-system": "0.21.0",
67
69
  "@rive-app/react-webgl2": "^4.29.1",
68
70
  "@streamdown/cjk": "^1.0.3",
69
71
  "@streamdown/code": "^1.1.1",
@@ -102,6 +104,10 @@
102
104
  "tailwindcss": "^4.3.1"
103
105
  },
104
106
  "devDependencies": {
107
+ "@iconify-json/logos": "^1.2.11",
108
+ "@iconify/utils": "^3.1.4",
109
+ "@stryker-mutator/core": "9.6.1",
110
+ "@stryker-mutator/vitest-runner": "9.6.1",
105
111
  "@tailwindcss/postcss": "^4.3.1",
106
112
  "@testing-library/react": "^16.3.2",
107
113
  "@types/react": "^19",
@@ -49,7 +49,7 @@ import { AgentChat } from "@nadicodeai/ui/components/agent-chat";
49
49
  - Use package product components for shared settings, shell, installer, plugin-boundary, agent chat, artifact, file, diff, and redacted terminal summary UI.
50
50
  - Use first-party shadcn registry source in the consuming app for generic data tables, command palettes, and chart cards; do not import a NadicodeAI package abstraction for those patterns.
51
51
  - Keep routes, data, auth, server actions, persistence, permission decisions, runtime adapters, analytics, and product-specific copy in the consuming app.
52
- - Follow `docs/migration/nadia-consumer-readiness.md`: web admin or portal first, installer second, desktop shell third, desktop chat last, TUI through `docs/terminal-tui-semantics.md`.
52
+ - Render TUI surfaces through `docs/terminal-tui-semantics.md`.
53
53
  - Fixtures must be synthetic or redacted and cover provider, model, plugin, approval, diff, terminal, installer recovery, queued, streaming, and interrupted states. Do not use generic SaaS/card-grid filler, secrets, environment values, raw terminal output, hidden reasoning, user memory, fake customers, or fake proof metrics.
54
54
 
55
55
  ## Forms
@@ -1,180 +0,0 @@
1
- # Nadia Consumer Readiness
2
-
3
- This guide records the first consumer-readiness path for shared Nadia product UI.
4
- The components are presentational package surface. Consuming apps still own
5
- routes, auth, data loading, mutations, persistence, runtime adapters, permission
6
- decisions, analytics, and product-specific copy.
7
-
8
- ## Required Setup
9
-
10
- Complete [`../consuming-cross-repo.md`](../consuming-cross-repo.md) before
11
- starting a migration; it owns consumer setup. Component styling must satisfy
12
- [`../contract.md`](../contract.md).
13
-
14
- Use public package subpaths:
15
-
16
- ```tsx
17
- import { DashboardShell } from "@nadicodeai/ui/components/dashboard-shell";
18
- import { AgentChat } from "@nadicodeai/ui/components/agent-chat";
19
- ```
20
-
21
- Use first-party shadcn registry source directly in the consuming app for generic
22
- data tables, command palettes, and chart cards. Do not migrate those patterns
23
- through a NadicodeAI package wrapper.
24
-
25
- ## Consumer Mapping
26
-
27
- ### Toast
28
-
29
- The imperative toast API is package-owned. Import it from the
30
- `@nadicodeai/ui/components/toast` subpath, and mount `<Toaster />` from
31
- `@nadicodeai/ui/components/sonner` once at the app root.
32
-
33
- ```tsx
34
- import { toast } from "@nadicodeai/ui/components/toast";
35
-
36
- showToast(message, "success"); // → toast.success(message)
37
- showToast(message, "error"); // → toast.error(message)
38
- ```
39
-
40
- Per-toast duration is a sonner option passed as the second argument.
41
- Consumers must not depend on `sonner` directly.
42
-
43
- ### Confirm flows
44
-
45
- `ConfirmDialog` from `@nadicodeai/ui/components/confirm-dialog` takes `open`,
46
- `onConfirm`, `onCancel`, `title`, and optional `description`, `confirmLabel`,
47
- `cancelLabel`, `destructive`, `loading`. `useConfirmAction` from
48
- `@nadicodeai/ui/hooks` replaces bespoke delete-confirm hooks:
49
-
50
- ```tsx
51
- useConfirmAction({ onConfirm }); // (value) => Promise<void> | void
52
- // → { request, cancel, confirm, isBusy, isOpen, pending }
53
- ```
54
-
55
- | Old (`useConfirmDelete`) | New (`useConfirmAction`) |
56
- | --- | --- |
57
- | `onDelete` | `onConfirm` |
58
- | `requestDelete` | `request` |
59
- | `isDeleting` | `isBusy` |
60
- | `pendingId` | `pending` |
61
-
62
- A throw inside `onConfirm` keeps the dialog open and the hook swallows it —
63
- surface errors from inside `onConfirm` yourself, with a toast or an inline
64
- alert. Non-delete confirms (restart, reset, reload) use the same component
65
- with either plain boolean state or the same hook.
66
-
67
- ### Typography
68
-
69
- The package ships no `Text`/`Heading` component — the same boundary that
70
- keeps `DataTable` and `CommandPalette` out. The type scale is design-system
71
- CSS consumed as classes on raw elements: `nc-type-display-xl/lg/md/sm`,
72
- `nc-type-title-lg/md/sm`, `nc-type-body-lg/md/sm` (plus `-strong` variants
73
- for `body-md`/`body-sm`), `nc-type-caption` (plus `-strong` and `-mono`),
74
- `nc-type-code`, and `nc-type-button-md/lg`.
75
-
76
- | Old usage | New usage |
77
- | --- | --- |
78
- | Page-level heading | `<h1 className="nc-type-title-lg">` (or a `display-*` class at hero scale) |
79
- | Section header (the dominant H2 `variant="sm"` pattern) | `<h2 className="nc-type-title-sm">` |
80
- | Body copy | `<p className="nc-type-body-md">` |
81
- | Fine print / labels | `nc-type-caption` |
82
- | Code | `nc-type-code` |
83
-
84
- ### Segmented control
85
-
86
- Single-select segmented UI is the existing `ToggleGroup`:
87
-
88
- ```tsx
89
- <ToggleGroup spacing={0} variant="outline">
90
- <ToggleGroupItem value="day">Day</ToggleGroupItem>
91
- <ToggleGroupItem value="week">Week</ToggleGroupItem>
92
- </ToggleGroup>
93
- ```
94
-
95
- Base UI's `ToggleGroup` is single-select by default (`toggleMultiple`
96
- defaults to `false`), and its value is an array. Controlled usage is
97
- `value={[current]}` with:
98
-
99
- ```tsx
100
- onValueChange={(next) => {
101
- if (next.length) setCurrent(next[0]);
102
- }}
103
- ```
104
-
105
- The length guard preserves radio semantics by ignoring deselection of the
106
- active item. A label-plus-group row ("FilterGroup") is an app-level flex
107
- composition, not package surface.
108
-
109
- ### Copy affordances
110
-
111
- Copy-to-clipboard UI is the AI Elements surface — a sanctioned public path.
112
- Use `Snippet`/`SnippetCopyButton` and `CodeBlockCopyButton` from
113
- `@nadicodeai/ui/ai-elements`.
114
-
115
- | Old | New |
116
- | --- | --- |
117
- | `CommandBlock(label, code)` | `Snippet` with `SnippetCopyButton` |
118
- | Bare `CopyButton(text)` | `SnippetCopyButton` inside a `Snippet`, or an app-local `Button` when no snippet chrome is wanted |
119
-
120
- ### Breakpoints
121
-
122
- `useIsMobile()` (fixed 768) and `useBelowBreakpoint(px)` (true strictly below
123
- `px`) both ship from `@nadicodeai/ui/hooks`.
124
-
125
- ## Migration Order
126
-
127
- 1. Web admin or portal validation slice.
128
- 2. Installer and bootstrap flows.
129
- 3. Desktop shell and plugin boundary surfaces.
130
- 4. Desktop chat and runtime work surfaces.
131
- 5. TUI consumers through the terminal semantic mapping document.
132
-
133
- Desktop chat is last because it carries runtime-sensitive approval, streaming,
134
- queue, attachment, file, diff, and terminal states. Terminal consumers should
135
- mirror `docs/terminal-tui-semantics.md` instead of importing a DOM runtime.
136
-
137
- ## Readiness Gates
138
-
139
- - The consumer satisfies the canonical setup in
140
- [`../consuming-cross-repo.md`](../consuming-cross-repo.md).
141
- - Product components are imported from `@nadicodeai/ui/components/*` public
142
- subpaths, not `src/*`.
143
- - At least one local shell, bento, settings, installer, plugin, or chat
144
- layout responsibility is removed from the consumer.
145
- - Routes, data, auth, copy, persistence, and runtime behavior remain app-owned.
146
- - Fixtures use synthetic or redacted provider, model, plugin, approval, diff,
147
- terminal, installer, and agent-work scenarios.
148
- - No fixture contains secrets, environment values, raw terminal output, hidden
149
- reasoning, user memory, fake customers, fake proof metrics, or generic SaaS
150
- filler.
151
-
152
- ## First Validation Slice
153
-
154
- The in-repo portal is the first real consumer slice. It already imports package
155
- CSS at `portal/src/app/layout.tsx`. Its shell now consumes
156
- `@nadicodeai/ui/components/dashboard-shell` and keeps portal-owned route
157
- definitions, access checks, data, and Italian copy in `portal/`.
158
-
159
- This validates the package boundary because the shared component owns responsive
160
- dashboard chrome, mobile navigation trigger, content containment, and sidebar
161
- structure while the portal keeps the Nadia Agents activation domain.
162
-
163
- ## Fixture Expectations
164
-
165
- Use NadicodeAI-relevant synthetic/redacted fixtures:
166
-
167
- - Data and settings: provider rows, model choices, plugin status, session state,
168
- loading, permission, error, empty, and recovery copy.
169
- - Auth and installer: activation-shaped states, expired or invalid pairing,
170
- retry and recovery actions, no live OTPs or secrets.
171
- - Shell and plugin: realistic navigation hierarchy, permission badges, disabled,
172
- warning, error, unsafe, and contained-overflow states.
173
- - Agent, file, diff, and terminal: approval choices, tool failure, redacted
174
- terminal summaries, changed-file hierarchy, interrupted, queued, and streaming
175
- states.
176
-
177
- Brand and marketing components remain part of the same package surface. Consumer
178
- migrations should not hide or replace `PageFrame`, `SectionIntro`, `Bento`,
179
- `MediaMount`, `DemoSurface`, `HeroSplit`, `NavBar`, `Footer`, `BrandWordmark`,
180
- or the existing marketing sections.