@transferwise/components 0.0.0-experimental-7f34f59 → 0.0.0-experimental-0f96ac0

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.
@@ -18,7 +18,7 @@
18
18
  "neptune.DateLookup.year": "yıl",
19
19
  "neptune.FlowNavigation.back": "önceki adıma dön",
20
20
  "neptune.Info.ariaLabel": "Daha fazla bilgi",
21
- "neptune.Label.optional": "(İsteğe bağlı)",
21
+ "neptune.Label.optional": "(Isteğe bağlı)",
22
22
  "neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
23
23
  "neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
24
24
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Bir seçenek seçin...",
@@ -20,7 +20,7 @@ var tr = {
20
20
  "neptune.DateLookup.year": "yıl",
21
21
  "neptune.FlowNavigation.back": "önceki adıma dön",
22
22
  "neptune.Info.ariaLabel": "Daha fazla bilgi",
23
- "neptune.Label.optional": "(İsteğe bağlı)",
23
+ "neptune.Label.optional": "(Isteğe bağlı)",
24
24
  "neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
25
25
  "neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
26
26
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Bir seçenek seçin...",
@@ -18,7 +18,7 @@ var tr = {
18
18
  "neptune.DateLookup.year": "yıl",
19
19
  "neptune.FlowNavigation.back": "önceki adıma dön",
20
20
  "neptune.Info.ariaLabel": "Daha fazla bilgi",
21
- "neptune.Label.optional": "(İsteğe bağlı)",
21
+ "neptune.Label.optional": "(Isteğe bağlı)",
22
22
  "neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
23
23
  "neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
24
24
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Bir seçenek seçin...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-7f34f59",
3
+ "version": "0.0.0-experimental-0f96ac0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -92,9 +92,9 @@
92
92
  "rollup": "^4.18.1",
93
93
  "rollup-preserve-directives": "^1.1.1",
94
94
  "storybook": "^8.2.2",
95
+ "@transferwise/less-config": "3.1.0",
95
96
  "@transferwise/neptune-css": "14.13.3",
96
- "@wise/components-theming": "1.6.0",
97
- "@transferwise/less-config": "3.1.0"
97
+ "@wise/components-theming": "1.6.0"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@transferwise/icons": "^3.7.0",
package/src/i18n/tr.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "neptune.DateLookup.year": "yıl",
19
19
  "neptune.FlowNavigation.back": "önceki adıma dön",
20
20
  "neptune.Info.ariaLabel": "Daha fazla bilgi",
21
- "neptune.Label.optional": "(İsteğe bağlı)",
21
+ "neptune.Label.optional": "(Isteğe bağlı)",
22
22
  "neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
23
23
  "neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
24
24
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Bir seçenek seçin...",
@@ -1,81 +1,82 @@
1
- import { action } from '@storybook/addon-actions';
2
- import { boolean } from '@storybook/addon-knobs';
3
1
  import { Flag } from '@wise/art';
4
2
 
5
3
  import Avatar, { AvatarType } from '../avatar';
6
4
 
7
- import RadioGroup from './RadioGroup';
5
+ import RadioGroup, { RadioGroupProps, RadioGroupRadio } from './RadioGroup';
8
6
  import { Field } from '../field/Field';
7
+ import { Meta, StoryObj } from '@storybook/react';
8
+ import { fn } from '@storybook/test';
9
+ import { useState } from 'react';
9
10
 
10
- export default {
11
+ const meta = {
11
12
  component: RadioGroup,
12
13
  title: 'Forms/RadioGroup',
13
- };
14
+ } satisfies Meta<typeof RadioGroup>;
14
15
 
15
- export const Basic = () => {
16
- const showAvatars = boolean('avatar', false);
17
- const hasError = boolean('hasError', false);
16
+ export default meta;
17
+ type Story<T extends string | number = string> = StoryObj<RadioGroupProps<T>>;
18
18
 
19
- const avatar = showAvatars ? (
20
- <Avatar type={AvatarType.THUMBNAIL}>
21
- <Flag code="NZD" />
22
- </Avatar>
23
- ) : undefined;
19
+ export const Basic = {
20
+ args: {
21
+ selectedValue: 'radio-2',
22
+ name: 'radio-group',
23
+ radios: [
24
+ {
25
+ value: 'radio-1',
26
+ label: 'Radio1',
27
+ secondary: 'Secondary line 1',
28
+ disabled: false,
29
+ },
30
+ {
31
+ value: 'radio-2',
32
+ label: 'Radio2',
33
+ disabled: false,
34
+ },
35
+ {
36
+ value: 'radio-3',
37
+ label: 'Radio3',
38
+ secondary: 'Secondary line 3',
39
+ disabled: true,
40
+ },
41
+ ],
42
+ onChange: fn(),
43
+ },
44
+ } satisfies Story;
24
45
 
25
- return (
26
- <div className={`form-group ${hasError ? 'has-error' : ''}`}>
27
- <RadioGroup
28
- selectedValue="radio-2"
29
- name="radio-group"
30
- radios={[
31
- {
32
- value: 'radio-1',
33
- label: 'Radio1',
34
- secondary: 'Secondary line 1',
35
- disabled: false,
36
- avatar,
37
- },
38
- {
39
- value: 'radio-2',
40
- label: 'Radio2',
41
- disabled: false,
42
- avatar,
43
- },
44
- {
45
- value: 'radio-3',
46
- label: 'Radio3',
47
- secondary: 'Secondary line 3',
48
- disabled: true,
49
- avatar,
50
- },
51
- ]}
52
- onChange={(v) => action(v)}
53
- />
54
- </div>
55
- );
56
- };
46
+ export const WithAvatars = {
47
+ ...Basic,
48
+ args: {
49
+ ...Basic.args,
50
+ radios: Basic.args.radios.map(
51
+ (radio) =>
52
+ ({
53
+ ...radio,
54
+ avatar: (
55
+ <Avatar type={AvatarType.THUMBNAIL}>
56
+ <Flag code="NZD" />
57
+ </Avatar>
58
+ ),
59
+ }) satisfies RadioGroupRadio,
60
+ ),
61
+ },
62
+ } satisfies Story;
57
63
 
58
- export const Labeled = () => {
59
- return (
60
- <Field label="Do you like our product?">
61
- <RadioGroup
62
- name="radio-group"
63
- radios={[
64
- {
65
- value: 'yes',
66
- label: 'Yes',
67
- },
68
- {
69
- value: 'definitely',
70
- label: 'Definitely',
71
- },
72
- {
73
- value: 'absolutely',
74
- label: 'Absolutely',
75
- },
76
- ]}
77
- onChange={(v) => action(v)}
78
- />
79
- </Field>
80
- );
81
- };
64
+ export const WithinField = {
65
+ ...Basic,
66
+ render: function Render(args) {
67
+ const [selectedValue, setSelectedValue] = useState('radio-2');
68
+ const hasError = selectedValue === 'radio-2';
69
+ return (
70
+ <Field
71
+ {...(hasError
72
+ ? {
73
+ message: 'Something went wrong',
74
+ sentiment: 'negative',
75
+ }
76
+ : undefined)}
77
+ >
78
+ <RadioGroup {...args} selectedValue={selectedValue} onChange={setSelectedValue} />
79
+ </Field>
80
+ );
81
+ },
82
+ } satisfies Story;