@common-origin/design-system 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +844 -344
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/AILabel/AILabel.d.mts +30 -0
- package/dist/components/atoms/AILabel/AILabel.d.ts +30 -0
- package/dist/components/atoms/AILabel/AILabel.mjs +94 -0
- package/dist/components/atoms/AILabel/AILabel.mjs.map +1 -0
- package/dist/components/atoms/AILabel/index.d.mts +1 -0
- package/dist/components/atoms/AILabel/index.d.ts +1 -0
- package/dist/components/atoms/Chip/SuggestionChip.d.mts +24 -0
- package/dist/components/atoms/Chip/SuggestionChip.d.ts +24 -0
- package/dist/components/atoms/Chip/SuggestionChip.mjs +61 -0
- package/dist/components/atoms/Chip/SuggestionChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/index.d.mts +1 -0
- package/dist/components/atoms/Chip/index.d.ts +1 -0
- package/dist/components/atoms/index.d.mts +1 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/molecules/AgentInput/AgentInput.d.mts +63 -1
- package/dist/components/molecules/AgentInput/AgentInput.d.ts +63 -1
- package/dist/components/molecules/AgentInput/AgentInput.mjs +476 -112
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.mts +2 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.ts +2 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs +5 -1
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs.map +1 -1
- package/dist/components/molecules/AgentInput/index.d.mts +1 -1
- package/dist/components/molecules/AgentInput/index.d.ts +1 -1
- package/dist/components/molecules/CardLarge/CardLarge.mjs +1 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +2 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.mjs +1 -0
- package/dist/data.js +316 -3
- package/dist/data.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/tokenAliases.mjs +1 -0
- package/dist/lib/tokenAliases.mjs.map +1 -1
- package/dist/styles/icons.json +30 -1
- package/dist/styles/icons.json.mjs +33 -2
- package/dist/styles/icons.json.mjs.map +1 -1
- package/dist/styles/tokens.d.mts +545 -1
- package/dist/styles/tokens.d.ts +545 -1
- package/dist/styles/tokens.json +284 -2
- package/dist/styles/tokens.json.mjs +284 -2
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +284 -2
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +284 -2
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +545 -1
- package/dist/tokens/styles/tokens.d.ts +545 -1
- package/dist/tokens.css +242 -0
- package/dist/types/icons.d.mts +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AILabelKind = 'suggested' | 'removal';
|
|
3
|
+
export type AILabelSize = 'small' | 'medium';
|
|
4
|
+
export interface AILabelProps {
|
|
5
|
+
/**
|
|
6
|
+
* What the agent proposes for the item: a change or addition ("Suggested"), or its removal
|
|
7
|
+
* ("Will be removed"). The wording is fixed so it reads the same in every product (decision 0046).
|
|
8
|
+
* @default 'suggested'
|
|
9
|
+
*/
|
|
10
|
+
kind?: AILabelKind;
|
|
11
|
+
/**
|
|
12
|
+
* Size on the label scale (decision 0018): small (20px) for dense lists, medium (24px) elsewhere.
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: AILabelSize;
|
|
16
|
+
/** Test identifier for automated testing */
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
21
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
22
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <AILabel /> // "Suggested"
|
|
27
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const AILabel: React.FC<AILabelProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AILabelKind = 'suggested' | 'removal';
|
|
3
|
+
export type AILabelSize = 'small' | 'medium';
|
|
4
|
+
export interface AILabelProps {
|
|
5
|
+
/**
|
|
6
|
+
* What the agent proposes for the item: a change or addition ("Suggested"), or its removal
|
|
7
|
+
* ("Will be removed"). The wording is fixed so it reads the same in every product (decision 0046).
|
|
8
|
+
* @default 'suggested'
|
|
9
|
+
*/
|
|
10
|
+
kind?: AILabelKind;
|
|
11
|
+
/**
|
|
12
|
+
* Size on the label scale (decision 0018): small (20px) for dense lists, medium (24px) elsewhere.
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: AILabelSize;
|
|
16
|
+
/** Test identifier for automated testing */
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
21
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
22
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <AILabel /> // "Suggested"
|
|
27
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const AILabel: React.FC<AILabelProps>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
+
import { Icon } from '../Icon/Icon.mjs';
|
|
8
|
+
|
|
9
|
+
var semantic = tokens.semantic;
|
|
10
|
+
var color = semantic.color,
|
|
11
|
+
typography = semantic.typography,
|
|
12
|
+
size = semantic.size;
|
|
13
|
+
var labels = {
|
|
14
|
+
suggested: 'Suggested',
|
|
15
|
+
removal: 'Will be removed'
|
|
16
|
+
};
|
|
17
|
+
var sizeConfig = {
|
|
18
|
+
small: {
|
|
19
|
+
font: typography.caption,
|
|
20
|
+
gap: semantic.space[100],
|
|
21
|
+
icon: 'xs'
|
|
22
|
+
},
|
|
23
|
+
medium: {
|
|
24
|
+
font: typography.small,
|
|
25
|
+
gap: semantic.space[200],
|
|
26
|
+
icon: 'sm'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var StyledAILabel = /*#__PURE__*/styled.span.withConfig({
|
|
30
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
31
|
+
return !prop.startsWith('$');
|
|
32
|
+
},
|
|
33
|
+
displayName: "AILabel__StyledAILabel",
|
|
34
|
+
componentId: "sc-qknkn-0"
|
|
35
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n min-height: ", ";\n gap: ", ";\n font: ", ";\n color: ", ";\n white-space: nowrap;\n"], ["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n min-height: ", ";\n gap: ", ";\n font: ", ";\n color: ", ";\n white-space: nowrap;\n"])), function (_a) {
|
|
36
|
+
var $size = _a.$size;
|
|
37
|
+
return size.label[$size];
|
|
38
|
+
}, function (_a) {
|
|
39
|
+
var $size = _a.$size;
|
|
40
|
+
return sizeConfig[$size].gap;
|
|
41
|
+
}, function (_a) {
|
|
42
|
+
var $size = _a.$size;
|
|
43
|
+
return sizeConfig[$size].font;
|
|
44
|
+
}, color.text.ai);
|
|
45
|
+
var StyledIcon = /*#__PURE__*/styled.span.withConfig({
|
|
46
|
+
displayName: "AILabel__StyledIcon",
|
|
47
|
+
componentId: "sc-qknkn-1"
|
|
48
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-flex;\n color: ", ";\n"], ["\n display: inline-flex;\n color: ", ";\n"
|
|
49
|
+
/**
|
|
50
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
51
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
52
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <AILabel /> // "Suggested"
|
|
57
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
58
|
+
* ```
|
|
59
|
+
*/])), color.icon.ai);
|
|
60
|
+
/**
|
|
61
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
62
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
63
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <AILabel /> // "Suggested"
|
|
68
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
var AILabel = function AILabel(_a) {
|
|
72
|
+
var _b = _a.kind,
|
|
73
|
+
kind = _b === void 0 ? 'suggested' : _b,
|
|
74
|
+
_c = _a.size,
|
|
75
|
+
labelSize = _c === void 0 ? 'medium' : _c,
|
|
76
|
+
dataTestId = _a["data-testid"];
|
|
77
|
+
return jsxs(StyledAILabel, {
|
|
78
|
+
"$size": labelSize,
|
|
79
|
+
"data-testid": dataTestId,
|
|
80
|
+
children: [jsx(StyledIcon, {
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
children: jsx(Icon, {
|
|
83
|
+
name: "ai",
|
|
84
|
+
size: sizeConfig[labelSize].icon,
|
|
85
|
+
iconColor: "inherit"
|
|
86
|
+
})
|
|
87
|
+
}), labels[kind]]
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
AILabel.displayName = 'AILabel';
|
|
91
|
+
var templateObject_1, templateObject_2;
|
|
92
|
+
|
|
93
|
+
export { AILabel };
|
|
94
|
+
//# sourceMappingURL=AILabel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AILabel.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AILabel.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AILabel';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SuggestionChipProps {
|
|
3
|
+
/** The suggestion. It's also the button's accessible name, so keep it short and self-explanatory. */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Called when the suggestion is picked. Put its text in the input; never send it (decision 0046). */
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
/** Disables the chip */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Test identifier for automated testing */
|
|
10
|
+
'data-testid'?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
14
|
+
*
|
|
15
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
16
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
17
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
21
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
22
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
23
|
+
*/
|
|
24
|
+
export declare const SuggestionChip: React.FC<SuggestionChipProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SuggestionChipProps {
|
|
3
|
+
/** The suggestion. It's also the button's accessible name, so keep it short and self-explanatory. */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Called when the suggestion is picked. Put its text in the input; never send it (decision 0046). */
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
/** Disables the chip */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Test identifier for automated testing */
|
|
10
|
+
'data-testid'?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
14
|
+
*
|
|
15
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
16
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
17
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
21
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
22
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
23
|
+
*/
|
|
24
|
+
export declare const SuggestionChip: React.FC<SuggestionChipProps>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
+
import { forcedColors } from '../../../lib/styleUtils.mjs';
|
|
8
|
+
import { sizeStyles } from './shared/utils.mjs';
|
|
9
|
+
|
|
10
|
+
var chip = tokens.component.chip,
|
|
11
|
+
semantic = tokens.semantic;
|
|
12
|
+
var color = semantic.color;
|
|
13
|
+
// Outlined, with the naked fill ladder on hover and press (decisions 0030, 0046): the edge keeps it
|
|
14
|
+
// visible on white, the page and AgentInput's docked band
|
|
15
|
+
var StyledSuggestionChip = /*#__PURE__*/styled.button.withConfig({
|
|
16
|
+
displayName: "SuggestionChip__StyledSuggestionChip",
|
|
17
|
+
componentId: "sc-1k0njm-0"
|
|
18
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n margin: 0;\n box-sizing: border-box;\n border: ", " solid ", ";\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n text-align: start;\n /* A long suggestion wraps inside the chip rather than being cut off (issue 279) */\n white-space: normal;\n overflow-wrap: anywhere;\n transition: ", ";\n ", "\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n border-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n /* Forced colours: a native button gets ButtonBorder and GrayText; keep the edge (decision 0038) */\n ", " {\n border-color: ButtonBorder;\n\n &:disabled {\n border-color: GrayText;\n }\n }\n"], ["\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n margin: 0;\n box-sizing: border-box;\n border: ", " solid ", ";\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n text-align: start;\n /* A long suggestion wraps inside the chip rather than being cut off (issue 279) */\n white-space: normal;\n overflow-wrap: anywhere;\n transition: ", ";\n ", "\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n border-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n /* Forced colours: a native button gets ButtonBorder and GrayText; keep the edge (decision 0038) */\n ", " {\n border-color: ButtonBorder;\n\n &:disabled {\n border-color: GrayText;\n }\n }\n"
|
|
19
|
+
/**
|
|
20
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
21
|
+
*
|
|
22
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
23
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
24
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
28
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
29
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
30
|
+
*/])), semantic.border.width.thin, color.border.input, chip["default"].borderRadius, color.fill.none, color.text["default"], semantic.motion.transition.feedback, sizeStyles, color.fill['none-hover'], color.fill['none-pressed'], chip.focus.outline, semantic.border.focusOffset, color.border.emphasis, color.text.disabled, forcedColors);
|
|
31
|
+
/**
|
|
32
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
33
|
+
*
|
|
34
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
35
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
36
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
37
|
+
*
|
|
38
|
+
* Features:
|
|
39
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
40
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
41
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
42
|
+
*/
|
|
43
|
+
var SuggestionChip = function SuggestionChip(_a) {
|
|
44
|
+
var children = _a.children,
|
|
45
|
+
onClick = _a.onClick,
|
|
46
|
+
_b = _a.disabled,
|
|
47
|
+
disabled = _b === void 0 ? false : _b,
|
|
48
|
+
dataTestId = _a["data-testid"];
|
|
49
|
+
return jsx(StyledSuggestionChip, {
|
|
50
|
+
type: "button",
|
|
51
|
+
onClick: onClick,
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
"data-testid": dataTestId,
|
|
54
|
+
children: children
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
SuggestionChip.displayName = 'SuggestionChip';
|
|
58
|
+
var templateObject_1;
|
|
59
|
+
|
|
60
|
+
export { SuggestionChip };
|
|
61
|
+
//# sourceMappingURL=SuggestionChip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuggestionChip.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -8,8 +8,31 @@ export interface AgentInputProps {
|
|
|
8
8
|
value?: string;
|
|
9
9
|
defaultValue?: string;
|
|
10
10
|
onChange?: (value: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Called on Enter, Send, or a final voice transcript. When it resolves, the field clears if it
|
|
13
|
+
* still holds the submitted text (a follow-up typed meanwhile is kept). When it rejects, the text stays.
|
|
14
|
+
*/
|
|
11
15
|
onSubmit: (payload: SubmitPayload) => void | Promise<void>;
|
|
16
|
+
/** While submitting, turns Send into Stop and lets Escape stop. */
|
|
17
|
+
onStop?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* The review bar above the field, for an agent's proposal or an applied change (decision 0046).
|
|
20
|
+
* Omit it when there's nothing to review or undo.
|
|
21
|
+
*/
|
|
22
|
+
review?: AgentInputReview;
|
|
23
|
+
/**
|
|
24
|
+
* Prompt starters or follow-ups, shown above the field while it's empty and no proposal is open.
|
|
25
|
+
* At most three are shown. Picking one fills the field and focuses it; it never sends.
|
|
26
|
+
*/
|
|
27
|
+
suggestions?: string[];
|
|
28
|
+
/** Called with a suggestion's text when it's picked, after it fills the field */
|
|
29
|
+
onSuggestionSelect?: (text: string) => void;
|
|
12
30
|
placeholder?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Soft character limit for the submitted text. Typing past it is allowed, but Send is disabled and
|
|
33
|
+
* the counter and status line show the message is too long. A counter appears from 80% of the limit.
|
|
34
|
+
*/
|
|
35
|
+
maxLength?: number;
|
|
13
36
|
disabled?: boolean;
|
|
14
37
|
isSubmitting?: boolean;
|
|
15
38
|
enableVoice?: boolean;
|
|
@@ -21,10 +44,49 @@ export interface AgentInputProps {
|
|
|
21
44
|
onVoiceInterim?: (text: string) => void;
|
|
22
45
|
onVoiceFinal?: (text: string) => void;
|
|
23
46
|
onVoiceError?: (error: AgentInputVoiceError) => void;
|
|
47
|
+
/** Hint shown in the status line while idle or typing. Empty by default. */
|
|
48
|
+
helperText?: string;
|
|
49
|
+
/** Overrides the status line in every non-error state. */
|
|
24
50
|
statusMessage?: string;
|
|
51
|
+
/** Shown in the status line, styled and announced as an error, whenever it is set. */
|
|
25
52
|
errorMessage?: string;
|
|
26
53
|
label?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Sticks the input to the bottom of its scroll container, on the sticky layer, over a band of page
|
|
56
|
+
* background with room for the phone's home indicator. Render it as the last child of the
|
|
57
|
+
* scrolling content.
|
|
58
|
+
*/
|
|
59
|
+
docked?: boolean;
|
|
27
60
|
'data-testid'?: string;
|
|
28
61
|
}
|
|
29
|
-
|
|
62
|
+
/**
|
|
63
|
+
* An agent's proposal waiting for review, or a change already applied (decision 0046). In the
|
|
64
|
+
* proposal state the bar shows the summary with Accept and Discard; once applied, "Changes applied"
|
|
65
|
+
* with Undo.
|
|
66
|
+
*/
|
|
67
|
+
export type AgentInputReview = {
|
|
68
|
+
state: 'proposal';
|
|
69
|
+
/**
|
|
70
|
+
* Identifies this proposal. A new id while a proposal is open announces it as a replacement
|
|
71
|
+
* ("Proposal updated."), even when the summary is the same (decision 0047).
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
/** What the agent proposes. Say what changed, for example "3 changes: Tuesday is now fish" */
|
|
75
|
+
summary: string;
|
|
76
|
+
onAccept: () => void;
|
|
77
|
+
onDiscard: () => void;
|
|
78
|
+
} | {
|
|
79
|
+
state: 'applied';
|
|
80
|
+
onUndo: () => void;
|
|
81
|
+
};
|
|
82
|
+
export interface AgentInputFocusOptions {
|
|
83
|
+
/** Where to put the caret. Omit to keep the browser's default. */
|
|
84
|
+
cursor?: 'start' | 'end' | 'all';
|
|
85
|
+
}
|
|
86
|
+
/** Imperative handle, for products that focus or clear the field from their own controls. */
|
|
87
|
+
export interface AgentInputHandle {
|
|
88
|
+
focus: (options?: AgentInputFocusOptions) => void;
|
|
89
|
+
clear: () => void;
|
|
90
|
+
}
|
|
91
|
+
export declare const AgentInput: import("react").ForwardRefExoticComponent<AgentInputProps & import("react").RefAttributes<AgentInputHandle>>;
|
|
30
92
|
export {};
|
|
@@ -8,8 +8,31 @@ export interface AgentInputProps {
|
|
|
8
8
|
value?: string;
|
|
9
9
|
defaultValue?: string;
|
|
10
10
|
onChange?: (value: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Called on Enter, Send, or a final voice transcript. When it resolves, the field clears if it
|
|
13
|
+
* still holds the submitted text (a follow-up typed meanwhile is kept). When it rejects, the text stays.
|
|
14
|
+
*/
|
|
11
15
|
onSubmit: (payload: SubmitPayload) => void | Promise<void>;
|
|
16
|
+
/** While submitting, turns Send into Stop and lets Escape stop. */
|
|
17
|
+
onStop?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* The review bar above the field, for an agent's proposal or an applied change (decision 0046).
|
|
20
|
+
* Omit it when there's nothing to review or undo.
|
|
21
|
+
*/
|
|
22
|
+
review?: AgentInputReview;
|
|
23
|
+
/**
|
|
24
|
+
* Prompt starters or follow-ups, shown above the field while it's empty and no proposal is open.
|
|
25
|
+
* At most three are shown. Picking one fills the field and focuses it; it never sends.
|
|
26
|
+
*/
|
|
27
|
+
suggestions?: string[];
|
|
28
|
+
/** Called with a suggestion's text when it's picked, after it fills the field */
|
|
29
|
+
onSuggestionSelect?: (text: string) => void;
|
|
12
30
|
placeholder?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Soft character limit for the submitted text. Typing past it is allowed, but Send is disabled and
|
|
33
|
+
* the counter and status line show the message is too long. A counter appears from 80% of the limit.
|
|
34
|
+
*/
|
|
35
|
+
maxLength?: number;
|
|
13
36
|
disabled?: boolean;
|
|
14
37
|
isSubmitting?: boolean;
|
|
15
38
|
enableVoice?: boolean;
|
|
@@ -21,10 +44,49 @@ export interface AgentInputProps {
|
|
|
21
44
|
onVoiceInterim?: (text: string) => void;
|
|
22
45
|
onVoiceFinal?: (text: string) => void;
|
|
23
46
|
onVoiceError?: (error: AgentInputVoiceError) => void;
|
|
47
|
+
/** Hint shown in the status line while idle or typing. Empty by default. */
|
|
48
|
+
helperText?: string;
|
|
49
|
+
/** Overrides the status line in every non-error state. */
|
|
24
50
|
statusMessage?: string;
|
|
51
|
+
/** Shown in the status line, styled and announced as an error, whenever it is set. */
|
|
25
52
|
errorMessage?: string;
|
|
26
53
|
label?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Sticks the input to the bottom of its scroll container, on the sticky layer, over a band of page
|
|
56
|
+
* background with room for the phone's home indicator. Render it as the last child of the
|
|
57
|
+
* scrolling content.
|
|
58
|
+
*/
|
|
59
|
+
docked?: boolean;
|
|
27
60
|
'data-testid'?: string;
|
|
28
61
|
}
|
|
29
|
-
|
|
62
|
+
/**
|
|
63
|
+
* An agent's proposal waiting for review, or a change already applied (decision 0046). In the
|
|
64
|
+
* proposal state the bar shows the summary with Accept and Discard; once applied, "Changes applied"
|
|
65
|
+
* with Undo.
|
|
66
|
+
*/
|
|
67
|
+
export type AgentInputReview = {
|
|
68
|
+
state: 'proposal';
|
|
69
|
+
/**
|
|
70
|
+
* Identifies this proposal. A new id while a proposal is open announces it as a replacement
|
|
71
|
+
* ("Proposal updated."), even when the summary is the same (decision 0047).
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
/** What the agent proposes. Say what changed, for example "3 changes: Tuesday is now fish" */
|
|
75
|
+
summary: string;
|
|
76
|
+
onAccept: () => void;
|
|
77
|
+
onDiscard: () => void;
|
|
78
|
+
} | {
|
|
79
|
+
state: 'applied';
|
|
80
|
+
onUndo: () => void;
|
|
81
|
+
};
|
|
82
|
+
export interface AgentInputFocusOptions {
|
|
83
|
+
/** Where to put the caret. Omit to keep the browser's default. */
|
|
84
|
+
cursor?: 'start' | 'end' | 'all';
|
|
85
|
+
}
|
|
86
|
+
/** Imperative handle, for products that focus or clear the field from their own controls. */
|
|
87
|
+
export interface AgentInputHandle {
|
|
88
|
+
focus: (options?: AgentInputFocusOptions) => void;
|
|
89
|
+
clear: () => void;
|
|
90
|
+
}
|
|
91
|
+
export declare const AgentInput: import("react").ForwardRefExoticComponent<AgentInputProps & import("react").RefAttributes<AgentInputHandle>>;
|
|
30
92
|
export {};
|