@transferwise/components 0.0.0-experimental-d087eac → 0.0.0-experimental-186b26b
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/field/Field.js +63 -32
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.messages.js +14 -0
- package/build/field/Field.messages.js.map +1 -0
- package/build/field/Field.messages.mjs +10 -0
- package/build/field/Field.messages.mjs.map +1 -0
- package/build/field/Field.mjs +65 -34
- package/build/field/Field.mjs.map +1 -1
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/inputs/TextArea.js +18 -0
- package/build/inputs/TextArea.js.map +1 -1
- package/build/inputs/TextArea.mjs +19 -1
- package/build/inputs/TextArea.mjs.map +1 -1
- package/build/inputs/contexts.js +16 -0
- package/build/inputs/contexts.js.map +1 -1
- package/build/inputs/contexts.mjs +16 -2
- package/build/inputs/contexts.mjs.map +1 -1
- package/build/main.css +19 -3
- package/build/moneyInput/MoneyInput.js +1 -2
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +1 -2
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/styles/field/Field.css +17 -3
- package/build/styles/main.css +19 -3
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/field/Field.messages.d.ts +8 -0
- package/build/types/field/Field.messages.d.ts.map +1 -0
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +6 -0
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/field/Field.css +17 -3
- package/src/field/Field.less +15 -3
- package/src/field/Field.messages.ts +8 -0
- package/src/field/Field.story.tsx +5 -1
- package/src/field/Field.test.tsx +90 -0
- package/src/field/Field.tsx +84 -37
- package/src/i18n/en.json +1 -0
- package/src/inputs/TextArea.story.tsx +56 -0
- package/src/inputs/TextArea.tsx +23 -2
- package/src/inputs/contexts.tsx +18 -1
- package/src/main.css +19 -3
- package/src/moneyInput/MoneyInput.story.tsx +0 -20
- package/src/moneyInput/MoneyInput.test.story.tsx +0 -30
- package/src/moneyInput/MoneyInput.test.tsx +0 -36
- package/src/moneyInput/MoneyInput.tsx +0 -2
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +1 -0
|
@@ -566,42 +566,6 @@ describe('Money Input', () => {
|
|
|
566
566
|
expect(screen.getByRole('listbox', { name: triggerLabel ?? '' })).toBeInTheDocument();
|
|
567
567
|
});
|
|
568
568
|
|
|
569
|
-
describe('disabled options', () => {
|
|
570
|
-
const disabledCurrency: CurrencyOptionItem = {
|
|
571
|
-
value: 'CNY',
|
|
572
|
-
label: 'CNY',
|
|
573
|
-
note: 'Chinese yuan',
|
|
574
|
-
currency: 'cny',
|
|
575
|
-
disabled: true,
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
it('renders disabled currency option with aria-disabled', async () => {
|
|
579
|
-
customRender({
|
|
580
|
-
currencies: [{ header: 'Popular currencies' }, ...popularCurrencies, disabledCurrency],
|
|
581
|
-
});
|
|
582
|
-
await openDropdown();
|
|
583
|
-
const cnyOption = screen.getByRole('option', { name: /CNY/ });
|
|
584
|
-
expect(cnyOption).toHaveAttribute('aria-disabled', 'true');
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
it('does not call onCurrencyChange when a disabled option is clicked', async () => {
|
|
588
|
-
customRender({
|
|
589
|
-
currencies: [{ header: 'Popular currencies' }, ...popularCurrencies, disabledCurrency],
|
|
590
|
-
});
|
|
591
|
-
await openDropdown();
|
|
592
|
-
const cnyOption = screen.getByRole('option', { name: /CNY/ });
|
|
593
|
-
await userEvent.click(cnyOption);
|
|
594
|
-
expect(initialProps.onCurrencyChange).not.toHaveBeenCalled();
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
it('does not mark options without disabled property as disabled', async () => {
|
|
598
|
-
customRender();
|
|
599
|
-
await openDropdown();
|
|
600
|
-
const eurOption = screen.getByRole('option', { name: /EUR/ });
|
|
601
|
-
expect(eurOption).not.toHaveAttribute('aria-disabled', 'true');
|
|
602
|
-
});
|
|
603
|
-
});
|
|
604
|
-
|
|
605
569
|
it('renders custom action button in dropdown footer and calls onCustomAction', async () => {
|
|
606
570
|
const onCustomAction = jest.fn();
|
|
607
571
|
render(
|
|
@@ -34,7 +34,6 @@ export interface CurrencyOptionItem {
|
|
|
34
34
|
currency: string;
|
|
35
35
|
note?: string;
|
|
36
36
|
searchable?: string;
|
|
37
|
-
disabled?: boolean;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
export interface CurrencyHeaderItem {
|
|
@@ -257,7 +256,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
257
256
|
type: 'option',
|
|
258
257
|
value: item,
|
|
259
258
|
filterMatchers: [item.value, item.label, item.note ?? '', item.searchable ?? ''],
|
|
260
|
-
disabled: item.disabled,
|
|
261
259
|
});
|
|
262
260
|
}
|
|
263
261
|
});
|