@cloudscape-design/components 3.0.1270 → 3.0.1271
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/app-layout/visual-refresh-toolbar/toolbar/index.js +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +1 -2
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.css.js +6 -7
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.scoped.css +20 -26
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.selectors.js +6 -7
- package/button/styles.css.js +22 -22
- package/button/styles.scoped.css +78 -78
- package/button/styles.selectors.js +22 -22
- package/help-panel/styles.css.js +6 -6
- package/help-panel/styles.scoped.css +70 -70
- package/help-panel/styles.selectors.js +6 -6
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.ar.js +1 -1
- package/i18n/messages/all.ar.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +18 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/internal/base-component/styles.scoped.css +63 -4
- package/internal/components/token-list/styles.css.js +10 -10
- package/internal/components/token-list/styles.scoped.css +25 -25
- package/internal/components/token-list/styles.selectors.js +10 -10
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/styles/tokens.d.ts +17 -3
- package/internal/generated/styles/tokens.js +17 -3
- package/internal/generated/theming/index.cjs +417 -9
- package/internal/generated/theming/index.cjs.d.ts +189 -0
- package/internal/generated/theming/index.d.ts +189 -0
- package/internal/generated/theming/index.js +417 -9
- package/internal/keycode.d.ts +3 -1
- package/internal/keycode.d.ts.map +1 -1
- package/internal/keycode.js +5 -0
- package/internal/keycode.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/handle-key.d.ts +22 -1
- package/internal/utils/handle-key.d.ts.map +1 -1
- package/internal/utils/handle-key.js +62 -4
- package/internal/utils/handle-key.js.map +1 -1
- package/link/styles.css.js +21 -21
- package/link/styles.scoped.css +81 -81
- package/link/styles.selectors.js +21 -21
- package/package.json +1 -1
- package/prompt-input/components/menu-dropdown.d.ts +33 -0
- package/prompt-input/components/menu-dropdown.d.ts.map +1 -0
- package/prompt-input/components/menu-dropdown.js +48 -0
- package/prompt-input/components/menu-dropdown.js.map +1 -0
- package/prompt-input/components/textarea-mode.d.ts +15 -0
- package/prompt-input/components/textarea-mode.d.ts.map +1 -0
- package/prompt-input/components/textarea-mode.js +8 -0
- package/prompt-input/components/textarea-mode.js.map +1 -0
- package/prompt-input/components/token-mode.d.ts +61 -0
- package/prompt-input/components/token-mode.d.ts.map +1 -0
- package/prompt-input/components/token-mode.js +37 -0
- package/prompt-input/components/token-mode.js.map +1 -0
- package/prompt-input/core/caret-controller.d.ts +73 -0
- package/prompt-input/core/caret-controller.d.ts.map +1 -0
- package/prompt-input/core/caret-controller.js +396 -0
- package/prompt-input/core/caret-controller.js.map +1 -0
- package/prompt-input/core/caret-spot-utils.d.ts +6 -0
- package/prompt-input/core/caret-spot-utils.d.ts.map +1 -0
- package/prompt-input/core/caret-spot-utils.js +52 -0
- package/prompt-input/core/caret-spot-utils.js.map +1 -0
- package/prompt-input/core/caret-utils.d.ts +25 -0
- package/prompt-input/core/caret-utils.d.ts.map +1 -0
- package/prompt-input/core/caret-utils.js +183 -0
- package/prompt-input/core/caret-utils.js.map +1 -0
- package/prompt-input/core/constants.d.ts +14 -0
- package/prompt-input/core/constants.d.ts.map +1 -0
- package/prompt-input/core/constants.js +18 -0
- package/prompt-input/core/constants.js.map +1 -0
- package/prompt-input/core/dom-utils.d.ts +60 -0
- package/prompt-input/core/dom-utils.d.ts.map +1 -0
- package/prompt-input/core/dom-utils.js +252 -0
- package/prompt-input/core/dom-utils.js.map +1 -0
- package/prompt-input/core/event-handlers.d.ts +68 -0
- package/prompt-input/core/event-handlers.d.ts.map +1 -0
- package/prompt-input/core/event-handlers.js +678 -0
- package/prompt-input/core/event-handlers.js.map +1 -0
- package/prompt-input/core/menu-state.d.ts +62 -0
- package/prompt-input/core/menu-state.d.ts.map +1 -0
- package/prompt-input/core/menu-state.js +168 -0
- package/prompt-input/core/menu-state.js.map +1 -0
- package/prompt-input/core/token-operations.d.ts +21 -0
- package/prompt-input/core/token-operations.d.ts.map +1 -0
- package/prompt-input/core/token-operations.js +273 -0
- package/prompt-input/core/token-operations.js.map +1 -0
- package/prompt-input/core/token-renderer.d.ts +26 -0
- package/prompt-input/core/token-renderer.d.ts.map +1 -0
- package/prompt-input/core/token-renderer.js +230 -0
- package/prompt-input/core/token-renderer.js.map +1 -0
- package/prompt-input/core/token-utils.d.ts +22 -0
- package/prompt-input/core/token-utils.d.ts.map +1 -0
- package/prompt-input/core/token-utils.js +262 -0
- package/prompt-input/core/token-utils.js.map +1 -0
- package/prompt-input/core/trigger-utils.d.ts +18 -0
- package/prompt-input/core/trigger-utils.d.ts.map +1 -0
- package/prompt-input/core/trigger-utils.js +174 -0
- package/prompt-input/core/trigger-utils.js.map +1 -0
- package/prompt-input/core/type-guards.d.ts +13 -0
- package/prompt-input/core/type-guards.d.ts.map +1 -0
- package/prompt-input/core/type-guards.js +36 -0
- package/prompt-input/core/type-guards.js.map +1 -0
- package/prompt-input/index.d.ts +1 -1
- package/prompt-input/index.d.ts.map +1 -1
- package/prompt-input/index.js.map +1 -1
- package/prompt-input/interfaces.d.ts +356 -7
- package/prompt-input/interfaces.d.ts.map +1 -1
- package/prompt-input/interfaces.js.map +1 -1
- package/prompt-input/internal.d.ts +1 -1
- package/prompt-input/internal.d.ts.map +1 -1
- package/prompt-input/internal.js +195 -61
- package/prompt-input/internal.js.map +1 -1
- package/prompt-input/styles.css.js +26 -17
- package/prompt-input/styles.scoped.css +152 -39
- package/prompt-input/styles.selectors.js +26 -17
- package/prompt-input/test-classes/styles.css.js +7 -6
- package/prompt-input/test-classes/styles.scoped.css +10 -6
- package/prompt-input/test-classes/styles.selectors.js +7 -6
- package/prompt-input/tokens/use-shortcuts.d.ts +37 -0
- package/prompt-input/tokens/use-shortcuts.d.ts.map +1 -0
- package/prompt-input/tokens/use-shortcuts.js +89 -0
- package/prompt-input/tokens/use-shortcuts.js.map +1 -0
- package/prompt-input/tokens/use-token-mode.d.ts +78 -0
- package/prompt-input/tokens/use-token-mode.d.ts.map +1 -0
- package/prompt-input/tokens/use-token-mode.js +817 -0
- package/prompt-input/tokens/use-token-mode.js.map +1 -0
- package/prompt-input/utils/insert-text-content-editable.d.ts +10 -0
- package/prompt-input/utils/insert-text-content-editable.d.ts.map +1 -0
- package/prompt-input/utils/insert-text-content-editable.js +133 -0
- package/prompt-input/utils/insert-text-content-editable.js.map +1 -0
- package/tabs/styles.css.js +30 -30
- package/tabs/styles.scoped.css +55 -55
- package/tabs/styles.selectors.js +30 -30
- package/test-utils/dom/hotspot/index.js +1 -2
- package/test-utils/dom/hotspot/index.js.map +1 -1
- package/test-utils/dom/prompt-input/index.d.ts +53 -1
- package/test-utils/dom/prompt-input/index.js +121 -13
- package/test-utils/dom/prompt-input/index.js.map +1 -1
- package/test-utils/dom/s3-resource-selector/index.js +2 -3
- package/test-utils/dom/s3-resource-selector/index.js.map +1 -1
- package/test-utils/selectors/hotspot/index.js +1 -2
- package/test-utils/selectors/hotspot/index.js.map +1 -1
- package/test-utils/selectors/prompt-input/index.d.ts +30 -0
- package/test-utils/selectors/prompt-input/index.js +53 -7
- package/test-utils/selectors/prompt-input/index.js.map +1 -1
- package/test-utils/selectors/s3-resource-selector/index.js +2 -3
- package/test-utils/selectors/s3-resource-selector/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,QAAA,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,QAAA,MAAM,WAAW,wIA8ChB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompt-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,mBAAmB,MAAM,YAAY,CAAC;AAI7C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CACE,EACE,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,EACX,GAAG,KAAK,EACS,EACnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompt-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,mBAAmB,MAAM,YAAY,CAAC;AAI7C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CACE,EACE,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,EACX,GAAG,KAAK,EACS,EACnB,GAA6E,EAC7E,EAAE;IACF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,aAAa,EAAE;QACzD,KAAK,EAAE;YACL,QAAQ;YACR,YAAY;YACZ,SAAS;YACT,yBAAyB;YACzB,mBAAmB;YACnB,UAAU;YACV,oBAAoB;YACpB,OAAO;YACP,OAAO;SACR;KACF,CAAC,CAAC;IACH,OAAO,CACL,oBAAC,mBAAmB,IAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,yBAAyB,EAAE,yBAAyB,EACpD,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,EAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,KACZ,KAAK,KACL,kBAAkB,EACtB,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAC7C,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { PromptInputProps } from './interfaces';\nimport InternalPromptInput from './internal';\n\nexport { PromptInputProps };\n\nconst PromptInput = React.forwardRef(\n (\n {\n autoComplete,\n autoFocus,\n disableBrowserAutocorrect,\n disableActionButton,\n spellcheck,\n readOnly,\n actionButtonIconName,\n minRows = 1,\n maxRows = 3,\n ...props\n }: PromptInputProps,\n ref: React.Ref<PromptInputProps.Ref | HTMLTextAreaElement | HTMLInputElement>\n ) => {\n const baseComponentProps = useBaseComponent('PromptInput', {\n props: {\n readOnly,\n autoComplete,\n autoFocus,\n disableBrowserAutocorrect,\n disableActionButton,\n spellcheck,\n actionButtonIconName,\n minRows,\n maxRows,\n },\n });\n return (\n <InternalPromptInput\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n disableActionButton={disableActionButton}\n spellcheck={spellcheck}\n actionButtonIconName={actionButtonIconName}\n minRows={minRows}\n maxRows={maxRows}\n {...props}\n {...baseComponentProps}\n ref={ref}\n />\n );\n }\n);\napplyDisplayName(PromptInput, 'PromptInput');\nexport default PromptInput;\n"]}
|
|
@@ -1,16 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseDropdownHostProps, OptionsFilteringType } from '../dropdown/interfaces';
|
|
1
3
|
import { IconProps } from '../icon/interfaces';
|
|
2
|
-
import {
|
|
4
|
+
import { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputSpellcheck } from '../input/interfaces';
|
|
3
5
|
import { BaseComponentProps } from '../internal/base-component';
|
|
6
|
+
import { DropdownStatusProps } from '../internal/components/dropdown-status';
|
|
7
|
+
import { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';
|
|
4
8
|
import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
|
|
5
|
-
import { BaseKeyDetail, NonCancelableEventHandler } from '../internal/events';
|
|
9
|
+
import { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';
|
|
6
10
|
/**
|
|
7
11
|
* @awsuiSystem core
|
|
8
12
|
*/
|
|
9
13
|
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
10
|
-
export interface PromptInputProps extends Omit<BaseInputProps, 'nativeInputAttributes'>, InputKeyEvents, InputAutoCorrect,
|
|
14
|
+
export interface PromptInputProps extends Omit<BaseInputProps, 'nativeInputAttributes' | 'name' | 'value' | 'onChange'>, InputKeyEvents, InputAutoCorrect, InputSpellcheck, BaseComponentProps, FormFieldValidationControlProps {
|
|
15
|
+
/**
|
|
16
|
+
* Specifies the name of the prompt input for form submissions.
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies whether to enable a browser's autocomplete functionality for this input.
|
|
21
|
+
* In some cases it might be appropriate to disable autocomplete (for example, for security-sensitive fields).
|
|
22
|
+
* To use it correctly, set the `name` property.
|
|
23
|
+
*
|
|
24
|
+
* You can either provide a boolean value to set the property to "on" or "off", or specify a string value
|
|
25
|
+
* for the [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute.
|
|
26
|
+
*
|
|
27
|
+
* Note: When `tokens` is defined, autocomplete will not function.
|
|
28
|
+
*/
|
|
29
|
+
autoComplete?: boolean | string;
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the content of the prompt input.
|
|
32
|
+
*
|
|
33
|
+
* When `tokens` is not defined:
|
|
34
|
+
* - This property is required
|
|
35
|
+
* - Represents the current text content of the textarea
|
|
36
|
+
*
|
|
37
|
+
* When `tokens` is defined:
|
|
38
|
+
* - This property is optional and defaults to empty string
|
|
39
|
+
* - The actual content is managed via the `tokens` array
|
|
40
|
+
*/
|
|
41
|
+
value?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies the content of the prompt input when using token mode.
|
|
44
|
+
*
|
|
45
|
+
* Available types and their properties:
|
|
46
|
+
* - Text tokens:
|
|
47
|
+
* - `value` contains the text content.
|
|
48
|
+
* - Reference tokens:
|
|
49
|
+
* - `id` as the unique identifier, this is auto-generated however when setting `tokens` it is required to provide an ID.
|
|
50
|
+
* - `value` contains the reference value.
|
|
51
|
+
* - `label` for display (e.g., 'file.txt').
|
|
52
|
+
* - `menuId` for the associated menu (optional).
|
|
53
|
+
* - `pinned` to render at the start of the input.
|
|
54
|
+
* - Trigger tokens:
|
|
55
|
+
* - `id` as the unique identifier, this is auto-generated however when setting `tokens` it is required to provide an ID.
|
|
56
|
+
* - `value` contains the filter text.
|
|
57
|
+
* - `triggerChar` for the trigger character.
|
|
58
|
+
*
|
|
59
|
+
* When `menus` is defined, you should use `tokens` to control the content instead of `value`.
|
|
60
|
+
*
|
|
61
|
+
* Requires React 18.
|
|
62
|
+
*/
|
|
63
|
+
tokens?: readonly PromptInputProps.InputToken[];
|
|
64
|
+
/**
|
|
65
|
+
* Custom function to transform tokens into plain text for the `value` field in `onChange` and `onAction` events
|
|
66
|
+
* and for the hidden input when `name` is specified.
|
|
67
|
+
*
|
|
68
|
+
* If not provided, falls back to a default simple implementation.
|
|
69
|
+
*
|
|
70
|
+
* Use this to customize serialization, for example:
|
|
71
|
+
* - Using `label` instead of `value` for reference tokens
|
|
72
|
+
* - Adding custom formatting or separators between tokens
|
|
73
|
+
*
|
|
74
|
+
* Requires React 18.
|
|
75
|
+
*/
|
|
76
|
+
tokensToText?: (tokens: readonly PromptInputProps.InputToken[]) => string;
|
|
77
|
+
/**
|
|
78
|
+
* Called whenever a user changes the input value (by typing or pasting).
|
|
79
|
+
* The event `detail` contains the current value as a string and an array of tokens.
|
|
80
|
+
*
|
|
81
|
+
* When `tokens` is defined, the `value` is derived from `tokensToText(tokens)` if provided, otherwise from a default simple implementation.
|
|
82
|
+
*/
|
|
83
|
+
onChange?: NonCancelableEventHandler<PromptInputProps.ChangeDetail>;
|
|
11
84
|
/**
|
|
12
85
|
* Called whenever a user clicks the action button or presses the "Enter" key.
|
|
13
|
-
* The event `detail` contains the current value of
|
|
86
|
+
* The event `detail` contains the current value as a string and an array of tokens.
|
|
87
|
+
*
|
|
88
|
+
* When `tokens` is defined, the `value` is derived from `tokensToText(tokens)` if provided, otherwise from a default simple implementation.
|
|
14
89
|
*/
|
|
15
90
|
onAction?: NonCancelableEventHandler<PromptInputProps.ActionDetail>;
|
|
16
91
|
/**
|
|
@@ -53,6 +128,7 @@ export interface PromptInputProps extends Omit<BaseInputProps, 'nativeInputAttri
|
|
|
53
128
|
/**
|
|
54
129
|
* Adds an aria-label to the action button.
|
|
55
130
|
* @i18n
|
|
131
|
+
* @deprecated Use `i18nStrings.actionButtonAriaLabel` instead.
|
|
56
132
|
*/
|
|
57
133
|
actionButtonAriaLabel?: string;
|
|
58
134
|
/**
|
|
@@ -92,6 +168,97 @@ export interface PromptInputProps extends Omit<BaseInputProps, 'nativeInputAttri
|
|
|
92
168
|
* Determines whether the secondary content area of the input has padding. If true, removes the default padding from the secondary content area.
|
|
93
169
|
*/
|
|
94
170
|
disableSecondaryContentPaddings?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Defines trigger-based menus that appear when the user types a specific character (e.g., `@` or `/`).
|
|
173
|
+
* Each menu definition maps a trigger character to a list of selectable options.
|
|
174
|
+
*
|
|
175
|
+
* Requires React 18.
|
|
176
|
+
*
|
|
177
|
+
* #### MenuDefinition
|
|
178
|
+
* - `id` (string) - Unique identifier for this menu. Used in event callbacks to identify the menu.
|
|
179
|
+
* - `trigger` (string) - The character that activates this menu (e.g., `@`, `/`, `#`).
|
|
180
|
+
* - `options` (Option[] | OptionGroup[]) - The selectable items shown in the dropdown.
|
|
181
|
+
* - `useAtStart` (boolean) - (Optional) When true, the trigger is only detected at the start of the input and after any pinned tokens. Selected options become pinned reference tokens. Defaults to false.
|
|
182
|
+
* - `filteringType` (`'auto'` | `'manual'`) - (Optional) How filtering is applied. `auto` filters options client-side based on typed text. `manual` disables built-in filtering — use `onMenuFilter` to provide filtered options. Defaults to `auto`.
|
|
183
|
+
* - `statusType` (`'pending'` | `'loading'` | `'finished'` | `'error'`) - (Optional) The loading status of the menu options. Use with `onMenuLoadItems` for async loading.
|
|
184
|
+
* - `empty` (string) - (Optional) Text shown when no options match the filter.
|
|
185
|
+
* - `virtualScroll` (boolean) - (Optional) Enables virtual scrolling for large option lists.
|
|
186
|
+
*/
|
|
187
|
+
menus?: PromptInputProps.MenuDefinition[];
|
|
188
|
+
/**
|
|
189
|
+
* Maximum height of the menu dropdown in pixels.
|
|
190
|
+
* When not specified, the menu will grow to fit its content.
|
|
191
|
+
*
|
|
192
|
+
* Requires React 18.
|
|
193
|
+
*/
|
|
194
|
+
maxMenuHeight?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Called whenever a user selects an option in a menu.
|
|
197
|
+
*
|
|
198
|
+
* Requires React 18.
|
|
199
|
+
*/
|
|
200
|
+
onMenuItemSelect?: NonCancelableEventHandler<PromptInputProps.MenuItemSelectDetail>;
|
|
201
|
+
/**
|
|
202
|
+
* Use this event to implement the asynchronous behavior for menus.
|
|
203
|
+
*
|
|
204
|
+
* The event is called in the following situations:
|
|
205
|
+
* - The user scrolls to the end of the list of options, if `statusType` is set to `pending` (pagination).
|
|
206
|
+
* - The user clicks on the recovery button in the error state.
|
|
207
|
+
* - The user types after the trigger character.
|
|
208
|
+
* - The menu is opened.
|
|
209
|
+
*
|
|
210
|
+
* The detail object contains the following properties:
|
|
211
|
+
* - `menuId` - The ID of the menu that triggered the event.
|
|
212
|
+
* - `filteringText` - The value to use to fetch options (undefined for pagination).
|
|
213
|
+
* - `firstPage` - Indicates that you should fetch the first page of options.
|
|
214
|
+
* - `samePage` - Indicates that you should fetch the same page (for example, when clicking recovery button).
|
|
215
|
+
*
|
|
216
|
+
* Requires React 18.
|
|
217
|
+
*/
|
|
218
|
+
onMenuLoadItems?: NonCancelableEventHandler<PromptInputProps.MenuLoadItemsDetail>;
|
|
219
|
+
/**
|
|
220
|
+
* Called when the user types to filter options in manual filtering mode for a menu.
|
|
221
|
+
* Use this to filter the options based on the filtering text.
|
|
222
|
+
*
|
|
223
|
+
* The detail object contains:
|
|
224
|
+
* - `menuId` - The ID of the menu that triggered the event.
|
|
225
|
+
* - `filteringText` - The text to use for filtering options.
|
|
226
|
+
*
|
|
227
|
+
* Requires React 18.
|
|
228
|
+
*/
|
|
229
|
+
onMenuFilter?: NonCancelableEventHandler<PromptInputProps.MenuFilterDetail>;
|
|
230
|
+
/**
|
|
231
|
+
* Called when a trigger character is detected and about to be converted to a trigger token.
|
|
232
|
+
* This event is cancellable - return `preventDefault()` to prevent the trigger from being created.
|
|
233
|
+
*
|
|
234
|
+
* The detail object contains:
|
|
235
|
+
* - `menuId` - The ID of the menu associated with the trigger.
|
|
236
|
+
* - `triggerChar` - The trigger character that was detected.
|
|
237
|
+
* - `position` - The position in the text where the trigger was detected.
|
|
238
|
+
*
|
|
239
|
+
* Use this to implement custom validation logic for triggers, such as preventing
|
|
240
|
+
* triggers that don't meet certain conditions (for example, limiting the amount of references in a prompt).
|
|
241
|
+
*
|
|
242
|
+
* Requires React 18.
|
|
243
|
+
*/
|
|
244
|
+
onTriggerDetected?: CancelableEventHandler<PromptInputProps.TriggerDetectedDetail>;
|
|
245
|
+
/**
|
|
246
|
+
* An object containing all the localized strings required by the component.
|
|
247
|
+
*
|
|
248
|
+
* - `ariaLabel` (string) - Adds an aria-label to the input element.
|
|
249
|
+
* - `actionButtonAriaLabel` (string) - Adds an aria-label to the action button.
|
|
250
|
+
* - `menuErrorIconAriaLabel` (string) - Provides a text alternative for the error icon in the error message in menus.
|
|
251
|
+
* - `menuRecoveryText` (string) - Specifies the text for the recovery button in menus. The text is displayed next to the error text.
|
|
252
|
+
* - `menuLoadingText` (string) - Specifies the text to display when menus are in a loading state.
|
|
253
|
+
* - `menuFinishedText` (string) - Specifies the text to display when menus have finished loading all items.
|
|
254
|
+
* - `menuErrorText` (string) - Specifies the text to display when menus encounter an error while loading.
|
|
255
|
+
* - `selectedMenuItemAriaLabel` (string) - Specifies the string that describes an option as being selected.
|
|
256
|
+
* - `tokenInsertedAriaLabel` ((token: { label?: string; value: string }) => string) - Aria label announced when a reference token is inserted from a menu. Receives the token object with label and value properties.
|
|
257
|
+
* - `tokenPinnedAriaLabel` ((token: { label?: string; value: string }) => string) - Aria label announced when a reference token is pinned (inserted at the start). Receives the token object with label and value properties.
|
|
258
|
+
* - `tokenRemovedAriaLabel` ((token: { label?: string; value: string }) => string) - Aria label announced when a reference token is removed. Receives the token object with label and value properties.
|
|
259
|
+
* @i18n
|
|
260
|
+
*/
|
|
261
|
+
i18nStrings?: PromptInputProps.I18nStrings;
|
|
95
262
|
/**
|
|
96
263
|
* Attributes to add to the native `textarea` element.
|
|
97
264
|
* Some attributes will be automatically combined with internal attribute values:
|
|
@@ -99,20 +266,190 @@ export interface PromptInputProps extends Omit<BaseInputProps, 'nativeInputAttri
|
|
|
99
266
|
* - Event handlers will be chained, unless the default is prevented.
|
|
100
267
|
*
|
|
101
268
|
* We do not support using this attribute to apply custom styling.
|
|
269
|
+
* When `tokens` is defined, nativeTextareaAttributes will be ignored.
|
|
102
270
|
*
|
|
103
271
|
* @awsuiSystem core
|
|
104
272
|
*/
|
|
105
273
|
nativeTextareaAttributes?: NativeAttributes<React.TextareaHTMLAttributes<HTMLTextAreaElement>>;
|
|
106
274
|
/**
|
|
107
|
-
* An object containing CSS properties to customize the prompt input's visual appearance.
|
|
108
|
-
* Refer to the [style](/components/prompt-input/?tabId=style) tab for more details.
|
|
109
275
|
* @awsuiSystem core
|
|
110
276
|
*/
|
|
111
277
|
style?: PromptInputProps.Style;
|
|
112
278
|
}
|
|
113
279
|
export declare namespace PromptInputProps {
|
|
114
280
|
type KeyDetail = BaseKeyDetail;
|
|
115
|
-
|
|
281
|
+
interface I18nStrings {
|
|
282
|
+
actionButtonAriaLabel?: string;
|
|
283
|
+
menuErrorIconAriaLabel?: string;
|
|
284
|
+
menuRecoveryText?: string;
|
|
285
|
+
menuLoadingText?: string;
|
|
286
|
+
menuFinishedText?: string;
|
|
287
|
+
menuErrorText?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Aria label announced when a reference token is inserted from a menu.
|
|
290
|
+
* Receives the token object with label and value properties.
|
|
291
|
+
* @param token The inserted token
|
|
292
|
+
* @returns The announcement string
|
|
293
|
+
* @default `${token.label || token.value} inserted`
|
|
294
|
+
*/
|
|
295
|
+
tokenInsertedAriaLabel?: (token: {
|
|
296
|
+
label?: string;
|
|
297
|
+
value: string;
|
|
298
|
+
}) => string;
|
|
299
|
+
/**
|
|
300
|
+
* Aria label announced when a reference token is pinned (inserted at the start).
|
|
301
|
+
* Receives the token object with label and value properties.
|
|
302
|
+
* @param token The pinned token
|
|
303
|
+
* @returns The announcement string
|
|
304
|
+
* @default `${token.label || token.value} pinned`
|
|
305
|
+
*/
|
|
306
|
+
tokenPinnedAriaLabel?: (token: {
|
|
307
|
+
label?: string;
|
|
308
|
+
value: string;
|
|
309
|
+
}) => string;
|
|
310
|
+
/**
|
|
311
|
+
* Aria label announced when a reference token is removed.
|
|
312
|
+
* Receives the token object with label and value properties.
|
|
313
|
+
* @param token The removed token
|
|
314
|
+
* @returns The announcement string
|
|
315
|
+
* @default `${token.label || token.value} removed`
|
|
316
|
+
*/
|
|
317
|
+
tokenRemovedAriaLabel?: (token: {
|
|
318
|
+
label?: string;
|
|
319
|
+
value: string;
|
|
320
|
+
}) => string;
|
|
321
|
+
}
|
|
322
|
+
interface TextToken {
|
|
323
|
+
type: 'text' | 'break';
|
|
324
|
+
value: string;
|
|
325
|
+
}
|
|
326
|
+
interface ReferenceToken {
|
|
327
|
+
type: 'reference';
|
|
328
|
+
id: string;
|
|
329
|
+
label: string;
|
|
330
|
+
value: string;
|
|
331
|
+
/**
|
|
332
|
+
* The ID of the menu this reference was selected from.
|
|
333
|
+
* Optional — references can exist without being bound to a menu
|
|
334
|
+
* (e.g., preloaded references from external sources).
|
|
335
|
+
*/
|
|
336
|
+
menuId?: string;
|
|
337
|
+
/**
|
|
338
|
+
* When true, prevents user entered text from being placed before this token.
|
|
339
|
+
* Typically set for reference tokens from useAtStart menus.
|
|
340
|
+
*/
|
|
341
|
+
pinned?: boolean;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Token type for menu triggers with filter text.
|
|
345
|
+
* Represents a trigger character (e.g., "@" or "/") followed by filtering text.
|
|
346
|
+
* This token type is automatically managed by the component when menus are active.
|
|
347
|
+
*
|
|
348
|
+
* - `value`: The filtering text (without the trigger character)
|
|
349
|
+
* - `triggerChar`: The trigger character that opened the menu
|
|
350
|
+
*/
|
|
351
|
+
interface TriggerToken {
|
|
352
|
+
type: 'trigger';
|
|
353
|
+
value: string;
|
|
354
|
+
triggerChar: string;
|
|
355
|
+
id: string;
|
|
356
|
+
}
|
|
357
|
+
type InputToken = TextToken | ReferenceToken | TriggerToken;
|
|
358
|
+
interface ChangeDetail {
|
|
359
|
+
value: string;
|
|
360
|
+
tokens?: readonly InputToken[];
|
|
361
|
+
}
|
|
362
|
+
interface ActionDetail {
|
|
363
|
+
value: string;
|
|
364
|
+
tokens?: readonly InputToken[];
|
|
365
|
+
}
|
|
366
|
+
interface MenuItemSelectDetail {
|
|
367
|
+
menuId: string;
|
|
368
|
+
option: OptionDefinition;
|
|
369
|
+
}
|
|
370
|
+
interface MenuLoadItemsDetail {
|
|
371
|
+
menuId: string;
|
|
372
|
+
filteringText?: string;
|
|
373
|
+
firstPage: boolean;
|
|
374
|
+
samePage: boolean;
|
|
375
|
+
}
|
|
376
|
+
interface MenuFilterDetail {
|
|
377
|
+
menuId: string;
|
|
378
|
+
filteringText: string;
|
|
379
|
+
}
|
|
380
|
+
interface TriggerDetectedDetail {
|
|
381
|
+
menuId: string;
|
|
382
|
+
triggerChar: string;
|
|
383
|
+
position: number;
|
|
384
|
+
}
|
|
385
|
+
interface MenuDefinition extends Pick<DropdownStatusProps, 'empty' | 'statusType'>, Pick<BaseDropdownHostProps, 'virtualScroll'> {
|
|
386
|
+
/**
|
|
387
|
+
* The unique identifier for this menu.
|
|
388
|
+
*/
|
|
389
|
+
id: string;
|
|
390
|
+
/**
|
|
391
|
+
* The unique trigger symbol for showing this menu.
|
|
392
|
+
*/
|
|
393
|
+
trigger: string;
|
|
394
|
+
/**
|
|
395
|
+
* Set `useAtStart=true` for menus where a trigger should only be detected at the start of input.
|
|
396
|
+
* Set this for menus designated to modes or actions.
|
|
397
|
+
*
|
|
398
|
+
* Menus with `useAtStart=true` create pinned reference tokens.
|
|
399
|
+
*/
|
|
400
|
+
useAtStart?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Specifies an array of options that are displayed to the user as a list.
|
|
403
|
+
* The options can be grouped using `OptionGroup` objects.
|
|
404
|
+
*
|
|
405
|
+
* #### Option
|
|
406
|
+
* - `value` (string) - The returned value of the option when selected.
|
|
407
|
+
* - `label` (string) - (Optional) Option text displayed to the user.
|
|
408
|
+
* - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.
|
|
409
|
+
* - `description` (string) - (Optional) Further information about the option that appears below the label.
|
|
410
|
+
* - `disabled` (boolean) - (Optional) Determines whether the option is disabled.
|
|
411
|
+
* - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.
|
|
412
|
+
* - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.
|
|
413
|
+
* - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.
|
|
414
|
+
* - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.
|
|
415
|
+
* - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.
|
|
416
|
+
* - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \`iconAriaLabel\`. Specifies alternate text for a custom icon, for use with `iconUrl`.
|
|
417
|
+
* - `iconUrl` (string) - (Optional) URL of a custom icon.
|
|
418
|
+
* - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).
|
|
419
|
+
*
|
|
420
|
+
* #### OptionGroup
|
|
421
|
+
* - `label` (string) - Option group text displayed to the user.
|
|
422
|
+
* - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.
|
|
423
|
+
* - `options` (Option[]) - (Optional) The options under this group.
|
|
424
|
+
*
|
|
425
|
+
* Note: Only one level of option nesting is supported.
|
|
426
|
+
*
|
|
427
|
+
* If you want to use the built-in filtering capabilities of this component, provide
|
|
428
|
+
* a list of all valid options here and they will be automatically filtered based on the user's filtering input.
|
|
429
|
+
*
|
|
430
|
+
* Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options
|
|
431
|
+
* on your own.
|
|
432
|
+
*/
|
|
433
|
+
options: (OptionDefinition | OptionGroup)[];
|
|
434
|
+
/**
|
|
435
|
+
* Determines how filtering is applied to the list of `options`:
|
|
436
|
+
*
|
|
437
|
+
* - `auto` - The component will automatically filter options based on user input.
|
|
438
|
+
* - `manual` - You will set up `onMenuFilter` event listeners and filter options on your side or request
|
|
439
|
+
* them from server.
|
|
440
|
+
*
|
|
441
|
+
* By default the component will filter the provided `options` based on the value of the filtering input field.
|
|
442
|
+
* Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring
|
|
443
|
+
* are displayed in the list of options.
|
|
444
|
+
*
|
|
445
|
+
* If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are
|
|
446
|
+
* displayed in the menu. In that case make sure that you use the `onMenuFilter` event in order
|
|
447
|
+
* to set the `options` property to the options that are relevant for the user, given the filtering input value.
|
|
448
|
+
*
|
|
449
|
+
* Note: Manual filtering doesn't disable match highlighting.
|
|
450
|
+
**/
|
|
451
|
+
filteringType?: Exclude<OptionsFilteringType, 'none'>;
|
|
452
|
+
}
|
|
116
453
|
interface Ref {
|
|
117
454
|
/**
|
|
118
455
|
* Sets input focus on the textarea control.
|
|
@@ -130,6 +467,18 @@ export declare namespace PromptInputProps {
|
|
|
130
467
|
* common pitfalls: https://stackoverflow.com/questions/60129605/is-javascripts-setselectionrange-incompatible-with-react-hooks
|
|
131
468
|
*/
|
|
132
469
|
setSelectionRange(start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none'): void;
|
|
470
|
+
/**
|
|
471
|
+
* Inserts text at a specified position. Only supported when `tokens` is defined.
|
|
472
|
+
* Triggers input events and menu detection.
|
|
473
|
+
*
|
|
474
|
+
* When pinned reference tokens are present, `caretStart` and `caretEnd` are automatically
|
|
475
|
+
* shifted to account for their positions.
|
|
476
|
+
*
|
|
477
|
+
* @param text The text to insert.
|
|
478
|
+
* @param caretStart Position to insert at. Defaults to current caret position or 0.
|
|
479
|
+
* @param caretEnd Caret position after insertion. Defaults to end of inserted text.
|
|
480
|
+
*/
|
|
481
|
+
insertText(text: string, caretStart?: number, caretEnd?: number): void;
|
|
133
482
|
}
|
|
134
483
|
interface Style {
|
|
135
484
|
root?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3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Z,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;YACF,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,SAAS,CAAC,EAAE;gBACV,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;YACF,KAAK,CAAC,EAAE;gBACN,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;YACF,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/prompt-input/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IconProps } from '../icon/interfaces';\nimport {\n BaseChangeDetail,\n BaseInputProps,\n InputAutoComplete,\n InputAutoCorrect,\n InputKeyEvents,\n InputSpellcheck,\n} from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseKeyDetail, NonCancelableEventHandler } from '../internal/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface PromptInputProps\n extends Omit<BaseInputProps, 'nativeInputAttributes'>,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Called whenever a user clicks the action button or presses the \"Enter\" key.\n * The event `detail` contains the current value of the field.\n */\n onAction?: NonCancelableEventHandler<PromptInputProps.ActionDetail>;\n /**\n * Determines what icon to display in the action button.\n */\n actionButtonIconName?: IconProps.Name;\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `actionButtonIconSvg` will take precedence.\n */\n actionButtonIconUrl?: string;\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `iconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n actionButtonIconSvg?: React.ReactNode;\n /**\n * Specifies alternate text for a custom icon. We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `iconSvg` slot.\n */\n actionButtonIconAlt?: string;\n /**\n * Adds an aria-label to the action button.\n * @i18n\n */\n actionButtonAriaLabel?: string;\n\n /**\n * Specifies whether to disable the action button.\n */\n disableActionButton?: boolean;\n\n /**\n * Specifies the minimum number of lines of text to set the height to.\n */\n minRows?: number;\n\n /**\n * Specifies the maximum number of lines of text the textarea will expand to.\n * Defaults to 3. Use -1 for infinite rows.\n */\n maxRows?: number;\n\n /**\n * Use this to replace the primary action.\n * If this is provided then any other `actionButton*` properties will be ignored.\n * Note that you should still provide an `onAction` function in order to handle keyboard submission.\n *\n * @awsuiSystem core\n */\n customPrimaryAction?: React.ReactNode;\n\n /**\n * Use this slot to add secondary actions to the prompt input.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Use this slot to add secondary content, such as file attachments, to the prompt input.\n */\n secondaryContent?: React.ReactNode;\n\n /**\n * Determines whether the secondary actions area of the input has padding. If true, removes the default padding from the secondary actions area.\n */\n disableSecondaryActionsPaddings?: boolean;\n\n /**\n * Determines whether the secondary content area of the input has padding. If true, removes the default padding from the secondary content area.\n */\n disableSecondaryContentPaddings?: boolean;\n\n /**\n * Attributes to add to the native `textarea` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTextareaAttributes?: NativeAttributes<React.TextareaHTMLAttributes<HTMLTextAreaElement>>;\n\n /**\n * An object containing CSS properties to customize the prompt input's visual appearance.\n * Refer to the [style](/components/prompt-input/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: PromptInputProps.Style;\n}\n\nexport namespace PromptInputProps {\n export type KeyDetail = BaseKeyDetail;\n export type ActionDetail = BaseChangeDetail;\n\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n\n /**\n * Selects all text in the textarea control.\n */\n select(): void;\n\n /**\n * Selects a range of text in the textarea control.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/setSelectionRange\n * for more details on this method. Be aware that using this method in React has some\n * common pitfalls: https://stackoverflow.com/questions/60129605/is-javascripts-setselectionrange-incompatible-with-react-hooks\n */\n setSelectionRange(start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none'): void;\n }\n\n export interface Style {\n root?: {\n backgroundColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n color?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n fontSize?: string;\n fontWeight?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n placeholder?: {\n color?: string;\n fontSize?: string;\n fontStyle?: string;\n fontWeight?: string;\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/prompt-input/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseDropdownHostProps, OptionsFilteringType } from '../dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputSpellcheck } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface PromptInputProps\n extends Omit<BaseInputProps, 'nativeInputAttributes' | 'name' | 'value' | 'onChange'>,\n InputKeyEvents,\n InputAutoCorrect,\n InputSpellcheck,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Specifies the name of the prompt input for form submissions.\n */\n name?: string;\n\n /**\n * Specifies whether to enable a browser's autocomplete functionality for this input.\n * In some cases it might be appropriate to disable autocomplete (for example, for security-sensitive fields).\n * To use it correctly, set the `name` property.\n *\n * You can either provide a boolean value to set the property to \"on\" or \"off\", or specify a string value\n * for the [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute.\n *\n * Note: When `tokens` is defined, autocomplete will not function.\n */\n autoComplete?: boolean | string;\n\n /**\n * Specifies the content of the prompt input.\n *\n * When `tokens` is not defined:\n * - This property is required\n * - Represents the current text content of the textarea\n *\n * When `tokens` is defined:\n * - This property is optional and defaults to empty string\n * - The actual content is managed via the `tokens` array\n */\n value?: string;\n\n /**\n * Specifies the content of the prompt input when using token mode.\n *\n * Available types and their properties:\n * - Text tokens:\n * - `value` contains the text content.\n * - Reference tokens:\n * - `id` as the unique identifier, this is auto-generated however when setting `tokens` it is required to provide an ID.\n * - `value` contains the reference value.\n * - `label` for display (e.g., 'file.txt').\n * - `menuId` for the associated menu (optional).\n * - `pinned` to render at the start of the input.\n * - Trigger tokens:\n * - `id` as the unique identifier, this is auto-generated however when setting `tokens` it is required to provide an ID.\n * - `value` contains the filter text.\n * - `triggerChar` for the trigger character.\n *\n * When `menus` is defined, you should use `tokens` to control the content instead of `value`.\n *\n * Requires React 18.\n */\n tokens?: readonly PromptInputProps.InputToken[];\n\n /**\n * Custom function to transform tokens into plain text for the `value` field in `onChange` and `onAction` events\n * and for the hidden input when `name` is specified.\n *\n * If not provided, falls back to a default simple implementation.\n *\n * Use this to customize serialization, for example:\n * - Using `label` instead of `value` for reference tokens\n * - Adding custom formatting or separators between tokens\n *\n * Requires React 18.\n */\n tokensToText?: (tokens: readonly PromptInputProps.InputToken[]) => string;\n\n /**\n * Called whenever a user changes the input value (by typing or pasting).\n * The event `detail` contains the current value as a string and an array of tokens.\n *\n * When `tokens` is defined, the `value` is derived from `tokensToText(tokens)` if provided, otherwise from a default simple implementation.\n */\n onChange?: NonCancelableEventHandler<PromptInputProps.ChangeDetail>;\n\n /**\n * Called whenever a user clicks the action button or presses the \"Enter\" key.\n * The event `detail` contains the current value as a string and an array of tokens.\n *\n * When `tokens` is defined, the `value` is derived from `tokensToText(tokens)` if provided, otherwise from a default simple implementation.\n */\n onAction?: NonCancelableEventHandler<PromptInputProps.ActionDetail>;\n\n /**\n * Determines what icon to display in the action button.\n */\n actionButtonIconName?: IconProps.Name;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `actionButtonIconSvg` will take precedence.\n */\n actionButtonIconUrl?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `iconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n actionButtonIconSvg?: React.ReactNode;\n\n /**\n * Specifies alternate text for a custom icon. We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `iconSvg` slot.\n */\n actionButtonIconAlt?: string;\n\n /**\n * Adds an aria-label to the action button.\n * @i18n\n * @deprecated Use `i18nStrings.actionButtonAriaLabel` instead.\n */\n actionButtonAriaLabel?: string;\n\n /**\n * Specifies whether to disable the action button.\n */\n disableActionButton?: boolean;\n\n /**\n * Specifies the minimum number of lines of text to set the height to.\n */\n minRows?: number;\n\n /**\n * Specifies the maximum number of lines of text the textarea will expand to.\n * Defaults to 3. Use -1 for infinite rows.\n */\n maxRows?: number;\n\n /**\n * Use this to replace the primary action.\n * If this is provided then any other `actionButton*` properties will be ignored.\n * Note that you should still provide an `onAction` function in order to handle keyboard submission.\n *\n * @awsuiSystem core\n */\n customPrimaryAction?: React.ReactNode;\n\n /**\n * Use this slot to add secondary actions to the prompt input.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Use this slot to add secondary content, such as file attachments, to the prompt input.\n */\n secondaryContent?: React.ReactNode;\n\n /**\n * Determines whether the secondary actions area of the input has padding. If true, removes the default padding from the secondary actions area.\n */\n disableSecondaryActionsPaddings?: boolean;\n\n /**\n * Determines whether the secondary content area of the input has padding. If true, removes the default padding from the secondary content area.\n */\n disableSecondaryContentPaddings?: boolean;\n\n /**\n * Defines trigger-based menus that appear when the user types a specific character (e.g., `@` or `/`).\n * Each menu definition maps a trigger character to a list of selectable options.\n *\n * Requires React 18.\n *\n * #### MenuDefinition\n * - `id` (string) - Unique identifier for this menu. Used in event callbacks to identify the menu.\n * - `trigger` (string) - The character that activates this menu (e.g., `@`, `/`, `#`).\n * - `options` (Option[] | OptionGroup[]) - The selectable items shown in the dropdown.\n * - `useAtStart` (boolean) - (Optional) When true, the trigger is only detected at the start of the input and after any pinned tokens. Selected options become pinned reference tokens. Defaults to false.\n * - `filteringType` (`'auto'` | `'manual'`) - (Optional) How filtering is applied. `auto` filters options client-side based on typed text. `manual` disables built-in filtering — use `onMenuFilter` to provide filtered options. Defaults to `auto`.\n * - `statusType` (`'pending'` | `'loading'` | `'finished'` | `'error'`) - (Optional) The loading status of the menu options. Use with `onMenuLoadItems` for async loading.\n * - `empty` (string) - (Optional) Text shown when no options match the filter.\n * - `virtualScroll` (boolean) - (Optional) Enables virtual scrolling for large option lists.\n */\n menus?: PromptInputProps.MenuDefinition[];\n\n /**\n * Maximum height of the menu dropdown in pixels.\n * When not specified, the menu will grow to fit its content.\n *\n * Requires React 18.\n */\n maxMenuHeight?: number;\n\n /**\n * Called whenever a user selects an option in a menu.\n *\n * Requires React 18.\n */\n onMenuItemSelect?: NonCancelableEventHandler<PromptInputProps.MenuItemSelectDetail>;\n\n /**\n * Use this event to implement the asynchronous behavior for menus.\n *\n * The event is called in the following situations:\n * - The user scrolls to the end of the list of options, if `statusType` is set to `pending` (pagination).\n * - The user clicks on the recovery button in the error state.\n * - The user types after the trigger character.\n * - The menu is opened.\n *\n * The detail object contains the following properties:\n * - `menuId` - The ID of the menu that triggered the event.\n * - `filteringText` - The value to use to fetch options (undefined for pagination).\n * - `firstPage` - Indicates that you should fetch the first page of options.\n * - `samePage` - Indicates that you should fetch the same page (for example, when clicking recovery button).\n *\n * Requires React 18.\n */\n onMenuLoadItems?: NonCancelableEventHandler<PromptInputProps.MenuLoadItemsDetail>;\n\n /**\n * Called when the user types to filter options in manual filtering mode for a menu.\n * Use this to filter the options based on the filtering text.\n *\n * The detail object contains:\n * - `menuId` - The ID of the menu that triggered the event.\n * - `filteringText` - The text to use for filtering options.\n *\n * Requires React 18.\n */\n onMenuFilter?: NonCancelableEventHandler<PromptInputProps.MenuFilterDetail>;\n\n /**\n * Called when a trigger character is detected and about to be converted to a trigger token.\n * This event is cancellable - return `preventDefault()` to prevent the trigger from being created.\n *\n * The detail object contains:\n * - `menuId` - The ID of the menu associated with the trigger.\n * - `triggerChar` - The trigger character that was detected.\n * - `position` - The position in the text where the trigger was detected.\n *\n * Use this to implement custom validation logic for triggers, such as preventing\n * triggers that don't meet certain conditions (for example, limiting the amount of references in a prompt).\n *\n * Requires React 18.\n */\n onTriggerDetected?: CancelableEventHandler<PromptInputProps.TriggerDetectedDetail>;\n\n /**\n * An object containing all the localized strings required by the component.\n *\n * - `ariaLabel` (string) - Adds an aria-label to the input element.\n * - `actionButtonAriaLabel` (string) - Adds an aria-label to the action button.\n * - `menuErrorIconAriaLabel` (string) - Provides a text alternative for the error icon in the error message in menus.\n * - `menuRecoveryText` (string) - Specifies the text for the recovery button in menus. The text is displayed next to the error text.\n * - `menuLoadingText` (string) - Specifies the text to display when menus are in a loading state.\n * - `menuFinishedText` (string) - Specifies the text to display when menus have finished loading all items.\n * - `menuErrorText` (string) - Specifies the text to display when menus encounter an error while loading.\n * - `selectedMenuItemAriaLabel` (string) - Specifies the string that describes an option as being selected.\n * - `tokenInsertedAriaLabel` ((token: { label?: string; value: string }) => string) - Aria label announced when a reference token is inserted from a menu. Receives the token object with label and value properties.\n * - `tokenPinnedAriaLabel` ((token: { label?: string; value: string }) => string) - Aria label announced when a reference token is pinned (inserted at the start). Receives the token object with label and value properties.\n * - `tokenRemovedAriaLabel` ((token: { label?: string; value: string }) => string) - Aria label announced when a reference token is removed. Receives the token object with label and value properties.\n * @i18n\n */\n i18nStrings?: PromptInputProps.I18nStrings;\n\n /**\n * Attributes to add to the native `textarea` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n * When `tokens` is defined, nativeTextareaAttributes will be ignored.\n *\n * @awsuiSystem core\n */\n nativeTextareaAttributes?: NativeAttributes<React.TextareaHTMLAttributes<HTMLTextAreaElement>>;\n\n /**\n * @awsuiSystem core\n */\n style?: PromptInputProps.Style;\n}\n\nexport namespace PromptInputProps {\n export type KeyDetail = BaseKeyDetail;\n\n export interface I18nStrings {\n actionButtonAriaLabel?: string;\n menuErrorIconAriaLabel?: string;\n menuRecoveryText?: string;\n menuLoadingText?: string;\n menuFinishedText?: string;\n menuErrorText?: string;\n /**\n * Aria label announced when a reference token is inserted from a menu.\n * Receives the token object with label and value properties.\n * @param token The inserted token\n * @returns The announcement string\n * @default `${token.label || token.value} inserted`\n */\n tokenInsertedAriaLabel?: (token: { label?: string; value: string }) => string;\n /**\n * Aria label announced when a reference token is pinned (inserted at the start).\n * Receives the token object with label and value properties.\n * @param token The pinned token\n * @returns The announcement string\n * @default `${token.label || token.value} pinned`\n */\n tokenPinnedAriaLabel?: (token: { label?: string; value: string }) => string;\n /**\n * Aria label announced when a reference token is removed.\n * Receives the token object with label and value properties.\n * @param token The removed token\n * @returns The announcement string\n * @default `${token.label || token.value} removed`\n */\n tokenRemovedAriaLabel?: (token: { label?: string; value: string }) => string;\n }\n\n export interface TextToken {\n type: 'text' | 'break';\n value: string;\n }\n\n export interface ReferenceToken {\n type: 'reference';\n id: string;\n label: string;\n value: string;\n /**\n * The ID of the menu this reference was selected from.\n * Optional — references can exist without being bound to a menu\n * (e.g., preloaded references from external sources).\n */\n menuId?: string;\n /**\n * When true, prevents user entered text from being placed before this token.\n * Typically set for reference tokens from useAtStart menus.\n */\n pinned?: boolean;\n }\n\n /**\n * Token type for menu triggers with filter text.\n * Represents a trigger character (e.g., \"@\" or \"/\") followed by filtering text.\n * This token type is automatically managed by the component when menus are active.\n *\n * - `value`: The filtering text (without the trigger character)\n * - `triggerChar`: The trigger character that opened the menu\n */\n export interface TriggerToken {\n type: 'trigger';\n value: string;\n triggerChar: string;\n id: string;\n }\n\n export type InputToken = TextToken | ReferenceToken | TriggerToken;\n\n export interface ChangeDetail {\n value: string;\n tokens?: readonly InputToken[];\n }\n\n export interface ActionDetail {\n value: string;\n tokens?: readonly InputToken[];\n }\n\n export interface MenuItemSelectDetail {\n menuId: string;\n option: OptionDefinition;\n }\n\n export interface MenuLoadItemsDetail {\n menuId: string;\n filteringText?: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface MenuFilterDetail {\n menuId: string;\n filteringText: string;\n }\n\n export interface TriggerDetectedDetail {\n menuId: string;\n triggerChar: string;\n position: number;\n }\n\n export interface MenuDefinition\n extends Pick<DropdownStatusProps, 'empty' | 'statusType'>,\n Pick<BaseDropdownHostProps, 'virtualScroll'> {\n /**\n * The unique identifier for this menu.\n */\n id: string;\n\n /**\n * The unique trigger symbol for showing this menu.\n */\n trigger: string;\n\n /**\n * Set `useAtStart=true` for menus where a trigger should only be detected at the start of input.\n * Set this for menus designated to modes or actions.\n *\n * Menus with `useAtStart=true` create pinned reference tokens.\n */\n useAtStart?: boolean;\n\n /**\n * Specifies an array of options that are displayed to the user as a list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n */\n options: (OptionDefinition | OptionGroup)[];\n\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * - `auto` - The component will automatically filter options based on user input.\n * - `manual` - You will set up `onMenuFilter` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the menu. In that case make sure that you use the `onMenuFilter` event in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: Exclude<OptionsFilteringType, 'none'>;\n }\n\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n\n /**\n * Selects all text in the textarea control.\n */\n select(): void;\n\n /**\n * Selects a range of text in the textarea control.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/setSelectionRange\n * for more details on this method. Be aware that using this method in React has some\n * common pitfalls: https://stackoverflow.com/questions/60129605/is-javascripts-setselectionrange-incompatible-with-react-hooks\n */\n setSelectionRange(start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none'): void;\n\n /**\n * Inserts text at a specified position. Only supported when `tokens` is defined.\n * Triggers input events and menu detection.\n *\n * When pinned reference tokens are present, `caretStart` and `caretEnd` are automatically\n * shifted to account for their positions.\n *\n * @param text The text to insert.\n * @param caretStart Position to insert at. Defaults to current caret position or 0.\n * @param caretEnd Caret position after insertion. Defaults to end of inserted text.\n */\n insertText(text: string, caretStart?: number, caretEnd?: number): void;\n }\n\n export interface Style {\n root?: {\n backgroundColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n color?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n fontSize?: string;\n fontWeight?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n placeholder?: {\n color?: string;\n fontSize?: string;\n fontStyle?: string;\n fontWeight?: string;\n };\n }\n}\n"]}
|
|
@@ -3,5 +3,5 @@ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component
|
|
|
3
3
|
import { SomeRequired } from '../internal/types';
|
|
4
4
|
import { PromptInputProps } from './interfaces';
|
|
5
5
|
interface InternalPromptInputProps extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>, InternalBaseComponentProps {}
|
|
6
|
-
declare const InternalPromptInput: React.ForwardRefExoticComponent<InternalPromptInputProps & React.RefAttributes<PromptInputProps.Ref>>;
|
|
6
|
+
declare const InternalPromptInput: React.ForwardRefExoticComponent<InternalPromptInputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | PromptInputProps.Ref>>;
|
|
7
7
|
export default InternalPromptInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAY3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,gJA6axB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|