@transferwise/components 45.17.0 → 45.17.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/i18n/en.json +1 -0
- package/build/index.esm.js +52 -57
- package/build/index.esm.js.map +1 -1
- package/build/index.js +52 -57
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/common/Option/Option.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.messages.d.ts +9 -0
- package/build/types/button/Button.messages.d.ts.map +1 -0
- package/build/types/common/index.d.ts +1 -0
- package/build/types/common/randomId.d.ts +13 -0
- package/build/types/common/randomId.d.ts.map +1 -0
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/AccordionItem/AccordionItem.spec.js +1 -0
- package/src/accordion/AccordionItem/AccordionItem.tsx +19 -11
- package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +18 -4
- package/src/button/Button.messages.js +9 -0
- package/src/button/Button.spec.js +1 -2
- package/src/button/Button.tsx +11 -1
- package/src/button/__snapshots__/Button.spec.js.snap +22 -15
- package/src/common/Option/Option.css +1 -1
- package/src/common/Option/Option.less +0 -5
- package/src/common/index.js +1 -0
- package/src/common/randomId.ts +14 -0
- package/src/dateInput/DateInput.story.tsx +0 -3
- package/src/i18n/en.json +1 -0
- package/src/main.css +1 -1
- package/src/moneyInput/MoneyInput.story.tsx +0 -3
- package/src/phoneNumberInput/PhoneNumberInput.story.js +0 -3
- package/src/promoCard/PromoCard.tsx +1 -16
- package/src/select/Select.js +2 -0
- package/src/select/Select.story.js +0 -6
- package/src/select/searchBox/SearchBox.spec.js +3 -7
- package/src/select/searchBox/SearchBox.tsx +2 -0
- package/src/upload/Upload.spec.js +2 -0
- package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +0 -46
package/build/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var classNames = require('classnames');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var reactId = require('@radix-ui/react-id');
|
|
6
7
|
var icons = require('@transferwise/icons');
|
|
7
8
|
var PropTypes = require('prop-types');
|
|
8
9
|
var reactIntl = require('react-intl');
|
|
@@ -16,7 +17,6 @@ var mergeRefs = require('react-merge-refs');
|
|
|
16
17
|
var neptuneValidation = require('@transferwise/neptune-validation');
|
|
17
18
|
var reactPopper = require('react-popper');
|
|
18
19
|
var react$1 = require('@headlessui/react');
|
|
19
|
-
var reactId = require('@radix-ui/react-id');
|
|
20
20
|
var shim = require('use-sync-external-store/shim');
|
|
21
21
|
var react = require('@floating-ui/react');
|
|
22
22
|
var overlays = require('@react-aria/overlays');
|
|
@@ -490,6 +490,21 @@ function getDirectionFromLocale(locale) {
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
+
/**
|
|
494
|
+
* generateRandomId() function
|
|
495
|
+
*
|
|
496
|
+
* This function generates a random string of characters that can be used as
|
|
497
|
+
* an ID.
|
|
498
|
+
*
|
|
499
|
+
* @returns {string} A random string of characters.
|
|
500
|
+
* @example
|
|
501
|
+
* const id = generateRandomId();
|
|
502
|
+
* // id will be a random string of characters, such as "id-4711".
|
|
503
|
+
*/
|
|
504
|
+
const generateRandomId = () => {
|
|
505
|
+
return `id-${Math.random().toString(36).slice(7)}`;
|
|
506
|
+
};
|
|
507
|
+
|
|
493
508
|
const DEFAULT_TYPE$1 = exports.Typography.TITLE_GROUP;
|
|
494
509
|
const titleTypeMapping = {
|
|
495
510
|
[exports.Typography.TITLE_SCREEN]: 'h1',
|
|
@@ -673,8 +688,10 @@ const AccordionItem = ({
|
|
|
673
688
|
const iconElement = icon ? /*#__PURE__*/React.cloneElement(icon, {
|
|
674
689
|
size: 24
|
|
675
690
|
}) : null;
|
|
691
|
+
const fallbackId = reactId.useId();
|
|
692
|
+
const accordionId = id ?? fallbackId;
|
|
676
693
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
677
|
-
id:
|
|
694
|
+
id: accordionId,
|
|
678
695
|
className: classNames__default.default('np-accordion-item', iconElement ? 'np-accordion-item--with-icon' : null, {
|
|
679
696
|
'np-accordion-item--open': open
|
|
680
697
|
}),
|
|
@@ -688,14 +705,22 @@ const AccordionItem = ({
|
|
|
688
705
|
size: exports.Size.MEDIUM
|
|
689
706
|
}),
|
|
690
707
|
inverseMediaCircle: false,
|
|
708
|
+
"aria-expanded": open,
|
|
709
|
+
"aria-controls": `${accordionId}-section`,
|
|
710
|
+
id: `${accordionId}-control`,
|
|
691
711
|
onClick: onClick
|
|
692
|
-
}), open && /*#__PURE__*/jsxRuntime.jsx(
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
712
|
+
}), open && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
713
|
+
id: `${accordionId}-section`,
|
|
714
|
+
role: "region",
|
|
715
|
+
"aria-labelledby": `${accordionId}-control`,
|
|
716
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
717
|
+
as: "span",
|
|
718
|
+
type: exports.Typography.BODY_LARGE,
|
|
719
|
+
className: classNames__default.default('np-accordion-item__content', 'd-block', {
|
|
720
|
+
'has-icon': icon
|
|
721
|
+
}),
|
|
722
|
+
children: content
|
|
723
|
+
})
|
|
699
724
|
})]
|
|
700
725
|
});
|
|
701
726
|
};
|
|
@@ -796,7 +821,7 @@ const ActionOption = ({
|
|
|
796
821
|
});
|
|
797
822
|
};
|
|
798
823
|
|
|
799
|
-
var messages$
|
|
824
|
+
var messages$a = reactIntl.defineMessages({
|
|
800
825
|
ariaLabel: {
|
|
801
826
|
id: "neptune.CloseButton.ariaLabel"
|
|
802
827
|
}
|
|
@@ -812,7 +837,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
|
|
|
812
837
|
testId
|
|
813
838
|
}, reference) {
|
|
814
839
|
const intl = reactIntl.useIntl();
|
|
815
|
-
ariaLabel ??= intl.formatMessage(messages$
|
|
840
|
+
ariaLabel ??= intl.formatMessage(messages$a.ariaLabel);
|
|
816
841
|
const Icon = filled ? icons.CrossCircleFill : icons.Cross;
|
|
817
842
|
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
818
843
|
ref: reference,
|
|
@@ -832,7 +857,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
|
|
|
832
857
|
});
|
|
833
858
|
});
|
|
834
859
|
|
|
835
|
-
var messages$
|
|
860
|
+
var messages$9 = reactIntl.defineMessages({
|
|
836
861
|
opensInNewTab: {
|
|
837
862
|
id: "neptune.Link.opensInNewTab"
|
|
838
863
|
}
|
|
@@ -861,7 +886,7 @@ const Link = ({
|
|
|
861
886
|
onClick: onClick,
|
|
862
887
|
...props,
|
|
863
888
|
children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
|
|
864
|
-
title: formatMessage(messages$
|
|
889
|
+
title: formatMessage(messages$9.opensInNewTab)
|
|
865
890
|
})]
|
|
866
891
|
});
|
|
867
892
|
};
|
|
@@ -2101,6 +2126,12 @@ const BottomSheet$1 = props => {
|
|
|
2101
2126
|
};
|
|
2102
2127
|
var BottomSheet$2 = BottomSheet$1;
|
|
2103
2128
|
|
|
2129
|
+
var messages$8 = reactIntl.defineMessages({
|
|
2130
|
+
loadingAriaLabel: {
|
|
2131
|
+
id: "neptune.Button.loadingAriaLabel"
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
|
|
2104
2135
|
const typeClassMap$1 = {
|
|
2105
2136
|
[exports.ControlType.ACCENT]: 'btn-accent',
|
|
2106
2137
|
[exports.ControlType.POSITIVE]: 'btn-positive',
|
|
@@ -2167,6 +2198,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2167
2198
|
type = exports.ControlType.ACCENT,
|
|
2168
2199
|
...rest
|
|
2169
2200
|
}, reference) => {
|
|
2201
|
+
const intl = reactIntl.useIntl();
|
|
2170
2202
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2171
2203
|
logDeprecationNotices({
|
|
2172
2204
|
size,
|
|
@@ -2209,6 +2241,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2209
2241
|
ref: reference,
|
|
2210
2242
|
className: classes,
|
|
2211
2243
|
...props,
|
|
2244
|
+
"aria-live": loading ? 'polite' : 'off',
|
|
2245
|
+
"aria-label": loading ? intl.formatMessage(messages$8.loadingAriaLabel) : undefined,
|
|
2212
2246
|
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2213
2247
|
className: classNames__default.default('btn-loader', {
|
|
2214
2248
|
'm-l-2': !block
|
|
@@ -7493,6 +7527,8 @@ const SearchBox = /*#__PURE__*/React.forwardRef(({
|
|
|
7493
7527
|
}), /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
7494
7528
|
ref: reference,
|
|
7495
7529
|
id: id,
|
|
7530
|
+
role: "searchbox",
|
|
7531
|
+
inputMode: "search",
|
|
7496
7532
|
className: classNames__default.default(style('np-select-filter')),
|
|
7497
7533
|
placeholder: placeholder,
|
|
7498
7534
|
value: value,
|
|
@@ -7783,6 +7819,8 @@ function Select({
|
|
|
7783
7819
|
ref: optionsListReference,
|
|
7784
7820
|
id: listboxId,
|
|
7785
7821
|
role: "listbox",
|
|
7822
|
+
"aria-orientation": "vertical",
|
|
7823
|
+
"aria-activedescendant": getUniqueIdForOption(id, selected),
|
|
7786
7824
|
tabIndex: "-1",
|
|
7787
7825
|
className: dropdownClass,
|
|
7788
7826
|
...dropdownProps,
|
|
@@ -10425,50 +10463,6 @@ const PromoCardIndicator = ({
|
|
|
10425
10463
|
});
|
|
10426
10464
|
};
|
|
10427
10465
|
|
|
10428
|
-
const generateRandomId = () => {
|
|
10429
|
-
return `id-${Math.random().toString(36).slice(7)}`;
|
|
10430
|
-
};
|
|
10431
|
-
/**
|
|
10432
|
-
* PromoCard component.
|
|
10433
|
-
*
|
|
10434
|
-
* PromoCard is a marketing style component that is used to group marketing
|
|
10435
|
-
* product related information (such as choosing Card types). It can be used to
|
|
10436
|
-
* display information in a structured way, and can be customized with various
|
|
10437
|
-
* props to suit different use cases.
|
|
10438
|
-
*
|
|
10439
|
-
* @component
|
|
10440
|
-
* @param {string} className - Additional class name for the PromoCard.
|
|
10441
|
-
* @param {string} description - Description text for the PromoCard.
|
|
10442
|
-
* @param {boolean} defaultChecked - Initial checked state for checkboxes and radios.
|
|
10443
|
-
* @param {string} download - Download file name for links.
|
|
10444
|
-
* @param {string} href - URL for links.
|
|
10445
|
-
* @param {string} hrefLang - Language code for linked URL.
|
|
10446
|
-
* @param {string} id - ID of the PromoCard.
|
|
10447
|
-
* @param {string} imageAlt - Alt text for the image.
|
|
10448
|
-
* @param {string} imageSource - Source URL of the image.
|
|
10449
|
-
* @param {string} indicatorLabel - Label for the indicator icon.
|
|
10450
|
-
* @param {boolean} isChecked - Checked state for checkboxes and radios.
|
|
10451
|
-
* @param {boolean} isDisabled - Whether the PromoCard is disabled.
|
|
10452
|
-
* @param {Function} onClick - Click event handler for the PromoCard.
|
|
10453
|
-
* @param {string} rel - Relationship between the URL and the current page.
|
|
10454
|
-
* @param {number} tabIndex - Tab index for keyboard navigation.
|
|
10455
|
-
* @param {string} target - Target window for links.
|
|
10456
|
-
* @param {string} testId - ID used for testing.
|
|
10457
|
-
* @param {string} title - Title text of the PromoCard.
|
|
10458
|
-
* @param {('checkbox'|'radio')} type - Type of the PromoCard (checkbox, radio).
|
|
10459
|
-
* @param {string} value - Value for checkboxes and radios.
|
|
10460
|
-
* @returns {JSX.Element} The rendered PromoCard component.
|
|
10461
|
-
* @example
|
|
10462
|
-
* <PromoCard
|
|
10463
|
-
* title="Example PromoCard"
|
|
10464
|
-
* description="This is an example PromoCard with a link variation."
|
|
10465
|
-
* href="https://example.com"
|
|
10466
|
-
* target="_blank"
|
|
10467
|
-
* imageSource="https://example.com/image.png"
|
|
10468
|
-
* imageAlt="Example Image"
|
|
10469
|
-
* indicatorLabel="Learn More"
|
|
10470
|
-
* />
|
|
10471
|
-
*/
|
|
10472
10466
|
const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
10473
10467
|
className,
|
|
10474
10468
|
description,
|
|
@@ -10643,6 +10637,7 @@ const LanguageProvider = ({
|
|
|
10643
10637
|
};
|
|
10644
10638
|
|
|
10645
10639
|
var en = {
|
|
10640
|
+
"neptune.Button.loadingAriaLabel": "loading",
|
|
10646
10641
|
"neptune.Chips.ariaLabel": "Clear {choice}",
|
|
10647
10642
|
"neptune.ClearButton.ariaLabel": "Clear",
|
|
10648
10643
|
"neptune.CloseButton.ariaLabel": "Close",
|