@transferwise/components 40.12.14-inter.55 → 40.12.14-inter.59

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 (83) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/build/es/no-polyfill/button/Button.js +5 -5
  3. package/build/es/no-polyfill/common/domHelpers/index.js +1 -1
  4. package/build/es/no-polyfill/dateInput/DateInput.js +3 -3
  5. package/build/es/no-polyfill/definitionList/DefinitionList.js +1 -1
  6. package/build/es/no-polyfill/display/Display.story.js +1 -0
  7. package/build/es/no-polyfill/i18n/cs.json +2 -1
  8. package/build/es/no-polyfill/i18n/de.json +1 -0
  9. package/build/es/no-polyfill/i18n/es.json +2 -1
  10. package/build/es/no-polyfill/i18n/fr.json +1 -0
  11. package/build/es/no-polyfill/i18n/hu.json +1 -0
  12. package/build/es/no-polyfill/i18n/id.json +1 -0
  13. package/build/es/no-polyfill/i18n/it.json +2 -1
  14. package/build/es/no-polyfill/i18n/ja.json +1 -0
  15. package/build/es/no-polyfill/i18n/pl.json +1 -0
  16. package/build/es/no-polyfill/i18n/pt.json +2 -1
  17. package/build/es/no-polyfill/i18n/ro.json +1 -0
  18. package/build/es/no-polyfill/i18n/ru.json +1 -0
  19. package/build/es/no-polyfill/i18n/th.json +44 -0
  20. package/build/es/no-polyfill/i18n/tr.json +2 -1
  21. package/build/es/no-polyfill/i18n/uk.json +2 -1
  22. package/build/es/no-polyfill/i18n/zh-CN.json +44 -0
  23. package/build/es/no-polyfill/i18n/zh.json +1 -0
  24. package/build/es/no-polyfill/moneyInput/MoneyInput.js +2 -2
  25. package/build/es/no-polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  26. package/build/es/no-polyfill/select/Select.js +6 -6
  27. package/build/es/polyfill/button/Button.js +5 -5
  28. package/build/es/polyfill/common/domHelpers/index.js +1 -1
  29. package/build/es/polyfill/dateInput/DateInput.js +3 -3
  30. package/build/es/polyfill/definitionList/DefinitionList.js +1 -1
  31. package/build/es/polyfill/display/Display.story.js +1 -0
  32. package/build/es/polyfill/i18n/cs.json +2 -1
  33. package/build/es/polyfill/i18n/de.json +1 -0
  34. package/build/es/polyfill/i18n/es.json +2 -1
  35. package/build/es/polyfill/i18n/fr.json +1 -0
  36. package/build/es/polyfill/i18n/hu.json +1 -0
  37. package/build/es/polyfill/i18n/id.json +1 -0
  38. package/build/es/polyfill/i18n/it.json +2 -1
  39. package/build/es/polyfill/i18n/ja.json +1 -0
  40. package/build/es/polyfill/i18n/pl.json +1 -0
  41. package/build/es/polyfill/i18n/pt.json +2 -1
  42. package/build/es/polyfill/i18n/ro.json +1 -0
  43. package/build/es/polyfill/i18n/ru.json +1 -0
  44. package/build/es/polyfill/i18n/th.json +44 -0
  45. package/build/es/polyfill/i18n/tr.json +2 -1
  46. package/build/es/polyfill/i18n/uk.json +2 -1
  47. package/build/es/polyfill/i18n/zh-CN.json +44 -0
  48. package/build/es/polyfill/i18n/zh.json +1 -0
  49. package/build/es/polyfill/moneyInput/MoneyInput.js +2 -2
  50. package/build/es/polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  51. package/build/es/polyfill/select/Select.js +6 -6
  52. package/build/i18n/cs.json +2 -1
  53. package/build/i18n/de.json +1 -0
  54. package/build/i18n/es.json +2 -1
  55. package/build/i18n/fr.json +1 -0
  56. package/build/i18n/hu.json +1 -0
  57. package/build/i18n/id.json +1 -0
  58. package/build/i18n/it.json +2 -1
  59. package/build/i18n/ja.json +1 -0
  60. package/build/i18n/pl.json +1 -0
  61. package/build/i18n/pt.json +2 -1
  62. package/build/i18n/ro.json +1 -0
  63. package/build/i18n/ru.json +1 -0
  64. package/build/i18n/th.json +44 -0
  65. package/build/i18n/tr.json +2 -1
  66. package/build/i18n/uk.json +2 -1
  67. package/build/i18n/zh-CN.json +44 -0
  68. package/build/i18n/zh.json +1 -0
  69. package/build/main.css +1 -1
  70. package/build/styles/definitionList/DefinitionList.css +1 -1
  71. package/build/styles/main.css +1 -1
  72. package/build/types/button/Button.d.ts +17 -13
  73. package/build/types/checkboxButton/CheckboxButton.d.ts +3 -3
  74. package/build/types/checkboxButton/CheckboxButton.story.d.ts +1 -1
  75. package/build/types/common/domHelpers/index.d.ts +1 -0
  76. package/build/types/dateInput/DateInput.d.ts +1 -0
  77. package/build/types/definitionList/DefinitionList.d.ts +4 -0
  78. package/build/types/display/Display.story.d.ts +6 -0
  79. package/build/types/moneyInput/MoneyInput.d.ts +1 -0
  80. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +2 -0
  81. package/build/umd/no-polyfill/main.js +1 -1
  82. package/build/umd/polyfill/main.js +1 -1
  83. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,79 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [41.5.0](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.4.1...@transferwise/components@41.5.0) (2022-10-10)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add optional ActionButton to DefinitionList ([#1594](https://github.com/transferwise/neptune-web/issues/1594)) ([e26185e](https://github.com/transferwise/neptune-web/commit/e26185e0aef770c3cfa2201a0c0ce5a71b3ed8ca))
12
+
13
+
14
+
15
+
16
+
17
+ ## [41.4.1](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.4.0...@transferwise/components@41.4.1) (2022-10-04)
18
+
19
+ **Note:** Version bump only for package @transferwise/components
20
+
21
+
22
+
23
+
24
+
25
+ # [41.4.0](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.3.2...@transferwise/components@41.4.0) (2022-09-30)
26
+
27
+
28
+ ### Features
29
+
30
+ * add 'as' prop to support anchor tag buttons ([f9e3ff6](https://github.com/transferwise/neptune-web/commit/f9e3ff6c7b6263299285edd6815d731e9ab984bc))
31
+ * add disabled class ([a793614](https://github.com/transferwise/neptune-web/commit/a79361497f34f238b0c68582f45761aba8ce7642))
32
+ * update and refactor types to support anchor tags ([bcba7f1](https://github.com/transferwise/neptune-web/commit/bcba7f1c20923c48978c20a743b12b82a4353546))
33
+
34
+
35
+
36
+
37
+
38
+ ## [41.3.2](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.3.1...@transferwise/components@41.3.2) (2022-09-30)
39
+
40
+ **Note:** Version bump only for package @transferwise/components
41
+
42
+
43
+
44
+
45
+
46
+ ## [41.3.1](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.3.0...@transferwise/components@41.3.1) (2022-09-29)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * **CheckboxButton:** props issue ([#1623](https://github.com/transferwise/neptune-web/issues/1623)) ([58b4875](https://github.com/transferwise/neptune-web/commit/58b48753a4b16df5271fff8338107fd8156f7ded))
52
+
53
+
54
+
55
+
56
+
57
+ # [41.3.0](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.2.1...@transferwise/components@41.3.0) (2022-09-23)
58
+
59
+
60
+ ### Features
61
+
62
+ * expose selectProps for Select, MoneyInput and PhoneNumberInput ([c9899db](https://github.com/transferwise/neptune-web/commit/c9899db6c2fd57cd366236e354b79157e522655f))
63
+
64
+
65
+
66
+
67
+
68
+ ## [41.2.1](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.2.0...@transferwise/components@41.2.1) (2022-09-22)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * return default icon size to 16px in dynamic-flows ([#1554](https://github.com/transferwise/neptune-web/issues/1554)) ([591c51b](https://github.com/transferwise/neptune-web/commit/591c51b02089210314a1380ebfa86e11fa6b3d86))
74
+
75
+
76
+
77
+
78
+
6
79
  # [41.2.0](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.1.4...@transferwise/components@41.2.0) (2022-09-21)
7
80
 
8
81
 
@@ -424,6 +497,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
424
497
  ### Features
425
498
 
426
499
  * **select:** add aria-attributes and expose dropdownProps ([#1445](https://github.com/transferwise/neptune-web/issues/1445)) ([a5da938](https://github.com/transferwise/neptune-web/commit/a5da938a5a47ce430cc66174736f6ffa13925397))
500
+ * **select:** update `<button>` DOM element `role` attribute to `combobox` ([#1445](https://github.com/transferwise/neptune-web/issues/1445)) ([a5da938](https://github.com/transferwise/neptune-web/commit/a5da938a5a47ce430cc66174736f6ffa13925397))
501
+ * **select:** update `<ul>` DOM element `role` attribute to `listbox` ([#1445](https://github.com/transferwise/neptune-web/issues/1445)) ([a5da938](https://github.com/transferwise/neptune-web/commit/a5da938a5a47ce430cc66174736f6ffa13925397))
427
502
 
428
503
 
429
504
 
@@ -1,7 +1,7 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["block","children","className","disabled","htmlType","loading","priority","size","type"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classNames from"classnames";import{forwardRef}from"react";import{Size,ControlType,Priority}from"../common";import{typeClassMap,priorityClassMap}from"./classMap";import{establishNewPriority,establishNewType,logDeprecationNotices}from"./legacyUtils";/** @deprecated */import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Button=/*#__PURE__*/forwardRef(function(a,b){var c=a.block,d=void 0!==c&&c,e=a.children,f=a.className,g=a.disabled,h=a.htmlType,i=void 0===h?"button":h,j=a.loading,k=void 0!==j&&j,l=a.priority,m=void 0===l?Priority.PRIMARY:l,n=a.size,o=void 0===n?Size.MEDIUM:n,p=a.type,q=void 0===p?ControlType.ACCENT:p,r=_objectWithoutProperties(a,_excluded);logDeprecationNotices({size:o,type:q});// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2
- var s=establishNewType(q),t=establishNewPriority(m,q),u=classNames("btn btn-".concat(o),"np-btn np-btn-".concat(o),{"btn-loading":k,"btn-block np-btn-block":d},// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["as","block","children","className","disabled","loading","priority","size","type"],_excluded2=["htmlType"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classNames from"classnames";import{forwardRef}from"react";import{Size,ControlType,Priority}from"../common";import{typeClassMap,priorityClassMap}from"./classMap";import{establishNewPriority,establishNewType,logDeprecationNotices}from"./legacyUtils";/** @deprecated */import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Button=/*#__PURE__*/forwardRef(function(a,b){var c,d=a.as,e=a.block,f=void 0!==e&&e,g=a.children,h=a.className,i=a.disabled,j=a.loading,k=void 0!==j&&j,l=a.priority,m=void 0===l?Priority.PRIMARY:l,n=a.size,o=void 0===n?Size.MEDIUM:n,p=a.type,q=void 0===p?ControlType.ACCENT:p,r=_objectWithoutProperties(a,_excluded);logDeprecationNotices({size:o,type:q});// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2
+ var s,t=establishNewType(q),u=establishNewPriority(m,q),v=classNames("btn btn-".concat(o),"np-btn np-btn-".concat(o),{"btn-loading":k,"btn-block np-btn-block":f},{disabled:i||k},// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
3
3
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4
- typeClassMap[s],// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
4
+ typeClassMap[t],// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
5
5
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6
- priorityClassMap[t],f);// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
7
- return/*#__PURE__*/_jsxs("button",_objectSpread(_objectSpread({ref:b/* eslint-disable-next-line react/button-has-type */,type:i,className:u,disabled:g||k},r),{},{children:[e,k&&/*#__PURE__*/_jsx("span",{className:classNames("btn-loader",{"m-l-2":!d})})]}))});export default Button;
6
+ priorityClassMap[u],h),w=null!==(c=d)&&void 0!==c?c:"button";// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
7
+ if("button"===w){var x=r,y=x.htmlType,z=void 0===y?"button":y,A=_objectWithoutProperties(x,_excluded2);s=_objectSpread(_objectSpread({},A),{},{disabled:i||k,type:z})}else s=_objectSpread({},r);return/*#__PURE__*/_jsxs(w,_objectSpread(_objectSpread({ref:b,className:v},s),{},{children:[g,k&&/*#__PURE__*/_jsx("span",{className:classNames("btn-loader",{"m-l-2":!f})})]}))});export default Button;
@@ -1 +1 @@
1
- export function isServerSide(){return"undefined"==typeof window}export function isBrowser(){return!isServerSide()}export function stopPropagation(a){a.stopPropagation(),a.preventDefault(),a.nativeEvent&&a.nativeEvent.stopImmediatePropagation&&a.nativeEvent.stopImmediatePropagation()}export{addClickClassToDocumentOnIos,removeClickClassFromDocumentOnIos}from"./documentIosClick";
1
+ export function isServerSide(){return"undefined"==typeof window}export function isBrowser(){return!isServerSide()}export function stopPropagation(a){a.stopPropagation(),a.preventDefault(),a.nativeEvent&&a.nativeEvent.stopImmediatePropagation&&a.nativeEvent.stopImmediatePropagation()}export function getSimpleRandomId(a){var b=Math.ceil(999999*Math.random());return"".concat(a).concat(b)}export{addClickClassToDocumentOnIos,removeClickClassFromDocumentOnIos}from"./documentIosClick";
@@ -1,4 +1,4 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import classNames from"classnames";import PropTypes from"prop-types";import{useState}from"react";import{useIntl}from"react-intl";import{Size,DateMode,MonthFormat}from"../common";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import Select from"../select";import messages from"./DateInput.messages";import{explodeDate,convertToLocalMidnight}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=new Set(["en-US","ja-JP"]),INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b,c,d,e=a.disabled,f=a.size,g=a.value,h=a.dayLabel,i=a.monthLabel,j=a.yearLabel,k=a.monthFormat,l=a.mode,m=a.onChange,n=a.onFocus,o=a.onBlur,p=a.placeholders,q=a.id,r=useIntl(),s=r.locale,t=r.formatMessage,u=function(){return g&&isDateValid(g)?"string"==typeof g?convertToLocalMidnight(g):g:null},v=function(a){var b=INITIAL_DEFAULT_STATE;if(g&&isDateValid(g)){var c=u();b=explodeDate(c),isMonthAndYearFormat(g)&&(b.day=null)}return b[a]},w=useState(function(){return v("day")}),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useState(function(){return v("month")}),B=_slicedToArray(A,2),C=B[0],D=B[1],E=useState(function(){return v("year")}),F=_slicedToArray(E,2),G=F[0],H=F[1],I=useState(u),J=_slicedToArray(I,2),K=J[0],L=J[1];h=h||t(messages.dayLabel),i=i||t(messages.monthLabel),j=j||t(messages.yearLabel),p={day:(null===(b=p)||void 0===b?void 0:b.day)||"DD",month:(null===(c=p)||void 0===c?void 0:c.month)||t(messages.monthLabel),year:(null===(d=p)||void 0===d?void 0:d.year)||"YYYY"};var M=function(a){if(!isDateValid(a))return"";switch(l){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},N=function(){var a=getMonthNames(s,k);return/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:i}),/*#__PURE__*/_jsx(Select,{name:"month",classNames:"form-control",disabled:e,placeholder:p.month,options:O(),size:f,selected:null===C?null:{value:C,label:a[C]},onChange:function(a){return R(a)}})]})},O=function(){var a=[],b=getMonthNames(s,k);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},P=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:y,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:C,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:G,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||T(INITIAL_DEFAULT_STATE),l===DateMode.MONTH_YEAR?0<=b&&c&&(b!==C||c!==G)&&T(e):a&&0<=b&&c&&(a!==y||b!==C||c!==G)&&T(e)},Q=function(a){var b=U(a.target.value,C,G),c=b.checkedDay;z(c),P(c,C,G)},R=function(a){if(!a)return D(null),void P(y,null,G);var b=a?a.value:0,c=U(y,b,G),d=c.checkedDay;D(b),y&&d!==y&&z(d),P(d,b,G)},S=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
2
- var d=U(y,C,b),e=d.checkedDay;y&&e!==y&&z(e),H(c),P(e,C,c)}else H(c),P(y,C,null)},T=function(a){a!==K&&(L(a),m(M(a)||null))},U=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},V=l===DateMode.MONTH_YEAR,W=classNames({"col-sm-8":V,"col-sm-5":!V}),X=MonthBeforeDay.has(s);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[X&&/*#__PURE__*/_jsx("div",{className:W,children:N()}),!V&&/*#__PURE__*/_jsx("div",{className:"col-sm-3",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("input",{type:"number",name:"day",className:"form-control",value:y||"",placeholder:p.day,disabled:e,onChange:function(a){return Q(a)}})]})})}),!X&&/*#__PURE__*/_jsx("div",{className:W,children:N()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("input",{type:"number",name:"year",className:"form-control",placeholder:p.year,value:G||"",disabled:e,onChange:function(a){return S(a)}})]})})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classNames from"classnames";import PropTypes from"prop-types";import{useState}from"react";import{useIntl}from"react-intl";import{Size,DateMode,MonthFormat}from"../common";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import Select from"../select";import messages from"./DateInput.messages";import{explodeDate,convertToLocalMidnight}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=new Set(["en-US","ja-JP"]),INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b,c,d,e=a.disabled,f=a.size,g=a.value,h=a.dayLabel,i=a.monthLabel,j=a.yearLabel,k=a.monthFormat,l=a.mode,m=a.onChange,n=a.onFocus,o=a.onBlur,p=a.placeholders,q=a.id,r=a.selectProps,s=useIntl(),t=s.locale,u=s.formatMessage,v=function(){return g&&isDateValid(g)?"string"==typeof g?convertToLocalMidnight(g):g:null},w=function(a){var b=INITIAL_DEFAULT_STATE;if(g&&isDateValid(g)){var c=v();b=explodeDate(c),isMonthAndYearFormat(g)&&(b.day=null)}return b[a]},x=useState(function(){return w("day")}),y=_slicedToArray(x,2),z=y[0],A=y[1],B=useState(function(){return w("month")}),C=_slicedToArray(B,2),D=C[0],E=C[1],F=useState(function(){return w("year")}),G=_slicedToArray(F,2),H=G[0],I=G[1],J=useState(v),K=_slicedToArray(J,2),L=K[0],M=K[1];h=h||u(messages.dayLabel),i=i||u(messages.monthLabel),j=j||u(messages.yearLabel),p={day:(null===(b=p)||void 0===b?void 0:b.day)||"DD",month:(null===(c=p)||void 0===c?void 0:c.month)||u(messages.monthLabel),year:(null===(d=p)||void 0===d?void 0:d.year)||"YYYY"};var N=function(a){if(!isDateValid(a))return"";switch(l){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},O=function(){var a=getMonthNames(t,k);return/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:i}),/*#__PURE__*/_jsx(Select,_objectSpread({id:q?"".concat(q,"-select"):void 0,name:"month",classNames:"form-control",disabled:e,placeholder:p.month,options:P(),size:f,selected:null===D?null:{value:D,label:a[D]},onChange:function(a){return S(a)}},r))]})},P=function(){var a=[],b=getMonthNames(t,k);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},Q=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:z,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:D,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:H,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||U(INITIAL_DEFAULT_STATE),l===DateMode.MONTH_YEAR?0<=b&&c&&(b!==D||c!==H)&&U(e):a&&0<=b&&c&&(a!==z||b!==D||c!==H)&&U(e)},R=function(a){var b=V(a.target.value,D,H),c=b.checkedDay;A(c),Q(c,D,H)},S=function(a){if(!a)return E(null),void Q(z,null,H);var b=a?a.value:0,c=V(z,b,H),d=c.checkedDay;E(b),z&&d!==z&&A(d),Q(d,b,H)},T=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
2
+ var d=V(z,D,b),e=d.checkedDay;z&&e!==z&&A(e),I(c),Q(e,D,c)}else I(c),Q(z,D,null)},U=function(a){a!==L&&(M(a),m(N(a)||null))},V=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},W=l===DateMode.MONTH_YEAR,X=classNames({"col-sm-8":W,"col-sm-5":!W}),Y=MonthBeforeDay.has(t);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),!W&&/*#__PURE__*/_jsx("div",{className:"col-sm-3",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("input",{type:"number",name:"day",className:"form-control",value:z||"",placeholder:p.day,disabled:e,onChange:function(a){return R(a)}})]})})}),!Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("input",{type:"number",name:"year",className:"form-control",placeholder:p.year,value:H||"",disabled:e,onChange:function(a){return T(a)}})]})})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
3
3
  function shouldPropagateOnFocus(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c&&c.closest(".tw-date");return d!==e}// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
