@transferwise/components 0.0.0-experimental-c0ebd4f → 0.0.0-experimental-45bc861
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.map +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/common/propsValues/sentiment.js +0 -1
- package/build/common/propsValues/sentiment.js.map +1 -1
- package/build/common/propsValues/sentiment.mjs +0 -1
- package/build/common/propsValues/sentiment.mjs.map +1 -1
- package/build/i18n/cs.json +9 -9
- package/build/i18n/cs.json.js +9 -9
- package/build/i18n/cs.json.mjs +9 -9
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -1
- package/build/main.css +72 -60
- package/build/statusIcon/StatusIcon.js +2 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/inputs/Input.css +2 -28
- package/build/styles/inputs/TextArea.css +2 -28
- package/build/styles/item/Item.css +68 -0
- package/build/styles/main.css +72 -60
- package/build/styles/popover/Popover.css +2 -28
- package/build/test-utils/assets/apple-pay-logo.svg +84 -0
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +2 -2
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +2 -2
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/item/Item.d.ts +41 -0
- package/build/types/item/Item.d.ts.map +1 -0
- package/build/types/item/ItemAdditionalInfo.d.ts +9 -0
- package/build/types/item/ItemAdditionalInfo.d.ts.map +1 -0
- package/build/types/item/ItemCheckbox.d.ts +4 -0
- package/build/types/item/ItemCheckbox.d.ts.map +1 -0
- package/build/types/item/ItemIconButton.d.ts +4 -0
- package/build/types/item/ItemIconButton.d.ts.map +1 -0
- package/build/types/item/ItemMedia.d.ts +19 -0
- package/build/types/item/ItemMedia.d.ts.map +1 -0
- package/build/types/item/ItemNavigation.d.ts +4 -0
- package/build/types/item/ItemNavigation.d.ts.map +1 -0
- package/build/types/item/index.d.ts +6 -0
- package/build/types/item/index.d.ts.map +1 -0
- package/build/types/statusIcon/StatusIcon.d.ts +2 -3
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/test-utils/fake-data.d.ts +2 -0
- package/build/types/test-utils/fake-data.d.ts.map +1 -1
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/alert/Alert.story.tsx +3 -5
- package/src/alert/Alert.tsx +2 -11
- package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -2
- package/src/avatarWrapper/AvatarWrapper.tsx +2 -3
- package/src/common/propsValues/sentiment.ts +0 -1
- package/src/i18n/cs.json +9 -9
- package/src/index.ts +2 -0
- package/src/inputs/Input.css +2 -28
- package/src/inputs/TextArea.css +2 -28
- package/src/item/Item.css +68 -0
- package/src/item/Item.less +69 -0
- package/src/item/Item.story.tsx +111 -0
- package/src/item/Item.tsx +165 -0
- package/src/item/ItemAdditionalInfo.tsx +31 -0
- package/src/item/ItemCheckbox.tsx +16 -0
- package/src/item/ItemIconButton.tsx +15 -0
- package/src/item/ItemMedia.tsx +44 -0
- package/src/item/ItemNavigation.tsx +16 -0
- package/src/item/index.ts +6 -0
- package/src/main.css +72 -60
- package/src/main.less +1 -0
- package/src/popover/Popover.css +2 -28
- package/src/statusIcon/StatusIcon.docs.mdx +1 -1
- package/src/statusIcon/StatusIcon.spec.tsx +4 -10
- package/src/statusIcon/StatusIcon.story.tsx +5 -10
- package/src/statusIcon/StatusIcon.tsx +4 -6
- package/src/test-utils/assets/apple-pay-logo.svg +84 -0
- package/src/test-utils/fake-data.ts +5 -0
- package/src/title/Title.test.story.tsx +12 -19
- package/src/title/Title.tsx +0 -1
package/build/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton ref={closeButtonReference} size=\"xs\" onClick={onDismiss} />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","setTimeout","WDS_LIVE_REGION_DELAY_MS","closeButtonReference","useRef","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCYA,oCAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB,CAAA;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B,CAAA;AAC7B,CAAC,EAPWA,0BAAkB,KAAlBA,0BAAkB,GAO7B,EAAA,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Ac;QAAAO,QAAA,eAC3BgB,cAAA,CAACsC,uBAAW,EAAA;AAACC,UAAAA,GAAG,EAAEzC,oBAAqB;AAACb,UAAAA,IAAI,EAAC,IAAI;AAACgD,UAAAA,OAAO,EAAErD,SAAAA;SAC7D,CAAA;AAAA,OAAK,CACN,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV,CAAA;AAEA,SAAS0B,oBAAoBA,CAACvB,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC,CAAA;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B,CAAA;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport { CloseButton, Sentiment, Size, Typography, WDS_LIVE_REGION_DELAY_MS } from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.PENDING\n | Sentiment.NEGATIVE}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton ref={closeButtonReference} size=\"xs\" onClick={onDismiss} />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","setTimeout","WDS_LIVE_REGION_DELAY_MS","closeButtonReference","useRef","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Content":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton ref={closeButtonReference} size=\"xs\" onClick={onDismiss} />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","setTimeout","WDS_LIVE_REGION_DELAY_MS","closeButtonReference","useRef","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCYA,mBAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB,CAAA;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B,CAAA;AAC7B,CAAC,EAPWA,kBAAkB,KAAlBA,kBAAkB,GAO7B,EAAA,CAAA,CAAA,CAAA;AA+BD,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,SAAS;AACZ,MAAA,OAAO,UAAU,CAAA;AACnB,IAAA,KAAK,MAAM;AACT,MAAA,OAAO,SAAS,CAAA;AAClB,IAAA,KAAK,OAAO;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AA;AAEV,CAAA;AAEA,SAAS0B,oBAAoBA,CAACvB,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC,CAAA;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B,CAAA;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport { CloseButton, Sentiment, Size, Typography, WDS_LIVE_REGION_DELAY_MS } from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.PENDING\n | Sentiment.NEGATIVE}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton ref={closeButtonReference} size=\"xs\" onClick={onDismiss} />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","setTimeout","WDS_LIVE_REGION_DELAY_MS","closeButtonReference","useRef","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCYA,mBAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,C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S,EAAC,eAAe;YACzBwD,OAAO,EAAEzD,MAAM,CAACyD,OAAQ;YAAAjD,QAAA,EAEvBR,MAAM,CAAC0D,IAAAA;AAAI,WACN,CACT,CAAC,CAAA;SACD,CAAA;AACP,OAAK,CACL,EAACtD,SAAS,iBACRoB,GAAA,CAAA,KAAA,EAAA;AAAKvB,QAAAA,SAAS,EAAC,cAAc;QAAAO,QAAA,eAC3BgB,GAAA,CAACsC,WAAW,EAAA;AAACC,UAAAA,GAAG,EAAEzC,oBAAqB;AAACb,UAAAA,IAAI,EAAC,IAAI;AAACgD,UAAAA,OAAO,EAAErD,SAAAA;SAC7D,CAAA;AAAA,OAAK,CACN,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV,CAAA;AAEA,SAAS0B,oBAAoBA,CAACvB,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC,CAAA;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B,CAAA;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarWrapper.js","sources":["../../src/avatarWrapper/AvatarWrapper.tsx"],"sourcesContent":["import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';\nimport { useState, useEffect } from 'react';\n\nimport Avatar, { AvatarProps, AvatarType } from '../avatar';\nimport Badge, { BadgeProps } from '../badge';\nimport {\n ProfileType,\n ProfileTypePersonal,\n ProfileTypeBusiness,\n Size,\n Sentiment,\n getInitials,\n
|
|
1
|
+
{"version":3,"file":"AvatarWrapper.js","sources":["../../src/avatarWrapper/AvatarWrapper.tsx"],"sourcesContent":["import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';\nimport { useState, useEffect } from 'react';\n\nimport Avatar, { AvatarProps, AvatarType } from '../avatar';\nimport Badge, { BadgeProps } from '../badge';\nimport {\n ProfileType,\n ProfileTypePersonal,\n ProfileTypeBusiness,\n Size,\n Sentiment,\n getInitials,\n} from '../common';\nimport StatusIcon from '../statusIcon/StatusIcon';\n\ninterface OptionalBadgeProps extends Omit<BadgeProps, 'badge'> {\n url?: string;\n ariaLabel?: string;\n altText?: string;\n statusIcon?: Sentiment;\n}\n\nconst OptionalBadge = ({\n url,\n altText,\n statusIcon,\n children,\n ariaLabel,\n ...rest\n}: OptionalBadgeProps) => {\n if (url) {\n return (\n <Badge aria-label={ariaLabel} badge={<img src={url} alt={altText} />} {...rest}>\n {children}\n </Badge>\n );\n }\n if (statusIcon) {\n return (\n <Badge\n aria-label={ariaLabel}\n badge={<StatusIcon sentiment={statusIcon} size={Size.SMALL} />}\n {...rest}\n >\n {children}\n </Badge>\n );\n }\n return <>{children}</>;\n};\n\nexport type AvatarWrapperProps = {\n url?: string;\n 'aria-label'?: string;\n profileType?: ProfileTypeBusiness | ProfileTypePersonal;\n profileId?: string;\n name?: string;\n avatarProps?: AvatarProps;\n badgeProps?: BadgeProps;\n} & (\n | {\n badgeUrl: string;\n badgeAltText: string;\n badgeStatusIcon?: never;\n }\n | {\n badgeUrl?: never;\n badgeAltText?: never;\n badgeStatusIcon: Sentiment;\n }\n | {\n badgeUrl?: never;\n badgeAltText?: never;\n badgeStatusIcon?: never;\n }\n);\n\n/**\n * @deprecated Use `AvatarView` component instead\n */\nconst AvatarWrapper = ({\n url,\n 'aria-label': ariaLabel,\n profileType,\n profileId,\n badgeUrl,\n badgeAltText,\n badgeStatusIcon,\n name,\n avatarProps,\n badgeProps,\n}: AvatarWrapperProps) => {\n const [hasImageLoadError, setImageLoadError] = useState(false);\n const isBusinessProfile = profileType === ProfileType.BUSINESS;\n\n // Reset the errored state when url changes\n useEffect(() => setImageLoadError(false), [url]);\n\n const getAvatarProps = () => {\n let updatedAvatarProps = avatarProps;\n if (!badgeUrl && !badgeStatusIcon && ariaLabel) {\n updatedAvatarProps = { ...updatedAvatarProps, 'aria-label': ariaLabel };\n }\n if (url && !hasImageLoadError) {\n return {\n type: AvatarType.THUMBNAIL,\n children: <img src={url} alt=\"\" onError={() => setImageLoadError(true)} />,\n ...updatedAvatarProps,\n };\n }\n if (profileType) {\n return {\n type: AvatarType.ICON,\n children: isBusinessProfile ? <BriefcaseIcon size=\"24\" /> : <ProfileIcon size=\"24\" />,\n ...updatedAvatarProps,\n };\n }\n if (name) {\n return {\n type: AvatarType.INITIALS,\n children: <>{getInitials(name)}</>,\n backgroundColorSeed: profileId?.toString(),\n ...updatedAvatarProps,\n };\n }\n return {\n type: AvatarType.ICON,\n children: <ProfileIcon size=\"24\" />,\n ...updatedAvatarProps,\n };\n };\n\n return (\n <OptionalBadge\n url={badgeUrl}\n ariaLabel={ariaLabel}\n altText={badgeAltText}\n statusIcon={badgeStatusIcon}\n {...badgeProps}\n >\n <Avatar size={Size.MEDIUM} {...getAvatarProps()} />\n </OptionalBadge>\n );\n};\n\nexport default AvatarWrapper;\n"],"names":["OptionalBadge","url","altText","statusIcon","children","ariaLabel","rest","_jsx","Badge","badge","src","alt","StatusIcon","sentiment","size","Size","SMALL","_Fragment","AvatarWrapper","profileType","profileId","badgeUrl","badgeAltText","badgeStatusIcon","name","avatarProps","badgeProps","hasImageLoadError","setImageLoadError","useState","isBusinessProfile","ProfileType","BUSINESS","useEffect","getAvatarProps","updatedAvatarProps","type","AvatarType","THUMBNAIL","onError","ICON","BriefcaseIcon","ProfileIcon","INITIALS","getInitials","backgroundColorSeed","toString","Avatar","MEDIUM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,aAAa,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,CAACpB,IAAI,CAAA;AAAC,SAAI,CAAA;AAClCqB,QAAAA,mBAAmB,EAAEzB,SAAS,EAAE0B,QAAQ,EAAE;QAC1C,GAAGX,kBAAAA;OACJ,CAAA;AACH,KAAA;IACA,OAAO;MACLC,IAAI,EAAEC,sBAAU,CAACG,IAAI;MACrBpC,QAAQ,eAAEG,cAAA,CAACmC,YAAW,EAAA;AAAC5B,QAAAA,IAAI,EAAC,IAAA;AAAI,OAAG,CAAA;MACnC,GAAGqB,kBAAAA;KACJ,CAAA;GACF,CAAA;EAED,oBACE5B,cAAA,CAACP,aAAa,EAAA;AACZC,IAAAA,GAAG,EAAEoB,QAAS;AACdhB,IAAAA,SAAS,EAAEA,SAAU;AACrBH,IAAAA,OAAO,EAAEoB,YAAa;AACtBnB,IAAAA,UAAU,EAAEoB,eAAgB;AAAA,IAAA,GACxBG,UAAU;IAAAtB,QAAA,eAEdG,cAAA,CAACwC,cAAM,EAAA;MAACjC,IAAI,EAAEC,SAAI,CAACiC,MAAO;AAAA,MAAA,GAAKd,cAAc,EAAA;KAC/C,CAAA;AAAA,GAAe,CAAC,CAAA;AAEpB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarWrapper.mjs","sources":["../../src/avatarWrapper/AvatarWrapper.tsx"],"sourcesContent":["import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';\nimport { useState, useEffect } from 'react';\n\nimport Avatar, { AvatarProps, AvatarType } from '../avatar';\nimport Badge, { BadgeProps } from '../badge';\nimport {\n ProfileType,\n ProfileTypePersonal,\n ProfileTypeBusiness,\n Size,\n Sentiment,\n getInitials,\n
|
|
1
|
+
{"version":3,"file":"AvatarWrapper.mjs","sources":["../../src/avatarWrapper/AvatarWrapper.tsx"],"sourcesContent":["import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';\nimport { useState, useEffect } from 'react';\n\nimport Avatar, { AvatarProps, AvatarType } from '../avatar';\nimport Badge, { BadgeProps } from '../badge';\nimport {\n ProfileType,\n ProfileTypePersonal,\n ProfileTypeBusiness,\n Size,\n Sentiment,\n getInitials,\n} from '../common';\nimport StatusIcon from '../statusIcon/StatusIcon';\n\ninterface OptionalBadgeProps extends Omit<BadgeProps, 'badge'> {\n url?: string;\n ariaLabel?: string;\n altText?: string;\n statusIcon?: Sentiment;\n}\n\nconst OptionalBadge = ({\n url,\n altText,\n statusIcon,\n children,\n ariaLabel,\n ...rest\n}: OptionalBadgeProps) => {\n if (url) {\n return (\n <Badge aria-label={ariaLabel} badge={<img src={url} alt={altText} />} {...rest}>\n {children}\n </Badge>\n );\n }\n if (statusIcon) {\n return (\n <Badge\n aria-label={ariaLabel}\n badge={<StatusIcon sentiment={statusIcon} size={Size.SMALL} />}\n {...rest}\n >\n {children}\n </Badge>\n );\n }\n return <>{children}</>;\n};\n\nexport type AvatarWrapperProps = {\n url?: string;\n 'aria-label'?: string;\n profileType?: ProfileTypeBusiness | ProfileTypePersonal;\n profileId?: string;\n name?: string;\n avatarProps?: AvatarProps;\n badgeProps?: BadgeProps;\n} & (\n | {\n badgeUrl: string;\n badgeAltText: string;\n badgeStatusIcon?: never;\n }\n | {\n badgeUrl?: never;\n badgeAltText?: never;\n badgeStatusIcon: Sentiment;\n }\n | {\n badgeUrl?: never;\n badgeAltText?: never;\n badgeStatusIcon?: never;\n }\n);\n\n/**\n * @deprecated Use `AvatarView` component instead\n */\nconst AvatarWrapper = ({\n url,\n 'aria-label': ariaLabel,\n profileType,\n profileId,\n badgeUrl,\n badgeAltText,\n badgeStatusIcon,\n name,\n avatarProps,\n badgeProps,\n}: AvatarWrapperProps) => {\n const [hasImageLoadError, setImageLoadError] = useState(false);\n const isBusinessProfile = profileType === ProfileType.BUSINESS;\n\n // Reset the errored state when url changes\n useEffect(() => setImageLoadError(false), [url]);\n\n const getAvatarProps = () => {\n let updatedAvatarProps = avatarProps;\n if (!badgeUrl && !badgeStatusIcon && ariaLabel) {\n updatedAvatarProps = { ...updatedAvatarProps, 'aria-label': ariaLabel };\n }\n if (url && !hasImageLoadError) {\n return {\n type: AvatarType.THUMBNAIL,\n children: <img src={url} alt=\"\" onError={() => setImageLoadError(true)} />,\n ...updatedAvatarProps,\n };\n }\n if (profileType) {\n return {\n type: AvatarType.ICON,\n children: isBusinessProfile ? <BriefcaseIcon size=\"24\" /> : <ProfileIcon size=\"24\" />,\n ...updatedAvatarProps,\n };\n }\n if (name) {\n return {\n type: AvatarType.INITIALS,\n children: <>{getInitials(name)}</>,\n backgroundColorSeed: profileId?.toString(),\n ...updatedAvatarProps,\n };\n }\n return {\n type: AvatarType.ICON,\n children: <ProfileIcon size=\"24\" />,\n ...updatedAvatarProps,\n };\n };\n\n return (\n <OptionalBadge\n url={badgeUrl}\n ariaLabel={ariaLabel}\n altText={badgeAltText}\n statusIcon={badgeStatusIcon}\n {...badgeProps}\n >\n <Avatar size={Size.MEDIUM} {...getAvatarProps()} />\n </OptionalBadge>\n );\n};\n\nexport default AvatarWrapper;\n"],"names":["OptionalBadge","url","altText","statusIcon","children","ariaLabel","rest","_jsx","Badge","badge","src","alt","StatusIcon","sentiment","size","Size","SMALL","_Fragment","AvatarWrapper","profileType","profileId","badgeUrl","badgeAltText","badgeStatusIcon","name","avatarProps","badgeProps","hasImageLoadError","setImageLoadError","useState","isBusinessProfile","ProfileType","BUSINESS","useEffect","getAvatarProps","updatedAvatarProps","type","AvatarType","THUMBNAIL","onError","ICON","BriefcaseIcon","ProfileIcon","INITIALS","getInitials","backgroundColorSeed","toString","Avatar","MEDIUM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,aAAa,GAAGA,CAAC;EACrBC,GAAG;EACHC,OAAO;EACPC,UAAU;EACVC,QAAQ;EACRC,SAAS;EACT,GAAGC,IAAAA;AAAI,CACY,KAAI;AACvB,EAAA,IAAIL,GAAG,EAAE;IACP,oBACEM,GAAA,CAACC,KAAK,EAAA;AAAC,MAAA,YAAA,EAAY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EG,GAAA,CAACmC,MAAW,EAAA;AAAC5B,QAAAA,IAAI,EAAC,IAAA;AAAI,OAAG,CAAA;MACnC,GAAGqB,kBAAAA;KACJ,CAAA;GACF,CAAA;EAED,oBACE5B,GAAA,CAACP,aAAa,EAAA;AACZC,IAAAA,GAAG,EAAEoB,QAAS;AACdhB,IAAAA,SAAS,EAAEA,SAAU;AACrBH,IAAAA,OAAO,EAAEoB,YAAa;AACtBnB,IAAAA,UAAU,EAAEoB,eAAgB;AAAA,IAAA,GACxBG,UAAU;IAAAtB,QAAA,eAEdG,GAAA,CAACwC,MAAM,EAAA;MAACjC,IAAI,EAAEC,IAAI,CAACiC,MAAO;AAAA,MAAA,GAAKd,cAAc,EAAA;KAC/C,CAAA;AAAA,GAAe,CAAC,CAAA;AAEpB;;;;"}
|
|
@@ -6,7 +6,6 @@ exports.Sentiment = void 0;
|
|
|
6
6
|
Sentiment["NEUTRAL"] = "neutral";
|
|
7
7
|
Sentiment["POSITIVE"] = "positive";
|
|
8
8
|
Sentiment["WARNING"] = "warning";
|
|
9
|
-
// remove when all instances of Sentiment.PENDING have been updated to Status.PENDING
|
|
10
9
|
Sentiment["PENDING"] = "pending";
|
|
11
10
|
/**
|
|
12
11
|
* @deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment.js","sources":["../../../src/common/propsValues/sentiment.ts"],"sourcesContent":["export enum Sentiment {\n NEGATIVE = 'negative',\n NEUTRAL = 'neutral',\n POSITIVE = 'positive',\n WARNING = 'warning',\n
|
|
1
|
+
{"version":3,"file":"sentiment.js","sources":["../../../src/common/propsValues/sentiment.ts"],"sourcesContent":["export enum Sentiment {\n NEGATIVE = 'negative',\n NEUTRAL = 'neutral',\n POSITIVE = 'positive',\n WARNING = 'warning',\n PENDING = 'pending',\n\n /**\n * @deprecated\n */\n INFO = 'info',\n /**\n * @deprecated\n */\n ERROR = 'error',\n /**\n * @deprecated\n */\n SUCCESS = 'success',\n}\n"],"names":["Sentiment"],"mappings":";;AAAYA,2BAmBX;AAnBD,CAAA,UAAYA,SAAS,EAAA;AACnBA,EAAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrBA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrBA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AAEnB;;AAEG;AACHA,EAAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb;;AAEG;AACHA,EAAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf;;AAEG;AACHA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAnBWA,iBAAS,KAATA,iBAAS,GAmBpB,EAAA,CAAA,CAAA;;"}
|
|
@@ -4,7 +4,6 @@ var Sentiment;
|
|
|
4
4
|
Sentiment["NEUTRAL"] = "neutral";
|
|
5
5
|
Sentiment["POSITIVE"] = "positive";
|
|
6
6
|
Sentiment["WARNING"] = "warning";
|
|
7
|
-
// remove when all instances of Sentiment.PENDING have been updated to Status.PENDING
|
|
8
7
|
Sentiment["PENDING"] = "pending";
|
|
9
8
|
/**
|
|
10
9
|
* @deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment.mjs","sources":["../../../src/common/propsValues/sentiment.ts"],"sourcesContent":["export enum Sentiment {\n NEGATIVE = 'negative',\n NEUTRAL = 'neutral',\n POSITIVE = 'positive',\n WARNING = 'warning',\n
|
|
1
|
+
{"version":3,"file":"sentiment.mjs","sources":["../../../src/common/propsValues/sentiment.ts"],"sourcesContent":["export enum Sentiment {\n NEGATIVE = 'negative',\n NEUTRAL = 'neutral',\n POSITIVE = 'positive',\n WARNING = 'warning',\n PENDING = 'pending',\n\n /**\n * @deprecated\n */\n INFO = 'info',\n /**\n * @deprecated\n */\n ERROR = 'error',\n /**\n * @deprecated\n */\n SUCCESS = 'success',\n}\n"],"names":["Sentiment"],"mappings":"IAAYA,UAmBX;AAnBD,CAAA,UAAYA,SAAS,EAAA;AACnBA,EAAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrBA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrBA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AAEnB;;AAEG;AACHA,EAAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb;;AAEG;AACHA,EAAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf;;AAEG;AACHA,EAAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAnBWA,SAAS,KAATA,SAAS,GAmBpB,EAAA,CAAA,CAAA;;;;"}
|
package/build/i18n/cs.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"neptune.Button.loadingAriaLabel": "načítání",
|
|
3
|
-
"neptune.Chips.ariaLabel": "
|
|
4
|
-
"neptune.ClearButton.ariaLabel": "
|
|
3
|
+
"neptune.Chips.ariaLabel": "Vyčistit {choice}",
|
|
4
|
+
"neptune.ClearButton.ariaLabel": "Vyčistit",
|
|
5
5
|
"neptune.CloseButton.ariaLabel": "Zavřít",
|
|
6
6
|
"neptune.DateInput.day.label": "Den",
|
|
7
7
|
"neptune.DateInput.day.placeholder": "DD",
|
|
@@ -47,25 +47,25 @@
|
|
|
47
47
|
"neptune.Upload.csWrongTypeMessage": "Tento formát souboru není podporován. Zkuste to znovu s jiným souborem",
|
|
48
48
|
"neptune.Upload.psButtonText": "Zrušit",
|
|
49
49
|
"neptune.Upload.psProcessingText": "Načítání...",
|
|
50
|
-
"neptune.Upload.retry": "
|
|
50
|
+
"neptune.Upload.retry": "Opakovat",
|
|
51
51
|
"neptune.Upload.usButtonText": "Nebo vyberte soubor",
|
|
52
|
-
"neptune.Upload.usDropMessage": "
|
|
52
|
+
"neptune.Upload.usDropMessage": "Pusťte sem soubor pro jeho nahrání",
|
|
53
53
|
"neptune.Upload.usPlaceholder": "Přetáhněte soubor menší než {maxSize} MB",
|
|
54
54
|
"neptune.UploadButton.allFileTypes": "Všechny typy souborů",
|
|
55
|
-
"neptune.UploadButton.dropFiles": "
|
|
56
|
-
"neptune.UploadButton.instructions": "{fileTypes}, menší než {size}
|
|
55
|
+
"neptune.UploadButton.dropFiles": "Pusťte sem soubor pro jeho nahrání",
|
|
56
|
+
"neptune.UploadButton.instructions": "{fileTypes}, menší než {size}MB",
|
|
57
57
|
"neptune.UploadButton.maximumFiles": "Max. počet souborů: {maxFiles}.",
|
|
58
58
|
"neptune.UploadButton.uploadFile": "Nahrát soubor",
|
|
59
59
|
"neptune.UploadButton.uploadFiles": "Nahrát soubory",
|
|
60
60
|
"neptune.UploadInput.deleteModalBody": "Odstraněním tohoto souboru jej smažete z našeho systému.",
|
|
61
61
|
"neptune.UploadInput.deleteModalCancelButtonText": "Zrušit",
|
|
62
62
|
"neptune.UploadInput.deleteModalConfirmButtonText": "Odstranit",
|
|
63
|
-
"neptune.UploadInput.deleteModalTitle": "
|
|
63
|
+
"neptune.UploadInput.deleteModalTitle": "Jistě chcete odstranit tento soubor?",
|
|
64
64
|
"neptune.UploadInput.fileIsTooLarge": "Soubor je příliš velký",
|
|
65
65
|
"neptune.UploadInput.fileTypeNotSupported": "Typ souboru není podporován",
|
|
66
66
|
"neptune.UploadInput.maximumFilesAlreadyUploaded": "Je nám líto, ale toto nahrání se nezdařilo, protože můžeme přijmout pouze {maxFilesAllowed} souborů najednou.",
|
|
67
|
-
"neptune.UploadItem.deleting": "
|
|
68
|
-
"neptune.UploadItem.removeFile": "
|
|
67
|
+
"neptune.UploadItem.deleting": "Mažeme...",
|
|
68
|
+
"neptune.UploadItem.removeFile": "Odstranit soubor {filename}",
|
|
69
69
|
"neptune.UploadItem.uploaded": "Nahráno",
|
|
70
70
|
"neptune.UploadItem.uploadedFile": "Nahraný soubor",
|
|
71
71
|
"neptune.UploadItem.uploading": "Nahrávání...",
|
package/build/i18n/cs.json.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var cs = {
|
|
6
6
|
"neptune.Button.loadingAriaLabel": "načítání",
|
|
7
|
-
"neptune.Chips.ariaLabel": "
|
|
8
|
-
"neptune.ClearButton.ariaLabel": "
|
|
7
|
+
"neptune.Chips.ariaLabel": "Vyčistit {choice}",
|
|
8
|
+
"neptune.ClearButton.ariaLabel": "Vyčistit",
|
|
9
9
|
"neptune.CloseButton.ariaLabel": "Zavřít",
|
|
10
10
|
"neptune.DateInput.day.label": "Den",
|
|
11
11
|
"neptune.DateInput.day.placeholder": "DD",
|
|
@@ -51,25 +51,25 @@ var cs = {
|
|
|
51
51
|
"neptune.Upload.csWrongTypeMessage": "Tento formát souboru není podporován. Zkuste to znovu s jiným souborem",
|
|
52
52
|
"neptune.Upload.psButtonText": "Zrušit",
|
|
53
53
|
"neptune.Upload.psProcessingText": "Načítání...",
|
|
54
|
-
"neptune.Upload.retry": "
|
|
54
|
+
"neptune.Upload.retry": "Opakovat",
|
|
55
55
|
"neptune.Upload.usButtonText": "Nebo vyberte soubor",
|
|
56
|
-
"neptune.Upload.usDropMessage": "
|
|
56
|
+
"neptune.Upload.usDropMessage": "Pusťte sem soubor pro jeho nahrání",
|
|
57
57
|
"neptune.Upload.usPlaceholder": "Přetáhněte soubor menší než {maxSize} MB",
|
|
58
58
|
"neptune.UploadButton.allFileTypes": "Všechny typy souborů",
|
|
59
|
-
"neptune.UploadButton.dropFiles": "
|
|
60
|
-
"neptune.UploadButton.instructions": "{fileTypes}, menší než {size}
|
|
59
|
+
"neptune.UploadButton.dropFiles": "Pusťte sem soubor pro jeho nahrání",
|
|
60
|
+
"neptune.UploadButton.instructions": "{fileTypes}, menší než {size}MB",
|
|
61
61
|
"neptune.UploadButton.maximumFiles": "Max. počet souborů: {maxFiles}.",
|
|
62
62
|
"neptune.UploadButton.uploadFile": "Nahrát soubor",
|
|
63
63
|
"neptune.UploadButton.uploadFiles": "Nahrát soubory",
|
|
64
64
|
"neptune.UploadInput.deleteModalBody": "Odstraněním tohoto souboru jej smažete z našeho systému.",
|
|
65
65
|
"neptune.UploadInput.deleteModalCancelButtonText": "Zrušit",
|
|
66
66
|
"neptune.UploadInput.deleteModalConfirmButtonText": "Odstranit",
|
|
67
|
-
"neptune.UploadInput.deleteModalTitle": "
|
|
67
|
+
"neptune.UploadInput.deleteModalTitle": "Jistě chcete odstranit tento soubor?",
|
|
68
68
|
"neptune.UploadInput.fileIsTooLarge": "Soubor je příliš velký",
|
|
69
69
|
"neptune.UploadInput.fileTypeNotSupported": "Typ souboru není podporován",
|
|
70
70
|
"neptune.UploadInput.maximumFilesAlreadyUploaded": "Je nám líto, ale toto nahrání se nezdařilo, protože můžeme přijmout pouze {maxFilesAllowed} souborů najednou.",
|
|
71
|
-
"neptune.UploadItem.deleting": "
|
|
72
|
-
"neptune.UploadItem.removeFile": "
|
|
71
|
+
"neptune.UploadItem.deleting": "Mažeme...",
|
|
72
|
+
"neptune.UploadItem.removeFile": "Odstranit soubor {filename}",
|
|
73
73
|
"neptune.UploadItem.uploaded": "Nahráno",
|
|
74
74
|
"neptune.UploadItem.uploadedFile": "Nahraný soubor",
|
|
75
75
|
"neptune.UploadItem.uploading": "Nahrávání...",
|
package/build/i18n/cs.json.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var cs = {
|
|
2
2
|
"neptune.Button.loadingAriaLabel": "načítání",
|
|
3
|
-
"neptune.Chips.ariaLabel": "
|
|
4
|
-
"neptune.ClearButton.ariaLabel": "
|
|
3
|
+
"neptune.Chips.ariaLabel": "Vyčistit {choice}",
|
|
4
|
+
"neptune.ClearButton.ariaLabel": "Vyčistit",
|
|
5
5
|
"neptune.CloseButton.ariaLabel": "Zavřít",
|
|
6
6
|
"neptune.DateInput.day.label": "Den",
|
|
7
7
|
"neptune.DateInput.day.placeholder": "DD",
|
|
@@ -47,25 +47,25 @@ var cs = {
|
|
|
47
47
|
"neptune.Upload.csWrongTypeMessage": "Tento formát souboru není podporován. Zkuste to znovu s jiným souborem",
|
|
48
48
|
"neptune.Upload.psButtonText": "Zrušit",
|
|
49
49
|
"neptune.Upload.psProcessingText": "Načítání...",
|
|
50
|
-
"neptune.Upload.retry": "
|
|
50
|
+
"neptune.Upload.retry": "Opakovat",
|
|
51
51
|
"neptune.Upload.usButtonText": "Nebo vyberte soubor",
|
|
52
|
-
"neptune.Upload.usDropMessage": "
|
|
52
|
+
"neptune.Upload.usDropMessage": "Pusťte sem soubor pro jeho nahrání",
|
|
53
53
|
"neptune.Upload.usPlaceholder": "Přetáhněte soubor menší než {maxSize} MB",
|
|
54
54
|
"neptune.UploadButton.allFileTypes": "Všechny typy souborů",
|
|
55
|
-
"neptune.UploadButton.dropFiles": "
|
|
56
|
-
"neptune.UploadButton.instructions": "{fileTypes}, menší než {size}
|
|
55
|
+
"neptune.UploadButton.dropFiles": "Pusťte sem soubor pro jeho nahrání",
|
|
56
|
+
"neptune.UploadButton.instructions": "{fileTypes}, menší než {size}MB",
|
|
57
57
|
"neptune.UploadButton.maximumFiles": "Max. počet souborů: {maxFiles}.",
|
|
58
58
|
"neptune.UploadButton.uploadFile": "Nahrát soubor",
|
|
59
59
|
"neptune.UploadButton.uploadFiles": "Nahrát soubory",
|
|
60
60
|
"neptune.UploadInput.deleteModalBody": "Odstraněním tohoto souboru jej smažete z našeho systému.",
|
|
61
61
|
"neptune.UploadInput.deleteModalCancelButtonText": "Zrušit",
|
|
62
62
|
"neptune.UploadInput.deleteModalConfirmButtonText": "Odstranit",
|
|
63
|
-
"neptune.UploadInput.deleteModalTitle": "
|
|
63
|
+
"neptune.UploadInput.deleteModalTitle": "Jistě chcete odstranit tento soubor?",
|
|
64
64
|
"neptune.UploadInput.fileIsTooLarge": "Soubor je příliš velký",
|
|
65
65
|
"neptune.UploadInput.fileTypeNotSupported": "Typ souboru není podporován",
|
|
66
66
|
"neptune.UploadInput.maximumFilesAlreadyUploaded": "Je nám líto, ale toto nahrání se nezdařilo, protože můžeme přijmout pouze {maxFilesAllowed} souborů najednou.",
|
|
67
|
-
"neptune.UploadItem.deleting": "
|
|
68
|
-
"neptune.UploadItem.removeFile": "
|
|
67
|
+
"neptune.UploadItem.deleting": "Mažeme...",
|
|
68
|
+
"neptune.UploadItem.removeFile": "Odstranit soubor {filename}",
|
|
69
69
|
"neptune.UploadItem.uploaded": "Nahráno",
|
|
70
70
|
"neptune.UploadItem.uploadedFile": "Nahraný soubor",
|
|
71
71
|
"neptune.UploadItem.uploading": "Nahrávání...",
|
package/build/index.js
CHANGED
|
@@ -274,6 +274,7 @@ Object.defineProperty(exports, "UploadStep", {
|
|
|
274
274
|
get: function () { return Upload.UploadStep; }
|
|
275
275
|
});
|
|
276
276
|
exports.UploadInput = UploadInput.default;
|
|
277
|
+
exports.Item = Table.default;
|
|
277
278
|
exports.Table = Table.default;
|
|
278
279
|
exports.useDirection = useDirection.useDirection;
|
|
279
280
|
exports.useLayout = useLayout.useLayout;
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.mjs
CHANGED
|
@@ -105,7 +105,7 @@ export { default as Tooltip } from './tooltip/Tooltip.mjs';
|
|
|
105
105
|
export { default as Typeahead } from './typeahead/Typeahead.mjs';
|
|
106
106
|
export { default as Upload, UploadStep } from './upload/Upload.mjs';
|
|
107
107
|
export { default as UploadInput } from './uploadInput/UploadInput.mjs';
|
|
108
|
-
export { default as Table } from './table/Table.mjs';
|
|
108
|
+
export { default as Item, default as Table } from './table/Table.mjs';
|
|
109
109
|
import '@transferwise/neptune-validation';
|
|
110
110
|
export { useDirection } from './common/hooks/useDirection/useDirection.mjs';
|
|
111
111
|
export { useLayout } from './common/hooks/useLayout/useLayout.mjs';
|
package/build/main.css
CHANGED
|
@@ -2585,6 +2585,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2585
2585
|
line-height: 1.2;
|
|
2586
2586
|
line-height: var(--line-height-title);
|
|
2587
2587
|
letter-spacing: 0;
|
|
2588
|
+
-webkit-hyphens: auto;
|
|
2589
|
+
hyphens: auto;
|
|
2588
2590
|
margin-bottom: 0;
|
|
2589
2591
|
margin-bottom: initial;
|
|
2590
2592
|
font-size: 1.375rem;
|
|
@@ -2596,36 +2598,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2596
2598
|
height: 72px !important;
|
|
2597
2599
|
height: var(--size-72) !important;
|
|
2598
2600
|
}
|
|
2599
|
-
@supports (hyphenate-limit-chars: 1) {
|
|
2600
|
-
.np-form-control--size-lg {
|
|
2601
|
-
-webkit-hyphens: auto;
|
|
2602
|
-
hyphens: auto;
|
|
2603
|
-
hyphenate-limit-chars: 7 3;
|
|
2604
|
-
}
|
|
2605
|
-
@media (min-width: 768px) {
|
|
2606
|
-
.np-form-control--size-lg {
|
|
2607
|
-
hyphenate-limit-chars: 8 3;
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
@media (min-width: 992px) {
|
|
2611
|
-
.np-form-control--size-lg {
|
|
2612
|
-
hyphenate-limit-chars: 10 4 3;
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
2617
|
-
.np-form-control--size-lg {
|
|
2618
|
-
-webkit-hyphens: auto;
|
|
2619
|
-
hyphens: auto;
|
|
2620
|
-
-webkit-hyphenate-limit-before: 3;
|
|
2621
|
-
-webkit-hyphenate-limit-after: 3;
|
|
2622
|
-
}
|
|
2623
|
-
@media (min-width: 992px) {
|
|
2624
|
-
.np-form-control--size-lg {
|
|
2625
|
-
-webkit-hyphenate-limit-before: 4;
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
2601
|
.np-form-control--size-lg + p,
|
|
2630
2602
|
.np-form-control--size-lg + ul:not(.list-unstyled),
|
|
2631
2603
|
.np-form-control--size-lg + ol:not(.list-unstyled) {
|
|
@@ -2648,6 +2620,74 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2648
2620
|
border-radius: 9999px !important;
|
|
2649
2621
|
border-radius: var(--radius-full) !important;
|
|
2650
2622
|
}
|
|
2623
|
+
.np-item {
|
|
2624
|
+
padding: 16px;
|
|
2625
|
+
padding: var(--size-16);
|
|
2626
|
+
border-radius: 24px;
|
|
2627
|
+
border-radius: var(--radius-large);
|
|
2628
|
+
background-color: #ffffff;
|
|
2629
|
+
background-color: var(--color-background-screen);
|
|
2630
|
+
display: flex;
|
|
2631
|
+
gap: 16px;
|
|
2632
|
+
gap: var(--size-16);
|
|
2633
|
+
align-items: center;
|
|
2634
|
+
flex-direction: row;
|
|
2635
|
+
cursor: pointer;
|
|
2636
|
+
}
|
|
2637
|
+
.np-item:hover {
|
|
2638
|
+
background-color: var(--color-background-screen-hover);
|
|
2639
|
+
}
|
|
2640
|
+
.np-item:active {
|
|
2641
|
+
background-color: var(--color-background-screen-active);
|
|
2642
|
+
}
|
|
2643
|
+
.np-item-media {
|
|
2644
|
+
flex: 0 0 auto;
|
|
2645
|
+
align-items: flex-start;
|
|
2646
|
+
}
|
|
2647
|
+
.np-item-media-image {
|
|
2648
|
+
width: var(--item-media-image-size);
|
|
2649
|
+
height: var(--item-media-image-size);
|
|
2650
|
+
}
|
|
2651
|
+
.np-item-title {
|
|
2652
|
+
color: #37517e;
|
|
2653
|
+
color: var(--color-content-primary);
|
|
2654
|
+
}
|
|
2655
|
+
.np-item-additional-info {
|
|
2656
|
+
color: #768e9c;
|
|
2657
|
+
color: var(--color-content-tertiary);
|
|
2658
|
+
}
|
|
2659
|
+
.np-item-value {
|
|
2660
|
+
flex: 0 0 auto;
|
|
2661
|
+
}
|
|
2662
|
+
.np-item-control {
|
|
2663
|
+
flex: 0 0 auto;
|
|
2664
|
+
}
|
|
2665
|
+
.np-item-spotlight-active {
|
|
2666
|
+
background-color: rgba(134,167,189,0.10196);
|
|
2667
|
+
background-color: var(--color-background-neutral);
|
|
2668
|
+
}
|
|
2669
|
+
.np-item-spotlight-active:hover {
|
|
2670
|
+
background-color: var(--color-background-neutral-hover);
|
|
2671
|
+
}
|
|
2672
|
+
.np-item-spotlight-active:active {
|
|
2673
|
+
background-color: var(--color-background-neutral-active);
|
|
2674
|
+
}
|
|
2675
|
+
.np-item-spotlight-inactive {
|
|
2676
|
+
background-color: rgba(134, 167, 189, 0.025);
|
|
2677
|
+
border: 1px dashed rgba(0,0,0,0.10196);
|
|
2678
|
+
border: 1px dashed var(--color-border-neutral);
|
|
2679
|
+
}
|
|
2680
|
+
@supports (color: color-mix(in lch, red, blue)) {
|
|
2681
|
+
.np-item-spotlight-inactive {
|
|
2682
|
+
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
.np-item-spotlight-inactive:hover {
|
|
2686
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
2687
|
+
}
|
|
2688
|
+
.np-item-spotlight-inactive:active {
|
|
2689
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
2690
|
+
}
|
|
2651
2691
|
.np-field-control {
|
|
2652
2692
|
margin-top: 4px;
|
|
2653
2693
|
margin-top: var(--size-4);
|
|
@@ -4051,6 +4091,8 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4051
4091
|
line-height: 1.2;
|
|
4052
4092
|
line-height: var(--line-height-title);
|
|
4053
4093
|
letter-spacing: 0;
|
|
4094
|
+
-webkit-hyphens: auto;
|
|
4095
|
+
hyphens: auto;
|
|
4054
4096
|
margin-bottom: 0;
|
|
4055
4097
|
margin-bottom: initial;
|
|
4056
4098
|
font-weight: 600;
|
|
@@ -4060,36 +4102,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4060
4102
|
letter-spacing: -0.02em;
|
|
4061
4103
|
line-height: 122%;
|
|
4062
4104
|
}
|
|
4063
|
-
@supports (hyphenate-limit-chars: 1) {
|
|
4064
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4065
|
-
-webkit-hyphens: auto;
|
|
4066
|
-
hyphens: auto;
|
|
4067
|
-
hyphenate-limit-chars: 7 3;
|
|
4068
|
-
}
|
|
4069
|
-
@media (min-width: 768px) {
|
|
4070
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4071
|
-
hyphenate-limit-chars: 8 3;
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
@media (min-width: 992px) {
|
|
4075
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4076
|
-
hyphenate-limit-chars: 10 4 3;
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
4081
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4082
|
-
-webkit-hyphens: auto;
|
|
4083
|
-
hyphens: auto;
|
|
4084
|
-
-webkit-hyphenate-limit-before: 3;
|
|
4085
|
-
-webkit-hyphenate-limit-after: 3;
|
|
4086
|
-
}
|
|
4087
|
-
@media (min-width: 992px) {
|
|
4088
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4089
|
-
-webkit-hyphenate-limit-before: 4;
|
|
4090
|
-
}
|
|
4091
|
-
}
|
|
4092
|
-
}
|
|
4093
4105
|
.np-popover__container.np-bottom-sheet .np-popover__title + p,
|
|
4094
4106
|
.np-popover__container.np-bottom-sheet .np-popover__title + ul:not(.list-unstyled),
|
|
4095
4107
|
.np-popover__container.np-bottom-sheet .np-popover__title + ol:not(.list-unstyled) {
|
|
@@ -17,7 +17,7 @@ require('../common/propsValues/dateMode.js');
|
|
|
17
17
|
require('../common/propsValues/monthFormat.js');
|
|
18
18
|
require('../common/propsValues/position.js');
|
|
19
19
|
require('../common/propsValues/layouts.js');
|
|
20
|
-
|
|
20
|
+
require('../common/propsValues/status.js');
|
|
21
21
|
var sentiment = require('../common/propsValues/sentiment.js');
|
|
22
22
|
require('../common/propsValues/profileType.js');
|
|
23
23
|
require('../common/propsValues/variant.js');
|
|
@@ -55,7 +55,7 @@ const StatusIcon = ({
|
|
|
55
55
|
Icon: icons.Alert,
|
|
56
56
|
defaultIconLabel: intl.formatMessage(StatusIcon_messages.default.warningLabel)
|
|
57
57
|
},
|
|
58
|
-
[
|
|
58
|
+
[sentiment.Sentiment.PENDING]: {
|
|
59
59
|
Icon: icons.ClockBorderless,
|
|
60
60
|
defaultIconLabel: intl.formatMessage(StatusIcon_messages.default.pendingLabel)
|
|
61
61
|
},
|