@transferwise/components 45.9.3 → 45.9.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/build/es/no-polyfill/avatar/Avatar.js +1 -1
- package/build/es/no-polyfill/dateInput/DateInput.js +1 -1
- package/build/es/polyfill/avatar/Avatar.js +1 -1
- package/build/es/polyfill/dateInput/DateInput.js +1 -1
- package/build/main.css +1 -1
- package/build/styles/avatar/Avatar.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/modal/Modal.css +1 -1
- package/build/umd/no-polyfill/main.js +1 -1
- package/build/umd/polyfill/main.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import classnames from"classnames";import{useMemo}from"react";import{Theme}from"../common";import{getAvatarColorFromSeed}from"./colors";import{jsx as _jsx}from"react/jsx-runtime";var backwardsCompatibleSize=function(a){return"sm"===a?24:"md"===a?48:"lg"===a?72:a},Avatar=function(a){var b=a.backgroundColor,c=void 0===b?null:b,d=a.backgroundColorSeed,e=void 0===d?null:d,f=a.children,g=void 0===f?null:f,h=a.className,i=void 0===h?null:h,j=a.outlined,k=a.size,l=void 0===k?48:k,m=a.theme,n=void 0===m?Theme.LIGHT:m,o=a.type,p=void 0===o?"thumbnail":o,q=useMemo(function(){return!c&&e?"var(".concat(getAvatarColorFromSeed(e),")"):void 0},[c,e]),r=backwardsCompatibleSize(l);return/*#__PURE__*/_jsx("div",{className:classnames("tw-avatar",i,"tw-avatar--".concat(r),"tw-avatar--".concat(p),{"tw-avatar--outlined":void 0!==j&&j,"tw-avatar--branded":!!q,"np-text-title-body":"initials"===p}),children:/*#__PURE__*/_jsx("div",{className:"tw-avatar__content",style:{backgroundColor:c||q},children:g})})};export default Avatar;
|
|
1
|
+
import classnames from"classnames";import{useMemo}from"react";import{Theme}from"../common";import{getAvatarColorFromSeed}from"./colors";import{jsx as _jsx}from"react/jsx-runtime";var backwardsCompatibleSize=function(a){return"sm"===a?24:"md"===a?48:"lg"===a?72:a},Avatar=function(a){var b=a.backgroundColor,c=void 0===b?null:b,d=a.backgroundColorSeed,e=void 0===d?null:d,f=a.children,g=void 0===f?null:f,h=a.className,i=void 0===h?null:h,j=a.outlined,k=a.size,l=void 0===k?48:k,m=a.theme,n=void 0===m?Theme.LIGHT:m,o=a.type,p=void 0===o?"thumbnail":o,q=useMemo(function(){return!c&&e?"var(".concat(getAvatarColorFromSeed(e),")"):void 0},[c,e]),r=backwardsCompatibleSize(l);return/*#__PURE__*/_jsx("div",{className:classnames("tw-avatar",i,"tw-avatar--".concat(r),"tw-avatar--".concat(p),{"tw-avatar--outlined":void 0!==j&&j,"tw-avatar--custom-background":"icon"===p&&!!(c||q),"tw-avatar--branded":!!q,"np-text-title-body":"initials"===p}),children:/*#__PURE__*/_jsx("div",{className:"tw-avatar__content",style:{backgroundColor:c||q},children:g})})};export default Avatar;
|
|
@@ -1,4 +1,4 @@
|
|
|
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 classNames from"classnames";import PropTypes from"prop-types";import{useState}from"react";import{useIntl}from"react-intl";import{Select,Input}from"..";import{Size,DateMode,MonthFormat}from"../common";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import messages from"./DateInput.messages";import{explodeDate,convertToLocalMidnight}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=new Set(["en-US","ja-JP"]),INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b,c,d,e=a.disabled,f=a.size,g=a.value,h=a.dayLabel,i=a.monthLabel,j=a.yearLabel,k=a.monthFormat,l=a.mode,m=a.onChange,n=a.onFocus,o=a.onBlur,p=a.placeholders,q=a.id,r=a.selectProps,s=useIntl(),t=s.locale,u=s.formatMessage,v=function(){return g&&isDateValid(g)?"string"==typeof g?convertToLocalMidnight(g):g:null},w=function(a){var b=INITIAL_DEFAULT_STATE;if(g&&isDateValid(g)){var c=v();b=explodeDate(c),isMonthAndYearFormat(g)&&(b.day=null)}return b[a]},x=useState(function(){return w("day")}),y=_slicedToArray(x,2),z=y[0],A=y[1],B=useState(function(){return w("month")}),C=_slicedToArray(B,2),D=C[0],E=C[1],F=useState(function(){return w("year")}),G=_slicedToArray(F,2),H=G[0],I=G[1],J=useState(v),K=_slicedToArray(J,2),L=K[0],M=K[1];h=h||u(messages.dayLabel),i=i||u(messages.monthLabel),j=j||u(messages.yearLabel),p={day:(null===(b=p)||void 0===b?void 0:b.day)||"DD",month:(null===(c=p)||void 0===c?void 0:c.month)||u(messages.monthLabel),year:(null===(d=p)||void 0===d?void 0:d.year)||"YYYY"};var N=function(a){if(!isDateValid(a))return"";switch(l){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},O=function(){var a=getMonthNames(t,k);return/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:i}),/*#__PURE__*/_jsx(Select,_objectSpread({id:q?"".concat(q,"-select"):void 0,name:"month",disabled:e,placeholder:p.month,options:P(),size:f,selected:null===D?null:{value:D,label:a[D]},onChange:function(a){return S(a)}},r))]})},P=function(){var a=[],b=getMonthNames(t,k);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},Q=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:z,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:D,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:H,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||U(INITIAL_DEFAULT_STATE),l===DateMode.MONTH_YEAR?0<=b&&c&&(b!==D||c!==H)&&U(e):a&&0<=b&&c&&(a!==z||b!==D||c!==H)&&U(e)},R=function(a){var b=V(a.target.value,D,H),c=b.checkedDay;A(c),Q(c,D,H)},S=function(a){if(!a)return E(null),void Q(z,null,H);var b=a?a.value:0,c=V(z,b,H),d=c.checkedDay;E(b),z&&d!==z&&A(d),Q(d,b,H)},T=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
|
|
2
|
-
var d=V(z,D,b),e=d.checkedDay;z&&e!==z&&A(e),I(c),Q(e,D,c)}else I(c),Q(z,D,null)},U=function(a){a!==L&&(M(a),m(N(a)||null))},V=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},W=l===DateMode.MONTH_YEAR,X=classNames({"col-sm-8":W,"col-sm-5":!W}),Y=MonthBeforeDay.has(t);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),!W&&/*#__PURE__*/_jsx("div",{className:"col-sm-3",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"day",value:z||"",placeholder:p.day,disabled:e,onChange:function(a){return R(a)}})})]})}),!Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"year",placeholder:p.year,value:H||"",disabled:e,onChange:function(a){return T(a)}})})]})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
2
|
+
var d=V(z,D,b),e=d.checkedDay;z&&e!==z&&A(e),I(c),Q(e,D,c)}else I(c),Q(z,D,null)},U=function(a){a!==L&&(M(a),m(N(a)||null))},V=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},W=l===DateMode.MONTH_YEAR,X=classNames({"col-sm-8":W,"col-sm-5":!W}),Y=MonthBeforeDay.has(t);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),!W&&/*#__PURE__*/_jsx("div",{className:"col-sm-3",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"day",value:z||"",placeholder:p.day,disabled:e,min:1,onChange:function(a){return R(a)}})})]})}),!Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"year",placeholder:p.year,value:H||"",disabled:e,min:1,onChange:function(a){return T(a)}})})]})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
3
3
|
function shouldPropagateOnFocus(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c&&c.closest(".tw-date");return d!==e}// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
|
|
4
4
|
function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string,selectProps:PropTypes.object},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,id:"",selectProps:{}};export default DateInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import classnames from"classnames";import{useMemo}from"react";import{Theme}from"../common";import{getAvatarColorFromSeed}from"./colors";import{jsx as _jsx}from"react/jsx-runtime";var backwardsCompatibleSize=function(a){return"sm"===a?24:"md"===a?48:"lg"===a?72:a},Avatar=function(a){var b=a.backgroundColor,c=void 0===b?null:b,d=a.backgroundColorSeed,e=void 0===d?null:d,f=a.children,g=void 0===f?null:f,h=a.className,i=void 0===h?null:h,j=a.outlined,k=a.size,l=void 0===k?48:k,m=a.theme,n=void 0===m?Theme.LIGHT:m,o=a.type,p=void 0===o?"thumbnail":o,q=useMemo(function(){return!c&&e?"var(".concat(getAvatarColorFromSeed(e),")"):void 0},[c,e]),r=backwardsCompatibleSize(l);return/*#__PURE__*/_jsx("div",{className:classnames("tw-avatar",i,"tw-avatar--".concat(r),"tw-avatar--".concat(p),{"tw-avatar--outlined":void 0!==j&&j,"tw-avatar--branded":!!q,"np-text-title-body":"initials"===p}),children:/*#__PURE__*/_jsx("div",{className:"tw-avatar__content",style:{backgroundColor:c||q},children:g})})};export default Avatar;
|
|
1
|
+
import classnames from"classnames";import{useMemo}from"react";import{Theme}from"../common";import{getAvatarColorFromSeed}from"./colors";import{jsx as _jsx}from"react/jsx-runtime";var backwardsCompatibleSize=function(a){return"sm"===a?24:"md"===a?48:"lg"===a?72:a},Avatar=function(a){var b=a.backgroundColor,c=void 0===b?null:b,d=a.backgroundColorSeed,e=void 0===d?null:d,f=a.children,g=void 0===f?null:f,h=a.className,i=void 0===h?null:h,j=a.outlined,k=a.size,l=void 0===k?48:k,m=a.theme,n=void 0===m?Theme.LIGHT:m,o=a.type,p=void 0===o?"thumbnail":o,q=useMemo(function(){return!c&&e?"var(".concat(getAvatarColorFromSeed(e),")"):void 0},[c,e]),r=backwardsCompatibleSize(l);return/*#__PURE__*/_jsx("div",{className:classnames("tw-avatar",i,"tw-avatar--".concat(r),"tw-avatar--".concat(p),{"tw-avatar--outlined":void 0!==j&&j,"tw-avatar--custom-background":"icon"===p&&!!(c||q),"tw-avatar--branded":!!q,"np-text-title-body":"initials"===p}),children:/*#__PURE__*/_jsx("div",{className:"tw-avatar__content",style:{backgroundColor:c||q},children:g})})};export default Avatar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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.array.iterator.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.regexp.to-string.js";import classNames from"classnames";import PropTypes from"prop-types";import{useState}from"react";import{useIntl}from"react-intl";import{Select,Input}from"..";import{Size,DateMode,MonthFormat}from"../common";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import messages from"./DateInput.messages";import{explodeDate,convertToLocalMidnight}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=new Set(["en-US","ja-JP"]),INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b,c,d,e=a.disabled,f=a.size,g=a.value,h=a.dayLabel,i=a.monthLabel,j=a.yearLabel,k=a.monthFormat,l=a.mode,m=a.onChange,n=a.onFocus,o=a.onBlur,p=a.placeholders,q=a.id,r=a.selectProps,s=useIntl(),t=s.locale,u=s.formatMessage,v=function(){return g&&isDateValid(g)?"string"==typeof g?convertToLocalMidnight(g):g:null},w=function(a){var b=INITIAL_DEFAULT_STATE;if(g&&isDateValid(g)){var c=v();b=explodeDate(c),isMonthAndYearFormat(g)&&(b.day=null)}return b[a]},x=useState(function(){return w("day")}),y=_slicedToArray(x,2),z=y[0],A=y[1],B=useState(function(){return w("month")}),C=_slicedToArray(B,2),D=C[0],E=C[1],F=useState(function(){return w("year")}),G=_slicedToArray(F,2),H=G[0],I=G[1],J=useState(v),K=_slicedToArray(J,2),L=K[0],M=K[1];h=h||u(messages.dayLabel),i=i||u(messages.monthLabel),j=j||u(messages.yearLabel),p={day:(null===(b=p)||void 0===b?void 0:b.day)||"DD",month:(null===(c=p)||void 0===c?void 0:c.month)||u(messages.monthLabel),year:(null===(d=p)||void 0===d?void 0:d.year)||"YYYY"};var N=function(a){if(!isDateValid(a))return"";switch(l){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},O=function(){var a=getMonthNames(t,k);return/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:i}),/*#__PURE__*/_jsx(Select,_objectSpread({id:q?"".concat(q,"-select"):void 0,name:"month",disabled:e,placeholder:p.month,options:P(),size:f,selected:null===D?null:{value:D,label:a[D]},onChange:function(a){return S(a)}},r))]})},P=function(){var a=[],b=getMonthNames(t,k);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},Q=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:z,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:D,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:H,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||U(INITIAL_DEFAULT_STATE),l===DateMode.MONTH_YEAR?0<=b&&c&&(b!==D||c!==H)&&U(e):a&&0<=b&&c&&(a!==z||b!==D||c!==H)&&U(e)},R=function(a){var b=V(a.target.value,D,H),c=b.checkedDay;A(c),Q(c,D,H)},S=function(a){if(!a)return E(null),void Q(z,null,H);var b=a?a.value:0,c=V(z,b,H),d=c.checkedDay;E(b),z&&d!==z&&A(d),Q(d,b,H)},T=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
|
|
2
|
-
var d=V(z,D,b),e=d.checkedDay;z&&e!==z&&A(e),I(c),Q(e,D,c)}else I(c),Q(z,D,null)},U=function(a){a!==L&&(M(a),m(N(a)||null))},V=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},W=l===DateMode.MONTH_YEAR,X=classNames({"col-sm-8":W,"col-sm-5":!W}),Y=MonthBeforeDay.has(t);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),!W&&/*#__PURE__*/_jsx("div",{className:"col-sm-3",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"day",value:z||"",placeholder:p.day,disabled:e,onChange:function(a){return R(a)}})})]})}),!Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"year",placeholder:p.year,value:H||"",disabled:e,onChange:function(a){return T(a)}})})]})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
2
|
+
var d=V(z,D,b),e=d.checkedDay;z&&e!==z&&A(e),I(c),Q(e,D,c)}else I(c),Q(z,D,null)},U=function(a){a!==L&&(M(a),m(N(a)||null))},V=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},W=l===DateMode.MONTH_YEAR,X=classNames({"col-sm-8":W,"col-sm-5":!W}),Y=MonthBeforeDay.has(t);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),!W&&/*#__PURE__*/_jsx("div",{className:"col-sm-3",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"day",value:z||"",placeholder:p.day,disabled:e,min:1,onChange:function(a){return R(a)}})})]})}),!Y&&/*#__PURE__*/_jsx("div",{className:X,children:O()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("div",{className:"input-group input-group-".concat(f),children:/*#__PURE__*/_jsx(Input,{type:"number",name:"year",placeholder:p.year,value:H||"",disabled:e,min:1,onChange:function(a){return T(a)}})})]})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
3
3
|
function shouldPropagateOnFocus(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c&&c.closest(".tw-date");return d!==e}// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
|
|
4
4
|
function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string,selectProps:PropTypes.object},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,id:"",selectProps:{}};export default DateInput;
|