@jini-ai/admin 0.3.9 → 0.3.10
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.
|
@@ -22,8 +22,15 @@ import { type UseConfirmDialog } from './ConfirmDialog.hooks.js';
|
|
|
22
22
|
*
|
|
23
23
|
* | element | handle | role |
|
|
24
24
|
* |---|---|---|
|
|
25
|
-
* | the confirm action | `delete-role-confirm` | `button` |
|
|
26
25
|
* | the cancel/dismiss action | `delete-role-cancel` | `button` |
|
|
26
|
+
* | the confirm action, unless the caller opts out with `agentMayConfirm={false}` | `delete-role-confirm` | `button` |
|
|
27
|
+
*
|
|
28
|
+
* The confirm action is agent-reachable by default, same as every other published control — the
|
|
29
|
+
* product's standing policy is that the in-page assistant may click buttons, fill forms and confirm
|
|
30
|
+
* dialogs, with permanently destructive actions gated by a separate in-chat confirmation at the tool
|
|
31
|
+
* level rather than by hiding the button. A caller whose dialog must stay human-only regardless
|
|
32
|
+
* (e.g. it guards a secret the assistant must never see or move on its own) opts out explicitly with
|
|
33
|
+
* `agentMayConfirm={false}`.
|
|
27
34
|
*
|
|
28
35
|
* Both segments are literals this component chooses itself, never host data — unlike `RowMenu`'s
|
|
29
36
|
* per-item keys (arbitrary host strings that can collide after slugifying), `confirm`/`cancel`
|
|
@@ -31,7 +38,7 @@ import { type UseConfirmDialog } from './ConfirmDialog.hooks.js';
|
|
|
31
38
|
* choice of name, and a bad one should fail loudly at first render rather than silently answer to a
|
|
32
39
|
* handle the caller never wrote. Omit `agentHandle` and no `data-agent-*` markup is emitted at all.
|
|
33
40
|
*
|
|
34
|
-
*
|
|
41
|
+
* The published handles are present in the DOM as soon as `agentHandle` is supplied, regardless of `open` —
|
|
35
42
|
* this component stays mounted and toggles the native `<dialog>`'s open state rather than being
|
|
36
43
|
* conditionally rendered by its caller (see `useConfirmDialog`'s doc comment), so there is no
|
|
37
44
|
* "closed" render that omits them, the same reasoning `RowMenu`'s always-visible trigger handle
|
|
@@ -77,6 +84,11 @@ export interface ConfirmDialogProps {
|
|
|
77
84
|
/** This dialog's own agent handle — see this file's "Agent handles" doc comment for the full
|
|
78
85
|
* scheme. Omit and no `data-agent-*` markup is emitted at all. */
|
|
79
86
|
agentHandle?: string;
|
|
87
|
+
/** Publishes the confirm action (`<agentHandle>-confirm`) so the assistant can confirm this
|
|
88
|
+
* dialog without a human — on by default, matching every other published control. Pass `false`
|
|
89
|
+
* only for a dialog that must stay human-only regardless (e.g. it guards a secret). Has no
|
|
90
|
+
* effect without `agentHandle`. @default true */
|
|
91
|
+
agentMayConfirm?: boolean;
|
|
80
92
|
}
|
|
81
93
|
/**
|
|
82
94
|
* Controlled modal confirm — renders the `<dialog>` markup and delegates its open/close and focus
|
|
@@ -87,5 +99,5 @@ export interface ConfirmDialogProps {
|
|
|
87
99
|
* is no browser-assigned "default button" for Enter to reach for at all; confirm can only ever fire
|
|
88
100
|
* from an explicit click or explicit Tab-then-Enter onto it.
|
|
89
101
|
*/
|
|
90
|
-
export declare function ConfirmDialog({ useDialog, agentHandle: baseHandle, ...props }: ConfirmDialogProps): import("react").JSX.Element;
|
|
102
|
+
export declare function ConfirmDialog({ useDialog, agentHandle: baseHandle, agentMayConfirm, ...props }: ConfirmDialogProps): import("react").JSX.Element;
|
|
91
103
|
//# sourceMappingURL=ConfirmDialog.d.ts.map
|
|
@@ -76,14 +76,14 @@ function confirmDialogAgentProps(base, action, options) {
|
|
|
76
76
|
* is no browser-assigned "default button" for Enter to reach for at all; confirm can only ever fire
|
|
77
77
|
* from an explicit click or explicit Tab-then-Enter onto it.
|
|
78
78
|
*/
|
|
79
|
-
export function ConfirmDialog({ useDialog = useConfirmDialog, agentHandle: baseHandle, ...props }) {
|
|
79
|
+
export function ConfirmDialog({ useDialog = useConfirmDialog, agentHandle: baseHandle, agentMayConfirm = true, ...props }) {
|
|
80
80
|
const { titleId, dialogRef, cancelRef, handleNativeCancel, handleBackdropClick } = useDialog(props.open, props.pending, props.onCancel);
|
|
81
81
|
const tone = resolveTone(props);
|
|
82
82
|
const cancelLabel = useConfirmDialogCancelLabel(props.cancelLabel);
|
|
83
83
|
return (_jsxs("dialog", { ref: dialogRef, className: "confirm-dialog", "aria-labelledby": titleId, onCancel: handleNativeCancel, onClick: handleBackdropClick, children: [_jsx("h2", { id: titleId, children: props.title }), _jsx("div", { className: "confirm-dialog-body", children: props.body }), _jsxs("div", { className: "confirm-dialog-actions", children: [_jsx("button", { ref: cancelRef, type: "button", className: "btn-secondary", disabled: props.pending, onClick: props.onCancel, ...confirmDialogAgentProps(baseHandle, CANCEL_HANDLE_ACTION, {
|
|
84
84
|
role: 'button',
|
|
85
85
|
label: confirmDialogCancelLabel(cancelLabel, props.title),
|
|
86
|
-
}), children: cancelLabel }), _jsx("button", { type: "button", className: toneClassName(tone), disabled: props.pending, onClick: props.onConfirm, ...confirmDialogAgentProps(baseHandle, CONFIRM_HANDLE_ACTION, {
|
|
86
|
+
}), children: cancelLabel }), _jsx("button", { type: "button", className: toneClassName(tone), disabled: props.pending, onClick: props.onConfirm, ...confirmDialogAgentProps(agentMayConfirm ? baseHandle : undefined, CONFIRM_HANDLE_ACTION, {
|
|
87
87
|
role: 'button',
|
|
88
88
|
label: confirmDialogConfirmLabel(props.confirmLabel, props.title, tone),
|
|
89
89
|
}), children: props.confirmLabel })] })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/admin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "Composable admin surface for Jini-hosted products: framework-free contracts, panel registry, and route model in `/core`; React shell and panels in `/react`. Import only the layers you need.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"react-dom": "^19.2.0"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@jini-ai/agentic": "0.3.
|
|
85
|
-
"@jini-ai/ui": "0.3.
|
|
84
|
+
"@jini-ai/agentic": "0.3.7",
|
|
85
|
+
"@jini-ai/ui": "0.3.12"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "tsc -p tsconfig.json",
|