4
- function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,id:""};export default DateInput;
4
+ function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string,selectProps:PropTypes.object},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,id:"",selectProps:{}};export default DateInput;
@@ -1 +1 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";var _alignmentClassMap;import classNames from"classnames";import PropTypes from"prop-types";import{Layout}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var isLayoutHorizontal=function(a){return[Layout.HORIZONTAL_LEFT_ALIGNED,Layout.HORIZONTAL_RIGHT_ALIGNED,Layout.HORIZONTAL_JUSTIFIED].includes(a)},alignmentClassMap=(_alignmentClassMap={},_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_RIGHT_ALIGNED,"text-sm-right"),_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_JUSTIFIED,"text-sm-justify"),_alignmentClassMap),DefinitionList=function(a){var b=a.definitions,c=a.layout,d=a.muted;return/*#__PURE__*/_jsx("dl",{className:classNames("tw-definition-list d-flex ",{"text-muted":d,"flex-column":c===Layout.VERTICAL_ONE_COLUMN,"tw-definition-list--columns flex-column flex-row--sm":c===Layout.VERTICAL_TWO_COLUMN,"tw-definition-list--horizontal flex-column":isLayoutHorizontal(c)}),children:b.filter(function(a){return a}).map(function(a){var b=a.title,d=a.value,e=a.key;return/*#__PURE__*/_jsxs("div",{className:"tw-definition-list__item",children:[/*#__PURE__*/_jsx("dt",{children:b}),/*#__PURE__*/_jsx("dd",{className:alignmentClassMap[c]||"",children:d})]},e)})})};DefinitionList.propTypes={definitions:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.node.isRequired,value:PropTypes.node.isRequired,key:PropTypes.string.isRequired})),layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED","HORIZONTAL_RIGHT_ALIGNED"]),muted:PropTypes.bool},DefinitionList.defaultProps={definitions:[],layout:Layout.VERTICAL_TWO_COLUMN,muted:!1};export default DefinitionList;
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import classNames from"classnames";import PropTypes from"prop-types";import ActionButton from"../actionButton";import{Layout}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var isLayoutHorizontal=function(a){return[Layout.HORIZONTAL_LEFT_ALIGNED,Layout.HORIZONTAL_RIGHT_ALIGNED,Layout.HORIZONTAL_JUSTIFIED].includes(a)},getAlignmentClasses=function(a,b){var c=["d-flex"];return b&&(isLayoutHorizontal(a)?c.push("align-items-center"):c.push("align-items-start")),a===Layout.HORIZONTAL_RIGHT_ALIGNED?c.push("text-sm-right justify-content-end"):c.push("justify-content-between"),a===Layout.HORIZONTAL_JUSTIFIED&&c.push("text-sm-justify"),c},DefinitionList=function(a){var b=a.definitions,c=a.layout,d=a.muted;return/*#__PURE__*/_jsx("dl",{className:classNames("tw-definition-list d-flex ",{"text-muted":d,"flex-column":c===Layout.VERTICAL_ONE_COLUMN,"tw-definition-list--columns flex-column flex-row--sm":c===Layout.VERTICAL_TWO_COLUMN,"tw-definition-list--horizontal flex-column":isLayoutHorizontal(c)}),children:b.filter(function(a){return a}).map(function(a){var b=a.action,d=a.title,e=a.value,f=a.key;return/*#__PURE__*/_jsxs("div",{className:"tw-definition-list__item",children:[/*#__PURE__*/_jsx("dt",{children:d}),/*#__PURE__*/_jsxs("dd",{className:classNames.apply(void 0,_toConsumableArray(getAlignmentClasses(c,b))),children:[/*#__PURE__*/_jsx("div",{children:e}),b?/*#__PURE__*/_jsx("div",{className:classNames(isLayoutHorizontal(c)?"p-l-2":"p-x-2","tw-definition-list__action"),children:/*#__PURE__*/_jsx(ActionButton,{className:"tw-definition-list__button",onClick:b.onClick,children:b.label})}):null]})]},f)})})};DefinitionList.propTypes={definitions:PropTypes.arrayOf(PropTypes.shape({action:PropTypes.shape({label:PropTypes.string.isRequired,onClick:PropTypes.func.isRequired}),title:PropTypes.node.isRequired,value:PropTypes.node.isRequired,key:PropTypes.string.isRequired})),layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED","HORIZONTAL_RIGHT_ALIGNED"]),muted:PropTypes.bool},DefinitionList.defaultProps={definitions:[],layout:Layout.VERTICAL_TWO_COLUMN,muted:!1};export default DefinitionList;
@@ -0,0 +1 @@
1
+ /* eslint-disable jsx-a11y/accessible-emoji */import{Typography}from"../common";import Money from"../money/Money";import Title from"../title/Title";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{title:"Typography | Display"};export var Basic=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Title,{type:Typography.TITLE_SCREEN,children:"Display Number"}),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsx("h1",{className:"np-text-display-number",children:/*#__PURE__*/_jsx(Money,{amount:1050.6,currency:"UAH"})}),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsx("h1",{className:"np-text-display-number",children:/*#__PURE__*/_jsx(Money,{amount:10.17,currency:"JPY"})}),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsx("h1",{className:"np-text-display-number",children:/*#__PURE__*/_jsx(Money,{amount:.01,currency:"EUR"})}),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsx("h1",{className:"np-text-display-number",children:/*#__PURE__*/_jsx(Money,{amount:1e6,currency:"EUR"})}),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsx("h1",{className:"np-text-display-number",children:/*#__PURE__*/_jsx(Money,{amount:1e6,currency:"GBP"})})]})};
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Navigace v Pagination",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Přejít na stránku {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Současná stránka, stránka {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Hledat...",
12
13
  "neptune.Summary.statusDone": "Položka dokončena",
