ionbase-ui 0.59.0 → 0.70.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/dist/components/AgentActivity.d.ts +2 -1
- package/dist/components/AgentActivity.d.ts.map +1 -1
- package/dist/components/AgentActivity.js +4 -17
- package/dist/components/AgentActivity.js.map +1 -1
- package/dist/components/Calendar.d.ts +20 -0
- package/dist/components/Calendar.d.ts.map +1 -0
- package/dist/components/Calendar.js +151 -0
- package/dist/components/Calendar.js.map +1 -0
- package/dist/components/CalendarPopover.d.ts +26 -0
- package/dist/components/CalendarPopover.d.ts.map +1 -0
- package/dist/components/CalendarPopover.js +45 -0
- package/dist/components/CalendarPopover.js.map +1 -0
- package/dist/components/DateField.d.ts +15 -0
- package/dist/components/DateField.d.ts.map +1 -0
- package/dist/components/DateField.js +74 -0
- package/dist/components/DateField.js.map +1 -0
- package/dist/components/DatePicker.d.ts +81 -0
- package/dist/components/DatePicker.d.ts.map +1 -0
- package/dist/components/DatePicker.js +102 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker.d.ts +117 -0
- package/dist/components/DateRangePicker.d.ts.map +1 -0
- package/dist/components/DateRangePicker.js +152 -0
- package/dist/components/DateRangePicker.js.map +1 -0
- package/dist/components/Header.d.ts +10 -0
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +18 -3
- package/dist/components/Header.js.map +1 -1
- package/dist/components/NumberInput.d.ts +63 -0
- package/dist/components/NumberInput.d.ts.map +1 -0
- package/dist/components/NumberInput.js +102 -0
- package/dist/components/NumberInput.js.map +1 -0
- package/dist/components/PromptInput.d.ts +89 -0
- package/dist/components/PromptInput.d.ts.map +1 -0
- package/dist/components/PromptInput.js +130 -0
- package/dist/components/PromptInput.js.map +1 -0
- package/dist/components/ScrollProgress.d.ts +6 -0
- package/dist/components/ScrollProgress.d.ts.map +1 -1
- package/dist/components/ScrollProgress.js +2 -2
- package/dist/components/ScrollProgress.js.map +1 -1
- package/dist/components/SegmentedControl.d.ts +63 -0
- package/dist/components/SegmentedControl.d.ts.map +1 -0
- package/dist/components/SegmentedControl.js +79 -0
- package/dist/components/SegmentedControl.js.map +1 -0
- package/dist/components/Sidebar.d.ts +109 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +106 -0
- package/dist/components/Sidebar.js.map +1 -0
- package/dist/components/Stepper.d.ts +73 -0
- package/dist/components/Stepper.d.ts.map +1 -0
- package/dist/components/Stepper.js +82 -0
- package/dist/components/Stepper.js.map +1 -0
- package/dist/components/Toast.d.ts +8 -1
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +2 -2
- package/dist/components/Toast.js.map +1 -1
- package/dist/components/ToolCall.d.ts +66 -0
- package/dist/components/ToolCall.d.ts.map +1 -0
- package/dist/components/ToolCall.js +78 -0
- package/dist/components/ToolCall.js.map +1 -0
- package/dist/components/agent-status.d.ts +14 -0
- package/dist/components/agent-status.d.ts.map +1 -0
- package/dist/components/agent-status.js +16 -0
- package/dist/components/agent-status.js.map +1 -0
- package/dist/components/index.d.ts +18 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/iso-date.d.ts +53 -0
- package/dist/components/iso-date.d.ts.map +1 -0
- package/dist/components/iso-date.js +102 -0
- package/dist/components/iso-date.js.map +1 -0
- package/dist/figma-descriptions.json +107 -52
- package/dist/figma-map.json +735 -2
- package/dist/meta/AgentActivityStep.json +2 -2
- package/dist/meta/DatePicker.json +270 -0
- package/dist/meta/DateRangePicker.json +284 -0
- package/dist/meta/Header.json +32 -2
- package/dist/meta/NumberInput.json +407 -0
- package/dist/meta/PromptInput.json +212 -0
- package/dist/meta/ScrollProgress.json +26 -1
- package/dist/meta/SegmentedControl.json +217 -0
- package/dist/meta/SegmentedControlItem.json +122 -0
- package/dist/meta/Sidebar.json +150 -0
- package/dist/meta/SidebarItem.json +184 -0
- package/dist/meta/SidebarSection.json +131 -0
- package/dist/meta/Stepper.json +135 -0
- package/dist/meta/StepperStep.json +148 -0
- package/dist/meta/Tabs.json +5 -0
- package/dist/meta/ToastProvider.json +9 -2
- package/dist/meta/ToolCall.json +192 -0
- package/dist/meta/components.json +5812 -3293
- package/dist/meta/contrast.json +7776 -2478
- package/dist/meta/index.json +145 -3
- package/dist/meta/patterns/AgentRun.json +27 -0
- package/dist/meta/patterns/Form.json +9 -0
- package/dist/meta/patterns/PageShell.json +43 -3
- package/dist/meta/patterns/Wizard.json +20 -1
- package/dist/meta/patterns/index.json +10 -1
- package/dist/styles/date-picker.css +420 -0
- package/dist/styles/date-range-picker.css +280 -0
- package/dist/styles/header.css +26 -0
- package/dist/styles/index.css +15 -0
- package/dist/styles/number-input.css +83 -0
- package/dist/styles/prompt-input.css +127 -0
- package/dist/styles/scroll-progress.css +42 -4
- package/dist/styles/segmented-control.css +182 -0
- package/dist/styles/sidebar.css +307 -0
- package/dist/styles/stepper.css +250 -0
- package/dist/styles/table.css +9 -0
- package/dist/styles/tool-call.css +202 -0
- package/llms.txt +2 -2
- package/package.json +20 -19
- package/LICENSE +0 -21
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Names the navigation landmark. Required: a page with a sidebar usually has
|
|
5
|
+
* a second `<nav>` too, and "navigation, navigation" tells nobody which is
|
|
6
|
+
* which.
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* Pinned above the scrolling body — a workspace switcher, a search trigger,
|
|
11
|
+
* icon buttons. Any component.
|
|
12
|
+
*/
|
|
13
|
+
header?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Pinned below the scrolling body — an Invite button, help, a trial notice.
|
|
16
|
+
* Any component.
|
|
17
|
+
*/
|
|
18
|
+
footer?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* `SidebarSection`s, and anything that sits between them — a `Divider`, a
|
|
21
|
+
* promotional card. Items themselves always go inside a section.
|
|
22
|
+
*/
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export interface SidebarSectionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
26
|
+
/** The group's name — "Spaces", "Favorites". Omit for the top group. */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** Lets the title fold the section away. Needs a `title`. */
|
|
29
|
+
isCollapsible?: boolean;
|
|
30
|
+
/** Uncontrolled: whether a collapsible section starts open. */
|
|
31
|
+
defaultExpanded?: boolean;
|
|
32
|
+
/** Controlled: whether a collapsible section is open. */
|
|
33
|
+
isExpanded?: boolean;
|
|
34
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Controls beside the title — a `+` Button to create a space. Icon-only
|
|
37
|
+
* buttons need their own `aria-label`.
|
|
38
|
+
*/
|
|
39
|
+
actions?: React.ReactNode;
|
|
40
|
+
/** `SidebarItem`s only — the section renders a list. */
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export interface SidebarItemProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> {
|
|
44
|
+
/**
|
|
45
|
+
* The item's text. A string, because it also names the expand button of an
|
|
46
|
+
* item that has children.
|
|
47
|
+
*/
|
|
48
|
+
label: string;
|
|
49
|
+
/** Leading icon. Decorative — `label` names the item. */
|
|
50
|
+
icon?: React.ReactNode;
|
|
51
|
+
/** Where it goes. Omit for an item that only groups its children. */
|
|
52
|
+
href?: string;
|
|
53
|
+
/** For an item that acts rather than navigates. Ignored with `href`. */
|
|
54
|
+
onPress?: () => void;
|
|
55
|
+
/** The page the user is on. Marked `aria-current="page"`. */
|
|
56
|
+
isCurrent?: boolean;
|
|
57
|
+
isDisabled?: boolean;
|
|
58
|
+
/** Trailing text — a count, a shortcut, a status. */
|
|
59
|
+
badge?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Controls for this row — `…` and `+`. Revealed on hover and whenever focus
|
|
62
|
+
* is inside the row; always shown on touch screens. Icon-only buttons need
|
|
63
|
+
* their own `aria-label`.
|
|
64
|
+
*/
|
|
65
|
+
actions?: React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* Uncontrolled: whether the children start open. Defaults to open when the
|
|
68
|
+
* current page is somewhere inside.
|
|
69
|
+
*/
|
|
70
|
+
defaultExpanded?: boolean;
|
|
71
|
+
/** Controlled: whether the children are open. */
|
|
72
|
+
isExpanded?: boolean;
|
|
73
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
74
|
+
/** Nested `SidebarItem`s. Their presence is what makes the item expandable. */
|
|
75
|
+
children?: React.ReactNode;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sidebar — an application's navigation, as a column.
|
|
79
|
+
*
|
|
80
|
+
* DISCLOSURE NAVIGATION, NOT `role="tree"`
|
|
81
|
+
*
|
|
82
|
+
* A file-tree look invites the tree role, and the tree role is wrong here.
|
|
83
|
+
* A treeview takes the arrow keys, allows one tab stop for the whole widget,
|
|
84
|
+
* and does not permit interactive content inside an item — so the `…` and `+`
|
|
85
|
+
* buttons on a row, which are half the point of a workspace sidebar, could not
|
|
86
|
+
* exist in it. This is the WAI-ARIA disclosure navigation pattern instead:
|
|
87
|
+
* nested lists of links, each expandable level behind a real button with
|
|
88
|
+
* `aria-expanded`, and everything reachable with Tab.
|
|
89
|
+
*
|
|
90
|
+
* AN ITEM THAT IS A LINK AND HAS CHILDREN GETS TWO CONTROLS
|
|
91
|
+
*
|
|
92
|
+
* A button cannot sit inside a link. So a row that navigates AND expands
|
|
93
|
+
* renders the link and a separate chevron button beside it; a row with no
|
|
94
|
+
* `href` is one button that expands. The actions slot is a sibling of both,
|
|
95
|
+
* never nested inside either.
|
|
96
|
+
*
|
|
97
|
+
* THE CURRENT PAGE IS NEVER FOLDED AWAY
|
|
98
|
+
*
|
|
99
|
+
* An item whose subtree contains the current page starts open. A sidebar that
|
|
100
|
+
* loads with the user's location collapsed inside a closed group tells a
|
|
101
|
+
* sighted user nothing and a screen-reader user less.
|
|
102
|
+
*
|
|
103
|
+
* Expansion is per item, controlled or not. Remembering it across visits is the
|
|
104
|
+
* caller's job — this component cannot know where that state should live.
|
|
105
|
+
*/
|
|
106
|
+
export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLElement>>;
|
|
107
|
+
export declare const SidebarSection: React.ForwardRefExoticComponent<SidebarSectionProps & React.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
export declare const SidebarItem: React.ForwardRefExoticComponent<SidebarItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
109
|
+
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../src/components/Sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACrE;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,OAAO,CACR;IACC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,OAAO,CAAC;I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
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef, useId, useState } from 'react';
|
|
4
|
+
const Chevron = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m9 6 6 6-6 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
5
|
+
/** Does any SidebarItem below these children carry `isCurrent`? */
|
|
6
|
+
function containsCurrent(children) {
|
|
7
|
+
return React.Children.toArray(children).some((child) => {
|
|
8
|
+
if (!React.isValidElement(child))
|
|
9
|
+
return false;
|
|
10
|
+
return (child.props.isCurrent === true || containsCurrent(child.props.children));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function useDisclosure(controlled, initial, onChange) {
|
|
14
|
+
const [internal, setInternal] = useState(initial);
|
|
15
|
+
const isOpen = controlled ?? internal;
|
|
16
|
+
const toggle = () => {
|
|
17
|
+
const next = !isOpen;
|
|
18
|
+
if (controlled === undefined)
|
|
19
|
+
setInternal(next);
|
|
20
|
+
onChange?.(next);
|
|
21
|
+
};
|
|
22
|
+
return [isOpen, toggle];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Sidebar — an application's navigation, as a column.
|
|
26
|
+
*
|
|
27
|
+
* DISCLOSURE NAVIGATION, NOT `role="tree"`
|
|
28
|
+
*
|
|
29
|
+
* A file-tree look invites the tree role, and the tree role is wrong here.
|
|
30
|
+
* A treeview takes the arrow keys, allows one tab stop for the whole widget,
|
|
31
|
+
* and does not permit interactive content inside an item — so the `…` and `+`
|
|
32
|
+
* buttons on a row, which are half the point of a workspace sidebar, could not
|
|
33
|
+
* exist in it. This is the WAI-ARIA disclosure navigation pattern instead:
|
|
34
|
+
* nested lists of links, each expandable level behind a real button with
|
|
35
|
+
* `aria-expanded`, and everything reachable with Tab.
|
|
36
|
+
*
|
|
37
|
+
* AN ITEM THAT IS A LINK AND HAS CHILDREN GETS TWO CONTROLS
|
|
38
|
+
*
|
|
39
|
+
* A button cannot sit inside a link. So a row that navigates AND expands
|
|
40
|
+
* renders the link and a separate chevron button beside it; a row with no
|
|
41
|
+
* `href` is one button that expands. The actions slot is a sibling of both,
|
|
42
|
+
* never nested inside either.
|
|
43
|
+
*
|
|
44
|
+
* THE CURRENT PAGE IS NEVER FOLDED AWAY
|
|
45
|
+
*
|
|
46
|
+
* An item whose subtree contains the current page starts open. A sidebar that
|
|
47
|
+
* loads with the user's location collapsed inside a closed group tells a
|
|
48
|
+
* sighted user nothing and a screen-reader user less.
|
|
49
|
+
*
|
|
50
|
+
* Expansion is per item, controlled or not. Remembering it across visits is the
|
|
51
|
+
* caller's job — this component cannot know where that state should live.
|
|
52
|
+
*/
|
|
53
|
+
export const Sidebar = forwardRef(({ label, header, footer, children, className, ...rest }, ref) => (_jsxs("nav", { ...rest, ref: ref, "aria-label": label, className: ['ion-sidebar', className || ''].filter(Boolean).join(' '), children: [header && _jsx("div", { className: "ion-sidebar__header", children: header }), _jsx("div", { className: "ion-sidebar__body", children: children }), footer && _jsx("div", { className: "ion-sidebar__footer", children: footer })] })));
|
|
54
|
+
Sidebar.displayName = 'Sidebar';
|
|
55
|
+
export const SidebarSection = forwardRef(({ title, isCollapsible = false, defaultExpanded = true, isExpanded: isExpandedProp, onExpandedChange, actions, children, className, ...rest }, ref) => {
|
|
56
|
+
const titleId = useId();
|
|
57
|
+
const listId = useId();
|
|
58
|
+
const collapsible = isCollapsible && !!title;
|
|
59
|
+
const [isOpen, toggle] = useDisclosure(collapsible ? isExpandedProp : true, collapsible ? defaultExpanded : true, onExpandedChange);
|
|
60
|
+
return (_jsxs("div", { ...rest, ref: ref, className: ['ion-sidebar__section', className || '']
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join(' '), children: [title && (_jsxs("div", { className: "ion-sidebar__section-header", children: [collapsible ? (_jsxs("button", { type: "button", id: titleId, className: [
|
|
63
|
+
'ion-sidebar__section-title',
|
|
64
|
+
isOpen ? 'ion-sidebar__section-title--expanded' : '',
|
|
65
|
+
]
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.join(' '), "aria-expanded": isOpen, "aria-controls": listId, onClick: toggle, children: [title, _jsx("span", { className: "ion-sidebar__chevron", "aria-hidden": "true", children: _jsx(Chevron, {}) })] })) : (_jsx("span", { id: titleId, className: "ion-sidebar__section-title", children: title })), actions && (_jsx("span", { className: "ion-sidebar__section-actions", children: actions }))] })), _jsx("ul", { id: listId, className: "ion-sidebar__list", "aria-labelledby": title ? titleId : undefined, hidden: !isOpen, children: children })] }));
|
|
68
|
+
});
|
|
69
|
+
SidebarSection.displayName = 'SidebarSection';
|
|
70
|
+
export const SidebarItem = forwardRef(({ label, icon, href, onPress, isCurrent = false, isDisabled = false, badge, actions, defaultExpanded, isExpanded: isExpandedProp, onExpandedChange, children, className, ...rest }, ref) => {
|
|
71
|
+
const listId = useId();
|
|
72
|
+
const hasChildren = React.Children.toArray(children).some((c) => React.isValidElement(c));
|
|
73
|
+
const [isOpen, toggle] = useDisclosure(isExpandedProp, defaultExpanded ?? containsCurrent(children), onExpandedChange);
|
|
74
|
+
const content = (_jsxs(_Fragment, { children: [icon && (_jsx("span", { className: "ion-sidebar__icon", "aria-hidden": "true", children: icon })), _jsx("span", { className: "ion-sidebar__label", children: label }), badge !== undefined && badge !== null && (_jsx("span", { className: "ion-sidebar__badge", children: badge }))] }));
|
|
75
|
+
const chevron = (_jsx("span", { className: [
|
|
76
|
+
'ion-sidebar__chevron',
|
|
77
|
+
isOpen ? 'ion-sidebar__chevron--expanded' : '',
|
|
78
|
+
]
|
|
79
|
+
.filter(Boolean)
|
|
80
|
+
.join(' '), "aria-hidden": "true", children: _jsx(Chevron, {}) }));
|
|
81
|
+
let main;
|
|
82
|
+
if (href !== undefined && !isDisabled) {
|
|
83
|
+
main = (_jsx("a", { href: href, className: "ion-sidebar__link", "aria-current": isCurrent ? 'page' : undefined, children: content }));
|
|
84
|
+
}
|
|
85
|
+
else if (hasChildren && href === undefined) {
|
|
86
|
+
// No destination: the whole row is the disclosure.
|
|
87
|
+
main = (_jsxs("button", { type: "button", className: "ion-sidebar__link", "aria-expanded": isOpen, "aria-controls": listId, disabled: isDisabled, onClick: toggle, children: [content, chevron] }));
|
|
88
|
+
}
|
|
89
|
+
else if (onPress && !isDisabled) {
|
|
90
|
+
main = (_jsx("button", { type: "button", className: "ion-sidebar__link", onClick: onPress, children: content }));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
main = (_jsx("span", { className: "ion-sidebar__link", "aria-current": isCurrent ? 'page' : undefined, "aria-disabled": isDisabled || undefined, children: content }));
|
|
94
|
+
}
|
|
95
|
+
return (_jsxs("li", { ...rest, ref: ref, className: ['ion-sidebar__item', className || '']
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.join(' '), children: [_jsxs("div", { className: [
|
|
98
|
+
'ion-sidebar__row',
|
|
99
|
+
isCurrent ? 'ion-sidebar__row--current' : '',
|
|
100
|
+
isDisabled ? 'ion-sidebar__row--disabled' : '',
|
|
101
|
+
]
|
|
102
|
+
.filter(Boolean)
|
|
103
|
+
.join(' '), children: [main, actions && _jsx("span", { className: "ion-sidebar__actions", children: actions }), hasChildren && href !== undefined && (_jsx("button", { type: "button", className: "ion-sidebar__toggle", "aria-label": label, "aria-expanded": isOpen, "aria-controls": listId, disabled: isDisabled, onClick: toggle, children: chevron }))] }), hasChildren && (_jsx("ul", { id: listId, className: "ion-sidebar__list ion-sidebar__list--nested", hidden: !isOpen, children: children }))] }));
|
|
104
|
+
});
|
|
105
|
+
SidebarItem.displayName = 'SidebarItem';
|
|
106
|
+
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../src/components/Sidebar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,UAAU,EA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GACD,CACV,IACG,EACL,WAAW,IAAI,CACd,aACE,EAAE,EAAE,MAAM,EACV,SAAS,EAAC,6CAA6C,EACvD,MAAM,EAAE,CAAC,MAAM,YAEd,QAAQ,GACN,CACN,IACE,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export type StepperStepStatus = 'incomplete' | 'complete' | 'error';
|
|
4
|
+
export interface StepperProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Names the list. Defaults to "Progress"; give it the task's name when a page
|
|
7
|
+
* carries more than one — "Checkout progress".
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* `horizontal` for a page-width header above the form, `vertical` for a side
|
|
12
|
+
* rail. Below 40rem a horizontal stepper hides every label but the current
|
|
13
|
+
* one, so it does not need a second variant for mobile.
|
|
14
|
+
*/
|
|
15
|
+
orientation?: StepperOrientation;
|
|
16
|
+
/** `StepperStep` elements, first step first. */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export interface StepperStepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> {
|
|
20
|
+
/** The step's name, in the user's language. */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
/** A short second line — what the step asks for, or a summary of the answer. */
|
|
23
|
+
description?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the step's answers have been accepted. Orthogonal to `isCurrent`:
|
|
26
|
+
* a user who goes Back to step 1 is on a step that is both current and
|
|
27
|
+
* complete.
|
|
28
|
+
*/
|
|
29
|
+
status?: StepperStepStatus;
|
|
30
|
+
/** The step the user is on. Marked `aria-current="step"`. */
|
|
31
|
+
isCurrent?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Makes a visited step a link back to it. Ignored on the current step and on
|
|
34
|
+
* `incomplete` steps — see the component's comment for why.
|
|
35
|
+
*/
|
|
36
|
+
href?: string;
|
|
37
|
+
/** As `href`, for a wizard that changes step without a route. */
|
|
38
|
+
onPress?: () => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Stepper — where the user is in a task that has an order.
|
|
42
|
+
*
|
|
43
|
+
* WHY NOT TABS
|
|
44
|
+
*
|
|
45
|
+
* The `tablist` role announces peers that can be visited in any order, which is
|
|
46
|
+
* the opposite of a wizard. This is an ordered list: the steps are a sequence,
|
|
47
|
+
* and `ol` says so. Nothing here is a tab, and arrow keys do nothing.
|
|
48
|
+
*
|
|
49
|
+
* POSITION AND STATUS ARE TEXT, NOT ONLY DRAWING
|
|
50
|
+
*
|
|
51
|
+
* Every step renders "Step 2 of 5" and its status as visually hidden text. The
|
|
52
|
+
* number in the circle is for the eye; a screen reader cannot be relied on to
|
|
53
|
+
* announce list position, and a coloured ring carries nothing in forced-colours
|
|
54
|
+
* mode. The complete and error glyphs also differ in SHAPE — a check and an
|
|
55
|
+
* exclamation — so the states survive greyscale, which WCAG 1.4.1 requires.
|
|
56
|
+
*
|
|
57
|
+
* ONLY VISITED STEPS ARE LINKS
|
|
58
|
+
*
|
|
59
|
+
* `href` / `onPress` are honoured on `complete` and `error` steps that are not
|
|
60
|
+
* current. An `incomplete` step renders as text even when given one, because
|
|
61
|
+
* jumping forward past unanswered steps is exactly what a wizard exists to
|
|
62
|
+
* prevent — and a link that is there but should not be followed is worse than
|
|
63
|
+
* no link. The current step is text for the same reason Breadcrumb's is: a link
|
|
64
|
+
* to where you already are is a dead control.
|
|
65
|
+
*
|
|
66
|
+
* IT DOES NOT ANNOUNCE STEP CHANGES
|
|
67
|
+
*
|
|
68
|
+
* The Wizard pattern moves focus to the new step's heading, which announces it.
|
|
69
|
+
* A live region here as well would say the same thing twice, on every step.
|
|
70
|
+
*/
|
|
71
|
+
export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLOListElement>>;
|
|
72
|
+
export declare const StepperStep: React.ForwardRefExoticComponent<StepperStepProps & React.RefAttributes<HTMLLIElement>>;
|
|
73
|
+
//# sourceMappingURL=Stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../src/components/Stepper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AASpE,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAC1E;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,EACrC,SAAS,CACV;IACC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gFAAgF;IAChF,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;;;OAIG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAgCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,OAAO,uFA0CnB,CAAC;AAIF,eAAO,MAAM,WAAW,wFAoFvB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { createContext, forwardRef, useContext } from 'react';
|
|
4
|
+
const StepContext = createContext(null);
|
|
5
|
+
const STATUS_TEXT = {
|
|
6
|
+
incomplete: 'Not started',
|
|
7
|
+
complete: 'Completed',
|
|
8
|
+
error: 'Has errors',
|
|
9
|
+
};
|
|
10
|
+
const Check = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m6 12.5 4 4 8-9", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
11
|
+
const Exclamation = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { d: "M12 6.5v7", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }), _jsx("circle", { cx: "12", cy: "17.5", r: "1.5", fill: "currentColor" })] }));
|
|
12
|
+
/**
|
|
13
|
+
* Stepper — where the user is in a task that has an order.
|
|
14
|
+
*
|
|
15
|
+
* WHY NOT TABS
|
|
16
|
+
*
|
|
17
|
+
* The `tablist` role announces peers that can be visited in any order, which is
|
|
18
|
+
* the opposite of a wizard. This is an ordered list: the steps are a sequence,
|
|
19
|
+
* and `ol` says so. Nothing here is a tab, and arrow keys do nothing.
|
|
20
|
+
*
|
|
21
|
+
* POSITION AND STATUS ARE TEXT, NOT ONLY DRAWING
|
|
22
|
+
*
|
|
23
|
+
* Every step renders "Step 2 of 5" and its status as visually hidden text. The
|
|
24
|
+
* number in the circle is for the eye; a screen reader cannot be relied on to
|
|
25
|
+
* announce list position, and a coloured ring carries nothing in forced-colours
|
|
26
|
+
* mode. The complete and error glyphs also differ in SHAPE — a check and an
|
|
27
|
+
* exclamation — so the states survive greyscale, which WCAG 1.4.1 requires.
|
|
28
|
+
*
|
|
29
|
+
* ONLY VISITED STEPS ARE LINKS
|
|
30
|
+
*
|
|
31
|
+
* `href` / `onPress` are honoured on `complete` and `error` steps that are not
|
|
32
|
+
* current. An `incomplete` step renders as text even when given one, because
|
|
33
|
+
* jumping forward past unanswered steps is exactly what a wizard exists to
|
|
34
|
+
* prevent — and a link that is there but should not be followed is worse than
|
|
35
|
+
* no link. The current step is text for the same reason Breadcrumb's is: a link
|
|
36
|
+
* to where you already are is a dead control.
|
|
37
|
+
*
|
|
38
|
+
* IT DOES NOT ANNOUNCE STEP CHANGES
|
|
39
|
+
*
|
|
40
|
+
* The Wizard pattern moves focus to the new step's heading, which announces it.
|
|
41
|
+
* A live region here as well would say the same thing twice, on every step.
|
|
42
|
+
*/
|
|
43
|
+
export const Stepper = forwardRef(({ label = 'Progress', orientation = 'horizontal', children, className, ...rest }, ref) => {
|
|
44
|
+
/*
|
|
45
|
+
* Position comes from the children rather than from props on each step.
|
|
46
|
+
* Asking the caller to pass `index` and `total` five times is five chances
|
|
47
|
+
* for "Step 3 of 4" to appear twice.
|
|
48
|
+
*/
|
|
49
|
+
const steps = React.Children.toArray(children).filter(React.isValidElement);
|
|
50
|
+
return (_jsx("ol", { ...rest, ref: ref, "aria-label": label, "data-orientation": orientation, className: [
|
|
51
|
+
'ion-stepper',
|
|
52
|
+
`ion-stepper--${orientation}`,
|
|
53
|
+
className || '',
|
|
54
|
+
]
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.join(' '), children: steps.map((step, index) => (_jsx(StepContext.Provider, { value: { index, total: steps.length }, children: step }, step.key ?? index))) }));
|
|
57
|
+
});
|
|
58
|
+
Stepper.displayName = 'Stepper';
|
|
59
|
+
export const StepperStep = forwardRef(({ children, description, status = 'incomplete', isCurrent = false, href, onPress, className, ...rest }, ref) => {
|
|
60
|
+
const position = useContext(StepContext);
|
|
61
|
+
if (!position) {
|
|
62
|
+
throw new Error('StepperStep must be rendered inside a Stepper');
|
|
63
|
+
}
|
|
64
|
+
const number = position.index + 1;
|
|
65
|
+
const isInteractive = !isCurrent && status !== 'incomplete' && (!!href || !!onPress);
|
|
66
|
+
const statusText = isCurrent
|
|
67
|
+
? status === 'error'
|
|
68
|
+
? 'Current step, has errors'
|
|
69
|
+
: 'Current step'
|
|
70
|
+
: STATUS_TEXT[status];
|
|
71
|
+
const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "ion-stepper__indicator", "aria-hidden": "true", children: status === 'complete' ? (_jsx(Check, {})) : status === 'error' ? (_jsx(Exclamation, {})) : (number) }), _jsxs("span", { className: "ion-stepper__text", children: [_jsx("span", { className: "ion-visually-hidden", children: `Step ${number} of ${position.total}: ` }), _jsx("span", { className: "ion-stepper__label", children: children }), description && (_jsx("span", { className: "ion-stepper__description", children: description })), _jsx("span", { className: "ion-visually-hidden", children: `, ${statusText}` })] })] }));
|
|
72
|
+
return (_jsx("li", { ...rest, ref: ref, "aria-current": isCurrent ? 'step' : undefined, className: [
|
|
73
|
+
'ion-stepper__step',
|
|
74
|
+
status !== 'incomplete' ? `ion-stepper__step--${status}` : '',
|
|
75
|
+
isCurrent ? 'ion-stepper__step--current' : '',
|
|
76
|
+
className || '',
|
|
77
|
+
]
|
|
78
|
+
.filter(Boolean)
|
|
79
|
+
.join(' '), children: isInteractive && href ? (_jsx("a", { href: href, className: "ion-stepper__trigger", children: content })) : isInteractive ? (_jsx("button", { type: "button", className: "ion-stepper__trigger", onClick: onPress, children: content })) : (_jsx("span", { className: "ion-stepper__trigger", children: content })) }));
|
|
80
|
+
});
|
|
81
|
+
StepperStep.displayName = 'StepperStep';
|
|
82
|
+
//# sourceMappingURL=Stepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../../src/components/Stepper.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,U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O,GACD,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,sBAAsB,YAAE,OAAO,GAAQ,CACxD,GACE,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -43,6 +43,13 @@ export interface ToastProviderProps {
|
|
|
43
43
|
placement?: ToastPlacement;
|
|
44
44
|
/** Oldest are dropped past this. Prevents an unbounded stack covering the page. */
|
|
45
45
|
limit?: number;
|
|
46
|
+
/**
|
|
47
|
+
* The live region's accessible name. The region is a landmark, and landmark
|
|
48
|
+
* names must be unique on a page: an app with its own section called
|
|
49
|
+
* "Notifications" fails axe `landmark-unique` on every page that has one
|
|
50
|
+
* unless this is changed.
|
|
51
|
+
*/
|
|
52
|
+
label?: string;
|
|
46
53
|
}
|
|
47
54
|
/**
|
|
48
55
|
* Renders the queue and supplies `useToast`.
|
|
@@ -51,7 +58,7 @@ export interface ToastProviderProps {
|
|
|
51
58
|
* that appears at the same moment as its content is not reliably announced —
|
|
52
59
|
* assistive tech has to be watching the node before the text lands in it.
|
|
53
60
|
*/
|
|
54
|
-
export declare function ToastProvider({ children, placement, limit, }: ToastProviderProps): React.JSX.Element;
|
|
61
|
+
export declare function ToastProvider({ children, placement, limit, label, }: ToastProviderProps): React.JSX.Element;
|
|
55
62
|
export declare function useToast(): ToastContextValue;
|
|
56
63
|
export {};
|
|
57
64
|
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAUN,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,WAAW,GACrB,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAE1E,MAAM,MAAM,cAAc,GACxB,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;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;AAED,wBAAgB,QAAQ,IAAI,iBAAiB,CAI5C"}
|
package/dist/components/Toast.js
CHANGED
|
@@ -57,7 +57,7 @@ const ToastContext = createContext(null);
|
|
|
57
57
|
* that appears at the same moment as its content is not reliably announced —
|
|
58
58
|
* assistive tech has to be watching the node before the text lands in it.
|
|
59
59
|
*/
|
|
60
|
-
export function ToastProvider({ children, placement = 'bottom-right', limit = 4, }) {
|
|
60
|
+
export function ToastProvider({ children, placement = 'bottom-right', limit = 4, label = 'Notifications', }) {
|
|
61
61
|
const [items, setItems] = useState([]);
|
|
62
62
|
const counter = useRef(0);
|
|
63
63
|
const prefix = useId();
|
|
@@ -70,7 +70,7 @@ export function ToastProvider({ children, placement = 'bottom-right', limit = 4,
|
|
|
70
70
|
return id;
|
|
71
71
|
}, [prefix, limit]);
|
|
72
72
|
const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);
|
|
73
|
-
return (_jsxs(ToastContext.Provider, { value: value, children: [children, _jsx("div", { className: `ion-toast-region ion-toast-region--${placement}`, role: "region", "aria-label":
|
|
73
|
+
return (_jsxs(ToastContext.Provider, { value: value, children: [children, _jsx("div", { className: `ion-toast-region ion-toast-region--${placement}`, role: "region", "aria-label": label, children: items.map((item) => (_jsx(Toast, { ...item, onDismiss: dismiss }, item.id))) })] }));
|
|
74
74
|
}
|
|
75
75
|
export function useToast() {
|
|
76
76
|
const ctx = useContext(ToastContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAQf,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,CACjB,eAAK,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,iBAAa,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,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,OAAO,EAAE,CAAC;IACZ,CAAC,EACD,CAAC,MAAM,EAAE,KAAK,CAAC,CAChB,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEpE,OAAO,CACL,MAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,aAChC,QAAQ,EACT,cACE,SAAS,EAAE,sCAAsC,SAAS,EAAE,EAC5D,IAAI,EAAC,QAAQ,gBACD,KAAK,YAEhB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,KAAC,KAAK,OAAmB,IAAI,EAAE,SAAS,EAAE,OAAO,IAArC,IAAI,CAAC,EAAE,CAAkC,CACtD,CAAC,GACE,IACgB,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,GAAG,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACrC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AgentActivityStatus } from './agent-status.js';
|
|
3
|
+
export interface ToolCallProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
|
+
/**
|
|
5
|
+
* What the call did, in the user's language — "Searched the invoice archive".
|
|
6
|
+
* Required: the tool's function name is not a description of the work.
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
9
|
+
/** The tool's technical name, shown in monospace beside the title. */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** The same vocabulary as AgentActivityStep, so the two never disagree. */
|
|
12
|
+
status?: AgentActivityStatus;
|
|
13
|
+
/**
|
|
14
|
+
* What the agent passed in. Objects and arrays render as formatted JSON,
|
|
15
|
+
* strings as they are. Redact secrets before passing it — this renders
|
|
16
|
+
* exactly what it is given.
|
|
17
|
+
*/
|
|
18
|
+
input?: unknown;
|
|
19
|
+
/** What came back. Rendered as `input` is. */
|
|
20
|
+
output?: unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Why a `failed` call failed. Shown under the header whether or not the
|
|
23
|
+
* details are expanded — a failure that takes a click to read is not read.
|
|
24
|
+
*/
|
|
25
|
+
errorMessage?: React.ReactNode;
|
|
26
|
+
/** How long the call took, in milliseconds. */
|
|
27
|
+
durationMs?: number;
|
|
28
|
+
/** Uncontrolled: whether the details start open. */
|
|
29
|
+
defaultExpanded?: boolean;
|
|
30
|
+
/** Controlled: whether the details are open. Pass `onExpandedChange` with it. */
|
|
31
|
+
isExpanded?: boolean;
|
|
32
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* ToolCall — the evidence behind one step of an agent run.
|
|
36
|
+
*
|
|
37
|
+
* AgentActivityStep says what the agent did in the user's language. ToolCall
|
|
38
|
+
* is where the person checking that account goes next: which tool, with what
|
|
39
|
+
* arguments, and what came back. The title is still plain language and still
|
|
40
|
+
* required, so the technical detail supplements the account rather than
|
|
41
|
+
* replacing it.
|
|
42
|
+
*
|
|
43
|
+
* COLLAPSED BY DEFAULT, EXCEPT THE FAILURE
|
|
44
|
+
*
|
|
45
|
+
* A run makes dozens of calls, and a thread of expanded JSON is unreadable.
|
|
46
|
+
* But `errorMessage` renders outside the disclosure: evidence that takes a
|
|
47
|
+
* click to reach is evidence nobody reads, and a failure is the one thing in
|
|
48
|
+
* the call a reader must not miss.
|
|
49
|
+
*
|
|
50
|
+
* THE DETAILS ARE UNMOUNTED WHEN CLOSED — unlike Accordion, deliberately.
|
|
51
|
+
* Accordion keeps collapsed panels for the form state inside them; a tool call
|
|
52
|
+
* holds no user state, and its payloads can be megabytes of JSON multiplied by
|
|
53
|
+
* every call in the thread.
|
|
54
|
+
*
|
|
55
|
+
* A CALL WITH NOTHING TO SHOW IS NOT A BUTTON. With no input and no output the
|
|
56
|
+
* header renders as text: a disclosure that discloses nothing announces as
|
|
57
|
+
* expandable and does nothing.
|
|
58
|
+
*
|
|
59
|
+
* THE PAYLOADS ARE FOCUSABLE. Each is a scroll container capped in height, and
|
|
60
|
+
* a scroll container a keyboard user cannot focus is one they cannot scroll.
|
|
61
|
+
*
|
|
62
|
+
* It does not announce status changes. AgentActivity owns the run's live
|
|
63
|
+
* region; a second one here would talk over it.
|
|
64
|
+
*/
|
|
65
|
+
export declare const ToolCall: React.ForwardRefExoticComponent<ToolCallProps & React.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
//# sourceMappingURL=ToolCall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolCall.d.ts","sourceRoot":"","sources":["../../src/components/ToolCall.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,OAAO,CACR;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iFAAiF;IACjF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AA6BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,QAAQ,sFAwHpB,CAAC"}
|