@transferwise/components 46.156.0 → 46.157.1
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/build/Calendar/Calendar.constants.js +10 -0
- package/build/Calendar/Calendar.constants.js.map +1 -0
- package/build/Calendar/Calendar.constants.mjs +8 -0
- package/build/Calendar/Calendar.constants.mjs.map +1 -0
- package/build/Calendar/Calendar.js +121 -17
- package/build/Calendar/Calendar.js.map +1 -1
- package/build/Calendar/Calendar.messages.js +12 -0
- package/build/Calendar/Calendar.messages.js.map +1 -1
- package/build/Calendar/Calendar.messages.mjs +12 -0
- package/build/Calendar/Calendar.messages.mjs.map +1 -1
- package/build/Calendar/Calendar.mjs +122 -18
- package/build/Calendar/Calendar.mjs.map +1 -1
- package/build/Calendar/DateHeader/DateHeader.js +5 -1
- package/build/Calendar/DateHeader/DateHeader.js.map +1 -1
- package/build/Calendar/DateHeader/DateHeader.mjs +5 -1
- package/build/Calendar/DateHeader/DateHeader.mjs.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.js +20 -2
- package/build/Calendar/DayCalendar/DayCalendar.js.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.mjs +20 -2
- package/build/Calendar/DayCalendar/DayCalendar.mjs.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js +60 -19
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs +60 -19
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/MonthCalendar.js +6 -0
- package/build/Calendar/MonthCalendar/MonthCalendar.js.map +1 -1
- package/build/Calendar/MonthCalendar/MonthCalendar.mjs +6 -0
- package/build/Calendar/MonthCalendar/MonthCalendar.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js +8 -3
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs +8 -3
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
- package/build/Calendar/TableLink/TableLink.js +95 -0
- package/build/Calendar/TableLink/TableLink.js.map +1 -0
- package/build/Calendar/TableLink/TableLink.mjs +91 -0
- package/build/Calendar/TableLink/TableLink.mjs.map +1 -0
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js +8 -3
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js.map +1 -1
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs +8 -3
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs.map +1 -1
- package/build/Calendar/YearCalendar/YearCalendar.js +7 -0
- package/build/Calendar/YearCalendar/YearCalendar.js.map +1 -1
- package/build/Calendar/YearCalendar/YearCalendar.mjs +7 -0
- package/build/Calendar/YearCalendar/YearCalendar.mjs.map +1 -1
- package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.js +24 -0
- package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.js.map +1 -0
- package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.mjs +22 -0
- package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.mjs.map +1 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js +33 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs +31 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js +40 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js.map +1 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs +38 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs.map +1 -0
- package/build/DateLookup/DateLookup.js +20 -9
- package/build/DateLookup/DateLookup.js.map +1 -1
- package/build/DateLookup/DateLookup.mjs +20 -9
- package/build/DateLookup/DateLookup.mjs.map +1 -1
- package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.js +3 -5
- package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.js.map +1 -1
- package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.mjs +3 -5
- package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.mjs.map +1 -1
- package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -1
- package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -1
- package/build/Typeahead/Typeahead.js +53 -27
- package/build/Typeahead/Typeahead.js.map +1 -1
- package/build/Typeahead/Typeahead.messages.js +3 -0
- package/build/Typeahead/Typeahead.messages.js.map +1 -1
- package/build/Typeahead/Typeahead.messages.mjs +3 -0
- package/build/Typeahead/Typeahead.messages.mjs.map +1 -1
- package/build/Typeahead/Typeahead.mjs +53 -27
- package/build/Typeahead/Typeahead.mjs.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js +2 -2
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs +2 -2
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.js +3 -1
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.js.map +1 -1
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs +3 -1
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs.map +1 -1
- package/build/i18n/en.json +5 -0
- package/build/i18n/en.json.js +5 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +5 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/main.css +147 -43
- package/build/styles/Calendar/Calendar.css +112 -37
- package/build/styles/Calendar/TableLink/TableLink.css +115 -0
- package/build/styles/Typeahead/Typeahead.css +14 -0
- package/build/styles/Typeahead/TypeaheadOption/TypeaheadOption.css +5 -0
- package/build/styles/main.css +147 -43
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/Calendar/Calendar.constants.d.ts +2 -0
- package/build/types/Calendar/Calendar.constants.d.ts.map +1 -0
- package/build/types/Calendar/Calendar.d.ts +16 -3
- package/build/types/Calendar/Calendar.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.messages.d.ts +20 -0
- package/build/types/Calendar/Calendar.messages.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.types.d.ts +32 -0
- package/build/types/Calendar/Calendar.types.d.ts.map +1 -0
- package/build/types/Calendar/DateHeader/DateHeader.d.ts +2 -0
- package/build/types/Calendar/DateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts +7 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts +6 -0
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts +1 -0
- package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts.map +1 -1
- package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts +2 -1
- package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/{tableLink → TableLink}/TableLink.d.ts +5 -1
- package/build/types/Calendar/TableLink/TableLink.d.ts.map +1 -0
- package/build/types/Calendar/TableLink/index.d.ts.map +1 -0
- package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts +2 -1
- package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/YearCalendar/YearCalendar.d.ts +1 -0
- package/build/types/Calendar/YearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.d.ts +8 -0
- package/build/types/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.d.ts.map +1 -0
- package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts +3 -0
- package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts.map +1 -0
- package/build/types/Calendar/_helpers/index.d.ts +4 -0
- package/build/types/Calendar/_helpers/index.d.ts.map +1 -0
- package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts +3 -0
- package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts.map +1 -0
- package/build/types/Calendar/index.d.ts +1 -0
- package/build/types/Calendar/index.d.ts.map +1 -1
- package/build/types/DateLookup/DateLookup.d.ts +24 -5
- package/build/types/DateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/DateLookup/index.d.ts +1 -0
- package/build/types/DateLookup/index.d.ts.map +1 -1
- package/build/types/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.d.ts +6 -4
- package/build/types/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.d.ts.map +1 -1
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +1 -1
- package/build/types/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/Typeahead/Typeahead.messages.d.ts +5 -0
- package/build/types/Typeahead/Typeahead.messages.d.ts.map +1 -1
- package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/build/types/Typeahead/TypeaheadOption/TypeaheadOption.d.ts +1 -0
- package/build/types/Typeahead/TypeaheadOption/TypeaheadOption.d.ts.map +1 -1
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +10 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Calendar/Calendar.constants.ts +5 -0
- package/src/Calendar/Calendar.css +112 -37
- package/src/Calendar/Calendar.disabledDates.test.tsx +610 -0
- package/src/Calendar/Calendar.less +5 -35
- package/src/Calendar/Calendar.messages.ts +21 -0
- package/src/Calendar/Calendar.test.tsx +342 -32
- package/src/Calendar/Calendar.tsx +169 -19
- package/src/Calendar/Calendar.types.ts +35 -0
- package/src/Calendar/DateHeader/DateHeader.tsx +6 -0
- package/src/Calendar/DayCalendar/DayCalendar.tsx +39 -1
- package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +67 -27
- package/src/Calendar/MonthCalendar/MonthCalendar.tsx +8 -0
- package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +15 -3
- package/src/Calendar/TableLink/TableLink.css +115 -0
- package/src/Calendar/TableLink/TableLink.less +68 -0
- package/src/Calendar/TableLink/TableLink.tsx +117 -0
- package/src/Calendar/YearCalendar/Table/YearCalendarTable.tsx +15 -3
- package/src/Calendar/YearCalendar/YearCalendar.tsx +9 -0
- package/src/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.test.ts +90 -0
- package/src/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.ts +25 -0
- package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.test.ts +98 -0
- package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.ts +45 -0
- package/src/Calendar/_helpers/index.ts +3 -0
- package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.test.ts +169 -0
- package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.ts +59 -0
- package/src/Calendar/_stories/Calendar.accessibility.docs.mdx +118 -0
- package/src/Calendar/_stories/Calendar.story.tsx +144 -4
- package/src/Calendar/_stories/Calendar.test.story.tsx +114 -0
- package/src/Calendar/index.ts +7 -0
- package/src/DateLookup/DateLookup.disabledDates.test.tsx +312 -0
- package/src/DateLookup/DateLookup.test.tsx +34 -37
- package/src/DateLookup/DateLookup.tsx +37 -13
- package/src/DateLookup/_stories/DateLookup.accessibility.docs.mdx +108 -0
- package/src/DateLookup/_stories/DateLookup.story.tsx +126 -2
- package/src/DateLookup/index.ts +6 -0
- package/src/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.tsx +12 -13
- package/src/Inputs/SelectInput/SelectInput.test.tsx +37 -0
- package/src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +1 -1
- package/src/Typeahead/Typeahead.css +14 -0
- package/src/Typeahead/Typeahead.less +8 -0
- package/src/Typeahead/Typeahead.messages.ts +5 -0
- package/src/Typeahead/Typeahead.test.tsx +80 -3
- package/src/Typeahead/Typeahead.tsx +50 -27
- package/src/Typeahead/TypeaheadInput/TypeaheadInput.tsx +2 -6
- package/src/Typeahead/TypeaheadOption/TypeaheadOption.css +5 -0
- package/src/Typeahead/TypeaheadOption/TypeaheadOption.less +9 -0
- package/src/Typeahead/TypeaheadOption/TypeaheadOption.tsx +4 -2
- package/src/i18n/en.json +4 -0
- package/src/index.ts +3 -2
- package/src/main.css +147 -43
- package/build/Calendar/tableLink/TableLink.js +0 -61
- package/build/Calendar/tableLink/TableLink.js.map +0 -1
- package/build/Calendar/tableLink/TableLink.mjs +0 -57
- package/build/Calendar/tableLink/TableLink.mjs.map +0 -1
- package/build/types/Calendar/tableLink/TableLink.d.ts.map +0 -1
- package/build/types/Calendar/tableLink/index.d.ts.map +0 -1
- package/src/Calendar/tableLink/TableLink.tsx +0 -77
- /package/build/types/Calendar/{tableLink → TableLink}/index.d.ts +0 -0
- /package/src/Calendar/{tableLink → TableLink}/index.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInputTriggerButton.mjs","sources":["../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"sourcesContent":["import { ListboxButton } from '@headlessui/react';\nimport mergeProps from 'merge-props';\nimport { useContext } from 'react';\nimport { PolymorphicWithOverrides } from '../../../common/PolymorphicWithOverrides/PolymorphicWithOverrides';\nimport { Merge } from '../../../utils';\nimport { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';\n\nexport type SelectInputTriggerButtonElementType =
|
|
1
|
+
{"version":3,"file":"SelectInputTriggerButton.mjs","sources":["../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"sourcesContent":["import { ListboxButton } from '@headlessui/react';\nimport mergeProps from 'merge-props';\nimport { useContext } from 'react';\nimport { PolymorphicWithOverrides } from '../../../common/PolymorphicWithOverrides/PolymorphicWithOverrides';\nimport { Merge } from '../../../utils';\nimport { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';\n\nexport type SelectInputTriggerButtonElementType = React.ElementType;\n\nexport type SelectInputTriggerButtonProps<\n T extends SelectInputTriggerButtonElementType = 'button',\n> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;\n\n/**\n * The trigger button component for SelectInput.\n * Uses Headless UI's ListboxButton with polymorphic support to allow\n * rendering as different element types.\n */\nexport function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({\n as = 'button' as T,\n ...restProps\n}: SelectInputTriggerButtonProps<T>) {\n const { ref, onClick, onKeyDown, size, ...interactionProps } = useContext(\n SelectInputTriggerButtonPropsContext,\n );\n\n return (\n <ListboxButton\n ref={ref}\n as={PolymorphicWithOverrides}\n role=\"combobox\"\n __overrides={{ as, size, ...interactionProps }}\n {...mergeProps({ onClick, onKeyDown }, restProps)}\n />\n );\n}\n"],"names":["SelectInputTriggerButton","as","restProps","ref","onClick","onKeyDown","size","interactionProps","useContext","SelectInputTriggerButtonPropsContext","_jsx","ListboxButton","PolymorphicWithOverrides","role","__overrides","mergeProps"],"mappings":";;;;;;;AAkBM,SAAUA,wBAAwBA,CAA2D;AACjGC,EAAAA,EAAE,GAAG,QAAa;EAClB,GAAGC;AAAS,CACqB,EAAA;EACjC,MAAM;IAAEC,GAAG;IAAEC,OAAO;IAAEC,SAAS;IAAEC,IAAI;IAAE,GAAGC;AAAgB,GAAE,GAAGC,UAAU,CACvEC,oCAAoC,CACrC;EAED,oBACEC,GAAA,CAACC,aAAa,EAAA;AACZR,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,EAAE,EAAEW,wBAAyB;AAC7BC,IAAAA,IAAI,EAAC,UAAU;AACfC,IAAAA,WAAW,EAAE;MAAEb,EAAE;MAAEK,IAAI;MAAE,GAAGC;KAAmB;AAAA,IAAA,GAC3CQ,UAAU,CAAC;MAAEX,OAAO;AAAEC,MAAAA;AAAS,KAAE,EAAEH,SAAS;AAAC,GAAC,CAClD;AAEN;;;;"}
|
|
@@ -179,11 +179,9 @@ class Typeahead extends React.Component {
|
|
|
179
179
|
showSuggestions,
|
|
180
180
|
allowNew,
|
|
181
181
|
multiple,
|
|
182
|
-
chipSeparators
|
|
183
|
-
options
|
|
182
|
+
chipSeparators
|
|
184
183
|
} = this.props;
|
|
185
184
|
const {
|
|
186
|
-
keyboardFocusedOptionIndex,
|
|
187
185
|
query,
|
|
188
186
|
selected
|
|
189
187
|
} = this.state;
|
|
@@ -193,26 +191,8 @@ class Typeahead extends React.Component {
|
|
|
193
191
|
this.selectItem({
|
|
194
192
|
label: query
|
|
195
193
|
});
|
|
196
|
-
} else {
|
|
194
|
+
} else if (!this.handleOptionNavigation(event)) {
|
|
197
195
|
switch (event.key) {
|
|
198
|
-
case 'ArrowDown':
|
|
199
|
-
event.preventDefault();
|
|
200
|
-
this.moveFocusedOption(1);
|
|
201
|
-
break;
|
|
202
|
-
case 'ArrowUp':
|
|
203
|
-
event.preventDefault();
|
|
204
|
-
this.moveFocusedOption(-1);
|
|
205
|
-
break;
|
|
206
|
-
case 'Enter':
|
|
207
|
-
event.preventDefault();
|
|
208
|
-
if (keyboardFocusedOptionIndex != null && options[keyboardFocusedOptionIndex]) {
|
|
209
|
-
this.selectItem(options[keyboardFocusedOptionIndex]);
|
|
210
|
-
} else if (allowNew && query.trim()) {
|
|
211
|
-
this.selectItem({
|
|
212
|
-
label: query
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
break;
|
|
216
196
|
case 'Backspace':
|
|
217
197
|
if (multiple && !query && selected.length > 0) {
|
|
218
198
|
this.updateSelectedValue(selected.slice(0, -1));
|
|
@@ -221,6 +201,41 @@ class Typeahead extends React.Component {
|
|
|
221
201
|
}
|
|
222
202
|
}
|
|
223
203
|
};
|
|
204
|
+
handleOptionListKeyDown = event => {
|
|
205
|
+
this.handleOptionNavigation(event);
|
|
206
|
+
};
|
|
207
|
+
handleOptionNavigation(event) {
|
|
208
|
+
const {
|
|
209
|
+
allowNew,
|
|
210
|
+
options
|
|
211
|
+
} = this.props;
|
|
212
|
+
const {
|
|
213
|
+
keyboardFocusedOptionIndex,
|
|
214
|
+
query
|
|
215
|
+
} = this.state;
|
|
216
|
+
switch (event.key) {
|
|
217
|
+
case 'ArrowDown':
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
this.moveFocusedOption(1);
|
|
220
|
+
return true;
|
|
221
|
+
case 'ArrowUp':
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
this.moveFocusedOption(-1);
|
|
224
|
+
return true;
|
|
225
|
+
case 'Enter':
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
if (keyboardFocusedOptionIndex != null && options[keyboardFocusedOptionIndex]) {
|
|
228
|
+
this.selectItem(options[keyboardFocusedOptionIndex]);
|
|
229
|
+
} else if (allowNew && query.trim()) {
|
|
230
|
+
this.selectItem({
|
|
231
|
+
label: query
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return true;
|
|
235
|
+
default:
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
224
239
|
moveFocusedOption(offset) {
|
|
225
240
|
this.setState(previousState => {
|
|
226
241
|
const {
|
|
@@ -235,13 +250,20 @@ class Typeahead extends React.Component {
|
|
|
235
250
|
}
|
|
236
251
|
const optionRef = this.optionRefs[index];
|
|
237
252
|
if (optionRef?.current) {
|
|
238
|
-
optionRef.current.
|
|
253
|
+
optionRef.current.scrollIntoView({
|
|
254
|
+
block: 'nearest'
|
|
255
|
+
});
|
|
239
256
|
}
|
|
240
257
|
return {
|
|
241
258
|
keyboardFocusedOptionIndex: index
|
|
242
259
|
};
|
|
243
260
|
});
|
|
244
261
|
}
|
|
262
|
+
setFocusedOption = index => {
|
|
263
|
+
this.setState({
|
|
264
|
+
keyboardFocusedOptionIndex: index
|
|
265
|
+
});
|
|
266
|
+
};
|
|
245
267
|
selectItem = item => {
|
|
246
268
|
const {
|
|
247
269
|
multiple
|
|
@@ -380,10 +402,13 @@ class Typeahead extends React.Component {
|
|
|
380
402
|
className: clsx.clsx('dropdown btn-group btn-block', {
|
|
381
403
|
open: dropdownOpen
|
|
382
404
|
}),
|
|
383
|
-
id: `menu-${id}`,
|
|
384
405
|
children: (!!optionsToRender.length || footer) && /*#__PURE__*/jsxRuntime.jsxs("ul", {
|
|
385
406
|
className: "dropdown-menu",
|
|
386
|
-
|
|
407
|
+
id: `menu-${id}`,
|
|
408
|
+
role: "listbox",
|
|
409
|
+
"aria-label": this.props?.intl?.formatMessage(Typeahead_messages.default.suggestionsLabel),
|
|
410
|
+
tabIndex: 0,
|
|
411
|
+
onKeyDown: this.handleOptionListKeyDown,
|
|
387
412
|
children: [optionsToRender.map((option, idx) => {
|
|
388
413
|
const ref = /*#__PURE__*/React__default.default.createRef();
|
|
389
414
|
this.optionRefs[idx] = ref;
|
|
@@ -392,7 +417,8 @@ class Typeahead extends React.Component {
|
|
|
392
417
|
query: query,
|
|
393
418
|
option: option,
|
|
394
419
|
selected: keyboardFocusedOptionIndex === idx,
|
|
395
|
-
id:
|
|
420
|
+
id: `${id}-${idx}`,
|
|
421
|
+
onMouseEnter: () => this.setFocusedOption(idx),
|
|
396
422
|
onClick: event => {
|
|
397
423
|
this.onOptionSelected(event, option);
|
|
398
424
|
}
|
|
@@ -495,7 +521,7 @@ class Typeahead extends React.Component {
|
|
|
495
521
|
typeaheadId: id,
|
|
496
522
|
renderChip: this.renderChip,
|
|
497
523
|
autoComplete: inputAutoComplete,
|
|
498
|
-
ariaActivedescendant: keyboardFocusedOptionIndex !== null && options[keyboardFocusedOptionIndex] ? `option-${
|
|
524
|
+
ariaActivedescendant: keyboardFocusedOptionIndex !== null && options[keyboardFocusedOptionIndex] ? `option-${id}-${keyboardFocusedOptionIndex}` : undefined,
|
|
499
525
|
onChange: this.handleOnChange,
|
|
500
526
|
onKeyDown: this.handleOnKeyDown,
|
|
501
527
|
onFocus: this.handleOnFocus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.js","sources":["../../src/Typeahead/Typeahead.tsx"],"sourcesContent":["import { Cross as CrossIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { DebouncedFunc } from 'lodash';\nimport clamp from 'lodash.clamp';\nimport debounce from 'lodash.debounce';\nimport React, { Component, ReactNode } from 'react';\nimport { injectIntl, type WrappedComponentProps } from '../common/injectIntl';\n\nimport { Chip } from '../Chips';\nimport {\n Size,\n Sentiment,\n SizeMedium,\n SizeLarge,\n addClickClassToDocumentOnIos,\n removeClickClassFromDocumentOnIos,\n stopPropagation,\n} from '../common';\nimport { InlinePrompt, InlinePromptProps } from '../Prompt';\nimport { withInputAttributes, WithInputAttributesProps } from '../Inputs/contexts';\n\nimport TypeaheadInput from './TypeaheadInput/TypeaheadInput';\nimport TypeaheadOption from './TypeaheadOption/TypeaheadOption';\nimport messages from './Typeahead.messages';\n\nconst DEFAULT_MIN_QUERY_LENGTH = 3;\nconst SEARCH_DELAY = 200;\n\nexport type TypeaheadOption<T = string> = {\n label: string;\n note?: string;\n secondary?: string;\n value?: T;\n clearQueryOnSelect?: boolean;\n keepFocusOnSelect?: boolean;\n};\n\nexport interface TypeaheadProps<T> extends Partial<WrappedComponentProps> {\n id: string;\n name: string;\n addon?: ReactNode;\n /**\n * @deprecated Use [`Field`](?path=/docs/forms-field--docs) component and its `message` and `sentiment` props instead.\n * @deprecated `error`, `info` and `success` are deprecated as alert types and will be soon removed.\n */\n alert?: {\n message: InlinePromptProps['children'];\n type?:\n | InlinePromptProps['sentiment']\n | `${Sentiment.ERROR}`\n | `${Sentiment.INFO}`\n | `${Sentiment.SUCCESS}`;\n };\n /** @default false */\n allowNew?: boolean;\n /** @default true */\n autoFillOnBlur?: boolean;\n /** @default false */\n autoFocus?: boolean;\n /** @default [] */\n chipSeparators?: readonly string[];\n /** @default true */\n clearable?: boolean;\n footer?: ReactNode;\n /** @default [] */\n initialValue?: readonly TypeaheadOption<T>[];\n /** @default 'new-password' */\n inputAutoComplete?: string;\n maxHeight?: number;\n /** @default 3 */\n minQueryLength?: number;\n placeholder?: string;\n /** @default false */\n multiple?: boolean;\n options: readonly TypeaheadOption<T>[];\n /** @default 200 */\n searchDelay?: number;\n /** @default true */\n showSuggestions?: boolean;\n /** @default true */\n showNewEntry?: boolean;\n /** @default 'md' */\n size?: SizeMedium | SizeLarge;\n onBlur?: () => void;\n onChange: (options: TypeaheadOption<T>[]) => void;\n onFocus?: () => void;\n onInputChange?: (query: string) => void;\n onSearch?: (query: string) => void;\n validateChip?: (chip: TypeaheadOption<T>) => boolean;\n}\n\ntype TypeaheadPropsWithInputAttributes<T> = TypeaheadProps<T> &\n Partial<WithInputAttributesProps> &\n WrappedComponentProps;\n\ntype TypeaheadState<T> = {\n selected: readonly TypeaheadOption<T>[];\n keyboardFocusedOptionIndex: number | null;\n errorState: boolean;\n query: string;\n optionsShown: boolean;\n isFocused: boolean;\n};\n\nclass Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, TypeaheadState<T>> {\n declare props: TypeaheadPropsWithInputAttributes<T> &\n Required<Pick<TypeaheadPropsWithInputAttributes<T>, keyof typeof Typeahead.defaultProps>>;\n\n static defaultProps = {\n allowNew: false,\n autoFillOnBlur: true,\n autoFocus: false,\n chipSeparators: [],\n clearable: true,\n initialValue: [],\n inputAutoComplete: 'new-password',\n minQueryLength: DEFAULT_MIN_QUERY_LENGTH,\n multiple: false,\n searchDelay: SEARCH_DELAY,\n showSuggestions: true,\n showNewEntry: true,\n size: Size.MEDIUM,\n validateChip: () => true,\n } satisfies Partial<TypeaheadProps<unknown>>;\n optionRefs: (React.RefObject<HTMLLIElement> | null)[];\n\n constructor(props: TypeaheadPropsWithInputAttributes<T>) {\n super(props);\n const { searchDelay, initialValue, multiple } = this.props;\n this.handleSearchDebounced = debounce(this.handleSearch, searchDelay);\n const initialQuery = !multiple && initialValue.length > 0 ? initialValue[0].label : '';\n this.state = {\n selected: initialValue,\n errorState: false,\n query: initialQuery,\n keyboardFocusedOptionIndex: null,\n optionsShown: false,\n isFocused: false,\n };\n this.optionRefs = [] as (React.RefObject<HTMLLIElement> | null)[];\n }\n\n handleSearchDebounced: DebouncedFunc<Typeahead<T>['handleSearch']>;\n\n UNSAFE_componentWillReceiveProps(nextProps: TypeaheadPropsWithInputAttributes<T>) {\n if (nextProps.multiple !== this.props.multiple) {\n this.setState((previousState) => {\n const { selected } = previousState;\n if (!nextProps.multiple && selected.length > 0) {\n return {\n query: selected[0].label,\n selected: [selected[0]],\n };\n }\n return {\n selected: previousState.selected,\n query: '',\n };\n });\n }\n }\n\n componentWillUnmount() {\n this.handleSearchDebounced.cancel();\n }\n\n handleOnFocus = () => {\n this.showMenu();\n this.props.onFocus?.();\n };\n\n onOptionSelected = (event: React.MouseEvent, item: TypeaheadOption<T>) => {\n event.preventDefault();\n this.selectItem(item);\n };\n\n handleOnChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n const { optionsShown, selected } = this.state;\n const { multiple, onInputChange } = this.props;\n\n if (!optionsShown) {\n this.showMenu();\n }\n\n const query = event.target.value;\n\n if (!multiple && selected.length > 0) {\n this.updateSelectedValue([]);\n }\n\n this.setState({ query }, () => {\n this.handleSearchDebounced(query);\n if (onInputChange) {\n onInputChange(query);\n }\n });\n };\n\n handleOnPaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n const { allowNew, multiple, chipSeparators } = this.props;\n const { selected } = this.state;\n\n if (allowNew && multiple && chipSeparators.length > 0) {\n event.preventDefault();\n const value = event.clipboardData.getData('text');\n if (value) {\n const regex = new RegExp(chipSeparators.join('|'));\n const pastedChips = value\n .split(regex)\n .map((label) => ({ label: label.trim() }))\n .filter((chip) => chip.label);\n\n this.updateSelectedValue([...selected, ...pastedChips]);\n }\n }\n };\n\n handleOnKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n const { showSuggestions, allowNew, multiple, chipSeparators, options } = this.props;\n const { keyboardFocusedOptionIndex, query, selected } = this.state;\n const chipsMode = !showSuggestions && allowNew && multiple;\n\n if (chipsMode && ['Enter', 'Tab', ...chipSeparators].includes(event.key) && query.trim()) {\n event.preventDefault();\n this.selectItem({ label: query });\n } else {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.moveFocusedOption(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.moveFocusedOption(-1);\n break;\n case 'Enter':\n event.preventDefault();\n if (keyboardFocusedOptionIndex != null && options[keyboardFocusedOptionIndex]) {\n this.selectItem(options[keyboardFocusedOptionIndex]);\n } else if (allowNew && query.trim()) {\n this.selectItem({ label: query });\n }\n break;\n case 'Backspace':\n if (multiple && !query && selected.length > 0) {\n this.updateSelectedValue(selected.slice(0, -1));\n }\n break;\n default:\n break;\n }\n }\n };\n moveFocusedOption(offset: number) {\n this.setState((previousState) => {\n const { keyboardFocusedOptionIndex } = previousState;\n const { options } = this.props;\n let index = 0;\n if (keyboardFocusedOptionIndex !== null) {\n index = clamp(keyboardFocusedOptionIndex + offset, 0, options.length - 1);\n }\n const optionRef = this.optionRefs[index];\n if (optionRef?.current) {\n optionRef.current.focus(); // Set focus on the option element\n }\n return {\n keyboardFocusedOptionIndex: index,\n };\n });\n }\n\n selectItem = (item: TypeaheadOption<T>) => {\n const { multiple } = this.props;\n let selected = [...this.state.selected];\n let query;\n if (multiple) {\n selected.push(item);\n query = '';\n } else {\n selected = [item];\n query = item.label;\n }\n\n this.updateSelectedValue(selected);\n\n if (!item.keepFocusOnSelect) {\n this.hideMenu();\n }\n\n if (item.clearQueryOnSelect) {\n query = '';\n }\n\n this.setState({\n query,\n });\n };\n\n handleSearch = (query: string) => {\n const { onSearch } = this.props;\n if (onSearch) {\n onSearch(query);\n }\n\n this.setState((previousState) => ({\n keyboardFocusedOptionIndex: previousState.keyboardFocusedOptionIndex === null ? null : 0,\n }));\n };\n\n handleDocumentClick = () => {\n if (this.state.optionsShown) {\n this.hideMenu();\n const { allowNew, onBlur, autoFillOnBlur } = this.props;\n const { query } = this.state;\n this.setState({\n isFocused: false,\n });\n if (allowNew && autoFillOnBlur && query.trim()) {\n this.selectItem({ label: query });\n }\n\n if (onBlur) {\n onBlur();\n }\n }\n };\n\n showMenu = () => {\n this.setState(\n {\n isFocused: true,\n optionsShown: true,\n },\n () => {\n addClickClassToDocumentOnIos();\n document.addEventListener('click', this.handleDocumentClick, false);\n },\n );\n };\n\n hideMenu = () => {\n this.setState(\n {\n optionsShown: false,\n keyboardFocusedOptionIndex: null,\n },\n () => {\n removeClickClassFromDocumentOnIos();\n document.removeEventListener('click', this.handleDocumentClick, false);\n },\n );\n };\n\n updateSelectedValue = (selected: readonly TypeaheadOption<T>[]) => {\n const { onChange, validateChip } = this.props;\n\n const errorState = selected.some((chip) => !validateChip(chip));\n this.setState({ selected, errorState }, () => {\n onChange([...selected]);\n });\n };\n\n clear = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n if (this.state.selected.length > 0) {\n this.updateSelectedValue([]);\n }\n\n this.setState({\n query: '',\n });\n };\n\n removeChip = (option: TypeaheadOption<T>) => {\n const { selected } = this.state;\n\n if (selected.length > 0) {\n this.updateSelectedValue([...selected.filter((selectedOption) => selectedOption !== option)]);\n }\n };\n\n renderChip = (option: TypeaheadOption<T>, idx: number): ReactNode => {\n const valid = this.props.validateChip?.(option);\n\n return (\n <Chip\n key={idx}\n label={option.label}\n className={clsx('m-t-1', {\n 'has-error': !valid,\n 'np-chip--valid': valid,\n })}\n onRemove={() => this.removeChip(option)}\n />\n );\n };\n\n renderMenu = ({\n footer,\n options,\n id,\n keyboardFocusedOptionIndex,\n query,\n allowNew,\n showNewEntry,\n dropdownOpen,\n }: Pick<\n TypeaheadPropsWithInputAttributes<T>,\n 'footer' | 'options' | 'id' | 'allowNew' | 'showNewEntry'\n > &\n Pick<TypeaheadState<T>, 'keyboardFocusedOptionIndex' | 'query'> & {\n dropdownOpen: boolean;\n }) => {\n const optionsToRender = [...options];\n if (\n allowNew &&\n query.trim() &&\n options.every((option) => option.label.trim().toUpperCase() !== query.trim().toUpperCase()) &&\n showNewEntry\n ) {\n optionsToRender.push({\n label: query,\n });\n }\n return (\n <div\n className={clsx('dropdown btn-group btn-block', { open: dropdownOpen })}\n id={`menu-${id}`}\n >\n {(!!optionsToRender.length || footer) && (\n <ul className=\"dropdown-menu\" role=\"menu\">\n {optionsToRender.map((option, idx) => {\n const ref = React.createRef<HTMLLIElement>();\n this.optionRefs[idx] = ref;\n return (\n <TypeaheadOption\n key={`${option.label}${idx.toString()}`}\n ref={ref}\n query={query}\n option={option}\n selected={keyboardFocusedOptionIndex === idx}\n id={String(option.label.replace(/\\s+/g, '-'))}\n onClick={(event) => {\n this.onOptionSelected(event, option);\n }}\n />\n );\n })}\n {footer}\n </ul>\n )}\n </div>\n );\n };\n\n render() {\n const {\n inputAttributes,\n id: idProp,\n placeholder,\n multiple,\n size,\n addon,\n name,\n clearable,\n allowNew,\n footer,\n showSuggestions,\n showNewEntry,\n options,\n minQueryLength,\n autoFocus,\n maxHeight,\n alert,\n inputAutoComplete,\n } = this.props;\n const id = idProp ?? inputAttributes?.id;\n\n const { errorState, query, selected, optionsShown, keyboardFocusedOptionIndex } = this.state;\n\n const clearButton = clearable && (query || selected.length > 0);\n\n const dropdownOpen = optionsShown && showSuggestions && query.length >= minQueryLength;\n\n const menu = this.renderMenu({\n footer,\n options,\n id,\n keyboardFocusedOptionIndex,\n query,\n allowNew,\n showNewEntry,\n dropdownOpen,\n });\n\n const alertType = (() => {\n if (!alert?.type || alert.type === Sentiment.INFO) {\n return Sentiment.NEUTRAL;\n }\n if (alert.type === Sentiment.ERROR) {\n return Sentiment.NEGATIVE;\n }\n if (alert.type === Sentiment.SUCCESS) {\n return Sentiment.POSITIVE;\n }\n return alert.type;\n })();\n const hasError = errorState || (alert && alertType === Sentiment.NEGATIVE);\n const displayAlert = (!errorState && alert) || (alert && alertType === Sentiment.NEGATIVE);\n const hasWarning = displayAlert && alertType === Sentiment.WARNING;\n const hasInfo = displayAlert && alertType === Sentiment.NEUTRAL;\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <div\n role=\"group\"\n {...inputAttributes}\n id={id}\n className={clsx('typeahead', `typeahead-${size}`, {\n 'typeahead--has-value': selected.length > 0,\n 'typeahead--empty': selected.length === 0,\n 'typeahead--multiple': multiple,\n open: dropdownOpen,\n })}\n onClick={stopPropagation}\n >\n <div\n className={clsx('form-group', 'form-group--typeahead', {\n 'has-error': hasError,\n 'has-warning': hasWarning,\n 'has-info': hasInfo,\n })}\n >\n <div\n className={clsx(`input-group input-group-${size}`, {\n 'input-group--has-error': hasError,\n })}\n >\n {addon && <span className=\"input-group-addon input-group-addon--search\">{addon}</span>}\n\n <TypeaheadInput\n {...{\n autoFocus,\n multiple,\n dropdownOpen,\n placeholder,\n selected,\n maxHeight,\n }}\n id={id}\n name={name}\n value={query}\n typeaheadId={id}\n renderChip={this.renderChip}\n autoComplete={inputAutoComplete}\n ariaActivedescendant={\n keyboardFocusedOptionIndex !== null && options[keyboardFocusedOptionIndex]\n ? `option-${options[keyboardFocusedOptionIndex].label.replace(/\\s+/g, '-')}`\n : undefined\n }\n onChange={this.handleOnChange}\n onKeyDown={this.handleOnKeyDown}\n onFocus={this.handleOnFocus}\n onPaste={this.handleOnPaste}\n />\n\n {clearButton && (\n <div className=\"input-group-addon\">\n <button\n type=\"button\"\n className=\"btn-unstyled\"\n aria-label={this.props?.intl?.formatMessage(messages.clearLabel)}\n onClick={this.clear}\n >\n <CrossIcon />\n </button>\n </div>\n )}\n </div>\n {displayAlert ? (\n <InlinePrompt sentiment={alertType} className=\"typeahead--prompt\" width=\"full\">\n {alert.message}\n </InlinePrompt>\n ) : (\n menu\n )}\n </div>\n </div>\n );\n }\n}\n\nexport default injectIntl(withInputAttributes(Typeahead, { nonLabelable: true })) as <T>(\n props: TypeaheadProps<T>,\n) => React.ReactElement;\n"],"names":["DEFAULT_MIN_QUERY_LENGTH","SEARCH_DELAY","Typeahead","Component","defaultProps","allowNew","autoFillOnBlur","autoFocus","chipSeparators","clearable","initialValue","inputAutoComplete","minQueryLength","multiple","searchDelay","showSuggestions","showNewEntry","size","Size","MEDIUM","validateChip","optionRefs","constructor","props","handleSearchDebounced","debounce","handleSearch","initialQuery","length","label","state","selected","errorState","query","keyboardFocusedOptionIndex","optionsShown","isFocused","UNSAFE_componentWillReceiveProps","nextProps","setState","previousState","componentWillUnmount","cancel","handleOnFocus","showMenu","onFocus","onOptionSelected","event","item","preventDefault","selectItem","handleOnChange","onInputChange","target","value","updateSelectedValue","handleOnPaste","clipboardData","getData","regex","RegExp","join","pastedChips","split","map","trim","filter","chip","handleOnKeyDown","options","chipsMode","includes","key","moveFocusedOption","slice","offset","index","clamp","optionRef","current","focus","push","keepFocusOnSelect","hideMenu","clearQueryOnSelect","onSearch","handleDocumentClick","onBlur","addClickClassToDocumentOnIos","document","addEventListener","removeClickClassFromDocumentOnIos","removeEventListener","onChange","some","clear","removeChip","option","selectedOption","renderChip","idx","valid","_jsx","Chip","className","clsx","onRemove","renderMenu","footer","id","dropdownOpen","optionsToRender","every","toUpperCase","open","children","_jsxs","role","ref","React","createRef","TypeaheadOption","String","replace","onClick","toString","render","inputAttributes","idProp","placeholder","addon","name","maxHeight","alert","clearButton","menu","alertType","type","Sentiment","INFO","NEUTRAL","ERROR","NEGATIVE","SUCCESS","POSITIVE","hasError","displayAlert","hasWarning","WARNING","hasInfo","stopPropagation","TypeaheadInput","typeaheadId","autoComplete","ariaActivedescendant","undefined","onKeyDown","onPaste","intl","formatMessage","messages","clearLabel","CrossIcon","InlinePrompt","sentiment","width","message","injectIntl","withInputAttributes","nonLabelable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMA,wBAAwB,GAAG,CAAC;AAClC,MAAMC,YAAY,GAAG,GAAG;AA8ExB,MAAMC,SAAa,SAAQC,eAAkE,CAAA;AAI3F,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,cAAc,EAAE,IAAI;AACpBC,IAAAA,SAAS,EAAE,KAAK;AAChBC,IAAAA,cAAc,EAAE,EAAE;AAClBC,IAAAA,SAAS,EAAE,IAAI;AACfC,IAAAA,YAAY,EAAE,EAAE;AAChBC,IAAAA,iBAAiB,EAAE,cAAc;AACjCC,IAAAA,cAAc,EAAEZ,wBAAwB;AACxCa,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,WAAW,EAAEb,YAAY;AACzBc,IAAAA,eAAe,EAAE,IAAI;AACrBC,IAAAA,YAAY,EAAE,IAAI;IAClBC,IAAI,EAAEC,SAAI,CAACC,MAAM;IACjBC,YAAY,EAAEA,MAAM;GACsB;EAC5CC,UAAU;EAEVC,WAAAA,CAAYC,KAA2C,EAAA;IACrD,KAAK,CAACA,KAAK,CAAC;IACZ,M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K,CAAC,GAEf/B,IACD;OACE;AACP,KAAK,CAAC;AAEV,EAAA;;AAGF,wBAAegC,qBAAU,CAACC,4BAAmB,CAACtK,SAAS,EAAE;AAAEuK,EAAAA,YAAY,EAAE;AAAI,CAAE,CAAC,CAEzD;;;;"}
|
|
1
|
+
{"version":3,"file":"Typeahead.js","sources":["../../src/Typeahead/Typeahead.tsx"],"sourcesContent":["import { Cross as CrossIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { DebouncedFunc } from 'lodash';\nimport clamp from 'lodash.clamp';\nimport debounce from 'lodash.debounce';\nimport React, { Component, ReactNode } from 'react';\nimport { injectIntl, type WrappedComponentProps } from '../common/injectIntl';\n\nimport { Chip } from '../Chips';\nimport {\n Size,\n Sentiment,\n SizeMedium,\n SizeLarge,\n addClickClassToDocumentOnIos,\n removeClickClassFromDocumentOnIos,\n stopPropagation,\n} from '../common';\nimport { InlinePrompt, InlinePromptProps } from '../Prompt';\nimport { withInputAttributes, WithInputAttributesProps } from '../Inputs/contexts';\n\nimport TypeaheadInput from './TypeaheadInput/TypeaheadInput';\nimport TypeaheadOption from './TypeaheadOption/TypeaheadOption';\nimport messages from './Typeahead.messages';\n\nconst DEFAULT_MIN_QUERY_LENGTH = 3;\nconst SEARCH_DELAY = 200;\n\nexport type TypeaheadOption<T = string> = {\n label: string;\n note?: string;\n secondary?: string;\n value?: T;\n clearQueryOnSelect?: boolean;\n keepFocusOnSelect?: boolean;\n};\n\nexport interface TypeaheadProps<T> extends Partial<WrappedComponentProps> {\n id: string;\n name: string;\n addon?: ReactNode;\n /**\n * @deprecated Use [`Field`](?path=/docs/forms-field--docs) component and its `message` and `sentiment` props instead.\n * @deprecated `error`, `info` and `success` are deprecated as alert types and will be soon removed.\n */\n alert?: {\n message: InlinePromptProps['children'];\n type?:\n | InlinePromptProps['sentiment']\n | `${Sentiment.ERROR}`\n | `${Sentiment.INFO}`\n | `${Sentiment.SUCCESS}`;\n };\n /** @default false */\n allowNew?: boolean;\n /** @default true */\n autoFillOnBlur?: boolean;\n /** @default false */\n autoFocus?: boolean;\n /** @default [] */\n chipSeparators?: readonly string[];\n /** @default true */\n clearable?: boolean;\n footer?: ReactNode;\n /** @default [] */\n initialValue?: readonly TypeaheadOption<T>[];\n /** @default 'new-password' */\n inputAutoComplete?: string;\n maxHeight?: number;\n /** @default 3 */\n minQueryLength?: number;\n placeholder?: string;\n /** @default false */\n multiple?: boolean;\n options: readonly TypeaheadOption<T>[];\n /** @default 200 */\n searchDelay?: number;\n /** @default true */\n showSuggestions?: boolean;\n /** @default true */\n showNewEntry?: boolean;\n /** @default 'md' */\n size?: SizeMedium | SizeLarge;\n onBlur?: () => void;\n onChange: (options: TypeaheadOption<T>[]) => void;\n onFocus?: () => void;\n onInputChange?: (query: string) => void;\n onSearch?: (query: string) => void;\n validateChip?: (chip: TypeaheadOption<T>) => boolean;\n}\n\ntype TypeaheadPropsWithInputAttributes<T> = TypeaheadProps<T> &\n Partial<WithInputAttributesProps> &\n WrappedComponentProps;\n\ntype TypeaheadState<T> = {\n selected: readonly TypeaheadOption<T>[];\n keyboardFocusedOptionIndex: number | null;\n errorState: boolean;\n query: string;\n optionsShown: boolean;\n isFocused: boolean;\n};\n\nclass Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, TypeaheadState<T>> {\n declare props: TypeaheadPropsWithInputAttributes<T> &\n Required<Pick<TypeaheadPropsWithInputAttributes<T>, keyof typeof Typeahead.defaultProps>>;\n\n static defaultProps = {\n allowNew: false,\n autoFillOnBlur: true,\n autoFocus: false,\n chipSeparators: [],\n clearable: true,\n initialValue: [],\n inputAutoComplete: 'new-password',\n minQueryLength: DEFAULT_MIN_QUERY_LENGTH,\n multiple: false,\n searchDelay: SEARCH_DELAY,\n showSuggestions: true,\n showNewEntry: true,\n size: Size.MEDIUM,\n validateChip: () => true,\n } satisfies Partial<TypeaheadProps<unknown>>;\n optionRefs: (React.RefObject<HTMLLIElement> | null)[];\n\n constructor(props: TypeaheadPropsWithInputAttributes<T>) {\n super(props);\n const { searchDelay, initialValue, multiple } = this.props;\n this.handleSearchDebounced = debounce(this.handleSearch, searchDelay);\n const initialQuery = !multiple && initialValue.length > 0 ? initialValue[0].label : '';\n this.state = {\n selected: initialValue,\n errorState: false,\n query: initialQuery,\n keyboardFocusedOptionIndex: null,\n optionsShown: false,\n isFocused: false,\n };\n this.optionRefs = [] as (React.RefObject<HTMLLIElement> | null)[];\n }\n\n handleSearchDebounced: DebouncedFunc<Typeahead<T>['handleSearch']>;\n\n UNSAFE_componentWillReceiveProps(nextProps: TypeaheadPropsWithInputAttributes<T>) {\n if (nextProps.multiple !== this.props.multiple) {\n this.setState((previousState) => {\n const { selected } = previousState;\n if (!nextProps.multiple && selected.length > 0) {\n return {\n query: selected[0].label,\n selected: [selected[0]],\n };\n }\n return {\n selected: previousState.selected,\n query: '',\n };\n });\n }\n }\n\n componentWillUnmount() {\n this.handleSearchDebounced.cancel();\n }\n\n handleOnFocus = () => {\n this.showMenu();\n this.props.onFocus?.();\n };\n\n onOptionSelected = (event: React.MouseEvent, item: TypeaheadOption<T>) => {\n event.preventDefault();\n this.selectItem(item);\n };\n\n handleOnChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n const { optionsShown, selected } = this.state;\n const { multiple, onInputChange } = this.props;\n\n if (!optionsShown) {\n this.showMenu();\n }\n\n const query = event.target.value;\n\n if (!multiple && selected.length > 0) {\n this.updateSelectedValue([]);\n }\n\n this.setState({ query }, () => {\n this.handleSearchDebounced(query);\n if (onInputChange) {\n onInputChange(query);\n }\n });\n };\n\n handleOnPaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n const { allowNew, multiple, chipSeparators } = this.props;\n const { selected } = this.state;\n\n if (allowNew && multiple && chipSeparators.length > 0) {\n event.preventDefault();\n const value = event.clipboardData.getData('text');\n if (value) {\n const regex = new RegExp(chipSeparators.join('|'));\n const pastedChips = value\n .split(regex)\n .map((label) => ({ label: label.trim() }))\n .filter((chip) => chip.label);\n\n this.updateSelectedValue([...selected, ...pastedChips]);\n }\n }\n };\n\n handleOnKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n const { showSuggestions, allowNew, multiple, chipSeparators } = this.props;\n const { query, selected } = this.state;\n const chipsMode = !showSuggestions && allowNew && multiple;\n\n if (chipsMode && ['Enter', 'Tab', ...chipSeparators].includes(event.key) && query.trim()) {\n event.preventDefault();\n this.selectItem({ label: query });\n } else if (!this.handleOptionNavigation(event)) {\n switch (event.key) {\n case 'Backspace':\n if (multiple && !query && selected.length > 0) {\n this.updateSelectedValue(selected.slice(0, -1));\n }\n break;\n default:\n break;\n }\n }\n };\n\n handleOptionListKeyDown: React.KeyboardEventHandler<HTMLUListElement> = (event) => {\n this.handleOptionNavigation(event);\n };\n\n handleOptionNavigation(event: React.KeyboardEvent<HTMLElement>) {\n const { allowNew, options } = this.props;\n const { keyboardFocusedOptionIndex, query } = this.state;\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.moveFocusedOption(1);\n return true;\n case 'ArrowUp':\n event.preventDefault();\n this.moveFocusedOption(-1);\n return true;\n case 'Enter':\n event.preventDefault();\n if (keyboardFocusedOptionIndex != null && options[keyboardFocusedOptionIndex]) {\n this.selectItem(options[keyboardFocusedOptionIndex]);\n } else if (allowNew && query.trim()) {\n this.selectItem({ label: query });\n }\n return true;\n default:\n return false;\n }\n }\n moveFocusedOption(offset: number) {\n this.setState((previousState) => {\n const { keyboardFocusedOptionIndex } = previousState;\n const { options } = this.props;\n let index = 0;\n if (keyboardFocusedOptionIndex !== null) {\n index = clamp(keyboardFocusedOptionIndex + offset, 0, options.length - 1);\n }\n const optionRef = this.optionRefs[index];\n if (optionRef?.current) {\n optionRef.current.scrollIntoView({ block: 'nearest' });\n }\n return {\n keyboardFocusedOptionIndex: index,\n };\n });\n }\n\n setFocusedOption = (index: number) => {\n this.setState({ keyboardFocusedOptionIndex: index });\n };\n\n selectItem = (item: TypeaheadOption<T>) => {\n const { multiple } = this.props;\n let selected = [...this.state.selected];\n let query;\n if (multiple) {\n selected.push(item);\n query = '';\n } else {\n selected = [item];\n query = item.label;\n }\n\n this.updateSelectedValue(selected);\n\n if (!item.keepFocusOnSelect) {\n this.hideMenu();\n }\n\n if (item.clearQueryOnSelect) {\n query = '';\n }\n\n this.setState({\n query,\n });\n };\n\n handleSearch = (query: string) => {\n const { onSearch } = this.props;\n if (onSearch) {\n onSearch(query);\n }\n\n this.setState((previousState) => ({\n keyboardFocusedOptionIndex: previousState.keyboardFocusedOptionIndex === null ? null : 0,\n }));\n };\n\n handleDocumentClick = () => {\n if (this.state.optionsShown) {\n this.hideMenu();\n const { allowNew, onBlur, autoFillOnBlur } = this.props;\n const { query } = this.state;\n this.setState({\n isFocused: false,\n });\n if (allowNew && autoFillOnBlur && query.trim()) {\n this.selectItem({ label: query });\n }\n\n if (onBlur) {\n onBlur();\n }\n }\n };\n\n showMenu = () => {\n this.setState(\n {\n isFocused: true,\n optionsShown: true,\n },\n () => {\n addClickClassToDocumentOnIos();\n document.addEventListener('click', this.handleDocumentClick, false);\n },\n );\n };\n\n hideMenu = () => {\n this.setState(\n {\n optionsShown: false,\n keyboardFocusedOptionIndex: null,\n },\n () => {\n removeClickClassFromDocumentOnIos();\n document.removeEventListener('click', this.handleDocumentClick, false);\n },\n );\n };\n\n updateSelectedValue = (selected: readonly TypeaheadOption<T>[]) => {\n const { onChange, validateChip } = this.props;\n\n const errorState = selected.some((chip) => !validateChip(chip));\n this.setState({ selected, errorState }, () => {\n onChange([...selected]);\n });\n };\n\n clear = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n if (this.state.selected.length > 0) {\n this.updateSelectedValue([]);\n }\n\n this.setState({\n query: '',\n });\n };\n\n removeChip = (option: TypeaheadOption<T>) => {\n const { selected } = this.state;\n\n if (selected.length > 0) {\n this.updateSelectedValue([...selected.filter((selectedOption) => selectedOption !== option)]);\n }\n };\n\n renderChip = (option: TypeaheadOption<T>, idx: number): ReactNode => {\n const valid = this.props.validateChip?.(option);\n\n return (\n <Chip\n key={idx}\n label={option.label}\n className={clsx('m-t-1', {\n 'has-error': !valid,\n 'np-chip--valid': valid,\n })}\n onRemove={() => this.removeChip(option)}\n />\n );\n };\n\n renderMenu = ({\n footer,\n options,\n id,\n keyboardFocusedOptionIndex,\n query,\n allowNew,\n showNewEntry,\n dropdownOpen,\n }: Pick<\n TypeaheadPropsWithInputAttributes<T>,\n 'footer' | 'options' | 'id' | 'allowNew' | 'showNewEntry'\n > &\n Pick<TypeaheadState<T>, 'keyboardFocusedOptionIndex' | 'query'> & {\n dropdownOpen: boolean;\n }) => {\n const optionsToRender = [...options];\n if (\n allowNew &&\n query.trim() &&\n options.every((option) => option.label.trim().toUpperCase() !== query.trim().toUpperCase()) &&\n showNewEntry\n ) {\n optionsToRender.push({\n label: query,\n });\n }\n return (\n <div className={clsx('dropdown btn-group btn-block', { open: dropdownOpen })}>\n {(!!optionsToRender.length || footer) && (\n <ul\n className=\"dropdown-menu\"\n id={`menu-${id}`}\n role=\"listbox\"\n aria-label={this.props?.intl?.formatMessage(messages.suggestionsLabel)}\n tabIndex={0}\n onKeyDown={this.handleOptionListKeyDown}\n >\n {optionsToRender.map((option, idx) => {\n const ref = React.createRef<HTMLLIElement>();\n this.optionRefs[idx] = ref;\n return (\n <TypeaheadOption\n key={`${option.label}${idx.toString()}`}\n ref={ref}\n query={query}\n option={option}\n selected={keyboardFocusedOptionIndex === idx}\n id={`${id}-${idx}`}\n onMouseEnter={() => this.setFocusedOption(idx)}\n onClick={(event) => {\n this.onOptionSelected(event, option);\n }}\n />\n );\n })}\n {footer}\n </ul>\n )}\n </div>\n );\n };\n\n render() {\n const {\n inputAttributes,\n id: idProp,\n placeholder,\n multiple,\n size,\n addon,\n name,\n clearable,\n allowNew,\n footer,\n showSuggestions,\n showNewEntry,\n options,\n minQueryLength,\n autoFocus,\n maxHeight,\n alert,\n inputAutoComplete,\n } = this.props;\n const id = idProp ?? inputAttributes?.id;\n\n const { errorState, query, selected, optionsShown, keyboardFocusedOptionIndex } = this.state;\n\n const clearButton = clearable && (query || selected.length > 0);\n\n const dropdownOpen = optionsShown && showSuggestions && query.length >= minQueryLength;\n\n const menu = this.renderMenu({\n footer,\n options,\n id,\n keyboardFocusedOptionIndex,\n query,\n allowNew,\n showNewEntry,\n dropdownOpen,\n });\n\n const alertType = (() => {\n if (!alert?.type || alert.type === Sentiment.INFO) {\n return Sentiment.NEUTRAL;\n }\n if (alert.type === Sentiment.ERROR) {\n return Sentiment.NEGATIVE;\n }\n if (alert.type === Sentiment.SUCCESS) {\n return Sentiment.POSITIVE;\n }\n return alert.type;\n })();\n const hasError = errorState || (alert && alertType === Sentiment.NEGATIVE);\n const displayAlert = (!errorState && alert) || (alert && alertType === Sentiment.NEGATIVE);\n const hasWarning = displayAlert && alertType === Sentiment.WARNING;\n const hasInfo = displayAlert && alertType === Sentiment.NEUTRAL;\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <div\n role=\"group\"\n {...inputAttributes}\n id={id}\n className={clsx('typeahead', `typeahead-${size}`, {\n 'typeahead--has-value': selected.length > 0,\n 'typeahead--empty': selected.length === 0,\n 'typeahead--multiple': multiple,\n open: dropdownOpen,\n })}\n onClick={stopPropagation}\n >\n <div\n className={clsx('form-group', 'form-group--typeahead', {\n 'has-error': hasError,\n 'has-warning': hasWarning,\n 'has-info': hasInfo,\n })}\n >\n <div\n className={clsx(`input-group input-group-${size}`, {\n 'input-group--has-error': hasError,\n })}\n >\n {addon && <span className=\"input-group-addon input-group-addon--search\">{addon}</span>}\n\n <TypeaheadInput\n {...{\n autoFocus,\n multiple,\n dropdownOpen,\n placeholder,\n selected,\n maxHeight,\n }}\n id={id}\n name={name}\n value={query}\n typeaheadId={id}\n renderChip={this.renderChip}\n autoComplete={inputAutoComplete}\n ariaActivedescendant={\n keyboardFocusedOptionIndex !== null && options[keyboardFocusedOptionIndex]\n ? `option-${id}-${keyboardFocusedOptionIndex}`\n : undefined\n }\n onChange={this.handleOnChange}\n onKeyDown={this.handleOnKeyDown}\n onFocus={this.handleOnFocus}\n onPaste={this.handleOnPaste}\n />\n\n {clearButton && (\n <div className=\"input-group-addon\">\n <button\n type=\"button\"\n className=\"btn-unstyled\"\n aria-label={this.props?.intl?.formatMessage(messages.clearLabel)}\n onClick={this.clear}\n >\n <CrossIcon />\n </button>\n </div>\n )}\n </div>\n {displayAlert ? (\n <InlinePrompt sentiment={alertType} className=\"typeahead--prompt\" width=\"full\">\n {alert.message}\n </InlinePrompt>\n ) : (\n menu\n )}\n </div>\n </div>\n );\n }\n}\n\nexport default injectIntl(withInputAttributes(Typeahead, { nonLabelable: true })) as <T>(\n props: TypeaheadProps<T>,\n) => React.ReactElement;\n"],"names":["DEFAULT_MIN_QUERY_LENGTH","SEARCH_DELAY","Typeahead","Component","defaultProps","allowNew","autoFillOnBlur","autoFocus","chipSeparators","clearable","initialValue","inputAutoComplete","minQueryLength","multiple","searchDelay","showSuggestions","showNewEntry","size","Size","MEDIUM","validateChip","optionRefs","constructor","props","handleSearchDebounced","debounce","handleSearch","initialQuery","length","label","state","selected","errorState","query","keyboardFocusedOptionIndex","optionsShown","isFocused","UNSAFE_componentWillReceiveProps","nextProps","setState","previousState","componentWillUnmount","cancel","handleOnFocus","showMenu","onFocus","onOptionSelected","event","item","preventDefault","selectItem","handleOnChange","onInputChange","target","value","updateSelectedValue","handleOnPaste","clipboardData","getData","regex","RegExp","join","pastedChips","split","map","trim","filter","chip","handleOnKeyDown","chipsMode","includes","key","handleOptionNavigation","slice","handleOptionListKeyDown","options","moveFocusedOption","offset","index","clamp","optionRef","current","scrollIntoView","block","setFocusedOption","push","keepFocusOnSelect","hideMenu","clearQueryOnSelect","onSearch","handleDocumentClick","onBlur","addClickClassToDocumentOnIos","document","addEventListener","removeClickClassFromDocumentOnIos","removeEventListener","onChange","some","clear","removeChip","option","selectedOption","renderChip","idx","valid","_jsx","Chip","className","clsx","onRemove","renderMenu","footer","id","dropdownOpen","optionsToRender","every","toUpperCase","open","children","_jsxs","role","intl","formatMessage","messages","suggestionsLabel","tabIndex","onKeyDown","ref","React","createRef","TypeaheadOption","onMouseEnter","onClick","toString","render","inputAttributes","idProp","placeholder","addon","name","maxHeight","alert","clearButton","menu","alertType","type","Sentiment","INFO","NEUTRAL","ERROR","NEGATIVE","SUCCESS","POSITIVE","hasError","displayAlert","hasWarning","WARNING","hasInfo","stopPropagation","TypeaheadInput","typeaheadId","autoComplete","ariaActivedescendant","undefined","onPaste","clearLabel","CrossIcon","InlinePrompt","sentiment","width","message","injectIntl","withInputAttributes","nonLabelable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMA,wBAAwB,GAAG,CAAC;AAClC,MAAMC,YAAY,GAAG,GAAG;AA8ExB,MAAMC,SAAa,SAAQC,eAAkE,CAAA;AAI3F,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,cAAc,EAAE,IAAI;AACpBC,IAAAA,SAAS,EAAE,KAAK;AAChBC,IAAAA,cAAc,EAAE,EAAE;AAClBC,IAAAA,SAAS,EAAE,IAAI;AACfC,IAAAA,YAAY,EAAE,EAAE;AAChBC,IAAAA,iBAAiB,EAAE,cAAc;AACjCC,IAAAA,cAAc,EAAEZ,wBAAwB;AACxCa,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,WAAW,EAAEb,YAAY;AACzBc,IAAAA,eAAe,EAAE,IAAI;AACrBC,IAAAA,YAAY,EAAE,IAAI;IAClBC,IAAI,EAAEC,SAAI,CAACC,MAAM;IACjBC,YAAY,EAAEA,MAAM;GACsB;EAC5CC,UAAU;EAEVC,WAAAA,CAAYC,KAA2C,EAAA;IACrD,KAAK,CAACA,KAAK,CAAC;IACZ,MAAM;MAAET,WAAW;MAAEJ,YAAY;AAAEG,MAAAA;KAAU,GAAG,IAAI,CAACU,KAAK;IAC1D,IAAI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AAc;YAC5B0H,OAAO,EAAE,IAAI,CAAC7G;AAAc,WAAA,CAG9B,EAACuF,WAAW,iBACVrC,cAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,mBAAmB;AAAAW,YAAAA,QAAA,eAChCb,cAAA,CAAA,QAAA,EAAA;AACEwC,cAAAA,IAAI,EAAC,QAAQ;AACbtC,cAAAA,SAAS,EAAC,cAAc;cACxB,YAAA,EAAY,IAAI,CAACrF,KAAK,EAAEmG,IAAI,EAAEC,aAAa,CAACC,0BAAQ,CAAC0C,UAAU,CAAE;cACjEjC,OAAO,EAAE,IAAI,CAAClC,KAAM;AAAAoB,cAAAA,QAAA,eAEpBb,cAAA,CAAC6D,WAAS,EAAA,EAAA;aACJ;AACV,WAAK,CACN;AAAA,SACE,CACL,EAACZ,YAAY,gBACXjD,cAAA,CAAC8D,yBAAY,EAAA;AAACC,UAAAA,SAAS,EAAExB,SAAU;AAACrC,UAAAA,SAAS,EAAC,mBAAmB;AAAC8D,UAAAA,KAAK,EAAC,MAAM;UAAAnD,QAAA,EAC3EuB,KAAK,CAAC6B;SACK,CAAC,GAEf3B,IACD;OACE;AACP,KAAK,CAAC;AAEV,EAAA;;AAGF,wBAAe4B,qBAAU,CAACC,4BAAmB,CAAC3K,SAAS,EAAE;AAAE4K,EAAAA,YAAY,EAAE;AAAI,CAAE,CAAC,CAEzD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.messages.js","sources":["../../src/Typeahead/Typeahead.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n clearLabel: {\n id: 'neptune.ClearButton.ariaLabel',\n defaultMessage: 'Clear',\n description: 'Description of clear button',\n },\n});\n"],"names":["defineMessages","clearLabel","id"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Typeahead.messages.js","sources":["../../src/Typeahead/Typeahead.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n clearLabel: {\n id: 'neptune.ClearButton.ariaLabel',\n defaultMessage: 'Clear',\n description: 'Description of clear button',\n },\n suggestionsLabel: {\n id: 'neptune.Typeahead.suggestionsLabel',\n defaultMessage: 'Suggestions',\n description: 'Accessible label for the list of typeahead suggestions',\n },\n});\n"],"names":["defineMessages","clearLabel","id","suggestionsLabel"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA;GAGH;AACDC,EAAAA,gBAAgB,EAAE;IAChBD,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.messages.mjs","sources":["../../src/Typeahead/Typeahead.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n clearLabel: {\n id: 'neptune.ClearButton.ariaLabel',\n defaultMessage: 'Clear',\n description: 'Description of clear button',\n },\n});\n"],"names":["defineMessages","clearLabel","id"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Typeahead.messages.mjs","sources":["../../src/Typeahead/Typeahead.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n clearLabel: {\n id: 'neptune.ClearButton.ariaLabel',\n defaultMessage: 'Clear',\n description: 'Description of clear button',\n },\n suggestionsLabel: {\n id: 'neptune.Typeahead.suggestionsLabel',\n defaultMessage: 'Suggestions',\n description: 'Accessible label for the list of typeahead suggestions',\n },\n});\n"],"names":["defineMessages","clearLabel","id","suggestionsLabel"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA;GAGH;AACDC,EAAAA,gBAAgB,EAAE;IAChBD,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
|
|
@@ -169,11 +169,9 @@ class Typeahead extends Component {
|
|
|
169
169
|
showSuggestions,
|
|
170
170
|
allowNew,
|
|
171
171
|
multiple,
|
|
172
|
-
chipSeparators
|
|
173
|
-
options
|
|
172
|
+
chipSeparators
|
|
174
173
|
} = this.props;
|
|
175
174
|
const {
|
|
176
|
-
keyboardFocusedOptionIndex,
|
|
177
175
|
query,
|
|
178
176
|
selected
|
|
179
177
|
} = this.state;
|
|
@@ -183,26 +181,8 @@ class Typeahead extends Component {
|
|
|
183
181
|
this.selectItem({
|
|
184
182
|
label: query
|
|
185
183
|
});
|
|
186
|
-
} else {
|
|
184
|
+
} else if (!this.handleOptionNavigation(event)) {
|
|
187
185
|
switch (event.key) {
|
|
188
|
-
case 'ArrowDown':
|
|
189
|
-
event.preventDefault();
|
|
190
|
-
this.moveFocusedOption(1);
|
|
191
|
-
break;
|
|
192
|
-
case 'ArrowUp':
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
this.moveFocusedOption(-1);
|
|
195
|
-
break;
|
|
196
|
-
case 'Enter':
|
|
197
|
-
event.preventDefault();
|
|
198
|
-
if (keyboardFocusedOptionIndex != null && options[keyboardFocusedOptionIndex]) {
|
|
199
|
-
this.selectItem(options[keyboardFocusedOptionIndex]);
|
|
200
|
-
} else if (allowNew && query.trim()) {
|
|
201
|
-
this.selectItem({
|
|
202
|
-
label: query
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
break;
|
|
206
186
|
case 'Backspace':
|
|
207
187
|
if (multiple && !query && selected.length > 0) {
|
|
208
188
|
this.updateSelectedValue(selected.slice(0, -1));
|
|
@@ -211,6 +191,41 @@ class Typeahead extends Component {
|
|
|
211
191
|
}
|
|
212
192
|
}
|
|
213
193
|
};
|
|
194
|
+
handleOptionListKeyDown = event => {
|
|
195
|
+
this.handleOptionNavigation(event);
|
|
196
|
+
};
|
|
197
|
+
handleOptionNavigation(event) {
|
|
198
|
+
const {
|
|
199
|
+
allowNew,
|
|
200
|
+
options
|
|
201
|
+
} = this.props;
|
|
202
|
+
const {
|
|
203
|
+
keyboardFocusedOptionIndex,
|
|
204
|
+
query
|
|
205
|
+
} = this.state;
|
|
206
|
+
switch (event.key) {
|
|
207
|
+
case 'ArrowDown':
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
this.moveFocusedOption(1);
|
|
210
|
+
return true;
|
|
211
|
+
case 'ArrowUp':
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
this.moveFocusedOption(-1);
|
|
214
|
+
return true;
|
|
215
|
+
case 'Enter':
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
if (keyboardFocusedOptionIndex != null && options[keyboardFocusedOptionIndex]) {
|
|
218
|
+
this.selectItem(options[keyboardFocusedOptionIndex]);
|
|
219
|
+
} else if (allowNew && query.trim()) {
|
|
220
|
+
this.selectItem({
|
|
221
|
+
label: query
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
default:
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
214
229
|
moveFocusedOption(offset) {
|
|
215
230
|
this.setState(previousState => {
|
|
216
231
|
const {
|
|
@@ -225,13 +240,20 @@ class Typeahead extends Component {
|
|
|
225
240
|
}
|
|
226
241
|
const optionRef = this.optionRefs[index];
|
|
227
242
|
if (optionRef?.current) {
|
|
228
|
-
optionRef.current.
|
|
243
|
+
optionRef.current.scrollIntoView({
|
|
244
|
+
block: 'nearest'
|
|
245
|
+
});
|
|
229
246
|
}
|
|
230
247
|
return {
|
|
231
248
|
keyboardFocusedOptionIndex: index
|
|
232
249
|
};
|
|
233
250
|
});
|
|
234
251
|
}
|
|
252
|
+
setFocusedOption = index => {
|
|
253
|
+
this.setState({
|
|
254
|
+
keyboardFocusedOptionIndex: index
|
|
255
|
+
});
|
|
256
|
+
};
|
|
235
257
|
selectItem = item => {
|
|
236
258
|
const {
|
|
237
259
|
multiple
|
|
@@ -370,10 +392,13 @@ class Typeahead extends Component {
|
|
|
370
392
|
className: clsx('dropdown btn-group btn-block', {
|
|
371
393
|
open: dropdownOpen
|
|
372
394
|
}),
|
|
373
|
-
id: `menu-${id}`,
|
|
374
395
|
children: (!!optionsToRender.length || footer) && /*#__PURE__*/jsxs("ul", {
|
|
375
396
|
className: "dropdown-menu",
|
|
376
|
-
|
|
397
|
+
id: `menu-${id}`,
|
|
398
|
+
role: "listbox",
|
|
399
|
+
"aria-label": this.props?.intl?.formatMessage(messages.suggestionsLabel),
|
|
400
|
+
tabIndex: 0,
|
|
401
|
+
onKeyDown: this.handleOptionListKeyDown,
|
|
377
402
|
children: [optionsToRender.map((option, idx) => {
|
|
378
403
|
const ref = /*#__PURE__*/React__default.createRef();
|
|
379
404
|
this.optionRefs[idx] = ref;
|
|
@@ -382,7 +407,8 @@ class Typeahead extends Component {
|
|
|
382
407
|
query: query,
|
|
383
408
|
option: option,
|
|
384
409
|
selected: keyboardFocusedOptionIndex === idx,
|
|
385
|
-
id:
|
|
410
|
+
id: `${id}-${idx}`,
|
|
411
|
+
onMouseEnter: () => this.setFocusedOption(idx),
|
|
386
412
|
onClick: event => {
|
|
387
413
|
this.onOptionSelected(event, option);
|
|
388
414
|
}
|
|
@@ -485,7 +511,7 @@ class Typeahead extends Component {
|
|
|
485
511
|
typeaheadId: id,
|
|
486
512
|
renderChip: this.renderChip,
|
|
487
513
|
autoComplete: inputAutoComplete,
|
|
488
|
-
ariaActivedescendant: keyboardFocusedOptionIndex !== null && options[keyboardFocusedOptionIndex] ? `option-${
|
|
514
|
+
ariaActivedescendant: keyboardFocusedOptionIndex !== null && options[keyboardFocusedOptionIndex] ? `option-${id}-${keyboardFocusedOptionIndex}` : undefined,
|
|
489
515
|
onChange: this.handleOnChange,
|
|
490
516
|
onKeyDown: this.handleOnKeyDown,
|
|
491
517
|
onFocus: this.handleOnFocus,
|