13
14
  "neptune.Summary.statusNotDone": "Položka k dokončení",
14
15
  "neptune.Summary.statusPending": "Čekající položka",
@@ -33,7 +34,7 @@
33
34
  "neptune.UploadInput.deleteModalTitle": "Jistě chcete odstranit tento soubor?",
34
35
  "neptune.UploadInput.fileIsTooLarge": "Soubor je příliš velký",
35
36
  "neptune.UploadInput.fileTypeNotSupported": "Typ souboru není podporován",
36
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "Sorry, this upload failed because we can only accept {maxFilesAllowed} files at once.",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "Je nám líto, ale toto nahrání se nezdařilo, protože můžeme přijmout pouze {maxFilesAllowed} souborů najednou.",
37
38
  "neptune.UploadItem.deleting": "Mažeme...",
38
39
  "neptune.UploadItem.removeFile": "Odstranit soubor {filename}",
39
40
  "neptune.UploadItem.uploaded": "Nahráno",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Seitennummer-Navigation",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Weiter zur Seite {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Aktuelle Seite – Seite {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Wird gesucht...",
12
13
  "neptune.Summary.statusDone": "Schritt erledigt",
13
14
  "neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
14
15
  "neptune.Summary.statusPending": "Schritt ausstehend",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Navegación por las páginas",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Ve a la página {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Página actual, página {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Buscar...",
