@transferwise/components 46.58.0 → 46.58.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.
@@ -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": "(Isteğe bağlı)",
21
+ "neptune.Label.optional": "(İsteğ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": "(Isteğe bağlı)",
23
+ "neptune.Label.optional": "(İsteğ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": "(Isteğe bağlı)",
21
+ "neptune.Label.optional": "(İsteğ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...",
@@ -30,7 +30,9 @@ function InlineAlert({
30
30
  children: [iconTypes.has(type) && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
31
31
  sentiment: type,
32
32
  size: size.Size.SMALL
33
- }), children]
33
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
34
+ children: children
35
+ })]
34
36
  });
35
37
  }
36
38
 
@@ -1 +1 @@
1
- {"version":3,"file":"InlineAlert.js","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\nimport Body from '../body';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\n/**\n * Avoid using `<InlineAlert>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field sentiment={..} message={..}>..</Field>\n * ```\n */\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <Body\n role=\"alert\"\n id={id}\n className={clsx(\n 'alert alert-detach',\n `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`,\n 'd-flex',\n className,\n )}\n >\n {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}\n {children}\n </Body>\n );\n}\n"],"names":["iconTypes","Set","Sentiment","NEGATIVE","ERROR","POSITIVE","SUCCESS","WARNING","InlineAlert","id","type","className","children","_jsxs","Body","role","clsx","has","_jsx","StatusIcon","sentiment","size","Size","SMALL"],"mappings":";;;;;;;;;AAcA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAwC,CAC/DC,mBAAS,CAACC,QAAQ,EAClBD,mBAAS,CAACE,KAAK,EACfF,mBAAS,CAACG,QAAQ,EAClBH,mBAAS,CAACI,OAAO,EACjBJ,mBAAS,CAACK,OAAO,CAClB,CAAC,CAAA;AAEF;;;;;;;;AAQG;AACqB,SAAAC,WAAWA,CAAC;EAClCC,EAAE;AACFC,EAAAA,IAAI,GAAG,SAAS;EAChBC,SAAS;AACTC,EAAAA,QAAAA;AACiB,CAAA,EAAA;EACjB,oBACEC,eAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAC,OAAO;AACZN,IAAAA,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEK,SAAI,CACb,oBAAoB,EACpB,CAASN,MAAAA,EAAAA,IAAI,KAAKR,mBAAS,CAACC,QAAQ,IAAIO,IAAI,KAAKR,mBAAS,CAACE,KAAK,GAAG,QAAQ,GAAGM,IAAI,CAAA,CAAE,EACpF,QAAQ,EACRC,SAAS,CACT;IAAAC,QAAA,EAAA,CAEDZ,SAAS,CAACiB,GAAG,CAACP,IAAI,CAAC,iBAAIQ,cAAA,CAACC,UAAU,EAAA;AAACC,MAAAA,SAAS,EAAEV,IAAK;MAACW,IAAI,EAAEC,SAAI,CAACC,KAAAA;KAAM,CAAG,EACxEX,QAAQ,CAAA;AAAA,GACL,CAAC,CAAA;AAEX;;;;"}
1
+ {"version":3,"file":"InlineAlert.js","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\nimport Body from '../body';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\n/**\n * Avoid using `<InlineAlert>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field sentiment={..} message={..}>..</Field>\n * ```\n */\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <Body\n role=\"alert\"\n id={id}\n className={clsx(\n 'alert alert-detach',\n `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`,\n 'd-flex',\n className,\n )}\n >\n {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}\n <div>{children}</div>\n </Body>\n );\n}\n"],"names":["iconTypes","Set","Sentiment","NEGATIVE","ERROR","POSITIVE","SUCCESS","WARNING","InlineAlert","id","type","className","children","_jsxs","Body","role","clsx","has","_jsx","StatusIcon","sentiment","size","Size","SMALL"],"mappings":";;;;;;;;;AAcA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAwC,CAC/DC,mBAAS,CAACC,QAAQ,EAClBD,mBAAS,CAACE,KAAK,EACfF,mBAAS,CAACG,QAAQ,EAClBH,mBAAS,CAACI,OAAO,EACjBJ,mBAAS,CAACK,OAAO,CAClB,CAAC,CAAA;AAEF;;;;;;;;AAQG;AACqB,SAAAC,WAAWA,CAAC;EAClCC,EAAE;AACFC,EAAAA,IAAI,GAAG,SAAS;EAChBC,SAAS;AACTC,EAAAA,QAAAA;AACiB,CAAA,EAAA;EACjB,oBACEC,eAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAC,OAAO;AACZN,IAAAA,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEK,SAAI,CACb,oBAAoB,EACpB,CAASN,MAAAA,EAAAA,IAAI,KAAKR,mBAAS,CAACC,QAAQ,IAAIO,IAAI,KAAKR,mBAAS,CAACE,KAAK,GAAG,QAAQ,GAAGM,IAAI,CAAA,CAAE,EACpF,QAAQ,EACRC,SAAS,CACT;IAAAC,QAAA,EAAA,CAEDZ,SAAS,CAACiB,GAAG,CAACP,IAAI,CAAC,iBAAIQ,cAAA,CAACC,UAAU,EAAA;AAACC,MAAAA,SAAS,EAAEV,IAAK;MAACW,IAAI,EAAEC,SAAI,CAACC,KAAAA;KAAM,CAAG,eACzEL,cAAA,CAAA,KAAA,EAAA;AAAAN,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CACtB,CAAA;AAAA,GAAM,CAAC,CAAA;AAEX;;;;"}
@@ -28,7 +28,9 @@ function InlineAlert({
28
28
  children: [iconTypes.has(type) && /*#__PURE__*/jsx(StatusIcon, {
29
29
  sentiment: type,
30
30
  size: Size.SMALL
31
- }), children]
31
+ }), /*#__PURE__*/jsx("div", {
32
+ children: children
33
+ })]
32
34
  });
