@transferwise/components 0.0.0-experimental-1d00fb5 → 0.0.0-experimental-d44dcb8
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/alert/Alert.js +1 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +1 -1
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +1 -1
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/field/Field.js +8 -4
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +8 -4
- package/build/field/Field.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +1 -7
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +1 -7
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/main.css +27 -12
- package/build/nudge/Nudge.js +8 -12
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +8 -12
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js +2 -0
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +2 -0
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/radioGroup/RadioGroup.js +1 -0
- package/build/radioGroup/RadioGroup.js.map +1 -1
- package/build/radioGroup/RadioGroup.mjs +1 -0
- package/build/radioGroup/RadioGroup.mjs.map +1 -1
- package/build/styles/field/Field.css +10 -1
- package/build/styles/main.css +27 -12
- package/build/styles/nudge/Nudge.css +7 -11
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +3 -0
- package/build/styles/radioGroup/RadioGroup.css +3 -0
- package/build/styles/typeahead/Typeahead.css +4 -0
- package/build/typeahead/Typeahead.js +20 -7
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +20 -7
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/components/src/alert/Alert.d.ts +1 -1
- package/build/types/components/src/alert/Alert.d.ts.map +1 -1
- package/build/types/components/src/field/Field.d.ts +8 -4
- package/build/types/components/src/field/Field.d.ts.map +1 -1
- package/build/types/components/src/inlineAlert/InlineAlert.d.ts +1 -7
- package/build/types/components/src/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/components/src/nudge/Nudge.d.ts +2 -2
- package/build/types/components/src/nudge/Nudge.d.ts.map +1 -1
- package/build/types/components/src/prompt/InlinePrompt/InlinePrompt.d.ts +6 -1
- package/build/types/components/src/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/components/src/radioGroup/RadioGroup.d.ts.map +1 -1
- package/build/types/components/src/typeahead/Typeahead.d.ts +8 -4
- package/build/types/components/src/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/components/src/upload/Upload.d.ts +1 -1
- package/build/types/components/src/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +5 -4
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +5 -4
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.spec.tsx +1 -1
- package/src/alert/Alert.tsx +2 -2
- package/src/checkbox/Checkbox.story.tsx +11 -3
- package/src/checkbox/Checkbox.tsx +1 -1
- package/src/checkbox/__snapshots__/Checkbox.spec.tsx.snap +1 -1
- package/src/field/Field.css +10 -1
- package/src/field/Field.less +13 -2
- package/src/field/Field.spec.tsx +19 -3
- package/src/field/Field.story.tsx +18 -0
- package/src/field/Field.tsx +17 -5
- package/src/inlineAlert/InlineAlert.story.tsx +4 -0
- package/src/inlineAlert/InlineAlert.tsx +1 -7
- package/src/main.css +27 -12
- package/src/main.less +1 -0
- package/src/nudge/Nudge.css +7 -11
- package/src/nudge/Nudge.less +13 -10
- package/src/nudge/Nudge.spec.tsx +6 -5
- package/src/nudge/Nudge.story.tsx +0 -9
- package/src/nudge/Nudge.tsx +3 -14
- package/src/prompt/InlinePrompt/InlinePrompt.css +3 -0
- package/src/prompt/InlinePrompt/InlinePrompt.less +5 -1
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +17 -0
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +35 -0
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +7 -0
- package/src/radioGroup/RadioGroup.css +3 -0
- package/src/radioGroup/RadioGroup.less +3 -0
- package/src/radioGroup/RadioGroup.story.tsx +2 -0
- package/src/radioGroup/RadioGroup.test.story.tsx +62 -0
- package/src/radioGroup/RadioGroup.tsx +6 -1
- package/src/typeahead/Typeahead.css +4 -0
- package/src/typeahead/Typeahead.less +5 -1
- package/src/typeahead/Typeahead.spec.tsx +1 -1
- package/src/typeahead/Typeahead.story.tsx +151 -3
- package/src/typeahead/Typeahead.tsx +33 -9
- package/src/upload/Upload.story.tsx +1 -1
- package/src/upload/Upload.tests.story.tsx +36 -1
- package/src/upload/Upload.tsx +1 -1
- package/src/upload/steps/uploadImageStep/uploadImageStep.tsx +7 -3
package/build/nudge/Nudge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nudge.js","sources":["../../src/nudge/Nudge.tsx"],"sourcesContent":["import { Illustration, Assets, type IllustrationNames } from '@wise/art';\nimport { clsx } from 'clsx';\nimport { ReactNode, useEffect, useState, MouseEvent } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport
|
|
1
|
+
{"version":3,"file":"Nudge.js","sources":["../../src/nudge/Nudge.tsx"],"sourcesContent":["import { Illustration, Assets, type IllustrationNames } from '@wise/art';\nimport { clsx } from 'clsx';\nimport { ReactNode, useEffect, useState, MouseEvent } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport Link from '../link';\nimport type { AlertAction } from '../alert';\n\n// WARNING: Changing this will cause nudges to reappear wherever persist nudge is used and privacy team will need to be updated too\nexport const STORAGE_NAME = 'dismissedNudges';\n\nconst getLocalStorage = (): string[] => {\n try {\n const storageItem = localStorage.getItem(STORAGE_NAME);\n\n if (storageItem) {\n const storage: unknown = JSON.parse(storageItem);\n\n if (Array.isArray(storage)) {\n return storage.map((item) => String(item));\n }\n }\n } catch (error) {}\n\n return [];\n};\n\ntype MediaNameType =\n | `${Assets.GLOBE}`\n | `${Assets.LOCK}`\n | `${Assets.WALLET}`\n | `${Assets.GEAR}`\n | `${Assets.INVITE_LETTER}`\n | `${Assets.PERSONAL_CARD}`\n | `${Assets.BUSINESS_CARD}`\n | `${Assets.HEART}`\n | `${Assets.MULTI_CURRENCY}`\n | `${Assets.SHOPPING_BAG}`\n | `${Assets.FLOWER}`\n | `${Assets.BACKPACK}`;\n\ntype BaseProps = {\n /** @deprecated use `mediaName` property instead */\n media?: ReactNode;\n /** Media name */\n mediaName?: MediaNameType;\n title: ReactNode;\n link?: ReactNode;\n href?: string;\n onClick?: (event?: MouseEvent<HTMLSpanElement>) => void;\n /** Fired when the user clicks on close button */\n onDismiss?: () => void;\n /** An optional call to action to sit under the main body of the nudge. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n};\n\nexport interface OptionalId extends BaseProps {\n id?: string;\n persistDismissal?: false;\n isPreviouslyDismissed?: undefined;\n}\n\nexport interface RequiredPersistProps extends BaseProps {\n /** This ID should be completely unique to the page and feature as it uses a shared array which could conflict with other nudges in Wise */\n id: string;\n /** Use persist dismissal to keep the nudge dismissed using the browser's localStorage */\n persistDismissal: true;\n /**\n * Fired on mount for determining if nudge has been dismissed before\n *\n * @param {boolean} value - set to true if dismissed previously\n */\n isPreviouslyDismissed?: (value: boolean) => void;\n}\n\nexport type Props = OptionalId | RequiredPersistProps;\n\nconst Nudge = ({\n media,\n mediaName,\n title,\n link,\n href,\n onClick,\n onDismiss,\n persistDismissal,\n isPreviouslyDismissed,\n id,\n className,\n action,\n}: Props) => {\n const [isDismissed, setIsDismissed] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n\n const handleOnDismiss = () => {\n const dismissedNudgesStorage = getLocalStorage();\n\n if (persistDismissal && id) {\n try {\n localStorage.setItem(STORAGE_NAME, JSON.stringify([...dismissedNudgesStorage, id]));\n } catch (error) {}\n\n setIsDismissed(true);\n }\n\n if (onDismiss) {\n onDismiss();\n }\n };\n\n useEffect(() => {\n if (persistDismissal && id) {\n const dismissedNudgesStorage = getLocalStorage();\n let isDismissed = false;\n\n if (dismissedNudgesStorage?.find((item) => item === id)) {\n setIsDismissed(true);\n isDismissed = true;\n }\n\n if (isPreviouslyDismissed) {\n isPreviouslyDismissed(isDismissed);\n }\n }\n\n setIsMounted(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [id, persistDismissal]);\n\n if (persistDismissal && (isDismissed || !isMounted)) {\n return null;\n }\n\n return (\n <div className={clsx('wds-nudge', className)} id={id}>\n {!!mediaName && (\n <div className=\"wds-nudge-media\">\n <Illustration\n name={mediaName as IllustrationNames}\n className={clsx(`wds-nudge-media-${mediaName}`)}\n size=\"small\"\n disablePadding\n alt=\"\"\n />\n </div>\n )}\n <div className=\"wds-nudge-container\">\n <div className=\"wds-nudge-content\">\n <Body type={Typography.BODY_LARGE} className={clsx('wds-nudge-body')}>\n {title}\n </Body>\n {/* Merge these two Link instances into one */}\n {link && (\n <Link\n href={href}\n type={Typography.LINK_LARGE}\n className=\"wds-nudge-link\"\n onClick={onClick}\n >\n {link}\n </Link>\n )}\n {action && (\n <Link\n href={action.href}\n target={action.target}\n className=\"m-t-1\"\n aria-label={action['aria-label']}\n type={Typography.LINK_LARGE}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n )}\n </div>\n {onDismiss || persistDismissal ? (\n <CloseButton className=\"wds-nudge-control\" size=\"sm\" onClick={handleOnDismiss} />\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default Nudge;\n"],"names":["STORAGE_NAME","getLocalStorage","storageItem","localStorage","getItem","storage","JSON","parse","Array","isArray","map","item","String","error","Nudge","media","mediaName","title","link","href","onClick","onDismiss","persistDismissal","isPreviouslyDismissed","id","className","action","isDismissed","setIsDismissed","useState","isMounted","setIsMounted","handleOnDismiss","dismissedNudgesStorage","setItem","stringify","useEffect","find","_jsxs","clsx","children","_jsx","Illustration","name","size","disablePadding","alt","Body","type","Typography","BODY_LARGE","Link","LINK_LARGE","target","text","CloseButton"],"mappings":";;;;;;;;;;;;;AAUA;AACO,MAAMA,YAAY,GAAG;AAE5B,MAAMC,eAAe,GAAGA,MAAgB;EACtC,IAAI;AACF,IAAA,MAAMC,WAAW,GAAGC,YAAY,CAACC,OAAO,CAACJ,YAAY,CAAC;AAEtD,IAAA,IAAIE,WAAW,EAAE;AACf,MAAA,MAAMG,OAAgB,GAAGC,IAAI,CAACC,KAAK,CAACL,WAAW,CAAC;AAEhD,MAAA,IAAIM,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;QAC1B,OAAOA,OAAO,CAACK,GAAG,CAAEC,IAAI,IAAKC,MAAM,CAACD,IAAI,CAAC,CAAC;AAC5C,MAAA;AACF,IAAA;AACF,EAAA,CAAC,CAAC,OAAOE,KAAK,EAAE,CAAC;AAEjB,EAAA,OAAO,EAAE;AACX,CAAC;AAqDD,MAAMC,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,IAAI;EACJC,IAAI;EACJC,OAAO;EACPC,SAAS;EACTC,gBAAgB;EAChBC,qBAAqB;EACrBC,EAAE;EACFC,SAAS;AACTC,EAAAA;AACK,CAAC,KAAK;EACX,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;EACrD,MAAM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ACG,UAAW;UAC5BhC,OAAO,EAAEM,MAAM,CAACN,OAAQ;UAAAoB,QAAA,EAEvBd,MAAM,CAAC4B;AAAI,SACR,CACP;OACE,CAAC,EACLjC,SAAS,IAAIC,gBAAgB,gBAC5BmB,cAAA,CAACc,uBAAW,EAAA;AAAC9B,QAAAA,SAAS,EAAC,mBAAmB;AAACmB,QAAAA,IAAI,EAAC,IAAI;AAACxB,QAAAA,OAAO,EAAEY;OAAkB,CAAC,GAC/E,IAAI;AAAA,KACL,CAAC;AAAA,GACH,CAAC;AAEV;;;;;"}
|
package/build/nudge/Nudge.mjs
CHANGED
|
@@ -3,13 +3,11 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import Body from '../body/Body.mjs';
|
|
5
5
|
import { Typography } from '../common/propsValues/typography.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import { useIntl } from 'react-intl';
|
|
8
|
-
import closeBtnMessages from '../common/closeButton/CloseButton.messages.mjs';
|
|
9
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { CloseButton } from '../common/closeButton/CloseButton.mjs';
|
|
10
7
|
import Link from '../link/Link.mjs';
|
|
11
|
-
import
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
9
|
|
|
10
|
+
// WARNING: Changing this will cause nudges to reappear wherever persist nudge is used and privacy team will need to be updated too
|
|
13
11
|
const STORAGE_NAME = 'dismissedNudges';
|
|
14
12
|
const getLocalStorage = () => {
|
|
15
13
|
try {
|
|
@@ -24,6 +22,7 @@ const getLocalStorage = () => {
|
|
|
24
22
|
return [];
|
|
25
23
|
};
|
|
26
24
|
const Nudge = ({
|
|
25
|
+
media,
|
|
27
26
|
mediaName,
|
|
28
27
|
title,
|
|
29
28
|
link,
|
|
@@ -36,7 +35,6 @@ const Nudge = ({
|
|
|
36
35
|
className,
|
|
37
36
|
action
|
|
38
37
|
}) => {
|
|
39
|
-
const intl = useIntl();
|
|
40
38
|
const [isDismissed, setIsDismissed] = useState(false);
|
|
41
39
|
const [isMounted, setIsMounted] = useState(false);
|
|
42
40
|
const handleOnDismiss = () => {
|
|
@@ -104,12 +102,10 @@ const Nudge = ({
|
|
|
104
102
|
onClick: action.onClick,
|
|
105
103
|
children: action.text
|
|
106
104
|
})]
|
|
107
|
-
}), onDismiss || persistDismissal ? /*#__PURE__*/jsx(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
onClick: handleOnDismiss,
|
|
112
|
-
children: /*#__PURE__*/jsx(Cross, {})
|
|
105
|
+
}), onDismiss || persistDismissal ? /*#__PURE__*/jsx(CloseButton, {
|
|
106
|
+
className: "wds-nudge-control",
|
|
107
|
+
size: "sm",
|
|
108
|
+
onClick: handleOnDismiss
|
|
113
109
|
}) : null]
|
|
114
110
|
})]
|
|
115
111
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nudge.mjs","sources":["../../src/nudge/Nudge.tsx"],"sourcesContent":["import { Illustration, Assets, type IllustrationNames } from '@wise/art';\nimport { clsx } from 'clsx';\nimport { ReactNode, useEffect, useState, MouseEvent } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport
|
|
1
|
+
{"version":3,"file":"Nudge.mjs","sources":["../../src/nudge/Nudge.tsx"],"sourcesContent":["import { Illustration, Assets, type IllustrationNames } from '@wise/art';\nimport { clsx } from 'clsx';\nimport { ReactNode, useEffect, useState, MouseEvent } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport Link from '../link';\nimport type { AlertAction } from '../alert';\n\n// WARNING: Changing this will cause nudges to reappear wherever persist nudge is used and privacy team will need to be updated too\nexport const STORAGE_NAME = 'dismissedNudges';\n\nconst getLocalStorage = (): string[] => {\n try {\n const storageItem = localStorage.getItem(STORAGE_NAME);\n\n if (storageItem) {\n const storage: unknown = JSON.parse(storageItem);\n\n if (Array.isArray(storage)) {\n return storage.map((item) => String(item));\n }\n }\n } catch (error) {}\n\n return [];\n};\n\ntype MediaNameType =\n | `${Assets.GLOBE}`\n | `${Assets.LOCK}`\n | `${Assets.WALLET}`\n | `${Assets.GEAR}`\n | `${Assets.INVITE_LETTER}`\n | `${Assets.PERSONAL_CARD}`\n | `${Assets.BUSINESS_CARD}`\n | `${Assets.HEART}`\n | `${Assets.MULTI_CURRENCY}`\n | `${Assets.SHOPPING_BAG}`\n | `${Assets.FLOWER}`\n | `${Assets.BACKPACK}`;\n\ntype BaseProps = {\n /** @deprecated use `mediaName` property instead */\n media?: ReactNode;\n /** Media name */\n mediaName?: MediaNameType;\n title: ReactNode;\n link?: ReactNode;\n href?: string;\n onClick?: (event?: MouseEvent<HTMLSpanElement>) => void;\n /** Fired when the user clicks on close button */\n onDismiss?: () => void;\n /** An optional call to action to sit under the main body of the nudge. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n};\n\nexport interface OptionalId extends BaseProps {\n id?: string;\n persistDismissal?: false;\n isPreviouslyDismissed?: undefined;\n}\n\nexport interface RequiredPersistProps extends BaseProps {\n /** This ID should be completely unique to the page and feature as it uses a shared array which could conflict with other nudges in Wise */\n id: string;\n /** Use persist dismissal to keep the nudge dismissed using the browser's localStorage */\n persistDismissal: true;\n /**\n * Fired on mount for determining if nudge has been dismissed before\n *\n * @param {boolean} value - set to true if dismissed previously\n */\n isPreviouslyDismissed?: (value: boolean) => void;\n}\n\nexport type Props = OptionalId | RequiredPersistProps;\n\nconst Nudge = ({\n media,\n mediaName,\n title,\n link,\n href,\n onClick,\n onDismiss,\n persistDismissal,\n isPreviouslyDismissed,\n id,\n className,\n action,\n}: Props) => {\n const [isDismissed, setIsDismissed] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n\n const handleOnDismiss = () => {\n const dismissedNudgesStorage = getLocalStorage();\n\n if (persistDismissal && id) {\n try {\n localStorage.setItem(STORAGE_NAME, JSON.stringify([...dismissedNudgesStorage, id]));\n } catch (error) {}\n\n setIsDismissed(true);\n }\n\n if (onDismiss) {\n onDismiss();\n }\n };\n\n useEffect(() => {\n if (persistDismissal && id) {\n const dismissedNudgesStorage = getLocalStorage();\n let isDismissed = false;\n\n if (dismissedNudgesStorage?.find((item) => item === id)) {\n setIsDismissed(true);\n isDismissed = true;\n }\n\n if (isPreviouslyDismissed) {\n isPreviouslyDismissed(isDismissed);\n }\n }\n\n setIsMounted(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [id, persistDismissal]);\n\n if (persistDismissal && (isDismissed || !isMounted)) {\n return null;\n }\n\n return (\n <div className={clsx('wds-nudge', className)} id={id}>\n {!!mediaName && (\n <div className=\"wds-nudge-media\">\n <Illustration\n name={mediaName as IllustrationNames}\n className={clsx(`wds-nudge-media-${mediaName}`)}\n size=\"small\"\n disablePadding\n alt=\"\"\n />\n </div>\n )}\n <div className=\"wds-nudge-container\">\n <div className=\"wds-nudge-content\">\n <Body type={Typography.BODY_LARGE} className={clsx('wds-nudge-body')}>\n {title}\n </Body>\n {/* Merge these two Link instances into one */}\n {link && (\n <Link\n href={href}\n type={Typography.LINK_LARGE}\n className=\"wds-nudge-link\"\n onClick={onClick}\n >\n {link}\n </Link>\n )}\n {action && (\n <Link\n href={action.href}\n target={action.target}\n className=\"m-t-1\"\n aria-label={action['aria-label']}\n type={Typography.LINK_LARGE}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n )}\n </div>\n {onDismiss || persistDismissal ? (\n <CloseButton className=\"wds-nudge-control\" size=\"sm\" onClick={handleOnDismiss} />\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default Nudge;\n"],"names":["STORAGE_NAME","getLocalStorage","storageItem","localStorage","getItem","storage","JSON","parse","Array","isArray","map","item","String","error","Nudge","media","mediaName","title","link","href","onClick","onDismiss","persistDismissal","isPreviouslyDismissed","id","className","action","isDismissed","setIsDismissed","useState","isMounted","setIsMounted","handleOnDismiss","dismissedNudgesStorage","setItem","stringify","useEffect","find","_jsxs","clsx","children","_jsx","Illustration","name","size","disablePadding","alt","Body","type","Typography","BODY_LARGE","Link","LINK_LARGE","target","text","CloseButton"],"mappings":";;;;;;;;;AAUA;AACO,MAAMA,YAAY,GAAG;AAE5B,MAAMC,eAAe,GAAGA,MAAgB;EACtC,IAAI;AACF,IAAA,MAAMC,WAAW,GAAGC,YAAY,CAACC,OAAO,CAACJ,YAAY,CAAC;AAEtD,IAAA,IAAIE,WAAW,EAAE;AACf,MAAA,MAAMG,OAAgB,GAAGC,IAAI,CAACC,KAAK,CAACL,WAAW,CAAC;AAEhD,MAAA,IAAIM,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;QAC1B,OAAOA,OAAO,CAACK,GAAG,CAAEC,IAAI,IAAKC,MAAM,CAACD,IAAI,CAAC,CAAC;AAC5C,MAAA;AACF,IAAA;AACF,EAAA,CAAC,CAAC,OAAOE,KAAK,EAAE,CAAC;AAEjB,EAAA,OAAO,EAAE;AACX,CAAC;AAqDD,MAAMC,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,IAAI;EACJC,IAAI;EACJC,OAAO;EACPC,SAAS;EACTC,gBAAgB;EAChBC,qBAAqB;EACrBC,EAAE;EACFC,SAAS;AACTC,EAAAA;AACK,CAAC,KAAK;EACX,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC;EACrD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGF,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMG,eAAe,GAAGA,MAAM;AAC5B,IAAA,MAAMC,sBAAsB,GAAGhC,eAAe,EAAE;IAEhD,IAAIqB,gBAAgB,IAAIE,EAAE,EAAE;MAC1B,IAAI;AACFrB,QAAAA,YAAY,CAAC+B,OAAO,CAAClC,YAAY,EAAEM,IAAI,CAAC6B,SAAS,CAAC,CAAC,GAAGF,sBAAsB,EAAET,EAAE,CAAC,CAAC,CAAC;AACrF,MA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|
@@ -26,6 +26,7 @@ const InlinePrompt = ({
|
|
|
26
26
|
children,
|
|
27
27
|
media = null,
|
|
28
28
|
mediaLabel,
|
|
29
|
+
width = 'auto',
|
|
29
30
|
'data-testid': dataTestId,
|
|
30
31
|
...rest
|
|
31
32
|
}) => {
|
|
@@ -63,6 +64,7 @@ const InlinePrompt = ({
|
|
|
63
64
|
sentiment: surfaceSentiment,
|
|
64
65
|
"data-testid": dataTestId,
|
|
65
66
|
className: clsx.clsx('wds-inline-prompt', `wds-inline-prompt--${sentiment$1}`, {
|
|
67
|
+
'wds-inline-prompt--full-width': width === 'full',
|
|
66
68
|
'wds-inline-prompt--muted': muted,
|
|
67
69
|
'wds-inline-prompt--loading': loading
|
|
68
70
|
}, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n /**\n * Override for the sentiment's-derived, default, accessible name announced by the screen readers.\n * To be used primarily for `proposition` sentiment.\n */\n mediaLabel?: string;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing. <br />\n *\n * **NB:** It should be used in favour of `InlineAlert` which will be soon deprecated.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n mediaLabel,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" title={mediaLabel} />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox title={mediaLabel} />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} iconLabel={mediaLabel} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","mediaLabel","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","title","ProcessIndicator","GiftBox","StatusIcon","iconLabel","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n /**\n * Override for the sentiment's-derived, default, accessible name announced by the screen readers.\n * To be used primarily for `proposition` sentiment.\n */\n mediaLabel?: string;\n /**\n * Defines the sizing strategy of the prompt component - either hugging the content or taking full width of the container.\n * @default auto\n */\n width?: 'auto' | 'full';\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing. <br />\n *\n * **NB:** It should be used in favour of `InlineAlert` which will be soon deprecated.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n mediaLabel,\n width = 'auto',\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" title={mediaLabel} />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox title={mediaLabel} />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} iconLabel={mediaLabel} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--full-width': width === 'full',\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","mediaLabel","width","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","title","ProcessIndicator","GiftBox","StatusIcon","iconLabel","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;;;AA8CA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAGA,CAAC;aAC3BC,WAAS,GAAGC,mBAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;EACZC,UAAU;AACVC,EAAAA,KAAK,GAAG,MAAM;AACd,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AACc,CAAC,KAAK;EACvB,MAAMC,gBAAgB,GAAGZ,WAAS,KAAKC,mBAAS,CAACC,QAAQ,GAAG,SAAS,GAAGF,WAAS;EAEjF,MAAMa,WAAW,GAAGA,MAAM;AACxB,IAAA,IAAIV,KAAK,EAAE;MACT,oBAAOW,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;AAAC,QAAA,aAAA,EAAY,oBAAoB;AAACC,QAAAA,KAAK,EAAET;AAAW,OAAE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linePrompt = ({
|
|
|
24
24
|
children,
|
|
25
25
|
media = null,
|
|
26
26
|
mediaLabel,
|
|
27
|
+
width = 'auto',
|
|
27
28
|
'data-testid': dataTestId,
|
|
28
29
|
...rest
|
|
29
30
|
}) => {
|
|
@@ -61,6 +62,7 @@ const InlinePrompt = ({
|
|
|
61
62
|
sentiment: surfaceSentiment,
|
|
62
63
|
"data-testid": dataTestId,
|
|
63
64
|
className: clsx('wds-inline-prompt', `wds-inline-prompt--${sentiment}`, {
|
|
65
|
+
'wds-inline-prompt--full-width': width === 'full',
|
|
64
66
|
'wds-inline-prompt--muted': muted,
|
|
65
67
|
'wds-inline-prompt--loading': loading
|
|
66
68
|
}, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n /**\n * Override for the sentiment's-derived, default, accessible name announced by the screen readers.\n * To be used primarily for `proposition` sentiment.\n */\n mediaLabel?: string;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing. <br />\n *\n * **NB:** It should be used in favour of `InlineAlert` which will be soon deprecated.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n mediaLabel,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" title={mediaLabel} />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox title={mediaLabel} />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} iconLabel={mediaLabel} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","mediaLabel","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","title","ProcessIndicator","GiftBox","StatusIcon","iconLabel","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n /**\n * Override for the sentiment's-derived, default, accessible name announced by the screen readers.\n * To be used primarily for `proposition` sentiment.\n */\n mediaLabel?: string;\n /**\n * Defines the sizing strategy of the prompt component - either hugging the content or taking full width of the container.\n * @default auto\n */\n width?: 'auto' | 'full';\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing. <br />\n *\n * **NB:** It should be used in favour of `InlineAlert` which will be soon deprecated.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n mediaLabel,\n width = 'auto',\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" title={mediaLabel} />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox title={mediaLabel} />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} iconLabel={mediaLabel} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--full-width': width === 'full',\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","mediaLabel","width","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","title","ProcessIndicator","GiftBox","StatusIcon","iconLabel","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;AA8CA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAGA,CAAC;EAC3BC,SAAS,GAAGC,SAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;EACZC,UAAU;AACVC,EAAAA,KAAK,GAAG,MAAM;AACd,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AACc,CAAC,KAAK;EACvB,MAAMC,gBAAgB,GAAGZ,SAAS,KAAKC,SAAS,CAACC,QAAQ,GAAG,SAAS,GAAGF,SAAS;EAEjF,MAAMa,WAAW,GAAGA,MAAM;AACxB,IAAA,IAAIV,KAAK,EAAE;MACT,oBAAOW,GAAA,CAACC,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;AAAC,QAAA,aAAA,EAAY,oBAAoB;AAACC,QAAAA,KAAK,EAAET;AAAW,OAAE,CAAC;AAC1F,IAAA;AACA,IAAA,IAA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../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
|
|
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\n role=\"radiogroup\"\n {...inputAttributes}\n {...UNSAFE_inputAttributes}\n className=\"wds-radio-group\"\n >\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","className","children","map","value","restProps","index","Radio","checked","nextValue"],"mappings":";;;;;;;;;AAmBe,SAASA,UAAUA,CAAoC;EACpEC,IAAI;EACJC,MAAM;AACNC,EAAAA,aAAa,EAAEC,eAAe;EAC9BC,QAAQ;AACRC,EAAAA;AACkB,CAAC,EAAE;EACrB,MAAMC,eAAe,GAAGC,2BAAkB,CAAC;AAAEC,IAAAA,YAAY,EAAE;AAAK,GAAC,CAAC;EAElE,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,cAAQ,CAACR,eAAe,CAAC;AAE3E,EAAA,OAAOF,MAAM,CAACW,MAAM,GAAG,CAAC,gBACtBC,cAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,IAAI,EAAC,YAAY;AAAA,IAAA,GACbR,eAAe;AAAA,IAAA,GACfD,sBAAsB;AAC1BU,IAAAA,SAAS,EAAC,iBAAiB;AAAAC,IAAAA,QAAA,EAE1Bf,MAAM,CAACgB,GAAG,CAAC,CAAC;AAAEC,MAAAA,KAAK,GAAG,EAAO;MAAE,GAAGC;AAAU,KAAC,EAAEC,KAAK,kBACnDP,cAAA,CAACQ;AACC;AAAA,MAAA;AAAA,MAAA,GAEIF,SAAS;AACbnB,MAAAA,IAAI,EAAEA,IAAK;AACXkB,MAAAA,KAAK,EAAEA,KAAM;MACbI,OAAO,EAAEJ,KAAK,KAAKT,iBAAkB;MACrCL,QAAQ,EAAGmB,SAAS,IAAK;QACvBb,oBAAoB,CAACa,SAAS,CAAC;QAC/BnB,QAAQ,CAACmB,SAAS,CAAC;AACrB,MAAA;AAAE,KAAA,EARGH,KASN,CACF;GACE,CAAC,GACJ,IAAI;AACV;;;;"}
|
|
@@ -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, 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
|
|
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\n role=\"radiogroup\"\n {...inputAttributes}\n {...UNSAFE_inputAttributes}\n className=\"wds-radio-group\"\n >\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","className","children","map","value","restProps","index","Radio","checked","nextValue"],"mappings":";;;;;AAmBe,SAASA,UAAUA,CAAoC;EACpEC,IAAI;EACJC,MAAM;AACNC,EAAAA,aAAa,EAAEC,eAAe;EAC9BC,QAAQ;AACRC,EAAAA;AACkB,CAAC,EAAE;EACrB,MAAMC,eAAe,GAAGC,kBAAkB,CAAC;AAAEC,IAAAA,YAAY,EAAE;AAAK,GAAC,CAAC;EAElE,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,QAAQ,CAACR,eAAe,CAAC;AAE3E,EAAA,OAAOF,MAAM,CAACW,MAAM,GAAG,CAAC,gBACtBC,GAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,IAAI,EAAC,YAAY;AAAA,IAAA,GACbR,eAAe;AAAA,IAAA,GACfD,sBAAsB;AAC1BU,IAAAA,SAAS,EAAC,iBAAiB;AAAAC,IAAAA,QAAA,EAE1Bf,MAAM,CAACgB,GAAG,CAAC,CAAC;AAAEC,MAAAA,KAAK,GAAG,EAAO;MAAE,GAAGC;AAAU,KAAC,EAAEC,KAAK,kBACnDP,GAAA,CAACQ;AACC;AAAA,MAAA;AAAA,MAAA,GAEIF,SAAS;AACbnB,MAAAA,IAAI,EAAEA,IAAK;AACXkB,MAAAA,KAAK,EAAEA,KAAM;MACbI,OAAO,EAAEJ,KAAK,KAAKT,iBAAkB;MACrCL,QAAQ,EAAGmB,SAAS,IAAK;QACvBb,oBAAoB,CAACa,SAAS,CAAC;QAC/BnB,QAAQ,CAACmB,SAAS,CAAC;AACrB,MAAA;AAAE,KAAA,EARGH,KASN,CACF;GACE,CAAC,GACJ,IAAI;AACV;;;;"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
.np-field-control
|
|
1
|
+
.np-field-control,
|
|
2
|
+
.np-field__prompt {
|
|
2
3
|
margin-top: 4px;
|
|
3
4
|
margin-top: var(--size-4);
|
|
4
5
|
}
|
|
6
|
+
.np-field .form-group--typeahead[class],
|
|
7
|
+
.np-field .np-checkbox-label[class] {
|
|
8
|
+
margin-bottom: 0;
|
|
9
|
+
}
|
|
10
|
+
.np-field:has(.wds-radio-group) .np-field__prompt {
|
|
11
|
+
margin-top: 12px;
|
|
12
|
+
margin-top: var(--size-12);
|
|
13
|
+
}
|
package/build/styles/main.css
CHANGED
|
@@ -949,6 +949,9 @@
|
|
|
949
949
|
.wds-inline-prompt:has(button):active {
|
|
950
950
|
background-color: var(--color-sentiment-background-surface-active);
|
|
951
951
|
}
|
|
952
|
+
.wds-inline-prompt--full-width {
|
|
953
|
+
width: 100%;
|
|
954
|
+
}
|
|
952
955
|
.wds-inline-prompt--muted {
|
|
953
956
|
opacity: 0.93;
|
|
954
957
|
filter: grayscale(1);
|
|
@@ -3822,10 +3825,19 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3822
3825
|
stroke-dasharray: calc(12px * 0.5) calc(12px * 0.5);
|
|
3823
3826
|
stroke-dasharray: var(--wds-list-item-spotlight-strokeDashSize) var(--wds-list-item-spotlight-strokeDashSize);
|
|
3824
3827
|
}
|
|
3825
|
-
.np-field-control
|
|
3828
|
+
.np-field-control,
|
|
3829
|
+
.np-field__prompt {
|
|
3826
3830
|
margin-top: 4px;
|
|
3827
3831
|
margin-top: var(--size-4);
|
|
3828
3832
|
}
|
|
3833
|
+
.np-field .form-group--typeahead[class],
|
|
3834
|
+
.np-field .np-checkbox-label[class] {
|
|
3835
|
+
margin-bottom: 0;
|
|
3836
|
+
}
|
|
3837
|
+
.np-field:has(.wds-radio-group) .np-field__prompt {
|
|
3838
|
+
margin-top: 12px;
|
|
3839
|
+
margin-top: var(--size-12);
|
|
3840
|
+
}
|
|
3829
3841
|
.np-input-group {
|
|
3830
3842
|
display: inline-grid;
|
|
3831
3843
|
width: 100%;
|
|
@@ -5052,17 +5064,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5052
5064
|
margin-left: 0;
|
|
5053
5065
|
margin-right: -16px;
|
|
5054
5066
|
}
|
|
5055
|
-
.wds-nudge-media-gift-box {
|
|
5056
|
-
margin-left: -22px;
|
|
5057
|
-
margin-top: 6px;
|
|
5058
|
-
position: absolute;
|
|
5059
|
-
width: 129px;
|
|
5060
|
-
}
|
|
5061
|
-
[dir="rtl"] .wds-nudge-media-gift-box {
|
|
5062
|
-
transform: scaleX(-1);
|
|
5063
|
-
margin-left: 0;
|
|
5064
|
-
margin-right: -22px;
|
|
5065
|
-
}
|
|
5066
5067
|
.wds-nudge-container {
|
|
5067
5068
|
align-items: stretch;
|
|
5068
5069
|
display: flex;
|
|
@@ -5098,6 +5099,13 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5098
5099
|
-webkit-text-decoration: var(--nudge-link-text-decoration);
|
|
5099
5100
|
text-decoration: var(--nudge-link-text-decoration);
|
|
5100
5101
|
}
|
|
5102
|
+
.wds-nudge-container .wds-nudge-control {
|
|
5103
|
+
max-width: var(--nudge-control-width);
|
|
5104
|
+
flex-basis: var(--nudge-control-width);
|
|
5105
|
+
flex: 0 0 var(--nudge-control-width);
|
|
5106
|
+
height: var(--nudge-control-width);
|
|
5107
|
+
background-color: var(--nudge-control-background-color);
|
|
5108
|
+
}
|
|
5101
5109
|
.np-overlay-header .np-overlay-header__content {
|
|
5102
5110
|
min-height: 97px;
|
|
5103
5111
|
width: 100%;
|
|
@@ -5398,6 +5406,9 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5398
5406
|
.np-CardGroup .np-Card.np-Card--promoCard {
|
|
5399
5407
|
max-width: 100%;
|
|
5400
5408
|
}
|
|
5409
|
+
.wds-radio-group .np-radio:last-child label {
|
|
5410
|
+
margin-bottom: 0;
|
|
5411
|
+
}
|
|
5401
5412
|
.np-section {
|
|
5402
5413
|
margin-top: 32px;
|
|
5403
5414
|
margin-top: var(--size-32);
|
|
@@ -6924,6 +6935,10 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
6924
6935
|
padding: 0;
|
|
6925
6936
|
margin: 0;
|
|
6926
6937
|
}
|
|
6938
|
+
.typeahead--prompt {
|
|
6939
|
+
margin-top: 4px;
|
|
6940
|
+
margin-top: var(--size-4);
|
|
6941
|
+
}
|
|
6927
6942
|
.typeahead-sm.typeahead--multiple .typeahead__input-container {
|
|
6928
6943
|
min-height: 32px;
|
|
6929
6944
|
}
|
|
@@ -158,17 +158,6 @@
|
|
|
158
158
|
margin-left: 0;
|
|
159
159
|
margin-right: -16px;
|
|
160
160
|
}
|
|
161
|
-
.wds-nudge-media-gift-box {
|
|
162
|
-
margin-left: -22px;
|
|
163
|
-
margin-top: 6px;
|
|
164
|
-
position: absolute;
|
|
165
|
-
width: 129px;
|
|
166
|
-
}
|
|
167
|
-
[dir="rtl"] .wds-nudge-media-gift-box {
|
|
168
|
-
transform: scaleX(-1);
|
|
169
|
-
margin-left: 0;
|
|
170
|
-
margin-right: -22px;
|
|
171
|
-
}
|
|
172
161
|
.wds-nudge-container {
|
|
173
162
|
align-items: stretch;
|
|
174
163
|
display: flex;
|
|
@@ -204,3 +193,10 @@
|
|
|
204
193
|
-webkit-text-decoration: var(--nudge-link-text-decoration);
|
|
205
194
|
text-decoration: var(--nudge-link-text-decoration);
|
|
206
195
|
}
|
|
196
|
+
.wds-nudge-container .wds-nudge-control {
|
|
197
|
+
max-width: var(--nudge-control-width);
|
|
198
|
+
flex-basis: var(--nudge-control-width);
|
|
199
|
+
flex: 0 0 var(--nudge-control-width);
|
|
200
|
+
height: var(--nudge-control-width);
|
|
201
|
+
background-color: var(--nudge-control-background-color);
|
|
202
|
+
}
|
|
@@ -14,7 +14,7 @@ var size = require('../common/propsValues/size.js');
|
|
|
14
14
|
var sentiment = require('../common/propsValues/sentiment.js');
|
|
15
15
|
require('../common/closeButton/CloseButton.messages.js');
|
|
16
16
|
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
-
var
|
|
17
|
+
var InlinePrompt = require('../prompt/InlinePrompt/InlinePrompt.js');
|
|
18
18
|
var contexts = require('../inputs/contexts.js');
|
|
19
19
|
var TypeaheadInput = require('./typeaheadInput/TypeaheadInput.js');
|
|
20
20
|
var TypeaheadOption = require('./typeaheadOption/TypeaheadOption.js');
|
|
@@ -410,9 +410,20 @@ class Typeahead extends React.Component {
|
|
|
410
410
|
showNewEntry,
|
|
411
411
|
dropdownOpen
|
|
412
412
|
});
|
|
413
|
-
const alertType =
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
const alertType = (() => {
|
|
414
|
+
if (!alert?.type || alert.type === sentiment.Sentiment.INFO) {
|
|
415
|
+
return sentiment.Sentiment.NEUTRAL;
|
|
416
|
+
}
|
|
417
|
+
if (alert.type === sentiment.Sentiment.ERROR) {
|
|
418
|
+
return sentiment.Sentiment.NEGATIVE;
|
|
419
|
+
}
|
|
420
|
+
if (alert.type === sentiment.Sentiment.SUCCESS) {
|
|
421
|
+
return sentiment.Sentiment.POSITIVE;
|
|
422
|
+
}
|
|
423
|
+
return alert.type;
|
|
424
|
+
})();
|
|
425
|
+
const hasError = errorState || alert && alertType === sentiment.Sentiment.NEGATIVE;
|
|
426
|
+
const displayAlert = !errorState && alert || alert && alertType === sentiment.Sentiment.NEGATIVE;
|
|
416
427
|
const hasWarning = displayAlert && alertType === sentiment.Sentiment.WARNING;
|
|
417
428
|
const hasInfo = displayAlert && alertType === sentiment.Sentiment.NEUTRAL;
|
|
418
429
|
return /*#__PURE__*/ /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */jsxRuntime.jsx("div", {
|
|
@@ -427,7 +438,7 @@ class Typeahead extends React.Component {
|
|
|
427
438
|
}),
|
|
428
439
|
onClick: documentIosClick.stopPropagation,
|
|
429
440
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
430
|
-
className: clsx.clsx('form-group', {
|
|
441
|
+
className: clsx.clsx('form-group', 'form-group--typeahead', {
|
|
431
442
|
'has-error': hasError,
|
|
432
443
|
'has-warning': hasWarning,
|
|
433
444
|
'has-info': hasInfo
|
|
@@ -467,8 +478,10 @@ class Typeahead extends React.Component {
|
|
|
467
478
|
children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
|
|
468
479
|
})
|
|
469
480
|
})]
|
|
470
|
-
}), displayAlert ? /*#__PURE__*/jsxRuntime.jsx(
|
|
471
|
-
|
|
481
|
+
}), displayAlert ? /*#__PURE__*/jsxRuntime.jsx(InlinePrompt.InlinePrompt, {
|
|
482
|
+
sentiment: alertType,
|
|
483
|
+
className: "typeahead--prompt",
|
|
484
|
+
width: "full",
|
|
472
485
|
children: alert.message
|
|
473
486
|
}) : menu]
|
|
474
487
|
})
|