12
13
  "neptune.Summary.statusDone": "Apartado listo",
13
14
  "neptune.Summary.statusNotDone": "Apartado a completar",
14
15
  "neptune.Summary.statusPending": "Apartado pendiente",
@@ -33,7 +34,7 @@
33
34
  "neptune.UploadInput.deleteModalTitle": "¿Estás seguro que quieres eliminar este archivo?",
34
35
  "neptune.UploadInput.fileIsTooLarge": "El archivo es demasiado grande",
35
36
  "neptune.UploadInput.fileTypeNotSupported": "Tipo de archivo no compatible",
36
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "Lo sentimos, la carga falló porque solo podemos aceptar {maxFilesAllowed} archivos a la vez.",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "Lo sentimos, ha habido un error porque solo podemos aceptar {maxFilesAllowed} archivos a la vez.",
37
38
  "neptune.UploadItem.deleting": "Eliminando...",
38
39
  "neptune.UploadItem.removeFile": "Eliminar el archivo {filename}",
39
40
  "neptune.UploadItem.uploaded": "Subido",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Navigation par pagination",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Aller à la page {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Page actuelle, page {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Recherche...",
12
13
  "neptune.Summary.statusDone": "Validé",
13
14
  "neptune.Summary.statusNotDone": "À compléter",
14
15
  "neptune.Summary.statusPending": "En attente",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Lapszámos navigáció",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Ugrás a(z) {pageNumber}. oldalra",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Jelenlegi oldal, {pageNumber}. oldal",
12
+ "neptune.Select.searchPlaceholder": "Keresés...",
12
13
  "neptune.Summary.statusDone": "Kész",
13
14
  "neptune.Summary.statusNotDone": "Hátravan",
14
15
  "neptune.Summary.statusPending": "Függőben",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Halaman navigasi",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Lanjut ke halaman {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Halaman saat ini, halaman {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Cari...",
12
13
  "neptune.Summary.statusDone": "Item selesai",
13
14
  "neptune.Summary.statusNotDone": "Item yang harus dilakukan",
14
15
  "neptune.Summary.statusPending": "Item tertunda",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Navigazione",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Via a pagina {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Pagina corrente, pagina {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Cerca...",
12
13
  "neptune.Summary.statusDone": "Completato",
13
14
  "neptune.Summary.statusNotDone": "Da completare",
14
15
  "neptune.Summary.statusPending": "In corso",
@@ -33,7 +34,7 @@
33
34
  "neptune.UploadInput.deleteModalTitle": "Vuoi davvero cancellare questo file?",
34
35
  "neptune.UploadInput.fileIsTooLarge": "File troppo grande",
35
36
  "neptune.UploadInput.fileTypeNotSupported": "Tipo di file non supportato",
36
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "Sorry, this upload failed because we can only accept {maxFilesAllowed} files at once.",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "Siamo spiacenti, questo caricamento non è riuscito perché possiamo accettare solo {maxFilesAllowed} file alla volta.",
37
38
  "neptune.UploadItem.deleting": "Eliminando...",
38
39
  "neptune.UploadItem.removeFile": "Rimuovi file {filename}",
39
40
  "neptune.UploadItem.uploaded": "Caricato",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "ページネーションナビゲーション",
10
10
  "neptune.PaginationLink.ariaLabel.active": "{pageNumber}のページへ移動します",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "現在のページ、{pageNumber}ページ",
12
+ "neptune.Select.searchPlaceholder": "検索... ",
12
13
  "neptune.Summary.statusDone": "完了",
13
14
  "neptune.Summary.statusNotDone": "未対応",
14
15
  "neptune.Summary.statusPending": "保留中",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Nawigacja w paginacji",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Przejdź do strony {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Obecna strona, strona {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Wyszukaj...",
12
13
  "neptune.Summary.statusDone": "Czynność wykonana",
13
14
  "neptune.Summary.statusNotDone": "Czynność do wykonania",
14
15
  "neptune.Summary.statusPending": "Czynność oczekująca",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Navegação pelas páginas",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Ir para a página {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Página atual, página {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Buscar...",
12
13
  "neptune.Summary.statusDone": "Pronto",
13
14
  "neptune.Summary.statusNotDone": "Não iniciado",
14
15
  "neptune.Summary.statusPending": "Pendente",
@@ -33,7 +34,7 @@
33
34
  "neptune.UploadInput.deleteModalTitle": "Tem certeza que deseja remover esta arquivo?",
34
35
  "neptune.UploadInput.fileIsTooLarge": "O arquivo é muito grande",
35
36
  "neptune.UploadInput.fileTypeNotSupported": "Não aceitamos arquivos neste formato",
36
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "Ocorreu um erro. Você só pode enviar {maxFilesAllowed} arquivos por vez.",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "Não recebemos os seus arquivos. Você só pode enviar {maxFilesAllowed} arquivos por vez.",
37
38
  "neptune.UploadItem.deleting": "Removendo...",
38
39
  "neptune.UploadItem.removeFile": "Remover arquivo {filename}",
39
40
  "neptune.UploadItem.uploaded": "Enviado",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Navigare prin pagină",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Du-te la pagina {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Pagina curentă, pagina {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Caută...",
12
13
  "neptune.Summary.statusDone": "Finalizat",
13
14
  "neptune.Summary.statusNotDone": "De făcut",
14
15
  "neptune.Summary.statusPending": "În așteptare",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Постраничная навигация",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Перейти на страницу {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Текущая страница, страница {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Поиск...",
12
13
  "neptune.Summary.statusDone": "Этап завершен",
13
14
  "neptune.Summary.statusNotDone": "Этап к выполнению",
14
15
  "neptune.Summary.statusPending": "Этап в процессе",