33
35
  }
34
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"InlineAlert.mjs","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\nimport Body from '../body';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\n/**\n * Avoid using `<InlineAlert>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field sentiment={..} message={..}>..</Field>\n * ```\n */\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <Body\n role=\"alert\"\n id={id}\n className={clsx(\n 'alert alert-detach',\n `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`,\n 'd-flex',\n className,\n )}\n >\n {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}\n {children}\n </Body>\n );\n}\n"],"names":["iconTypes","Set","Sentiment","NEGATIVE","ERROR","POSITIVE","SUCCESS","WARNING","InlineAlert","id","type","className","children","_jsxs","Body","role","clsx","has","_jsx","StatusIcon","sentiment","size","Size","SMALL"],"mappings":";;;;;;;AAcA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAwC,CAC/DC,SAAS,CAACC,QAAQ,EAClBD,SAAS,CAACE,KAAK,EACfF,SAAS,CAACG,QAAQ,EAClBH,SAAS,CAACI,OAAO,EACjBJ,SAAS,CAACK,OAAO,CAClB,CAAC,CAAA;AAEF;;;;;;;;AAQG;AACqB,SAAAC,WAAWA,CAAC;EAClCC,EAAE;AACFC,EAAAA,IAAI,GAAG,SAAS;EAChBC,SAAS;AACTC,EAAAA,QAAAA;AACiB,CAAA,EAAA;EACjB,oBACEC,IAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAC,OAAO;AACZN,IAAAA,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEK,IAAI,CACb,oBAAoB,EACpB,CAASN,MAAAA,EAAAA,IAAI,KAAKR,SAAS,CAACC,QAAQ,IAAIO,IAAI,KAAKR,SAAS,CAACE,KAAK,GAAG,QAAQ,GAAGM,IAAI,CAAA,CAAE,EACpF,QAAQ,EACRC,SAAS,CACT;IAAAC,QAAA,EAAA,CAEDZ,SAAS,CAACiB,GAAG,CAACP,IAAI,CAAC,iBAAIQ,GAAA,CAACC,UAAU,EAAA;AAACC,MAAAA,SAAS,EAAEV,IAAK;MAACW,IAAI,EAAEC,IAAI,CAACC,KAAAA;KAAM,CAAG,EACxEX,QAAQ,CAAA;AAAA,GACL,CAAC,CAAA;AAEX;;;;"}
1
+ {"version":3,"file":"InlineAlert.mjs","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\nimport Body from '../body';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\n/**\n * Avoid using `<InlineAlert>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field sentiment={..} message={..}>..</Field>\n * ```\n */\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <Body\n role=\"alert\"\n id={id}\n className={clsx(\n 'alert alert-detach',\n `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`,\n 'd-flex',\n className,\n )}\n >\n {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}\n <div>{children}</div>\n </Body>\n );\n}\n"],"names":["iconTypes","Set","Sentiment","NEGATIVE","ERROR","POSITIVE","SUCCESS","WARNING","InlineAlert","id","type","className","children","_jsxs","Body","role","clsx","has","_jsx","StatusIcon","sentiment","size","Size","SMALL"],"mappings":";;;;;;;AAcA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAwC,CAC/DC,SAAS,CAACC,QAAQ,EAClBD,SAAS,CAACE,KAAK,EACfF,SAAS,CAACG,QAAQ,EAClBH,SAAS,CAACI,OAAO,EACjBJ,SAAS,CAACK,OAAO,CAClB,CAAC,CAAA;AAEF;;;;;;;;AAQG;AACqB,SAAAC,WAAWA,CAAC;EAClCC,EAAE;AACFC,EAAAA,IAAI,GAAG,SAAS;EAChBC,SAAS;AACTC,EAAAA,QAAAA;AACiB,CAAA,EAAA;EACjB,oBACEC,IAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAC,OAAO;AACZN,IAAAA,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEK,IAAI,CACb,oBAAoB,EACpB,CAASN,MAAAA,EAAAA,IAAI,KAAKR,SAAS,CAACC,QAAQ,IAAIO,IAAI,KAAKR,SAAS,CAACE,KAAK,GAAG,QAAQ,GAAGM,IAAI,CAAA,CAAE,EACpF,QAAQ,EACRC,SAAS,CACT;IAAAC,QAAA,EAAA,CAEDZ,SAAS,CAACiB,GAAG,CAACP,IAAI,CAAC,iBAAIQ,GAAA,CAACC,UAAU,EAAA;AAACC,MAAAA,SAAS,EAAEV,IAAK;MAACW,IAAI,EAAEC,IAAI,CAACC,KAAAA;KAAM,CAAG,eACzEL,GAAA,CAAA,KAAA,EAAA;AAAAN,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CACtB,CAAA;AAAA,GAAM,CAAC,CAAA;AAEX;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.58.0",
3
+ "version": "46.58.1",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -93,8 +93,8 @@
93
93
  "rollup-preserve-directives": "^1.1.1",
94
94
  "storybook": "^8.2.2",
95
95
  "@transferwise/less-config": "3.1.0",
96
- "@wise/components-theming": "1.6.0",
97
- "@transferwise/neptune-css": "14.13.3"
96
+ "@transferwise/neptune-css": "14.13.4",
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": "(Isteğe bağlı)",
21
+ "neptune.Label.optional": "(İsteğ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...",
@@ -47,7 +47,7 @@ export default function InlineAlert({
47
47
  )}
48
48
  >
49
49
  {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}
50
- {children}
50
+ <div>{children}</div>
51
51
  </Body>
52
52
  );
53
53
  }
@@ -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;