@transferwise/components 46.58.0 → 46.59.0
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/tr.json +1 -1
- package/build/i18n/tr.json.js +1 -1
- package/build/i18n/tr.json.mjs +1 -1
- package/build/inlineAlert/InlineAlert.js +3 -1
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +3 -1
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/radioGroup/RadioGroup.js +3 -1
- package/build/radioGroup/RadioGroup.js.map +1 -1
- package/build/radioGroup/RadioGroup.mjs +3 -1
- package/build/radioGroup/RadioGroup.mjs.map +1 -1
- package/build/types/radioGroup/RadioGroup.d.ts +3 -1
- package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/i18n/tr.json +1 -1
- package/src/inlineAlert/InlineAlert.tsx +1 -1
- package/src/inputs/InputGroup.story.tsx +8 -0
- package/src/inputs/SearchInput.story.tsx +8 -0
- package/src/radioGroup/RadioGroup.story.tsx +70 -69
- package/src/radioGroup/RadioGroup.tsx +4 -2
package/build/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": "(
|
|
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...",
|
package/build/i18n/tr.json.js
CHANGED
|
@@ -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": "(
|
|
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...",
|
package/build/i18n/tr.json.mjs
CHANGED
|
@@ -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": "(
|
|
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...",
|
|
@@ -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}
|
|
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;;;;"}
|
|
@@ -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}
|
|
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;;;;"}
|
|
@@ -9,7 +9,8 @@ function RadioGroup({
|
|
|
9
9
|
name,
|
|
10
10
|
radios,
|
|
11
11
|
selectedValue: controlledValue,
|
|
12
|
-
onChange
|
|
12
|
+
onChange,
|
|
13
|
+
UNSAFE_inputAttributes
|
|
13
14
|
}) {
|
|
14
15
|
const inputAttributes = contexts.useInputAttributes({
|
|
15
16
|
nonLabelable: true
|
|
@@ -18,6 +19,7 @@ function RadioGroup({
|
|
|
18
19
|
return radios.length > 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
19
20
|
role: "radiogroup",
|
|
20
21
|
...inputAttributes,
|
|
22
|
+
...UNSAFE_inputAttributes,
|
|
21
23
|
children: radios.map(({
|
|
22
24
|
value = '',
|
|
23
25
|
...restProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../src/radioGroup/RadioGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport Radio from '../radio';\nimport { RadioProps } from '../radio/Radio';\nimport { useInputAttributes } from '../inputs/contexts';\n\nexport type RadioGroupRadio<T extends string | number = string> = Omit<\n RadioProps<T>,\n 'name' | 'checked' | 'onChange' | 'className'\n>;\n\nexport interface RadioGroupProps<T extends string | number = string> {\n name: string;\n radios: readonly RadioGroupRadio<T>[];\n selectedValue?: T; // TODO: `NoInfer<T>` from TypeScript 5.4\n onChange: NonNullable<RadioProps<T>['onChange']>;\n}\n\nexport default function RadioGroup<T extends string | number = never>({\n name,\n radios,\n selectedValue: controlledValue,\n onChange,\n}: RadioGroupProps<T>) {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n\n const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);\n\n return radios.length > 0 ? (\n <div role=\"radiogroup\" {...inputAttributes}>\n {radios.map(({ value = '' as T, ...restProps }, index) => (\n <Radio\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n {...restProps}\n name={name}\n value={value}\n checked={value === uncontrolledValue}\n onChange={(nextValue) => {\n setUncontrolledValue(nextValue);\n onChange(nextValue);\n }}\n />\n ))}\n </div>\n ) : null;\n}\n"],"names":["RadioGroup","name","radios","selectedValue","controlledValue","onChange","inputAttributes","useInputAttributes","nonLabelable","uncontrolledValue","setUncontrolledValue","useState","length","_jsx","role","children","map","value","restProps","index","Radio","checked","nextValue"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../src/radioGroup/RadioGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport Radio from '../radio';\nimport { RadioProps } from '../radio/Radio';\nimport { useInputAttributes, WithInputAttributesProps } from '../inputs/contexts';\n\nexport type RadioGroupRadio<T extends string | number = string> = Omit<\n RadioProps<T>,\n 'name' | 'checked' | 'onChange' | 'className'\n>;\n\nexport interface RadioGroupProps<T extends string | number = string> {\n name: string;\n radios: readonly RadioGroupRadio<T>[];\n selectedValue?: T; // TODO: `NoInfer<T>` from TypeScript 5.4\n onChange: NonNullable<RadioProps<T>['onChange']>;\n UNSAFE_inputAttributes?: WithInputAttributesProps['inputAttributes'];\n}\n\nexport default function RadioGroup<T extends string | number = never>({\n name,\n radios,\n selectedValue: controlledValue,\n onChange,\n UNSAFE_inputAttributes,\n}: RadioGroupProps<T>) {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n\n const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);\n\n return radios.length > 0 ? (\n <div role=\"radiogroup\" {...inputAttributes} {...UNSAFE_inputAttributes}>\n {radios.map(({ value = '' as T, ...restProps }, index) => (\n <Radio\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n {...restProps}\n name={name}\n value={value}\n checked={value === uncontrolledValue}\n onChange={(nextValue) => {\n setUncontrolledValue(nextValue);\n onChange(nextValue);\n }}\n />\n ))}\n </div>\n ) : null;\n}\n"],"names":["RadioGroup","name","radios","selectedValue","controlledValue","onChange","UNSAFE_inputAttributes","inputAttributes","useInputAttributes","nonLabelable","uncontrolledValue","setUncontrolledValue","useState","length","_jsx","role","children","map","value","restProps","index","Radio","checked","nextValue"],"mappings":";;;;;;;AAmBc,SAAUA,UAAUA,CAAoC;EACpEC,IAAI;EACJC,MAAM;AACNC,EAAAA,aAAa,EAAEC,eAAe;EAC9BC,QAAQ;AACRC,EAAAA,sBAAAA;AACmB,CAAA,EAAA;EACnB,MAAMC,eAAe,GAAGC,2BAAkB,CAAC;AAAEC,IAAAA,YAAY,EAAE,IAAA;AAAM,GAAA,CAAC,CAAA;EAElE,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,cAAQ,CAACR,eAAe,CAAC,CAAA;AAE3E,EAAA,OAAOF,MAAM,CAACW,MAAM,GAAG,CAAC,gBACtBC,cAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,IAAI,EAAC,YAAY;AAAA,IAAA,GAAKR,eAAe;AAAA,IAAA,GAAMD,sBAAsB;AAAAU,IAAAA,QAAA,EACnEd,MAAM,CAACe,GAAG,CAAC,CAAC;AAAEC,MAAAA,KAAK,GAAG,EAAO;MAAE,GAAGC,SAAAA;AAAS,KAAE,EAAEC,KAAK,kBACnDN,cAAA,CAACO,KAAAA;AACC;AAAA,MAAA;AAAA,MAAA,GAEIF,SAAS;AACblB,MAAAA,IAAI,EAAEA,IAAK;AACXiB,MAAAA,KAAK,EAAEA,KAAM;MACbI,OAAO,EAAEJ,KAAK,KAAKR,iBAAkB;MACrCL,QAAQ,EAAGkB,SAAS,IAAI;QACtBZ,oBAAoB,CAACY,SAAS,CAAC,CAAA;QAC/BlB,QAAQ,CAACkB,SAAS,CAAC,CAAA;AACrB,OAAA;AAAE,KAAA,EARGH,KAQH,CAEL,CAAA;GACE,CAAC,GACJ,IAAI,CAAA;AACV;;;;"}
|
|
@@ -7,7 +7,8 @@ function RadioGroup({
|
|
|
7
7
|
name,
|
|
8
8
|
radios,
|
|
9
9
|
selectedValue: controlledValue,
|
|
10
|
-
onChange
|
|
10
|
+
onChange,
|
|
11
|
+
UNSAFE_inputAttributes
|
|
11
12
|
}) {
|
|
12
13
|
const inputAttributes = useInputAttributes({
|
|
13
14
|
nonLabelable: true
|
|
@@ -16,6 +17,7 @@ function RadioGroup({
|
|
|
16
17
|
return radios.length > 0 ? /*#__PURE__*/jsx("div", {
|
|
17
18
|
role: "radiogroup",
|
|
18
19
|
...inputAttributes,
|
|
20
|
+
...UNSAFE_inputAttributes,
|
|
19
21
|
children: radios.map(({
|
|
20
22
|
value = '',
|
|
21
23
|
...restProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.mjs","sources":["../../src/radioGroup/RadioGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport Radio from '../radio';\nimport { RadioProps } from '../radio/Radio';\nimport { useInputAttributes } from '../inputs/contexts';\n\nexport type RadioGroupRadio<T extends string | number = string> = Omit<\n RadioProps<T>,\n 'name' | 'checked' | 'onChange' | 'className'\n>;\n\nexport interface RadioGroupProps<T extends string | number = string> {\n name: string;\n radios: readonly RadioGroupRadio<T>[];\n selectedValue?: T; // TODO: `NoInfer<T>` from TypeScript 5.4\n onChange: NonNullable<RadioProps<T>['onChange']>;\n}\n\nexport default function RadioGroup<T extends string | number = never>({\n name,\n radios,\n selectedValue: controlledValue,\n onChange,\n}: RadioGroupProps<T>) {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n\n const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);\n\n return radios.length > 0 ? (\n <div role=\"radiogroup\" {...inputAttributes}>\n {radios.map(({ value = '' as T, ...restProps }, index) => (\n <Radio\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n {...restProps}\n name={name}\n value={value}\n checked={value === uncontrolledValue}\n onChange={(nextValue) => {\n setUncontrolledValue(nextValue);\n onChange(nextValue);\n }}\n />\n ))}\n </div>\n ) : null;\n}\n"],"names":["RadioGroup","name","radios","selectedValue","controlledValue","onChange","inputAttributes","useInputAttributes","nonLabelable","uncontrolledValue","setUncontrolledValue","useState","length","_jsx","role","children","map","value","restProps","index","Radio","checked","nextValue"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"RadioGroup.mjs","sources":["../../src/radioGroup/RadioGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport Radio from '../radio';\nimport { RadioProps } from '../radio/Radio';\nimport { useInputAttributes, WithInputAttributesProps } from '../inputs/contexts';\n\nexport type RadioGroupRadio<T extends string | number = string> = Omit<\n RadioProps<T>,\n 'name' | 'checked' | 'onChange' | 'className'\n>;\n\nexport interface RadioGroupProps<T extends string | number = string> {\n name: string;\n radios: readonly RadioGroupRadio<T>[];\n selectedValue?: T; // TODO: `NoInfer<T>` from TypeScript 5.4\n onChange: NonNullable<RadioProps<T>['onChange']>;\n UNSAFE_inputAttributes?: WithInputAttributesProps['inputAttributes'];\n}\n\nexport default function RadioGroup<T extends string | number = never>({\n name,\n radios,\n selectedValue: controlledValue,\n onChange,\n UNSAFE_inputAttributes,\n}: RadioGroupProps<T>) {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n\n const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);\n\n return radios.length > 0 ? (\n <div role=\"radiogroup\" {...inputAttributes} {...UNSAFE_inputAttributes}>\n {radios.map(({ value = '' as T, ...restProps }, index) => (\n <Radio\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n {...restProps}\n name={name}\n value={value}\n checked={value === uncontrolledValue}\n onChange={(nextValue) => {\n setUncontrolledValue(nextValue);\n onChange(nextValue);\n }}\n />\n ))}\n </div>\n ) : null;\n}\n"],"names":["RadioGroup","name","radios","selectedValue","controlledValue","onChange","UNSAFE_inputAttributes","inputAttributes","useInputAttributes","nonLabelable","uncontrolledValue","setUncontrolledValue","useState","length","_jsx","role","children","map","value","restProps","index","Radio","checked","nextValue"],"mappings":";;;;;AAmBc,SAAUA,UAAUA,CAAoC;EACpEC,IAAI;EACJC,MAAM;AACNC,EAAAA,aAAa,EAAEC,eAAe;EAC9BC,QAAQ;AACRC,EAAAA,sBAAAA;AACmB,CAAA,EAAA;EACnB,MAAMC,eAAe,GAAGC,kBAAkB,CAAC;AAAEC,IAAAA,YAAY,EAAE,IAAA;AAAM,GAAA,CAAC,CAAA;EAElE,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,QAAQ,CAACR,eAAe,CAAC,CAAA;AAE3E,EAAA,OAAOF,MAAM,CAACW,MAAM,GAAG,CAAC,gBACtBC,GAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,IAAI,EAAC,YAAY;AAAA,IAAA,GAAKR,eAAe;AAAA,IAAA,GAAMD,sBAAsB;AAAAU,IAAAA,QAAA,EACnEd,MAAM,CAACe,GAAG,CAAC,CAAC;AAAEC,MAAAA,KAAK,GAAG,EAAO;MAAE,GAAGC,SAAAA;AAAS,KAAE,EAAEC,KAAK,kBACnDN,GAAA,CAACO,KAAAA;AACC;AAAA,MAAA;AAAA,MAAA,GAEIF,SAAS;AACblB,MAAAA,IAAI,EAAEA,IAAK;AACXiB,MAAAA,KAAK,EAAEA,KAAM;MACbI,OAAO,EAAEJ,KAAK,KAAKR,iBAAkB;MACrCL,QAAQ,EAAGkB,SAAS,IAAI;QACtBZ,oBAAoB,CAACY,SAAS,CAAC,CAAA;QAC/BlB,QAAQ,CAACkB,SAAS,CAAC,CAAA;AACrB,OAAA;AAAE,KAAA,EARGH,KAQH,CAEL,CAAA;GACE,CAAC,GACJ,IAAI,CAAA;AACV;;;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { RadioProps } from '../radio/Radio';
|
|
2
|
+
import { WithInputAttributesProps } from '../inputs/contexts';
|
|
2
3
|
export type RadioGroupRadio<T extends string | number = string> = Omit<RadioProps<T>, 'name' | 'checked' | 'onChange' | 'className'>;
|
|
3
4
|
export interface RadioGroupProps<T extends string | number = string> {
|
|
4
5
|
name: string;
|
|
5
6
|
radios: readonly RadioGroupRadio<T>[];
|
|
6
7
|
selectedValue?: T;
|
|
7
8
|
onChange: NonNullable<RadioProps<T>['onChange']>;
|
|
9
|
+
UNSAFE_inputAttributes?: WithInputAttributesProps['inputAttributes'];
|
|
8
10
|
}
|
|
9
|
-
export default function RadioGroup<T extends string | number = never>({ name, radios, selectedValue: controlledValue, onChange, }: RadioGroupProps<T>): import("react").JSX.Element | null;
|
|
11
|
+
export default function RadioGroup<T extends string | number = never>({ name, radios, selectedValue: controlledValue, onChange, UNSAFE_inputAttributes, }: RadioGroupProps<T>): import("react").JSX.Element | null;
|
|
10
12
|
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/radioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/radioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAsB,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAElF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,IAAI,CACpE,UAAU,CAAC,CAAC,CAAC,EACb,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAC9C,CAAC;AAEF,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,aAAa,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,sBAAsB,CAAC,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;CACtE;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,EACpE,IAAI,EACJ,MAAM,EACN,aAAa,EAAE,eAAe,EAC9B,QAAQ,EACR,sBAAsB,GACvB,EAAE,eAAe,CAAC,CAAC,CAAC,sCAuBpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.59.0",
|
|
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/neptune-css": "14.13.4",
|
|
95
96
|
"@transferwise/less-config": "3.1.0",
|
|
96
|
-
"@wise/components-theming": "1.6.0"
|
|
97
|
-
"@transferwise/neptune-css": "14.13.3"
|
|
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": "(
|
|
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...",
|
|
@@ -3,6 +3,7 @@ import { Search } from '@transferwise/icons';
|
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import ActionButton from '../actionButton';
|
|
6
|
+
import { Field } from '../field/Field';
|
|
6
7
|
|
|
7
8
|
import { Input } from './Input';
|
|
8
9
|
import { InputGroup } from './InputGroup';
|
|
@@ -40,6 +41,13 @@ export const WithSuffix: Story = {
|
|
|
40
41
|
args: {
|
|
41
42
|
disabled: false,
|
|
42
43
|
},
|
|
44
|
+
decorators: [
|
|
45
|
+
(Story) => (
|
|
46
|
+
<Field label="Label">
|
|
47
|
+
<Story />
|
|
48
|
+
</Field>
|
|
49
|
+
),
|
|
50
|
+
],
|
|
43
51
|
};
|
|
44
52
|
|
|
45
53
|
function InputGroupWithSuffix(args: NonNullable<Story['args']>) {
|
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Size } from '../common';
|
|
5
|
+
import { Field } from '../field/Field';
|
|
5
6
|
|
|
6
7
|
import { SearchInput } from './SearchInput';
|
|
7
8
|
|
|
@@ -24,6 +25,13 @@ export const Basic: Story = {
|
|
|
24
25
|
action: 'changed',
|
|
25
26
|
},
|
|
26
27
|
},
|
|
28
|
+
decorators: [
|
|
29
|
+
(Story) => (
|
|
30
|
+
<Field label="Label">
|
|
31
|
+
<Story />
|
|
32
|
+
</Field>
|
|
33
|
+
),
|
|
34
|
+
],
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
function SearchInputBasic({ onChange, ...restProps }: NonNullable<Story['args']>) {
|
|
@@ -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
|
-
|
|
11
|
+
const meta = {
|
|
11
12
|
component: RadioGroup,
|
|
12
13
|
title: 'Forms/RadioGroup',
|
|
13
|
-
}
|
|
14
|
+
} satisfies Meta<typeof RadioGroup>;
|
|
14
15
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
const hasError = boolean('hasError', false);
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story<T extends string | number = string> = StoryObj<RadioGroupProps<T>>;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import Radio from '../radio';
|
|
4
4
|
import { RadioProps } from '../radio/Radio';
|
|
5
|
-
import { useInputAttributes } from '../inputs/contexts';
|
|
5
|
+
import { useInputAttributes, WithInputAttributesProps } from '../inputs/contexts';
|
|
6
6
|
|
|
7
7
|
export type RadioGroupRadio<T extends string | number = string> = Omit<
|
|
8
8
|
RadioProps<T>,
|
|
@@ -14,6 +14,7 @@ export interface RadioGroupProps<T extends string | number = string> {
|
|
|
14
14
|
radios: readonly RadioGroupRadio<T>[];
|
|
15
15
|
selectedValue?: T; // TODO: `NoInfer<T>` from TypeScript 5.4
|
|
16
16
|
onChange: NonNullable<RadioProps<T>['onChange']>;
|
|
17
|
+
UNSAFE_inputAttributes?: WithInputAttributesProps['inputAttributes'];
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export default function RadioGroup<T extends string | number = never>({
|
|
@@ -21,13 +22,14 @@ export default function RadioGroup<T extends string | number = never>({
|
|
|
21
22
|
radios,
|
|
22
23
|
selectedValue: controlledValue,
|
|
23
24
|
onChange,
|
|
25
|
+
UNSAFE_inputAttributes,
|
|
24
26
|
}: RadioGroupProps<T>) {
|
|
25
27
|
const inputAttributes = useInputAttributes({ nonLabelable: true });
|
|
26
28
|
|
|
27
29
|
const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);
|
|
28
30
|
|
|
29
31
|
return radios.length > 0 ? (
|
|
30
|
-
<div role="radiogroup" {...inputAttributes}>
|
|
32
|
+
<div role="radiogroup" {...inputAttributes} {...UNSAFE_inputAttributes}>
|
|
31
33
|
{radios.map(({ value = '' as T, ...restProps }, index) => (
|
|
32
34
|
<Radio
|
|
33
35
|
// eslint-disable-next-line react/no-array-index-key
|