@cloudscape-design/components-themeable 3.0.782 → 3.0.784
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/styles/forms/mixins.scss +7 -0
- package/lib/internal/scss/prompt-input/styles.scss +127 -34
- package/lib/internal/scss/prompt-input/test-classes/styles.scss +8 -0
- package/lib/internal/template/button/analytics-metadata/interfaces.d.ts +1 -1
- package/lib/internal/template/button/analytics-metadata/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button/analytics-metadata/interfaces.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts +2 -0
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +2 -2
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/internal/components/chart-filter/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/chart-filter/index.js +1 -1
- package/lib/internal/template/internal/components/chart-filter/index.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown-status/index.d.ts +1 -1
- package/lib/internal/template/internal/components/dropdown-status/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/dropdown-status/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/multiselect/internal.d.ts +8 -1
- package/lib/internal/template/multiselect/internal.d.ts.map +1 -1
- package/lib/internal/template/multiselect/internal.js +22 -136
- package/lib/internal/template/multiselect/internal.js.map +1 -1
- package/lib/internal/template/multiselect/use-multiselect.d.ts +64 -0
- package/lib/internal/template/multiselect/use-multiselect.d.ts.map +1 -0
- package/lib/internal/template/multiselect/use-multiselect.js +163 -0
- package/lib/internal/template/multiselect/use-multiselect.js.map +1 -0
- package/lib/internal/template/prompt-input/interfaces.d.ts +16 -0
- package/lib/internal/template/prompt-input/interfaces.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/interfaces.js.map +1 -1
- package/lib/internal/template/prompt-input/internal.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/internal.js +28 -11
- package/lib/internal/template/prompt-input/internal.js.map +1 -1
- package/lib/internal/template/prompt-input/styles.css.js +14 -8
- package/lib/internal/template/prompt-input/styles.scoped.css +264 -68
- package/lib/internal/template/prompt-input/styles.selectors.js +14 -8
- package/lib/internal/template/prompt-input/test-classes/styles.css.js +5 -3
- package/lib/internal/template/prompt-input/test-classes/styles.scoped.css +11 -3
- package/lib/internal/template/prompt-input/test-classes/styles.selectors.js +5 -3
- package/lib/internal/template/test-utils/dom/prompt-input/index.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/prompt-input/index.js +6 -0
- package/lib/internal/template/test-utils/dom/prompt-input/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/prompt-input/index.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/prompt-input/index.js +6 -0
- package/lib/internal/template/test-utils/selectors/prompt-input/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,142 +1,47 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
7
6
|
import { useInternalI18n } from '../i18n/context';
|
|
8
7
|
import { getBaseProps } from '../internal/base-component';
|
|
9
8
|
import Dropdown from '../internal/components/dropdown';
|
|
10
9
|
import DropdownFooter from '../internal/components/dropdown-footer/index.js';
|
|
11
|
-
import { useDropdownStatus } from '../internal/components/dropdown-status';
|
|
12
|
-
import { isGroup } from '../internal/components/option/utils/filter-options';
|
|
13
|
-
import { prepareOptions } from '../internal/components/option/utils/prepare-options';
|
|
14
10
|
import ScreenreaderOnly from '../internal/components/screenreader-only';
|
|
15
11
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
16
|
-
import { fireNonCancelableEvent } from '../internal/events';
|
|
17
|
-
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
18
12
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
19
13
|
import { joinStrings } from '../internal/utils/strings';
|
|
20
14
|
import Filter from '../select/parts/filter';
|
|
21
15
|
import PlainList from '../select/parts/plain-list';
|
|
22
16
|
import Trigger from '../select/parts/trigger';
|
|
23
17
|
import VirtualList from '../select/parts/virtual-list';
|
|
24
|
-
import { checkOptionValueField } from '../select/utils/check-option-value-field.js';
|
|
25
|
-
import { findOptionIndex } from '../select/utils/connect-options';
|
|
26
|
-
import { useAnnouncement } from '../select/utils/use-announcement';
|
|
27
|
-
import { useLoadItems } from '../select/utils/use-load-items';
|
|
28
|
-
import { useNativeSearch } from '../select/utils/use-native-search';
|
|
29
|
-
import { useSelect } from '../select/utils/use-select';
|
|
30
18
|
import InternalTokenGroup from '../token-group/internal';
|
|
19
|
+
import { useMultiselect } from './use-multiselect';
|
|
31
20
|
import styles from './styles.css.js';
|
|
32
21
|
const InternalMultiselect = React.forwardRef((_a, externalRef) => {
|
|
33
22
|
var _b;
|
|
34
|
-
var { options
|
|
35
|
-
checkOptionValueField('Multiselect', 'options', options);
|
|
23
|
+
var { options, filteringType, filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, ariaRequired, placeholder, disabled, readOnly, ariaLabel, selectedOptions, deselectAriaLabel, tokenLimit, i18nStrings, virtualScroll, inlineTokens = false, hideTokens, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, __internalRootRef = null, autoFocus } = _a, restProps = __rest(_a, ["options", "filteringType", "filteringPlaceholder", "filteringAriaLabel", "filteringClearAriaLabel", "ariaRequired", "placeholder", "disabled", "readOnly", "ariaLabel", "selectedOptions", "deselectAriaLabel", "tokenLimit", "i18nStrings", "virtualScroll", "inlineTokens", "hideTokens", "expandToViewport", "tokenLimitShowFewerAriaLabel", "tokenLimitShowMoreAriaLabel", "__internalRootRef", "autoFocus"]);
|
|
36
24
|
const baseProps = getBaseProps(restProps);
|
|
37
25
|
const formFieldContext = useFormFieldContext(restProps);
|
|
38
26
|
const i18n = useInternalI18n('multiselect');
|
|
39
|
-
const i18nCommon = useInternalI18n('select');
|
|
40
|
-
const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);
|
|
41
|
-
const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);
|
|
42
|
-
const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);
|
|
43
|
-
if (restProps.recoveryText && !onLoadItems) {
|
|
44
|
-
warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');
|
|
45
|
-
}
|
|
46
|
-
const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({
|
|
47
|
-
onLoadItems,
|
|
48
|
-
options,
|
|
49
|
-
statusType,
|
|
50
|
-
});
|
|
51
|
-
const useInteractiveGroups = true;
|
|
52
|
-
const [filteringValue, setFilteringValue] = useState('');
|
|
53
|
-
const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(options, filteringType, filteringValue);
|
|
54
|
-
const updateSelectedOption = useCallback((option) => {
|
|
55
|
-
const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);
|
|
56
|
-
// switch between selection and deselection behavior, ignores disabled options to prevent
|
|
57
|
-
// getting stuck on one behavior when an option is disabled and its state cannot be changed
|
|
58
|
-
const isAllChildrenSelected = (optionsArray) => optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);
|
|
59
|
-
const intersection = (visibleOptions, options) => visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);
|
|
60
|
-
const union = (visibleOptions, options) => visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);
|
|
61
|
-
const select = (options, selectedOptions) => {
|
|
62
|
-
return union(selectedOptions, options);
|
|
63
|
-
};
|
|
64
|
-
const unselect = (options, selectedOptions) => {
|
|
65
|
-
return selectedOptions.filter(option => findOptionIndex(options, option) === -1);
|
|
66
|
-
};
|
|
67
|
-
let newSelectedOptions = [...selectedOptions];
|
|
68
|
-
if (isGroup(option)) {
|
|
69
|
-
const visibleOptions = intersection([...option.options], filtered);
|
|
70
|
-
newSelectedOptions = isAllChildrenSelected(visibleOptions)
|
|
71
|
-
? unselect(visibleOptions, newSelectedOptions)
|
|
72
|
-
: select(visibleOptions, newSelectedOptions);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
newSelectedOptions = isAllChildrenSelected([option])
|
|
76
|
-
? unselect([option], newSelectedOptions)
|
|
77
|
-
: select([option], newSelectedOptions);
|
|
78
|
-
}
|
|
79
|
-
fireNonCancelableEvent(onChange, {
|
|
80
|
-
selectedOptions: newSelectedOptions,
|
|
81
|
-
});
|
|
82
|
-
}, [onChange, selectedOptions, filteredOptions]);
|
|
83
|
-
const rootRef = useRef(null);
|
|
84
27
|
const selfControlId = useUniqueId('trigger');
|
|
85
28
|
const controlId = (_b = formFieldContext.controlId) !== null && _b !== void 0 ? _b : selfControlId;
|
|
86
|
-
const
|
|
29
|
+
const ariaLabelId = useUniqueId('multiselect-arialabel-');
|
|
87
30
|
const footerId = useUniqueId('footer');
|
|
88
|
-
const
|
|
89
|
-
const
|
|
31
|
+
const [filteringValue, setFilteringValue] = useState('');
|
|
32
|
+
const multiselectProps = useMultiselect(Object.assign({ options,
|
|
90
33
|
selectedOptions,
|
|
91
|
-
updateSelectedOption,
|
|
92
|
-
options: filteredOptions,
|
|
93
34
|
filteringType,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
35
|
+
disabled,
|
|
36
|
+
deselectAriaLabel,
|
|
37
|
+
controlId,
|
|
38
|
+
ariaLabelId,
|
|
39
|
+
footerId,
|
|
40
|
+
filteringValue,
|
|
99
41
|
setFilteringValue,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
const handleNativeSearch = useNativeSearch({
|
|
104
|
-
isEnabled: filteringType === 'none' && isOpen,
|
|
105
|
-
options: filteredOptions,
|
|
106
|
-
highlightOption: highlightOption,
|
|
107
|
-
highlightedOption: highlightedOption === null || highlightedOption === void 0 ? void 0 : highlightedOption.option,
|
|
108
|
-
useInteractiveGroups,
|
|
109
|
-
});
|
|
110
|
-
const isEmpty = !options || options.length === 0;
|
|
111
|
-
const isNoMatch = filteredOptions && filteredOptions.length === 0;
|
|
112
|
-
const isFiltered = filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;
|
|
113
|
-
const filteredText = isFiltered ? filteringResultsText === null || filteringResultsText === void 0 ? void 0 : filteringResultsText(matchesCount, totalCount) : undefined;
|
|
114
|
-
const dropdownStatus = useDropdownStatus({
|
|
115
|
-
statusType,
|
|
116
|
-
empty,
|
|
117
|
-
loadingText,
|
|
118
|
-
finishedText,
|
|
119
|
-
errorText,
|
|
120
|
-
recoveryText,
|
|
121
|
-
isEmpty,
|
|
122
|
-
isNoMatch,
|
|
123
|
-
noMatch,
|
|
124
|
-
isFiltered,
|
|
125
|
-
filteringResultsText: filteredText,
|
|
126
|
-
onRecoveryClick: handleRecoveryClick,
|
|
127
|
-
errorIconAriaLabel: errorIconAriaLabel,
|
|
128
|
-
hasRecoveryCallback: !!onLoadItems,
|
|
129
|
-
});
|
|
130
|
-
const filter = (React.createElement(Filter, Object.assign({ clearAriaLabel: filteringClearAriaLabel, filteringType: filteringType, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, ariaRequired: ariaRequired, value: filteringValue }, getFilterProps())));
|
|
131
|
-
const trigger = (React.createElement(Trigger, Object.assign({ placeholder: placeholder, disabled: disabled, readOnly: readOnly, triggerProps: getTriggerProps(disabled, autoFocus), selectedOption: null, selectedOptions: selectedOptions, triggerVariant: inlineTokens ? 'tokens' : 'placeholder', isOpen: isOpen }, formFieldContext, { controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, multiSelectAriaLabelId) })));
|
|
132
|
-
const menuProps = Object.assign(Object.assign({}, getMenuProps()), { onLoadMore: handleLoadMore, ariaLabelledby: joinStrings(multiSelectAriaLabelId, controlId), ariaDescribedby: dropdownStatus.content ? footerId : undefined });
|
|
133
|
-
const announcement = useAnnouncement({
|
|
134
|
-
announceSelected,
|
|
135
|
-
highlightedOption,
|
|
136
|
-
getParent: option => { var _a; return (_a = parentMap.get(option)) === null || _a === void 0 ? void 0 : _a.option; },
|
|
137
|
-
selectedAriaLabel,
|
|
138
|
-
renderHighlightedAriaLive,
|
|
139
|
-
});
|
|
42
|
+
externalRef }, restProps));
|
|
43
|
+
const filter = (React.createElement(Filter, Object.assign({ clearAriaLabel: filteringClearAriaLabel, filteringType: filteringType, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, ariaRequired: ariaRequired, value: filteringValue }, multiselectProps.getFilterProps())));
|
|
44
|
+
const trigger = (React.createElement(Trigger, Object.assign({ placeholder: placeholder, disabled: disabled, readOnly: readOnly, triggerProps: multiselectProps.getTriggerProps(disabled, autoFocus), selectedOption: null, selectedOptions: selectedOptions, triggerVariant: inlineTokens ? 'tokens' : 'placeholder', isOpen: multiselectProps.isOpen }, formFieldContext, { controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, ariaLabelId) })));
|
|
140
45
|
const tokens = selectedOptions.map(option => ({
|
|
141
46
|
label: option.label,
|
|
142
47
|
disabled: disabled || option.disabled,
|
|
@@ -149,38 +54,19 @@ const InternalMultiselect = React.forwardRef((_a, externalRef) => {
|
|
|
149
54
|
tags: option.tags,
|
|
150
55
|
dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel === null || deselectAriaLabel === void 0 ? void 0 : deselectAriaLabel(option), format => { var _a; return format({ option__label: (_a = option.label) !== null && _a !== void 0 ? _a : '' }); }),
|
|
151
56
|
}));
|
|
152
|
-
useEffect(() => {
|
|
153
|
-
var _a;
|
|
154
|
-
(_a = scrollToIndex.current) === null || _a === void 0 ? void 0 : _a.call(scrollToIndex, highlightedIndex);
|
|
155
|
-
}, [highlightedIndex]);
|
|
156
57
|
const ListComponent = virtualScroll ? VirtualList : PlainList;
|
|
157
|
-
const handleMouseDown = (event) => {
|
|
158
|
-
const target = event.target;
|
|
159
|
-
if (target !== document.activeElement) {
|
|
160
|
-
// prevent currently focused element from losing it
|
|
161
|
-
event.preventDefault();
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
58
|
const showTokens = !hideTokens && !inlineTokens && tokens.length > 0;
|
|
165
|
-
const handleTokenDismiss = ({ detail }) => {
|
|
166
|
-
const optionToDeselect = selectedOptions[detail.itemIndex];
|
|
167
|
-
updateSelectedOption(optionToDeselect);
|
|
168
|
-
const targetRef = getTriggerProps().ref;
|
|
169
|
-
if (targetRef.current) {
|
|
170
|
-
targetRef.current.focus();
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
59
|
const tokenGroupI18nStrings = {
|
|
174
60
|
limitShowFewer: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.tokenLimitShowFewer,
|
|
175
61
|
limitShowMore: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.tokenLimitShowMore,
|
|
176
62
|
};
|
|
177
|
-
const
|
|
178
|
-
const dropdownProps = getDropdownProps();
|
|
179
|
-
return (React.createElement("div", Object.assign({}, baseProps, { ref:
|
|
180
|
-
React.createElement(Dropdown, Object.assign({}, dropdownProps, { ariaLabelledby: dropdownProps.dropdownContentRole ? joinStrings(
|
|
181
|
-
React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: isOpen ? dropdownStatus.content : null, id: footerId })) : null, menuProps:
|
|
182
|
-
showTokens && (React.createElement(InternalTokenGroup, { className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens,
|
|
183
|
-
React.createElement(ScreenreaderOnly, { id:
|
|
63
|
+
const dropdownStatus = multiselectProps.dropdownStatus;
|
|
64
|
+
const dropdownProps = multiselectProps.getDropdownProps();
|
|
65
|
+
return (React.createElement("div", Object.assign({}, baseProps, { ref: __internalRootRef, className: clsx(styles.root, baseProps.className) }, multiselectProps.getWrapperProps()),
|
|
66
|
+
React.createElement(Dropdown, Object.assign({}, dropdownProps, { ariaLabelledby: dropdownProps.dropdownContentRole ? joinStrings(ariaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined, open: multiselectProps.isOpen, trigger: trigger, header: filter, footer: dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: multiselectProps.isOpen ? dropdownStatus.content : null, id: footerId })) : null, expandToViewport: expandToViewport, stretchBeyondTriggerWidth: true }),
|
|
67
|
+
React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: multiselectProps.isOpen ? dropdownStatus.content : null, id: footerId })) : null, menuProps: multiselectProps.getMenuProps(), getOptionProps: multiselectProps.getOptionProps, filteredOptions: multiselectProps.filteredOptions, filteringValue: filteringValue, ref: multiselectProps.scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, checkboxes: true, useInteractiveGroups: true, screenReaderContent: multiselectProps.announcement, highlightType: multiselectProps.highlightType })),
|
|
68
|
+
showTokens && (React.createElement(InternalTokenGroup, Object.assign({}, multiselectProps.getTokenProps(), { className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens, i18nStrings: tokenGroupI18nStrings, limitShowMoreAriaLabel: tokenLimitShowMoreAriaLabel, limitShowFewerAriaLabel: tokenLimitShowFewerAriaLabel, disableOuterPadding: true, readOnly: readOnly }))),
|
|
69
|
+
React.createElement(ScreenreaderOnly, { id: ariaLabelId }, ariaLabel)));
|
|
184
70
|
});
|
|
185
71
|
export default InternalMultiselect;
|
|
186
72
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1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AoB,EAAE,oBAAoB,EAC1C,mBAAmB,EAAE,YAAY,EACjC,aAAa,EAAE,aAAa,GAC5B,CACO;QACV,UAAU,IAAI,CACb,oBAAC,kBAAkB,IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,kBAAkB,EAC7B,WAAW,EAAE,qBAAqB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH;QACD,oBAAC,gBAAgB,IAAC,EAAE,EAAE,sBAAsB,IAAG,SAAS,CAAoB,CACxE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport Filter from '../select/parts/filter';\nimport PlainList, { SelectListProps } from '../select/parts/plain-list';\nimport Trigger from '../select/parts/trigger';\nimport VirtualList from '../select/parts/virtual-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { MenuProps, useSelect } from '../select/utils/use-select';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport InternalTokenGroup from '../token-group/internal';\nimport { MultiselectProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = MultiselectProps & InternalBaseComponentProps & { inlineTokens?: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options = [],\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n renderHighlightedAriaLive,\n selectedOptions = [],\n deselectAriaLabel,\n keepOpen = true,\n tokenLimit,\n i18nStrings,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n inlineTokens = false,\n hideTokens = false,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef = null,\n autoFocus,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n checkOptionValueField('Multiselect', 'options', options);\n\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const i18n = useInternalI18n('multiselect');\n\n const i18nCommon = useInternalI18n('select');\n const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);\n const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const [filteringValue, setFilteringValue] = useState('');\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filtered);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [onChange, selectedOptions, filteredOptions]\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const multiSelectAriaLabelId = useUniqueId('multiselect-arialabel-');\n\n const footerId = useUniqueId('footer');\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: filteredOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n statusType,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: filteredOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n isFiltered,\n filteringResultsText: filteredText,\n onRecoveryClick: handleRecoveryClick,\n errorIconAriaLabel: errorIconAriaLabel,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={inlineTokens ? 'tokens' : 'placeholder'}\n isOpen={isOpen}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, multiSelectAriaLabelId)}\n />\n );\n\n const menuProps: MenuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(multiSelectAriaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const showTokens = !hideTokens && !inlineTokens && tokens.length > 0;\n const handleTokenDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyPress={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={\n dropdownProps.dropdownContentRole ? joinStrings(multiSelectAriaLabelId, controlId) : undefined\n }\n ariaDescribedby={\n dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined\n }\n open={isOpen}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n stretchBeyondTriggerWidth={true}\n >\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={useInteractiveGroups}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n </Dropdown>\n {showTokens && (\n <InternalTokenGroup\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n onDismiss={handleTokenDismiss}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n />\n )}\n <ScreenreaderOnly id={multiSelectAriaLabelId}>{ariaLabel}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,I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c,EAAE,cAAc,EAC9B,GAAG,EAAE,gBAAgB,CAAC,aAAa,EACnC,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,IAAI,EAC1B,mBAAmB,EAAE,gBAAgB,CAAC,YAAY,EAClD,aAAa,EAAE,gBAAgB,CAAC,aAAa,GAC7C,CACO;QAEV,UAAU,IAAI,CACb,oBAAC,kBAAkB,oBACb,gBAAgB,CAAC,aAAa,EAAE,IACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,qBAAqB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,QAAQ,IAClB,CACH;QAED,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,CAAoB,CAC7D,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings';\nimport Filter from '../select/parts/filter';\nimport PlainList from '../select/parts/plain-list';\nimport Trigger from '../select/parts/trigger';\nimport VirtualList from '../select/parts/virtual-list';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport InternalTokenGroup from '../token-group/internal';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = SomeRequired<\n MultiselectProps,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen' | 'hideTokens'\n> &\n InternalBaseComponentProps & { inlineTokens?: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n selectedOptions,\n deselectAriaLabel,\n tokenLimit,\n i18nStrings,\n virtualScroll,\n inlineTokens = false,\n hideTokens,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef = null,\n autoFocus,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const i18n = useInternalI18n('multiselect');\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const ariaLabelId = useUniqueId('multiselect-arialabel-');\n const footerId = useUniqueId('footer');\n\n const [filteringValue, setFilteringValue] = useState('');\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled,\n deselectAriaLabel,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n ...restProps,\n });\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...multiselectProps.getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={multiselectProps.getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={inlineTokens ? 'tokens' : 'placeholder'}\n isOpen={multiselectProps.isOpen}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, ariaLabelId)}\n />\n );\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const showTokens = !hideTokens && !inlineTokens && tokens.length > 0;\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const dropdownStatus = multiselectProps.dropdownStatus;\n const dropdownProps = multiselectProps.getDropdownProps();\n\n return (\n <div\n {...baseProps}\n ref={__internalRootRef}\n className={clsx(styles.root, baseProps.className)}\n {...multiselectProps.getWrapperProps()}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.dropdownContentRole ? joinStrings(ariaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined\n }\n open={multiselectProps.isOpen}\n trigger={trigger}\n header={filter}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n stretchBeyondTriggerWidth={true}\n >\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={multiselectProps.getMenuProps()}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringValue}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n />\n </Dropdown>\n\n {showTokens && (\n <InternalTokenGroup\n {...multiselectProps.getTokenProps()}\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n />\n )}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownStatusProps } from '../internal/components/dropdown-status';
|
|
3
|
+
import { SomeRequired } from '../internal/types';
|
|
4
|
+
import { SelectListProps } from '../select/parts/plain-list';
|
|
5
|
+
import { TokenGroupProps } from '../token-group/interfaces';
|
|
6
|
+
import { MultiselectProps } from './interfaces';
|
|
7
|
+
type UseMultiselectOptions = SomeRequired<Pick<MultiselectProps, 'options' | 'selectedOptions' | 'filteringType' | 'filteringResultsText' | 'disabled' | 'noMatch' | 'renderHighlightedAriaLive' | 'deselectAriaLabel' | 'keepOpen' | 'onBlur' | 'onFocus' | 'onLoadItems' | 'onChange' | 'selectedAriaLabel'> & DropdownStatusProps & {
|
|
8
|
+
controlId: string;
|
|
9
|
+
ariaLabelId: string;
|
|
10
|
+
footerId: string;
|
|
11
|
+
filteringValue: string;
|
|
12
|
+
setFilteringValue: (value: string) => void;
|
|
13
|
+
externalRef: React.Ref<MultiselectProps.Ref>;
|
|
14
|
+
}, 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen'>;
|
|
15
|
+
export declare function useMultiselect({ options, filteringType, filteringResultsText, disabled, statusType, empty, loadingText, finishedText, errorText, noMatch, renderHighlightedAriaLive, selectedOptions, deselectAriaLabel, keepOpen, onBlur, onFocus, onLoadItems, onChange, controlId, ariaLabelId, footerId, filteringValue, setFilteringValue, externalRef, ...restProps }: UseMultiselectOptions): {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
tokens: readonly TokenGroupProps.Item[];
|
|
18
|
+
announcement: string;
|
|
19
|
+
dropdownStatus: import("../internal/components/dropdown-status").DropdownStatusResult;
|
|
20
|
+
filteringValue: string;
|
|
21
|
+
filteredOptions: readonly import("../internal/components/option/interfaces").DropdownOption[];
|
|
22
|
+
highlightType: import("../internal/components/options-list/utils/use-highlight-option").HighlightType;
|
|
23
|
+
scrollToIndex: React.RefObject<SelectListProps.SelectListRef>;
|
|
24
|
+
getFilterProps: () => Partial<import("../select/parts/filter").FilterProps>;
|
|
25
|
+
getTriggerProps: (disabled?: boolean, autoFocus?: boolean) => import("../select/utils/use-select").SelectTriggerProps;
|
|
26
|
+
getMenuProps: () => {
|
|
27
|
+
onLoadMore: () => void;
|
|
28
|
+
ariaLabelledby: string | undefined;
|
|
29
|
+
ariaDescribedby: string | undefined;
|
|
30
|
+
open?: boolean | undefined;
|
|
31
|
+
position?: import("csstype").Property.Position | undefined;
|
|
32
|
+
className?: string | undefined;
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
role?: "listbox" | "menu" | "list" | undefined;
|
|
35
|
+
onFocus?: import("../internal/events").NonCancelableEventHandler<{}> | undefined;
|
|
36
|
+
onBlur?: import("../internal/events").NonCancelableEventHandler<{
|
|
37
|
+
relatedTarget: Node | null;
|
|
38
|
+
}> | undefined;
|
|
39
|
+
onKeyDown?: import("../internal/events").CancelableEventHandler<import("../internal/events").BaseKeyDetail> | undefined;
|
|
40
|
+
onMouseMove?: ((itemIndex: number) => void) | undefined;
|
|
41
|
+
onMouseUp?: ((itemIndex: number) => void) | undefined;
|
|
42
|
+
ariaLabel?: string | undefined;
|
|
43
|
+
statusType: DropdownStatusProps.StatusType;
|
|
44
|
+
nativeAttributes?: Record<string, any> | undefined;
|
|
45
|
+
decreaseBlockMargin?: boolean | undefined;
|
|
46
|
+
ref: React.RefObject<HTMLUListElement>;
|
|
47
|
+
};
|
|
48
|
+
getOptionProps: (option: import("../internal/components/option/interfaces").DropdownOption, index: number) => any;
|
|
49
|
+
getTokenProps: () => {
|
|
50
|
+
onDismiss: import("../internal/events").NonCancelableEventHandler<TokenGroupProps.DismissDetail>;
|
|
51
|
+
};
|
|
52
|
+
getDropdownProps: () => {
|
|
53
|
+
onMouseDown: (event: React.MouseEvent) => void;
|
|
54
|
+
onFocus?: import("../internal/events").NonCancelableEventHandler<Pick<React.FocusEvent<Element, Element>, "target" | "relatedTarget">> | undefined;
|
|
55
|
+
onBlur?: import("../internal/events").NonCancelableEventHandler<Pick<React.FocusEvent<Element, Element>, "target" | "relatedTarget">> | undefined;
|
|
56
|
+
dropdownContentId?: string | undefined;
|
|
57
|
+
dropdownContentRole?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
getWrapperProps: () => {
|
|
60
|
+
onKeyDown: (event: React.KeyboardEvent<Element>) => void;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=use-multiselect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-multiselect.d.ts","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAK9D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAC;AAKhG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAO7D,OAAO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
|
3
|
+
import { __rest } from "tslib";
|
|
4
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
5
|
+
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
6
|
+
import { useInternalI18n } from '../i18n/context';
|
|
7
|
+
import { useDropdownStatus } from '../internal/components/dropdown-status';
|
|
8
|
+
import { isGroup } from '../internal/components/option/utils/filter-options';
|
|
9
|
+
import { prepareOptions } from '../internal/components/option/utils/prepare-options';
|
|
10
|
+
import { fireNonCancelableEvent } from '../internal/events';
|
|
11
|
+
import { joinStrings } from '../internal/utils/strings';
|
|
12
|
+
import { checkOptionValueField } from '../select/utils/check-option-value-field.js';
|
|
13
|
+
import { findOptionIndex } from '../select/utils/connect-options';
|
|
14
|
+
import { useAnnouncement } from '../select/utils/use-announcement';
|
|
15
|
+
import { useLoadItems } from '../select/utils/use-load-items';
|
|
16
|
+
import { useNativeSearch } from '../select/utils/use-native-search';
|
|
17
|
+
import { useSelect } from '../select/utils/use-select';
|
|
18
|
+
export function useMultiselect(_a) {
|
|
19
|
+
var { options, filteringType, filteringResultsText, disabled, statusType, empty, loadingText, finishedText, errorText, noMatch, renderHighlightedAriaLive, selectedOptions, deselectAriaLabel, keepOpen, onBlur, onFocus, onLoadItems, onChange, controlId, ariaLabelId, footerId, filteringValue, setFilteringValue, externalRef } = _a, restProps = __rest(_a, ["options", "filteringType", "filteringResultsText", "disabled", "statusType", "empty", "loadingText", "finishedText", "errorText", "noMatch", "renderHighlightedAriaLive", "selectedOptions", "deselectAriaLabel", "keepOpen", "onBlur", "onFocus", "onLoadItems", "onChange", "controlId", "ariaLabelId", "footerId", "filteringValue", "setFilteringValue", "externalRef"]);
|
|
20
|
+
checkOptionValueField('Multiselect', 'options', options);
|
|
21
|
+
const i18n = useInternalI18n('multiselect');
|
|
22
|
+
const i18nCommon = useInternalI18n('select');
|
|
23
|
+
const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);
|
|
24
|
+
const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);
|
|
25
|
+
const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);
|
|
26
|
+
if (restProps.recoveryText && !onLoadItems) {
|
|
27
|
+
warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');
|
|
28
|
+
}
|
|
29
|
+
const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({
|
|
30
|
+
onLoadItems,
|
|
31
|
+
options,
|
|
32
|
+
statusType,
|
|
33
|
+
});
|
|
34
|
+
const useInteractiveGroups = true;
|
|
35
|
+
const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(options, filteringType, filteringValue);
|
|
36
|
+
const updateSelectedOption = useCallback((option) => {
|
|
37
|
+
const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);
|
|
38
|
+
// switch between selection and deselection behavior, ignores disabled options to prevent
|
|
39
|
+
// getting stuck on one behavior when an option is disabled and its state cannot be changed
|
|
40
|
+
const isAllChildrenSelected = (optionsArray) => optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);
|
|
41
|
+
const intersection = (visibleOptions, options) => visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);
|
|
42
|
+
const union = (visibleOptions, options) => visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);
|
|
43
|
+
const select = (options, selectedOptions) => {
|
|
44
|
+
return union(selectedOptions, options);
|
|
45
|
+
};
|
|
46
|
+
const unselect = (options, selectedOptions) => {
|
|
47
|
+
return selectedOptions.filter(option => findOptionIndex(options, option) === -1);
|
|
48
|
+
};
|
|
49
|
+
let newSelectedOptions = [...selectedOptions];
|
|
50
|
+
if (isGroup(option)) {
|
|
51
|
+
const visibleOptions = intersection([...option.options], filtered);
|
|
52
|
+
newSelectedOptions = isAllChildrenSelected(visibleOptions)
|
|
53
|
+
? unselect(visibleOptions, newSelectedOptions)
|
|
54
|
+
: select(visibleOptions, newSelectedOptions);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
newSelectedOptions = isAllChildrenSelected([option])
|
|
58
|
+
? unselect([option], newSelectedOptions)
|
|
59
|
+
: select([option], newSelectedOptions);
|
|
60
|
+
}
|
|
61
|
+
fireNonCancelableEvent(onChange, {
|
|
62
|
+
selectedOptions: newSelectedOptions,
|
|
63
|
+
});
|
|
64
|
+
}, [onChange, selectedOptions, filteredOptions]);
|
|
65
|
+
const scrollToIndex = useRef(null);
|
|
66
|
+
const { isOpen, highlightType, highlightedOption, highlightedIndex, getTriggerProps, getDropdownProps, getFilterProps, getMenuProps, getOptionProps, highlightOption, announceSelected, } = useSelect({
|
|
67
|
+
selectedOptions,
|
|
68
|
+
updateSelectedOption,
|
|
69
|
+
options: filteredOptions,
|
|
70
|
+
filteringType,
|
|
71
|
+
onFocus,
|
|
72
|
+
onBlur,
|
|
73
|
+
externalRef,
|
|
74
|
+
keepOpen,
|
|
75
|
+
fireLoadItems,
|
|
76
|
+
setFilteringValue,
|
|
77
|
+
useInteractiveGroups,
|
|
78
|
+
statusType,
|
|
79
|
+
});
|
|
80
|
+
const wrapperOnKeyDown = useNativeSearch({
|
|
81
|
+
isEnabled: filteringType === 'none' && isOpen,
|
|
82
|
+
options: filteredOptions,
|
|
83
|
+
highlightOption: highlightOption,
|
|
84
|
+
highlightedOption: highlightedOption === null || highlightedOption === void 0 ? void 0 : highlightedOption.option,
|
|
85
|
+
useInteractiveGroups,
|
|
86
|
+
});
|
|
87
|
+
const isEmpty = !options || options.length === 0;
|
|
88
|
+
const isNoMatch = filteredOptions && filteredOptions.length === 0;
|
|
89
|
+
const isFiltered = filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;
|
|
90
|
+
const filteredText = isFiltered ? filteringResultsText === null || filteringResultsText === void 0 ? void 0 : filteringResultsText(matchesCount, totalCount) : undefined;
|
|
91
|
+
const dropdownStatus = useDropdownStatus({
|
|
92
|
+
statusType,
|
|
93
|
+
empty,
|
|
94
|
+
loadingText,
|
|
95
|
+
finishedText,
|
|
96
|
+
errorText,
|
|
97
|
+
recoveryText,
|
|
98
|
+
isEmpty,
|
|
99
|
+
isNoMatch,
|
|
100
|
+
noMatch,
|
|
101
|
+
isFiltered,
|
|
102
|
+
filteringResultsText: filteredText,
|
|
103
|
+
onRecoveryClick: handleRecoveryClick,
|
|
104
|
+
errorIconAriaLabel: errorIconAriaLabel,
|
|
105
|
+
hasRecoveryCallback: !!onLoadItems,
|
|
106
|
+
});
|
|
107
|
+
const announcement = useAnnouncement({
|
|
108
|
+
announceSelected,
|
|
109
|
+
highlightedOption,
|
|
110
|
+
getParent: option => { var _a; return (_a = parentMap.get(option)) === null || _a === void 0 ? void 0 : _a.option; },
|
|
111
|
+
selectedAriaLabel,
|
|
112
|
+
renderHighlightedAriaLive,
|
|
113
|
+
});
|
|
114
|
+
const tokens = selectedOptions.map(option => ({
|
|
115
|
+
label: option.label,
|
|
116
|
+
disabled: disabled || option.disabled,
|
|
117
|
+
labelTag: option.labelTag,
|
|
118
|
+
description: option.description,
|
|
119
|
+
iconAlt: option.iconAlt,
|
|
120
|
+
iconName: option.iconName,
|
|
121
|
+
iconUrl: option.iconUrl,
|
|
122
|
+
iconSvg: option.iconSvg,
|
|
123
|
+
tags: option.tags,
|
|
124
|
+
dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel === null || deselectAriaLabel === void 0 ? void 0 : deselectAriaLabel(option), format => { var _a; return format({ option__label: (_a = option.label) !== null && _a !== void 0 ? _a : '' }); }),
|
|
125
|
+
}));
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
var _a;
|
|
128
|
+
(_a = scrollToIndex.current) === null || _a === void 0 ? void 0 : _a.call(scrollToIndex, highlightedIndex);
|
|
129
|
+
}, [highlightedIndex]);
|
|
130
|
+
const dropdownOnMouseDown = (event) => {
|
|
131
|
+
const target = event.target;
|
|
132
|
+
if (target !== document.activeElement) {
|
|
133
|
+
// prevent currently focused element from losing it
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const tokenOnDismiss = ({ detail }) => {
|
|
138
|
+
const optionToDeselect = selectedOptions[detail.itemIndex];
|
|
139
|
+
updateSelectedOption(optionToDeselect);
|
|
140
|
+
const targetRef = getTriggerProps().ref;
|
|
141
|
+
if (targetRef.current) {
|
|
142
|
+
targetRef.current.focus();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
isOpen,
|
|
147
|
+
tokens,
|
|
148
|
+
announcement,
|
|
149
|
+
dropdownStatus,
|
|
150
|
+
filteringValue,
|
|
151
|
+
filteredOptions,
|
|
152
|
+
highlightType,
|
|
153
|
+
scrollToIndex,
|
|
154
|
+
getFilterProps,
|
|
155
|
+
getTriggerProps,
|
|
156
|
+
getMenuProps: () => (Object.assign(Object.assign({}, getMenuProps()), { onLoadMore: handleLoadMore, ariaLabelledby: joinStrings(ariaLabelId, controlId), ariaDescribedby: dropdownStatus.content ? footerId : undefined })),
|
|
157
|
+
getOptionProps,
|
|
158
|
+
getTokenProps: () => ({ onDismiss: tokenOnDismiss }),
|
|
159
|
+
getDropdownProps: () => (Object.assign(Object.assign({}, getDropdownProps()), { onMouseDown: dropdownOnMouseDown })),
|
|
160
|
+
getWrapperProps: () => ({ onKeyDown: wrapperOnKeyDown }),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=use-multiselect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-multiselect.js","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EA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rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useCallback, useEffect, useRef } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { DropdownStatusProps, useDropdownStatus } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings';\nimport { SelectListProps } from '../select/parts/plain-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useSelect } from '../select/utils/use-select';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport { MultiselectProps } from './interfaces';\n\ntype UseMultiselectOptions = SomeRequired<\n Pick<\n MultiselectProps,\n | 'options'\n | 'selectedOptions'\n | 'filteringType'\n | 'filteringResultsText'\n | 'disabled'\n | 'noMatch'\n | 'renderHighlightedAriaLive'\n | 'deselectAriaLabel'\n | 'keepOpen'\n | 'onBlur'\n | 'onFocus'\n | 'onLoadItems'\n | 'onChange'\n | 'selectedAriaLabel'\n > &\n DropdownStatusProps & {\n controlId: string;\n ariaLabelId: string;\n footerId: string;\n filteringValue: string;\n setFilteringValue: (value: string) => void;\n externalRef: React.Ref<MultiselectProps.Ref>;\n },\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen'\n>;\n\nexport function useMultiselect({\n options,\n filteringType,\n filteringResultsText,\n disabled,\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n renderHighlightedAriaLive,\n selectedOptions,\n deselectAriaLabel,\n keepOpen,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n ...restProps\n}: UseMultiselectOptions) {\n checkOptionValueField('Multiselect', 'options', options);\n\n const i18n = useInternalI18n('multiselect');\n const i18nCommon = useInternalI18n('select');\n const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);\n const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filtered);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [onChange, selectedOptions, filteredOptions]\n );\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: filteredOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n statusType,\n });\n\n const wrapperOnKeyDown = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: filteredOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n isFiltered,\n filteringResultsText: filteredText,\n onRecoveryClick: handleRecoveryClick,\n errorIconAriaLabel: errorIconAriaLabel,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const dropdownOnMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const tokenOnDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n return {\n isOpen,\n tokens,\n announcement,\n dropdownStatus,\n filteringValue,\n filteredOptions,\n highlightType,\n scrollToIndex,\n getFilterProps,\n getTriggerProps,\n getMenuProps: () => ({\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(ariaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n }),\n getOptionProps,\n getTokenProps: () => ({ onDismiss: tokenOnDismiss }),\n getDropdownProps: () => ({ ...getDropdownProps(), onMouseDown: dropdownOnMouseDown }),\n getWrapperProps: () => ({ onKeyDown: wrapperOnKeyDown }),\n };\n}\n"]}
|
|
@@ -64,6 +64,22 @@ export interface PromptInputProps extends BaseInputProps, InputKeyEvents, InputA
|
|
|
64
64
|
* Specifies the maximum number of lines of text the textarea will expand to.
|
|
65
65
|
*/
|
|
66
66
|
maxRows?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Use this slot to add secondary actions to the prompt input.
|
|
69
|
+
*/
|
|
70
|
+
secondaryActions?: React.ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* Use this slot to add secondary content, such as file attachments, to the prompt input.
|
|
73
|
+
*/
|
|
74
|
+
secondaryContent?: React.ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Determines whether the secondary actions area of the input has padding. If true, removes the default padding from the secondary actions area.
|
|
77
|
+
*/
|
|
78
|
+
disableSecondaryActionsPaddings?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Determines whether the secondary content area of the input has padding. If true, removes the default padding from the secondary content area.
|
|
81
|
+
*/
|
|
82
|
+
disableSecondaryContentPaddings?: boolean;
|
|
67
83
|
}
|
|
68
84
|
export declare namespace PromptInputProps {
|
|
69
85
|
type KeyDetail = BaseKeyDetail;
|
|
@@ -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,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,+BAA+B;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACpE;;OAEG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IACtC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,mBAAmB,CAAC,EAAE,KAAK,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