@transferwise/components 41.2.1-inter.1 → 41.3.0
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 +24 -0
- package/build/es/no-polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
- package/build/es/no-polyfill/actionButton/ActionButton.js +1 -1
- package/build/es/no-polyfill/alert/Alert.js +1 -1
- package/build/es/no-polyfill/avatar/Avatar.js +1 -1
- package/build/es/no-polyfill/avatarWrapper/AvatarWrapper.js +1 -1
- package/build/es/no-polyfill/card/Card.js +1 -1
- package/build/es/no-polyfill/checkbox/Checkbox.js +1 -1
- package/build/es/no-polyfill/chips/Chip.js +1 -1
- package/build/es/no-polyfill/circularButton/CircularButton.js +1 -1
- package/build/es/no-polyfill/common/Option/Option.js +1 -1
- 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/dateInput/DateInput.js +3 -3
- package/build/es/no-polyfill/dateLookup/dateHeader/DateHeader.js +1 -1
- package/build/es/no-polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -1
- package/build/es/no-polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
- package/build/es/no-polyfill/dateLookup/tableLink/TableLink.js +1 -1
- package/build/es/no-polyfill/drawer/Drawer.js +1 -1
- package/build/es/no-polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
- package/build/es/no-polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +1 -1
- package/build/es/no-polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
- package/build/es/no-polyfill/header/Header.js +2 -2
- package/build/es/no-polyfill/index.js +2 -2
- package/build/es/no-polyfill/instructionsList/InstructionsList.js +3 -3
- package/build/es/no-polyfill/link/Link.js +3 -2
- package/build/es/no-polyfill/link/Link.story.js +1 -1
- package/build/es/no-polyfill/modal/Modal.js +1 -1
- package/build/es/no-polyfill/moneyInput/MoneyInput.js +2 -2
- package/build/es/no-polyfill/nudge/Nudge.js +1 -1
- package/build/es/no-polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
- package/build/es/no-polyfill/popover/Popover.js +1 -1
- package/build/es/no-polyfill/progressBar/ProgressBar.js +1 -1
- package/build/es/no-polyfill/radio/Radio.js +1 -1
- package/build/es/no-polyfill/select/Select.js +6 -6
- package/build/es/no-polyfill/select/option/Option.js +1 -1
- package/build/es/no-polyfill/snackbar/Snackbar.js +1 -1
- package/build/es/no-polyfill/stepper/Stepper.js +1 -1
- package/build/es/no-polyfill/summary/Summary.js +1 -1
- package/build/es/no-polyfill/tabs/Tab.js +1 -1
- package/build/es/no-polyfill/tile/Tile.js +1 -1
- package/build/es/no-polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
- package/build/es/no-polyfill/upload/Upload.js +1 -1
- package/build/es/no-polyfill/upload/steps/completeStep/completeStep.js +1 -1
- package/build/es/no-polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
- package/build/es/no-polyfill/upload/steps/processingStep/processingStep.js +1 -1
- package/build/es/no-polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
- package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
- package/build/es/polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
- package/build/es/polyfill/actionButton/ActionButton.js +1 -1
- package/build/es/polyfill/alert/Alert.js +1 -1
- package/build/es/polyfill/avatar/Avatar.js +1 -1
- package/build/es/polyfill/avatarWrapper/AvatarWrapper.js +1 -1
- package/build/es/polyfill/card/Card.js +1 -1
- package/build/es/polyfill/checkbox/Checkbox.js +1 -1
- package/build/es/polyfill/chips/Chip.js +1 -1
- package/build/es/polyfill/circularButton/CircularButton.js +1 -1
- package/build/es/polyfill/common/Option/Option.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/dateInput/DateInput.js +3 -3
- package/build/es/polyfill/dateLookup/dateHeader/DateHeader.js +1 -1
- package/build/es/polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -1
- package/build/es/polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
- package/build/es/polyfill/dateLookup/tableLink/TableLink.js +1 -1
- package/build/es/polyfill/drawer/Drawer.js +1 -1
- package/build/es/polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
- package/build/es/polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +1 -1
- package/build/es/polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
- package/build/es/polyfill/header/Header.js +2 -2
- package/build/es/polyfill/index.js +2 -2
- package/build/es/polyfill/instructionsList/InstructionsList.js +3 -3
- package/build/es/polyfill/link/Link.js +3 -2
- package/build/es/polyfill/link/Link.story.js +1 -1
- package/build/es/polyfill/modal/Modal.js +1 -1
- package/build/es/polyfill/moneyInput/MoneyInput.js +2 -2
- package/build/es/polyfill/nudge/Nudge.js +1 -1
- package/build/es/polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
- package/build/es/polyfill/popover/Popover.js +1 -1
- package/build/es/polyfill/progressBar/ProgressBar.js +1 -1
- package/build/es/polyfill/radio/Radio.js +1 -1
- package/build/es/polyfill/select/Select.js +6 -6
- package/build/es/polyfill/select/option/Option.js +1 -1
- package/build/es/polyfill/snackbar/Snackbar.js +1 -1
- package/build/es/polyfill/stepper/Stepper.js +1 -1
- package/build/es/polyfill/summary/Summary.js +1 -1
- package/build/es/polyfill/tabs/Tab.js +1 -1
- package/build/es/polyfill/tile/Tile.js +1 -1
- package/build/es/polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
- package/build/es/polyfill/upload/Upload.js +1 -1
- package/build/es/polyfill/upload/steps/completeStep/completeStep.js +1 -1
- package/build/es/polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
- package/build/es/polyfill/upload/steps/processingStep/processingStep.js +1 -1
- package/build/es/polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/es/polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
- package/build/es/polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
- package/build/main.css +1 -1
- package/build/styles/accordion/Accordion.css +1 -1
- package/build/styles/actionButton/ActionButton.css +1 -1
- package/build/styles/actionOption/ActionOption.css +1 -0
- package/build/styles/avatar/Avatar.css +1 -1
- package/build/styles/chips/Chip.css +1 -1
- package/build/styles/circularButton/CircularButton.css +1 -1
- package/build/styles/common/Option/Option.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/drawer/Drawer.css +1 -1
- package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/build/styles/header/Header.css +1 -1
- package/build/styles/lab/mobileNav/MobileNav.css +1 -1
- package/build/styles/link/Link.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/modal/Modal.css +1 -1
- package/build/styles/navigationOption/NavigationOption.css +1 -1
- package/build/styles/nudge/Nudge.css +1 -1
- package/build/styles/popover/Popover.css +1 -1
- package/build/styles/progressBar/ProgressBar.css +1 -0
- package/build/styles/select/Select.css +1 -1
- package/build/styles/snackbar/Snackbar.css +1 -1
- package/build/styles/stepper/Stepper.css +1 -1
- package/build/styles/summary/Summary.css +1 -1
- package/build/styles/tabs/Tabs.css +1 -1
- package/build/styles/tile/Tile.css +1 -1
- package/build/styles/typeahead/Typeahead.css +1 -1
- package/build/styles/uploadInput/uploadButton/UploadButton.css +1 -1
- package/build/styles/uploadInput/uploadItem/UploadItem.css +1 -1
- package/build/types/checkboxButton/CheckboxButton.d.ts +1 -1
- package/build/types/checkboxButton/CheckboxButton.story.d.ts +1 -1
- package/build/types/common/domHelpers/index.d.ts +1 -0
- package/build/types/common/index.d.ts +0 -1
- package/build/types/common/panel/Panel.d.ts +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
- package/build/types/dateInput/DateInput.d.ts +1 -0
- package/build/types/header/Header.d.ts +1 -1
- package/build/types/header/Header.story.d.ts +1 -1
- package/build/types/index.d.ts +2 -4
- package/build/types/link/Link.d.ts +5 -6
- package/build/types/link/Link.story.d.ts +2 -2
- package/build/types/moneyInput/MoneyInput.d.ts +1 -0
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +2 -0
- package/build/types/select/searchBox/SearchBox.d.ts +1 -1
- 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 +5 -5
- package/build/es/no-polyfill/body/Body.js +0 -1
- package/build/es/no-polyfill/body/Body.spec.js +0 -1
- package/build/es/no-polyfill/body/Body.story.js +0 -1
- package/build/es/no-polyfill/body/index.js +0 -1
- package/build/es/no-polyfill/common/propsValues/typography.js +0 -1
- package/build/es/no-polyfill/title/Title.js +0 -1
- package/build/es/no-polyfill/title/Title.spec.js +0 -1
- package/build/es/no-polyfill/title/Title.story.js +0 -1
- package/build/es/no-polyfill/title/index.js +0 -1
- package/build/es/polyfill/body/Body.js +0 -1
- package/build/es/polyfill/body/Body.spec.js +0 -1
- package/build/es/polyfill/body/Body.story.js +0 -1
- package/build/es/polyfill/body/index.js +0 -1
- package/build/es/polyfill/common/propsValues/typography.js +0 -1
- package/build/es/polyfill/title/Title.js +0 -1
- package/build/es/polyfill/title/Title.spec.js +0 -1
- package/build/es/polyfill/title/Title.story.js +0 -1
- package/build/es/polyfill/title/index.js +0 -1
- package/build/types/body/Body.d.ts +0 -14
- package/build/types/body/Body.spec.d.ts +0 -1
- package/build/types/body/Body.story.d.ts +0 -8
- package/build/types/body/index.d.ts +0 -1
- package/build/types/common/propsValues/typography.d.ts +0 -27
- package/build/types/title/Title.d.ts +0 -14
- package/build/types/title/Title.spec.d.ts +0 -1
- package/build/types/title/Title.story.d.ts +0 -8
- package/build/types/title/index.d.ts +0 -1
|
@@ -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.object.to-string.js";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{Component}from"react";import CSSTransition from"react-transition-group/CSSTransition";import ActionButton from"../actionButton";import
|
|
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.object.to-string.js";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{Component}from"react";import CSSTransition from"react-transition-group/CSSTransition";import ActionButton from"../actionButton";import{Theme}from"../common";import{DirectionContext}from"../provider/direction";import withNextPortal from"../withNextPortal/withNextPortal";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var CSS_TRANSITION_DURATION=400;export var Snackbar=/*#__PURE__*/function(a){function b(){var a;return _classCallCheck(this,b),a=c.call(this),_defineProperty(_assertThisInitialized(a),"setLeaveTimeout",function(){var b=a.props.timeout;a.timeout=setTimeout(function(){a.setState({visible:!1})},b)}),a.state={visible:!1,text:""},a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout),clearTimeout(this.transitionTimeout)}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(a,b){return!!a.text&&(a.timestamp!==this.props.timestamp||b.visible!==this.state.visible||b.text!==this.state.text)}},{key:"componentDidUpdate",value:function componentDidUpdate(a){var b=this,c=this.props,d=c.action,e=c.text,f=c.theme,g=c.timestamp;a.text?a.timestamp!==g&&(clearTimeout(this.timeout),this.state.visible?this.setState({visible:!1},function(){b.transitionTimeout=setTimeout(function(){b.setState({visible:!0,action:d,text:e,theme:f}),b.setLeaveTimeout()},CSS_TRANSITION_DURATION)}):(this.setState({visible:!0,action:d,text:e,theme:f}),this.setLeaveTimeout())):this.setState({visible:!0,action:d,text:e,theme:f},function(){b.setLeaveTimeout()})}},{key:"render",value:function render(){var a=this.state,b=a.action,c=a.text,d=a.theme,e=a.visible,f=this.props.timeout;return/*#__PURE__*/_jsx("div",{className:"snackbar",children:/*#__PURE__*/_jsx(CSSTransition,{in:e,classNames:"snackbar__text-container",timeout:{appear:0,enter:f,exit:CSS_TRANSITION_DURATION},unmountOnExit:!0,children:/*#__PURE__*/_jsxs("span",{className:"snackbar__text snackbar__text--".concat(d),children:[c,b?/*#__PURE__*/_jsx(ActionButton,{className:"snackbar__text__action",onClick:b.onClick,children:b.label}):null]})})})}}]),b}(Component);Snackbar.contextType=DirectionContext,Snackbar.propTypes={action:PropTypes.shape({label:PropTypes.string.isRequired,onClick:PropTypes.func.isRequired}),text:PropTypes.node.isRequired,theme:PropTypes.oneOf(["light","dark"]),timeout:PropTypes.number.isRequired,timestamp:PropTypes.number.isRequired},Snackbar.defaultProps={action:null,theme:Theme.LIGHT};export default withNextPortal(Snackbar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.map.js";import classNames from"classnames";import PropTypes from"prop-types";import
|
|
1
|
+
import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.map.js";import classNames from"classnames";import PropTypes from"prop-types";import{Position}from"../common";import{useDirection}from"../common/hooks";import Tooltip from"../tooltip";import{isTouchDevice}from"./deviceDetection";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";function clamp(a,b,c){return Math.max(Math.min(b,c),a)}/* eslint-disable react/no-array-index-key */var Stepper=function(a){var b=a.steps,c=a.activeStep,d=a.className,e=useDirection(),f=e.isRTL;if(0===b.length)return null;var g=clamp(0,b.length-1,c),h=1/(b.length-1),i=g/(b.length-1),j=Math.max(i-h,0),k=Math.min(g,1)*h;return/*#__PURE__*/_jsxs("div",{className:classNames("tw-stepper",d),children:[/*#__PURE__*/_jsxs("div",{className:"progress",children:[/*#__PURE__*/_jsx("div",{className:"progress-bar-filler",style:{width:"".concat(100*j,"%")}}),/*#__PURE__*/_jsx("div",{className:"progress-bar-ending",style:{width:"".concat(100*k,"%")}})]}),/*#__PURE__*/_jsx("ul",{className:"tw-stepper-steps p-t-1 m-b-0",children:b.map(function renderStep(a,b){var c=b===g,d=a.onClick&&!c,e=d?/*#__PURE__*/_jsx("button",{type:"button",className:"btn-unstyled tw-stepper__step-label",onClick:function onClick(){return d&&a.onClick()},children:/*#__PURE__*/_jsx("small",{children:a.label})}):/*#__PURE__*/_jsx("small",{className:"tw-stepper__step-label",children:a.label});return/*#__PURE__*/_jsx("li",{className:"\n hidden-xs\n tw-stepper__step\n ".concat(c?"tw-stepper__step--active":"","\n ").concat(d?"tw-stepper__step--clickable":"","\n "),style:f?{right:"".concat(100*(b*h),"%")}:{left:"".concat(100*(b*h),"%")},children:a.hoverLabel&&!isTouchDevice()?/*#__PURE__*/_jsx(Tooltip,{position:Position.BOTTOM,label:a.hoverLabel,children:e}):e},b)})})]})};/* eslint-enable react/no-array-index-key */Stepper.propTypes={steps:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,onClick:PropTypes.func,hoverLabel:PropTypes.node})).isRequired,activeStep:PropTypes.number,className:PropTypes.string},Stepper.defaultProps={activeStep:0,className:void 0};export default Stepper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _statusLabels;import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import{CheckCircleFill as CheckCircleIcon,ClockFill as PendingCircleIcon}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{cloneElement}from"react";import{useIntl}from"react-intl";import requiredIf from"react-required-if";import
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _statusLabels;import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import{CheckCircleFill as CheckCircleIcon,ClockFill as PendingCircleIcon}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{cloneElement}from"react";import{useIntl}from"react-intl";import requiredIf from"react-required-if";import{Status,Size}from"../common";import Info from"../info";import{deprecated}from"../utilities";import messages from"./Summary.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var BadgeIcons={done:CheckCircleIcon,pending:PendingCircleIcon},statusLabels=(_statusLabels={},_defineProperty(_statusLabels,Status.NOT_DONE,"statusNotDone"),_defineProperty(_statusLabels,Status.DONE,"statusDone"),_defineProperty(_statusLabels,Status.PENDING,"statusPending"),_statusLabels),expiryDate=new Date("03-01-2021"),Summary=function(a){var b=a.action,c=a.as,d=a.className,e=a.content,f=a.description,g=void 0===f?e:f,h=a.help,i=a.icon,j=a.illustration,k=a.info,l=void 0===k?h:k,m=a.status,n=a.title,o=useIntl(),p=j;if(i){var q,r=null===i||void 0===i||null===(q=i.props)||void 0===q?void 0:q.size;p=24===r?i:/*#__PURE__*/cloneElement(i,{size:24})}var s=m&&BadgeIcons[m];return/*#__PURE__*/_jsxs(c,{className:classNames("np-summary d-flex align-items-start",d),"aria-label":m&&o.formatMessage(messages[statusLabels[m]]),children:[/*#__PURE__*/_jsxs("div",{className:"np-summary__icon",children:[p,s&&/*#__PURE__*/_jsx(s,{size:16,className:"np-summary-icon__".concat(m)})]}),/*#__PURE__*/_jsxs("div",{className:"np-summary__body m-l-2",children:[/*#__PURE__*/_jsxs("div",{className:"np-summary__title d-flex",children:[/*#__PURE__*/_jsx("strong",{children:n}),l&&/*#__PURE__*/_jsx(Info,{"aria-label":l["aria-label"],className:"m-l-1 hidden-xs",content:l.content,presentation:l.presentation,title:l.title,onClick:l.onClick})]}),g&&/*#__PURE__*/_jsx("div",{className:"np-summary__description",children:g}),b&&/*#__PURE__*/_jsx("a",{href:b.href,target:b.target,className:"np-summary__action","aria-label":b["aria-label"],onClick:b.onClick,children:b.text})]}),l&&/*#__PURE__*/_jsx(Info,{"aria-label":l["aria-label"],className:"m-l-2 hidden-sm hidden-md hidden-lg hidden-xl",content:l.content,presentation:l.presentation,size:Size.LARGE,title:l.title,onClick:l.onClick})]})};Summary.propTypes={/** Action displayed at the bottom of the Summary */action:PropTypes.shape({text:PropTypes.node.isRequired,href:PropTypes.string.isRequired,"aria-label":PropTypes.string,target:PropTypes.string,onClick:PropTypes.func}),/** Decides which html element should wrap the Summary */as:PropTypes.string,/** Extra classes applied to Summary */className:PropTypes.string,/** @deprecated please use description instead */content:deprecated(PropTypes.node,{component:"Summary",newProp:"description",expiryDate:expiryDate}),/** Summary description */description:PropTypes.node,/** @deprecated please use info instead */help:deprecated(PropTypes.shape({content:PropTypes.node.isRequired,title:PropTypes.node}),{component:"Summary",newProp:"info",expiryDate:expiryDate}),/** Infos displayed on help Icon click inside Popover or Modal */info:PropTypes.shape({"aria-label":PropTypes.string.isRequired,content:PropTypes.node.isRequired,onClick:PropTypes.func,presentation:PropTypes.oneOf(["POPOVER","MODAL"]),title:PropTypes.node}),/** @deprecated please use icon instead */illustration:deprecated(PropTypes.node,{component:"Summary",newProp:"icon",expiryDate:expiryDate}),/** Main Summary Icon */icon:requiredIf(PropTypes.node,function(a){var b=a.illustration;return!b}),/** Decides the badge applied to Icon */status:PropTypes.oneOf(["notDone","done","pending"]),/** Summary title */title:PropTypes.node.isRequired},Summary.defaultProps={action:null,as:"div",className:null,content:null,help:null,illustration:null,status:null};export default Summary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import classNames from"classnames";import PropTypes from"prop-types";import{forwardRef,useEffect,useRef}from"react";import{jsx as _jsx}from"react/jsx-runtime";var Tab=/*#__PURE__*/forwardRef(function(a,b){var c=a.children,d=a.id,e=a.disabled,f=a.panelId,g=a.selected,h=a.onKeyDown,i=a.onClick,j=a.style,k=a.focusTab,l=useRef(!0),m=function(){return l.current?void(l.current=!1):void(g&&k&&k())};return useEffect(function(){m()},[g]),/*#__PURE__*/_jsx("li",{ref:b,className:classNames("tabs__tab",
|
|
1
|
+
import classNames from"classnames";import PropTypes from"prop-types";import{forwardRef,useEffect,useRef}from"react";import{jsx as _jsx}from"react/jsx-runtime";var Tab=/*#__PURE__*/forwardRef(function(a,b){var c=a.children,d=a.id,e=a.disabled,f=a.panelId,g=a.selected,h=a.onKeyDown,i=a.onClick,j=a.style,k=a.focusTab,l=useRef(!0),m=function(){return l.current?void(l.current=!1):void(g&&k&&k())};return useEffect(function(){m()},[g]),/*#__PURE__*/_jsx("li",{ref:b,className:classNames("tabs__tab",{"tabs__tab--selected":g,disabled:e}),role:"tab",id:d,"aria-selected":g?"true":"false","aria-disabled":e?"true":"false","aria-controls":e?null:f,tabIndex:"0",style:j,onKeyDown:e?null:h,onClick:i,children:c})});Tab.defaultProps={disabled:!1,selected:!1,onClick:null,style:null,focusTab:null},Tab.propTypes={children:PropTypes.node.isRequired,disabled:PropTypes.bool,selected:PropTypes.bool,id:PropTypes.string.isRequired,panelId:PropTypes.string.isRequired,onKeyDown:PropTypes.func.isRequired,onClick:PropTypes.func,style:PropTypes.shape({width:PropTypes.string}),focusTab:PropTypes.func};export default Tab;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import classNames from"classnames";import PropTypes from"prop-types";import
|
|
1
|
+
import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import classNames from"classnames";import PropTypes from"prop-types";import{Size,Key}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var Tile=function(a){var b=a.className,c=a.description,d=a.disabled,e=a.href,f=a.target,g=a.media,h=a.onClick,i=a.size,j=a.title,k=i===Size.SMALL;return/*#__PURE__*/_jsxs("a",{className:classNames("decision","flex-column","np-tile","text-no-decoration","text-xs-center",b,{"p-y-5 p-x-4":!k,"np-tile--small p-a-2":k,disabled:d}),href:e,target:f,"aria-label":j,onClick:d?null:h,onKeyDown:d?null:function(a){var b=a.key;(b===Key.ENTER||Key.SPACE.includes(b))&&h()},children:[/*#__PURE__*/_jsx("div",{className:"np-tile__media d-flex justify-content-center",children:g}),/*#__PURE__*/_jsx("div",{className:"np-tile__title",children:j}),c&&/*#__PURE__*/_jsx("div",{className:"np-tile__description",children:c})]})};Tile.propTypes={/** Classes to apply to the Tile container */className:PropTypes.string,description:PropTypes.node,disabled:PropTypes.bool,href:PropTypes.string.isRequired,target:PropTypes.oneOf(["_self","_blank","_parent","_top"]),/** Accepts only Avatar and images */media:PropTypes.node.isRequired,/** Function called onClick or onKeyDown */onClick:PropTypes.func.isRequired,/** The size applied to Tile */size:PropTypes.oneOf(["sm","md"]),title:PropTypes.node.isRequired},Tile.defaultProps={className:"",description:null,disabled:!1,size:Size.MEDIUM,target:void 0};export default Tile;
|
|
@@ -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 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:"
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";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";var _UPLOAD_STEP_COMPONEN;import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import _regeneratorRuntime from"@babel/runtime/regenerator";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{Plus as PlusIcon}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{Component}from"react";import{injectIntl}from"react-intl";import{Status
|
|
1
|
+
import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";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";var _UPLOAD_STEP_COMPONEN;import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import _regeneratorRuntime from"@babel/runtime/regenerator";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{Plus as PlusIcon}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{Component}from"react";import{injectIntl}from"react-intl";import{Status}from"../common";import messages from"./Upload.messages";import{UploadImageStep,MediaUploadStep,ProcessingStep,CompleteStep}from"./steps";import{UploadStep}from"./uploadSteps";import{postData,asyncFileRead,isSizeValid,isTypeValid,getFileType}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var PROCESS_STATE=["error","success"],ANIMATION_FIX=10,MAX_SIZE_DEFAULT=5e6,UPLOAD_STEP_COMPONENTS=(_UPLOAD_STEP_COMPONEN={},_defineProperty(_UPLOAD_STEP_COMPONEN,UploadStep.UPLOAD_IMAGE_STEP,UploadImageStep),_defineProperty(_UPLOAD_STEP_COMPONEN,UploadStep.MEDIA_UPLOAD_STEP,MediaUploadStep),_UPLOAD_STEP_COMPONEN),Upload=/*#__PURE__*/function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"onAnimationCompleted",/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function b(a){var c,e,f,g,h,i,j;return _regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:c=d.state,e=c.response,f=c.isProcessing,g=c.fileName,h=d.props.animationDelay,f&&a===Status.SUCCEEDED&&(i=d.props.onSuccess,d.timeouts=setTimeout(function(){d.setState({isProcessing:!1,isComplete:!0},function(){return i?i(e,g):{}})},h)),f&&a===Status.FAILED&&(j=d.props.onFailure,d.timeouts=setTimeout(function(){d.setState({isProcessing:!1,isComplete:!0},function(){return j?j(e):{}})},h));case 4:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}()),_defineProperty(_assertThisInitialized(d),"asyncPost",function(a){var b=d.props,c=b.httpOptions,e=b.fetcher,f=c||{},g=f.fileInputName,h=void 0===g?a.name:g,i=f.data,j=void 0===i?{}:i,k=new FormData;return k.append(h,a),Object.keys(j).forEach(function(a){return k.append(a,j[a])}),postData(d.prepareHttpOptions(c),k,e)}),_defineProperty(_assertThisInitialized(d),"asyncResponse",function(a,b){d.timeouts=setTimeout(function(){d.setState({response:a,isError:b===PROCESS_STATE[0],isSuccess:b===PROCESS_STATE[1]})},ANIMATION_FIX)}),_defineProperty(_assertThisInitialized(d),"prepareHttpOptions",function(a){if(!a.url)throw new Error("You must supply a URL to post image data asynchronously");return a}),_defineProperty(_assertThisInitialized(d),"handleOnClear",function(a){a.preventDefault();var b=d.props.onCancel;b&&b(),d.reset()}),_defineProperty(_assertThisInitialized(d),"reset",function(){d.dragCounter=0,clearTimeout(d.timeouts),d.setState({isComplete:!1,isError:!1,isProcessing:!1,isSuccess:!1})}),_defineProperty(_assertThisInitialized(d),"showDataImage",function(a){var b=d.state.isImage;b&&d.setState({uploadedImage:a})}),_defineProperty(_assertThisInitialized(d),"fileDropped",/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function b(a){var c,e,f,g,h,i,j,k,l,m;return _regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=d.props,e=c.httpOptions,f=c.maxSize,g=c.onStart,h=c.usDisabled,i=c.usAccept,j=d.state.isProcessing,!(h||j)){b.next=4;break}return b.abrupt("return",!1);case 4:if(a){b.next=6;break}throw new Error("Could not retrieve file");case 6:return d.setState({fileName:a.name,isDroppable:!1,isProcessing:!0}),g&&g(a),k=null,b.prev=9,b.next=12,asyncFileRead(a);case 12:k=b.sent,b.next=18;break;case 15:b.prev=15,b.t0=b["catch"](9),d.asyncResponse(b.t0,PROCESS_STATE[0]);case 18:if(k){b.next=20;break}return b.abrupt("return",!1);case 20:if(d.setState({isImage:getFileType(a,k).includes("image")}),isTypeValid(a,i,k)){b.next=25;break}return l={status:415,statusText:"Unsupported Media Type"},d.asyncResponse(l,PROCESS_STATE[0]),b.abrupt("return",!1);case 25:if(isSizeValid(a,f)){b.next=29;break}return m={status:413,statusText:"Request Entity Too Large"},d.asyncResponse(m,PROCESS_STATE[0]),b.abrupt("return",!1);case 29:if(!e){b.next=33;break}return b.next=32,d.asyncPost(a).then(function(a){return d.asyncResponse(a,"success")}).then(function(){return d.showDataImage(k),!0}).catch(function(a){return d.asyncResponse(a,PROCESS_STATE[0]),!1});case 32:return b.abrupt("return",b.sent);case 33:return d.showDataImage(k),d.asyncResponse(k,"success"),b.abrupt("return",!0);case 36:case"end":return b.stop();}},b,null,[[9,15]])}));return function(){return a.apply(this,arguments)}}()),d.dragCounter=0,d.timeouts=null,d.state={fileName:"",isComplete:!1,isError:!1,isImage:!1,isProcessing:!1,isSuccess:!1,response:null,uploadedImage:null},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"getErrorMessage",value:function getErrorMessage(a){return 413===a?this.props.csTooLargeMessage||this.props.intl.formatMessage(messages.csTooLargeMessage):415===a?this.props.csWrongTypeMessage||this.props.intl.formatMessage(messages.csWrongTypeMessage):this.props.csFailureText||this.props.intl.formatMessage(messages.csFailureText)}},{key:"onDragLeave",value:function onDragLeave(a){a.preventDefault(),this.dragCounter-=1,0===this.dragCounter&&this.setState({isDroppable:!1})}},{key:"onDragEnter",value:function onDragEnter(a){a.preventDefault(),this.dragCounter+=1;var b=this.props.usDisabled,c=this.state.isProcessing;1!==this.dragCounter||b||c||this.setState({isDroppable:!0})}},{key:"onDrop",value:function onDrop(a){var b=this.state.isProcessing;a.preventDefault(),b||this.reset(),a.dataTransfer&&a.dataTransfer.files&&a.dataTransfer.files[0]&&this.fileDropped(a.dataTransfer.files[0])}},{key:"render",value:function render(){var a=this,b=this.props,c=b.usDropMessage,d=b.usAccept,e=b.usButtonText,f=b.usDisabled,g=b.usHelpImage,h=b.usLabel,i=b.usPlaceholder,j=b.psButtonText,k=b.psProcessingText,l=b.csButtonText,m=b.csSuccessText,n=b.size,o=b.uploadStep,p=b.intl,q=this.state,r=q.response,s=q.fileName,t=q.isComplete,u=q.isDroppable,v=q.isError,w=q.isImage,x=q.isProcessing,y=q.isSuccess,z=q.uploadedImage,A=UPLOAD_STEP_COMPONENTS[o]||UploadImageStep;return/*#__PURE__*/_jsxs("div",{className:classNames({droppable:!0,"tw-droppable-sm droppable-sm":"sm"===n,"tw-droppable-md droppable-md":"md"===n||!n,"tw-droppable-lg droppable-lg":"lg"===n,"droppable-dropping":u,"droppable-processing":x,"droppable-complete":t}),onDragEnter:function onDragEnter(b){return a.onDragEnter(b)},onDragLeave:function onDragLeave(b){return a.onDragLeave(b)},onDrop:function onDrop(b){return a.onDrop(b)},onDragOver:function onDragOver(a){return a.preventDefault()},children:[!x&&!t&&/*#__PURE__*/_jsx(A,{fileDropped:function fileDropped(b){return a.fileDropped(b)},isComplete:t,usAccept:d,usButtonText:e||p.formatMessage(messages.usButtonText),usDisabled:f,usHelpImage:g,usLabel:h,usPlaceholder:i||p.formatMessage(messages.usPlaceholder)}),x&&/*#__PURE__*/_jsx(ProcessingStep,{isComplete:t,isError:v,isSuccess:y,psButtonText:j||p.formatMessage(messages.psButtonText),psProcessingText:k||p.formatMessage(messages.psProcessingText),onAnimationCompleted:function onAnimationCompleted(b){return a.onAnimationCompleted(b)},onClear:function onClear(b){return a.handleOnClear(b)}}),(y||v||t)&&/*#__PURE__*/_jsx(CompleteStep,{fileName:s,isComplete:t,isError:v,isImage:w,csButtonText:l||p.formatMessage(messages.csButtonText),csFailureText:this.getErrorMessage(null===r||void 0===r?void 0:r.status),csSuccessText:m||p.formatMessage(messages.csSuccessText),uploadedImage:z,onClear:function onClear(b){return a.handleOnClear(b)}}),!x&&/*#__PURE__*/_jsx("div",{className:"droppable-dropping-card droppable-card",children:/*#__PURE__*/_jsxs("div",{className:"droppable-card-content",children:[/*#__PURE__*/_jsx("div",{className:"circle circle-sm p-t-1 text-primary",children:/*#__PURE__*/_jsx(PlusIcon,{})}),/*#__PURE__*/_jsx("h4",{className:"m-t-3",children:c||p.formatMessage(messages.usDropMessage)})]})})]})}}]),b}(Component);/*
|
|
2
2
|
* This delay is required for the isError/isSuccess to be fired after isProcessing so the processIndicator, will be
|
|
3
3
|
* rendered first and then updated with the right status.
|
|
4
4
|
*/Upload.propTypes={animationDelay:PropTypes.number,csButtonText:PropTypes.string,csFailureText:PropTypes.string,csSuccessText:PropTypes.string,csTooLargeMessage:PropTypes.string,csWrongTypeMessage:PropTypes.string,httpOptions:PropTypes.shape({url:PropTypes.string.isRequired,method:PropTypes.oneOf(["POST","PUT","PATCH"]),fileInputName:PropTypes.string,data:PropTypes.object,headers:PropTypes.object}),/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AlertCircle as AlertCircleIcon,Document as DocumentIcon}from"@transferwise/icons";import PropTypes from"prop-types";import{Priority,
|
|
1
|
+
import{AlertCircle as AlertCircleIcon,Document as DocumentIcon}from"@transferwise/icons";import PropTypes from"prop-types";import{Priority,Size}from"../../..";import Button from"../../../button";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 CompleteStep=function(a){var b=a.csButtonText,c=a.csFailureText,d=a.csSuccessText,e=a.fileName,f=a.isComplete,g=a.isError,h=a.isImage,i=a.onClear,j=a.uploadedImage;return/*#__PURE__*/_jsx("div",{className:"droppable-complete-card droppable-card","aria-hidden":!f,children:/*#__PURE__*/_jsxs("div",{className:"droppable-card-content",children:[/*#__PURE__*/_jsx("div",{className:"droppable-card-content d-flex flex-column align-items-center",children:g?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(AlertCircleIcon,{size:24,className:"text-negative"}),c&&/*#__PURE__*/_jsx("p",{className:"m-t-2",children:c})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[h&&j?/*#__PURE__*/_jsx("img",{src:j,alt:"OK",className:"thumbnail "}):/*#__PURE__*/_jsx(DocumentIcon,{}),e&&/*#__PURE__*/_jsx("p",{className:"m-b-0",children:/*#__PURE__*/_jsx("small",{children:e})}),d&&/*#__PURE__*/_jsx("div",{className:"caption m-t-1",children:/*#__PURE__*/_jsx("span",{className:"h4",children:d})})]})}),b&&/*#__PURE__*/_jsx(Button,{size:Size.SMALL,priority:Priority.SECONDARY,className:"m-t-3",onClick:function onClick(a){return i(a)},children:b})]})})};CompleteStep.propTypes={csButtonText:PropTypes.string.isRequired,csSuccessText:PropTypes.string.isRequired,csFailureText:PropTypes.string.isRequired,fileName:PropTypes.string.isRequired,isComplete:PropTypes.bool.isRequired,isError:PropTypes.bool.isRequired,isImage:PropTypes.bool.isRequired,onClear:PropTypes.func.isRequired,uploadedImage:PropTypes.string},CompleteStep.defaultProps={uploadedImage:null};export default CompleteStep;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Upload as UploadIcon}from"@transferwise/icons";import
|
|
1
|
+
import{Upload as UploadIcon}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{getSupportedSpotMimeTypes,requestMedia}from"../../utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MediaUploadStep=function(a){var b=a.isComplete,c=a.usAccept,d=a.usButtonText,e=a.usDisabled,f=a.usHelpImage,g=a.usLabel,h=a.usPlaceholder,i=a.fileDropped;return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("div",{className:"droppable-default-card","aria-hidden":b,children:/*#__PURE__*/_jsxs("div",{className:"droppable-card-content",children:[/*#__PURE__*/_jsx("div",{className:"m-b-3",children:function getImage(){return f?"string"==typeof f?/*#__PURE__*/_jsx("img",{src:f,alt:g,className:"thumbnail text-xs-center"}):f:/*#__PURE__*/_jsx("div",{className:"circle circle-sm circle-inverse p-t-1",children:/*#__PURE__*/_jsx(UploadIcon,{size:24})})}()}),g&&/*#__PURE__*/_jsx("h4",{className:"m-b-1",children:g}),h&&/*#__PURE__*/_jsx("p",{className:"m-b-3",children:"".concat(h)}),/*#__PURE__*/_jsx("button",{type:"button",className:classNames("btn btn-primary btn-sm",{disabled:e}),disabled:e,onClick:function getMediaFile(){var a=getSupportedSpotMimeTypes(c);if(0===a.length)throw new Error("provided mimeTypes not supported");requestMedia({allowedMimeTypes:a}).then(function(a){return i(a)})},children:d||/*#__PURE__*/_jsx(UploadIcon,{size:24,className:"m-r-0"})})]})})})};MediaUploadStep.propTypes={fileDropped:PropTypes.func.isRequired,isComplete:PropTypes.bool.isRequired,usAccept:PropTypes.string.isRequired,usButtonText:PropTypes.string.isRequired,usDisabled:PropTypes.bool.isRequired,usHelpImage:PropTypes.node.isRequired,usLabel:PropTypes.string.isRequired,usPlaceholder:PropTypes.string.isRequired};export default MediaUploadStep;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import Button from"../../../button";import{Status,Size
|
|
1
|
+
import PropTypes from"prop-types";import Button from"../../../button";import{Status,Size}from"../../../common";import ProcessIndicator from"../../../processIndicator";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ProcessingStep=function(a){var b=a.isComplete,c=a.isError,d=a.isSuccess,e=a.onAnimationCompleted,f=a.onClear,g=a.psButtonText,h=a.psProcessingText,i=Status.PROCESSING;return c&&(i=Status.FAILED),d&&(i=Status.SUCCEEDED),/*#__PURE__*/_jsx("div",{className:"droppable-processing-card droppable-card","aria-hidden":b,children:/*#__PURE__*/_jsxs("div",{className:"droppable-card-content",children:[/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.Small,status:i,onAnimationCompleted:function onAnimationCompleted(a){return e(a)}}),/*#__PURE__*/_jsx("h4",{className:"m-t-3 m-b-3",children:h}),g&&/*#__PURE__*/_jsx(Button,{size:Size.SMALL,onClick:function onClick(a){return f(a)},children:g})]})})};ProcessingStep.propTypes={isComplete:PropTypes.bool.isRequired,isError:PropTypes.bool.isRequired,isSuccess:PropTypes.bool.isRequired,onAnimationCompleted:PropTypes.func.isRequired,onClear:PropTypes.func.isRequired,psButtonText:PropTypes.string.isRequired,psProcessingText:PropTypes.string.isRequired};export default ProcessingStep;
|
|
@@ -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.object.to-string.js";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{Upload as UploadIcon}from"@transferwise/icons";import PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var UploadImageStep=/*#__PURE__*/function(a){function b(){var a;return _classCallCheck(this,b),a=c.call(this),_defineProperty(_assertThisInitialized(a),"onManualUpload",function(){var b=a.props.fileDropped;if(a.uploadInputRef&&a.uploadInputRef.current){var c=a.uploadInputRef.current.files[0];b(c)}}),_defineProperty(_assertThisInitialized(a),"getImage",function(){var b=a.props,c=b.usHelpImage,d=b.usLabel;return c?"string"==typeof c?/*#__PURE__*/_jsx("img",{src:c,alt:d,className:"thumbnail text-xs-center"}):c:/*#__PURE__*/_jsx("div",{className:"circle circle-sm circle-inverse p-t-1",children:/*#__PURE__*/_jsx(UploadIcon,{size:24})})}),a.uploadInputRef=/*#__PURE__*/createRef(),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this,b=this.props,c=b.isComplete,d=b.usAccept,e=b.usButtonText,f=b.usDisabled,g=b.usLabel,h=b.usPlaceholder;return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("div",{className:"droppable-default-card","aria-hidden":c,children:/*#__PURE__*/_jsxs("div",{className:"droppable-card-content",children:[/*#__PURE__*/_jsx("div",{className:"m-b-3",children:this.getImage()}),g&&/*#__PURE__*/_jsx("h4",{className:"
|
|
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.object.to-string.js";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{Upload as UploadIcon}from"@transferwise/icons";import PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var UploadImageStep=/*#__PURE__*/function(a){function b(){var a;return _classCallCheck(this,b),a=c.call(this),_defineProperty(_assertThisInitialized(a),"onManualUpload",function(){var b=a.props.fileDropped;if(a.uploadInputRef&&a.uploadInputRef.current){var c=a.uploadInputRef.current.files[0];b(c)}}),_defineProperty(_assertThisInitialized(a),"getImage",function(){var b=a.props,c=b.usHelpImage,d=b.usLabel;return c?"string"==typeof c?/*#__PURE__*/_jsx("img",{src:c,alt:d,className:"thumbnail text-xs-center"}):c:/*#__PURE__*/_jsx("div",{className:"circle circle-sm circle-inverse p-t-1",children:/*#__PURE__*/_jsx(UploadIcon,{size:24})})}),a.uploadInputRef=/*#__PURE__*/createRef(),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this,b=this.props,c=b.isComplete,d=b.usAccept,e=b.usButtonText,f=b.usDisabled,g=b.usLabel,h=b.usPlaceholder;return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("div",{className:"droppable-default-card","aria-hidden":c,children:/*#__PURE__*/_jsxs("div",{className:"droppable-card-content",children:[/*#__PURE__*/_jsx("div",{className:"m-b-3",children:this.getImage()}),g&&/*#__PURE__*/_jsx("h4",{className:"m-b-1",children:g}),h&&/*#__PURE__*/_jsx("p",{className:"m-b-3",children:"".concat(h)}),/*#__PURE__*/_jsxs("label",{className:"btn btn-primary btn-sm ".concat(f?"disabled":""),children:[e?/*#__PURE__*/_jsx("span",{children:e}):/*#__PURE__*/_jsx(UploadIcon,{size:24,className:"m-r-0"}),/*#__PURE__*/_jsx("input",{ref:this.uploadInputRef,type:"file",accept:"*"===d?null:d,className:"tw-droppable-input hidden",disabled:f,name:"file-upload",onChange:function onChange(){return a.onManualUpload()}})]})]})})})}}]),b}(PureComponent);UploadImageStep.propTypes={fileDropped:PropTypes.func.isRequired,isComplete:PropTypes.bool.isRequired,usAccept:PropTypes.string.isRequired,usButtonText:PropTypes.string.isRequired,usDisabled:PropTypes.bool.isRequired,usHelpImage:PropTypes.node.isRequired,usLabel:PropTypes.string.isRequired,usPlaceholder:PropTypes.string.isRequired};export default UploadImageStep;
|
|
@@ -1 +1 @@
|
|
|
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"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";import{PlusCircle as PlusIcon,Upload as UploadIcon}from"@transferwise/icons";import classNames from"classnames";import{useRef,useState}from"react";import{useIntl}from"react-intl";import
|
|
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"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";import{PlusCircle as PlusIcon,Upload as UploadIcon}from"@transferwise/icons";import classNames from"classnames";import{useRef,useState}from"react";import{useIntl}from"react-intl";import{useDirection}from"../../common/hooks";import MESSAGES from"./UploadButton.messages";import{DEFAULT_SIZE_LIMIT,imageFileTypes}from"./defaults";import getAllowedFileTypes from"./getAllowedFileTypes";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var TEST_IDS;(function(a){a.uploadInput="uploadInput",a.mediaBody="mediaBody"})(TEST_IDS||(TEST_IDS={}));var onDragOver=function(a){a.preventDefault()},DEFAULT_FILE_INPUT_ID="np-upload-button",UploadButton=function(a){function b(){if(e)return e;var a=z(),b="*"===a?r(MESSAGES.allFileTypes):a;return r(MESSAGES.instructions,{fileTypes:b,size:Math.round(i/1e3)})}var c=a.disabled,d=a.multiple,e=a.description,f=a.fileTypes,g=void 0===f?imageFileTypes:f,h=a.sizeLimit,i=void 0===h?DEFAULT_SIZE_LIMIT:h,j=a.maxFiles,k=a.onChange,l=a.id,m=void 0===l?DEFAULT_FILE_INPUT_ID:l,n=a.uploadButtonTitle,o=useDirection(),p=o.isRTL,q=useIntl(),r=q.formatMessage,s=useRef(null),t=useState(!1),u=_slicedToArray(t,2),v=u[0],w=u[1],x=useRef(0),y=function(){x.current=0,w(!1)},z=function(){return"*"===g?g:Array.isArray(g)?getAllowedFileTypes(g).join(", "):getAllowedFileTypes([g]).join(", ")};return/*#__PURE__*/_jsxs("div",_objectSpread(_objectSpread({className:classNames("np-upload-button-container","droppable",{"droppable-dropping":v})},!c&&{onDragEnter:function onDragEnter(a){a.preventDefault(),x.current+=1,1===x.current&&w(!0)},onDragLeave:function onDragLeave(a){a.preventDefault(),x.current-=1,0===x.current&&w(!1)},onDrop:function onDrop(a){a.preventDefault(),y(),a.dataTransfer&&a.dataTransfer.files&&a.dataTransfer.files[0]&&k(a.dataTransfer.files)},onDragOver:onDragOver}),{},{children:[/*#__PURE__*/_jsx("input",_objectSpread(_objectSpread(_objectSpread({ref:s,id:m,type:"file"},function(){var a="*"===z();return a?null:Array.isArray(g)?{accept:g.join(",")}:{accept:g}}()),d&&{multiple:!0}),{},{className:"tw-droppable-input",disabled:c,name:"file-upload","data-testid":TEST_IDS.uploadInput,onChange:function filesSelected(a){var b=a.target.files;b&&(k(b),s.current&&(s.current.value=""))}})),/*#__PURE__*/_jsx("label",{htmlFor:m,className:classNames("btn","np-upload-accent","np-upload-button",{disabled:c}),children:/*#__PURE__*/_jsxs("div",{className:"media",children:[/*#__PURE__*/_jsx("div",{className:"np-upload-icon media-left",children:/*#__PURE__*/_jsx(UploadIcon,{size:24,className:"text-link"})}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx("div",{children:function(){return n?n:r(d?MESSAGES.uploadFiles:MESSAGES.uploadFile)}()}),function(){return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsxs("small",{className:classNames("np-upload-description",{"text-primary":!c}),children:[b(),j&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("br",{}),"Maximum ".concat(j," files.")]})]})})}()]})]})}),v&&/*#__PURE__*/_jsxs("div",{className:"droppable-card droppable-dropping-card droppable-card-content",children:[/*#__PURE__*/_jsx(PlusIcon,{className:"text-info m-x-1",size:24}),/*#__PURE__*/_jsx("div",{className:"text-info",children:r(MESSAGES.dropFile)})]})]}))};export default UploadButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _typeof from"@babel/runtime/helpers/typeof";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import{AlertCircle,CrossCircleFill}from"@transferwise/icons";import classNames from"classnames";import{useIntl}from"react-intl";import
|
|
2
|
-
}()}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx(
|
|
1
|
+
import _typeof from"@babel/runtime/helpers/typeof";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import{AlertCircle,CrossCircleFill}from"@transferwise/icons";import classNames from"classnames";import{useIntl}from"react-intl";import{Size,Status}from"../../common";import ProcessIndicator from"../../processIndicator/ProcessIndicator";import MESSAGES from"./UploadItem.messages";import{UploadItemBody}from"./UploadItemBody";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var TEST_IDS;(function(a){a.uploadItem="uploadItem",a.mediaBody="mediaBody"})(TEST_IDS||(TEST_IDS={}));var UploadItem=function(a){var b=a.file,c=a.canDelete,d=a.onDelete,e=a.onDownload,f=useIntl(),g=f.formatMessage,h=b.status,i=b.filename,j=b.error,k=b.url,l=[Status.SUCCEEDED,void 0].includes(h)&&!!k,m=function(){return"object"===_typeof(j)&&j.message||j||g(MESSAGES.uploadingFailed)};return/*#__PURE__*/_jsx("div",{className:classNames("np-upload-item",{"np-upload-item__link":l}),"data-testid":TEST_IDS.uploadItem,children:/*#__PURE__*/_jsxs("div",{className:"np-upload-item__body",children:[/*#__PURE__*/_jsx(UploadItemBody,{url:l?k:void 0,onDownload:function onDownloadFile(a){e&&(a.preventDefault(),e(b))},children:/*#__PURE__*/_jsx("div",{className:"np-upload-button",children:/*#__PURE__*/_jsxs("div",{className:"media",children:[/*#__PURE__*/_jsx("div",{className:"np-upload-icon media-left",children:function getIcon(){if(j||h===Status.FAILED)return/*#__PURE__*/_jsx(AlertCircle,{size:24,className:"text-negative"});var a;switch(h){case Status.PROCESSING:case Status.PENDING:a=/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.EXTRA_SMALL,status:Status.PROCESSING});break;case Status.SUCCEEDED:case Status.DONE:default:a=/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.EXTRA_SMALL,status:Status.SUCCEEDED});}return/*#__PURE__*/_jsx("span",{style:{transform:"scale(0.8335)"},children:a});// Scale down ProcessIndicator to be 20px*20px to match `icons`
|
|
2
|
+
}()}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx("div",{className:"text-word-break text-primary",children:function getTitle(){return i||g(MESSAGES.uploadedFile)}()}),/*#__PURE__*/_jsx("small",{className:"np-upload-description text-primary",children:function getDescription(){if(j||h===Status.FAILED)return/*#__PURE__*/_jsx("span",{className:"text-negative",children:m()});switch(h){case Status.PENDING:return/*#__PURE__*/_jsx("span",{children:g(MESSAGES.uploading)});case Status.PROCESSING:return/*#__PURE__*/_jsx("span",{children:g(MESSAGES.deleting)});case Status.SUCCEEDED:case Status.DONE:default:return/*#__PURE__*/_jsx("span",{className:"text-positive",children:g(MESSAGES.uploaded)});}}()})]})]})})}),c&&/*#__PURE__*/_jsx("button",{"aria-label":g(MESSAGES.removeFile,{filename:i}),className:"btn np-upload-item__remove-button media-left",type:"button",onClick:function onClick(){return d()},children:/*#__PURE__*/_jsx(CrossCircleFill,{size:16})})]})})};export default UploadItem;
|