@@ -0,0 +1,44 @@
1
+ {
2
+ "neptune.Chips.ariaLabel": "เคลียร์ {choice}",
3
+ "neptune.ClearButton.ariaLabel": "ชัดเจน",
4
+ "neptune.CloseButton.ariaLabel": "ปิด",
5
+ "neptune.DateInput.day.label": "วัน",
6
+ "neptune.DateInput.month.label": "เดือน",
7
+ "neptune.DateInput.year.label": "ปี",
8
+ "neptune.MoneyInput.Select.placeholder": "เลือกตัวเลือก...",
9
+ "neptune.Pagination.ariaLabel": "การนำทางเลขหน้า",
10
+ "neptune.PaginationLink.ariaLabel.active": "ไปที่หน้า {pageNumber}",
11
+ "neptune.PaginationLink.ariaLabel.inactive": "หน้าปัจจุบัน หน้า {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "ค้นหา...",
13
+ "neptune.Summary.statusDone": "รายการที่ทำแล้ว",
14
+ "neptune.Summary.statusNotDone": "รายการที่ต้องทำ",
15
+ "neptune.Summary.statusPending": "รายการที่รอดำเนินการ",
16
+ "neptune.Upload.csButtonText": "อัพโหลดไฟล์อื่นหรือไม่",
17
+ "neptune.Upload.csFailureText": "การอัปโหลดล้มเหลว กรุณาลองอีกครั้ง",
18
+ "neptune.Upload.csSuccessText": "อัปโหลดเสร็จสมบูรณ์!",
19
+ "neptune.Upload.csTooLargeMessage": "กรุณาใช้ไฟล์ที่มีขนาดเล็กกว่า 5MB",
20
+ "neptune.Upload.csWrongTypeMessage": "ไม่รองรับประเภทไฟล์ โปรดลองอีกครั้งโดยใช้ไฟล์อื่น",
21
+ "neptune.Upload.psButtonText": "ยกเลิก",
22
+ "neptune.Upload.psProcessingText": "กำลังอัปโหลด...",
23
+ "neptune.Upload.usButtonText": "หรือเลือกไฟล์",
24
+ "neptune.Upload.usDropMessage": "วางไฟล์เพื่อเริ่มการอัปโหลด",
25
+ "neptune.Upload.usPlaceholder": "ลากและวางไฟล์ที่มีขนาดไม่เกิน 5MB",
26
+ "neptune.UploadButton.allFileTypes": "ไฟล์ทุกประเภท",
27
+ "neptune.UploadButton.dropFiles": "วางไฟล์เพื่อเริ่มการอัปโหลด",
28
+ "neptune.UploadButton.instructions": "{fileTypes} น้อยกว่า {size}MB",
29
+ "neptune.UploadButton.uploadFile": "อัปโหลดไฟล์",
30
+ "neptune.UploadButton.uploadFiles": "อัปโหลดไฟล์",
31
+ "neptune.UploadInput.deleteModalBody": "การลบไฟล์นี้จะลบออกจากระบบของเรา",
32
+ "neptune.UploadInput.deleteModalCancelButtonText": "ยกเลิก",
33
+ "neptune.UploadInput.deleteModalConfirmButtonText": "ลบ",
34
+ "neptune.UploadInput.deleteModalTitle": "แน่ใจว่าต้องการลบไฟล์นี้หรือไม่",
35
+ "neptune.UploadInput.fileIsTooLarge": "ไฟล์ใหญ่เกินไป",
36
+ "neptune.UploadInput.fileTypeNotSupported": "ไม่รองรับประเภทไฟล์",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "ขออภัย การอัปโหลดนี้ไม่สำเร็จเนื่องจากเรายอมรับได้แค่ครั้งละ {maxFilesAllowed} ไฟล์",
38
+ "neptune.UploadItem.deleting": "กำลังลบ...",
39
+ "neptune.UploadItem.removeFile": "ลบไฟล์ {filename}",
40
+ "neptune.UploadItem.uploaded": "อัปโหลดแล้ว",
41
+ "neptune.UploadItem.uploadedFile": "อัปโหลดไฟล์แล้ว",
42
+ "neptune.UploadItem.uploading": "กำลังอัปโหลด...",
43
+ "neptune.UploadItem.uploadingFailed": "อัปโหลดไม่สำเร็จ"
44
+ }
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Sayfalandırma gezintisi",
10
10
  "neptune.PaginationLink.ariaLabel.active": "{pageNumber} numaralı sayfaya git",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Mevcut sayfa, sayfa {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Ara...",
12
13
  "neptune.Summary.statusDone": "Tamamlanan aşama",
13
14
  "neptune.Summary.statusNotDone": "Yapılacak",
14
15
  "neptune.Summary.statusPending": "Bekliyor",
@@ -33,7 +34,7 @@
33
34
  "neptune.UploadInput.deleteModalTitle": "Bu dosyayı kaldırmak istediğinizden emin misiniz?",
34
35
  "neptune.UploadInput.fileIsTooLarge": "Dosya çok büyük",
35
36
  "neptune.UploadInput.fileTypeNotSupported": "Dosya tipi desteklenmiyor",
36
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "Sorry, this upload failed because we can only accept {maxFilesAllowed} files at once.",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "Üzgünüz, bu yükleme aynı anda en fazla {maxFilesAllowed} dosya kabul edebildiğimiz için başarısız oldu.",
37
38
  "neptune.UploadItem.deleting": "Siliniyor...",
38
39
  "neptune.UploadItem.removeFile": "{filename} dosyasını kaldır",
39
40
  "neptune.UploadItem.uploaded": "Yüklendi",
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "Перехід за сторінками",
10
10
  "neptune.PaginationLink.ariaLabel.active": "Перейти на сторінку {pageNumber}",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "Ця сторінка, сторінка {pageNumber}",
12
+ "neptune.Select.searchPlaceholder": "Пошук…",
12
13
  "neptune.Summary.statusDone": "Виконано",
13
14
  "neptune.Summary.statusNotDone": "Не виконано",
14
15
  "neptune.Summary.statusPending": "Виконується",
@@ -33,7 +34,7 @@
33
34
  "neptune.UploadInput.deleteModalTitle": "Справді вилучити цей файл?",
34
35
  "neptune.UploadInput.fileIsTooLarge": "Файл завеликий",
35
36
  "neptune.UploadInput.fileTypeNotSupported": "Тип файлу не підтримується",
36
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "Sorry, this upload failed because we can only accept {maxFilesAllowed} files at once.",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "На жаль, це завантаження не вдале. Ми можемо завантажити лише {maxFilesAllowed} файлів за один раз.",
37
38
  "neptune.UploadItem.deleting": "Видалення…",
38
39
  "neptune.UploadItem.removeFile": "Вилучити файл {filename}",
39
40
  "neptune.UploadItem.uploaded": "Завантажено",
@@ -0,0 +1,44 @@
1
+ {
2
+ "neptune.Chips.ariaLabel": "清除 {choice}",
3
+ "neptune.ClearButton.ariaLabel": "清晰",
4
+ "neptune.CloseButton.ariaLabel": "关闭",
5
+ "neptune.DateInput.day.label": "日",
6
+ "neptune.DateInput.month.label": "月",
7
+ "neptune.DateInput.year.label": "年",
8
+ "neptune.MoneyInput.Select.placeholder": "请选择...",
9
+ "neptune.Pagination.ariaLabel": "分页导航",
10
+ "neptune.PaginationLink.ariaLabel.active": "转到第 {pageNumber} 页",
11
+ "neptune.PaginationLink.ariaLabel.inactive": "当前页面,第 {pageNumber} 页",
12
+ "neptune.Select.searchPlaceholder": "搜索",
13
+ "neptune.Summary.statusDone": "已完成",
14
+ "neptune.Summary.statusNotDone": "未完成",
15
+ "neptune.Summary.statusPending": "待处理",
16
+ "neptune.Upload.csButtonText": "上传另一个文件?",
17
+ "neptune.Upload.csFailureText": "上传失败。请重试",
18
+ "neptune.Upload.csSuccessText": "上传完毕!",
19
+ "neptune.Upload.csTooLargeMessage": "请提供小于 5MB 的文件",
20
+ "neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
21
+ "neptune.Upload.psButtonText": "取消",
22
+ "neptune.Upload.psProcessingText": "正在上传…",
23
+ "neptune.Upload.usButtonText": "或选择文件",
24
+ "neptune.Upload.usDropMessage": "拖放文件开始上传",
25
+ "neptune.Upload.usPlaceholder": "拖放小于 5MB 的文件",
26
+ "neptune.UploadButton.allFileTypes": "所有文件类型",
27
+ "neptune.UploadButton.dropFiles": "拖放文件开始上传",
28
+ "neptune.UploadButton.instructions": "{fileTypes},小于 {size}MB",
29
+ "neptune.UploadButton.uploadFile": "上传文件",
30
+ "neptune.UploadButton.uploadFiles": "上传文件",
31
+ "neptune.UploadInput.deleteModalBody": "删除此文件会将其从我们的系统中删除",
32
+ "neptune.UploadInput.deleteModalCancelButtonText": "取消",
33
+ "neptune.UploadInput.deleteModalConfirmButtonText": "删除",
34
+ "neptune.UploadInput.deleteModalTitle": "确定要删除此文件吗?",
35
+ "neptune.UploadInput.fileIsTooLarge": "文件太大",
36
+ "neptune.UploadInput.fileTypeNotSupported": "文件类型不受支持",
37
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "抱歉,此上传失败,因为我们一次只能接受 {maxFilesAllowed} 个文件。",
38
+ "neptune.UploadItem.deleting": "正在删除…",
39
+ "neptune.UploadItem.removeFile": "删除文件 {filename}",
40
+ "neptune.UploadItem.uploaded": "已上传",
41
+ "neptune.UploadItem.uploadedFile": "上传的文件",
42
+ "neptune.UploadItem.uploading": "正在上传…",
43
+ "neptune.UploadItem.uploadingFailed": "上传失败"
44
+ }
@@ -9,6 +9,7 @@
9
9
  "neptune.Pagination.ariaLabel": "分頁導航",
10
10
  "neptune.PaginationLink.ariaLabel.active": "前往第{pageNumber}頁",
11
11
  "neptune.PaginationLink.ariaLabel.inactive": "目前在第{pageNumber}頁",
12
+ "neptune.Select.searchPlaceholder": "搜尋…",
12
13
  "neptune.Summary.statusDone": "已完成事項",
13
14
  "neptune.Summary.statusNotDone": "未完成事項",
14
15
  "neptune.Summary.statusPending": "待處理事項",
@@ -1,5 +1,5 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{isEmpty,isNumber,isNull}from"@transferwise/neptune-validation";import classNames from"classnames";import PropTypes from"prop-types";import{Component}from"react";import{injectIntl}from"react-intl";import{Typography}from"../common";import{Key as keyValues}from"../common/key";import keyCodes from"../common/keyCodes";import{Size}from"../common/propsValues/size";import Select from"../select";import Title from"../title";import messages from"./MoneyInput.messages";import{formatAmount,parseAmount}from"./currencyFormatting";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Currency=PropTypes.shape({header:PropTypes.string,value:PropTypes.string,label:PropTypes.string,currency:PropTypes.string,note:PropTypes.string,searchable:PropTypes.string}),CUSTOM_ACTION="CUSTOM_ACTION",isNumberOrNull=function(a){return isNumber(a)||isNull(a)},formatAmountIfSet=function(a,b,c){return"number"==typeof a?formatAmount(a,b,c):""},inputKeyCodeAllowlist=new Set([keyCodes.BACKSPACE,keyCodes.DELETE,keyCodes.COMMA,keyCodes.PERIOD,keyCodes.DOWN,keyCodes.UP,keyCodes.LEFT,keyCodes.RIGHT,keyCodes.ENTER,keyCodes.ESCAPE,keyCodes.TAB]),inputKeyAllowlist=new Set([keyValues.PERIOD,keyValues.COMMA]),MoneyInput=/*#__PURE__*/function(a){function b(a){var d;_classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"isInputAllowedForKeyEvent",function(a){var b=a.keyCode,c=a.metaKey,d=a.key,e=a.ctrlKey,f=isNumber(parseInt(d,10));return f||c||e||inputKeyCodeAllowlist.has(b)||inputKeyAllowlist.has(d)}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){d.isInputAllowedForKeyEvent(a)||a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"handlePaste",function(a){var b=(a.clipboardData||window.clipboardData).getData("text"),c=d.state.locale,e=isEmpty(b)?null:parseAmount(b,d.props.selectedCurrency.currency,c);isNumberOrNull(e)&&(d.setState({formattedAmount:formatAmountIfSet(e,d.props.selectedCurrency.currency,c)}),d.props.onAmountChange(e)),a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"onAmountChange",function(a){var b=a.target.value;d.setState({formattedAmount:b});var c=isEmpty(b)?null:parseAmount(b,d.props.selectedCurrency.currency,d.state.locale);isNumberOrNull(c)&&d.props.onAmountChange(c)}),_defineProperty(_assertThisInitialized(d),"onAmountBlur",function(){d.amountFocused=!1,d.setAmount()}),_defineProperty(_assertThisInitialized(d),"onAmountFocus",function(){d.amountFocused=!0}),_defineProperty(_assertThisInitialized(d),"handleSelectChange",function(a){d.handleSearchChange(""),d.props.onCustomAction&&a.value===CUSTOM_ACTION?d.props.onCustomAction():d.props.onCurrencyChange(a)}),_defineProperty(_assertThisInitialized(d),"handleSearchChange",function(a){d.setState({searchQuery:a}),d.props.onSearchChange&&d.props.onSearchChange({searchQuery:a,filteredOptions:filterOptionsForQuery(d.props.currencies,a)})}),_defineProperty(_assertThisInitialized(d),"style",function(a){return d.props.classNames[a]||a});var e=d.props.intl.locale;return d.formatMessage=d.props.intl.formatMessage,d.state={searchQuery:"",formattedAmount:formatAmountIfSet(a.amount,a.selectedCurrency.currency,e),locale:e},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(a){var b;if(this.setState({locale:null===a||void 0===a||null===(b=a.intl)||void 0===b?void 0:b.locale}),!this.amountFocused){var c;this.setState({formattedAmount:formatAmountIfSet(a.amount,a.selectedCurrency.currency,null===a||void 0===a||null===(c=a.intl)||void 0===c?void 0:c.locale)})}}},{key:"getSelectOptions",value:function getSelectOptions(){var a=_toConsumableArray(filterOptionsForQuery(this.props.currencies,this.state.searchQuery));return this.props.onCustomAction&&a.push({value:CUSTOM_ACTION,label:this.props.customActionLabel}),a}},{key:"setAmount",value:function setAmount(){var a=this;this.setState(function(b){var c=parseAmount(b.formattedAmount,a.props.selectedCurrency.currency,a.state.locale);return isNumberOrNull(c)?{formattedAmount:formatAmountIfSet(c,a.props.selectedCurrency.currency,b.locale)}:{formattedAmount:b.formattedAmount}})}},{key:"render",value:function render(){var a=this.props,b=a.selectedCurrency,c=a.onCurrencyChange,d=a.size,e=a.addon,f=this.getSelectOptions(),g=!this.state.searchQuery&&(1===f.length&&f[0].currency===b.currency||!c),h=!this.props.onAmountChange;return/*#__PURE__*/_jsxs("div",{className:classNames(this.style("tw-money-input"),this.style("input-group"),this.style("input-group-".concat(d))),children:[/*#__PURE__*/_jsx("input",{id:this.props.id,value:this.state.formattedAmount,type:"text",inputMode:"decimal",className:classNames(this.style("form-control")),disabled:h,placeholder:formatAmountIfSet(this.props.placeholder,this.props.selectedCurrency.currency,this.state.locale),autoComplete:"off",onKeyDown:this.handleKeyDown,onChange:this.onAmountChange,onFocus:this.onAmountFocus,onBlur:this.onAmountBlur,onPaste:this.handlePaste}),e&&/*#__PURE__*/_jsx("span",{className:classNames(this.style("input-group-addon"),this.style("input-".concat(d)),h?this.style("disabled"):""),children:e}),g?/*#__PURE__*/_jsxs("div",{className:classNames(this.style("input-group-addon"),this.style("input-".concat(d)),this.style("tw-money-input__fixed-currency"),h?this.style("disabled"):""),children:[("lg"===d||"md"===d)&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("i",{className:classNames(this.style("tw-money-input__keyline"))}),/*#__PURE__*/_jsx("i",{className:classNames(this.style("currency-flag"),this.style("currency-flag-".concat(b.currency.toLowerCase())),this.style("hidden-xs"),this.style("m-r-2"))})]}),/*#__PURE__*/_jsx(Title,{as:"span",type:Typography.TITLE_SUBSECTION,className:classNames(_defineProperty({},this.style("m-r-1"),"lg"===d)),children:b.currency.toUpperCase()})]}):/*#__PURE__*/_jsx("div",{className:classNames(this.style("input-group-btn"),this.style("amount-currency-select-btn")),children:/*#__PURE__*/_jsx(Select,{classNames:this.props.classNames,options:f,selected:_objectSpread(_objectSpread({},b),{},{label:/*#__PURE__*/_jsx(Title,{as:"span",type:Typography.TITLE_SUBSECTION,children:b.label}),note:null}),placeholder:this.formatMessage(messages.selectPlaceholder),searchPlaceholder:this.props.searchPlaceholder,searchValue:this.state.searchQuery,size:d,required:!0,dropdownWidth:Size.LARGE,inverse:!0,onChange:this.handleSelectChange,onSearchChange:this.handleSearchChange})})]})}}]),b}(Component);function filterOptionsForQuery(a,b){if(!b)return a;var c=removeDuplicateValueOptions(a).filter(function(a){return isCurrencyOptionAndFitsQuery(a,b)});return sortOptionsLabelsToFirst(c,b)}function removeDuplicateValueOptions(a){var b=[],c=[];return a.forEach(function(a){a.value&&!c.includes(a.value)&&(b.push(a),c.push(a.value))}),b}function isCurrencyOptionAndFitsQuery(a,b){return!!a.value&&(contains(a.label,b)||contains(a.searchable,b)||contains(a.note,b))}function contains(a,b){return a&&a.toLowerCase().includes(b.toLowerCase())}function sortOptionsLabelsToFirst(a,b){return a.sort(function(a,c){var d=contains(a.label,b),e=contains(c.label,b);return d&&e?0:d?-1:e?1:0})}MoneyInput.propTypes={id:PropTypes.string,currencies:PropTypes.arrayOf(Currency).isRequired,selectedCurrency:Currency.isRequired,onCurrencyChange:PropTypes.func,placeholder:PropTypes.number,amount:PropTypes.number,size:PropTypes.oneOf(["sm","md","lg"]),onAmountChange:PropTypes.func,addon:PropTypes.node,searchPlaceholder:PropTypes.string,/**
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{isEmpty,isNumber,isNull}from"@transferwise/neptune-validation";import classNames from"classnames";import PropTypes from"prop-types";import{Component}from"react";import{injectIntl}from"react-intl";import{Typography}from"../common";import{Key as keyValues}from"../common/key";import keyCodes from"../common/keyCodes";import{Size}from"../common/propsValues/size";import Select from"../select";import Title from"../title";import messages from"./MoneyInput.messages";import{formatAmount,parseAmount}from"./currencyFormatting";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Currency=PropTypes.shape({header:PropTypes.string,value:PropTypes.string,label:PropTypes.string,currency:PropTypes.string,note:PropTypes.string,searchable:PropTypes.string}),CUSTOM_ACTION="CUSTOM_ACTION",isNumberOrNull=function(a){return isNumber(a)||isNull(a)},formatAmountIfSet=function(a,b,c){return"number"==typeof a?formatAmount(a,b,c):""},inputKeyCodeAllowlist=new Set([keyCodes.BACKSPACE,keyCodes.DELETE,keyCodes.COMMA,keyCodes.PERIOD,keyCodes.DOWN,keyCodes.UP,keyCodes.LEFT,keyCodes.RIGHT,keyCodes.ENTER,keyCodes.ESCAPE,keyCodes.TAB]),inputKeyAllowlist=new Set([keyValues.PERIOD,keyValues.COMMA]),MoneyInput=/*#__PURE__*/function(a){function b(a){var d;_classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"isInputAllowedForKeyEvent",function(a){var b=a.keyCode,c=a.metaKey,d=a.key,e=a.ctrlKey,f=isNumber(parseInt(d,10));return f||c||e||inputKeyCodeAllowlist.has(b)||inputKeyAllowlist.has(d)}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){d.isInputAllowedForKeyEvent(a)||a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"handlePaste",function(a){var b=(a.clipboardData||window.clipboardData).getData("text"),c=d.state.locale,e=isEmpty(b)?null:parseAmount(b,d.props.selectedCurrency.currency,c);isNumberOrNull(e)&&(d.setState({formattedAmount:formatAmountIfSet(e,d.props.selectedCurrency.currency,c)}),d.props.onAmountChange(e)),a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"onAmountChange",function(a){var b=a.target.value;d.setState({formattedAmount:b});var c=isEmpty(b)?null:parseAmount(b,d.props.selectedCurrency.currency,d.state.locale);isNumberOrNull(c)&&d.props.onAmountChange(c)}),_defineProperty(_assertThisInitialized(d),"onAmountBlur",function(){d.amountFocused=!1,d.setAmount()}),_defineProperty(_assertThisInitialized(d),"onAmountFocus",function(){d.amountFocused=!0}),_defineProperty(_assertThisInitialized(d),"handleSelectChange",function(a){d.handleSearchChange(""),d.props.onCustomAction&&a.value===CUSTOM_ACTION?d.props.onCustomAction():d.props.onCurrencyChange(a)}),_defineProperty(_assertThisInitialized(d),"handleSearchChange",function(a){d.setState({searchQuery:a}),d.props.onSearchChange&&d.props.onSearchChange({searchQuery:a,filteredOptions:filterOptionsForQuery(d.props.currencies,a)})}),_defineProperty(_assertThisInitialized(d),"style",function(a){return d.props.classNames[a]||a});var e=d.props.intl.locale;return d.formatMessage=d.props.intl.formatMessage,d.state={searchQuery:"",formattedAmount:formatAmountIfSet(a.amount,a.selectedCurrency.currency,e),locale:e},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(a){var b;if(this.setState({locale:null===a||void 0===a||null===(b=a.intl)||void 0===b?void 0:b.locale}),!this.amountFocused){var c;this.setState({formattedAmount:formatAmountIfSet(a.amount,a.selectedCurrency.currency,null===a||void 0===a||null===(c=a.intl)||void 0===c?void 0:c.locale)})}}},{key:"getSelectOptions",value:function getSelectOptions(){var a=_toConsumableArray(filterOptionsForQuery(this.props.currencies,this.state.searchQuery));return this.props.onCustomAction&&a.push({value:CUSTOM_ACTION,label:this.props.customActionLabel}),a}},{key:"setAmount",value:function setAmount(){var a=this;this.setState(function(b){var c=parseAmount(b.formattedAmount,a.props.selectedCurrency.currency,a.state.locale);return isNumberOrNull(c)?{formattedAmount:formatAmountIfSet(c,a.props.selectedCurrency.currency,b.locale)}:{formattedAmount:b.formattedAmount}})}},{key:"render",value:function render(){var a=this.props,b=a.selectedCurrency,c=a.onCurrencyChange,d=a.size,e=a.addon,f=a.id,g=a.selectProps,h=this.getSelectOptions(),i=!this.state.searchQuery&&(1===h.length&&h[0].currency===b.currency||!c),j=!this.props.onAmountChange;return/*#__PURE__*/_jsxs("div",{className:classNames(this.style("tw-money-input"),this.style("input-group"),this.style("input-group-".concat(d))),children:[/*#__PURE__*/_jsx("input",{id:f,value:this.state.formattedAmount,type:"text",inputMode:"decimal",className:classNames(this.style("form-control")),disabled:j,placeholder:formatAmountIfSet(this.props.placeholder,this.props.selectedCurrency.currency,this.state.locale),autoComplete:"off",onKeyDown:this.handleKeyDown,onChange:this.onAmountChange,onFocus:this.onAmountFocus,onBlur:this.onAmountBlur,onPaste:this.handlePaste}),e&&/*#__PURE__*/_jsx("span",{className:classNames(this.style("input-group-addon"),this.style("input-".concat(d)),j?this.style("disabled"):""),children:e}),i?/*#__PURE__*/_jsxs("div",{className:classNames(this.style("input-group-addon"),this.style("input-".concat(d)),this.style("tw-money-input__fixed-currency"),j?this.style("disabled"):""),children:[("lg"===d||"md"===d)&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("i",{className:classNames(this.style("tw-money-input__keyline"))}),/*#__PURE__*/_jsx("i",{className:classNames(this.style("currency-flag"),this.style("currency-flag-".concat(b.currency.toLowerCase())),this.style("hidden-xs"),this.style("m-r-2"))})]}),/*#__PURE__*/_jsx(Title,{as:"span",type:Typography.TITLE_SUBSECTION,className:classNames(_defineProperty({},this.style("m-r-1"),"lg"===d)),children:b.currency.toUpperCase()})]}):/*#__PURE__*/_jsx("div",{className:classNames(this.style("input-group-btn"),this.style("amount-currency-select-btn")),children:/*#__PURE__*/_jsx(Select,_objectSpread({id:f?"".concat(f,"-select"):void 0,classNames:this.props.classNames,options:h,selected:_objectSpread(_objectSpread({},b),{},{label:/*#__PURE__*/_jsx(Title,{as:"span",type:Typography.TITLE_SUBSECTION,children:b.label}),note:null}),placeholder:this.formatMessage(messages.selectPlaceholder),searchPlaceholder:this.props.searchPlaceholder,searchValue:this.state.searchQuery,size:d,required:!0,dropdownWidth:Size.LARGE,inverse:!0,onChange:this.handleSelectChange,onSearchChange:this.handleSearchChange},g))})]})}}]),b}(Component);function filterOptionsForQuery(a,b){if(!b)return a;var c=removeDuplicateValueOptions(a).filter(function(a){return isCurrencyOptionAndFitsQuery(a,b)});return sortOptionsLabelsToFirst(c,b)}function removeDuplicateValueOptions(a){var b=[],c=[];return a.forEach(function(a){a.value&&!c.includes(a.value)&&(b.push(a),c.push(a.value))}),b}function isCurrencyOptionAndFitsQuery(a,b){return!!a.value&&(contains(a.label,b)||contains(a.searchable,b)||contains(a.note,b))}function contains(a,b){return a&&a.toLowerCase().includes(b.toLowerCase())}function sortOptionsLabelsToFirst(a,b){return a.sort(function(a,c){var d=contains(a.label,b),e=contains(c.label,b);return d&&e?0:d?-1:e?1:0})}MoneyInput.propTypes={id:PropTypes.string,currencies:PropTypes.arrayOf(Currency).isRequired,selectedCurrency:Currency.isRequired,onCurrencyChange:PropTypes.func,placeholder:PropTypes.number,amount:PropTypes.number,size:PropTypes.oneOf(["sm","md","lg"]),onAmountChange:PropTypes.func,addon:PropTypes.node,searchPlaceholder:PropTypes.string,/**
2
2
  * Allows the consumer to react to searching, while the search itself is handled internally. Called with `{ searchQuery: string, filteredOptions: Currency[] }`
3
- */onSearchChange:PropTypes.func,customActionLabel:PropTypes.node,onCustomAction:PropTypes.func,classNames:PropTypes.objectOf(PropTypes.string)},MoneyInput.defaultProps={id:null,size:Size.LARGE,addon:null,searchPlaceholder:"",onSearchChange:void 0,onCurrencyChange:null,placeholder:null,amount:null,onAmountChange:null,customActionLabel:"",onCustomAction:null,classNames:{}};// this export is necessary for react-to-typescript-definitions
3
+ */onSearchChange:PropTypes.func,customActionLabel:PropTypes.node,onCustomAction:PropTypes.func,classNames:PropTypes.objectOf(PropTypes.string),selectProps:PropTypes.object},MoneyInput.defaultProps={id:null,size:Size.LARGE,addon:null,searchPlaceholder:"",onSearchChange:void 0,onCurrencyChange:null,placeholder:null,amount:null,onAmountChange:null,customActionLabel:"",onCustomAction:null,classNames:{},selectProps:{}};// this export is necessary for react-to-typescript-definitions
4
4
  // to be able to properly generate TS types, this is due to us wrapping this component in `injectIntl` before exporting
