@transferwise/components 0.0.0-experimental-1dc47da → 0.0.0-experimental-ced9e0d

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-1dc47da",
3
+ "version": "0.0.0-experimental-ced9e0d",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -94,9 +94,9 @@
94
94
  "react-intl": "^6.6.6",
95
95
  "rollup": "^4.17.2",
96
96
  "storybook": "^7.6.19",
97
- "@transferwise/less-config": "3.1.0",
97
+ "@transferwise/neptune-css": "14.10.0",
98
98
  "@wise/components-theming": "1.3.0",
99
- "@transferwise/neptune-css": "14.10.0"
99
+ "@transferwise/less-config": "3.1.0"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@transferwise/icons": "^3.7.0",
@@ -1,9 +1,13 @@
1
+ import { FORCE_RE_RENDER } from '@storybook/core-events';
2
+ import { addons, useGlobals } from '@storybook/manager-api';
1
3
  import { Meta, StoryObj } from '@storybook/react';
2
- import { within, userEvent } from '@storybook/test';
4
+ import { expect, within, userEvent } from '@storybook/test';
3
5
  import { Lock } from '@transferwise/icons';
4
- import React, { useState } from 'react';
6
+ import React, { useEffect, useState } from 'react';
5
7
 
6
8
  import MoneyInput, { CurrencyOptionItem } from '.';
9
+ import Provider from '../provider/Provider';
10
+ import translations from '../i18n';
7
11
 
8
12
  export default {
9
13
  component: MoneyInput,
@@ -148,6 +152,40 @@ export const BalanceCurrencies: Story = {
148
152
  },
149
153
  };
150
154
 
155
+ export const MaxLengthOverride: Story = {
156
+ args: {
157
+ ...SingleCurrency.args,
158
+ maxLengthOverride: 5,
159
+ },
160
+ play: async ({ canvasElement }) => {
161
+ await userEvent.tab();
162
+ await userEvent.keyboard('12.345');
163
+
164
+ await expect(within(canvasElement).getByRole('textbox')).toHaveValue('12.34');
165
+ },
166
+ };
167
+
168
+ export const MaxLengthOverrideWithCommaDecimalSeparator: Story = {
169
+ ...MaxLengthOverride,
170
+ decorators: [
171
+ (Story) => {
172
+ const locale = 'de';
173
+ return (
174
+ <Provider i18n={{ locale, messages: translations[locale] }}>
175
+ <Story />
176
+ </Provider>
177
+ );
178
+ },
179
+ ],
180
+ play: async ({ canvasElement }) => {
181
+ await userEvent.tab();
182
+ await userEvent.keyboard('12,345');
183
+ await userEvent.tab();
184
+
185
+ await expect(within(canvasElement).getByRole('textbox')).toHaveValue('12.34');
186
+ },
187
+ };
188
+
151
189
  export const OpenedInput: Story = {
152
190
  ...MultipleCurrencies,
153
191
  play: async ({ canvasElement }) => {