@transferwise/components 0.0.0-experimental-11c630d → 0.0.0-experimental-50dbef7

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.
Files changed (59) hide show
  1. package/build/common/card/Card.js.map +1 -1
  2. package/build/common/card/Card.mjs.map +1 -1
  3. package/build/field/Field.js +1 -1
  4. package/build/field/Field.js.map +1 -1
  5. package/build/field/Field.mjs +1 -1
  6. package/build/field/Field.mjs.map +1 -1
  7. package/build/index.js +1 -2
  8. package/build/index.js.map +1 -1
  9. package/build/index.mjs +1 -1
  10. package/build/moneyInput/MoneyInput.js +3 -8
  11. package/build/moneyInput/MoneyInput.js.map +1 -1
  12. package/build/moneyInput/MoneyInput.mjs +3 -8
  13. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  14. package/build/promoCard/PromoCardGroup.js.map +1 -1
  15. package/build/promoCard/PromoCardGroup.mjs.map +1 -1
  16. package/build/promoCard/PromoCardIndicator.js.map +1 -1
  17. package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
  18. package/build/sticky/Sticky.js.map +1 -1
  19. package/build/sticky/Sticky.mjs.map +1 -1
  20. package/build/types/common/card/Card.d.ts +1 -1
  21. package/build/types/index.d.ts +0 -4
  22. package/build/types/index.d.ts.map +1 -1
  23. package/build/types/moneyInput/MoneyInput.d.ts +3 -7
  24. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  25. package/build/types/promoCard/PromoCardIndicator.d.ts +1 -1
  26. package/build/types/sticky/Sticky.d.ts +1 -1
  27. package/build/types/uploadInput/uploadItem/UploadItem.d.ts +1 -1
  28. package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
  29. package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
  30. package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
  31. package/package.json +3 -3
  32. package/src/common/card/Card.tsx +1 -1
  33. package/src/field/Field.spec.tsx +1 -1
  34. package/src/field/Field.story.tsx +19 -8
  35. package/src/field/Field.tsx +1 -1
  36. package/src/index.ts +2 -5
  37. package/src/moneyInput/MoneyInput.spec.js +6 -19
  38. package/src/moneyInput/MoneyInput.story.tsx +9 -7
  39. package/src/moneyInput/MoneyInput.tsx +5 -8
  40. package/src/promoCard/PromoCardGroup.tsx +1 -1
  41. package/src/promoCard/PromoCardIndicator.tsx +1 -1
  42. package/src/sticky/Sticky.tsx +1 -1
  43. package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
  44. package/build/types/withId/index.d.ts +0 -3
  45. package/build/types/withId/index.d.ts.map +0 -1
  46. package/build/types/withId/story/source.d.ts +0 -2
  47. package/build/types/withId/story/source.d.ts.map +0 -1
  48. package/build/types/withId/withId.d.ts +0 -17
  49. package/build/types/withId/withId.d.ts.map +0 -1
  50. package/build/withId/withId.js +0 -19
  51. package/build/withId/withId.js.map +0 -1
  52. package/build/withId/withId.mjs +0 -17
  53. package/build/withId/withId.mjs.map +0 -1
  54. package/src/withId/index.ts +0 -2
  55. package/src/withId/story/source.tsx +0 -22
  56. package/src/withId/withId.docs.mdx +0 -24
  57. package/src/withId/withId.spec.tsx +0 -26
  58. package/src/withId/withId.story.tsx +0 -38
  59. package/src/withId/withId.tsx +0 -29
