@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
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useDropdownStatus } from '../../internal/components/dropdown-status';
|
|
3
|
+
import { CaretController } from '../core/caret-controller';
|
|
4
|
+
import { MenuItemsHandlers, MenuItemsState } from '../core/menu-state';
|
|
5
|
+
import { PortalContainer } from '../core/token-renderer';
|
|
6
|
+
import { PromptInputProps } from '../interfaces';
|
|
7
|
+
/** Mutable state shared between the editable tokens hook and event handlers. */
|
|
8
|
+
export interface EditableState {
|
|
9
|
+
skipNextZeroWidthUpdate: boolean;
|
|
10
|
+
menuSelectionTokenId: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function createEditableState(): EditableState;
|
|
13
|
+
/** Configuration for the useTokenMode hook — all props needed to drive token-mode behavior. */
|
|
14
|
+
export interface UseTokenModeConfig {
|
|
15
|
+
editableElementRef: React.RefObject<HTMLDivElement>;
|
|
16
|
+
caretControllerRef: React.MutableRefObject<CaretController | null>;
|
|
17
|
+
tokens?: readonly PromptInputProps.InputToken[];
|
|
18
|
+
tokensToText?: (tokens: readonly PromptInputProps.InputToken[]) => string;
|
|
19
|
+
menus?: readonly PromptInputProps.MenuDefinition[];
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
autoFocus?: boolean;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
invalid?: boolean;
|
|
25
|
+
warning?: boolean;
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
ariaLabelledby?: string;
|
|
28
|
+
ariaDescribedby?: string;
|
|
29
|
+
ariaRequired?: boolean;
|
|
30
|
+
disableBrowserAutocorrect?: boolean;
|
|
31
|
+
spellcheck?: boolean;
|
|
32
|
+
onChange: (detail: {
|
|
33
|
+
value: string;
|
|
34
|
+
tokens: PromptInputProps.InputToken[];
|
|
35
|
+
}) => void;
|
|
36
|
+
onTriggerDetected?: (detail: PromptInputProps.TriggerDetectedDetail) => boolean;
|
|
37
|
+
onAction?: PromptInputProps['onAction'];
|
|
38
|
+
onBlur?: PromptInputProps['onBlur'];
|
|
39
|
+
onFocus?: PromptInputProps['onFocus'];
|
|
40
|
+
onKeyDown?: PromptInputProps['onKeyDown'];
|
|
41
|
+
onKeyUp?: PromptInputProps['onKeyUp'];
|
|
42
|
+
onMenuItemSelect?: PromptInputProps['onMenuItemSelect'];
|
|
43
|
+
onMenuFilter?: PromptInputProps['onMenuFilter'];
|
|
44
|
+
onMenuLoadItems?: PromptInputProps['onMenuLoadItems'];
|
|
45
|
+
i18nStrings?: PromptInputProps['i18nStrings'];
|
|
46
|
+
adjustInputHeight: () => void;
|
|
47
|
+
}
|
|
48
|
+
/** Return value of useTokenMode — state, handlers, and attributes consumed by TokenMode component. */
|
|
49
|
+
export interface UseTokenModeResult {
|
|
50
|
+
portalContainersRef: React.MutableRefObject<Map<string, PortalContainer>>;
|
|
51
|
+
/** Snapshot of portal containers for rendering portals. Updated after each renderTokensToDOM call. */
|
|
52
|
+
portalContainers: PortalContainer[];
|
|
53
|
+
/** Portal elements to render — renders Token components into DOM containers via createPortal. */
|
|
54
|
+
portals: React.ReactPortal[];
|
|
55
|
+
editableState: EditableState;
|
|
56
|
+
editableElementAttributes: React.HTMLAttributes<HTMLDivElement> & {
|
|
57
|
+
'data-placeholder'?: string;
|
|
58
|
+
};
|
|
59
|
+
activeTriggerToken: PromptInputProps.TriggerToken | null;
|
|
60
|
+
activeMenu: PromptInputProps.MenuDefinition | null;
|
|
61
|
+
menuIsOpen: boolean;
|
|
62
|
+
menuFilterText: string;
|
|
63
|
+
triggerWrapperRef: React.MutableRefObject<HTMLElement | null>;
|
|
64
|
+
triggerWrapperReady: boolean;
|
|
65
|
+
menuListId: string;
|
|
66
|
+
menuFooterControlId: string;
|
|
67
|
+
highlightedMenuOptionId: string | undefined;
|
|
68
|
+
menuItemsState: MenuItemsState;
|
|
69
|
+
menuItemsHandlers: MenuItemsHandlers;
|
|
70
|
+
menuDropdownStatus: ReturnType<typeof useDropdownStatus> | null;
|
|
71
|
+
shouldRenderMenuDropdown: boolean;
|
|
72
|
+
handleInput: () => void;
|
|
73
|
+
handleLoadMore: () => void;
|
|
74
|
+
tokenOperationAnnouncement: string;
|
|
75
|
+
markTokensAsSent: (tokens: readonly PromptInputProps.InputToken[]) => void;
|
|
76
|
+
}
|
|
77
|
+
/** Encapsulates all token-mode logic: trigger detection, menu state, keyboard handling, and rendering. */
|
|
78
|
+
export declare function useTokenMode(config: UseTokenModeConfig): UseTokenModeResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-token-mode.d.ts","sourceRoot":"","sources":["../../../../src/prompt-input/tokens/use-token-mode.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAMlG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAI9E,OAAO,EAA0B,eAAe,EAAqB,MAAM,0BAA0B,CAAC;AAatG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