@nadicodeai/ui 0.8.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.
- package/AGENTS.md +1 -0
- package/README.md +1 -0
- package/dist/components/confirm-dialog.d.ts +16 -0
- package/dist/components/confirm-dialog.d.ts.map +1 -0
- package/dist/components/confirm-dialog.js +18 -0
- package/dist/components/toast.d.ts +3 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +4 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/use-below-breakpoint.d.ts +3 -0
- package/dist/hooks/use-below-breakpoint.d.ts.map +1 -0
- package/dist/hooks/use-below-breakpoint.js +20 -0
- package/dist/hooks/use-confirm-action.d.ts +17 -0
- package/dist/hooks/use-confirm-action.d.ts.map +1 -0
- package/dist/hooks/use-confirm-action.js +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/docs/agents/nadicodeai-ui.md +1 -0
- package/docs/migration/nadia-consumer-readiness.md +100 -0
- package/llms.txt +1 -0
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -115,6 +115,7 @@ Use public component subpaths for product UI:
|
|
|
115
115
|
- `@nadicodeai/ui/components/chart-kpi-stat`
|
|
116
116
|
- `@nadicodeai/ui/components/chart-sparkline`
|
|
117
117
|
- `@nadicodeai/ui/components/chart-time-series`
|
|
118
|
+
- `@nadicodeai/ui/components/confirm-dialog`
|
|
118
119
|
- `@nadicodeai/ui/components/dashboard-shell`
|
|
119
120
|
- `@nadicodeai/ui/components/desktop-shell`
|
|
120
121
|
- `@nadicodeai/ui/components/feedback-state`
|
package/README.md
CHANGED
|
@@ -142,6 +142,7 @@ Current product subpaths:
|
|
|
142
142
|
- `@nadicodeai/ui/components/chart-kpi-stat`
|
|
143
143
|
- `@nadicodeai/ui/components/chart-sparkline`
|
|
144
144
|
- `@nadicodeai/ui/components/chart-time-series`
|
|
145
|
+
- `@nadicodeai/ui/components/confirm-dialog`
|
|
145
146
|
- `@nadicodeai/ui/components/dashboard-shell`
|
|
146
147
|
- `@nadicodeai/ui/components/desktop-shell`
|
|
147
148
|
- `@nadicodeai/ui/components/feedback-state`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
interface ConfirmDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onConfirm: () => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
confirmLabel?: React.ReactNode;
|
|
9
|
+
cancelLabel?: React.ReactNode;
|
|
10
|
+
destructive?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel, cancelLabel, destructive, loading, }: ConfirmDialogProps): React.JSX.Element;
|
|
14
|
+
export { ConfirmDialog };
|
|
15
|
+
export type { ConfirmDialogProps };
|
|
16
|
+
//# sourceMappingURL=confirm-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAapC,UAAU,kBAAkB;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAOD,iBAAS,aAAa,CAAC,EACrB,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,EACX,YAAwB,EACxB,WAAsB,EACtB,WAAmB,EACnB,OAAe,GAChB,EAAE,kBAAkB,qBA+BpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "./alert-dialog.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { Spinner } from "./spinner.js";
|
|
6
|
+
// Fully controlled confirm dialog over the registry AlertDialog parts. The
|
|
7
|
+
// confirm action is a plain Button (not AlertDialogAction) so a failed confirm
|
|
8
|
+
// can keep the dialog open; the only closing gesture is Escape (alert dialogs
|
|
9
|
+
// take no backdrop dismissal), which routes through onCancel, and loading
|
|
10
|
+
// disables both buttons while the action runs.
|
|
11
|
+
function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel = "Confirm", cancelLabel = "Cancel", destructive = false, loading = false, }) {
|
|
12
|
+
return (_jsx(AlertDialog, { open: open, onOpenChange: (nextOpen) => {
|
|
13
|
+
if (!nextOpen) {
|
|
14
|
+
onCancel();
|
|
15
|
+
}
|
|
16
|
+
}, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), description ? _jsx(AlertDialogDescription, { children: description }) : null] }), _jsxs(AlertDialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: onCancel, disabled: loading, children: cancelLabel }), _jsxs(Button, { variant: destructive ? "destructive" : "default", onClick: onConfirm, disabled: loading, children: [loading ? _jsx(Spinner, {}) : null, confirmLabel] })] })] }) }));
|
|
17
|
+
}
|
|
18
|
+
export { ConfirmDialog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/components/toast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-below-breakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/use-below-breakpoint.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CActD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
// Strictly-below max-width query for a pixel breakpoint, mirroring
|
|
4
|
+
// use-mobile's `${breakpoint - 1}px` convention: true only under `px`, never at.
|
|
5
|
+
export function belowBreakpointQuery(px) {
|
|
6
|
+
return `(max-width: ${px - 1}px)`;
|
|
7
|
+
}
|
|
8
|
+
export function useBelowBreakpoint(px) {
|
|
9
|
+
const [isBelow, setIsBelow] = React.useState(undefined);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const mql = window.matchMedia(belowBreakpointQuery(px));
|
|
12
|
+
const onChange = () => {
|
|
13
|
+
setIsBelow(mql.matches);
|
|
14
|
+
};
|
|
15
|
+
mql.addEventListener("change", onChange);
|
|
16
|
+
setIsBelow(mql.matches);
|
|
17
|
+
return () => mql.removeEventListener("change", onChange);
|
|
18
|
+
}, [px]);
|
|
19
|
+
return !!isBelow;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ConfirmActionGate {
|
|
2
|
+
busy: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function requestConfirmAction<T>(gate: ConfirmActionGate, value: T, setPending: (value: T | null) => void): void;
|
|
5
|
+
export declare function cancelConfirmAction<T>(gate: ConfirmActionGate, setPending: (value: T | null) => void): void;
|
|
6
|
+
export declare function runConfirmAction<T>(gate: ConfirmActionGate, pending: T | null, onConfirm: (value: T) => void | Promise<void>, setPending: (value: T | null) => void, setBusy: (busy: boolean) => void): Promise<void>;
|
|
7
|
+
export declare function useConfirmAction<T>({ onConfirm, }: {
|
|
8
|
+
onConfirm: (value: T) => void | Promise<void>;
|
|
9
|
+
}): {
|
|
10
|
+
readonly request: (value: T) => void;
|
|
11
|
+
readonly cancel: () => void;
|
|
12
|
+
readonly confirm: () => Promise<void>;
|
|
13
|
+
readonly isBusy: boolean;
|
|
14
|
+
readonly isOpen: boolean;
|
|
15
|
+
readonly pending: T | null;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=use-confirm-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-confirm-action.d.ts","sourceRoot":"","sources":["../../src/hooks/use-confirm-action.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;CACf;AAID,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,CAAC,EACR,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,GACpC,IAAI,CAKN;AAID,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,IAAI,EAAE,iBAAiB,EACvB,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,GACpC,IAAI,CAKN;AAKD,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,CAAC,GAAG,IAAI,EACjB,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC7C,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,EACrC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAC/B,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,EAClC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;8BAK2C,CAAC;;;;;;EAqB5C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
// Request stages a value for confirmation; ignored while a confirm is in
|
|
4
|
+
// flight so the pending value cannot change under a running action.
|
|
5
|
+
export function requestConfirmAction(gate, value, setPending) {
|
|
6
|
+
if (gate.busy) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
setPending(value);
|
|
10
|
+
}
|
|
11
|
+
// Cancel clears the pending value, but is a no-op while a confirm is in flight
|
|
12
|
+
// so the dialog cannot be dismissed mid-action.
|
|
13
|
+
export function cancelConfirmAction(gate, setPending) {
|
|
14
|
+
if (gate.busy) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
setPending(null);
|
|
18
|
+
}
|
|
19
|
+
// Confirm marks busy, awaits `onConfirm`, and clears the pending value on
|
|
20
|
+
// success. A thrown error is swallowed so the dialog stays open (the caller
|
|
21
|
+
// surfaces the error inside `onConfirm`); busy always resets in `finally`.
|
|
22
|
+
export async function runConfirmAction(gate, pending, onConfirm, setPending, setBusy) {
|
|
23
|
+
if (gate.busy || pending === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
gate.busy = true;
|
|
27
|
+
setBusy(true);
|
|
28
|
+
try {
|
|
29
|
+
await onConfirm(pending);
|
|
30
|
+
setPending(null);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Keep the pending value so the dialog stays open.
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
gate.busy = false;
|
|
37
|
+
setBusy(false);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function useConfirmAction({ onConfirm, }) {
|
|
41
|
+
const [pending, setPending] = React.useState(null);
|
|
42
|
+
const [isBusy, setIsBusy] = React.useState(false);
|
|
43
|
+
const gateRef = React.useRef({ busy: false });
|
|
44
|
+
const request = React.useCallback((value) => {
|
|
45
|
+
requestConfirmAction(gateRef.current, value, setPending);
|
|
46
|
+
}, []);
|
|
47
|
+
const cancel = React.useCallback(() => {
|
|
48
|
+
cancelConfirmAction(gateRef.current, setPending);
|
|
49
|
+
}, []);
|
|
50
|
+
const confirm = React.useCallback(() => runConfirmAction(gateRef.current, pending, onConfirm, setPending, setIsBusy), [pending, onConfirm]);
|
|
51
|
+
return {
|
|
52
|
+
request,
|
|
53
|
+
cancel,
|
|
54
|
+
confirm,
|
|
55
|
+
isBusy,
|
|
56
|
+
isOpen: pending !== null,
|
|
57
|
+
pending,
|
|
58
|
+
};
|
|
59
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export * from "./components/code-editor-mockup";
|
|
|
41
41
|
export * from "./components/collapsible";
|
|
42
42
|
export * from "./components/combobox";
|
|
43
43
|
export * from "./components/command";
|
|
44
|
+
export * from "./components/confirm-dialog";
|
|
44
45
|
export * from "./components/contact";
|
|
45
46
|
export * from "./components/context-menu";
|
|
46
47
|
export * from "./components/dashboard-shell";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;A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AAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ export * from "./components/code-editor-mockup.js";
|
|
|
41
41
|
export * from "./components/collapsible.js";
|
|
42
42
|
export * from "./components/combobox.js";
|
|
43
43
|
export * from "./components/command.js";
|
|
44
|
+
export * from "./components/confirm-dialog.js";
|
|
44
45
|
export * from "./components/contact.js";
|
|
45
46
|
export * from "./components/context-menu.js";
|
|
46
47
|
export * from "./components/dashboard-shell.js";
|
|
@@ -88,6 +88,7 @@ Current shipped product subpaths:
|
|
|
88
88
|
- `@nadicodeai/ui/components/chart-kpi-stat`
|
|
89
89
|
- `@nadicodeai/ui/components/chart-sparkline`
|
|
90
90
|
- `@nadicodeai/ui/components/chart-time-series`
|
|
91
|
+
- `@nadicodeai/ui/components/confirm-dialog`
|
|
91
92
|
- `@nadicodeai/ui/components/dashboard-shell`
|
|
92
93
|
- `@nadicodeai/ui/components/desktop-shell`
|
|
93
94
|
- `@nadicodeai/ui/components/feedback-state`
|
|
@@ -27,6 +27,106 @@ Use first-party shadcn registry source directly in the consuming app for generic
|
|
|
27
27
|
data tables, command palettes, and chart cards. Do not migrate those patterns
|
|
28
28
|
through a NadicodeAI package wrapper.
|
|
29
29
|
|
|
30
|
+
## Consumer Mapping
|
|
31
|
+
|
|
32
|
+
### Toast
|
|
33
|
+
|
|
34
|
+
The imperative toast API is package-owned. Import it from the
|
|
35
|
+
`@nadicodeai/ui/components/toast` subpath, and mount `<Toaster />` from
|
|
36
|
+
`@nadicodeai/ui/components/sonner` once at the app root.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { toast } from "@nadicodeai/ui/components/toast";
|
|
40
|
+
|
|
41
|
+
showToast(message, "success"); // → toast.success(message)
|
|
42
|
+
showToast(message, "error"); // → toast.error(message)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Per-toast duration is a sonner option passed as the second argument.
|
|
46
|
+
Consumers must not depend on `sonner` directly.
|
|
47
|
+
|
|
48
|
+
### Confirm flows
|
|
49
|
+
|
|
50
|
+
`ConfirmDialog` from `@nadicodeai/ui/components/confirm-dialog` takes `open`,
|
|
51
|
+
`onConfirm`, `onCancel`, `title`, and optional `description`, `confirmLabel`,
|
|
52
|
+
`cancelLabel`, `destructive`, `loading`. `useConfirmAction` from
|
|
53
|
+
`@nadicodeai/ui/hooks` replaces bespoke delete-confirm hooks:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
useConfirmAction({ onConfirm }); // (value) => Promise<void> | void
|
|
57
|
+
// → { request, cancel, confirm, isBusy, isOpen, pending }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Old (`useConfirmDelete`) | New (`useConfirmAction`) |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `onDelete` | `onConfirm` |
|
|
63
|
+
| `requestDelete` | `request` |
|
|
64
|
+
| `isDeleting` | `isBusy` |
|
|
65
|
+
| `pendingId` | `pending` |
|
|
66
|
+
|
|
67
|
+
A throw inside `onConfirm` keeps the dialog open and the hook swallows it —
|
|
68
|
+
surface errors from inside `onConfirm` yourself, with a toast or an inline
|
|
69
|
+
alert. Non-delete confirms (restart, reset, reload) use the same component
|
|
70
|
+
with either plain boolean state or the same hook.
|
|
71
|
+
|
|
72
|
+
### Typography
|
|
73
|
+
|
|
74
|
+
The package ships no `Text`/`Heading` component — the same boundary that
|
|
75
|
+
keeps `DataTable` and `CommandPalette` out. The type scale is design-system
|
|
76
|
+
CSS consumed as classes on raw elements: `nc-type-display-xl/lg/md/sm`,
|
|
77
|
+
`nc-type-title-lg/md/sm`, `nc-type-body-lg/md/sm` (plus `-strong` variants
|
|
78
|
+
for `body-md`/`body-sm`), `nc-type-caption` (plus `-strong` and `-mono`),
|
|
79
|
+
`nc-type-code`, and `nc-type-button-md/lg`.
|
|
80
|
+
|
|
81
|
+
| Old usage | New usage |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| Page-level heading | `<h1 className="nc-type-title-lg">` (or a `display-*` class at hero scale) |
|
|
84
|
+
| Section header (the dominant H2 `variant="sm"` pattern) | `<h2 className="nc-type-title-sm">` |
|
|
85
|
+
| Body copy | `<p className="nc-type-body-md">` |
|
|
86
|
+
| Fine print / labels | `nc-type-caption` |
|
|
87
|
+
| Code | `nc-type-code` |
|
|
88
|
+
|
|
89
|
+
### Segmented control
|
|
90
|
+
|
|
91
|
+
Single-select segmented UI is the existing `ToggleGroup`:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<ToggleGroup spacing={0} variant="outline">
|
|
95
|
+
<ToggleGroupItem value="day">Day</ToggleGroupItem>
|
|
96
|
+
<ToggleGroupItem value="week">Week</ToggleGroupItem>
|
|
97
|
+
</ToggleGroup>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Base UI's `ToggleGroup` is single-select by default (`toggleMultiple`
|
|
101
|
+
defaults to `false`), and its value is an array. Controlled usage is
|
|
102
|
+
`value={[current]}` with:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
onValueChange={(next) => {
|
|
106
|
+
if (next.length) setCurrent(next[0]);
|
|
107
|
+
}}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The length guard preserves radio semantics by ignoring deselection of the
|
|
111
|
+
active item. A label-plus-group row ("FilterGroup") is an app-level flex
|
|
112
|
+
composition, not package surface.
|
|
113
|
+
|
|
114
|
+
### Copy affordances
|
|
115
|
+
|
|
116
|
+
Copy-to-clipboard UI is the AI Elements surface — a sanctioned public path.
|
|
117
|
+
Use `Snippet`/`SnippetCopyButton` and `CodeBlockCopyButton` from
|
|
118
|
+
`@nadicodeai/ui/ai-elements`.
|
|
119
|
+
|
|
120
|
+
| Old | New |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `CommandBlock(label, code)` | `Snippet` with `SnippetCopyButton` |
|
|
123
|
+
| Bare `CopyButton(text)` | `SnippetCopyButton` inside a `Snippet`, or an app-local `Button` when no snippet chrome is wanted |
|
|
124
|
+
|
|
125
|
+
### Breakpoints
|
|
126
|
+
|
|
127
|
+
`useIsMobile()` (fixed 768) and `useBelowBreakpoint(px)` (true strictly below
|
|
128
|
+
`px`) both ship from `@nadicodeai/ui/hooks`.
|
|
129
|
+
|
|
30
130
|
## Migration Order
|
|
31
131
|
|
|
32
132
|
1. Web admin or portal validation slice.
|
package/llms.txt
CHANGED
|
@@ -41,6 +41,7 @@ Component surface:
|
|
|
41
41
|
- `@nadicodeai/ui/components/chart-kpi-stat`
|
|
42
42
|
- `@nadicodeai/ui/components/chart-sparkline`
|
|
43
43
|
- `@nadicodeai/ui/components/chart-time-series`
|
|
44
|
+
- `@nadicodeai/ui/components/confirm-dialog`
|
|
44
45
|
- `@nadicodeai/ui/components/dashboard-shell`
|
|
45
46
|
- `@nadicodeai/ui/components/desktop-shell`
|
|
46
47
|
- `@nadicodeai/ui/components/feedback-state`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadicodeai/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@base-ui/react": "^1.6.0",
|
|
66
|
-
"@nadicodeai/design-system": "0.
|
|
66
|
+
"@nadicodeai/design-system": "0.9.0",
|
|
67
67
|
"@rive-app/react-webgl2": "^4.29.1",
|
|
68
68
|
"@streamdown/cjk": "^1.0.3",
|
|
69
69
|
"@streamdown/code": "^1.1.1",
|