5
5
  export{MoneyInput};export default injectIntl(MoneyInput);
@@ -1 +1 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{isArray}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useState,useEffect}from"react";import{useIntl}from"react-intl";import{Size}from"../common";import Select from"../select";import countries from"./data/countries";import{explodeNumberModel,filterOptionsForQuery,isValidPhoneNumber,cleanNumber,setDefaultPrefix,isStringNumeric,sortArrayByProperty,groupCountriesByPrefix}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ALLOWED_PHONE_CHARS=/^$|^[\d-\s]+$/,PhoneNumberInput=function(a){var b=a.onChange,c=a.searchPlaceholder,d=a.disabled,e=a.required,f=a.size,g=a.placeholder,h=a.onFocus,i=a.onBlur,j=a.countryCode,k=useIntl(),l=k.locale,m=useState(function getInitialValue(){var b=a.initialValue,c=b?cleanNumber(b):null;return c&&isValidPhoneNumber(c)?explodeNumberModel(c):{prefix:setDefaultPrefix(l,j),suffix:""}}()),n=_slicedToArray(m,2),o=n[0],p=n[1],q=useState(null),r=_slicedToArray(q,2),s=r[0],t=r[1],u=useState(""),v=_slicedToArray(u,2),w=v[0],x=v[1],y=groupCountriesByPrefix(sortArrayByProperty(countries,"iso3")),z=groupCountriesByPrefix(sortArrayByProperty(countries,"phone")),A=function getSelectOptions(){var a=filterOptionsForQuery(isStringNumeric(w)?z:y,w);return a.map(function(a){var b=a.phone,c=a.iso3,d=a.iso2,e="";return c?e=isArray(c)?c.join(", "):c:d&&(e=isArray(d)?d.join(", "):d),{value:b,label:b,note:e}})}();return useEffect(function(){if(null===s)return t(o);var a=o.prefix+o.suffix,c=s.prefix+s.suffix;if(a!==c){var d=isValidPhoneNumber(a)?cleanNumber(a):null;b(d),t(o)}},[b,s,o]),/*#__PURE__*/_jsxs("div",{className:"tw-telephone",children:[/*#__PURE__*/_jsx("div",{className:"tw-telephone__country-select",children:/*#__PURE__*/_jsx(Select,{options:A,selected:{value:o.prefix,label:o.prefix},placeholder:"Select an option...",searchPlaceholder:c,dropdownWidth:Size.SMALL,searchValue:w,required:e,disabled:d,size:f,onChange:function onPrefixChange(a){var b=a.value;x(""),p({prefix:b,suffix:o.suffix})},onSearchChange:function onSearchChange(a){return x(a)}})}),/*#__PURE__*/_jsx("div",{className:"tw-telephone__number-input",children:/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx("input",{name:"phoneNumber",inputMode:"numeric",value:o.suffix,type:"text",className:"form-control",disabled:d,required:e,placeholder:g,onChange:function onSuffixChange(a){var b=a.target.value,c=void 0===b?"":b;ALLOWED_PHONE_CHARS.test(c)&&p({prefix:o.prefix,suffix:c})},onPaste:function onPaste(a){if(a.nativeEvent.clipboardData){var b=(a.nativeEvent.clipboardData.getData("text/plain")||"").replace(/(\s|-)+/g,""),c=explodeNumberModel(b),d=c.prefix,e=c.suffix,f=A.find(function(a){var b=a.value;return b===d});f&&ALLOWED_PHONE_CHARS.test(e)&&p({prefix:d,suffix:e})}},onFocus:h,onBlur:i})})})]})};PhoneNumberInput.propTypes={required:PropTypes.bool,disabled:PropTypes.bool,initialValue:PropTypes.string,onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,countryCode:PropTypes.string,searchPlaceholder:PropTypes.string,size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string},PhoneNumberInput.defaultProps={required:!1,disabled:!1,initialValue:null,onFocus:function onFocus(){},onBlur:function onBlur(){},countryCode:null,searchPlaceholder:"Prefix",size:Size.MEDIUM,placeholder:""};export default PhoneNumberInput;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{isArray}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useState,useEffect}from"react";import{useIntl}from"react-intl";import{Size}from"../common";import Select from"../select";import countries from"./data/countries";import{explodeNumberModel,filterOptionsForQuery,isValidPhoneNumber,cleanNumber,setDefaultPrefix,isStringNumeric,sortArrayByProperty,groupCountriesByPrefix}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ALLOWED_PHONE_CHARS=/^$|^[\d-\s]+$/,PhoneNumberInput=function(a){var b=a.id,c=a.onChange,d=a.searchPlaceholder,e=a.disabled,f=a.required,g=a.size,h=a.placeholder,i=a.onFocus,j=a.onBlur,k=a.countryCode,l=a.selectProps,m=useIntl(),n=m.locale,o=useState(function getInitialValue(){var b=a.initialValue,c=b?cleanNumber(b):null;return c&&isValidPhoneNumber(c)?explodeNumberModel(c):{prefix:setDefaultPrefix(n,k),suffix:""}}()),p=_slicedToArray(o,2),q=p[0],r=p[1],s=useState(null),t=_slicedToArray(s,2),u=t[0],v=t[1],w=useState(""),x=_slicedToArray(w,2),y=x[0],z=x[1],A=groupCountriesByPrefix(sortArrayByProperty(countries,"iso3")),B=groupCountriesByPrefix(sortArrayByProperty(countries,"phone")),C=function getSelectOptions(){var a=filterOptionsForQuery(isStringNumeric(y)?B:A,y);return a.map(function(a){var b=a.phone,c=a.iso3,d=a.iso2,e="";return c?e=isArray(c)?c.join(", "):c:d&&(e=isArray(d)?d.join(", "):d),{value:b,label:b,note:e}})}();return useEffect(function(){if(null===u)return v(q);var a=q.prefix+q.suffix,b=u.prefix+u.suffix;if(a!==b){var d=isValidPhoneNumber(a)?cleanNumber(a):null;c(d),v(q)}},[c,u,q]),/*#__PURE__*/_jsxs("div",{className:"tw-telephone",children:[/*#__PURE__*/_jsx("div",{className:"tw-telephone__country-select",children:/*#__PURE__*/_jsx(Select,_objectSpread({id:b?"".concat(b,"-select"):void 0,options:C,selected:{value:q.prefix,label:q.prefix},placeholder:"Select an option...",searchPlaceholder:d,dropdownWidth:Size.SMALL,searchValue:y,required:f,disabled:e,size:g,onChange:function onPrefixChange(a){var b=a.value;z(""),r({prefix:b,suffix:q.suffix})},onSearchChange:function onSearchChange(a){return z(a)}},l))}),/*#__PURE__*/_jsx("div",{className:"tw-telephone__number-input",children:/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(g),children:/*#__PURE__*/_jsx("input",{id:b,name:"phoneNumber",inputMode:"numeric",value:q.suffix,type:"text",className:"form-control",disabled:e,required:f,placeholder:h,onChange:function onSuffixChange(a){var b=a.target.value,c=void 0===b?"":b;ALLOWED_PHONE_CHARS.test(c)&&r({prefix:q.prefix,suffix:c})},onPaste:function onPaste(a){if(a.nativeEvent.clipboardData){var b=(a.nativeEvent.clipboardData.getData("text/plain")||"").replace(/(\s|-)+/g,""),c=explodeNumberModel(b),d=c.prefix,e=c.suffix,f=C.find(function(a){var b=a.value;return b===d});f&&ALLOWED_PHONE_CHARS.test(e)&&r({prefix:d,suffix:e})}},onFocus:i,onBlur:j})})})]})};PhoneNumberInput.propTypes={id:PropTypes.string,required:PropTypes.bool,disabled:PropTypes.bool,initialValue:PropTypes.string,onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,countryCode:PropTypes.string,searchPlaceholder:PropTypes.string,size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string,selectProps:PropTypes.object},PhoneNumberInput.defaultProps={id:null,required:!1,disabled:!1,initialValue:null,onFocus:function onFocus(){},onBlur:function onBlur(){},countryCode:null,searchPlaceholder:"Prefix",size:Size.MEDIUM,placeholder:"",selectProps:{}};export default PhoneNumberInput;