@transferwise/components 40.11.2 → 40.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/build/es/no-polyfill/common/domHelpers/index.js +1 -1
- package/build/es/no-polyfill/common/index.js +1 -1
- package/build/es/no-polyfill/dateLookup/DateLookup.js +2 -2
- package/build/es/no-polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
- package/build/es/no-polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
- package/build/es/no-polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
- package/build/es/no-polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
- package/build/es/no-polyfill/i18n/en.json +1 -0
- package/build/es/no-polyfill/moneyInput/MoneyInput.js +1 -1
- package/build/es/no-polyfill/provider/Provider.js +1 -1
- package/build/es/no-polyfill/provider/Provider.spec.js +1 -1
- package/build/es/no-polyfill/select/Select.js +10 -5
- package/build/es/no-polyfill/select/Select.messages.js +1 -0
- package/build/es/no-polyfill/select/option/Option.js +1 -1
- package/build/es/no-polyfill/select/searchBox/SearchBox.js +1 -1
- package/build/es/no-polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
- package/build/es/polyfill/common/domHelpers/index.js +1 -1
- package/build/es/polyfill/common/index.js +1 -1
- package/build/es/polyfill/dateLookup/DateLookup.js +2 -2
- package/build/es/polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
- package/build/es/polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
- package/build/es/polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
- package/build/es/polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
- package/build/es/polyfill/i18n/en.json +1 -0
- package/build/es/polyfill/moneyInput/MoneyInput.js +1 -1
- package/build/es/polyfill/provider/Provider.js +1 -1
- package/build/es/polyfill/provider/Provider.spec.js +1 -1
- package/build/es/polyfill/select/Select.js +10 -5
- package/build/es/polyfill/select/Select.messages.js +1 -0
- package/build/es/polyfill/select/option/Option.js +1 -1
- package/build/es/polyfill/select/searchBox/SearchBox.js +1 -1
- package/build/es/polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
- package/build/i18n/en.json +1 -0
- package/build/main.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/dateLookup/dateTrigger/DateTrigger.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/moneyInput/MoneyInput.css +1 -1
- package/build/styles/phoneNumberInput/PhoneNumberInput.css +1 -1
- package/build/styles/select/Select.css +1 -0
- package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +1 -1
- package/build/types/common/domHelpers/index.d.ts +2 -0
- package/build/types/common/index.d.ts +1 -1
- package/build/types/common/panel/Panel.d.ts +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
- package/build/types/select/Select.d.ts +26 -3
- package/build/types/select/Select.messages.d.ts +7 -0
- package/build/types/select/option/Option.d.ts +12 -37
- package/build/types/select/searchBox/SearchBox.d.ts +4 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/tooltip/Tooltip.story.d.ts +1 -1
- package/build/umd/no-polyfill/main.js +1 -1
- package/build/umd/polyfill/main.js +1 -1
- package/package.json +4 -4
- package/build/es/no-polyfill/select/domHelpers/domHelpers.js +0 -1
- package/build/es/no-polyfill/select/domHelpers/index.js +0 -1
- package/build/es/polyfill/select/domHelpers/domHelpers.js +0 -1
- package/build/es/polyfill/select/domHelpers/index.js +0 -1
- package/build/types/select/domHelpers/domHelpers.d.ts +0 -2
- package/build/types/select/domHelpers/index.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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
|
+
## [40.11.5](https://github.com/transferwise/neptune-web/compare/@transferwise/components@40.11.4...@transferwise/components@40.11.5) (2022-05-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @transferwise/components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [40.11.4](https://github.com/transferwise/neptune-web/compare/@transferwise/components@40.11.3...@transferwise/components@40.11.4) (2022-05-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **Select:** bug fixes and refactoring ([#1399](https://github.com/transferwise/neptune-web/issues/1399)) ([26e3ca5](https://github.com/transferwise/neptune-web/commit/26e3ca53c8ed45b64799a32eeb524472a93a9b50))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [40.11.3](https://github.com/transferwise/neptune-web/compare/@transferwise/components@40.11.2...@transferwise/components@40.11.3) (2022-05-27)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **Provider:** use passed in messages when locale parsing fails ([#1457](https://github.com/transferwise/neptune-web/issues/1457)) ([d0a4651](https://github.com/transferwise/neptune-web/commit/d0a46514f8e5ad877608fc1ffc718d7e7e872fd3))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [40.11.2](https://github.com/transferwise/neptune-web/compare/@transferwise/components@40.11.1...@transferwise/components@40.11.2) (2022-05-26)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @transferwise/components
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function isServerSide(){return"undefined"==typeof window}export function isBrowser(){return!isServerSide()}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{addClickClassToDocumentOnIos,removeClickClassFromDocumentOnIos}from"./documentIosClick";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as HistoryNavigator}from"./historyNavigator";export
|
|
1
|
+
export{default as HistoryNavigator}from"./historyNavigator";export*from"./domHelpers";export{addNoScrollBodyClass,removeNoScrollBodyClass}from"./DOMOperations";export*from"./theme";export*from"./direction";// Props
|
|
2
2
|
export*from"./propsValues/control";export{Breakpoint}from"./propsValues/breakpoint";export*from"./propsValues/size";export*from"./propsValues/width";export{Type}from"./propsValues/type";export{DateMode}from"./propsValues/dateMode";export{MonthFormat}from"./propsValues/monthFormat";export*from"./propsValues/position";export{Layout}from"./propsValues/layouts";export{Status}from"./propsValues/status";export{Sentiment}from"./propsValues/sentiment";export{ProfileType}from"./propsValues/profileType";export*from"./propsValues/scroll";export{MarkdownNodeType}from"./propsValues/markdownNodeType";export{FileType}from"./fileType";export{Key}from"./key";export*from"./locale";export*from"./commonProps";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
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 _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 PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{Size,MonthFormat,
|
|
2
|
-
ref:this.element,className:"btn-group btn-block
|
|
1
|
+
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 _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 PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{Size,MonthFormat,Position}from"../common";import{isWithinRange,moveToWithinRange}from"../common/dateUtils";import KeyCodes from"../common/keyCodes";import ResponsivePanel from"../common/responsivePanel";import DateTrigger from"./dateTrigger";import DayCalendar from"./dayCalendar";import{getStartOfDay}from"./getStartOfDay";import MonthCalendar from"./monthCalendar";import YearCalendar from"./yearCalendar";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MODE={DAY:"day",MONTH:"month",YEAR:"year"},DateLookup=/*#__PURE__*/function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"element",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"dropdown",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"open",function(){var a=d.props.onFocus;d.setState({open:!0,mode:MODE.DAY}),a&&a()}),_defineProperty(_assertThisInitialized(d),"close",function(){var a=d.props.onBlur;d.setState({open:!1}),a&&a()}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){var b=d.state.open;switch(a.keyCode){case KeyCodes.LEFT:b?d.adjustDate(-1,-1,-1):d.open(),a.preventDefault();break;case KeyCodes.UP:b?d.adjustDate(-7,-4,-4):d.open(),a.preventDefault();break;case KeyCodes.RIGHT:b?d.adjustDate(1,1,1):d.open(),a.preventDefault();break;case KeyCodes.DOWN:b?d.adjustDate(7,4,4):d.open(),a.preventDefault();break;case KeyCodes.ESCAPE:d.close(),a.preventDefault();break;default:}}),_defineProperty(_assertThisInitialized(d),"adjustDate",function(a,b,c){var e,f=d.state,g=f.selectedDate,h=f.min,i=f.max,j=f.mode;e=g?new Date(j===MODE.YEAR?g.getFullYear()+c:g.getFullYear(),j===MODE.MONTH?g.getMonth()+b:g.getMonth(),j===MODE.DAY?g.getDate()+a:g.getDate()):getStartOfDay(new Date),e=moveToWithinRange(e,h,i),+e!=+g&&d.props.onChange(e)}),_defineProperty(_assertThisInitialized(d),"focusOn",function(a,b){var c=d.element.current.querySelector(a);c?c.focus():b&&d.focusOn(b)}),_defineProperty(_assertThisInitialized(d),"switchMode",function(a){d.setState({mode:a},function(){d.focusOn(".active",".today")})}),_defineProperty(_assertThisInitialized(d),"switchToDays",function(){return d.switchMode(MODE.DAY)}),_defineProperty(_assertThisInitialized(d),"switchToMonths",function(){return d.switchMode(MODE.MONTH)}),_defineProperty(_assertThisInitialized(d),"switchToYears",function(){return d.switchMode(MODE.YEAR)}),_defineProperty(_assertThisInitialized(d),"handleSelectedDateUpdate",function(a){d.setState({selectedDate:a},function(){d.props.onChange(a),d.close(),d.focusOn(".btn")})}),_defineProperty(_assertThisInitialized(d),"handleViewDateUpdate",function(a){var b=a.month,c=void 0===b?d.state.viewMonth:b,e=a.year,f=void 0===e?d.state.viewYear:e;d.setState({viewMonth:c,viewYear:f})}),_defineProperty(_assertThisInitialized(d),"getCalendar",function(){var a=d.state,b=a.selectedDate,c=a.min,e=a.max,f=a.viewMonth,g=a.viewYear,h=a.mode,i=d.props,j=i.placeholder,k=i.monthFormat;return/*#__PURE__*/_jsxs("div",{className:"p-a-1",children:[h===MODE.DAY&&/*#__PURE__*/_jsx(DayCalendar,{selectedDate:b,min:c,max:e,viewMonth:f,viewYear:g,monthFormat:k,onSelect:d.handleSelectedDateUpdate,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.MONTH&&/*#__PURE__*/_jsx(MonthCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToDays,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.YEAR&&/*#__PURE__*/_jsx(YearCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToMonths,onViewDateUpdate:d.handleViewDateUpdate})]})}),_defineProperty(_assertThisInitialized(d),"handleClear",function(){d.props.onChange(null),d.focusOn(".np-date-trigger")}),d.state={selectedDate:getStartOfDay(a.value),min:getStartOfDay(a.min),max:getStartOfDay(a.max),viewMonth:(a.value||new Date).getMonth(),viewYear:(a.value||new Date).getFullYear(),open:!1,mode:MODE.DAY},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"componentDidUpdate",value:function componentDidUpdate(a){+this.props.value!=+a.value&&this.state.open&&this.focusOn(".active")}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState=function(){}}},{key:"render",value:function render(){var a=this.state,b=a.selectedDate,c=a.open,d=this.props,e=d.size,f=d.placeholder,g=d.label,h=d.monthFormat,i=d.disabled,j=d.clearable,k=d.value;return/*#__PURE__*/_jsxs("div",{// eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
2
|
+
ref:this.element,className:"btn-group btn-block",onKeyDown:this.handleKeyDown,children:[/*#__PURE__*/_jsx(DateTrigger,{selectedDate:b,size:e,placeholder:f,label:g,monthFormat:h,disabled:i,onClick:this.open,onClear:!i&&j&&k?this.handleClear:null}),/*#__PURE__*/_jsx(ResponsivePanel,{anchorRef:this.element,open:c,className:"tw-date-lookup-menu",position:Position.BOTTOM,onClose:this.close,children:this.getCalendar()})]})}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(a,b){var c=getStartOfDay(a.value),d=getStartOfDay(a.min),e=getStartOfDay(a.max),f=+b.selectedDate!=+c,g=+b.min!=+d,h=+b.max!=+e;if(f||g||h){var i=f?c:b.selectedDate,j=g?d:b.min,k=h?e:b.max;// make sure that selected date is within allowed range
|
|
3
3
|
if(!isWithinRange(i,j,k))return a.onChange(moveToWithinRange(i,j,k)),null;var l=(i||new Date).getMonth(),m=(i||new Date).getFullYear();return{selectedDate:i,min:j,max:k,viewMonth:l,viewYear:m}}return null}}]),b}(PureComponent);DateLookup.propTypes={value:PropTypes.instanceOf(Date).isRequired,min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string,label:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),disabled:PropTypes.bool,onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,clearable:PropTypes.bool},DateLookup.defaultProps={min:null,max:null,size:Size.MEDIUM,placeholder:"",label:"",monthFormat:MonthFormat.LONG,disabled:!1,onFocus:null,onBlur:null,clearable:!1};export default DateLookup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatDate}from"@transferwise/formatting";import{isKey}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useIntl}from"react-intl";import Chevron from"../../chevron";import{Size,Position}from"../../common";import CloseButton from"../../common/closeButton/CloseButton";import messages from"./DateTrigger.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{className:"btn btn-".concat(c," btn-input
|
|
1
|
+
import{formatDate}from"@transferwise/formatting";import{isKey}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useIntl}from"react-intl";import Chevron from"../../chevron";import{Size,Position}from"../../common";import CloseButton from"../../common/closeButton/CloseButton";import messages from"./DateTrigger.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{className:"btn btn-".concat(c," btn-input np-date-trigger np-date-trigger--").concat(c),disabled:g,type:"button",onClick:h,children:[e&&/*#__PURE__*/_jsx("span",{className:"control-label small m-r-1",children:e}),b?/*#__PURE__*/_jsx("span",{children:formatDate(b,k,{day:"numeric",month:f,year:"numeric"})}):/*#__PURE__*/_jsx("span",{className:"form-control-placeholder visible-xs-inline visible-sm-inline visible-md-inline visible-lg-inline visible-xl-inline",children:d}),i?/*#__PURE__*/_jsx(CloseButton,{className:"clear-btn d-flex align-items-center","aria-label":l(messages.ariaLabel),size:c===Size.SMALL?16:24,filled:!0,onClick:function(a){a.stopPropagation(),a.preventDefault(),i()},onKeyPress:function handleKeyDown(a){(isKey({keyType:"Space",event:a})||isKey({keyType:"Enter",event:a}))&&(a.stopPropagation(),a.preventDefault(),i())}}):/*#__PURE__*/_jsx(Chevron,{orientation:Position.BOTTOM,disabled:g})]})};DateTrigger.propTypes={selectedDate:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string.isRequired,label:PropTypes.string.isRequired,monthFormat:PropTypes.oneOf(["short","long"]).isRequired,disabled:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired,onClear:PropTypes.func},DateTrigger.defaultProps={selectedDate:null,size:Size.MEDIUM,onClear:void 0};export default DateTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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 _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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{MonthFormat}from"../../common";import DateHeader from"../dateHeader";import DayCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs(
|
|
1
|
+
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 _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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{MonthFormat}from"../../common";import DateHeader from"../dateHeader";import DayCalendarTable from"./table";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 DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(DateHeader,{label:formatDate(new Date(f,e),g,{month:h,year:"numeric"}),onLabelClick:i,onPreviousClick:this.selectPreviousMonth,onNextClick:this.selectNextMonth}),/*#__PURE__*/_jsx(DayCalendarTable,{selectedDate:b,min:c,max:d,viewMonth:e,viewYear:f,onSelect:j})]})}}]),b}(PureComponent);DayCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,monthFormat:PropTypes.oneOf([MonthFormat.LONG,MonthFormat.SHORT]).isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},DayCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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 _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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import DateHeader from"../dateHeader";import MonthCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs(
|
|
1
|
+
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 _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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import DateHeader from"../dateHeader";import MonthCalendarTable from"./table";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 MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(DateHeader,{label:formatDate(new Date(e,0),f,{year:"numeric"}),onLabelClick:h,onPreviousClick:this.selectPreviousYear,onNextClick:this.selectNextYear}),/*#__PURE__*/_jsx(MonthCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:g,onSelect:this.onMonthSelect})]})}}]),b}(PureComponent);MonthCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},MonthCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(MonthCalendar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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 _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 PropTypes from"prop-types";import{PureComponent}from"react";import DateHeader from"../dateHeader";import YearCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs(
|
|
1
|
+
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 _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 PropTypes from"prop-types";import{PureComponent}from"react";import DateHeader from"../dateHeader";import YearCalendarTable from"./table";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 YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(DateHeader,{onPreviousClick:this.selectPreviousYears,onNextClick:this.selectNextYears}),/*#__PURE__*/_jsx(YearCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:f,onSelect:this.onYearSelect})]})}}]),b}(PureComponent);YearCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},YearCalendar.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendar;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"neptune.Pagination.ariaLabel": "Pagination navigation",
|
|
10
10
|
"neptune.PaginationLink.ariaLabel.active": "Go to page {pageNumber}",
|
|
11
11
|
"neptune.PaginationLink.ariaLabel.inactive": "Current page, page {pageNumber}",
|
|
12
|
+
"neptune.Select.searchPlaceholder": "Search...",
|
|
12
13
|
"neptune.Summary.statusDone": "Item done",
|
|
13
14
|
"neptune.Summary.statusNotDone": "Item to do",
|
|
14
15
|
"neptune.Summary.statusPending": "Item pending",
|
|
@@ -1,4 +1,4 @@
|
|
|
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{Key as keyValues}from"../common/key";import keyCodes from"../common/keyCodes";import{Size}from"../common/propsValues/size";import Select from"../select";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("span",{className:"lg"===d?this.style("m-r-1"):"",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),{},{note:null}),placeholder:this.formatMessage(messages.selectPlaceholder),searchPlaceholder:this.props.searchPlaceholder,searchValue:this.state.searchQuery,size:d,required:!0,
|
|
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{Key as keyValues}from"../common/key";import keyCodes from"../common/keyCodes";import{Size}from"../common/propsValues/size";import Select from"../select";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("span",{className:"lg"===d?this.style("m-r-1"):"",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),{},{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,/**
|
|
2
2
|
* Allows the consumer to react to searching, while the search itself is handled internally. Called with `{ searchQuery: string, filteredOptions: Currency[] }`
|
|
3
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
|
|
4
4
|
// to be able to properly generate TS types, this is due to us wrapping this component in `injectIntl` before exporting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import{IntlProvider}from"react-intl";import{adjustLocale,DEFAULT_LOCALE,getDirectionFromLocale}from"../common";import en from"../i18n/en.json";import{DirectionProvider}from"./direction";import{jsx as _jsx}from"react/jsx-runtime";var Provider=function(a){var b,c=a.i18n,d=a.children,e=c.locale,f=c.messages,g=c.defaultRichTextElements,h=adjustLocale(e);return null===h?(console.warn("Unsupported locale value was provided: '".concat(e,"', defaulting to '").concat(DEFAULT_LOCALE,"'")),b={locale:DEFAULT_LOCALE,messages:en}):b={locale:h,messages:f},/*#__PURE__*/_jsx(DirectionProvider,{direction:getDirectionFromLocale(e),children:/*#__PURE__*/_jsx(IntlProvider,{defaultLocale:DEFAULT_LOCALE,locale:b.locale,messages:b.messages,defaultRichTextElements:g,children:d})})};Provider.propTypes={i18n:PropTypes.shape({locale:PropTypes.string.isRequired,messages:PropTypes.shape({}).isRequired,defaultRichTextElements:PropTypes.shape({})}).isRequired,children:PropTypes.node},Provider.defaultProps={children:void 0};export default Provider;
|
|
1
|
+
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}import PropTypes from"prop-types";import{IntlProvider}from"react-intl";import{adjustLocale,DEFAULT_LOCALE,getDirectionFromLocale}from"../common";import en from"../i18n/en.json";import{DirectionProvider}from"./direction";import{jsx as _jsx}from"react/jsx-runtime";var Provider=function(a){var b,c=a.i18n,d=a.children,e=c.locale,f=c.messages,g=c.defaultRichTextElements,h=adjustLocale(e);return null===h?(console.warn("Unsupported locale value was provided: '".concat(e,"', defaulting to '").concat(DEFAULT_LOCALE,"'")),b={locale:DEFAULT_LOCALE,messages:_objectSpread(_objectSpread({},en),f)}):b={locale:h,messages:f},/*#__PURE__*/_jsx(DirectionProvider,{direction:getDirectionFromLocale(e),children:/*#__PURE__*/_jsx(IntlProvider,{defaultLocale:DEFAULT_LOCALE,locale:b.locale,messages:b.messages,defaultRichTextElements:g,children:d})})};Provider.propTypes={i18n:PropTypes.shape({locale:PropTypes.string.isRequired,messages:PropTypes.shape({}).isRequired,defaultRichTextElements:PropTypes.shape({})}).isRequired,children:PropTypes.node},Provider.defaultProps={children:void 0};export default Provider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";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 _regeneratorRuntime from"@babel/runtime/regenerator";import{render,waitFor,screen}from"@testing-library/react";import{FormattedMessage,useIntl}from"react-intl";import closeButtonMessages from"../common/closeButton/CloseButton.messages";import Provider from".";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";describe("Provider",function(){beforeAll(function(){jest.spyOn(console,"error").mockImplementation(function(){return jest.fn()}),jest.spyOn(console,"error").mockImplementation(function(){return jest.fn()}),jest.spyOn(console,"warn").mockImplementation(function(){return jest.fn()})}),afterAll(function(){jest.restoreAllMocks()}),it("does not add any elements in the DOM",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function a(){var b,c,d,e;return _regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b="en",a.next=3,import("../i18n/".concat(b,".json"));case 3:c=a.sent,d=render(/*#__PURE__*/_jsx(Provider,{i18n:{locale:b,messages:c}})),e=d.container,expect(e).toBeEmptyDOMElement();case 6:case"end":return a.stop();}},a)}))),it.each([["zh-HK","zh-HK"],["ru","ru"],["en-GB","en-GB"],["en-US","en-US"],["en_US","en-US"],["en_GB","en-GB"],["ja","ja"],["ja-JP","ja-JP"],["","en-GB"],[" ","en-GB"],[null,"en-GB"],[void 0,"en-GB"]])("check locale value \"%s\"",function(a,b){var c=render(/*#__PURE__*/ // @ts-expect-error 2322
|
|
2
|
-
_jsx(Provider,{i18n:{locale:a,messages:{}},children:/*#__PURE__*/_jsx(function TestComponent(){var a=useIntl();return/*#__PURE__*/_jsxs(_Fragment,{children:["locale: ",a.locale]})},{})})),d=c.container;expect(d).toHaveTextContent("locale: ".concat(b))}),it.each([["ru","\u0417\u0430\u043A\u0440\u044B\u0442\u044C"],["en","Close"]])("switching locale (%s)",/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function c(a,b){var d;return _regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return expect(document.body).toBeEmptyDOMElement(),c.next=3,import("../i18n/".concat(a,".json"));case 3:return d=c.sent,render(/*#__PURE__*/_jsx(Provider,{i18n:{locale:a,messages:d},children:/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel))})),c.next=7,waitFor(function(){expect(screen.getByText(b)).toBeInTheDocument()});case 7:case"end":return c.stop();}},c)}));return function(){return a.apply(this,arguments)}}())});
|
|
2
|
+
_jsx(Provider,{i18n:{locale:a,messages:{}},children:/*#__PURE__*/_jsx(function TestComponent(){var a=useIntl();return/*#__PURE__*/_jsxs(_Fragment,{children:["locale: ",a.locale]})},{})})),d=c.container;expect(d).toHaveTextContent("locale: ".concat(b))}),it.each([["ru","\u0417\u0430\u043A\u0440\u044B\u0442\u044C"],["en","Close"]])("switching locale (%s)",/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function c(a,b){var d;return _regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return expect(document.body).toBeEmptyDOMElement(),c.next=3,import("../i18n/".concat(a,".json"));case 3:return d=c.sent,render(/*#__PURE__*/_jsx(Provider,{i18n:{locale:a,messages:d},children:/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel))})),c.next=7,waitFor(function(){expect(screen.getByText(b)).toBeInTheDocument()});case 7:case"end":return c.stop();}},c)}));return function(){return a.apply(this,arguments)}}()),it("does not override passed in messages if parsing locale fails",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function a(){var b,c,d,e;return _regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return expect(document.body).toBeEmptyDOMElement(),b="some.message.that.was.passed.in",c="Boop",d="en-GB",e=_defineProperty({},b,c),Object.defineProperty(Intl,"Locale",{value:void 0}),render(/*#__PURE__*/_jsxs(Provider,{i18n:{locale:d,messages:e},children:[/*#__PURE__*/_jsx("span",{children:/*#__PURE__*/_jsx(FormattedMessage,{id:b})}),/*#__PURE__*/_jsx("span",{children:/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel))})]})),a.t0=expect,a.next=10,screen.findByText(c);case 10:a.t1=a.sent,(0,a.t0)(a.t1).toBeInTheDocument(),expect(screen.getByText("Close")).toBeInTheDocument();case 13:case"end":return a.stop();}},a)})))});
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,useEffect,useRef}from"react";import{useIntl}from"react-intl";import Button from"../button";import Chevron from"../chevron";import{Position,Size}from"../common";import BottomSheet from"../common/bottomSheet";import{stopPropagation}from"../common/domHelpers";import{useLayout}from"../common/hooks";import KeyCodes from"../common/keyCodes";import Panel from"../common/panel";import Drawer from"../drawer";import messages from"./Select.messages";import Option from"./option";import SearchBox from"./searchBox";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DEFAULT_SEARCH_VALUE="",DEFAULT_OPTIONS_PAGE_SIZE=100,includesString=function(a,b){return a.toLowerCase().includes(b.toLowerCase())};function defaultFilterFunction(a,b){if(isPlaceholderOption(a))return!0;var c=a.label,d=a.note,e=a.secondary,f=a.currency,g=a.searchStrings;return!!c&&includesString(c,b)||!!d&&includesString(d,b)||!!e&&includesString(e,b)||!!f&&includesString(f,b)||!!g&&g.some(function(a){return includesString(a,b)})}function isActionableOption(a){return!a.header&&!a.separator&&!a.disabled}function isHeaderOption(a){return null!==a&&"header"in a}function isSparatorOption(a){return null!==a&&"separator"in a}/**
|
|
2
|
+
* No option or placeholder option is selected
|
|
3
|
+
*/var DEFAULT_SELECTED_OPTION=null;function isPlaceholderOption(a){return a===DEFAULT_SELECTED_OPTION||"placeholder"in a}export default function Select(a){function b(){if(null!==U){var a=ga().filter(isActionableOption);e(a[U])}}function c(a){var b=ga().filter(isActionableOption),c=b.reduce(function(a,b,c){return null===a?k(v,b)?c:null:a},null),d=null===W.current||void 0===W.current?-1:W.current,e=d;null===d&&null===c&&V(0),null===d&&null!==c&&(e=c);var f=e+a,g=Math.max(Math.min(0,b.length-1),f);V(g)}function d(a){return function(b){stopPropagation(b),e(a)}}function e(a){x(isPlaceholderOption(a)?DEFAULT_SELECTED_OPTION:a),ia()}// eslint-disable-next-line react/prop-types
|
|
4
|
+
function f(a){var b=a.className,c=classNames(K("np-dropdown-menu"),_defineProperty({},K("np-dropdown-menu-".concat(r)),!fa),K(b));return/*#__PURE__*/_jsxs("ul",_objectSpread(_objectSpread({ref:ca,id:"".concat(n,"-listbox"),role:"listbox",tabIndex:"-1",className:c},G),{},{children:[!o&&!da&&null!==m&&/*#__PURE__*/_jsx(h,{}),da&&/*#__PURE__*/_jsx(SearchBox,{ref:_,classNames:E,value:C||Q,placeholder:D||J(messages.searchPlaceholder),onChange:ha,onClick:stopPropagation}),ga().slice(0,Z).map(ja),Z<ga().length&&/*#__PURE__*/_jsx(g,{})]}))}function g(){function a(a){stopPropagation(a),$(Z+DEFAULT_OPTIONS_PAGE_SIZE)}return/*#__PURE__*/ (/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */_jsx("li",{className:classNames(K("clickable"),K("border-bottom"),K("show-more")),onClick:a,onKeyPress:a,children:/*#__PURE__*/_jsx("a",{children:"..."})}))}function h(){var a={placeholder:m};return/*#__PURE__*/ (/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */_jsx("li",{className:classNames(K("clickable"),K("border-bottom")),onClick:d(a),onKeyPress:d(a),children:/*#__PURE__*/_jsx("a",{children:m})}))}// eslint-disable-next-line react/prop-types
|
|
5
|
+
function i(a){var b=a.key;return/*#__PURE__*/_jsx("li",{className:K("np-separator"),"aria-hidden":!0},b)}// eslint-disable-next-line react/prop-types
|
|
6
|
+
function j(a){var b=a.key,c=a.children;return/*#__PURE__*/_jsx("li",{className:K("np-dropdown-header"),onClick:stopPropagation,onKeyPress:stopPropagation,children:c},b)}function k(a,b){return(null===a||void 0===a?void 0:a.value)===(null===b||void 0===b?void 0:b.value)}function l(a){return ga().reduce(function(b,c,d){return d<a&&isActionableOption(c)?b+1:b},0)}var m=a.placeholder,n=a.id,o=a.required,p=a.disabled,q=a.inverse,r=a.dropdownWidth,t=a.size,u=a.block,v=a.selected,w=a.search,x=a.onChange,y=a.onFocus,z=a.onBlur,A=a.options,B=a.onSearchChange,C=a.searchValue,D=a.searchPlaceholder,E=a.classNames,F=a.dropdownUp,G=a.dropdownProps,H=a.buttonProps,I=useIntl(),J=I.formatMessage,K=function(a){return E[a]||a},s=useState(!1),L=_slicedToArray(s,2),M=L[0],N=L[1],O=useState(DEFAULT_SEARCH_VALUE),P=_slicedToArray(O,2),Q=P[0],R=P[1],S=useState(null),T=_slicedToArray(S,2),U=T[0],V=T[1],W=useRef(),X=useState(DEFAULT_OPTIONS_PAGE_SIZE),Y=_slicedToArray(X,2),Z=Y[0],$=Y[1],_=useRef(null),aa=useRef(null),ba=useRef(null),ca=useRef(null),da=!!B||!!w,ea=useLayout(),fa=ea.isMobile,ga=function(){return w&&Q?A.filter(function(a){return isActionableOption(a)&&!isPlaceholderOption(a)}).filter(function(a){return"function"==typeof w?w(a,Q):defaultFilterFunction(a,Q)}):A},ha=function(a){$(DEFAULT_OPTIONS_PAGE_SIZE),R(a.target.value),B&&B(a.target.value)};useEffect(function(){W.current=U,M&&(!fa||""!==Q)&&(da&&!!_.current&&_.current.focus(),!da&&ca.current&&ca.current.focus())},[M,Q,da,fa,U]);var ia=function(){N(!1),V(null),ba.current&&ba.current.focus()},ja=function(a,b){var c,e=a;if(isSparatorOption(e)&&null!==e&&void 0!==e&&e.separator)return/*#__PURE__*/_jsx(i,{},b);var f=a;if(isHeaderOption(f)&&f.header)return/*#__PURE__*/_jsx(j,{children:f.header},b);var g=k(v,a),h=a,m=!h.disabled&&U===l(b),n=classNames(K("np-dropdown-item"),h.disabled?[K("disabled")]:K("clickable"),(c={},_defineProperty(c,K("active"),g),_defineProperty(c,K("np-dropdown-item--focused"),m),c)),o=h.disabled?stopPropagation:d(h);return/*#__PURE__*/ (/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */_jsx("li",{"aria-selected":g,"aria-disabled":a.disabled,role:"option",tabIndex:"-1",className:n,onClick:o,onKeyPress:o,children:/*#__PURE__*/_jsx("a",{disabled:h.disabled,children:/*#__PURE__*/_jsx(Option,_objectSpread(_objectSpread({},h),{},{classNames:E}))})},b))},ka=!!A.length;return M&&(""!==C||""!==Q)&&(ka&&null===U&&V(0),!ka&&null!==U&&V(null)),/*#__PURE__*/_jsxs("div",{// eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
7
|
+
ref:aa,className:classNames(K("np-select"),u?K("btn-block"):null,K("btn-group")),onKeyDown:function handleKeyDown(a){switch(a.keyCode){case KeyCodes.UP:case KeyCodes.DOWN:M?c(a.keyCode===KeyCodes.UP?-1:1):N(!0),stopPropagation(a);break;case KeyCodes.SPACE:a.target!==_.current&&(M?b():N(!0),stopPropagation(a));break;case KeyCodes.ENTER:M?b():N(!0),stopPropagation(a);break;case KeyCodes.ESCAPE:ia(),stopPropagation(a);break;case KeyCodes.TAB:M&&b();break;default:}},onTouchMove:function handleTouchStart(a){a.currentTarget===a.target&&M&&ia()},onFocus:function handleOnFocus(a){y&&y(a)},onBlur:function handleOnBlur(a){var b=a.nativeEvent;if(b){var c=b.relatedTarget,d=a.currentTarget;if(d&&c&&d.contains(c))return}z&&z(a)},children:[/*#__PURE__*/_jsxs(Button,_objectSpread(_objectSpread({ref:ba,id:n,block:u,size:t,htmlType:"button",className:classNames(K("np-dropdown-toggle"),q?K("np-dropdown-toggle-navy"):null)// reset Button's styles
|
|
8
|
+
,type:null,priority:null,disabled:p,role:"combobox","aria-controls":"".concat(n,"-listbox"),"aria-expanded":M,"aria-autocomplete":"none",onClick:function handleOnClick(){N(!0)}},H),{},{children:[v?/*#__PURE__*/_jsx(Option,_objectSpread(_objectSpread({},v),{},{classNames:E,selected:!0})):/*#__PURE__*/_jsx("span",{className:K("form-control-placeholder"),children:m}),/*#__PURE__*/_jsx(Chevron// disabled={disabled}
|
|
9
|
+
,{className:classNames(K("tw-icon"),K("tw-chevron-up-icon"),K("tw-chevron"),K("bottom"),K("np-select-chevron"))})]})),fa?da?/*#__PURE__*/_jsx(Drawer,{open:M,headerTitle:D||J(messages.searchPlaceholder),onClose:ia,children:/*#__PURE__*/_jsx(f,{})}):/*#__PURE__*/_jsx(BottomSheet,{open:M,onClose:ia,children:/*#__PURE__*/_jsx(f,{className:"p-a-1"})}):/*#__PURE__*/_jsx(Panel,{open:M,flip:!1,anchorRef:aa,position:F?Position.TOP:Position.BOTTOM,onClose:ia,children:/*#__PURE__*/_jsx(f,{className:"p-a-1"})})]})}Select.propTypes={placeholder:PropTypes.string,id:PropTypes.string,required:PropTypes.bool,disabled:PropTypes.bool,inverse:PropTypes.bool,dropdownRight:PropTypes.oneOf(["xs","sm","md","lg","xl"]),dropdownWidth:PropTypes.oneOf(["sm","md","lg"]),size:PropTypes.oneOf(["sm","md","lg"]),block:PropTypes.bool,selected:PropTypes.shape({value:PropTypes.any.isRequired,label:PropTypes.node,icon:PropTypes.node,currency:PropTypes.string,note:PropTypes.node,secondary:PropTypes.node}),/**
|
|
5
10
|
* Search toggle
|
|
6
11
|
* if `true` default search functionality being enabled (not case sensitive search in option labels & currency props)
|
|
7
12
|
* if `function` you can define your own search function to implement custom search experience. This search function used while filtering the options array. The custom search function takes two parameters. First is the option the second is the keyword.
|
|
8
13
|
*/search:PropTypes.oneOfType([PropTypes.bool,PropTypes.func]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({value:PropTypes.any,label:PropTypes.node,header:PropTypes.node,icon:PropTypes.node,currency:PropTypes.string,note:PropTypes.node,secondary:PropTypes.node,separator:PropTypes.bool,disabled:PropTypes.bool,searchStrings:PropTypes.arrayOf(PropTypes.string)})).isRequired,/**
|
|
9
14
|
* To have full control of your search value and response use `onSearchChange` function combined with `searchValue` and custom filtering on the options array.
|
|
10
15
|
* DO NOT USE TOGETHER WITH `search` PROPERTY
|
|
11
|
-
*/onSearchChange:PropTypes.func,searchValue:PropTypes.string,searchPlaceholder:PropTypes.string,classNames:PropTypes.objectOf(PropTypes.string),dropdownUp:PropTypes.bool,buttonProps:PropTypes.object,dropdownProps:PropTypes.object},Select.defaultProps={id:void 0,placeholder:void 0,size:"md",dropdownRight:null,dropdownWidth:
|
|
16
|
+
*/onSearchChange:PropTypes.func,searchValue:PropTypes.string,searchPlaceholder:PropTypes.string,classNames:PropTypes.objectOf(PropTypes.string),dropdownUp:PropTypes.bool,buttonProps:PropTypes.object,dropdownProps:PropTypes.object},Select.defaultProps={id:void 0,placeholder:void 0,size:"md",dropdownRight:null,dropdownWidth:Size.MEDIUM,inverse:!1,required:!1,disabled:!1,block:!0,selected:null,onFocus:null,onBlur:null,onSearchChange:void 0,search:!1,searchValue:"",searchPlaceholder:void 0,classNames:{},dropdownUp:!1,buttonProps:{},dropdownProps:{}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineMessages}from"react-intl";export default defineMessages({searchPlaceholder:{id:"neptune.Select.searchPlaceholder"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{cloneElement}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";function Option(a){var b=a.label,c=a.currency,d=void 0===c?"":c,e=a.note,f=void 0===e?"":e,g=a.secondary,h=void 0===g?"":g,i=a.icon,j=a.classNames,k=void 0===j?{}:j,l=a.selected,m=void 0!==l&&l,n=function(a){return a.map(function(a){return k[a]||a}).join(" ")},o=d?"".concat(n(["currency-flag","currency-flag-".concat(d.toLowerCase()),"".concat(m?"hidden-xs":"")])):void 0,p=f?"".concat(n(["d-inline-flex align-items-center"])):void 0;return/*#__PURE__*/_jsxs(_Fragment,{children:[i?/*#__PURE__*/cloneElement(i,{size:24,className:"".concat(n(["tw-icon","".concat(m&&d?"hidden-xs":"")]))}):d&&/*#__PURE__*/_jsx("i",{className:o}),/*#__PURE__*/_jsxs("span",{className:p,children:[b,f&&/*#__PURE__*/_jsx("span",{className:"body-2 m-l-1",children:f})]}),h&&/*#__PURE__*/_jsx("span",{className:"body-2 text-ellipsis",children:h})]})}export default Option;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Search as SearchIcon}from"@transferwise/icons";import classnames from"classnames";import
|
|
1
|
+
import{Search as SearchIcon}from"@transferwise/icons";import classnames from"classnames";import{forwardRef}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var SearchBox=/*#__PURE__*/forwardRef(function(a,b){var c=a.classNames,d=void 0===c?{}:c,e=a.onChange,f=a.onClick,g=a.placeholder,h=void 0===g?void 0:g,i=a.value,j=void 0===i?"":i,k=function(a){return d[a]||a};return/*#__PURE__*/_jsx("li",{className:k("border-bottom"),children:/*#__PURE__*/_jsx("a",{className:"".concat(k("np-select-filter-link")," ").concat(k("p-a-0")),children:/*#__PURE__*/_jsxs("div",{className:k("input-group"),children:[/*#__PURE__*/_jsx("span",{className:k("input-group-addon"),children:/*#__PURE__*/_jsx(SearchIcon,{className:classnames(k("tw-icon"),k("tw-icon-search"))})}),/*#__PURE__*/_jsx("input",{ref:b,type:"text",className:classnames(k("np-select-filter"),k("form-control")),placeholder:h,value:j,spellCheck:"false",onChange:e,onClick:f})]})})})});export default SearchBox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/anchor-is-valid */import classNames from"classnames";import PropTypes from"prop-types";import hightlight from"../util/highlight";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Option=function(a){var b=a.option,c=a.selected,d=a.onClick,e=a.query,f=b.label,g=b.note,h=b.secondary;return/*#__PURE__*/_jsx("li",{role:"option","aria-selected":"false",className:classNames("typeahead__option tw-dropdown-item
|
|
1
|
+
/* eslint-disable jsx-a11y/anchor-is-valid */import classNames from"classnames";import PropTypes from"prop-types";import hightlight from"../util/highlight";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Option=function(a){var b=a.option,c=a.selected,d=a.onClick,e=a.query,f=b.label,g=b.note,h=b.secondary;return/*#__PURE__*/_jsx("li",{role:"option","aria-selected":"false",className:classNames("typeahead__option tw-dropdown-item clickable",{"tw-dropdown-item--focused":c}),children:/*#__PURE__*/_jsxs("a",{className:"dropdown-item",href:"#",onClick:d,children:[/*#__PURE__*/_jsx("span",{children:hightlight(f,e)}),g&&/*#__PURE__*/_jsx("span",{className:"body-2 m-l-1",children:g}),h&&/*#__PURE__*/_jsx("span",{className:"body-2 text-ellipsis",children:h})]})})};Option.propTypes={option:PropTypes.shape({label:PropTypes.string.isRequired,note:PropTypes.string,secondary:PropTypes.string}).isRequired,query:PropTypes.string,selected:PropTypes.bool,onClick:PropTypes.func},Option.defaultProps={selected:!1,query:"",onClick:function onClick(){}};export default Option;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function isServerSide(){return"undefined"==typeof window}export function isBrowser(){return!isServerSide()}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{addClickClassToDocumentOnIos,removeClickClassFromDocumentOnIos}from"./documentIosClick";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as HistoryNavigator}from"./historyNavigator";export
|
|
1
|
+
export{default as HistoryNavigator}from"./historyNavigator";export*from"./domHelpers";export{addNoScrollBodyClass,removeNoScrollBodyClass}from"./DOMOperations";export*from"./theme";export*from"./direction";// Props
|
|
2
2
|
export*from"./propsValues/control";export{Breakpoint}from"./propsValues/breakpoint";export*from"./propsValues/size";export*from"./propsValues/width";export{Type}from"./propsValues/type";export{DateMode}from"./propsValues/dateMode";export{MonthFormat}from"./propsValues/monthFormat";export*from"./propsValues/position";export{Layout}from"./propsValues/layouts";export{Status}from"./propsValues/status";export{Sentiment}from"./propsValues/sentiment";export{ProfileType}from"./propsValues/profileType";export*from"./propsValues/scroll";export{MarkdownNodeType}from"./propsValues/markdownNodeType";export{FileType}from"./fileType";export{Key}from"./key";export*from"./locale";export*from"./commonProps";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
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";import"core-js/modules/es.reflect.construct.js";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 PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{Size,MonthFormat,
|
|
2
|
-
ref:this.element,className:"btn-group btn-block
|
|
1
|
+
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";import"core-js/modules/es.reflect.construct.js";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 PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{Size,MonthFormat,Position}from"../common";import{isWithinRange,moveToWithinRange}from"../common/dateUtils";import KeyCodes from"../common/keyCodes";import ResponsivePanel from"../common/responsivePanel";import DateTrigger from"./dateTrigger";import DayCalendar from"./dayCalendar";import{getStartOfDay}from"./getStartOfDay";import MonthCalendar from"./monthCalendar";import YearCalendar from"./yearCalendar";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MODE={DAY:"day",MONTH:"month",YEAR:"year"},DateLookup=/*#__PURE__*/function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"element",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"dropdown",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"open",function(){var a=d.props.onFocus;d.setState({open:!0,mode:MODE.DAY}),a&&a()}),_defineProperty(_assertThisInitialized(d),"close",function(){var a=d.props.onBlur;d.setState({open:!1}),a&&a()}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){var b=d.state.open;switch(a.keyCode){case KeyCodes.LEFT:b?d.adjustDate(-1,-1,-1):d.open(),a.preventDefault();break;case KeyCodes.UP:b?d.adjustDate(-7,-4,-4):d.open(),a.preventDefault();break;case KeyCodes.RIGHT:b?d.adjustDate(1,1,1):d.open(),a.preventDefault();break;case KeyCodes.DOWN:b?d.adjustDate(7,4,4):d.open(),a.preventDefault();break;case KeyCodes.ESCAPE:d.close(),a.preventDefault();break;default:}}),_defineProperty(_assertThisInitialized(d),"adjustDate",function(a,b,c){var e,f=d.state,g=f.selectedDate,h=f.min,i=f.max,j=f.mode;e=g?new Date(j===MODE.YEAR?g.getFullYear()+c:g.getFullYear(),j===MODE.MONTH?g.getMonth()+b:g.getMonth(),j===MODE.DAY?g.getDate()+a:g.getDate()):getStartOfDay(new Date),e=moveToWithinRange(e,h,i),+e!=+g&&d.props.onChange(e)}),_defineProperty(_assertThisInitialized(d),"focusOn",function(a,b){var c=d.element.current.querySelector(a);c?c.focus():b&&d.focusOn(b)}),_defineProperty(_assertThisInitialized(d),"switchMode",function(a){d.setState({mode:a},function(){d.focusOn(".active",".today")})}),_defineProperty(_assertThisInitialized(d),"switchToDays",function(){return d.switchMode(MODE.DAY)}),_defineProperty(_assertThisInitialized(d),"switchToMonths",function(){return d.switchMode(MODE.MONTH)}),_defineProperty(_assertThisInitialized(d),"switchToYears",function(){return d.switchMode(MODE.YEAR)}),_defineProperty(_assertThisInitialized(d),"handleSelectedDateUpdate",function(a){d.setState({selectedDate:a},function(){d.props.onChange(a),d.close(),d.focusOn(".btn")})}),_defineProperty(_assertThisInitialized(d),"handleViewDateUpdate",function(a){var b=a.month,c=void 0===b?d.state.viewMonth:b,e=a.year,f=void 0===e?d.state.viewYear:e;d.setState({viewMonth:c,viewYear:f})}),_defineProperty(_assertThisInitialized(d),"getCalendar",function(){var a=d.state,b=a.selectedDate,c=a.min,e=a.max,f=a.viewMonth,g=a.viewYear,h=a.mode,i=d.props,j=i.placeholder,k=i.monthFormat;return/*#__PURE__*/_jsxs("div",{className:"p-a-1",children:[h===MODE.DAY&&/*#__PURE__*/_jsx(DayCalendar,{selectedDate:b,min:c,max:e,viewMonth:f,viewYear:g,monthFormat:k,onSelect:d.handleSelectedDateUpdate,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.MONTH&&/*#__PURE__*/_jsx(MonthCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToDays,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.YEAR&&/*#__PURE__*/_jsx(YearCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToMonths,onViewDateUpdate:d.handleViewDateUpdate})]})}),_defineProperty(_assertThisInitialized(d),"handleClear",function(){d.props.onChange(null),d.focusOn(".np-date-trigger")}),d.state={selectedDate:getStartOfDay(a.value),min:getStartOfDay(a.min),max:getStartOfDay(a.max),viewMonth:(a.value||new Date).getMonth(),viewYear:(a.value||new Date).getFullYear(),open:!1,mode:MODE.DAY},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"componentDidUpdate",value:function componentDidUpdate(a){+this.props.value!=+a.value&&this.state.open&&this.focusOn(".active")}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState=function(){}}},{key:"render",value:function render(){var a=this.state,b=a.selectedDate,c=a.open,d=this.props,e=d.size,f=d.placeholder,g=d.label,h=d.monthFormat,i=d.disabled,j=d.clearable,k=d.value;return/*#__PURE__*/_jsxs("div",{// eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
2
|
+
ref:this.element,className:"btn-group btn-block",onKeyDown:this.handleKeyDown,children:[/*#__PURE__*/_jsx(DateTrigger,{selectedDate:b,size:e,placeholder:f,label:g,monthFormat:h,disabled:i,onClick:this.open,onClear:!i&&j&&k?this.handleClear:null}),/*#__PURE__*/_jsx(ResponsivePanel,{anchorRef:this.element,open:c,className:"tw-date-lookup-menu",position:Position.BOTTOM,onClose:this.close,children:this.getCalendar()})]})}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(a,b){var c=getStartOfDay(a.value),d=getStartOfDay(a.min),e=getStartOfDay(a.max),f=+b.selectedDate!=+c,g=+b.min!=+d,h=+b.max!=+e;if(f||g||h){var i=f?c:b.selectedDate,j=g?d:b.min,k=h?e:b.max;// make sure that selected date is within allowed range
|
|
3
3
|
if(!isWithinRange(i,j,k))return a.onChange(moveToWithinRange(i,j,k)),null;var l=(i||new Date).getMonth(),m=(i||new Date).getFullYear();return{selectedDate:i,min:j,max:k,viewMonth:l,viewYear:m}}return null}}]),b}(PureComponent);DateLookup.propTypes={value:PropTypes.instanceOf(Date).isRequired,min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string,label:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),disabled:PropTypes.bool,onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,clearable:PropTypes.bool},DateLookup.defaultProps={min:null,max:null,size:Size.MEDIUM,placeholder:"",label:"",monthFormat:MonthFormat.LONG,disabled:!1,onFocus:null,onBlur:null,clearable:!1};export default DateLookup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"core-js/modules/es.array.concat.js";import{formatDate}from"@transferwise/formatting";import{isKey}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useIntl}from"react-intl";import Chevron from"../../chevron";import{Size,Position}from"../../common";import CloseButton from"../../common/closeButton/CloseButton";import messages from"./DateTrigger.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{className:"btn btn-".concat(c," btn-input
|
|
1
|
+
import"core-js/modules/es.array.concat.js";import{formatDate}from"@transferwise/formatting";import{isKey}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useIntl}from"react-intl";import Chevron from"../../chevron";import{Size,Position}from"../../common";import CloseButton from"../../common/closeButton/CloseButton";import messages from"./DateTrigger.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{className:"btn btn-".concat(c," btn-input np-date-trigger np-date-trigger--").concat(c),disabled:g,type:"button",onClick:h,children:[e&&/*#__PURE__*/_jsx("span",{className:"control-label small m-r-1",children:e}),b?/*#__PURE__*/_jsx("span",{children:formatDate(b,k,{day:"numeric",month:f,year:"numeric"})}):/*#__PURE__*/_jsx("span",{className:"form-control-placeholder visible-xs-inline visible-sm-inline visible-md-inline visible-lg-inline visible-xl-inline",children:d}),i?/*#__PURE__*/_jsx(CloseButton,{className:"clear-btn d-flex align-items-center","aria-label":l(messages.ariaLabel),size:c===Size.SMALL?16:24,filled:!0,onClick:function(a){a.stopPropagation(),a.preventDefault(),i()},onKeyPress:function handleKeyDown(a){(isKey({keyType:"Space",event:a})||isKey({keyType:"Enter",event:a}))&&(a.stopPropagation(),a.preventDefault(),i())}}):/*#__PURE__*/_jsx(Chevron,{orientation:Position.BOTTOM,disabled:g})]})};DateTrigger.propTypes={selectedDate:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string.isRequired,label:PropTypes.string.isRequired,monthFormat:PropTypes.oneOf(["short","long"]).isRequired,disabled:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired,onClear:PropTypes.func},DateTrigger.defaultProps={selectedDate:null,size:Size.MEDIUM,onClear:void 0};export default DateTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{MonthFormat}from"../../common";import DateHeader from"../dateHeader";import DayCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs(
|
|
1
|
+
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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{MonthFormat}from"../../common";import DateHeader from"../dateHeader";import DayCalendarTable from"./table";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 DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(DateHeader,{label:formatDate(new Date(f,e),g,{month:h,year:"numeric"}),onLabelClick:i,onPreviousClick:this.selectPreviousMonth,onNextClick:this.selectNextMonth}),/*#__PURE__*/_jsx(DayCalendarTable,{selectedDate:b,min:c,max:d,viewMonth:e,viewYear:f,onSelect:j})]})}}]),b}(PureComponent);DayCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,monthFormat:PropTypes.oneOf([MonthFormat.LONG,MonthFormat.SHORT]).isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},DayCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import DateHeader from"../dateHeader";import MonthCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs(
|
|
1
|
+
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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import DateHeader from"../dateHeader";import MonthCalendarTable from"./table";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 MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(DateHeader,{label:formatDate(new Date(e,0),f,{year:"numeric"}),onLabelClick:h,onPreviousClick:this.selectPreviousYear,onNextClick:this.selectNextYear}),/*#__PURE__*/_jsx(MonthCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:g,onSelect:this.onMonthSelect})]})}}]),b}(PureComponent);MonthCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},MonthCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(MonthCalendar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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 PropTypes from"prop-types";import{PureComponent}from"react";import DateHeader from"../dateHeader";import YearCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs(
|
|
1
|
+
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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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 PropTypes from"prop-types";import{PureComponent}from"react";import DateHeader from"../dateHeader";import YearCalendarTable from"./table";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 YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(DateHeader,{onPreviousClick:this.selectPreviousYears,onNextClick:this.selectNextYears}),/*#__PURE__*/_jsx(YearCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:f,onSelect:this.onYearSelect})]})}}]),b}(PureComponent);YearCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},YearCalendar.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendar;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"neptune.Pagination.ariaLabel": "Pagination navigation",
|
|
10
10
|
"neptune.PaginationLink.ariaLabel.active": "Go to page {pageNumber}",
|
|
11
11
|
"neptune.PaginationLink.ariaLabel.inactive": "Current page, page {pageNumber}",
|
|
12
|
+
"neptune.Select.searchPlaceholder": "Search...",
|
|
12
13
|
"neptune.Summary.statusDone": "Item done",
|
|
13
14
|
"neptune.Summary.statusNotDone": "Item to do",
|
|
14
15
|
"neptune.Summary.statusPending": "Item pending",
|