@jini-ai/ui 0.6.22 → 0.7.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/CHANGELOG.md +27 -0
- package/dist/features/admin-widgets/components/ImagePreviewModal.d.ts +3 -3
- package/dist/features/admin-widgets/components/ImagePreviewModal.js +3 -1
- package/dist/features/admin-widgets/components/InfoTip.d.ts +2 -2
- package/dist/features/admin-widgets/components/InfoTip.js +3 -1
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.d.ts +2 -2
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.js +3 -1
- package/dist/features/admin-widgets/components/Select/Select.d.ts +2 -2
- package/dist/features/admin-widgets/components/Select/Select.js +12 -8
- package/dist/features/admin-widgets/components/SuggestInput/SuggestInput.d.ts +2 -2
- package/dist/features/admin-widgets/components/SuggestInput/SuggestInput.js +3 -1
- package/dist/features/execution/react/components/SearchableModelSelect.d.ts +5 -5
- package/dist/features/execution/react/components/SearchableModelSelect.js +4 -2
- package/dist/features/interactive-ui/providers/shadcn/checkbox-field.d.ts +3 -2
- package/dist/features/interactive-ui/providers/shadcn/checkbox-field.js +5 -2
- package/dist/features/interactive-ui/providers/shadcn/select-field.d.ts +4 -2
- package/dist/features/interactive-ui/providers/shadcn/select-field.js +9 -2
- package/dist/features/interactive-ui/providers/shadcn/select.d.ts +5 -3
- package/dist/features/interactive-ui/providers/shadcn/select.js +9 -4
- package/dist/features/mcp-ui/cards.d.ts +12 -0
- package/dist/features/mcp-ui/cards.js +8 -0
- package/dist/features/mcp-ui/credential-card.d.ts +34 -0
- package/dist/features/mcp-ui/credential-card.js +42 -0
- package/dist/features/mcp-ui/secret-card.d.ts +2 -16
- package/dist/features/mcp-ui/secret-card.js +4 -1
- package/dist/features/mcp-ui/sign-in-card.d.ts +57 -0
- package/dist/features/mcp-ui/sign-in-card.js +67 -0
- package/dist/features/mcp-ui/surfaces/access-approval.d.ts +15 -0
- package/dist/features/mcp-ui/surfaces/access-approval.js +17 -0
- package/dist/features/mcp-ui/surfaces/bridge.d.ts +2 -8
- package/dist/features/mcp-ui/surfaces/confirmation.d.ts +9 -8
- package/dist/features/mcp-ui/surfaces/confirmation.js +24 -9
- package/dist/features/mcp-ui/surfaces/document.d.ts +18 -27
- package/dist/features/mcp-ui/surfaces/document.js +21 -7
- package/dist/features/mcp-ui/surfaces/fields.d.ts +2 -74
- package/dist/features/mcp-ui/surfaces/form.d.ts +2 -42
- package/dist/features/mcp-ui/surfaces/index.d.ts +1 -0
- package/dist/features/mcp-ui/surfaces/index.js +1 -0
- package/dist/features/mcp-ui/surfaces/outcome.d.ts +2 -39
- package/dist/features/mcp-ui/surfaces/outcome.js +25 -2
- package/dist/features/mcp-ui/surfaces/select.d.ts +2 -7
- package/dist/features/mcp-ui/surfaces/structured-details.d.ts +2 -19
- package/dist/features/mcp-ui/surfaces/text-input.d.ts +2 -5
- package/dist/features/mcp-ui/surfaces/tokens.d.ts +2 -2
- package/dist/features/panel-kit/failure-channel.d.ts +25 -0
- package/dist/features/panel-kit/failure-channel.js +36 -0
- package/dist/features/panel-kit/index.d.ts +2 -0
- package/dist/features/panel-kit/index.js +1 -0
- package/dist/features/site-card/SiteCard.d.ts +40 -0
- package/dist/features/site-card/SiteCard.js +15 -0
- package/dist/features/site-card/SiteListToolbar.d.ts +28 -0
- package/dist/features/site-card/SiteListToolbar.js +15 -0
- package/dist/features/site-card/index.d.ts +5 -0
- package/dist/features/site-card/index.js +5 -0
- package/dist/features/site-card/site-card.css +136 -0
- package/dist/features/site-card/site-list-view.d.ts +53 -0
- package/dist/features/site-card/site-list-view.js +62 -0
- package/dist/features/site-card/use-site-list-view.hooks.d.ts +24 -0
- package/dist/features/site-card/use-site-list-view.hooks.js +26 -0
- package/dist/features/tab-strip/react/components/TabStrip.d.ts +3 -2
- package/dist/features/tab-strip/react/components/TabStrip.js +5 -2
- package/dist/features/tab-strip/react/components/TabStripItem.d.ts +3 -2
- package/dist/features/tab-strip/react/components/TabStripItem.js +5 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/react/components/CustomSelect.d.ts +5 -3
- package/dist/react/components/CustomSelect.js +18 -11
- package/dist/react/components/PillButton.d.ts +3 -2
- package/dist/react/components/PillButton.js +5 -2
- package/dist/react/components/PopoverItem.d.ts +3 -2
- package/dist/react/components/PopoverItem.js +5 -2
- package/dist/react/components/PopoverMenu.d.ts +3 -2
- package/dist/react/components/PopoverMenu.js +5 -2
- package/dist/react/components/SecretInput.d.ts +3 -2
- package/dist/react/components/SecretInput.js +6 -3
- package/dist/react/components/select-popover.d.ts +8 -2
- package/dist/react/components/select-popover.js +8 -3
- package/dist/react/hooks/useAgentHandle.d.ts +17 -0
- package/dist/react/hooks/useAgentHandle.js +17 -0
- package/dist/styles/admin.css +1 -0
- package/package.json +38 -12
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file What the Websites list shows, as plain functions (owner, 2026-11-04): newest first by default,
|
|
3
|
+
* a remembered "Sort by", pinned and recent sites by default with the rest one click away, and a
|
|
4
|
+
* "Hidden" filter. Hiding only leaves the list; the site stays on disk.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_SITE_LIST_PREFS = { sort: "recent", pinned: [], hidden: [] };
|
|
7
|
+
/** How many of the newest sites the default view shows besides the pinned ones. */
|
|
8
|
+
export const SITE_LIST_RECENT_COUNT = 6;
|
|
9
|
+
const SORTS = ["recent", "oldest", "name"];
|
|
10
|
+
function createdTime(item) {
|
|
11
|
+
const time = Date.parse(item.createdAt);
|
|
12
|
+
return Number.isNaN(time) ? 0 : time;
|
|
13
|
+
}
|
|
14
|
+
function byName(a, b) {
|
|
15
|
+
return a.name.localeCompare(b.name, undefined, { sensitivity: "base" }) || a.id.localeCompare(b.id);
|
|
16
|
+
}
|
|
17
|
+
const COMPARE = {
|
|
18
|
+
recent: (a, b) => createdTime(b) - createdTime(a) || byName(a, b),
|
|
19
|
+
oldest: (a, b) => createdTime(a) - createdTime(b) || byName(a, b),
|
|
20
|
+
name: byName,
|
|
21
|
+
};
|
|
22
|
+
function stringList(value) {
|
|
23
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads a stored value; anything malformed falls back to the defaults, so a damaged entry can never
|
|
27
|
+
* blank the list.
|
|
28
|
+
* @returns Valid preferences. @complexity O(n) stored ids.
|
|
29
|
+
*/
|
|
30
|
+
export function parseSiteListPrefs({ stored }, _options = {}) {
|
|
31
|
+
if (typeof stored !== "object" || stored === null)
|
|
32
|
+
return DEFAULT_SITE_LIST_PREFS;
|
|
33
|
+
const value = stored;
|
|
34
|
+
return {
|
|
35
|
+
sort: SORTS.includes(value.sort) ? value.sort : DEFAULT_SITE_LIST_PREFS.sort,
|
|
36
|
+
pinned: stringList(value.pinned),
|
|
37
|
+
hidden: stringList(value.hidden),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The cards for one filter, pinned first and then in the chosen order.
|
|
42
|
+
* @returns The visible items and both counts. @complexity O(n log n) in `items`.
|
|
43
|
+
*/
|
|
44
|
+
export function siteListView({ items, prefs, filter }, _options = {}) {
|
|
45
|
+
const hidden = new Set(items.filter((item) => !item.running).map((item) => item.id).filter((id) => prefs.hidden.includes(id)));
|
|
46
|
+
const pinned = new Set(prefs.pinned);
|
|
47
|
+
const compare = COMPARE[prefs.sort];
|
|
48
|
+
const inOrder = (list) => [...list].sort((a, b) => Number(pinned.has(b.id)) - Number(pinned.has(a.id)) || compare(a, b));
|
|
49
|
+
const shown = items.filter((item) => !hidden.has(item.id));
|
|
50
|
+
const counts = { allCount: shown.length, hiddenCount: items.length - shown.length };
|
|
51
|
+
if (filter === "hidden")
|
|
52
|
+
return { visible: inOrder(items.filter((item) => hidden.has(item.id))), ...counts };
|
|
53
|
+
if (filter === "all")
|
|
54
|
+
return { visible: inOrder(shown), ...counts };
|
|
55
|
+
const newest = new Set([...shown].sort(COMPARE.recent).slice(0, SITE_LIST_RECENT_COUNT).map((item) => item.id));
|
|
56
|
+
return { visible: inOrder(shown.filter((item) => pinned.has(item.id) || newest.has(item.id) || item.running === true)), ...counts };
|
|
57
|
+
}
|
|
58
|
+
/** Adds or removes one id. @returns A new list. @complexity O(n). */
|
|
59
|
+
export function toggleListed({ list, id }, _options = {}) {
|
|
60
|
+
return list.includes(id) ? list.filter((entry) => entry !== id) : [...list, id];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=site-list-view.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SiteListFilter, type SiteListItem, type SiteListPrefs, type SiteListSort, type SiteListView } from "./site-list-view.js";
|
|
2
|
+
export interface SiteListController<Item> extends SiteListView<Item> {
|
|
3
|
+
filter: SiteListFilter;
|
|
4
|
+
setFilter(filter: SiteListFilter): void;
|
|
5
|
+
sort: SiteListSort;
|
|
6
|
+
setSort(sort: SiteListSort): void;
|
|
7
|
+
isPinned(id: string): boolean;
|
|
8
|
+
togglePin(id: string): void;
|
|
9
|
+
isHidden(id: string): boolean;
|
|
10
|
+
toggleHidden(id: string): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The list's current view and its actions. The host owns storing `prefs`, which is what makes them
|
|
14
|
+
* per person; the open filter lasts as long as the page. A "Hidden" filter with nothing left to show
|
|
15
|
+
* falls back to the default view, so showing the last hidden site never strands the person on an
|
|
16
|
+
* empty list.
|
|
17
|
+
* @returns The view and its actions. @complexity O(n log n) per render in `items`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSiteListView<Item extends SiteListItem>({ items, prefs, onPrefsChange }: {
|
|
20
|
+
items: readonly Item[];
|
|
21
|
+
prefs: SiteListPrefs;
|
|
22
|
+
onPrefsChange: (next: SiteListPrefs) => void;
|
|
23
|
+
}, _options?: {}): SiteListController<Item>;
|
|
24
|
+
//# sourceMappingURL=use-site-list-view.hooks.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { siteListView, toggleListed } from "./site-list-view.js";
|
|
3
|
+
/**
|
|
4
|
+
* The list's current view and its actions. The host owns storing `prefs`, which is what makes them
|
|
5
|
+
* per person; the open filter lasts as long as the page. A "Hidden" filter with nothing left to show
|
|
6
|
+
* falls back to the default view, so showing the last hidden site never strands the person on an
|
|
7
|
+
* empty list.
|
|
8
|
+
* @returns The view and its actions. @complexity O(n log n) per render in `items`.
|
|
9
|
+
*/
|
|
10
|
+
export function useSiteListView({ items, prefs, onPrefsChange }, _options = {}) {
|
|
11
|
+
const [chosenFilter, setFilter] = useState("pinned-recent");
|
|
12
|
+
const hiddenLeft = items.some((item) => prefs.hidden.includes(item.id) && !item.running);
|
|
13
|
+
const filter = chosenFilter === "hidden" && !hiddenLeft ? "pinned-recent" : chosenFilter;
|
|
14
|
+
return {
|
|
15
|
+
...siteListView({ items, prefs, filter }),
|
|
16
|
+
filter,
|
|
17
|
+
setFilter,
|
|
18
|
+
sort: prefs.sort,
|
|
19
|
+
setSort: (sort) => onPrefsChange({ ...prefs, sort }),
|
|
20
|
+
isPinned: (id) => prefs.pinned.includes(id),
|
|
21
|
+
togglePin: (id) => onPrefsChange({ ...prefs, pinned: toggleListed({ list: prefs.pinned, id }) }),
|
|
22
|
+
isHidden: (id) => prefs.hidden.includes(id),
|
|
23
|
+
toggleHidden: (id) => onPrefsChange({ ...prefs, hidden: toggleListed({ list: prefs.hidden, id }) }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=use-site-list-view.hooks.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type AgentControlProps } from '../../../../react/hooks/useAgentHandle.js';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { TabStripHapticsPort } from '../../ports.js';
|
|
3
4
|
import type { TabStripDropEdge, TabStripReorderTiming, TabStripTab } from '../../types.js';
|
|
4
5
|
import { useTabStripDragReorder } from '../hooks/useTabStripDragReorder.js';
|
|
5
|
-
export interface TabStripProps {
|
|
6
|
+
export interface TabStripProps extends AgentControlProps {
|
|
6
7
|
tabs: TabStripTab[];
|
|
7
8
|
activeTabId: string | null;
|
|
8
9
|
onActivate: (tabId: string) => void;
|
|
@@ -36,5 +37,5 @@ export interface TabStripProps {
|
|
|
36
37
|
* all `WorkspaceTabsBar.tsx`-only chrome that remain host-composed, not
|
|
37
38
|
* part of this primitive).
|
|
38
39
|
*/
|
|
39
|
-
export declare function TabStrip({ tabs, activeTabId, onActivate, onClose, onReorder, reorderTiming, haptics, closeLabel, closeIcon, trailing, ariaLabel, className, useTabStripDragReorder: useTabStripDragReorderHook, }: TabStripProps): import("react").JSX.Element;
|
|
40
|
+
export declare function TabStrip({ tabs, activeTabId, onActivate, onClose, onReorder, reorderTiming, haptics, closeLabel, closeIcon, trailing, ariaLabel, className, useTabStripDragReorder: useTabStripDragReorderHook, ...agentProps }: TabStripProps): import("react").JSX.Element;
|
|
40
41
|
//# sourceMappingURL=TabStrip.d.ts.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { agentHandleSegment } from '@jini-ai/agentic';
|
|
3
|
+
import { useAgentHandle } from '../../../../react/hooks/useAgentHandle.js';
|
|
2
4
|
import { noopTabStripHaptics } from '../../ports.js';
|
|
3
5
|
import { useTabStripDragReorder } from '../hooks/useTabStripDragReorder.js';
|
|
4
6
|
import { TabStripItem } from './TabStripItem.js';
|
|
@@ -17,13 +19,14 @@ import { TabStripFrame } from './TabStripFrame.js';
|
|
|
17
19
|
* all `WorkspaceTabsBar.tsx`-only chrome that remain host-composed, not
|
|
18
20
|
* part of this primitive).
|
|
19
21
|
*/
|
|
20
|
-
export function TabStrip({ tabs, activeTabId, onActivate, onClose, onReorder, reorderTiming, haptics = noopTabStripHaptics, closeLabel, closeIcon, trailing, ariaLabel, className, useTabStripDragReorder: useTabStripDragReorderHook = useTabStripDragReorder, }) {
|
|
22
|
+
export function TabStrip({ tabs, activeTabId, onActivate, onClose, onReorder, reorderTiming, haptics = noopTabStripHaptics, closeLabel, closeIcon, trailing, ariaLabel, className, useTabStripDragReorder: useTabStripDragReorderHook = useTabStripDragReorder, ...agentProps }) {
|
|
23
|
+
const base = useAgentHandle(agentProps);
|
|
21
24
|
const { draggingTabId, dragOverTarget, stripRef, stripDragProps, getItemDragProps } = useTabStripDragReorderHook({
|
|
22
25
|
tabs,
|
|
23
26
|
onReorder,
|
|
24
27
|
reorderTiming,
|
|
25
28
|
haptics,
|
|
26
29
|
});
|
|
27
|
-
return (_jsxs(TabStripFrame, { className: ['jini-tab-strip', className].filter(Boolean).join(' '), role: "tablist", "aria-label": ariaLabel, ref: stripRef, onDragOver: stripDragProps.onDragOver, onDrop: stripDragProps.onDrop, onDragLeave: stripDragProps.onDragLeave, children: [tabs.map((tab) => (_jsx(TabStripItem, { tab: tab, active: tab.id === activeTabId, dragging: draggingTabId === tab.id, dragOverEdge: dragOverTarget?.tabId === tab.id && draggingTabId !== tab.id ? dragOverTarget.edge : null, dragProps: getItemDragProps(tab.id), onActivate: onActivate, onClose: onClose, closeLabel: closeLabel, closeIcon: closeIcon }, tab.id))), trailing] }));
|
|
30
|
+
return (_jsxs(TabStripFrame, { className: ['jini-tab-strip', className].filter(Boolean).join(' '), role: "tablist", "aria-label": ariaLabel, ref: stripRef, onDragOver: stripDragProps.onDragOver, onDrop: stripDragProps.onDrop, onDragLeave: stripDragProps.onDragLeave, children: [tabs.map((tab) => (_jsx(TabStripItem, { agentHandle: base ? `${base}-tab-${agentHandleSegment({ value: tab.id })}` : false, "data-agent-page": agentProps['data-agent-page'], tab: tab, active: tab.id === activeTabId, dragging: draggingTabId === tab.id, dragOverEdge: dragOverTarget?.tabId === tab.id && draggingTabId !== tab.id ? dragOverTarget.edge : null, dragProps: getItemDragProps(tab.id), onActivate: onActivate, onClose: onClose, closeLabel: closeLabel, closeIcon: closeIcon }, tab.id))), trailing] }));
|
|
28
31
|
}
|
|
29
32
|
//# sourceMappingURL=TabStrip.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type AgentControlProps } from '../../../../react/hooks/useAgentHandle.js';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { TabStripDropEdge, TabStripTab } from '../../types.js';
|
|
3
4
|
import type { TabStripItemDragProps } from '../hooks/useTabStripDragReorder.js';
|
|
4
|
-
export interface TabStripItemProps {
|
|
5
|
+
export interface TabStripItemProps extends AgentControlProps {
|
|
5
6
|
tab: TabStripTab;
|
|
6
7
|
active: boolean;
|
|
7
8
|
dragging: boolean;
|
|
@@ -26,5 +27,5 @@ export interface TabStripItemProps {
|
|
|
26
27
|
* purpose is redundant once the outer element itself is focusable/
|
|
27
28
|
* keyboard-activatable, so this follows the simpler of the two shapes).
|
|
28
29
|
*/
|
|
29
|
-
export declare function TabStripItem({ tab, active, dragging, dragOverEdge, dragProps, onActivate, onClose, closeLabel, closeIcon, }: TabStripItemProps): import("react").JSX.Element;
|
|
30
|
+
export declare function TabStripItem({ tab, active, dragging, dragOverEdge, dragProps, onActivate, onClose, closeLabel, closeIcon, ...agentProps }: TabStripItemProps): import("react").JSX.Element;
|
|
30
31
|
//# sourceMappingURL=TabStripItem.d.ts.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { agentHandleProps } from '@jini-ai/agentic';
|
|
3
|
+
import { useAgentHandle } from '../../../../react/hooks/useAgentHandle.js';
|
|
2
4
|
import { useT } from '../../../i18n/index.js';
|
|
3
5
|
import { TAB_STRIP_ITEM_ID_ATTRIBUTE } from '../../constants.js';
|
|
4
6
|
import { isTabClosable } from '../../rules.js';
|
|
@@ -14,7 +16,8 @@ import { isTabClosable } from '../../rules.js';
|
|
|
14
16
|
* purpose is redundant once the outer element itself is focusable/
|
|
15
17
|
* keyboard-activatable, so this follows the simpler of the two shapes).
|
|
16
18
|
*/
|
|
17
|
-
export function TabStripItem({ tab, active, dragging, dragOverEdge, dragProps, onActivate, onClose, closeLabel, closeIcon, }) {
|
|
19
|
+
export function TabStripItem({ tab, active, dragging, dragOverEdge, dragProps, onActivate, onClose, closeLabel, closeIcon, ...agentProps }) {
|
|
20
|
+
const base = useAgentHandle(agentProps);
|
|
18
21
|
const t = useT();
|
|
19
22
|
const resolvedCloseLabel = closeLabel ?? t('Close tab');
|
|
20
23
|
const showClose = isTabClosable(tab, Boolean(onClose));
|
|
@@ -43,6 +46,6 @@ export function TabStripItem({ tab, active, dragging, dragOverEdge, dragProps, o
|
|
|
43
46
|
]
|
|
44
47
|
.filter(Boolean)
|
|
45
48
|
.join(' ');
|
|
46
|
-
return (_jsxs("div", { className: className, [TAB_STRIP_ITEM_ID_ATTRIBUTE]: tab.id, role: "tab", "aria-selected": active, tabIndex: 0, title: tab.title, draggable: dragProps.draggable, onDragStart: dragProps.onDragStart, onDragEnd: dragProps.onDragEnd, onClick: handleClick, onKeyDown: handleKeyDown, children: [_jsx("div", { className: "jini-tab-strip-item__content", children: tab.content }), showClose ? (_jsx("button", { type: "button", className: "jini-tab-strip-item__close", "aria-label": resolvedCloseLabel, title: resolvedCloseLabel, onClick: handleClose, children: closeIcon ?? '×' })) : null] }));
|
|
49
|
+
return (_jsxs("div", { className: className, ...agentHandleProps({}, { base, role: 'button', ...(tab.title === undefined ? {} : { label: tab.title }) }), "data-agent-private": agentProps['data-agent-private'], "data-agent-page": agentProps['data-agent-page'], [TAB_STRIP_ITEM_ID_ATTRIBUTE]: tab.id, role: "tab", "aria-selected": active, tabIndex: 0, title: tab.title, draggable: dragProps.draggable, onDragStart: dragProps.onDragStart, onDragEnd: dragProps.onDragEnd, onClick: handleClick, onKeyDown: handleKeyDown, children: [_jsx("div", { className: "jini-tab-strip-item__content", children: tab.content }), showClose ? (_jsx("button", { ...agentHandleProps({}, { base, action: 'close', role: 'button', label: resolvedCloseLabel }), type: "button", className: "jini-tab-strip-item__close", "aria-label": resolvedCloseLabel, title: resolvedCloseLabel, onClick: handleClose, children: closeIcon ?? '×' })) : null] }));
|
|
47
50
|
}
|
|
48
51
|
//# sourceMappingURL=TabStripItem.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export * from './utils/scroll-tabs-with-wheel.js';
|
|
|
94
94
|
export * from './utils/color-math.js';
|
|
95
95
|
export * from './utils/design-md.js';
|
|
96
96
|
export * from './utils/file-system-errors.js';
|
|
97
|
+
export { useAgentHandle, type AgentControlProps } from './react/hooks/useAgentHandle.js';
|
|
97
98
|
export * from './react/hooks/useInView.js';
|
|
98
99
|
export * from './react/hooks/useCoalescedCallback.js';
|
|
99
100
|
export * from './react/hooks/useStableHandler.js';
|
|
@@ -137,4 +138,5 @@ export * from './react/components/EditorIcon.js';
|
|
|
137
138
|
export * from './react/components/TokenChip.js';
|
|
138
139
|
export * from './react/components/ValueChip.js';
|
|
139
140
|
export * from './react/components/ComponentKitPreview.js';
|
|
141
|
+
export { useOverlayContainer } from '@jini-ai/ui-kit/react';
|
|
140
142
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,7 @@ export * from './utils/design-md.js';
|
|
|
98
98
|
// import. `@jini-ai/chat`'s `./react` subpath needs `FILE_SYSTEM_READ_ERROR_MESSAGE` for a test
|
|
99
99
|
// assertion now that it's an external package rather than living inside `ui`.
|
|
100
100
|
export * from './utils/file-system-errors.js';
|
|
101
|
+
export { useAgentHandle } from './react/hooks/useAgentHandle.js';
|
|
101
102
|
export * from './react/hooks/useInView.js';
|
|
102
103
|
export * from './react/hooks/useCoalescedCallback.js';
|
|
103
104
|
export * from './react/hooks/useStableHandler.js';
|
|
@@ -144,4 +145,6 @@ export * from './react/components/EditorIcon.js';
|
|
|
144
145
|
export * from './react/components/TokenChip.js';
|
|
145
146
|
export * from './react/components/ValueChip.js';
|
|
146
147
|
export * from './react/components/ComponentKitPreview.js';
|
|
148
|
+
// Share the existing kit overlay context with consumers of these React primitives.
|
|
149
|
+
export { useOverlayContainer } from '@jini-ai/ui-kit/react';
|
|
147
150
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { KeyboardEvent, MutableRefObject, ReactNode } from 'react';
|
|
2
|
+
import { type AgentControlProps } from '../hooks/useAgentHandle.js';
|
|
2
3
|
export interface CustomSelectOption {
|
|
3
4
|
value: string;
|
|
4
5
|
label: string;
|
|
@@ -9,7 +10,7 @@ export interface CustomSelectGroup {
|
|
|
9
10
|
options: CustomSelectOption[];
|
|
10
11
|
}
|
|
11
12
|
export type CustomSelectItem = CustomSelectOption | CustomSelectGroup;
|
|
12
|
-
export interface CustomSelectProps {
|
|
13
|
+
export interface CustomSelectProps extends AgentControlProps {
|
|
13
14
|
value: string;
|
|
14
15
|
options: CustomSelectItem[];
|
|
15
16
|
onChange: (value: string) => void;
|
|
@@ -200,10 +201,11 @@ export declare function useCustomSelectOriginTheme({ buttonRef, open, portal }:
|
|
|
200
201
|
* {@link useCustomSelect}; this component only wires the hook's state to the
|
|
201
202
|
* trigger button and the listbox menu.
|
|
202
203
|
*/
|
|
203
|
-
export declare function CustomSelect({ value, options, onChange, ariaLabel, labelledBy, className, triggerClassName, menuClassName, disabled, placeholder, portal, portalContainer, title, onFocus, menuHeader, onOpenChange, useCustomSelect: useCustomSelectHook, }: CustomSelectProps): import("react").JSX.Element;
|
|
204
|
+
export declare function CustomSelect({ value, options, onChange, ariaLabel, labelledBy, className, triggerClassName, menuClassName, disabled, placeholder, portal, portalContainer, title, onFocus, menuHeader, onOpenChange, useCustomSelect: useCustomSelectHook, ...agentProps }: CustomSelectProps): import("react").JSX.Element;
|
|
204
205
|
/** One row in the listbox: a selectable option button that reports hover
|
|
205
206
|
* (activation) and click (choice) back to {@link CustomSelect}. */
|
|
206
|
-
export declare function CustomSelectOptionButton({ option, selected, active, id, onChoose, onActive, }: {
|
|
207
|
+
export declare function CustomSelectOptionButton({ option, selected, active, id, onChoose, onActive, agentHandle, }: {
|
|
208
|
+
agentHandle?: string | false | undefined;
|
|
207
209
|
option: CustomSelectOption;
|
|
208
210
|
selected: boolean;
|
|
209
211
|
active: boolean;
|
|
@@ -10,8 +10,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
// `CustomSelectOptionButton` leaf, and the dumb `CustomSelect` render.
|
|
11
11
|
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import { createPortal } from 'react-dom';
|
|
13
|
-
import {
|
|
13
|
+
import { useOverlayContainer } from '@jini-ai/ui-kit/react';
|
|
14
|
+
import { useSelectPopover, isSelectEventInside, openSelectOnKey, applySelectNavigationKey, resolveSelectPortalContainer, resolveSelectOriginPage } from './select-popover.js';
|
|
14
15
|
import { Icon } from './Icon.js';
|
|
16
|
+
import { agentHandleProps, agentHandleSegment } from '@jini-ai/agentic';
|
|
17
|
+
import { useAgentHandle } from '../hooks/useAgentHandle.js';
|
|
15
18
|
/** Space between the trigger and the menu. */
|
|
16
19
|
export const CUSTOM_SELECT_MENU_GAP = 4;
|
|
17
20
|
/** Minimum distance the menu keeps from any viewport edge. */
|
|
@@ -262,14 +265,14 @@ function customSelectMenuStyle({ portal, position }) {
|
|
|
262
265
|
: undefined;
|
|
263
266
|
}
|
|
264
267
|
/** Where an open menu renders: inline, or portalled only after its first measurement. */
|
|
265
|
-
function mountCustomSelectMenu({ menu, portal, position, trigger }, { container } = {}) {
|
|
268
|
+
function mountCustomSelectMenu({ menu, portal, position, trigger }, { container, fallbackContainer } = {}) {
|
|
266
269
|
if (!portal)
|
|
267
270
|
return menu;
|
|
268
|
-
return position ? createPortal(menu, resolveSelectPortalContainer({ trigger }, { container })) : null;
|
|
271
|
+
return position ? createPortal(menu, resolveSelectPortalContainer({ trigger }, { container, fallbackContainer })) : null;
|
|
269
272
|
}
|
|
270
273
|
/** The listbox rows: groups render a labelled block of option buttons, flat options render directly. */
|
|
271
|
-
function CustomSelectMenuOptions({ options, value, activeValue, optionIdByValue, onChoose, onActive }) {
|
|
272
|
-
const renderOption = (option) => (_jsx(CustomSelectOptionButton, { option: option, selected: option.value === value, active: option.value === activeValue, id: optionIdByValue.get(option.value), onChoose: onChoose, onActive: onActive }, option.value));
|
|
274
|
+
function CustomSelectMenuOptions({ options, value, activeValue, optionIdByValue, onChoose, onActive, base }) {
|
|
275
|
+
const renderOption = (option) => (_jsx(CustomSelectOptionButton, { option: option, agentHandle: base ? `${base}-option-${agentHandleSegment({ value: option.value })}` : false, selected: option.value === value, active: option.value === activeValue, id: optionIdByValue.get(option.value), onChoose: onChoose, onActive: onActive }, option.value));
|
|
273
276
|
return (_jsx(_Fragment, { children: options.map((item) => (isCustomSelectGroup(item) ? (_jsxs("div", { className: "jini-select-group", children: [_jsx("div", { className: "jini-select-group-label", children: item.label }), item.options.map(renderOption)] }, `group:${item.label}`)) : renderOption(item))) }));
|
|
274
277
|
}
|
|
275
278
|
/**
|
|
@@ -278,20 +281,24 @@ function CustomSelectMenuOptions({ options, value, activeValue, optionIdByValue,
|
|
|
278
281
|
* {@link useCustomSelect}; this component only wires the hook's state to the
|
|
279
282
|
* trigger button and the listbox menu.
|
|
280
283
|
*/
|
|
281
|
-
export function CustomSelect({ value, options, onChange, ariaLabel, labelledBy, className, triggerClassName, menuClassName, disabled = false, placeholder, portal = true, portalContainer, title, onFocus, menuHeader, onOpenChange, useCustomSelect: useCustomSelectHook = useCustomSelect, }) {
|
|
284
|
+
export function CustomSelect({ value, options, onChange, ariaLabel, labelledBy, className, triggerClassName, menuClassName, disabled = false, placeholder, portal = true, portalContainer, title, onFocus, menuHeader, onOpenChange, useCustomSelect: useCustomSelectHook = useCustomSelect, ...agentProps }) {
|
|
282
285
|
const { idBase, buttonRef, menuRef, open, activeValue, position, selectedLabel, optionIdByValue, activeOptionId, choose, setActiveValue, toggleOpen, onButtonKeyDown, onMenuKeyDown, } = useCustomSelectHook({ value, options, onChange, portal, placeholder, onOpenChange });
|
|
286
|
+
const base = useAgentHandle(agentProps);
|
|
287
|
+
const overlayContainer = useOverlayContainer({});
|
|
288
|
+
const originPage = agentProps['data-agent-page'] ?? resolveSelectOriginPage({ trigger: buttonRef.current });
|
|
283
289
|
const originTheme = useCustomSelectOriginTheme({ buttonRef, open, portal });
|
|
284
|
-
const menu = (_jsxs("div", { ref: menuRef, id: `${idBase}-menu`, onKeyDown: onMenuKeyDown, ...originTheme, className: [
|
|
290
|
+
const menu = (_jsxs("div", { ref: menuRef, id: `${idBase}-menu`, onKeyDown: onMenuKeyDown, ...originTheme, "data-agent-page": originPage, "data-agent-private": agentProps['data-agent-private'], className: [
|
|
285
291
|
'jini-select-menu',
|
|
286
292
|
portal ? 'portal' : 'inline',
|
|
287
293
|
menuClassName,
|
|
288
|
-
].filter(Boolean).join(' '), role: "listbox", "aria-label": ariaLabel, style: customSelectMenuStyle({ portal, position }), children: [menuHeader, _jsx(CustomSelectMenuOptions, { options: options, value: value, activeValue: activeValue, optionIdByValue: optionIdByValue, onChoose: choose, onActive: setActiveValue })] }));
|
|
289
|
-
return (_jsxs("div", { className: ['jini-select', className].filter(Boolean).join(' '), children: [_jsxs("button", { ref: buttonRef, type: "button", className: ['jini-select-trigger', triggerClassName].filter(Boolean).join(' '), role: "combobox", value: value, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": `${idBase}-menu`, "aria-activedescendant": activeOptionId, "aria-describedby": labelledBy, "aria-label": `${ariaLabel}: ${selectedLabel}`, disabled: disabled, title: title, onClick: toggleOpen, onKeyDown: onButtonKeyDown, onFocus: onFocus, children: [_jsx("span", { id: `${idBase}-value`, className: "jini-select-value", children: selectedLabel }), _jsx(Icon, { name: "chevron-down", size: 14 })] }), open ? mountCustomSelectMenu({ menu, portal, position, trigger: buttonRef.current }, { container: portalContainer }) : null] }));
|
|
294
|
+
].filter(Boolean).join(' '), role: "listbox", "aria-label": ariaLabel, style: customSelectMenuStyle({ portal, position }), children: [menuHeader, _jsx(CustomSelectMenuOptions, { base: base, options: options, value: value, activeValue: activeValue, optionIdByValue: optionIdByValue, onChoose: choose, onActive: setActiveValue })] }));
|
|
295
|
+
return (_jsxs("div", { className: ['jini-select', className].filter(Boolean).join(' '), children: [_jsxs("button", { ref: buttonRef, ...agentHandleProps({}, { base, role: 'field', label: ariaLabel }), "data-agent-private": agentProps['data-agent-private'], "data-agent-page": agentProps['data-agent-page'], type: "button", className: ['jini-select-trigger', triggerClassName].filter(Boolean).join(' '), role: "combobox", value: value, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": `${idBase}-menu`, "aria-activedescendant": activeOptionId, "aria-describedby": labelledBy, "aria-label": `${ariaLabel}: ${selectedLabel}`, disabled: disabled, title: title, onClick: toggleOpen, onKeyDown: onButtonKeyDown, onFocus: onFocus, children: [_jsx("span", { id: `${idBase}-value`, className: "jini-select-value", children: selectedLabel }), _jsx(Icon, { name: "chevron-down", size: 14 })] }), open ? mountCustomSelectMenu({ menu, portal, position, trigger: buttonRef.current }, { container: portalContainer, fallbackContainer: overlayContainer }) : null] }));
|
|
290
296
|
}
|
|
291
297
|
/** One row in the listbox: a selectable option button that reports hover
|
|
292
298
|
* (activation) and click (choice) back to {@link CustomSelect}. */
|
|
293
|
-
export function CustomSelectOptionButton({ option, selected, active, id, onChoose, onActive, }) {
|
|
294
|
-
|
|
299
|
+
export function CustomSelectOptionButton({ option, selected, active, id, onChoose, onActive, agentHandle, }) {
|
|
300
|
+
const base = useAgentHandle({ agentHandle });
|
|
301
|
+
return (_jsxs("button", { ...agentHandleProps({}, { base, role: 'button', label: option.label }), id: id, type: "button", className: [
|
|
295
302
|
'jini-select-option',
|
|
296
303
|
selected ? 'selected' : '',
|
|
297
304
|
active ? 'active' : '',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import { type AgentControlProps } from '../hooks/useAgentHandle.js';
|
|
3
|
+
export interface PillButtonProps extends AgentControlProps {
|
|
3
4
|
/** Rendered before the label. Any host-supplied icon element. */
|
|
4
5
|
icon?: ReactNode;
|
|
5
6
|
/** Pill label. Usually plain text, but accepts a node so a caller can
|
|
@@ -29,5 +30,5 @@ export interface PillButtonProps {
|
|
|
29
30
|
* Origin: `PillButton` from the vendored schedule/mention god-component
|
|
30
31
|
* (recon r6 §1.19) — generic popover-trigger chrome, no product types.
|
|
31
32
|
*/
|
|
32
|
-
export declare function PillButton({ icon, label, active, 'aria-label': ariaLabel, trailingIcon, onClick, disabled, className, children, }: PillButtonProps): import("react").JSX.Element;
|
|
33
|
+
export declare function PillButton({ icon, label, active, 'aria-label': ariaLabel, trailingIcon, onClick, disabled, className, children, agentHandle, 'data-agent-element': suppliedHandle, 'data-agent-private': privateControl, 'data-agent-page': page, }: PillButtonProps): import("react").JSX.Element;
|
|
33
34
|
//# sourceMappingURL=PillButton.d.ts.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { agentHandleProps } from '@jini-ai/agentic';
|
|
3
|
+
import { useAgentHandle } from '../hooks/useAgentHandle.js';
|
|
2
4
|
import { withClassName } from '../../utils/class-names.js';
|
|
3
5
|
/**
|
|
4
6
|
* Generic labeled trigger pill: icon + label (+ optional trailing icon),
|
|
@@ -9,7 +11,8 @@ import { withClassName } from '../../utils/class-names.js';
|
|
|
9
11
|
* Origin: `PillButton` from the vendored schedule/mention god-component
|
|
10
12
|
* (recon r6 §1.19) — generic popover-trigger chrome, no product types.
|
|
11
13
|
*/
|
|
12
|
-
export function PillButton({ icon, label, active = false, 'aria-label': ariaLabel, trailingIcon, onClick, disabled = false, className, children, }) {
|
|
13
|
-
|
|
14
|
+
export function PillButton({ icon, label, active = false, 'aria-label': ariaLabel, trailingIcon, onClick, disabled = false, className, children, agentHandle, 'data-agent-element': suppliedHandle, 'data-agent-private': privateControl, 'data-agent-page': page, }) {
|
|
15
|
+
const base = useAgentHandle({ agentHandle, 'data-agent-element': suppliedHandle, 'data-agent-private': privateControl });
|
|
16
|
+
return (_jsxs("div", { className: withClassName('jini-pill-wrap', className), children: [_jsxs("button", { ...agentHandleProps({}, { base, role: 'button', label: ariaLabel ?? (typeof label === 'string' ? label : 'Action') }), "data-agent-private": privateControl, "data-agent-page": page, type: "button", className: `jini-pill${active ? ' is-active' : ''}`, "aria-label": ariaLabel, "aria-expanded": children ? active : undefined, onClick: onClick, disabled: disabled, children: [icon, _jsx("span", { className: "jini-pill__label", children: label }), trailingIcon] }), children] }));
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=PillButton.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import { type AgentControlProps } from '../hooks/useAgentHandle.js';
|
|
3
|
+
export interface PopoverItemProps extends AgentControlProps {
|
|
3
4
|
selected?: boolean;
|
|
4
5
|
/** Rendered when `selected` — typically a check icon. Omit for a plain
|
|
5
6
|
* text-only item with no selection affordance. */
|
|
@@ -20,5 +21,5 @@ export interface PopoverItemProps {
|
|
|
20
21
|
* Origin: `PopoverItem` from the vendored schedule/mention god-component
|
|
21
22
|
* (recon r6 §1.19) — generic, no product types.
|
|
22
23
|
*/
|
|
23
|
-
export declare function PopoverItem({ selected, selectedIcon, label, hint, onClick, title }: PopoverItemProps): import("react").JSX.Element;
|
|
24
|
+
export declare function PopoverItem({ selected, selectedIcon, label, hint, onClick, title, ...agentProps }: PopoverItemProps): import("react").JSX.Element;
|
|
24
25
|
//# sourceMappingURL=PopoverItem.d.ts.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { agentHandleProps } from '@jini-ai/agentic';
|
|
3
|
+
import { useAgentHandle } from '../hooks/useAgentHandle.js';
|
|
2
4
|
/**
|
|
3
5
|
* Generic single-select-style menu row: an optional selected-check slot,
|
|
4
6
|
* a label, and an optional secondary hint line. Props in, JSX out.
|
|
@@ -6,7 +8,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
8
|
* Origin: `PopoverItem` from the vendored schedule/mention god-component
|
|
7
9
|
* (recon r6 §1.19) — generic, no product types.
|
|
8
10
|
*/
|
|
9
|
-
export function PopoverItem({ selected = false, selectedIcon, label, hint, onClick, title }) {
|
|
10
|
-
|
|
11
|
+
export function PopoverItem({ selected = false, selectedIcon, label, hint, onClick, title, ...agentProps }) {
|
|
12
|
+
const base = useAgentHandle(agentProps);
|
|
13
|
+
return (_jsxs("button", { ...agentHandleProps({}, { base, role: 'button', label }), "data-agent-private": agentProps['data-agent-private'], "data-agent-page": agentProps['data-agent-page'], type: "button", className: `jini-popover__item${selected ? ' is-selected' : ''}`, onClick: onClick, title: title, children: [_jsx("span", { className: "jini-popover__check", children: selected ? selectedIcon : null }), _jsxs("span", { className: "jini-popover__body", children: [_jsx("span", { className: "jini-popover__label", children: label }), hint ? _jsx("span", { className: "jini-popover__hint", children: hint }) : null] })] }));
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=PopoverItem.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import type { AgentControlProps } from '../hooks/useAgentHandle.js';
|
|
3
|
+
export interface PopoverMenuProps extends AgentControlProps {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
className?: string;
|
|
5
6
|
}
|
|
@@ -11,5 +12,5 @@ export interface PopoverMenuProps {
|
|
|
11
12
|
* Origin: `PopoverMenu` from the vendored schedule/mention god-component
|
|
12
13
|
* (recon r6 §1.19) — generic, no product types.
|
|
13
14
|
*/
|
|
14
|
-
export declare function PopoverMenu({ children, className }: PopoverMenuProps): import("react").JSX.Element;
|
|
15
|
+
export declare function PopoverMenu({ children, className, ...agentProps }: PopoverMenuProps): import("react").JSX.Element;
|
|
15
16
|
//# sourceMappingURL=PopoverMenu.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { agentHandleProps } from '@jini-ai/agentic';
|
|
2
3
|
import { withClassName } from '../../utils/class-names.js';
|
|
3
4
|
/**
|
|
4
5
|
* Generic popover panel shell: a plain positioned wrapper around a list of
|
|
@@ -8,7 +9,9 @@ import { withClassName } from '../../utils/class-names.js';
|
|
|
8
9
|
* Origin: `PopoverMenu` from the vendored schedule/mention god-component
|
|
9
10
|
* (recon r6 §1.19) — generic, no product types.
|
|
10
11
|
*/
|
|
11
|
-
export function PopoverMenu({ children, className }) {
|
|
12
|
-
|
|
12
|
+
export function PopoverMenu({ children, className, ...agentProps }) {
|
|
13
|
+
const base = agentProps.agentHandle === false || agentProps['data-agent-private'] !== undefined
|
|
14
|
+
? undefined : agentProps.agentHandle ?? agentProps['data-agent-element'];
|
|
15
|
+
return _jsx("div", { ...agentHandleProps({}, { base, role: 'region' }), "data-agent-private": agentProps['data-agent-private'], "data-agent-page": agentProps['data-agent-page'], className: withClassName('jini-popover', className), children: children });
|
|
13
16
|
}
|
|
14
17
|
//# sourceMappingURL=PopoverMenu.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* @file The shared masked input: a password/token/key `<input>` with an eye toggle inside its right
|
|
4
|
-
* edge. Drop-in for `<input type="password">` —
|
|
4
|
+
* edge. Drop-in for `<input type="password">` — ordinary input props pass through; agent
|
|
5
|
+
* addressing is excluded and privacy remains enforced after reveal.
|
|
5
6
|
*
|
|
6
7
|
* Same markup and classes as `@jini-ai/ui-kit`'s password `TextField` and the mcp-ui secret fields
|
|
7
8
|
* (`.jini-secret` / `.jini-secret-toggle`), so one host stylesheet styles all of them; hosts own
|
|
@@ -25,7 +26,7 @@ interface SecretToggleProps {
|
|
|
25
26
|
readonly show: string;
|
|
26
27
|
readonly hide: string;
|
|
27
28
|
};
|
|
28
|
-
/** Extra attributes for the toggle button
|
|
29
|
+
/** Extra ordinary attributes for the toggle button; agent addressing is always excluded. */
|
|
29
30
|
readonly toggleAttrs?: Readonly<Record<string, string | boolean | undefined>>;
|
|
30
31
|
/** Controlled mode: the host owns the shown/hidden state. */
|
|
31
32
|
readonly revealed?: boolean;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { SecretInput as KitSecretInput } from '@jini-ai/ui-kit/react';
|
|
4
|
+
import { secretControlAttrs } from '@jini-ai/ui-kit';
|
|
4
5
|
import { useT } from '../../features/i18n/index.js';
|
|
5
6
|
import { Icon } from './Icon.js';
|
|
6
7
|
import { useSecretReveal } from './SecretInput.hooks.js';
|
|
7
|
-
/** Reveal state + the eye button, shared by `SecretInput` and `SecretTextarea`.
|
|
8
|
+
/** Reveal state + the private eye button, shared by `SecretInput` and `SecretTextarea`.
|
|
9
|
+
* @complexity O(p) time and space in toggle props; no I/O.
|
|
10
|
+
* @overallScore 100 */
|
|
8
11
|
function useSecretToggle({ label, toggleLabels, toggleAttrs, revealed, onRevealedChange }, { value, disabled } = {}) {
|
|
9
12
|
const t = useT();
|
|
10
13
|
const reveal = useSecretReveal({ value, labels: toggleLabels ?? { show: `${t('Show')} ${label}`, hide: `${t('Hide')} ${label}` } }, { ...(revealed === undefined ? {} : { revealed }), ...(onRevealedChange ? { onRevealedChange } : {}) });
|
|
11
14
|
// One signal only: the name flips Show/Hide, so no `aria-pressed` — both together made screen
|
|
12
15
|
// readers announce "Hide API key, toggle button, pressed" (Opus UI review 2026-10-26).
|
|
13
|
-
const button = (_jsx("button", { ...toggleAttrs, type: "button", className: "jini-secret-toggle", "aria-label": reveal.toggleLabel, title: reveal.toggleLabel, disabled: disabled, onClick: reveal.toggle, children: _jsx(Icon, { name: reveal.revealed ? 'eye-off' : 'eye', size: 18 }) }));
|
|
16
|
+
const button = (_jsx("button", { ...secretControlAttrs({ attrs: toggleAttrs ?? {} }), type: "button", className: "jini-secret-toggle", "aria-label": reveal.toggleLabel, title: reveal.toggleLabel, disabled: disabled, onClick: reveal.toggle, children: _jsx(Icon, { name: reveal.revealed ? 'eye-off' : 'eye', size: 18 }) }));
|
|
14
17
|
return { reveal, button };
|
|
15
18
|
}
|
|
16
19
|
export const SecretInput = forwardRef(function SecretInput(props, ref) {
|
|
@@ -26,6 +29,6 @@ export const SecretTextarea = forwardRef(function SecretTextarea(props, ref) {
|
|
|
26
29
|
/* Not a standard CSS property, so it is set here rather than left to a host stylesheet: a host
|
|
27
30
|
that forgot it would show the secret in clear text. pre-wrap keeps line breaks while masked. */
|
|
28
31
|
const masked = { ...style, ...{ WebkitTextSecurity: reveal.revealed || replacementShown ? 'none' : 'disc' }, whiteSpace: 'pre-wrap' };
|
|
29
|
-
return (_jsxs("span", { className: "jini-secret jini-secret--multiline", children: [_jsx("textarea", { ...textareaProps, ...(replacementShown ? { value: maskedValue, readOnly: true } : {}), spellCheck: false, ref: ref, style: masked }), button] }));
|
|
32
|
+
return (_jsxs("span", { className: "jini-secret jini-secret--multiline", children: [_jsx("textarea", { ...secretControlAttrs({ attrs: textareaProps }), ...(replacementShown ? { value: maskedValue, readOnly: true } : {}), spellCheck: false, ref: ref, style: masked }), button] }));
|
|
30
33
|
});
|
|
31
34
|
//# sourceMappingURL=SecretInput.js.map
|
|
@@ -11,12 +11,18 @@ export declare function resolveTabTarget({ panel, trigger, shiftKey }: {
|
|
|
11
11
|
trigger: HTMLElement | null;
|
|
12
12
|
shiftKey: boolean;
|
|
13
13
|
}, _optional?: Record<string, never>): HTMLElement | null;
|
|
14
|
-
/**
|
|
14
|
+
/** Explicit destinations win; otherwise keep native-dialog ownership before a host kit overlay. */
|
|
15
15
|
export declare function resolveSelectPortalContainer({ trigger }: {
|
|
16
16
|
trigger: HTMLElement | null;
|
|
17
|
-
}, { container }?: {
|
|
17
|
+
}, { container, fallbackContainer }?: {
|
|
18
18
|
container?: Element | DocumentFragment | null | undefined;
|
|
19
|
+
fallbackContainer?: Element | DocumentFragment | null | undefined;
|
|
19
20
|
}): Element | DocumentFragment;
|
|
21
|
+
/** Keep a portalled menu associated with the nearest page that owns its trigger.
|
|
22
|
+
* @complexity O(d) time and O(1) space in ancestor depth; a DOM read only. */
|
|
23
|
+
export declare function resolveSelectOriginPage({ trigger }: {
|
|
24
|
+
trigger: HTMLElement | null;
|
|
25
|
+
}, _optional?: Record<string, never>): string | undefined;
|
|
20
26
|
/** Pure containment decision; outside clicks must neither select an option nor steal focus. */
|
|
21
27
|
export declare function isSelectEventInside({ target, trigger, panel }: {
|
|
22
28
|
target: Node;
|
|
@@ -24,9 +24,14 @@ export function resolveTabTarget({ panel, trigger, shiftKey }, _optional = {}) {
|
|
|
24
24
|
const nextIndex = triggerIndex + (shiftKey ? -1 : 1);
|
|
25
25
|
return nodes[modalDialog ? (nextIndex + nodes.length) % nodes.length : nextIndex] ?? null;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
export function resolveSelectPortalContainer({ trigger }, { container } = {}) {
|
|
29
|
-
return container ?? trigger?.closest('dialog') ?? document.body;
|
|
27
|
+
/** Explicit destinations win; otherwise keep native-dialog ownership before a host kit overlay. */
|
|
28
|
+
export function resolveSelectPortalContainer({ trigger }, { container, fallbackContainer } = {}) {
|
|
29
|
+
return container ?? trigger?.closest('dialog') ?? fallbackContainer ?? document.body;
|
|
30
|
+
}
|
|
31
|
+
/** Keep a portalled menu associated with the nearest page that owns its trigger.
|
|
32
|
+
* @complexity O(d) time and O(1) space in ancestor depth; a DOM read only. */
|
|
33
|
+
export function resolveSelectOriginPage({ trigger }, _optional = {}) {
|
|
34
|
+
return trigger?.closest('[data-agent-page]')?.getAttribute('data-agent-page') ?? undefined;
|
|
30
35
|
}
|
|
31
36
|
/** Pure containment decision; outside clicks must neither select an option nor steal focus. */
|
|
32
37
|
export function isSelectEventInside({ target, trigger, panel }, _optional = {}) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Shared controls preserve explicit names; `false` suppresses automatic addressing. */
|
|
2
|
+
export interface AgentControlProps {
|
|
3
|
+
readonly agentHandle?: string | false | undefined;
|
|
4
|
+
readonly 'data-agent-element'?: string | undefined;
|
|
5
|
+
readonly 'data-agent-private'?: string | boolean | undefined;
|
|
6
|
+
readonly 'data-agent-page'?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a mounted control's stable address without using labels or list positions.
|
|
10
|
+
* React instance identity distinguishes roots and survives rerenders/keyed reordering;
|
|
11
|
+
* remounts may receive a new address. Semantic privacy and opt-out take precedence.
|
|
12
|
+
* @param required - Explicit handle/markup or opt-out; private controls never get a handle.
|
|
13
|
+
* @returns The supplied name, a bounded automatic name, or undefined when excluded.
|
|
14
|
+
* @complexity O(n) in the React instance id; no I/O or DOM effects.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAgentHandle(required: AgentControlProps, _optional?: Record<string, never>): string | undefined;
|
|
17
|
+
//# sourceMappingURL=useAgentHandle.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useId } from 'react';
|
|
2
|
+
import { agentHandleSegment } from '@jini-ai/agentic';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a mounted control's stable address without using labels or list positions.
|
|
5
|
+
* React instance identity distinguishes roots and survives rerenders/keyed reordering;
|
|
6
|
+
* remounts may receive a new address. Semantic privacy and opt-out take precedence.
|
|
7
|
+
* @param required - Explicit handle/markup or opt-out; private controls never get a handle.
|
|
8
|
+
* @returns The supplied name, a bounded automatic name, or undefined when excluded.
|
|
9
|
+
* @complexity O(n) in the React instance id; no I/O or DOM effects.
|
|
10
|
+
*/
|
|
11
|
+
export function useAgentHandle(required, _optional = {}) {
|
|
12
|
+
const id = useId();
|
|
13
|
+
if (required.agentHandle === false || required['data-agent-private'] !== undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
return required.agentHandle ?? required['data-agent-element'] ?? `ui-${agentHandleSegment({ value: id })}`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=useAgentHandle.js.map
|
package/dist/styles/admin.css
CHANGED
|
@@ -247,6 +247,7 @@
|
|
|
247
247
|
.jini-scroll-jump__btn:hover { opacity: 1; color: var(--jini-text); }
|
|
248
248
|
.jini-scroll-jump__btn:focus-visible { opacity: 1; outline: 2px solid var(--jini-accent); outline-offset: 2px; }
|
|
249
249
|
@media (prefers-reduced-motion: reduce) { .jini-scroll-jump__btn { transition: none; } }
|
|
250
|
+
@media (max-width: 640px) { .jini-scroll-jump__btn { width: 44px; height: 44px; } }
|
|
250
251
|
|
|
251
252
|
.tab-bar { display: flex; flex-wrap: wrap; gap: 0.3rem; border-bottom: 1px solid var(--jini-border); margin-bottom: 1.3rem; }
|
|
252
253
|
|