@transferwise/components 46.17.2 → 46.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.esm.js +28 -20
- package/build/index.esm.js.map +1 -1
- package/build/index.js +27 -19
- package/build/index.js.map +1 -1
- package/build/main.css +4 -0
- package/build/styles/instructionsList/InstructionsList.css +4 -0
- package/build/styles/main.css +4 -0
- package/build/types/accordion/Accordion.d.ts +3 -7
- package/build/types/accordion/Accordion.d.ts.map +1 -1
- package/build/types/accordion/index.d.ts +1 -0
- package/build/types/accordion/index.d.ts.map +1 -1
- package/build/types/body/Body.d.ts +1 -1
- package/build/types/chips/Chips.d.ts +2 -2
- package/build/types/chips/Chips.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +1 -0
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts +1 -1
- package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +1 -1
- package/build/types/decision/Decision.d.ts +1 -1
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +1 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instructionsList/InstructionsList.d.ts +4 -4
- package/build/types/instructionsList/InstructionsList.d.ts.map +1 -1
- package/build/types/markdown/Markdown.d.ts +2 -2
- package/build/types/markdown/Markdown.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts.map +1 -1
- package/build/types/radioGroup/RadioGroup.d.ts +2 -1
- package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
- package/build/types/radioGroup/index.d.ts +1 -1
- package/build/types/radioGroup/index.d.ts.map +1 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts +3 -3
- package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/stepper/Stepper.d.ts +1 -1
- package/build/types/stepper/Stepper.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts +8 -6
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts +1 -1
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +1 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/getAllowedFileTypes.d.ts +1 -1
- package/build/types/uploadInput/uploadButton/getAllowedFileTypes.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.tsx +6 -7
- package/src/accordion/index.ts +1 -0
- package/src/chips/Chips.story.tsx +2 -2
- package/src/chips/Chips.tsx +2 -2
- package/src/dateLookup/DateLookup.js +2 -0
- package/src/dateLookup/DateLookup.story.js +3 -0
- package/src/dateLookup/DateLookup.view.spec.js +5 -0
- package/src/dateLookup/dateTrigger/DateTrigger.js +1 -1
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +11 -3
- package/src/dateLookup/getFocusableTime/getFocusableTime.tsx +1 -1
- package/src/decision/Decision.tsx +1 -1
- package/src/flowNavigation/FlowNavigation.tsx +1 -1
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +6 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
- package/src/index.ts +2 -1
- package/src/instructionsList/InstructionsList.css +4 -0
- package/src/instructionsList/InstructionsList.less +5 -0
- package/src/instructionsList/InstructionsList.tsx +7 -7
- package/src/main.css +4 -0
- package/src/markdown/Markdown.tsx +3 -3
- package/src/moneyInput/MoneyInput.tsx +3 -3
- package/src/phoneNumberInput/PhoneNumberInput.tsx +1 -1
- package/src/phoneNumberInput/utils/excludeCountries/excludeCountries.ts +5 -2
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.ts +1 -1
- package/src/phoneNumberInput/utils/longestMatchingPrefix/index.ts +1 -1
- package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts +1 -1
- package/src/promoCard/PromoCardGroup.tsx +1 -1
- package/src/radioGroup/RadioGroup.tsx +6 -1
- package/src/radioGroup/index.ts +1 -1
- package/src/segmentedControl/SegmentedControl.tsx +3 -3
- package/src/slidingPanel/SlidingPanel.js +1 -0
- package/src/stepper/Stepper.spec.js +16 -0
- package/src/stepper/Stepper.tsx +2 -1
- package/src/typeahead/Typeahead.story.tsx +109 -0
- package/src/typeahead/Typeahead.tsx +18 -9
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +1 -1
- package/src/uploadInput/UploadInput.tsx +6 -6
- package/src/uploadInput/uploadButton/UploadButton.tsx +5 -7
- package/src/uploadInput/uploadButton/getAllowedFileTypes.ts +1 -1
package/build/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { forwardRef, cloneElement, useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect, createContext, useContext, Component, PureComponent, createRef, Children, Fragment as Fragment$1 } from 'react';
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect, createContext, useContext, createElement, Component, PureComponent, createRef, Children, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { useId } from '@radix-ui/react-id';
|
|
6
6
|
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$2, ClockBorderless, CheckCircle, InfoCircle, Warning, CrossCircle, Clock, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
@@ -1778,8 +1778,9 @@ const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
|
1778
1778
|
}, reference) => {
|
|
1779
1779
|
/** @type {RefObject<HTMLDivElement>} */
|
|
1780
1780
|
const localReference = useRef(null);
|
|
1781
|
-
return /*#__PURE__*/
|
|
1781
|
+
return /*#__PURE__*/createElement(CSSTransition, {
|
|
1782
1782
|
...rest,
|
|
1783
|
+
key: `sliding-panel--open-${position}`,
|
|
1783
1784
|
nodeRef: localReference,
|
|
1784
1785
|
in: open
|
|
1785
1786
|
// Wait for animation to finish before unmount.
|
|
@@ -1792,13 +1793,12 @@ const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
|
1792
1793
|
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1793
1794
|
}, 'sliding-panel'),
|
|
1794
1795
|
appear: true,
|
|
1795
|
-
unmountOnExit: true
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
});
|
|
1796
|
+
unmountOnExit: true
|
|
1797
|
+
}, /*#__PURE__*/jsx("div", {
|
|
1798
|
+
ref: mergeRefs([reference, localReference]),
|
|
1799
|
+
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1800
|
+
children: children
|
|
1801
|
+
}));
|
|
1802
1802
|
});
|
|
1803
1803
|
SlidingPanel.propTypes = {
|
|
1804
1804
|
children: PropTypes.node,
|
|
@@ -3261,7 +3261,7 @@ const DateTrigger = ({
|
|
|
3261
3261
|
className: "input-group-addon",
|
|
3262
3262
|
children: /*#__PURE__*/jsx(CloseButton, {
|
|
3263
3263
|
className: `clear-btn clear-btn--${size}`,
|
|
3264
|
-
"aria-label": formatMessage(dateTriggerMessages.ariaLabel)
|
|
3264
|
+
"aria-label": `${formatMessage(dateTriggerMessages.ariaLabel)} ${label}`,
|
|
3265
3265
|
size: Size.SMALL,
|
|
3266
3266
|
onClick: event => {
|
|
3267
3267
|
event.stopPropagation();
|
|
@@ -4239,6 +4239,7 @@ class DateLookup extends PureComponent {
|
|
|
4239
4239
|
return /*#__PURE__*/jsxs("div", {
|
|
4240
4240
|
// eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
4241
4241
|
ref: this.element,
|
|
4242
|
+
id: this.props.id,
|
|
4242
4243
|
"aria-labelledby": ariaLabelledBy,
|
|
4243
4244
|
className: "input-group",
|
|
4244
4245
|
onKeyDown: this.handleKeyDown,
|
|
@@ -4263,6 +4264,7 @@ class DateLookup extends PureComponent {
|
|
|
4263
4264
|
}
|
|
4264
4265
|
}
|
|
4265
4266
|
DateLookup.propTypes = {
|
|
4267
|
+
id: PropTypes.string,
|
|
4266
4268
|
value: PropTypes.instanceOf(Date),
|
|
4267
4269
|
min: PropTypes.instanceOf(Date),
|
|
4268
4270
|
max: PropTypes.instanceOf(Date),
|
|
@@ -5434,6 +5436,7 @@ const Stepper = ({
|
|
|
5434
5436
|
});
|
|
5435
5437
|
return /*#__PURE__*/jsx("li", {
|
|
5436
5438
|
className: classNames('hidden-xs', 'tw-stepper__step', active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default', clickable && 'tw-stepper__step--clickable', step.hoverLabel && 'tw-stepper__step--has-tooltip'),
|
|
5439
|
+
"aria-current": active ? 'step' : false,
|
|
5437
5440
|
style: isRTL ? {
|
|
5438
5441
|
right: `${index * stepPercentage * 100}%`
|
|
5439
5442
|
} : {
|
|
@@ -7368,7 +7371,7 @@ const InstructionsList = ({
|
|
|
7368
7371
|
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
7369
7372
|
children: [dontsInstructions, dosInstructions]
|
|
7370
7373
|
});
|
|
7371
|
-
return /*#__PURE__*/jsx("
|
|
7374
|
+
return /*#__PURE__*/jsx("ul", {
|
|
7372
7375
|
className: "tw-instructions",
|
|
7373
7376
|
children: orderedInstructions
|
|
7374
7377
|
});
|
|
@@ -7378,7 +7381,7 @@ function Instruction({
|
|
|
7378
7381
|
type
|
|
7379
7382
|
}) {
|
|
7380
7383
|
const isInstructionNode = typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
|
|
7381
|
-
return /*#__PURE__*/jsxs("
|
|
7384
|
+
return /*#__PURE__*/jsxs("li", {
|
|
7382
7385
|
className: "instruction",
|
|
7383
7386
|
"aria-label": isInstructionNode ? item['aria-label'] : undefined,
|
|
7384
7387
|
children: [type === 'do' ? /*#__PURE__*/jsx(CheckCircleFill, {
|
|
@@ -7859,7 +7862,7 @@ function contains(property, query) {
|
|
|
7859
7862
|
return property && property.toLowerCase().includes(query.toLowerCase());
|
|
7860
7863
|
}
|
|
7861
7864
|
function sortOptionsLabelsToFirst(options, query) {
|
|
7862
|
-
return options.sort((first, second) => {
|
|
7865
|
+
return [...options].sort((first, second) => {
|
|
7863
7866
|
const firstContains = contains(first.label, query);
|
|
7864
7867
|
const secondContains = contains(second.label, query);
|
|
7865
7868
|
if (firstContains && secondContains) {
|
|
@@ -12265,7 +12268,12 @@ class Typeahead extends Component {
|
|
|
12265
12268
|
query = item.label;
|
|
12266
12269
|
}
|
|
12267
12270
|
this.updateSelectedValue(selected);
|
|
12268
|
-
|
|
12271
|
+
if (!item.keepFocusOnSelect) {
|
|
12272
|
+
this.hideMenu();
|
|
12273
|
+
}
|
|
12274
|
+
if (item.clearQueryOnSelect) {
|
|
12275
|
+
query = '';
|
|
12276
|
+
}
|
|
12269
12277
|
this.setState({
|
|
12270
12278
|
query
|
|
12271
12279
|
});
|
|
@@ -12333,7 +12341,7 @@ class Typeahead extends Component {
|
|
|
12333
12341
|
selected,
|
|
12334
12342
|
errorState
|
|
12335
12343
|
}, () => {
|
|
12336
|
-
onChange(selected);
|
|
12344
|
+
onChange([...selected]);
|
|
12337
12345
|
});
|
|
12338
12346
|
};
|
|
12339
12347
|
clear = event => {
|
|
@@ -12492,10 +12500,10 @@ class Typeahead extends Component {
|
|
|
12492
12500
|
children: /*#__PURE__*/jsx(Cross, {})
|
|
12493
12501
|
})
|
|
12494
12502
|
})]
|
|
12495
|
-
}), displayAlert
|
|
12503
|
+
}), displayAlert ? /*#__PURE__*/jsx(InlineAlert, {
|
|
12496
12504
|
type: alert.type,
|
|
12497
12505
|
children: alert.message
|
|
12498
|
-
})
|
|
12506
|
+
}) : menu]
|
|
12499
12507
|
})
|
|
12500
12508
|
});
|
|
12501
12509
|
}
|
|
@@ -13476,7 +13484,7 @@ const UploadButton = ({
|
|
|
13476
13484
|
if (fileTypes === '*') {
|
|
13477
13485
|
return fileTypes;
|
|
13478
13486
|
}
|
|
13479
|
-
return Array.isArray(fileTypes) ?
|
|
13487
|
+
return getAllowedFileTypes(Array.isArray(fileTypes) ? fileTypes : [fileTypes]).join(', ');
|
|
13480
13488
|
};
|
|
13481
13489
|
function getDescription() {
|
|
13482
13490
|
if (description) {
|
|
@@ -13492,7 +13500,7 @@ const UploadButton = ({
|
|
|
13492
13500
|
function getAcceptedTypes() {
|
|
13493
13501
|
const areAllFilesAllowed = getFileTypesDescription() === '*';
|
|
13494
13502
|
if (areAllFilesAllowed) {
|
|
13495
|
-
return
|
|
13503
|
+
return {}; //file input by default allows all files
|
|
13496
13504
|
}
|
|
13497
13505
|
if (Array.isArray(fileTypes)) {
|
|
13498
13506
|
return {
|
|
@@ -13958,7 +13966,7 @@ const UploadInput = ({
|
|
|
13958
13966
|
}, []);
|
|
13959
13967
|
useEffect(() => {
|
|
13960
13968
|
if (onFilesChange && mounted) {
|
|
13961
|
-
onFilesChange(uploadedFiles);
|
|
13969
|
+
onFilesChange([...uploadedFiles]);
|
|
13962
13970
|
}
|
|
13963
13971
|
}, [onFilesChange, uploadedFiles]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
13964
13972
|
return /*#__PURE__*/jsxs(Fragment, {
|