@@ -1 +1 @@
1
- {"version":3,"file":"MoneyInput.mjs","sources":["../../src/moneyInput/MoneyInput.tsx"],"sourcesContent":["import { isEmpty, isNumber, isNull } from '@transferwise/neptune-validation';\nimport { Flag } from '@wise/art';\nimport { clsx } from 'clsx';\nimport { Component } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport { Typography, Size, SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { withInputAttributes, WithInputAttributesProps } from '../inputs/contexts';\nimport { Input } from '../inputs/Input';\nimport {\n SelectInput,\n SelectInputItem,\n SelectInputOptionContent,\n SelectInputOptionItem,\n SelectInputProps,\n} from '../inputs/SelectInput';\nimport Title from '../title';\n\nimport messages from './MoneyInput.messages';\nimport { formatAmount, parseAmount } from './currencyFormatting';\nimport withId from '../withId';\n\nexport interface CurrencyOptionItem {\n header?: never;\n value: string;\n label: string;\n currency: string;\n note?: string;\n searchable?: string;\n}\n\nexport interface CurrencyHeaderItem {\n header: string;\n}\n\nexport type CurrencyItem = CurrencyOptionItem | CurrencyHeaderItem;\n\nconst isNumberOrNull = (v: unknown): v is number | null => isNumber(v) || isNull(v);\n\nconst formatAmountIfSet = ({\n amount,\n currency,\n locale,\n}: {\n amount: number | null | undefined;\n currency: string;\n locale: string;\n}) => {\n return typeof amount === 'number' ? formatAmount(amount, currency, locale) : '';\n};\n\nconst parseNumber = ({\n amount,\n currency,\n locale,\n}: {\n amount: string;\n currency: string;\n locale: string;\n}) => {\n return parseAmount(amount, currency, locale);\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Escape',\n 'Tab',\n]);\n\nexport interface MoneyInputProps extends WrappedComponentProps {\n id?: string;\n 'aria-labelledby'?: string;\n currencies: readonly CurrencyItem[];\n selectedCurrency: CurrencyOptionItem;\n onCurrencyChange?: (value: CurrencyOptionItem) => void;\n placeholder?: number;\n amount: number | null;\n size?: SizeSmall | SizeMedium | SizeLarge;\n onAmountChange?: (value: number | null) => void;\n addon?: React.ReactNode;\n searchPlaceholder?: string;\n /**\n * Allows the consumer to react to searching, while the search itself is handled internally.\n */\n onSearchChange?: (value: { searchQuery: string; filteredOptions: CurrencyItem[] }) => void;\n customActionLabel?: React.ReactNode;\n onCustomAction?: () => void;\n classNames?: Record<string, string>;\n selectProps?: Partial<SelectInputProps<CurrencyOptionItem>>;\n}\n\ntype MoneyInputPropsWithInputAttributes = MoneyInputProps & Partial<WithInputAttributesProps>;\n\ninterface MoneyInputState {\n searchQuery: string;\n formattedAmount: string;\n locale: string;\n}\n\nclass MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInputState> {\n declare props: MoneyInputPropsWithInputAttributes &\n Required<Pick<MoneyInputPropsWithInputAttributes, keyof typeof MoneyInput.defaultProps>>;\n\n static defaultProps = {\n size: Size.LARGE,\n classNames: {},\n selectProps: {},\n } satisfies Partial<MoneyInputPropsWithInputAttributes>;\n\n amountFocused = false;\n\n constructor(props: MoneyInputProps) {\n super(props);\n this.state = {\n searchQuery: '',\n formattedAmount: formatAmountIfSet({\n amount: props.amount,\n currency: props.selectedCurrency.currency,\n locale: props.intl.locale,\n }),\n locale: props.intl.locale,\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps: MoneyInputProps) {\n this.setState({ locale: nextProps.intl.locale });\n\n if (!this.amountFocused) {\n this.setState({\n formattedAmount: formatAmountIfSet({\n amount: nextProps.amount,\n currency: nextProps.selectedCurrency.currency,\n locale: nextProps.intl.locale,\n }),\n });\n }\n }\n\n isInputAllowedForKeyEvent = (event: React.KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = event;\n const isNumberKey = isNumber(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n };\n\n handleKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (!this.isInputAllowedForKeyEvent(event)) {\n event.preventDefault();\n }\n };\n\n handlePaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n const paste = event.clipboardData.getData('text');\n const { locale } = this.state;\n const parsed = isEmpty(paste)\n ? null\n : parseNumber({\n amount: paste,\n currency: this.props.selectedCurrency.currency,\n locale,\n });\n\n if (isNumberOrNull(parsed)) {\n this.setState({\n formattedAmount: formatAmountIfSet({\n amount: parsed,\n currency: this.props.selectedCurrency.currency,\n locale,\n }),\n });\n this.props.onAmountChange?.(parsed);\n }\n\n event.preventDefault();\n };\n\n onAmountChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n const { value } = event.target;\n this.setState({\n formattedAmount: value,\n });\n const parsed = isEmpty(value)\n ? null\n : parseNumber({\n amount: value,\n currency: this.props.selectedCurrency.currency,\n locale: this.state.locale,\n });\n if (isNumberOrNull(parsed)) {\n this.props.onAmountChange?.(parsed);\n }\n };\n\n onAmountBlur = () => {\n this.amountFocused = false;\n this.setAmount();\n };\n\n onAmountFocus = () => {\n this.amountFocused = true;\n };\n\n getSelectOptions() {\n const selectOptions = filterCurrenciesForQuery(this.props.currencies, this.state.searchQuery);\n\n const formattedOptions: SelectInputItem<CurrencyOptionItem>[] = [];\n let currentGroupOptions: SelectInputOptionItem<CurrencyOptionItem>[] | undefined;\n\n selectOptions.forEach((item) => {\n if (item.header != null) {\n currentGroupOptions = [];\n formattedOptions.push({\n type: 'group',\n label: item.header,\n options: currentGroupOptions,\n });\n } else {\n (currentGroupOptions ?? formattedOptions).push({\n type: 'option',\n value: item,\n filterMatchers: [item.value, item.label, item.note ?? '', item.searchable ?? ''],\n });\n }\n });\n\n return formattedOptions;\n }\n\n setAmount() {\n this.setState((previousState) => {\n const parsed = parseNumber({\n amount: previousState.formattedAmount,\n currency: this.props.selectedCurrency.currency,\n locale: previousState.locale,\n });\n if (!isNumberOrNull(parsed)) {\n return {\n formattedAmount: previousState.formattedAmount,\n };\n }\n return {\n formattedAmount: formatAmountIfSet({\n amount: parsed,\n currency: this.props.selectedCurrency.currency,\n locale: previousState.locale,\n }),\n };\n });\n }\n\n handleSelectChange = (value: CurrencyOptionItem) => {\n this.handleSearchChange('');\n this.props.onCurrencyChange?.(value);\n };\n\n handleCustomAction = () => {\n this.handleSearchChange('');\n this.props.onCustomAction?.();\n };\n\n handleSearchChange = (searchQuery: string) => {\n this.setState({ searchQuery });\n this.props.onSearchChange?.({\n searchQuery,\n filteredOptions: filterCurrenciesForQuery(this.props.currencies, searchQuery),\n });\n };\n\n style = (className: string) => this.props.classNames[className] || className;\n\n render() {\n const {\n inputAttributes,\n id: amountInputId,\n 'aria-labelledby': ariaLabelledByProp,\n selectedCurrency,\n onCurrencyChange,\n size,\n addon,\n selectProps,\n } = this.props;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];\n const selectOptions = this.getSelectOptions();\n\n const hasSingleCurrency = () => {\n if (selectOptions.length !== 0) {\n const firstItem = selectOptions[0];\n\n if (selectOptions.length === 1) {\n if (firstItem.type === 'option') {\n return firstItem.value.currency === selectedCurrency.currency;\n }\n if (firstItem.type === 'group') {\n return (\n firstItem.options.length === 1 &&\n !(this.props.onCustomAction && this.props.customActionLabel)\n );\n }\n }\n } else if (selectedCurrency?.currency) {\n return true;\n }\n\n return false;\n };\n\n const isFixedCurrency = (!this.state.searchQuery && hasSingleCurrency()) || !onCurrencyChange;\n const disabled = !this.props.onAmountChange;\n const currencyCurrencyElementId = `${amountInputId}currentCurrency:`;\n\n return (\n <div\n role=\"group\"\n {...inputAttributes}\n aria-labelledby={ariaLabelledBy}\n className={clsx(\n this.style('tw-money-input'),\n this.style('input-group'),\n this.style(`input-group-${size}`),\n )}\n >\n <Input\n id={amountInputId}\n value={this.state.formattedAmount}\n inputMode=\"decimal\"\n disabled={disabled}\n placeholder={formatAmountIfSet({\n amount: this.props.placeholder,\n currency: this.props.selectedCurrency.currency,\n locale: this.state.locale,\n })}\n autoComplete=\"off\"\n aria-describedby={currencyCurrencyElementId}\n onKeyDown={this.handleKeyDown}\n onChange={this.onAmountChange}\n onFocus={this.onAmountFocus}\n onBlur={this.onAmountBlur}\n onPaste={this.handlePaste}\n />\n {addon && (\n <span\n className={clsx(\n this.style('input-group-addon'),\n this.style(`input-${size}`),\n disabled ? this.style('disabled') : '',\n )}\n >\n {addon}\n </span>\n )}\n {isFixedCurrency ? (\n <div\n className={clsx(\n this.style('input-group-addon'),\n this.style(`input-${size}`),\n this.style('tw-money-input__fixed-currency'),\n disabled ? this.style('disabled') : '',\n )}\n id={currencyCurrencyElementId}\n >\n {(size === 'lg' || size === 'md') && (\n <span className={clsx(this.style('money-input-currency-flag'), this.style('m-r-2'))}>\n <Flag code={selectedCurrency.currency.toLowerCase()} intrinsicSize={24} />\n </span>\n )}\n <Title\n as=\"span\"\n type={Typography.TITLE_SUBSECTION}\n className={size === 'lg' ? this.style('m-r-1') : ''}\n >\n {selectedCurrency.currency.toUpperCase()}\n </Title>\n </div>\n ) : (\n <div\n className={clsx(\n this.style('input-group-btn'),\n this.style('amount-currency-select-btn'),\n )}\n >\n <SelectInput\n id={currencyCurrencyElementId}\n items={selectOptions}\n value={selectedCurrency}\n compareValues=\"currency\"\n renderValue={(currency, withinTrigger) => {\n return (\n <SelectInputOptionContent\n title={withinTrigger ? currency.currency.toUpperCase() : currency.label}\n note={withinTrigger ? undefined : currency.note}\n icon={<Flag code={currency.currency} intrinsicSize={24} />}\n />\n );\n }}\n renderFooter={\n this.props.onCustomAction\n ? () => (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div role=\"button\" tabIndex={0} onClick={this.handleCustomAction}>\n {this.props.customActionLabel}\n </div>\n )\n : undefined\n }\n placeholder={this.props.intl.formatMessage(messages.selectPlaceholder)}\n filterable\n filterPlaceholder={this.props.searchPlaceholder}\n disabled={disabled}\n size={size}\n onChange={this.handleSelectChange}\n onFilterChange={({ queryNormalized }) => {\n this.handleSearchChange(queryNormalized ?? '');\n }}\n {...selectProps}\n />\n </div>\n )}\n </div>\n );\n }\n}\n\nfunction filterCurrenciesForQuery(\n currencies: readonly CurrencyItem[],\n query: string,\n): CurrencyItem[] {\n if (!query) {\n return [...currencies];\n }\n\n const options = currencies.filter(\n (option): option is CurrencyOptionItem => option.header == null,\n );\n const filteredOptions = removeDuplicateValueOptions(options).filter((option) =>\n currencyOptionFitsQuery(option, query),\n );\n\n return sortOptionsLabelsToFirst(filteredOptions, query);\n}\n\nfunction removeDuplicateValueOptions(options: readonly CurrencyOptionItem[]) {\n const uniqueValues = new Set<string>();\n return options.filter((option) => {\n if (!uniqueValues.has(option.value)) {\n uniqueValues.add(option.value);\n return true;\n }\n return false;\n });\n}\n\nfunction currencyOptionFitsQuery(option: CurrencyOptionItem, query: string) {\n if (!option.value) {\n return false;\n }\n\n return (\n contains(option.label, query) ||\n contains(option.searchable, query) ||\n contains(option.note, query)\n );\n}\n\nfunction contains(property: string | undefined, query: string) {\n return property?.toLowerCase().includes(query.toLowerCase());\n}\n\nfunction sortOptionsLabelsToFirst(options: readonly CurrencyOptionItem[], query: string) {\n return [...options].sort((first, second) => {\n const firstContains = contains(first.label, query);\n const secondContains = contains(second.label, query);\n\n if (firstContains && secondContains) {\n return 0;\n }\n if (firstContains) {\n return -1;\n }\n if (secondContains) {\n return 1;\n }\n return 0;\n });\n}\n\nexport default injectIntl(withId(withInputAttributes(MoneyInput, { nonLabelable: true })));\n"],"names":["isNumberOrNull","v","isNumber","isNull","formatAmountIfSet","amount","currency","locale","formatAmount","parseNumber","parseAmount","allowedInputKeys","Set","MoneyInput","Component","defaultProps","size","Size","LARGE","classNames","selectProps","amountFocused","constructor","props","state","searchQuery","formattedAmount","selectedCurrency","intl","UNSAFE_componentWillReceiveProps","nextProps","setState","isInputAllowedForKeyEvent","event","metaKey","key","ctrlKey","isNumberKey","Number","parseInt","has","handleKeyDown","preventDefault","handlePaste","paste","clipboardData","getData","parsed","isEmpty","onAmountChange","value","target","onAmountBlur","setAmount","onAmountFocus","getSelectOptions","selectOptions","filterCurrenciesForQuery","currencies","formattedOptions","currentGroupOptions","forEach","item","header","push","type","label","options","filterMatchers","note","searchable","previousState","handleSelectChange","handleSearchChange","onCurrencyChange","handleCustomAction","onCustomAction","onSearchChange","filteredOptions","style","className","render","inputAttributes","id","amountInputId","ariaLabelledByProp","addon","ariaLabelledBy","hasSingleCurrency","length","firstItem","customActionLabel","isFixedCurrency","disabled","currencyCurrencyElementId","_jsxs","role","clsx","children","_jsx","Input","inputMode","placeholder","autoComplete","onKeyDown","onChange","onFocus","onBlur","onPaste","Flag","code","toLowerCase","intrinsicSize","Title","as","Typography","TITLE_SUBSECTION","toUpperCase","SelectInput","items","compareValues","renderValue","withinTrigger","SelectInputOptionContent","title","undefined","icon","renderFooter","tabIndex","onClick","formatMessage","messages","selectPlaceholder","filterable","filterPlaceholder","searchPlaceholder","onFilterChange","queryNormalized","query","filter","option","removeDuplicateValueOptions","currencyOptionFitsQuery","sortOptionsLabelsToFirst","uniqueValues","add","contains","property","includes","sort","first","second","firstContains","secondContains","injectIntl","withId","withInputAttributes","nonLabelable"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,MAAMA,cAAc,GAAIC,CAAU,IAAyBC,QAAQ,CAACD,CAAC,CAAC,IAAIE,MAAM,CAACF,CAAC,CAAC,CAAA;AAEnF,MAAMG,iBAAiB,GAAGA,CAAC;EACzBC,MAAM;EACNC,QAAQ;AACRC,EAAAA,MAAAA;AAKD,CAAA,KAAI;AACH,EAAA,OAAO,OAAOF,MAAM,KAAK,QAAQ,GAAGG,YAAY,CAACH,MAAM,EAAEC,QAAQ,EAAEC,MAAM,CAAC,GAAG,EAAE,CAAA;AACjF,CAAC,CAAA;AAED,MAAME,WAAW,GAAGA,CAAC;EACnBJ,MAAM;EACNC,QAAQ;AACRC,EAAAA,MAAAA;AAKD,CAAA,KAAI;AACH,EAAA,OAAOG,WAAW,CAACL,MAAM,EAAEC,QAAQ,EAAEC,MAAM,CAAC,CAAA;AAC9C,CAAC,CAAA;AAED,MAAMI,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,KAAK,CACN,CAAC,CAAA;AAgCF,MAAMC,UAAW,SAAQC,SAA8D,CAAA;AAIrF,EAAA,OAAOC,YAAY,GAAG;IACpBC,IAAI,EAAEC,IAAI,CAACC,KAAK;IAChBC,UAAU,EAAE,EAAE;AACdC,IAAAA,WAAW,EAAE,EAAE;GACsC,CAAA;AAEvDC,EAAAA,aAAa,GAAG,KAAK,CAAA;EAErBC,WAAAA,CAAYC,KAAsB,EAAA;IAChC,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI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,QAAQA,CAACC,QAA4B,EAAET,KAAa,EAAA;AAC3D,EAAA,OAAOS,QAAQ,EAAEpC,WAAW,EAAE,CAACqC,QAAQ,CAACV,KAAK,CAAC3B,WAAW,EAAE,CAAC,CAAA;AAC9D,CAAA;AAEA,SAASgC,wBAAwBA,CAAC5E,OAAsC,EAAEuE,KAAa,EAAA;EACrF,OAAO,CAAC,GAAGvE,OAAO,CAAC,CAACkF,IAAI,CAAC,CAACC,KAAK,EAAEC,MAAM,KAAI;IACzC,MAAMC,aAAa,GAAGN,QAAQ,CAACI,KAAK,CAACpF,KAAK,EAAEwE,KAAK,CAAC,CAAA;IAClD,MAAMe,cAAc,GAAGP,QAAQ,CAACK,MAAM,CAACrF,KAAK,EAAEwE,KAAK,CAAC,CAAA;IAEpD,IAAIc,aAAa,IAAIC,cAAc,EAAE;AACnC,MAAA,OAAO,CAAC,CAAA;AACV,KAAA;AACA,IAAA,IAAID,aAAa,EAAE;AACjB,MAAA,OAAO,CAAC,CAAC,CAAA;AACX,KAAA;AACA,IAAA,IAAIC,cAAc,EAAE;AAClB,MAAA,OAAO,CAAC,CAAA;AACV,KAAA;AACA,IAAA,OAAO,CAAC,CAAA;AACV,GAAC,CAAC,CAAA;AACJ,CAAA;AAEA,mBAAeC,UAAU,CAACC,MAAM,CAACC,mBAAmB,CAAC/I,UAAU,EAAE;AAAEgJ,EAAAA,YAAY,EAAE,IAAA;AAAI,CAAE,CAAC,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"MoneyInput.mjs","sources":["../../src/moneyInput/MoneyInput.tsx"],"sourcesContent":["import { isEmpty, isNumber, isNull } from '@transferwise/neptune-validation';\nimport { Flag } from '@wise/art';\nimport { clsx } from 'clsx';\nimport { Component } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport { Typography } from '../common';\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../common/propsValues/size';\nimport { withInputAttributes, WithInputAttributesProps } from '../inputs/contexts';\nimport { Input } from '../inputs/Input';\nimport {\n SelectInput,\n SelectInputItem,\n SelectInputOptionContent,\n SelectInputOptionItem,\n SelectInputProps,\n} from '../inputs/SelectInput';\nimport Title from '../title';\n\nimport messages from './MoneyInput.messages';\nimport { formatAmount, parseAmount } from './currencyFormatting';\n\nexport interface CurrencyOptionItem {\n header?: never;\n value: string;\n label: string;\n currency: string;\n note?: string;\n searchable?: string;\n}\n\nexport interface CurrencyHeaderItem {\n header: string;\n}\n\nexport type CurrencyItem = CurrencyOptionItem | CurrencyHeaderItem;\n\nconst isNumberOrNull = (v: unknown): v is number | null => isNumber(v) || isNull(v);\n\nconst formatAmountIfSet = ({\n amount,\n currency,\n locale,\n}: {\n amount: number | null | undefined;\n currency: string;\n locale: string;\n}) => {\n return typeof amount === 'number' ? formatAmount(amount, currency, locale) : '';\n};\n\nconst parseNumber = ({\n amount,\n currency,\n locale,\n}: {\n amount: string;\n currency: string;\n locale: string;\n}) => {\n return parseAmount(amount, currency, locale);\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Escape',\n 'Tab',\n]);\n\nexport interface MoneyInputProps extends WrappedComponentProps {\n id?: string;\n 'aria-labelledby'?: string;\n currencies: readonly CurrencyItem[];\n selectedCurrency: CurrencyOptionItem;\n onCurrencyChange?: (value: CurrencyOptionItem) => void;\n placeholder?: number;\n amount: number | null;\n size?: SizeSmall | SizeMedium | SizeLarge;\n onAmountChange?: (value: number | null) => void;\n addon?: React.ReactNode;\n searchPlaceholder?: string;\n /**\n * Allows the consumer to react to searching, while the search itself is handled internally.\n */\n onSearchChange?: (value: { searchQuery: string; filteredOptions: CurrencyItem[] }) => void;\n customActionLabel?: React.ReactNode;\n onCustomAction?: () => void;\n classNames?: Record<string, string>;\n selectProps?: Partial<SelectInputProps<CurrencyOptionItem>>;\n}\n\ntype MoneyInputPropsWithInputAttributes = MoneyInputProps & Partial<WithInputAttributesProps>;\n\ninterface MoneyInputState {\n searchQuery: string;\n formattedAmount: string;\n locale: string;\n}\n\nclass MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInputState> {\n declare props: MoneyInputPropsWithInputAttributes &\n Required<Pick<MoneyInputPropsWithInputAttributes, keyof typeof MoneyInput.defaultProps>>;\n\n static defaultProps = {\n size: Size.LARGE,\n classNames: {},\n selectProps: {},\n } satisfies Partial<MoneyInputPropsWithInputAttributes>;\n\n amountFocused = false;\n\n constructor(props: MoneyInputProps) {\n super(props);\n this.state = {\n searchQuery: '',\n formattedAmount: formatAmountIfSet({\n amount: props.amount,\n currency: props.selectedCurrency.currency,\n locale: props.intl.locale,\n }),\n locale: props.intl.locale,\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps: MoneyInputProps) {\n this.setState({ locale: nextProps.intl.locale });\n\n if (!this.amountFocused) {\n this.setState({\n formattedAmount: formatAmountIfSet({\n amount: nextProps.amount,\n currency: nextProps.selectedCurrency.currency,\n locale: nextProps.intl.locale,\n }),\n });\n }\n }\n\n isInputAllowedForKeyEvent = (event: React.KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = event;\n const isNumberKey = isNumber(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n };\n\n handleKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (!this.isInputAllowedForKeyEvent(event)) {\n event.preventDefault();\n }\n };\n\n handlePaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n const paste = event.clipboardData.getData('text');\n const { locale } = this.state;\n const parsed = isEmpty(paste)\n ? null\n : parseNumber({\n amount: paste,\n currency: this.props.selectedCurrency.currency,\n locale,\n });\n\n if (isNumberOrNull(parsed)) {\n this.setState({\n formattedAmount: formatAmountIfSet({\n amount: parsed,\n currency: this.props.selectedCurrency.currency,\n locale,\n }),\n });\n this.props.onAmountChange?.(parsed);\n }\n\n event.preventDefault();\n };\n\n onAmountChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n const { value } = event.target;\n this.setState({\n formattedAmount: value,\n });\n const parsed = isEmpty(value)\n ? null\n : parseNumber({\n amount: value,\n currency: this.props.selectedCurrency.currency,\n locale: this.state.locale,\n });\n if (isNumberOrNull(parsed)) {\n this.props.onAmountChange?.(parsed);\n }\n };\n\n onAmountBlur = () => {\n this.amountFocused = false;\n this.setAmount();\n };\n\n onAmountFocus = () => {\n this.amountFocused = true;\n };\n\n getSelectOptions() {\n const selectOptions = filterCurrenciesForQuery(this.props.currencies, this.state.searchQuery);\n\n const formattedOptions: SelectInputItem<CurrencyOptionItem>[] = [];\n let currentGroupOptions: SelectInputOptionItem<CurrencyOptionItem>[] | undefined;\n\n selectOptions.forEach((item) => {\n if (item.header != null) {\n currentGroupOptions = [];\n formattedOptions.push({\n type: 'group',\n label: item.header,\n options: currentGroupOptions,\n });\n } else {\n (currentGroupOptions ?? formattedOptions).push({\n type: 'option',\n value: item,\n filterMatchers: [item.value, item.label, item.note ?? '', item.searchable ?? ''],\n });\n }\n });\n\n return formattedOptions;\n }\n\n setAmount() {\n this.setState((previousState) => {\n const parsed = parseNumber({\n amount: previousState.formattedAmount,\n currency: this.props.selectedCurrency.currency,\n locale: previousState.locale,\n });\n if (!isNumberOrNull(parsed)) {\n return {\n formattedAmount: previousState.formattedAmount,\n };\n }\n return {\n formattedAmount: formatAmountIfSet({\n amount: parsed,\n currency: this.props.selectedCurrency.currency,\n locale: previousState.locale,\n }),\n };\n });\n }\n\n handleSelectChange = (value: CurrencyOptionItem) => {\n this.handleSearchChange('');\n this.props.onCurrencyChange?.(value);\n };\n\n handleCustomAction = () => {\n this.handleSearchChange('');\n this.props.onCustomAction?.();\n };\n\n handleSearchChange = (searchQuery: string) => {\n this.setState({ searchQuery });\n this.props.onSearchChange?.({\n searchQuery,\n filteredOptions: filterCurrenciesForQuery(this.props.currencies, searchQuery),\n });\n };\n\n style = (className: string) => this.props.classNames[className] || className;\n\n render() {\n const {\n inputAttributes,\n id: amountInputId,\n 'aria-labelledby': ariaLabelledByProp,\n selectedCurrency,\n onCurrencyChange,\n size,\n addon,\n selectProps,\n } = this.props;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];\n\n const selectOptions = this.getSelectOptions();\n\n const hasSingleCurrency = () => {\n if (selectOptions.length !== 0) {\n const firstItem = selectOptions[0];\n\n if (selectOptions.length === 1) {\n if (firstItem.type === 'option') {\n return firstItem.value.currency === selectedCurrency.currency;\n }\n if (firstItem.type === 'group') {\n return (\n firstItem.options.length === 1 &&\n !(this.props.onCustomAction && this.props.customActionLabel)\n );\n }\n }\n } else if (selectedCurrency?.currency) {\n return true;\n }\n\n return false;\n };\n\n const isFixedCurrency = (!this.state.searchQuery && hasSingleCurrency()) || !onCurrencyChange;\n\n const disabled = !this.props.onAmountChange;\n return (\n <div\n role=\"group\"\n {...inputAttributes}\n aria-labelledby={ariaLabelledBy}\n className={clsx(\n this.style('tw-money-input'),\n this.style('input-group'),\n this.style(`input-group-${size}`),\n )}\n >\n <Input\n id={amountInputId}\n value={this.state.formattedAmount}\n inputMode=\"decimal\"\n disabled={disabled}\n placeholder={formatAmountIfSet({\n amount: this.props.placeholder,\n currency: this.props.selectedCurrency.currency,\n locale: this.state.locale,\n })}\n autoComplete=\"off\"\n onKeyDown={this.handleKeyDown}\n onChange={this.onAmountChange}\n onFocus={this.onAmountFocus}\n onBlur={this.onAmountBlur}\n onPaste={this.handlePaste}\n />\n {addon && (\n <span\n className={clsx(\n this.style('input-group-addon'),\n this.style(`input-${size}`),\n disabled ? this.style('disabled') : '',\n )}\n >\n {addon}\n </span>\n )}\n {isFixedCurrency ? (\n <div\n className={clsx(\n this.style('input-group-addon'),\n this.style(`input-${size}`),\n this.style('tw-money-input__fixed-currency'),\n disabled ? this.style('disabled') : '',\n )}\n >\n {(size === 'lg' || size === 'md') && (\n <span className={clsx(this.style('money-input-currency-flag'), this.style('m-r-2'))}>\n <Flag code={selectedCurrency.currency.toLowerCase()} intrinsicSize={24} />\n </span>\n )}\n <Title\n as=\"span\"\n type={Typography.TITLE_SUBSECTION}\n className={size === 'lg' ? this.style('m-r-1') : ''}\n >\n {selectedCurrency.currency.toUpperCase()}\n </Title>\n </div>\n ) : (\n <div\n className={clsx(\n this.style('input-group-btn'),\n this.style('amount-currency-select-btn'),\n )}\n >\n <SelectInput\n items={selectOptions}\n value={selectedCurrency}\n compareValues=\"currency\"\n renderValue={(currency, withinTrigger) => {\n return (\n <SelectInputOptionContent\n title={withinTrigger ? currency.currency.toUpperCase() : currency.label}\n note={withinTrigger ? undefined : currency.note}\n icon={<Flag code={currency.currency} intrinsicSize={24} />}\n />\n );\n }}\n renderFooter={\n this.props.onCustomAction\n ? () => (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div role=\"button\" tabIndex={0} onClick={this.handleCustomAction}>\n {this.props.customActionLabel}\n </div>\n )\n : undefined\n }\n placeholder={this.props.intl.formatMessage(messages.selectPlaceholder)}\n filterable\n filterPlaceholder={this.props.searchPlaceholder}\n disabled={disabled}\n size={size}\n onChange={this.handleSelectChange}\n onFilterChange={({ queryNormalized }) => {\n this.handleSearchChange(queryNormalized ?? '');\n }}\n {...selectProps}\n />\n </div>\n )}\n </div>\n );\n }\n}\n\nfunction filterCurrenciesForQuery(\n currencies: readonly CurrencyItem[],\n query: string,\n): CurrencyItem[] {\n if (!query) {\n return [...currencies];\n }\n\n const options = currencies.filter(\n (option): option is CurrencyOptionItem => option.header == null,\n );\n const filteredOptions = removeDuplicateValueOptions(options).filter((option) =>\n currencyOptionFitsQuery(option, query),\n );\n\n return sortOptionsLabelsToFirst(filteredOptions, query);\n}\n\nfunction removeDuplicateValueOptions(options: readonly CurrencyOptionItem[]) {\n const uniqueValues = new Set<string>();\n return options.filter((option) => {\n if (!uniqueValues.has(option.value)) {\n uniqueValues.add(option.value);\n return true;\n }\n return false;\n });\n}\n\nfunction currencyOptionFitsQuery(option: CurrencyOptionItem, query: string) {\n if (!option.value) {\n return false;\n }\n\n return (\n contains(option.label, query) ||\n contains(option.searchable, query) ||\n contains(option.note, query)\n );\n}\n\nfunction contains(property: string | undefined, query: string) {\n return property?.toLowerCase().includes(query.toLowerCase());\n}\n\nfunction sortOptionsLabelsToFirst(options: readonly CurrencyOptionItem[], query: string) {\n return [...options].sort((first, second) => {\n const firstContains = contains(first.label, query);\n const secondContains = contains(second.label, query);\n\n if (firstContains && secondContains) {\n return 0;\n }\n if (firstContains) {\n return -1;\n }\n if (secondContains) {\n return 1;\n }\n return 0;\n });\n}\n\nexport default injectIntl(withInputAttributes(MoneyInput, { nonLabelable: true }));\n"],"names":["isNumberOrNull","v","isNumber","isNull","formatAmountIfSet","amount","currency","locale","formatAmount","parseNumber","parseAmount","allowedInputKeys","Set","MoneyInput","Component","defaultProps","size","Size","LARGE","classNames","selectProps","amountFocused","constructor","props","state","searchQuery","formattedAmount","selectedCurrency","intl","UNSAFE_componentWillReceiveProps","nextProps","setState","isInputAllowedForKeyEvent","event","metaKey","key","ctrlKey","isNumberKey","Number","parseInt","has","handleKeyDown","preventDefault","handlePaste","paste","clipboardData","getData","parsed","isEmpty","onAmountChange","value","target","onAmountBlur","setAmount","onAmountFocus","getSelectOptions","selectOptions","filterCurrenciesForQuery","currencies","formattedOptions","currentGroupOptions","forEach","item","header","push","type","label","options","filterMatchers","note","searchable","previousState","handleSelectChange","handleSearchChange","onCurrencyChange","handleCustomAction","onCustomAction","onSearchChange","filteredOptions","style","className","render","inputAttributes","id","amountInputId","ariaLabelledByProp","addon","ariaLabelledBy","hasSingleCurrency","length","firstItem","customActionLabel","isFixedCurrency","disabled","_jsxs","role","clsx","children","_jsx","Input","inputMode","placeholder","autoComplete","onKeyDown","onChange","onFocus","onBlur","onPaste","Flag","code","toLowerCase","intrinsicSize","Title","as","Typography","TITLE_SUBSECTION","toUpperCase","SelectInput","items","compareValues","renderValue","withinTrigger","SelectInputOptionContent","title","undefined","icon","renderFooter","tabIndex","onClick","formatMessage","messages","selectPlaceholder","filterable","filterPlaceholder","searchPlaceholder","onFilterChange","queryNormalized","query","filter","option","removeDuplicateValueOptions","currencyOptionFitsQuery","sortOptionsLabelsToFirst","uniqueValues","add","contains","property","includes","sort","first","second","firstContains","secondContains","injectIntl","withInputAttributes","nonLabelable"],"mappings":";;;;;;;;;;;;;;;;AAqCA,MAAMA,cAAc,GAAIC,CAAU,IAAyBC,QAAQ,CAACD,CAAC,CAAC,IAAIE,MAAM,CAACF,CAAC,CAAC,CAAA;AAEnF,MAAMG,iBAAiB,GAAGA,CAAC;EACzBC,MAAM;EACNC,QAAQ;AACRC,EAAAA,MAAAA;AAKD,CAAA,KAAI;AACH,EAAA,OAAO,OAAOF,MAAM,KAAK,QAAQ,GAAGG,YAAY,CAACH,MAAM,EAAEC,QAAQ,EAAEC,MAAM,CAAC,GAAG,EAAE,CAAA;AACjF,CAAC,CAAA;AAED,MAAME,WAAW,GAAGA,CAAC;EACnBJ,MAAM;EACNC,QAAQ;AACRC,EAAAA,MAAAA;AAKD,CAAA,KAAI;AACH,EAAA,OAAOG,WAAW,CAACL,MAAM,EAAEC,QAAQ,EAAEC,MAAM,CAAC,CAAA;AAC9C,CAAC,CAAA;AAED,MAAMI,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,KAAK,CACN,CAAC,CAAA;AAgCF,MAAMC,UAAW,SAAQC,SAA8D,CAAA;AAIrF,EAAA,OAAOC,YAAY,GAAG;IACpBC,IAAI,EAAEC,IAAI,CAACC,KAAK;IAChBC,UAAU,EAAE,EAAE;AACdC,IAAAA,WAAW,EAAE,EAAE;GACsC,CAAA;AAEvDC,EAAAA,aAAa,GAAG,KAAK,CAAA;EAErBC,WAAAA,CAAYC,KAAsB,EAAA;IAChC,KAAK,CAACA,KAAK,CAAC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CAAC3E,OAAsC,EAAEsE,KAAa,EAAA;EACrF,OAAO,CAAC,GAAGtE,OAAO,CAAC,CAACiF,IAAI,CAAC,CAACC,KAAK,EAAEC,MAAM,KAAI;IACzC,MAAMC,aAAa,GAAGN,QAAQ,CAACI,KAAK,CAACnF,KAAK,EAAEuE,KAAK,CAAC,CAAA;IAClD,MAAMe,cAAc,GAAGP,QAAQ,CAACK,MAAM,CAACpF,KAAK,EAAEuE,KAAK,CAAC,CAAA;IAEpD,IAAIc,aAAa,IAAIC,cAAc,EAAE;AACnC,MAAA,OAAO,CAAC,CAAA;AACV,KAAA;AACA,IAAA,IAAID,aAAa,EAAE;AACjB,MAAA,OAAO,CAAC,CAAC,CAAA;AACX,KAAA;AACA,IAAA,IAAIC,cAAc,EAAE;AAClB,MAAA,OAAO,CAAC,CAAA;AACV,KAAA;AACA,IAAA,OAAO,CAAC,CAAA;AACV,GAAC,CAAC,CAAA;AACJ,CAAA;AAEA,mBAAeC,UAAU,CAACC,mBAAmB,CAAC7I,UAAU,EAAE;AAAE8I,EAAAA,YAAY,EAAE,IAAA;AAAM,CAAA,CAAC,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PromoCardGroup.js","sources":["../../src/promoCard/PromoCardGroup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { FunctionComponent, ReactNode, useState, useEffect, useMemo } from 'react';\n\nimport { PromoCardProps } from './PromoCard';\nimport PromoCardContext from './PromoCardContext';\n\nexport type AriaRoleRadioGroup = 'radiogroup';\n\nexport interface PromoCardGroupProps {\n /**\n * Optional class name(s) to add to the group container.\n */\n className?: string;\n /**\n * The PromoCard components to display inside the group.\n */\n children: ReactNode;\n /**\n * The default checked for the group.\n */\n defaultChecked?: string;\n /**\n * Optional ID to add to the group container.\n */\n id?: string;\n /**\n * Whether the group is disabled or not.\n */\n isDisabled?: boolean;\n /**\n * Optional label to display above the group.\n */\n label?: string;\n /**\n * Optional function to call when the group value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Optional ID to add to the group container for testing purposes.\n */\n testId?: string;\n}\n\n/**\n * PromoCardGroup component.\n *\n * A PromoCardGroup is a container for PromoCard components that allows the user to select one or more\n * cards from a group. It can be used to display a set of related options, and can be customized with\n * various props to suit different use cases.\n *\n * @param {ReactNode} children - The PromoCard components to display inside the group.\n * @param {string} className - Optional class name(s) to add to the group container.\n * @param {string} defaultChecked - The default value for the group.\n * @param {string} id - Optional ID to add to the group container.\n * @param {boolean} isDisabled=false - Whether the group is disabled or not.\n * @param {string} label - Optional label to display above the group.\n * @param {Function} onChange - Optional function to call when the group value changes.\n * @param {string} testId - Optional ID to add to the group container for testing purposes.\n * @returns {JSX.Element} - The PromoCardGroup component.\n */\nconst PromoCardGroup: FunctionComponent<PromoCardGroupProps> = ({\n children,\n className,\n defaultChecked = '',\n id,\n isDisabled = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = () => {},\n testId,\n}) => {\n const [state, setState] = useState<string>(defaultChecked);\n const [containerRole, setContainerRole] = useState<string | null>(null);\n\n /**\n * The context value for the PromoCardGroup.\n *\n * The context value is an object that contains the current state of the\n * group, whether the group is disabled or not, and a function to call when\n * the group value changes. This value is used to provide context to child\n * PromoCard components, allowing them to interact with the group and update\n * its state.\n */\n const contextValue = useMemo(() => {\n const handleOnChange = (value: string) => {\n setState(value);\n onChange(value);\n };\n\n return { state, isDisabled, onChange: handleOnChange };\n }, [state, isDisabled, onChange]);\n\n const commonClasses = clsx(\n {\n 'np-CardGroup': true,\n 'is-disabled': isDisabled,\n },\n className,\n );\n\n const commonProps = {\n className: commonClasses,\n id,\n 'data-testid': testId,\n role: containerRole as AriaRoleRadioGroup | undefined, // Add the role attribute here\n };\n\n useEffect(() => {\n setState(defaultChecked);\n\n // Collect an array of types from the children PromoCard components\n const types =\n React.Children.map(children, (child) => {\n if (React.isValidElement<PromoCardProps>(child) && child.props.type) {\n return child.props.type;\n }\n return null;\n })?.filter((type): type is 'radio' | 'checkbox' => type !== null && type !== undefined) ?? [];\n\n // Check if all types are the same\n const allTypesAreTheSame = types.every((type) => type === types[0]);\n\n // If all types are the same and the type is 'radio', set the container role\n setContainerRole(allTypesAreTheSame && types[0] === 'radio' ? 'radiogroup' : null);\n }, [defaultChecked, children]);\n\n return (\n <PromoCardContext.Provider value={contextValue}>\n <div {...commonProps}>{children}</div>\n </PromoCardContext.Provider>\n );\n};\n\nexport default React.memo(PromoCardGroup);\n"],"names":["PromoCardGroup","children","className","defaultChecked","id","isDisabled","onChange","testId","state","setState","useState","containerRole","setContainerRole","contextValue","useMemo","handleOnChange","value","commonClasses","clsx","commonProps","role","useEffect","types","React","Children","map","child","isValidElement","props","type","filter","undefined","allTypesAreTheSame","every","_jsx","PromoCardContext","Provider","memo"],"mappings":";;;;;;;;;;;AA4DA,MAAMA,cAAc,GAA2CA,CAAC;EAC9DC,QAAQ;EACRC,SAAS;AACTC,EAAAA,cAAc,GAAG,EAAE;EACnBC,EAAE;AACFC,EAAAA,UAAU,GAAG,KAAK;AAClB;AACAC,EAAAA,QAAQ,GAAGA,MAAK,EAAG;AACnBC,EAAAA,MAAAA;AACD,CAAA,KAAI;EACH,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAQ,CAASP,cAAc,CAAC,CAAA;EAC1D,MAAM,CAACQ,aAAa,EAAEC,gBAAgB,CAAC,GAAGF,cAAQ,CAAgB,IAAI,CAAC,CAAA;AAEvE;;;;;;;;AAQG;AACH,EAAA,MAAMG,YAAY,GAAGC,aAAO,CAAC,MAAK;IAChC,MAAMC,cAAc,GAAIC,KAAa,IAAI;MACvCP,QAAQ,CAACO,KAAK,CAAC,CAAA;MACfV,QAAQ,CAACU,KAAK,CAAC,CAAA;KAChB,CAAA;IAED,OAAO;MAAER,KAAK;MAAEH,UAAU;AAAEC,MAAAA,QAAQ,EAAES,cAAAA;KAAgB,CAAA;GACvD,EAAE,CAACP,KAAK,EAAEH,UAAU,EAAEC,QAAQ,CAAC,CAAC,CAAA;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A;AAAA,MAAA,GAASf,WAAW;AAAAlB,MAAAA,QAAA,EAAGA,QAAAA;KAAc,CAAA;AACvC,GAA2B,CAAC,CAAA;AAEhC,CAAC,CAAA;AAED,uBAAA,aAAesB,sBAAK,CAACc,IAAI,CAACrC,cAAc,CAAC;;;;"}
1
+ {"version":3,"file":"PromoCardGroup.js","sources":["../../src/promoCard/PromoCardGroup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { FunctionComponent, ReactNode, useState, useEffect, useMemo } from 'react';\n\nimport { PromoCardProps } from './PromoCard';\nimport PromoCardContext from './PromoCardContext';\n\nexport type AriaRoleRadioGroup = 'radiogroup';\n\nexport interface PromoCardGroupProps {\n /**\n * Optional class name(s) to add to the group container.\n */\n className?: string;\n /**\n * The PromoCard components to display inside the group.\n */\n children: ReactNode;\n /**\n * The default checked for the group.\n */\n defaultChecked?: string;\n /**\n * Optional ID to add to the group container.\n */\n id?: string;\n /**\n * Whether the group is disabled or not.\n */\n isDisabled?: boolean;\n /**\n * Optional label to display above the group.\n */\n label?: string;\n /**\n * Optional function to call when the group value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Optional ID to add to the group container for testing purposes.\n */\n testId?: string;\n}\n\n/**\n * PromoCardGroup component.\n *\n * A PromoCardGroup is a container for PromoCard components that allows the user to select one or more\n * cards from a group. It can be used to display a set of related options, and can be customized with\n * various props to suit different use cases.\n *\n * @param {ReactNode} children - The PromoCard components to display inside the group.\n * @param {string} className - Optional class name(s) to add to the group container.\n * @param {string} defaultChecked - The default value for the group.\n * @param {string} id - Optional ID to add to the group container.\n * @param {boolean} isDisabled=false - Whether the group is disabled or not.\n * @param {string} label - Optional label to display above the group.\n * @param {Function} onChange - Optional function to call when the group value changes.\n * @param {string} testId - Optional ID to add to the group container for testing purposes.\n * @returns {React.JSX.Element} - The PromoCardGroup component.\n */\nconst PromoCardGroup: FunctionComponent<PromoCardGroupProps> = ({\n children,\n className,\n defaultChecked = '',\n id,\n isDisabled = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = () => {},\n testId,\n}) => {\n const [state, setState] = useState<string>(defaultChecked);\n const [containerRole, setContainerRole] = useState<string | null>(null);\n\n /**\n * The context value for the PromoCardGroup.\n *\n * The context value is an object that contains the current state of the\n * group, whether the group is disabled or not, and a function to call when\n * the group value changes. This value is used to provide context to child\n * PromoCard components, allowing them to interact with the group and update\n * its state.\n */\n const contextValue = useMemo(() => {\n const handleOnChange = (value: string) => {\n setState(value);\n onChange(value);\n };\n\n return { state, isDisabled, onChange: handleOnChange };\n }, [state, isDisabled, onChange]);\n\n const commonClasses = clsx(\n {\n 'np-CardGroup': true,\n 'is-disabled': isDisabled,\n },\n className,\n );\n\n const commonProps = {\n className: commonClasses,\n id,\n 'data-testid': testId,\n role: containerRole as AriaRoleRadioGroup | undefined, // Add the role attribute here\n };\n\n useEffect(() => {\n setState(defaultChecked);\n\n // Collect an array of types from the children PromoCard components\n const types =\n React.Children.map(children, (child) => {\n if (React.isValidElement<PromoCardProps>(child) && child.props.type) {\n return child.props.type;\n }\n return null;\n })?.filter((type): type is 'radio' | 'checkbox' => type !== null && type !== undefined) ?? [];\n\n // Check if all types are the same\n const allTypesAreTheSame = types.every((type) => type === types[0]);\n\n // If all types are the same and the type is 'radio', set the container role\n setContainerRole(allTypesAreTheSame && types[0] === 'radio' ? 'radiogroup' : null);\n }, [defaultChecked, children]);\n\n return (\n <PromoCardContext.Provider value={contextValue}>\n <div {...commonProps}>{children}</div>\n </PromoCardContext.Provider>\n );\n};\n\nexport default React.memo(PromoCardGroup);\n"],"names":["PromoCardGroup","children","className","defaultChecked","id","isDisabled","onChange","testId","state","setState","useState","containerRole","setContainerRole","contextValue","useMemo","handleOnChange","value","commonClasses","clsx","commonProps","role","useEffect","types","React","Children","map","child","isValidElement","props","type","filter","undefined","allTypesAreTheSame","every","_jsx","PromoCardContext","Provider","memo"],"mappings":";;;;;;;;;;;AA4DA,MAAMA,cAAc,GAA2CA,CAAC;EAC9DC,QA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AACC,IAAI,EAAE;AACnE,QAAA,OAAOH,KAAK,CAACE,KAAK,CAACC,IAAI,CAAA;AACzB,OAAA;AACA,MAAA,OAAO,IAAI,CAAA;AACb,KAAC,CAAC,EAAEC,MAAM,CAAED,IAAI,IAAmCA,IAAI,KAAK,IAAI,IAAIA,IAAI,KAAKE,SAAS,CAAC,IAAI,EAAE,CAAA;AAE/F;AACA,IAAA,MAAMC,kBAAkB,GAAGV,KAAK,CAACW,KAAK,CAAEJ,IAAI,IAAKA,IAAI,KAAKP,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAEnE;AACAV,IAAAA,gBAAgB,CAACoB,kBAAkB,IAAIV,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC,CAAA;AACpF,GAAC,EAAE,CAACnB,cAAc,EAAEF,QAAQ,CAAC,CAAC,CAAA;AAE9B,EAAA,oBACEiC,cAAA,CAACC,iCAAgB,CAACC,QAAQ,EAAA;AAACpB,IAAAA,KAAK,EAAEH,YAAa;AAAAZ,IAAAA,QAAA,eAC7CiC,cAAA,CAAA,KAAA,EAAA;AAAA,MAAA,GAASf,WAAW;AAAAlB,MAAAA,QAAA,EAAGA,QAAAA;KAAc,CAAA;AACvC,GAA2B,CAAC,CAAA;AAEhC,CAAC,CAAA;AAED,uBAAA,aAAesB,sBAAK,CAACc,IAAI,CAACrC,cAAc,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PromoCardGroup.mjs","sources":["../../src/promoCard/PromoCardGroup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { FunctionComponent, ReactNode, useState, useEffect, useMemo } from 'react';\n\nimport { PromoCardProps } from './PromoCard';\nimport PromoCardContext from './PromoCardContext';\n\nexport type AriaRoleRadioGroup = 'radiogroup';\n\nexport interface PromoCardGroupProps {\n /**\n * Optional class name(s) to add to the group container.\n */\n className?: string;\n /**\n * The PromoCard components to display inside the group.\n */\n children: ReactNode;\n /**\n * The default checked for the group.\n */\n defaultChecked?: string;\n /**\n * Optional ID to add to the group container.\n */\n id?: string;\n /**\n * Whether the group is disabled or not.\n */\n isDisabled?: boolean;\n /**\n * Optional label to display above the group.\n */\n label?: string;\n /**\n * Optional function to call when the group value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Optional ID to add to the group container for testing purposes.\n */\n testId?: string;\n}\n\n/**\n * PromoCardGroup component.\n *\n * A PromoCardGroup is a container for PromoCard components that allows the user to select one or more\n * cards from a group. It can be used to display a set of related options, and can be customized with\n * various props to suit different use cases.\n *\n * @param {ReactNode} children - The PromoCard components to display inside the group.\n * @param {string} className - Optional class name(s) to add to the group container.\n * @param {string} defaultChecked - The default value for the group.\n * @param {string} id - Optional ID to add to the group container.\n * @param {boolean} isDisabled=false - Whether the group is disabled or not.\n * @param {string} label - Optional label to display above the group.\n * @param {Function} onChange - Optional function to call when the group value changes.\n * @param {string} testId - Optional ID to add to the group container for testing purposes.\n * @returns {JSX.Element} - The PromoCardGroup component.\n */\nconst PromoCardGroup: FunctionComponent<PromoCardGroupProps> = ({\n children,\n className,\n defaultChecked = '',\n id,\n isDisabled = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = () => {},\n testId,\n}) => {\n const [state, setState] = useState<string>(defaultChecked);\n const [containerRole, setContainerRole] = useState<string | null>(null);\n\n /**\n * The context value for the PromoCardGroup.\n *\n * The context value is an object that contains the current state of the\n * group, whether the group is disabled or not, and a function to call when\n * the group value changes. This value is used to provide context to child\n * PromoCard components, allowing them to interact with the group and update\n * its state.\n */\n const contextValue = useMemo(() => {\n const handleOnChange = (value: string) => {\n setState(value);\n onChange(value);\n };\n\n return { state, isDisabled, onChange: handleOnChange };\n }, [state, isDisabled, onChange]);\n\n const commonClasses = clsx(\n {\n 'np-CardGroup': true,\n 'is-disabled': isDisabled,\n },\n className,\n );\n\n const commonProps = {\n className: commonClasses,\n id,\n 'data-testid': testId,\n role: containerRole as AriaRoleRadioGroup | undefined, // Add the role attribute here\n };\n\n useEffect(() => {\n setState(defaultChecked);\n\n // Collect an array of types from the children PromoCard components\n const types =\n React.Children.map(children, (child) => {\n if (React.isValidElement<PromoCardProps>(child) && child.props.type) {\n return child.props.type;\n }\n return null;\n })?.filter((type): type is 'radio' | 'checkbox' => type !== null && type !== undefined) ?? [];\n\n // Check if all types are the same\n const allTypesAreTheSame = types.every((type) => type === types[0]);\n\n // If all types are the same and the type is 'radio', set the container role\n setContainerRole(allTypesAreTheSame && types[0] === 'radio' ? 'radiogroup' : null);\n }, [defaultChecked, children]);\n\n return (\n <PromoCardContext.Provider value={contextValue}>\n <div {...commonProps}>{children}</div>\n </PromoCardContext.Provider>\n );\n};\n\nexport default React.memo(PromoCardGroup);\n"],"names":["PromoCardGroup","children","className","defaultChecked","id","isDisabled","onChange","testId","state","setState","useState","containerRole","setContainerRole","contextValue","useMemo","handleOnChange","value","commonClasses","clsx","commonProps","role","useEffect","types","React","Children","map","child","isValidElement","props","type","filter","undefined","allTypesAreTheSame","every","_jsx","PromoCardContext","Provider","memo"],"mappings":";;;;;AA4DA,MAAMA,cAAc,GAA2CA,CAAC;EAC9DC,QAAQ;EACRC,SAAS;AACTC,EAAAA,cAAc,GAAG,EAAE;EACnBC,EAAE;AACFC,EAAAA,UAAU,GAAG,KAAK;AAClB;AACAC,EAAAA,QAAQ,GAAGA,MAAK,EAAG;AACnBC,EAAAA,MAAAA;AACD,CAAA,KAAI;EACH,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAASP,cAAc,CAAC,CAAA;EAC1D,MAAM,CAACQ,aAAa,EAAEC,gBAAgB,CAAC,GAAGF,QAAQ,CAAgB,IAAI,CAAC,CAAA;AAEvE;;;;;;;;AAQG;AACH,EAAA,MAAMG,YAAY,GAAGC,OAAO,CAAC,MAAK;IAChC,MAAMC,cAAc,GAAIC,KAAa,IAAI;MACvCP,QAAQ,CAACO,KAAK,CAAC,CAAA;MACfV,QAAQ,CAACU,KAAK,CAAC,CA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,CAAC,CAAC,CAAA;AAE9B,EAAA,oBACEiC,GAAA,CAACC,gBAAgB,CAACC,QAAQ,EAAA;AAACpB,IAAAA,KAAK,EAAEH,YAAa;AAAAZ,IAAAA,QAAA,eAC7CiC,GAAA,CAAA,KAAA,EAAA;AAAA,MAAA,GAASf,WAAW;AAAAlB,MAAAA,QAAA,EAAGA,QAAAA;KAAc,CAAA;AACvC,GAA2B,CAAC,CAAA;AAEhC,CAAC,CAAA;AAED,uBAAA,aAAesB,cAAK,CAACc,IAAI,CAACrC,cAAc,CAAC;;;;"}
1
+ {"version":3,"file":"PromoCardGroup.mjs","sources":["../../src/promoCard/PromoCardGroup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { FunctionComponent, ReactNode, useState, useEffect, useMemo } from 'react';\n\nimport { PromoCardProps } from './PromoCard';\nimport PromoCardContext from './PromoCardContext';\n\nexport type AriaRoleRadioGroup = 'radiogroup';\n\nexport interface PromoCardGroupProps {\n /**\n * Optional class name(s) to add to the group container.\n */\n className?: string;\n /**\n * The PromoCard components to display inside the group.\n */\n children: ReactNode;\n /**\n * The default checked for the group.\n */\n defaultChecked?: string;\n /**\n * Optional ID to add to the group container.\n */\n id?: string;\n /**\n * Whether the group is disabled or not.\n */\n isDisabled?: boolean;\n /**\n * Optional label to display above the group.\n */\n label?: string;\n /**\n * Optional function to call when the group value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Optional ID to add to the group container for testing purposes.\n */\n testId?: string;\n}\n\n/**\n * PromoCardGroup component.\n *\n * A PromoCardGroup is a container for PromoCard components that allows the user to select one or more\n * cards from a group. It can be used to display a set of related options, and can be customized with\n * various props to suit different use cases.\n *\n * @param {ReactNode} children - The PromoCard components to display inside the group.\n * @param {string} className - Optional class name(s) to add to the group container.\n * @param {string} defaultChecked - The default value for the group.\n * @param {string} id - Optional ID to add to the group container.\n * @param {boolean} isDisabled=false - Whether the group is disabled or not.\n * @param {string} label - Optional label to display above the group.\n * @param {Function} onChange - Optional function to call when the group value changes.\n * @param {string} testId - Optional ID to add to the group container for testing purposes.\n * @returns {React.JSX.Element} - The PromoCardGroup component.\n */\nconst PromoCardGroup: FunctionComponent<PromoCardGroupProps> = ({\n children,\n className,\n defaultChecked = '',\n id,\n isDisabled = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = () => {},\n testId,\n}) => {\n const [state, setState] = useState<string>(defaultChecked);\n const [containerRole, setContainerRole] = useState<string | null>(null);\n\n /**\n * The context value for the PromoCardGroup.\n *\n * The context value is an object that contains the current state of the\n * group, whether the group is disabled or not, and a function to call when\n * the group value changes. This value is used to provide context to child\n * PromoCard components, allowing them to interact with the group and update\n * its state.\n */\n const contextValue = useMemo(() => {\n const handleOnChange = (value: string) => {\n setState(value);\n onChange(value);\n };\n\n return { state, isDisabled, onChange: handleOnChange };\n }, [state, isDisabled, onChange]);\n\n const commonClasses = clsx(\n {\n 'np-CardGroup': true,\n 'is-disabled': isDisabled,\n },\n className,\n );\n\n const commonProps = {\n className: commonClasses,\n id,\n 'data-testid': testId,\n role: containerRole as AriaRoleRadioGroup | undefined, // Add the role attribute here\n };\n\n useEffect(() => {\n setState(defaultChecked);\n\n // Collect an array of types from the children PromoCard components\n const types =\n React.Children.map(children, (child) => {\n if (React.isValidElement<PromoCardProps>(child) && child.props.type) {\n return child.props.type;\n }\n return null;\n })?.filter((type): type is 'radio' | 'checkbox' => type !== null && type !== undefined) ?? [];\n\n // Check if all types are the same\n const allTypesAreTheSame = types.every((type) => type === types[0]);\n\n // If all types are the same and the type is 'radio', set the container role\n setContainerRole(allTypesAreTheSame && types[0] === 'radio' ? 'radiogroup' : null);\n }, [defaultChecked, children]);\n\n return (\n <PromoCardContext.Provider value={contextValue}>\n <div {...commonProps}>{children}</div>\n </PromoCardContext.Provider>\n );\n};\n\nexport default React.memo(PromoCardGroup);\n"],"names":["PromoCardGroup","children","className","defaultChecked","id","isDisabled","onChange","testId","state","setState","useState","containerRole","setContainerRole","contextValue","useMemo","handleOnChange","value","commonClasses","clsx","commonProps","role","useEffect","types","React","Children","map","child","isValidElement","props","type","filter","undefined","allTypesAreTheSame","every","_jsx","PromoCardContext","Provider","memo"],"mappings":";;;;;AA4DA,MAAMA,cAAc,GAA2CA,CAAC;EAC9DC,QAAQ;EACRC,SAAS;AACTC,EAAAA,cAAc,GAAG,EAAE;EACnBC,EAAE;AACFC,EAAAA,UAAU,GAAG,KAAK;AAClB;AACAC,EAAAA,QAAQ,GAAGA,MAAK,EAAG;AACnBC,EAAAA,MAAAA;AACD,CAAA,KAAI;EACH,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAASP,cAAc,CAAC,CAAA;EAC1D,MAAM,CAACQ,aAAa,EAAEC,gBAAgB,CAAC,GAAGF,QAAQ,CAAgB,IAAI,CAAC,CAAA;AAEvE;;;;;;;;AAQG;AACH,EAAA,MAAMG,YAAY,GAAGC,OAAO,CAAC,MAAK;IAChC,MAAMC,cAAc,GAAIC,KAAa,IAAI;MACvCP,QAAQ,CAACO,KAAK,CAAC,CAAA;MACfV,QAAQ,CAACU,KAAK,CAAC,CAAA;KAChB,CAAA;IAED,OAAO;MAAER,KAAK;MAAEH,UAAU;AAAEC,MAAAA,QAAQ,EAAES,cAAAA;KAAgB,CAAA;GACvD,EAAE,CAACP,KAAK,EAAEH,UAAU,EAAEC,QAAQ,CAAC,CAAC,CAAA;EAEjC,MAAMW,aAAa,GAAGC,IAAI,CACxB;AACE,IAAA,cAAc,EAAE,IAAI;AACpB,IAAA,aAAa,EAAEb,UAAAA;GAChB,EACDH,SAAS,CACV,CAAA;AAED,EAAA,MAAMiB,WAAW,GAAG;AAClBjB,IAAAA,SAAS,EAAEe,aAAa;IACxBb,EAAE;AACF,IAAA,aAAa,EAAEG,MAAM;IACrBa,IAAI,EAAET,aAA+C;GACtD,CAAA;AAEDU,EAAAA,SAAS,CAAC,MAAK;IACbZ,QAAQ,CAACN,cAAc,CAAC,CAAA;AAExB;IACA,MAAMmB,KAAK,GACTC,cAAK,CAACC,QAAQ,CAACC,GAAG,CAACxB,QAAQ,EAAGyB,KAAK,IAAI;AACrC,MAAA,kBAAIH,cAAK,CAACI,cAAc,CAAiBD,KAAK,CAAC,IAAIA,KAAK,CAACE,KAAK,CAACC,IAAI,EAAE;AACnE,QAAA,OAAOH,KAAK,CAACE,KAAK,CAACC,IAAI,CAAA;AACzB,OAAA;AACA,MAAA,OAAO,IAAI,CAAA;AACb,KAAC,CAAC,EAAEC,MAAM,CAAED,IAAI,IAAmCA,IAAI,KAAK,IAAI,IAAIA,IAAI,KAAKE,SAAS,CAAC,IAAI,EAAE,CAAA;AAE/F;AACA,IAAA,MAAMC,kBAAkB,GAAGV,KAAK,CAACW,KAAK,CAAEJ,IAAI,IAAKA,IAAI,KAAKP,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAEnE;AACAV,IAAAA,gBAAgB,CAACoB,kBAAkB,IAAIV,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC,CAAA;AACpF,GAAC,EAAE,CAACnB,cAAc,EAAEF,QAAQ,CAAC,CAAC,CAAA;AAE9B,EAAA,oBACEiC,GAAA,CAACC,gBAAgB,CAACC,QAAQ,EAAA;AAACpB,IAAAA,KAAK,EAAEH,YAAa;AAAAZ,IAAAA,QAAA,eAC7CiC,GAAA,CAAA,KAAA,EAAA;AAAA,MAAA,GAASf,WAAW;AAAAlB,MAAAA,QAAA,EAAGA,QAAAA;KAAc,CAAA;AACvC,GAA2B,CAAC,CAAA;AAEhC,CAAC,CAAA;AAED,uBAAA,aAAesB,cAAK,CAACc,IAAI,CAACrC,cAAc,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PromoCardIndicator.js","sources":["../../src/promoCard/PromoCardIndicator.tsx"],"sourcesContent":["import { ArrowRight, Check, Download } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactElement, ReactNode } from 'react';\n\nimport Avatar, { AvatarType } from '../avatar';\nimport Body from '../body';\nimport { Typography } from '../common';\n\nexport type PromoCardIndicatorProps = {\n /** Optional class name(s) to add to the indicator container. */\n className?: string;\n\n /** Optional label to display next to the indicator. */\n label?: string;\n\n /** Optional icon to display in the indicator. */\n icon?: 'check' | 'arrow' | 'download' | ReactElement;\n\n /** Optional prop to specify whether the indicator is sized small or not. */\n isSmall?: boolean;\n\n /** Optional ID to add to the indicator container for testing purposes. */\n testid?: string;\n\n /** Optional children to display inside the indicator. */\n children?: ReactNode;\n};\n\n/**\n * PromoCardIndicator component.\n *\n * A PromoCardIndicator is a small component that can be used to display\n * additional information or actions related to a PromoCard. It can be\n * customized with various props to suit different use cases.\n *\n * @param {string} className - Optional class name(s) to add to the indicator container.\n * @param {string} label - Optional label to display next to the indicator.\n * @param {string | ReactElement} icon - Optional icon to display in the indicator.\n * @param {string} testid - Optional ID to add to the indicator container for testing purposes.\n * @param {ReactNode} children - Optional children to display inside the indicator.\n * @returns {JSX.Element} - The PromoCardIndicator component.\n * @example\n * <PromoCardIndicator label=\"Download\" icon=\"download\" />\n */\nconst PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({\n className,\n children,\n label,\n icon,\n isSmall = false,\n testid,\n ...rest\n}) => {\n const isIconString = icon && typeof icon === 'string';\n\n const IconComponent =\n isIconString &&\n {\n check: Check,\n arrow: ArrowRight,\n download: Download,\n }[icon];\n\n return (\n <div className={clsx('np-Card-indicator', className)} data-testid={testid} {...rest}>\n {label && (\n <Body as=\"span\" type={Typography.BODY_LARGE_BOLD} className=\"np-Card-indicatorText\">\n {label}\n </Body>\n )}\n {icon && (\n <Avatar\n type={AvatarType.ICON}\n size={isSmall ? 40 : 56}\n backgroundColor=\"var(--Card-indicator-icon-background-color)\"\n className=\"np-Card-indicatorIcon\"\n >\n {IconComponent ? <IconComponent size={24} aria-hidden=\"true\" /> : icon}\n </Avatar>\n )}\n {children}\n </div>\n );\n};\n\nexport default PromoCardIndicator;\n"],"names":["PromoCardIndicator","className","children","label","icon","isSmall","testid","rest","isIconString","IconComponent","check","Check","arrow","ArrowRight","download","Download","_jsxs","clsx","_jsx","Body","as","type","Typography","BODY_LARGE_BOLD","Avatar","AvatarType","ICON","size","backgroundColor"],"mappings":";;;;;;;;;;AA4CMA,MAAAA,kBAAkB,GAAsCA,CAAC;EAC7DC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACLC,IAAI;AACJC,EAAAA,OAAO,GAAG,KAAK;EACfC,MAAM;EACN,GAAGC,IAAAA;AACJ,CAAA,KAAI;AACH,EAAA,MAAMC,YAAY,GAAGJ,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,CAAA;EAErD,MAAMK,aAAa,GACjBD,YAAY,IACZ;AACEE,IAAAA,KAAK,EAAEC,WAAK;AACZC,IAAAA,KAAK,EAAEC,gBAAU;AACjBC,IAAAA,QAAQ,EAAEC,cAAAA;GACX,CAACX,IAAI,CAAC,CAAA;AAET,EAAA,oBACEY,eAAA,CAAA,KAAA,EAAA;AAAKf,IAAAA,SAAS,EAAEgB,SAAI,CAAC,mBAAmB,EAAEhB,SAAS,CAAE;AAAC,IAAA,aAAA,EAAaK,MAAO;AAAA,IAAA,GAAKC,IAAI;AAAAL,IAAAA,QAAA,EAChFC,CAAAA,KAAK,iBACJe,cAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACC,IAAI,EAAEC,qBAAU,CAACC,eAAgB;AAACtB,MAAAA,SAAS,EAAC,uBAAuB;AAAAC,MAAAA,QAAA,EAChFC,KAAAA;AAAK,KACF,CACP,EACAC,IAAI,iBACHc,cAAA,CAACM,MAAM,EAAA;MACLH,IAAI,EAAEI,sBAAU,CAACC,IAAK;AACtBC,MAAAA,IAAI,EAAEtB,OAAO,GAAG,EAAE,GAAG,EAAG;AACxBuB,MAAAA,eAAe,EAAC,6CAA6C;AAC7D3B,MAAAA,SAAS,EAAC,uBAAuB;AAAAC,MAAAA,QAAA,EAEhCO,aAAa,gBAAGS,cAAA,CAACT,aAAa,EAAA;AAACkB,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAY,EAAA,MAAA;AAAM,QAAG,GAAGvB,IAAAA;KAC5D,CACT,EACAF,QAAQ,CAAA;AAAA,GACN,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"PromoCardIndicator.js","sources":["../../src/promoCard/PromoCardIndicator.tsx"],"sourcesContent":["import { ArrowRight, Check, Download } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactElement, ReactNode } from 'react';\n\nimport Avatar, { AvatarType } from '../avatar';\nimport Body from '../body';\nimport { Typography } from '../common';\n\nexport type PromoCardIndicatorProps = {\n /** Optional class name(s) to add to the indicator container. */\n className?: string;\n\n /** Optional label to display next to the indicator. */\n label?: string;\n\n /** Optional icon to display in the indicator. */\n icon?: 'check' | 'arrow' | 'download' | ReactElement;\n\n /** Optional prop to specify whether the indicator is sized small or not. */\n isSmall?: boolean;\n\n /** Optional ID to add to the indicator container for testing purposes. */\n testid?: string;\n\n /** Optional children to display inside the indicator. */\n children?: ReactNode;\n};\n\n/**\n * PromoCardIndicator component.\n *\n * A PromoCardIndicator is a small component that can be used to display\n * additional information or actions related to a PromoCard. It can be\n * customized with various props to suit different use cases.\n *\n * @param {string} className - Optional class name(s) to add to the indicator container.\n * @param {string} label - Optional label to display next to the indicator.\n * @param {string | ReactElement} icon - Optional icon to display in the indicator.\n * @param {string} testid - Optional ID to add to the indicator container for testing purposes.\n * @param {ReactNode} children - Optional children to display inside the indicator.\n * @returns {React.JSX.Element} - The PromoCardIndicator component.\n * @example\n * <PromoCardIndicator label=\"Download\" icon=\"download\" />\n */\nconst PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({\n className,\n children,\n label,\n icon,\n isSmall = false,\n testid,\n ...rest\n}) => {\n const isIconString = icon && typeof icon === 'string';\n\n const IconComponent =\n isIconString &&\n {\n check: Check,\n arrow: ArrowRight,\n download: Download,\n }[icon];\n\n return (\n <div className={clsx('np-Card-indicator', className)} data-testid={testid} {...rest}>\n {label && (\n <Body as=\"span\" type={Typography.BODY_LARGE_BOLD} className=\"np-Card-indicatorText\">\n {label}\n </Body>\n )}\n {icon && (\n <Avatar\n type={AvatarType.ICON}\n size={isSmall ? 40 : 56}\n backgroundColor=\"var(--Card-indicator-icon-background-color)\"\n className=\"np-Card-indicatorIcon\"\n >\n {IconComponent ? <IconComponent size={24} aria-hidden=\"true\" /> : icon}\n </Avatar>\n )}\n {children}\n </div>\n );\n};\n\nexport default PromoCardIndicator;\n"],"names":["PromoCardIndicator","className","children","label","icon","isSmall","testid","rest","isIconString","IconComponent","check","Check","arrow","ArrowRight","download","Download","_jsxs","clsx","_jsx","Body","as","type","Typography","BODY_LARGE_BOLD","Avatar","AvatarType","ICON","size","backgroundColor"],"mappings":";;;;;;;;;;AA4CMA,MAAAA,kBAAkB,GAAsCA,CAAC;EAC7DC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACLC,IAAI;AACJC,EAAAA,OAAO,GAAG,KAAK;EACfC,MAAM;EACN,GAAGC,IAAAA;AACJ,CAAA,KAAI;AACH,EAAA,MAAMC,YAAY,GAAGJ,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,CAAA;EAErD,MAAMK,aAAa,GACjBD,YAAY,IACZ;AACEE,IAAAA,KAAK,EAAEC,WAAK;AACZC,IAAAA,KAAK,EAAEC,gBAAU;AACjBC,IAAAA,QAAQ,EAAEC,cAAAA;GACX,CAACX,IAAI,CAAC,CAAA;AAET,EAAA,oBACEY,eAAA,CAAA,KAAA,EAAA;AAAKf,IAAAA,SAAS,EAAEgB,SAAI,CAAC,mBAAmB,EAAEhB,SAAS,CAAE;AAAC,IAAA,aAAA,EAAaK,MAAO;AAAA,IAAA,GAAKC,IAAI;AAAAL,IAAAA,QAAA,EAChFC,CAAAA,KAAK,iBACJe,cAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACC,IAAI,EAAEC,qBAAU,CAACC,eAAgB;AAACtB,MAAAA,SAAS,EAAC,uBAAuB;AAAAC,MAAAA,QAAA,EAChFC,KAAAA;AAAK,KACF,CACP,EACAC,IAAI,iBACHc,cAAA,CAACM,MAAM,EAAA;MACLH,IAAI,EAAEI,sBAAU,CAACC,IAAK;AACtBC,MAAAA,IAAI,EAAEtB,OAAO,GAAG,EAAE,GAAG,EAAG;AACxBuB,MAAAA,eAAe,EAAC,6CAA6C;AAC7D3B,MAAAA,SAAS,EAAC,uBAAuB;AAAAC,MAAAA,QAAA,EAEhCO,aAAa,gBAAGS,cAAA,CAACT,aAAa,EAAA;AAACkB,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAY,EAAA,MAAA;AAAM,QAAG,GAAGvB,IAAAA;KAC5D,CACT,EACAF,QAAQ,CAAA;AAAA,GACN,CAAC,CAAA;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PromoCardIndicator.mjs","sources":["../../src/promoCard/PromoCardIndicator.tsx"],"sourcesContent":["import { ArrowRight, Check, Download } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactElement, ReactNode } from 'react';\n\nimport Avatar, { AvatarType } from '../avatar';\nimport Body from '../body';\nimport { Typography } from '../common';\n\nexport type PromoCardIndicatorProps = {\n /** Optional class name(s) to add to the indicator container. */\n className?: string;\n\n /** Optional label to display next to the indicator. */\n label?: string;\n\n /** Optional icon to display in the indicator. */\n icon?: 'check' | 'arrow' | 'download' | ReactElement;\n\n /** Optional prop to specify whether the indicator is sized small or not. */\n isSmall?: boolean;\n\n /** Optional ID to add to the indicator container for testing purposes. */\n testid?: string;\n\n /** Optional children to display inside the indicator. */\n children?: ReactNode;\n};\n\n/**\n * PromoCardIndicator component.\n *\n * A PromoCardIndicator is a small component that can be used to display\n * additional information or actions related to a PromoCard. It can be\n * customized with various props to suit different use cases.\n *\n * @param {string} className - Optional class name(s) to add to the indicator container.\n * @param {string} label - Optional label to display next to the indicator.\n * @param {string | ReactElement} icon - Optional icon to display in the indicator.\n * @param {string} testid - Optional ID to add to the indicator container for testing purposes.\n * @param {ReactNode} children - Optional children to display inside the indicator.\n * @returns {JSX.Element} - The PromoCardIndicator component.\n * @example\n * <PromoCardIndicator label=\"Download\" icon=\"download\" />\n */\nconst PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({\n className,\n children,\n label,\n icon,\n isSmall = false,\n testid,\n ...rest\n}) => {\n const isIconString = icon && typeof icon === 'string';\n\n const IconComponent =\n isIconString &&\n {\n check: Check,\n arrow: ArrowRight,\n download: Download,\n }[icon];\n\n return (\n <div className={clsx('np-Card-indicator', className)} data-testid={testid} {...rest}>\n {label && (\n <Body as=\"span\" type={Typography.BODY_LARGE_BOLD} className=\"np-Card-indicatorText\">\n {label}\n </Body>\n )}\n {icon && (\n <Avatar\n type={AvatarType.ICON}\n size={isSmall ? 40 : 56}\n backgroundColor=\"var(--Card-indicator-icon-background-color)\"\n className=\"np-Card-indicatorIcon\"\n >\n {IconComponent ? <IconComponent size={24} aria-hidden=\"true\" /> : icon}\n </Avatar>\n )}\n {children}\n </div>\n );\n};\n\nexport default PromoCardIndicator;\n"],"names":["PromoCardIndicator","className","children","label","icon","isSmall","testid","rest","isIconString","IconComponent","check","Check","arrow","ArrowRight","download","Download","_jsxs","clsx","_jsx","Body","as","type","Typography","BODY_LARGE_BOLD","Avatar","AvatarType","ICON","size","backgroundColor"],"mappings":";;;;;;;;AA4CMA,MAAAA,kBAAkB,GAAsCA,CAAC;EAC7DC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACLC,IAAI;AACJC,EAAAA,OAAO,GAAG,KAAK;EACfC,MAAM;EACN,GAAGC,IAAAA;AACJ,CAAA,KAAI;AACH,EAAA,MAAMC,YAAY,GAAGJ,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,CAAA;EAErD,MAAMK,aAAa,GACjBD,YAAY,IACZ;AACEE,IAAAA,KAAK,EAAEC,KAAK;AACZC,IAAAA,KAAK,EAAEC,UAAU;AACjBC,IAAAA,QAAQ,EAAEC,QAAAA;GACX,CAACX,IAAI,CAAC,CAAA;AAET,EAAA,oBACEY,IAAA,CAAA,KAAA,EAAA;AAAKf,IAAAA,SAAS,EAAEgB,IAAI,CAAC,mBAAmB,EAAEhB,SAAS,CAAE;AAAC,IAAA,aAAA,EAAaK,MAAO;AAAA,IAAA,GAAKC,IAAI;AAAAL,IAAAA,QAAA,EAChFC,CAAAA,KAAK,iBACJe,GAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACC,IAAI,EAAEC,UAAU,CAACC,eAAgB;AAACtB,MAAAA,SAAS,EAAC,uBAAuB;AAAAC,MAAAA,QAAA,EAChFC,KAAAA;AAAK,KACF,CACP,EACAC,IAAI,iBACHc,GAAA,CAACM,MAAM,EAAA;MACLH,IAAI,EAAEI,UAAU,CAACC,IAAK;AACtBC,MAAAA,IAAI,EAAEtB,OAAO,GAAG,EAAE,GAAG,EAAG;AACxBuB,MAAAA,eAAe,EAAC,6CAA6C;AAC7D3B,MAAAA,SAAS,EAAC,uBAAuB;AAAAC,MAAAA,QAAA,EAEhCO,aAAa,gBAAGS,GAAA,CAACT,aAAa,EAAA;AAACkB,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAY,EAAA,MAAA;AAAM,QAAG,GAAGvB,IAAAA;KAC5D,CACT,EACAF,QAAQ,CAAA;AAAA,GACN,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"PromoCardIndicator.mjs","sources":["../../src/promoCard/PromoCardIndicator.tsx"],"sourcesContent":["import { ArrowRight, Check, Download } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactElement, ReactNode } from 'react';\n\nimport Avatar, { AvatarType } from '../avatar';\nimport Body from '../body';\nimport { Typography } from '../common';\n\nexport type PromoCardIndicatorProps = {\n /** Optional class name(s) to add to the indicator container. */\n className?: string;\n\n /** Optional label to display next to the indicator. */\n label?: string;\n\n /** Optional icon to display in the indicator. */\n icon?: 'check' | 'arrow' | 'download' | ReactElement;\n\n /** Optional prop to specify whether the indicator is sized small or not. */\n isSmall?: boolean;\n\n /** Optional ID to add to the indicator container for testing purposes. */\n testid?: string;\n\n /** Optional children to display inside the indicator. */\n children?: ReactNode;\n};\n\n/**\n * PromoCardIndicator component.\n *\n * A PromoCardIndicator is a small component that can be used to display\n * additional information or actions related to a PromoCard. It can be\n * customized with various props to suit different use cases.\n *\n * @param {string} className - Optional class name(s) to add to the indicator container.\n * @param {string} label - Optional label to display next to the indicator.\n * @param {string | ReactElement} icon - Optional icon to display in the indicator.\n * @param {string} testid - Optional ID to add to the indicator container for testing purposes.\n * @param {ReactNode} children - Optional children to display inside the indicator.\n * @returns {React.JSX.Element} - The PromoCardIndicator component.\n * @example\n * <PromoCardIndicator label=\"Download\" icon=\"download\" />\n */\nconst PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({\n className,\n children,\n label,\n icon,\n isSmall = false,\n testid,\n ...rest\n}) => {\n const isIconString = icon && typeof icon === 'string';\n\n const IconComponent =\n isIconString &&\n {\n check: Check,\n arrow: ArrowRight,\n download: Download,\n }[icon];\n\n return (\n <div className={clsx('np-Card-indicator', className)} data-testid={testid} {...rest}>\n {label && (\n <Body as=\"span\" type={Typography.BODY_LARGE_BOLD} className=\"np-Card-indicatorText\">\n {label}\n </Body>\n )}\n {icon && (\n <Avatar\n type={AvatarType.ICON}\n size={isSmall ? 40 : 56}\n backgroundColor=\"var(--Card-indicator-icon-background-color)\"\n className=\"np-Card-indicatorIcon\"\n >\n {IconComponent ? <IconComponent size={24} aria-hidden=\"true\" /> : icon}\n </Avatar>\n )}\n {children}\n </div>\n );\n};\n\nexport default PromoCardIndicator;\n"],"names":["PromoCardIndicator","className","children","label","icon","isSmall","testid","rest","isIconString","IconComponent","check","Check","arrow","ArrowRight","download","Download","_jsxs","clsx","_jsx","Body","as","type","Typography","BODY_LARGE_BOLD","Avatar","AvatarType","ICON","size","backgroundColor"],"mappings":";;;;;;;;AA4CMA,MAAAA,kBAAkB,GAAsCA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"version":3,"file":"Sticky.js","sources":["../../src/sticky/Sticky.tsx"],"sourcesContent":["import { Position } from '../common';\nimport SlidingPanel from '../slidingPanel';\nimport { FunctionComponent } from 'react';\n\nexport interface StickyProps {\n /** Optional prop for children components to be rendered inside the Sticky component. */\n children?: React.ReactNode;\n\n /** Optional props that determines if the Sticky component is open or closed. Default value is `true`. */\n open?: boolean;\n\n /** Optional props that specifies the position of the Sticky component on the screen. Can be either `top` or `bottom`. */\n position?: `${Position.TOP}` | `${Position.BOTTOM}`;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n}\n\n/**\n * ### Sticky Component\n *\n * `<Sticky />` is a component that renders a `<SlidingPanel />` with specified props.\n * It uses the `<SlidingPanel />` component to create a panel that can slide in and out of view,\n * based on the `open` prop. It can be positioned at the top or bottom of the container,\n * as specified by the `position` prop.\n *\n * @component\n * @param {ReactNode} children - Children content.\n * @param {boolean} open - Determines if the Sticky component is open or closed.\n * @param {('top'|'bottom')} position - Specifies the position.\n * @param {string} testId - ID used for testing.\n * @returns {JSX.Element} The `SlidingPanel` component with applied props.\n * @example\n * <Button onClick={() => setOpen(!open)}>Open Sticky</Button>\n * <Sticky open={open} position={'bottom'}>\n * <div>\n * <Button onClick={() => setOpen(!open)}>Close Sticky</Button>\n * </div>\n * </Sticky>\n */\nconst Sticky: FunctionComponent<StickyProps> = ({\n children,\n open = true,\n position = Position.BOTTOM,\n testId,\n}: StickyProps) => {\n return (\n <SlidingPanel\n testId={testId}\n open={open}\n position={position}\n slidingPanelPositionFixed\n showSlidingPanelBorder\n >\n {children}\n </SlidingPanel>\n );\n};\n\nexport default Sticky;\n"],"names":["Sticky","children","open","position","Position","BOTTOM","testId","_jsx","SlidingPanel","slidingPanelPositionFixed","showSlidingPanelBorder"],"mappings":";;;;;;AAwCMA,MAAAA,MAAM,GAAmCA,CAAC;EAC9CC,QAAQ;AACRC,EAAAA,IAAI,GAAG,IAAI;YACXC,UAAQ,GAAGC,iBAAQ,CAACC,MAAM;AAC1BC,EAAAA,MAAAA;AAAM,CACM,KAAI;EAChB,oBACEC,cAAA,CAACC,oBAAY,EAAA;AACXF,IAAAA,MAAM,EAAEA,MAAO;AACfJ,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,UAAS;IACnBM,yBAAyB,EAAA,IAAA;IACzBC,sBAAsB,EAAA,IAAA;AAAAT,IAAAA,QAAA,EAErBA,QAAAA;AAAQ,GACG,CAAC,CAAA;AAEnB;;;;"}
1
+ {"version":3,"file":"Sticky.js","sources":["../../src/sticky/Sticky.tsx"],"sourcesContent":["import { Position } from '../common';\nimport SlidingPanel from '../slidingPanel';\nimport { FunctionComponent } from 'react';\n\nexport interface StickyProps {\n /** Optional prop for children components to be rendered inside the Sticky component. */\n children?: React.ReactNode;\n\n /** Optional props that determines if the Sticky component is open or closed. Default value is `true`. */\n open?: boolean;\n\n /** Optional props that specifies the position of the Sticky component on the screen. Can be either `top` or `bottom`. */\n position?: `${Position.TOP}` | `${Position.BOTTOM}`;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n}\n\n/**\n * ### Sticky Component\n *\n * `<Sticky />` is a component that renders a `<SlidingPanel />` with specified props.\n * It uses the `<SlidingPanel />` component to create a panel that can slide in and out of view,\n * based on the `open` prop. It can be positioned at the top or bottom of the container,\n * as specified by the `position` prop.\n *\n * @component\n * @param {ReactNode} children - Children content.\n * @param {boolean} open - Determines if the Sticky component is open or closed.\n * @param {('top'|'bottom')} position - Specifies the position.\n * @param {string} testId - ID used for testing.\n * @returns {React.JSX.Element} The `SlidingPanel` component with applied props.\n * @example\n * <Button onClick={() => setOpen(!open)}>Open Sticky</Button>\n * <Sticky open={open} position={'bottom'}>\n * <div>\n * <Button onClick={() => setOpen(!open)}>Close Sticky</Button>\n * </div>\n * </Sticky>\n */\nconst Sticky: FunctionComponent<StickyProps> = ({\n children,\n open = true,\n position = Position.BOTTOM,\n testId,\n}: StickyProps) => {\n return (\n <SlidingPanel\n testId={testId}\n open={open}\n position={position}\n slidingPanelPositionFixed\n showSlidingPanelBorder\n >\n {children}\n </SlidingPanel>\n );\n};\n\nexport default Sticky;\n"],"names":["Sticky","children","open","position","Position","BOTTOM","testId","_jsx","SlidingPanel","slidingPanelPositionFixed","showSlidingPanelBorder"],"mappings":";;;;;;AAwCMA,MAAAA,MAAM,GAAmCA,CAAC;EAC9CC,QAAQ;AACRC,EAAAA,IAAI,GAAG,IAAI;YACXC,UAAQ,GAAGC,iBAAQ,CAACC,MAAM;AAC1BC,EAAAA,MAAAA;AAAM,CACM,KAAI;EAChB,oBACEC,cAAA,CAACC,oBAAY,EAAA;AACXF,IAAAA,MAAM,EAAEA,MAAO;AACfJ,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,UAAS;IACnBM,yBAAyB,EAAA,IAAA;IACzBC,sBAAsB,EAAA,IAAA;AAAAT,IAAAA,QAAA,EAErBA,QAAAA;AAAQ,GACG,CAAC,CAAA;AAEnB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Sticky.mjs","sources":["../../src/sticky/Sticky.tsx"],"sourcesContent":["import { Position } from '../common';\nimport SlidingPanel from '../slidingPanel';\nimport { FunctionComponent } from 'react';\n\nexport interface StickyProps {\n /** Optional prop for children components to be rendered inside the Sticky component. */\n children?: React.ReactNode;\n\n /** Optional props that determines if the Sticky component is open or closed. Default value is `true`. */\n open?: boolean;\n\n /** Optional props that specifies the position of the Sticky component on the screen. Can be either `top` or `bottom`. */\n position?: `${Position.TOP}` | `${Position.BOTTOM}`;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n}\n\n/**\n * ### Sticky Component\n *\n * `<Sticky />` is a component that renders a `<SlidingPanel />` with specified props.\n * It uses the `<SlidingPanel />` component to create a panel that can slide in and out of view,\n * based on the `open` prop. It can be positioned at the top or bottom of the container,\n * as specified by the `position` prop.\n *\n * @component\n * @param {ReactNode} children - Children content.\n * @param {boolean} open - Determines if the Sticky component is open or closed.\n * @param {('top'|'bottom')} position - Specifies the position.\n * @param {string} testId - ID used for testing.\n * @returns {JSX.Element} The `SlidingPanel` component with applied props.\n * @example\n * <Button onClick={() => setOpen(!open)}>Open Sticky</Button>\n * <Sticky open={open} position={'bottom'}>\n * <div>\n * <Button onClick={() => setOpen(!open)}>Close Sticky</Button>\n * </div>\n * </Sticky>\n */\nconst Sticky: FunctionComponent<StickyProps> = ({\n children,\n open = true,\n position = Position.BOTTOM,\n testId,\n}: StickyProps) => {\n return (\n <SlidingPanel\n testId={testId}\n open={open}\n position={position}\n slidingPanelPositionFixed\n showSlidingPanelBorder\n >\n {children}\n </SlidingPanel>\n );\n};\n\nexport default Sticky;\n"],"names":["Sticky","children","open","position","Position","BOTTOM","testId","_jsx","SlidingPanel","slidingPanelPositionFixed","showSlidingPanelBorder"],"mappings":";;;;AAwCMA,MAAAA,MAAM,GAAmCA,CAAC;EAC9CC,QAAQ;AACRC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ,GAAGC,QAAQ,CAACC,MAAM;AAC1BC,EAAAA,MAAAA;AAAM,CACM,KAAI;EAChB,oBACEC,GAAA,CAACC,YAAY,EAAA;AACXF,IAAAA,MAAM,EAAEA,MAAO;AACfJ,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,QAAS;IACnBM,yBAAyB,EAAA,IAAA;IACzBC,sBAAsB,EAAA,IAAA;AAAAT,IAAAA,QAAA,EAErBA,QAAAA;AAAQ,GACG,CAAC,CAAA;AAEnB;;;;"}
1
+ {"version":3,"file":"Sticky.mjs","sources":["../../src/sticky/Sticky.tsx"],"sourcesContent":["import { Position } from '../common';\nimport SlidingPanel from '../slidingPanel';\nimport { FunctionComponent } from 'react';\n\nexport interface StickyProps {\n /** Optional prop for children components to be rendered inside the Sticky component. */\n children?: React.ReactNode;\n\n /** Optional props that determines if the Sticky component is open or closed. Default value is `true`. */\n open?: boolean;\n\n /** Optional props that specifies the position of the Sticky component on the screen. Can be either `top` or `bottom`. */\n position?: `${Position.TOP}` | `${Position.BOTTOM}`;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n}\n\n/**\n * ### Sticky Component\n *\n * `<Sticky />` is a component that renders a `<SlidingPanel />` with specified props.\n * It uses the `<SlidingPanel />` component to create a panel that can slide in and out of view,\n * based on the `open` prop. It can be positioned at the top or bottom of the container,\n * as specified by the `position` prop.\n *\n * @component\n * @param {ReactNode} children - Children content.\n * @param {boolean} open - Determines if the Sticky component is open or closed.\n * @param {('top'|'bottom')} position - Specifies the position.\n * @param {string} testId - ID used for testing.\n * @returns {React.JSX.Element} The `SlidingPanel` component with applied props.\n * @example\n * <Button onClick={() => setOpen(!open)}>Open Sticky</Button>\n * <Sticky open={open} position={'bottom'}>\n * <div>\n * <Button onClick={() => setOpen(!open)}>Close Sticky</Button>\n * </div>\n * </Sticky>\n */\nconst Sticky: FunctionComponent<StickyProps> = ({\n children,\n open = true,\n position = Position.BOTTOM,\n testId,\n}: StickyProps) => {\n return (\n <SlidingPanel\n testId={testId}\n open={open}\n position={position}\n slidingPanelPositionFixed\n showSlidingPanelBorder\n >\n {children}\n </SlidingPanel>\n );\n};\n\nexport default Sticky;\n"],"names":["Sticky","children","open","position","Position","BOTTOM","testId","_jsx","SlidingPanel","slidingPanelPositionFixed","showSlidingPanelBorder"],"mappings":";;;;AAwCMA,MAAAA,MAAM,GAAmCA,CAAC;EAC9CC,QAAQ;AACRC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ,GAAGC,QAAQ,CAACC,MAAM;AAC1BC,EAAAA,MAAAA;AAAM,CACM,KAAI;EAChB,oBACEC,GAAA,CAACC,YAAY,EAAA;AACXF,IAAAA,MAAM,EAAEA,MAAO;AACfJ,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,QAAS;IACnBM,yBAAyB,EAAA,IAAA;IACzBC,sBAAsB,EAAA,IAAA;AAAAT,IAAAA,QAAA,EAErBA,QAAAA;AAAQ,GACG,CAAC,CAAA;AAEnB;;;;"}
@@ -30,7 +30,7 @@ export interface CardProps {
30
30
  * @param {boolean} isSmall - Whether the card is small or not.
31
31
  * @param {(event_: MouseEvent<HTMLButtonElement>) => void} onDismiss - Optional function to call when the card is dismissed.
32
32
  * @param {string} testId - Optional ID to add to the card container for testing purposes.
33
- * @returns {JSX.Element} - The card component.
33
+ * @returns {React.JSX.Element} - The card component.
34
34
  * @example
35
35
  * <Card>
36
36
  * <p>Hello World!</p>
@@ -176,8 +176,4 @@ export { DEFAULT_LANG, DEFAULT_LOCALE, RTL_LANGUAGES, SUPPORTED_LANGUAGES, adjus
176
176
  * Translations
177
177
  */
178
178
  export { default as translations } from './i18n';
179
- /**
180
- * HoCs
181
- */
182
- export { default as withId } from './withId';
183
179
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjG,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EACV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,SAAS,EACT,UAAU,EACV,eAAe,GA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,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,MAAM,EACN,SAAS,EACT,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,UAAU,EACV,OAAO,EACP,KAAK,GACN,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { WrappedComponentProps } from 'react-intl';
2
- import { SizeLarge, SizeMedium, SizeSmall } from '../common';
2
+ import { SizeLarge, SizeMedium, SizeSmall } from '../common/propsValues/size';
3
3
  import { WithInputAttributesProps } from '../inputs/contexts';
4
4
  import { SelectInputProps } from '../inputs/SelectInput';
5
5
  export interface CurrencyOptionItem {
@@ -39,12 +39,8 @@ export interface MoneyInputProps extends WrappedComponentProps {
39
39
  selectProps?: Partial<SelectInputProps<CurrencyOptionItem>>;
40
40
  }
41
41
  type MoneyInputPropsWithInputAttributes = MoneyInputProps & Partial<WithInputAttributesProps>;
42
- declare const _default: import("react").FC<import("react-intl").WithIntlProps<Omit<MoneyInputPropsWithInputAttributes, "inputAttributes"> & {
43
- id?: string;
44
- }>> & {
45
- WrappedComponent: import("react").ComponentType<Omit<MoneyInputPropsWithInputAttributes, "inputAttributes"> & {
46
- id?: string;
47
- }>;
42
+ declare const _default: import("react").FC<import("react-intl").WithIntlProps<Omit<MoneyInputPropsWithInputAttributes, "inputAttributes">>> & {
43
+ WrappedComponent: import("react").ComponentType<Omit<MoneyInputPropsWithInputAttributes, "inputAttributes">>;
48
44
  };
49
45
  export default _default;
50
46
  //# sourceMappingURL=MoneyInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAoB,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAuB,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAKL,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AA0CnE,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iB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UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;CAC7D;AAED,KAAK,kCAAkC,GAAG,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;;;;AAuY9F,wBAAmF"}
@@ -25,7 +25,7 @@ export type PromoCardIndicatorProps = {
25
25
  * @param {string | ReactElement} icon - Optional icon to display in the indicator.
26
26
  * @param {string} testid - Optional ID to add to the indicator container for testing purposes.
27
27
  * @param {ReactNode} children - Optional children to display inside the indicator.
28
- * @returns {JSX.Element} - The PromoCardIndicator component.
28
+ * @returns {React.JSX.Element} - The PromoCardIndicator component.
29
29
  * @example
30
30
  * <PromoCardIndicator label="Download" icon="download" />
31
31
  */
@@ -23,7 +23,7 @@ export interface StickyProps {
23
23
  * @param {boolean} open - Determines if the Sticky component is open or closed.
24
24
  * @param {('top'|'bottom')} position - Specifies the position.
25
25
  * @param {string} testId - ID used for testing.
26
- * @returns {JSX.Element} The `SlidingPanel` component with applied props.
26
+ * @returns {React.JSX.Element} The `SlidingPanel` component with applied props.
27
27
  * @example
28
28
  * <Button onClick={() => setOpen(!open)}>Open Sticky</Button>
29
29
  * <Sticky open={open} position={'bottom'}>
@@ -1,5 +1,5 @@
1
1
  import { UploadedFile } from '../types';
2
- export type UploadItemProps = JSX.IntrinsicAttributes & {
2
+ export type UploadItemProps = React.JSX.IntrinsicAttributes & {
3
3
  file: UploadedFile;
4
4
  /**
5
5
  * Is this Item part of a multiple- or single-file UploadInput
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAe,MAAM,UAAU,CAAC;AAKrD,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCA8HjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAe,MAAM,UAAU,CAAC;AAKrD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAAG;IAC5D,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCA8HjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.js","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin, CheckCircleFill, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemLink } from './UploadItemLink';\n\nexport type UploadItemProps = JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n /**\n * We're temporarily reverting to the regular icon components,\n * until the StatusIcon receives 24px sizing. Some misalignment\n * to be expected.\n */\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <CrossCircleFill size={24} className=\"emphasis--negative\" />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <CheckCircleFill size={24} className=\"emphasis--positive\" />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={clsx('np-upload-item', { 'np-upload-item--link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemLink\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemLink>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={clsx('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","CrossCircleFill","size","className","processIndicator","PROCESSING","PENDING","ProcessIndicator","Size","EXTRA_SMALL","DONE","CheckCircleFill","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","clsx","uploadItem","_jsxs","UploadItemLink","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;;;;;AA+BYA,0BAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,gBAAQ,KAARA,gBAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACA,KAAI;EACpB,MAAM;AAAEC,IAAAA,aAAAA;GAAe,GAAGC,iBAAO,EAAE,CAAA;EACnC,MAAM;YAAEC,QAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,MAAM;AAAEC,IAAAA,GAAAA;AAAK,GAAA,GAAGX,IAAI,CAAA;AAErD,EAAA,MAAMY,WAAW,GAAG,CAACC,aAAM,CAACC,SAAS,EAAEC,SAAS,CAAC,CAACC,QAAQ,CAACT,QAAM,CAAC,IAAI,CAAC,CAACI,GAAG,CAAA;AAE3E;;;;AAIG;EACH,MAAMM,OAAO,GAAGA,MAAK;IACnB,IAAIR,KAAK,IAAIC,MAAM,EAAEQ,MAAM,IAAIX,QAAM,KAAKM,aAAM,CAACM,MAAM,EAAE;MACvD,oBAAOC,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,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A;AAAKhC,cAAAA,SAAS,EAAC,yBAAyB;cAAC,aAAazB,EAAAA,gBAAQ,CAAC2D,SAAU;cAAApB,QAAA,EAAA,cACvEjB,cAAA,CAACqB,IAAI,EAAA;AAAClB,gBAAAA,SAAS,EAAC,sCAAsC;gBAAAc,QAAA,EAAEW,QAAQ,EAAE;AAAA,eAAO,CACzE,EAACR,cAAc,EAAE,CAAA;AAAA,aACd,CACP,CAAA;WAAK,CAAA;SACF,CAAA;AACP,OAAgB,CAChB,EAACvC,SAAS,iBACRmB,cAAA,CAAA,QAAA,EAAA;AACE,QAAA,YAAA,EAAYf,aAAa,CAAC6B,mBAAQ,CAACwB,UAAU,EAAE;AAAElD,UAAAA,QAAAA;AAAU,SAAA,CAAE;QAC7De,SAAS,EAAE8B,SAAI,CAAC,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE;AACpE,UAAA,6BAA6B,EAAEjD,gBAAAA;AAChC,SAAA,CAAE;AACHsC,QAAAA,IAAI,EAAC,QAAQ;AACbiB,QAAAA,OAAO,EAAEA,MAAMzD,QAAQ,EAAG;QAAAmC,QAAA,eAE1BjB,cAAA,CAACwC,SAAG,EAAA;AAACtC,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"UploadItem.js","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin, CheckCircleFill, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemLink } from './UploadItemLink';\n\nexport type UploadItemProps = React.JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n /**\n * We're temporarily reverting to the regular icon components,\n * until the StatusIcon receives 24px sizing. Some misalignment\n * to be expected.\n */\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <CrossCircleFill size={24} className=\"emphasis--negative\" />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <CheckCircleFill size={24} className=\"emphasis--positive\" />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={clsx('np-upload-item', { 'np-upload-item--link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemLink\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemLink>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={clsx('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","CrossCircleFill","size","className","processIndicator","PROCESSING","PENDING","ProcessIndicator","Size","EXTRA_SMALL","DONE","CheckCircleFill","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","clsx","uploadItem","_jsxs","UploadItemLink","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;;;;;AA+BYA,0BAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,gBAAQ,KAARA,gBAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACA,KAAI;EACpB,MAAM;AAAEC,IAAAA,aAAAA;GAAe,GAAGC,iBAAO,EAAE,CAAA;EACnC,MAAM;YAAEC,QAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,MAAM;AAAEC,IAAAA,GAAAA;AAAK,GAAA,GAAGX,IAAI,CAAA;AAErD,EAAA,MAAMY,WAAW,GAAG,CAACC,aAAM,CAACC,SAAS,EAAEC,SAAS,CAAC,CAACC,QAAQ,CAACT,QAAM,CAAC,IAAI,CAAC,CAACI,GAAG,CAAA;AAE3E;;;;AAIG;EACH,MAAMM,OAAO,GAAGA,MAAK;IACnB,IAAIR,KAAK,IAAIC,MAAM,EAAEQ,MAAM,IAAIX,QAAM,KAAKM,aAAM,CAACM,MAAM,EAAE;MACvD,oBAAOC,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;AAACC,QAAAA,SAAS,EAAC,oBAAA;AAAoB,QAAG,CAAA;AACrE,KAAA;AAEA,IAAA,IAAIC,gBAAiC,CAAA;AAErC,IAAA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I,EAAA;AAAClB,gBAAAA,SAAS,EAAC,sCAAsC;gBAAAc,QAAA,EAAEW,QAAQ,EAAE;AAAA,eAAO,CACzE,EAACR,cAAc,EAAE,CAAA;AAAA,aACd,CACP,CAAA;WAAK,CAAA;SACF,CAAA;AACP,OAAgB,CAChB,EAACvC,SAAS,iBACRmB,cAAA,CAAA,QAAA,EAAA;AACE,QAAA,YAAA,EAAYf,aAAa,CAAC6B,mBAAQ,CAACwB,UAAU,EAAE;AAAElD,UAAAA,QAAAA;AAAU,SAAA,CAAE;QAC7De,SAAS,EAAE8B,SAAI,CAAC,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE;AACpE,UAAA,6BAA6B,EAAEjD,gBAAAA;AAChC,SAAA,CAAE;AACHsC,QAAAA,IAAI,EAAC,QAAQ;AACbiB,QAAAA,OAAO,EAAEA,MAAMzD,QAAQ,EAAG;QAAAmC,QAAA,eAE1BjB,cAAA,CAACwC,SAAG,EAAA;AAACtC,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin, CheckCircleFill, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemLink } from './UploadItemLink';\n\nexport type UploadItemProps = JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n /**\n * We're temporarily reverting to the regular icon components,\n * until the StatusIcon receives 24px sizing. Some misalignment\n * to be expected.\n */\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <CrossCircleFill size={24} className=\"emphasis--negative\" />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <CheckCircleFill size={24} className=\"emphasis--positive\" />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={clsx('np-upload-item', { 'np-upload-item--link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemLink\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemLink>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={clsx('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","CrossCircleFill","size","className","processIndicator","PROCESSING","PENDING","ProcessIndicator","Size","EXTRA_SMALL","DONE","CheckCircleFill","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","clsx","uploadItem","_jsxs","UploadItemLink","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;IA+BYA,SAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,QAAQ,KAARA,QAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACA,KAAI;EACpB,MAAM;AAAEC,IAAAA,aAAAA;GAAe,GAAGC,OAAO,EAAE,CAAA;EACnC,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,MAAM;AAAEC,IAAAA,GAAAA;AAAK,GAAA,GAAGX,IAAI,CAAA;AAErD,EAAA,MAAMY,WAAW,GAAG,CAACC,MAAM,CAACC,SAAS,EAAEC,SAAS,CAAC,CAACC,QAAQ,CAACT,MAAM,CAAC,IAAI,CAAC,CAACI,GAAG,CAAA;AAE3E;;;;AAIG;EACH,MAAMM,OAAO,GAAGA,MAAK;IACnB,IAAIR,KAAK,IAAIC,MAAM,EAAEQ,MAAM,IAAIX,MAAM,KAAKM,MAAM,CAACM,MAAM,EAAE;MACvD,oBAAOC,GAAA,CAACC,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;AAACC,QAAAA,SAAS,EAAC,oBAAA;AAAoB,QAAG,CAAA;AACrE,KAAA;AAEA,IAAA,IAAIC,gBAAiC,CAAA;AAErC,IAAA,QAAQjB,MAAM;MACZ,KAAKM,MAAM,CAACY,UAAU,CAAA;MACtB,KAAKZ,MAAM,CAACa,OAAO;QACjBF,gBAAgB,gBAAGJ,GAAA,CAACO,g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AAA;WAAK,CAAA;SACF,CAAA;AACP,OAAgB,CAChB,EAACvC,SAAS,iBACRmB,GAAA,CAAA,QAAA,EAAA;AACE,QAAA,YAAA,EAAYf,aAAa,CAAC6B,QAAQ,CAACwB,UAAU,EAAE;AAAElD,UAAAA,QAAAA;AAAU,SAAA,CAAE;QAC7De,SAAS,EAAE8B,IAAI,CAAC,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE;AACpE,UAAA,6BAA6B,EAAEjD,gBAAAA;AAChC,SAAA,CAAE;AACHsC,QAAAA,IAAI,EAAC,QAAQ;AACbiB,QAAAA,OAAO,EAAEA,MAAMzD,QAAQ,EAAG;QAAAmC,QAAA,eAE1BjB,GAAA,CAACwC,GAAG,EAAA;AAACtC,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"UploadItem.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin, CheckCircleFill, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemLink } from './UploadItemLink';\n\nexport type UploadItemProps = React.JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n /**\n * We're temporarily reverting to the regular icon components,\n * until the StatusIcon receives 24px sizing. Some misalignment\n * to be expected.\n */\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <CrossCircleFill size={24} className=\"emphasis--negative\" />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <CheckCircleFill size={24} className=\"emphasis--positive\" />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={clsx('np-upload-item', { 'np-upload-item--link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemLink\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemLink>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={clsx('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","CrossCircleFill","size","className","processIndicator","PROCESSING","PENDING","ProcessIndicator","Size","EXTRA_SMALL","DONE","CheckCircleFill","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","clsx","uploadItem","_jsxs","UploadItemLink","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;IA+BYA,SAGX;AAHD,CAAA,UAAYA,QAA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EAAE;AAAElD,UAAAA,QAAAA;AAAU,SAAA,CAAE;QAC7De,SAAS,EAAE8B,IAAI,CAAC,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE;AACpE,UAAA,6BAA6B,EAAEjD,gBAAAA;AAChC,SAAA,CAAE;AACHsC,QAAAA,IAAI,EAAC,QAAQ;AACbiB,QAAAA,OAAO,EAAEA,MAAMzD,QAAQ,EAAG;QAAAmC,QAAA,eAE1BjB,GAAA,CAACwC,GAAG,EAAA;AAACtC,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-11c630d",
3
+ "version": "0.0.0-experimental-50dbef7",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -93,8 +93,8 @@
93
93
  "rollup-preserve-directives": "^1.1.1",
94
94
  "storybook": "^8.2.2",
95
95
  "@transferwise/less-config": "3.1.0",
96
- "@transferwise/neptune-css": "14.13.2",
97
- "@wise/components-theming": "1.5.0"
96
+ "@wise/components-theming": "1.6.0",
97
+ "@transferwise/neptune-css": "14.13.2"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@transferwise/icons": "^3.7.0",