@lanaco/lnc-react-ui 4.0.12 → 4.0.14
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/dist/DecimalInput.cjs +19 -19
- package/dist/DecimalInput.js +95 -95
- package/dist/Modal.cjs +15 -15
- package/dist/Modal.js +78 -74
- package/package.json +1 -1
package/dist/DecimalInput.cjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";const B=require("react/jsx-runtime"),y=require("./index-BIlhCoy2.cjs"),F=require("react"),ae=require("./index-DaiUAQVF.cjs"),z=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),
|
|
1
|
+
"use strict";const B=require("react/jsx-runtime"),y=require("./index-BIlhCoy2.cjs"),F=require("react"),ae=require("./index-DaiUAQVF.cjs"),z=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),b=require("./utils-DTAPpJXU.cjs"),ie=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs");function A(){}function oe(){return!0}function O(a){return!!(a||"").match(/\d/)}function W(a){return a==null}function q(a){return a.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function ne(a){switch(a){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function se(a,l,u){var e=ne(u),t=a.search(/[1-9]/);return t=t===-1?a.length:t,a.substring(0,t)+a.substring(t,a.length).replace(e,"$1"+l)}function L(a,l){l===void 0&&(l=!0);var u=a[0]==="-",e=u&&l;a=a.replace("-","");var t=a.split("."),r=t[0],o=t[1]||"";return{beforeDecimal:r,afterDecimal:o,hasNagation:u,addNegation:e}}function le(a){if(!a)return a;var l=a[0]==="-";l&&(a=a.substring(1,a.length));var u=a.split("."),e=u[0].replace(/^0+/,"")||"0",t=u[1]||"";return(l?"-":"")+e+(t?"."+t:"")}function H(a,l,u){for(var e="",t=u?"0":"",r=0;r<=l-1;r++)e+=a[r]||t;return e}function G(a,l){return Array(l+1).join(a)}function fe(a){a+="";var l=a[0]==="-"?"-":"";l&&(a=a.substring(1));var u=a.split(/[eE]/g),e=u[0],t=u[1];if(t=Number(t),!t)return l+e;e=e.replace(".","");var r=1+t,o=e.length;return r<0?e="0."+G("0",Math.abs(r))+e:r>=o?e=e+G("0",r-o):e=(e.substring(0,r)||"0")+"."+e.substring(r),l+e}function ue(a,l,u){if(["","-"].indexOf(a)!==-1)return a;var e=a.indexOf(".")!==-1&&l,t=L(a),r=t.beforeDecimal,o=t.afterDecimal,s=t.hasNagation,i=parseFloat("0."+(o||"0")),n=o.length<=l?"0."+o:i.toFixed(l),f=n.split("."),p=r.split("").reverse().reduce(function(d,v,x){return d.length>x?(Number(d[0])+Number(v)).toString()+d.substring(1,d.length):v+d},f[0]),c=H(f[1]||"",Math.min(l,o.length),u),h=s?"-":"",m=e?".":"";return""+h+p+m+c}function _(a,l){if(a.value=a.value,a!==null){if(a.createTextRange){var u=a.createTextRange();return u.move("character",l),u.select(),!0}return a.selectionStart||a.selectionStart===0?(a.focus(),a.setSelectionRange(l,l),!0):(a.focus(),!1)}}function ce(a,l){for(var u=0,e=0,t=a.length,r=l.length;a[u]===l[u]&&u<t;)u++;for(;a[t-1-e]===l[r-1-e]&&r-e>u&&t-e>u;)e++;return{start:u,end:t-e}}function K(a,l,u){return Math.min(Math.max(a,l),u)}function Z(a){return Math.max(a.selectionStart,a.selectionEnd)}function pe(a){return a||typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function de(a,l){var u={};for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&l.indexOf(e)===-1&&(u[e]=a[e]);return u}var me={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:A,onChange:A,onKeyDown:A,onMouseUp:A,onFocus:A,onBlur:A,isAllowed:oe},J=function(a){function l(u){a.call(this,u);var e=u.defaultValue;this.validateProps();var t=this.formatValueProp(e);this.state={value:t,numAsString:this.removeFormatting(t),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return a&&(l.__proto__=a),l.prototype=Object.create(a&&a.prototype),l.prototype.constructor=l,l.prototype.componentDidMount=function(){this.setState({mounted:!0})},l.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},l.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},l.prototype.updateValueIfRequired=function(e){var t=this,r=t.props,o=t.state,s=t.focusedElm,i=o.value,n=o.numAsString;if(n===void 0&&(n=""),e!==r){this.validateProps();var f=this.formatNumString(n),p=W(r.value)?f:this.formatValueProp(),c=this.removeFormatting(p),h=parseFloat(c),m=parseFloat(n);((!isNaN(h)||!isNaN(m))&&h!==m||f!==i||s===null&&p!==i)&&this.updateValue({formattedValue:p,numAsString:c,input:s,source:"prop",event:null})}},l.prototype.getFloatString=function(e){e===void 0&&(e="");var t=this.props,r=t.decimalScale,o=this.getSeparators(),s=o.decimalSeparator,i=this.getNumberRegex(!0),n=e[0]==="-";n&&(e=e.replace("-","")),s&&r===0&&(e=e.split(s)[0]),e=(e.match(i)||[]).join("").replace(s,".");var f=e.indexOf(".");return f!==-1&&(e=e.substring(0,f)+"."+e.substring(f+1,e.length).replace(new RegExp(q(s),"g"),"")),n&&(e="-"+e),e},l.prototype.getNumberRegex=function(e,t){var r=this.props,o=r.format,s=r.decimalScale,i=r.customNumerals,n=this.getSeparators(),f=n.decimalSeparator;return new RegExp("[0-9"+(i?i.join(""):"")+"]"+(f&&s!==0&&!t&&!o?"|"+q(f):""),e?"g":void 0)},l.prototype.getSeparators=function(){var e=this.props,t=e.decimalSeparator,r=this.props,o=r.thousandSeparator,s=r.allowedDecimalSeparators;return o===!0&&(o=","),s||(s=[t,"."]),{decimalSeparator:t,thousandSeparator:o,allowedDecimalSeparators:s}},l.prototype.getMaskAtIndex=function(e){var t=this.props,r=t.mask;return r===void 0&&(r=" "),typeof r=="string"?r:r[e]||" "},l.prototype.getValueObject=function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}},l.prototype.validateProps=function(){var e=this.props,t=e.mask,r=this.getSeparators(),o=r.decimalSeparator,s=r.thousandSeparator;if(o===s)throw new Error(`
|
|
2
2
|
Decimal separator can't be same as thousand separator.
|
|
3
3
|
thousandSeparator: `+s+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
4
4
|
decimalSeparator: `+o+` (default value for decimalSeparator is .)
|
|
5
5
|
`);if(t){var i=t==="string"?t:t.toString();if(i.match(/\d/g))throw new Error(`
|
|
6
6
|
Mask `+t+` should not contain numeric character;
|
|
7
|
-
`)}},l.prototype.setPatchedCaretPosition=function(e,t,r){
|
|
7
|
+
`)}},l.prototype.setPatchedCaretPosition=function(e,t,r){_(e,t),this.caretPositionTimeout=setTimeout(function(){e.value===r&&_(e,t)},0)},l.prototype.correctCaretPosition=function(e,t,r){var o=this.props,s=o.prefix,i=o.suffix,n=o.format;if(e==="")return 0;if(t=K(t,0,e.length),!n){var f=e[0]==="-";return K(t,s.length+(f?1:0),e.length-i.length)}if(typeof n=="function"||n[t]==="#"&&O(e[t])||n[t-1]==="#"&&O(e[t-1]))return t;var p=n.indexOf("#"),c=n.lastIndexOf("#");t=K(t,p,c+1);for(var h=n.substring(t,n.length).indexOf("#"),m=t,d=t+(h===-1?0:h);m>p&&(n[m]!=="#"||!O(e[m]));)m-=1;var v=!O(e[d])||r==="left"&&t!==p||t-m<d-t;return v?O(e[m])?m+1:m:d},l.prototype.getCaretPosition=function(e,t,r){var o=this.props,s=o.format,i=this.state.value,n=this.getNumberRegex(!0),f=(e.match(n)||[]).join(""),p=(t.match(n)||[]).join(""),c,h;for(c=0,h=0;h<r;h++){var m=e[h]||"",d=t[c]||"";if(!(!m.match(n)&&m!==d)&&!(m==="0"&&d.match(n)&&d!=="0"&&f.length!==p.length)){for(;m!==t[c]&&c<t.length;)c++;c++}}return typeof s=="string"&&!i&&(c=t.length),c=this.correctCaretPosition(t,c),c},l.prototype.removePrefixAndSuffix=function(e){var t=this.props,r=t.format,o=t.prefix,s=t.suffix;if(!r&&e){var i=e[0]==="-";i&&(e=e.substring(1,e.length)),e=o&&e.indexOf(o)===0?e.substring(o.length,e.length):e;var n=e.lastIndexOf(s);e=s&&n!==-1&&n===e.length-s.length?e.substring(0,n):e,i&&(e="-"+e)}return e},l.prototype.removePatternFormatting=function(e){for(var t=this.props,r=t.format,o=r.split("#").filter(function(h){return h!==""}),s=0,i="",n=0,f=o.length;n<=f;n++){var p=o[n]||"",c=n===f?e.length:e.indexOf(p,s);if(c===-1){i=e;break}else i+=e.substring(s,c),s=c+p.length}return(i.match(this.getNumberRegex(!0))||[]).join("")},l.prototype.removeFormatting=function(e){var t=this.props,r=t.format,o=t.removeFormatting;return e&&(r?typeof r=="string"?e=this.removePatternFormatting(e):typeof o=="function"?e=o(e):e=(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e)},l.prototype.formatWithPattern=function(e){for(var t=this.props,r=t.format,o=0,s=r.split(""),i=0,n=r.length;i<n;i++)r[i]==="#"&&(s[i]=e[o]||this.getMaskAtIndex(o),o+=1);return s.join("")},l.prototype.formatAsNumber=function(e){var t=this.props,r=t.decimalScale,o=t.fixedDecimalScale,s=t.prefix,i=t.suffix,n=t.allowNegative,f=t.thousandsGroupStyle,p=this.getSeparators(),c=p.thousandSeparator,h=p.decimalSeparator,m=e.indexOf(".")!==-1||r&&o,d=L(e,n),v=d.beforeDecimal,x=d.afterDecimal,N=d.addNegation;return r!==void 0&&(x=H(x,r,o)),c&&(v=se(v,c,f)),s&&(v=s+v),i&&(x=x+i),N&&(v="-"+v),e=v+(m&&h||"")+x,e},l.prototype.formatNumString=function(e){e===void 0&&(e="");var t=this.props,r=t.format,o=t.allowEmptyFormatting,s=t.customNumerals,i=e;if(s&&s.length===10){var n=new RegExp("["+s.join("")+"]","g");i=e.replace(n,function(f){return s.indexOf(f).toString()})}return e===""&&!o?i="":e==="-"&&!r?i="-":typeof r=="string"?i=this.formatWithPattern(i):typeof r=="function"?i=r(i):i=this.formatAsNumber(i),i},l.prototype.formatValueProp=function(e){var t=this.props,r=t.format,o=t.decimalScale,s=t.fixedDecimalScale,i=t.allowEmptyFormatting,n=this.props,f=n.value,p=n.isNumericString;f=W(f)?e:f;var c=!f&&f!==0;if(c&&i&&(f=""),c&&!i)return"";typeof f=="number"&&(f=fe(f),p=!0),f==="Infinity"&&p&&(f=""),p&&!r&&typeof o=="number"&&(f=ue(f,o,s));var h=p?this.formatNumString(f):this.formatInput(f);return h},l.prototype.formatNegation=function(e){e===void 0&&(e="");var t=this.props,r=t.allowNegative,o=new RegExp("(-)"),s=new RegExp("(-)(.)*(-)"),i=o.test(e),n=s.test(e);return e=e.replace(/-/g,""),i&&!n&&r&&(e="-"+e),e},l.prototype.formatInput=function(e){e===void 0&&(e="");var t=this.props,r=t.format;return r||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},l.prototype.isCharacterAFormat=function(e,t){var r=this.props,o=r.format,s=r.prefix,i=r.suffix,n=r.decimalScale,f=r.fixedDecimalScale,p=this.getSeparators(),c=p.decimalSeparator;return!!(typeof o=="string"&&o[e]!=="#"||!o&&(e<s.length||e>=t.length-i.length||n&&f&&t[e]===c))},l.prototype.correctInputValue=function(e,t,r){var o=this,s=this.props,i=s.format,n=s.allowNegative,f=s.prefix,p=s.suffix,c=s.decimalScale,h=this.getSeparators(),m=h.allowedDecimalSeparators,d=h.decimalSeparator,v=this.state.numAsString||"",x=this.selectionBeforeInput,N=x.selectionStart,D=x.selectionEnd,C=ce(t,r),g=C.start,w=C.end;if(!i&&g===w&&m.indexOf(r[N])!==-1){var R=c===0?"":d;return r.substr(0,N)+R+r.substr(N+1,r.length)}var E=i?0:f.length,$=t.length-(i?0:p.length);if(r.length>t.length||!r.length||g===w||N===0&&D===t.length||g===0&&w===t.length||N===E&&D===$)return r;var j=t.substr(g,w-g),M=!![].concat(j).find(function(T,I){return o.isCharacterAFormat(I+g,t)});if(M){var U=t.substr(g),V={},S=[];[].concat(U).forEach(function(T,I){o.isCharacterAFormat(I+g,t)?V[I]=T:I>j.length-1&&S.push(T)}),Object.keys(V).forEach(function(T){S.length>T?S.splice(T,0,V[T]):S.push(V[T])}),r=t.substr(0,g)+S.join("")}if(!i){var P=this.removeFormatting(r),k=L(P,n),Y=k.beforeDecimal,ee=k.afterDecimal,te=k.addNegation,re=e<r.indexOf(d)+1;if(P.length<v.length&&re&&Y===""&&!parseFloat(ee))return te?"-":""}return r},l.prototype.updateValue=function(e){var t=e.formattedValue,r=e.input,o=e.setCaretPosition;o===void 0&&(o=!0);var s=e.source,i=e.event,n=e.numAsString,f=e.caretPos,p=this.props,c=p.onValueChange,h=this.state,m=h.value;if(r){if(f===void 0&&o){var d=e.inputValue||r.value,v=Z(r);r.value=t,f=this.getCaretPosition(d,t,v)}r.value=t,o&&this.setPatchedCaretPosition(r,f,t)}n===void 0&&(n=this.removeFormatting(t)),t!==m&&(this.setState({value:t,numAsString:n}),c(this.getValueObject(t,n),{event:i,source:s}))},l.prototype.onChange=function(e){var t=e.target,r=t.value,o=this,s=o.state,i=o.props,n=i.isAllowed,f=s.value||"",p=Z(t);r=this.correctInputValue(p,f,r);var c=this.formatInput(r)||"",h=this.removeFormatting(c),m=this.getValueObject(c,h),d=n(m);d||(c=f),this.updateValue({formattedValue:c,numAsString:h,inputValue:r,input:t,event:e,source:"event"}),d&&i.onChange(e)},l.prototype.onBlur=function(e){var t=this,r=t.props,o=t.state,s=r.format,i=r.onBlur,n=r.allowLeadingZeros,f=o.numAsString,p=o.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!s){isNaN(parseFloat(f))&&(f=""),n||(f=le(f));var c=this.formatNumString(f);if(c!==p){this.updateValue({formattedValue:c,numAsString:f,input:e.target,setCaretPosition:!1,event:e,source:"event"}),i(e);return}}i(e)},l.prototype.onKeyDown=function(e){var t=e.target,r=e.key,o=t.selectionStart,s=t.selectionEnd,i=t.value;i===void 0&&(i="");var n,f=this.props,p=f.decimalScale,c=f.fixedDecimalScale,h=f.prefix,m=f.suffix,d=f.format,v=f.onKeyDown,x=p!==void 0&&c,N=this.getNumberRegex(!1,x),D=new RegExp("-"),C=typeof d=="string";if(this.selectionBeforeInput={selectionStart:o,selectionEnd:s},r==="ArrowLeft"||r==="Backspace"?n=o-1:r==="ArrowRight"?n=o+1:r==="Delete"&&(n=o),n===void 0||o!==s){v(e);return}var g=n,w=C?d.indexOf("#"):h.length,R=C?d.lastIndexOf("#")+1:i.length-m.length;if(r==="ArrowLeft"||r==="ArrowRight"){var E=r==="ArrowLeft"?"left":"right";g=this.correctCaretPosition(i,n,E)}else if(r==="Delete"&&!N.test(i[n])&&!D.test(i[n]))for(;!N.test(i[g])&&g<R;)g++;else if(r==="Backspace"&&!N.test(i[n])){if(o<=w+1&&i[0]==="-"&&typeof d>"u"){var $=i.substring(1);this.updateValue({formattedValue:$,caretPos:g,input:t,event:e,source:"event"})}else if(!D.test(i[n])){for(;!N.test(i[g-1])&&g>w;)g--;g=this.correctCaretPosition(i,g,"left")}}(g!==n||n<w||n>R)&&(e.preventDefault(),this.setPatchedCaretPosition(t,g,i)),e.isUnitTestRun&&this.setPatchedCaretPosition(t,g,i),v(e)},l.prototype.onMouseUp=function(e){var t=e.target,r=t.selectionStart,o=t.selectionEnd,s=t.value;if(s===void 0&&(s=""),r===o){var i=this.correctCaretPosition(s,r);i!==r&&this.setPatchedCaretPosition(t,i,s)}this.props.onMouseUp(e)},l.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout(function(){var r=e.target,o=r.selectionStart,s=r.selectionEnd,i=r.value;i===void 0&&(i="");var n=t.correctCaretPosition(i,o);n!==o&&!(o===0&&s===i.length)&&t.setPatchedCaretPosition(r,n,i),t.props.onFocus(e)},0)},l.prototype.render=function(){var e=this.props,t=e.type,r=e.displayType,o=e.customInput,s=e.renderText,i=e.getInputRef,n=e.format;e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value;var f=de(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"]),p=f,c=this.state,h=c.value,m=c.mounted,d=m&&pe(n)?"numeric":void 0,v=Object.assign({inputMode:d},p,{type:t,value:h,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if(r==="text")return s?s(h,p)||null:F.createElement("span",Object.assign({},p,{ref:i}),h);if(o){var x=o;return F.createElement(x,Object.assign({},v,{ref:i}))}return F.createElement("input",Object.assign({},v,{ref:i}))},l}(F.Component);J.defaultProps=me;const he=z.newStyled.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
|
|
11
|
-
min-height: ${a=>
|
|
12
|
-
max-height: ${a=>
|
|
13
|
-
background-color: ${a=>
|
|
11
|
+
min-height: ${a=>b.getSizeValueWithUnits(a.theme,a.size)};
|
|
12
|
+
max-height: ${a=>b.getSizeValueWithUnits(a.theme,a.size)};
|
|
13
|
+
background-color: ${a=>b.getColorRgbaValue(a.theme,"Input",a.color,"enabled","background")};
|
|
14
14
|
border: 1px solid
|
|
15
|
-
${a=>
|
|
16
|
-
border-radius: ${a=>
|
|
15
|
+
${a=>b.getColorRgbaValue(a.theme,"Input",a.focused===!0?"primary":a.color,"enabled","border")};
|
|
16
|
+
border-radius: ${a=>b.getBorderRadiusValueWithUnits(a.theme,"regular")};
|
|
17
17
|
|
|
18
|
-
${a=>a.focused===!0&&a.readOnly!==!0?
|
|
19
|
-
${a=>a.isDisabled===!0?
|
|
20
|
-
${a=>a.isDisabled===!0?"border: 1px solid "+
|
|
18
|
+
${a=>a.focused===!0&&a.readOnly!==!0?b.getOutlineCss(a.theme):""}
|
|
19
|
+
${a=>a.isDisabled===!0?b.getDisabledStateCss(a.theme):""}
|
|
20
|
+
${a=>a.isDisabled===!0?"border: 1px solid "+b.getColorRgbaValue(a.theme,"Input",a.color,"disabled","border"):""}
|
|
21
21
|
|
|
22
22
|
& input {
|
|
23
23
|
background: none;
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
padding-bottom: 0.625rem;
|
|
28
28
|
width: 100%;
|
|
29
29
|
|
|
30
|
-
${a=>
|
|
31
|
-
min-height: ${a=>
|
|
32
|
-
max-height: ${a=>
|
|
33
|
-
color: ${a=>
|
|
34
|
-
caret-color: ${a=>
|
|
30
|
+
${a=>b.getComponentTypographyCss(a.theme,"Input",a.size,"enabled")}
|
|
31
|
+
min-height: ${a=>b.getSizeValueWithUnits(a.theme,a.size)};
|
|
32
|
+
max-height: ${a=>b.getSizeValueWithUnits(a.theme,a.size)};
|
|
33
|
+
color: ${a=>b.getColorRgbaValue(a.theme,"Input",a.focused===!0?"primary":a.color,"enabled","text")};
|
|
34
|
+
caret-color: ${a=>b.getColorRgbaValue(a.theme,"Input",a.color,"enabled","caret")};
|
|
35
35
|
padding-right: ${a=>a.suffix?"0":"0.75rem"};
|
|
36
36
|
padding-left: ${a=>a.prefix?"0":"0.75rem"};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
& input:disabled {
|
|
40
|
-
${a=>
|
|
40
|
+
${a=>b.getDisabledStateCss(a.theme)}
|
|
41
41
|
background: none;
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
& input::placeholder {
|
|
49
|
-
color: ${a=>
|
|
49
|
+
color: ${a=>b.getColorRgbaValue(a.theme,"Input",a.color,"enabled","placeholder")};
|
|
50
50
|
}
|
|
51
51
|
`,Q=z.newStyled.span`
|
|
52
52
|
padding: 0 12px;
|
|
53
|
-
color: ${a=>
|
|
54
|
-
`,ge=z.newStyled(Q)``,X=F.forwardRef((a,l)=>{const{disabled:
|
|
53
|
+
color: ${a=>b.getColorRgbaValue(a.theme,"Input",a.focused===!0?"primary":a.color,"enabled","prefix")};
|
|
54
|
+
`,ge=z.newStyled(Q)``,X=F.forwardRef((a,l)=>{const{disabled:u,readOnly:e,debounceTime:t=180,prefix:r,suffix:o,thousandSeparator:s=".",decimalSeparator:i=",",decimalScale:n=2,fixedDecimalScale:f=!0,allowNegative:p=!0,onChange:c,onKeyDown:h,onBlur:m,onFocus:d,className:v="",style:x={},size:N="small",color:D="primary",...C}=a,g=ie.useTheme(),[w,R]=F.useState(!1),E=F.useCallback(ae.debounce((S,P)=>$(S,P),t),[c]),$=(S,P)=>{c&&(c==null||c(S,P))},j=(S,P)=>{E(P.event,S==null?void 0:S.floatValue)},M=()=>n<0?0:n>17?17:n,U=S=>{R(!0),d==null||d(S)},V=S=>{R(!1),m==null||m(S)};return B.jsxs(he,{style:x,className:v,theme:g,color:D,size:N,prefix:r,suffix:o,focused:w,disabled:u,readOnly:e,children:[r&&B.jsx(Q,{theme:g,color:D,focused:w,className:"lnc-input-prefix",children:r}),B.jsx(J,{getInputRef:l,className:"lnc-decimal-input",disabled:u,readOnly:e,thousandSeparator:s,decimalSeparator:i,decimalScale:M(),fixedDecimalScale:f,allowNegative:p,onFocus:U,onBlur:V,onValueChange:j,...C}),o&&B.jsx(ge,{theme:g,color:D,focused:w,className:"lnc-input-suffix",children:o})]})});X.propTypes={id:y.PropTypes.string,value:y.PropTypes.any,defaultValue:y.PropTypes.any,disabled:y.PropTypes.bool,readOnly:y.PropTypes.bool,debounceTime:y.PropTypes.number,prefix:y.PropTypes.oneOfType([y.PropTypes.string,y.PropTypes.element]),suffix:y.PropTypes.oneOfType([y.PropTypes.string,y.PropTypes.element]),thousandSeparator:y.PropTypes.oneOf([".",","," "]),decimalSeparator:y.PropTypes.oneOf([".",","]),decimalScale:y.PropTypes.number,fixedDecimalScale:y.PropTypes.bool,allowNegative:y.PropTypes.bool,onChange:y.PropTypes.func,onBlur:y.PropTypes.func,onFocus:y.PropTypes.func,className:y.PropTypes.string,style:y.PropTypes.object,size:y.PropTypes.oneOf(["small","medium","large"]),color:y.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};module.exports=X;
|
package/dist/DecimalInput.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsxs as ie, jsx as K } from "react/jsx-runtime";
|
|
2
2
|
import { P as S } from "./index-BYnWp42a.js";
|
|
3
|
-
import
|
|
3
|
+
import B, { forwardRef as oe, useState as ne, useCallback as se } from "react";
|
|
4
4
|
import { d as fe } from "./index-CNBqQrtK.js";
|
|
5
5
|
import { n as G } from "./emotion-styled.browser.esm-BiK8DcgW.js";
|
|
6
|
-
import { d as
|
|
6
|
+
import { d as M, a as R, b as le, e as ue, h as W, g as ce } from "./utils-C52T57HO.js";
|
|
7
7
|
import { u as pe } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
|
|
8
|
-
function
|
|
8
|
+
function E() {
|
|
9
9
|
}
|
|
10
10
|
function de() {
|
|
11
11
|
return !0;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function I(a) {
|
|
14
14
|
return !!(a || "").match(/\d/);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Z(a) {
|
|
17
17
|
return a == null;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function _(a) {
|
|
20
20
|
return a.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
21
21
|
}
|
|
22
22
|
function me(a) {
|
|
@@ -46,7 +46,7 @@ function z(a, f) {
|
|
|
46
46
|
addNegation: e
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function ge(a) {
|
|
50
50
|
if (!a)
|
|
51
51
|
return a;
|
|
52
52
|
var f = a[0] === "-";
|
|
@@ -62,7 +62,7 @@ function Q(a, f, u) {
|
|
|
62
62
|
function q(a, f) {
|
|
63
63
|
return Array(f + 1).join(a);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function ve(a) {
|
|
66
66
|
a += "";
|
|
67
67
|
var f = a[0] === "-" ? "-" : "";
|
|
68
68
|
f && (a = a.substring(1));
|
|
@@ -76,8 +76,8 @@ function ge(a) {
|
|
|
76
76
|
function Se(a, f, u) {
|
|
77
77
|
if (["", "-"].indexOf(a) !== -1)
|
|
78
78
|
return a;
|
|
79
|
-
var e = a.indexOf(".") !== -1 && f, t = z(a), r = t.beforeDecimal, o = t.afterDecimal, s = t.hasNagation, i = parseFloat("0." + (o || "0")), n = o.length <= f ? "0." + o : i.toFixed(f), l = n.split("."), p = r.split("").reverse().reduce(function(d,
|
|
80
|
-
return d.length >
|
|
79
|
+
var e = a.indexOf(".") !== -1 && f, t = z(a), r = t.beforeDecimal, o = t.afterDecimal, s = t.hasNagation, i = parseFloat("0." + (o || "0")), n = o.length <= f ? "0." + o : i.toFixed(f), l = n.split("."), p = r.split("").reverse().reduce(function(d, v, x) {
|
|
80
|
+
return d.length > x ? (Number(d[0]) + Number(v)).toString() + d.substring(1, d.length) : v + d;
|
|
81
81
|
}, l[0]), c = Q(
|
|
82
82
|
l[1] || "",
|
|
83
83
|
Math.min(f, o.length),
|
|
@@ -127,12 +127,12 @@ var Ne = {
|
|
|
127
127
|
allowLeadingZeros: !1,
|
|
128
128
|
isNumericString: !1,
|
|
129
129
|
type: "text",
|
|
130
|
-
onValueChange:
|
|
131
|
-
onChange:
|
|
132
|
-
onKeyDown:
|
|
133
|
-
onMouseUp:
|
|
134
|
-
onFocus:
|
|
135
|
-
onBlur:
|
|
130
|
+
onValueChange: E,
|
|
131
|
+
onChange: E,
|
|
132
|
+
onKeyDown: E,
|
|
133
|
+
onMouseUp: E,
|
|
134
|
+
onFocus: E,
|
|
135
|
+
onBlur: E,
|
|
136
136
|
isAllowed: de
|
|
137
137
|
}, X = /* @__PURE__ */ function(a) {
|
|
138
138
|
function f(u) {
|
|
@@ -161,7 +161,7 @@ var Ne = {
|
|
|
161
161
|
var t = this, r = t.props, o = t.state, s = t.focusedElm, i = o.value, n = o.numAsString;
|
|
162
162
|
if (n === void 0 && (n = ""), e !== r) {
|
|
163
163
|
this.validateProps();
|
|
164
|
-
var l = this.formatNumString(n), p =
|
|
164
|
+
var l = this.formatNumString(n), p = Z(r.value) ? l : this.formatValueProp(), c = this.removeFormatting(p), h = parseFloat(c), m = parseFloat(n);
|
|
165
165
|
//while typing set state only when float value changes
|
|
166
166
|
((!isNaN(h) || !isNaN(m)) && h !== m || //can also set state when float value is same and the format props changes
|
|
167
167
|
l !== i || //set state always when not in focus and formatted value is changed
|
|
@@ -178,11 +178,11 @@ var Ne = {
|
|
|
178
178
|
var t = this.props, r = t.decimalScale, o = this.getSeparators(), s = o.decimalSeparator, i = this.getNumberRegex(!0), n = e[0] === "-";
|
|
179
179
|
n && (e = e.replace("-", "")), s && r === 0 && (e = e.split(s)[0]), e = (e.match(i) || []).join("").replace(s, ".");
|
|
180
180
|
var l = e.indexOf(".");
|
|
181
|
-
return l !== -1 && (e = e.substring(0, l) + "." + e.substring(l + 1, e.length).replace(new RegExp(
|
|
181
|
+
return l !== -1 && (e = e.substring(0, l) + "." + e.substring(l + 1, e.length).replace(new RegExp(_(s), "g"), "")), n && (e = "-" + e), e;
|
|
182
182
|
}, f.prototype.getNumberRegex = function(e, t) {
|
|
183
183
|
var r = this.props, o = r.format, s = r.decimalScale, i = r.customNumerals, n = this.getSeparators(), l = n.decimalSeparator;
|
|
184
184
|
return new RegExp(
|
|
185
|
-
"[0-9" + (i ? i.join("") : "") + "]" + (l && s !== 0 && !t && !o ? "|" +
|
|
185
|
+
"[0-9" + (i ? i.join("") : "") + "]" + (l && s !== 0 && !t && !o ? "|" + _(l) : ""),
|
|
186
186
|
e ? "g" : void 0
|
|
187
187
|
);
|
|
188
188
|
}, f.prototype.getSeparators = function() {
|
|
@@ -229,14 +229,14 @@ var Ne = {
|
|
|
229
229
|
var l = e[0] === "-";
|
|
230
230
|
return L(t, s.length + (l ? 1 : 0), e.length - i.length);
|
|
231
231
|
}
|
|
232
|
-
if (typeof n == "function" || n[t] === "#" &&
|
|
232
|
+
if (typeof n == "function" || n[t] === "#" && I(e[t]) || n[t - 1] === "#" && I(e[t - 1]))
|
|
233
233
|
return t;
|
|
234
234
|
var p = n.indexOf("#"), c = n.lastIndexOf("#");
|
|
235
235
|
t = L(t, p, c + 1);
|
|
236
|
-
for (var h = n.substring(t, n.length).indexOf("#"), m = t, d = t + (h === -1 ? 0 : h); m > p && (n[m] !== "#" || !
|
|
236
|
+
for (var h = n.substring(t, n.length).indexOf("#"), m = t, d = t + (h === -1 ? 0 : h); m > p && (n[m] !== "#" || !I(e[m])); )
|
|
237
237
|
m -= 1;
|
|
238
|
-
var
|
|
239
|
-
return
|
|
238
|
+
var v = !I(e[d]) || r === "left" && t !== p || t - m < d - t;
|
|
239
|
+
return v ? I(e[m]) ? m + 1 : m : d;
|
|
240
240
|
}, f.prototype.getCaretPosition = function(e, t, r) {
|
|
241
241
|
var o = this.props, s = o.format, i = this.state.value, n = this.getNumberRegex(!0), l = (e.match(n) || []).join(""), p = (t.match(n) || []).join(""), c, h;
|
|
242
242
|
for (c = 0, h = 0; h < r; h++) {
|
|
@@ -277,8 +277,8 @@ var Ne = {
|
|
|
277
277
|
r[i] === "#" && (s[i] = e[o] || this.getMaskAtIndex(o), o += 1);
|
|
278
278
|
return s.join("");
|
|
279
279
|
}, f.prototype.formatAsNumber = function(e) {
|
|
280
|
-
var t = this.props, r = t.decimalScale, o = t.fixedDecimalScale, s = t.prefix, i = t.suffix, n = t.allowNegative, l = t.thousandsGroupStyle, p = this.getSeparators(), c = p.thousandSeparator, h = p.decimalSeparator, m = e.indexOf(".") !== -1 || r && o, d = z(e, n),
|
|
281
|
-
return r !== void 0 && (
|
|
280
|
+
var t = this.props, r = t.decimalScale, o = t.fixedDecimalScale, s = t.prefix, i = t.suffix, n = t.allowNegative, l = t.thousandsGroupStyle, p = this.getSeparators(), c = p.thousandSeparator, h = p.decimalSeparator, m = e.indexOf(".") !== -1 || r && o, d = z(e, n), v = d.beforeDecimal, x = d.afterDecimal, b = d.addNegation;
|
|
281
|
+
return r !== void 0 && (x = Q(x, r, o)), c && (v = he(v, c, l)), s && (v = s + v), i && (x = x + i), b && (v = "-" + v), e = v + (m && h || "") + x, e;
|
|
282
282
|
}, f.prototype.formatNumString = function(e) {
|
|
283
283
|
e === void 0 && (e = "");
|
|
284
284
|
var t = this.props, r = t.format, o = t.allowEmptyFormatting, s = t.customNumerals, i = e;
|
|
@@ -294,11 +294,11 @@ var Ne = {
|
|
|
294
294
|
return e === "" && !o ? i = "" : e === "-" && !r ? i = "-" : typeof r == "string" ? i = this.formatWithPattern(i) : typeof r == "function" ? i = r(i) : i = this.formatAsNumber(i), i;
|
|
295
295
|
}, f.prototype.formatValueProp = function(e) {
|
|
296
296
|
var t = this.props, r = t.format, o = t.decimalScale, s = t.fixedDecimalScale, i = t.allowEmptyFormatting, n = this.props, l = n.value, p = n.isNumericString;
|
|
297
|
-
l =
|
|
297
|
+
l = Z(l) ? e : l;
|
|
298
298
|
var c = !l && l !== 0;
|
|
299
299
|
if (c && i && (l = ""), c && !i)
|
|
300
300
|
return "";
|
|
301
|
-
typeof l == "number" && (l =
|
|
301
|
+
typeof l == "number" && (l = ve(l), p = !0), l === "Infinity" && p && (l = ""), p && !r && typeof o == "number" && (l = Se(l, o, s));
|
|
302
302
|
var h = p ? this.formatNumString(l) : this.formatInput(l);
|
|
303
303
|
return h;
|
|
304
304
|
}, f.prototype.formatNegation = function(e) {
|
|
@@ -313,42 +313,42 @@ var Ne = {
|
|
|
313
313
|
var r = this.props, o = r.format, s = r.prefix, i = r.suffix, n = r.decimalScale, l = r.fixedDecimalScale, p = this.getSeparators(), c = p.decimalSeparator;
|
|
314
314
|
return !!(typeof o == "string" && o[e] !== "#" || !o && (e < s.length || e >= t.length - i.length || n && l && t[e] === c));
|
|
315
315
|
}, f.prototype.correctInputValue = function(e, t, r) {
|
|
316
|
-
var o = this, s = this.props, i = s.format, n = s.allowNegative, l = s.prefix, p = s.suffix, c = s.decimalScale, h = this.getSeparators(), m = h.allowedDecimalSeparators, d = h.decimalSeparator,
|
|
317
|
-
if (!i &&
|
|
316
|
+
var o = this, s = this.props, i = s.format, n = s.allowNegative, l = s.prefix, p = s.suffix, c = s.decimalScale, h = this.getSeparators(), m = h.allowedDecimalSeparators, d = h.decimalSeparator, v = this.state.numAsString || "", x = this.selectionBeforeInput, b = x.selectionStart, w = x.selectionEnd, P = ye(t, r), g = P.start, N = P.end;
|
|
317
|
+
if (!i && g === N && m.indexOf(r[b]) !== -1) {
|
|
318
318
|
var F = c === 0 ? "" : d;
|
|
319
|
-
return r.substr(0,
|
|
319
|
+
return r.substr(0, b) + F + r.substr(b + 1, r.length);
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var T = i ? 0 : l.length, $ = t.length - (i ? 0 : p.length);
|
|
322
322
|
if (
|
|
323
323
|
// don't do anything if something got added
|
|
324
324
|
r.length > t.length || // or if the new value is an empty string
|
|
325
325
|
!r.length || // or if nothing has changed, in which case start will be same as end
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
g === N || // or in case if whole input is selected and new value is typed
|
|
327
|
+
b === 0 && w === t.length || // or in case if the whole content is replaced by browser, example (autocomplete)
|
|
328
|
+
g === 0 && N === t.length || // or if charcters between prefix and suffix is selected.
|
|
329
329
|
// For numeric inputs we apply the format so, prefix and suffix can be ignored
|
|
330
|
-
|
|
330
|
+
b === T && w === $
|
|
331
331
|
)
|
|
332
332
|
return r;
|
|
333
|
-
var
|
|
334
|
-
function(C,
|
|
335
|
-
return o.isCharacterAFormat(
|
|
333
|
+
var O = t.substr(g, N - g), j = !![].concat(O).find(
|
|
334
|
+
function(C, V) {
|
|
335
|
+
return o.isCharacterAFormat(V + g, t);
|
|
336
336
|
}
|
|
337
337
|
);
|
|
338
|
-
if (
|
|
339
|
-
var k = t.substr(
|
|
340
|
-
[].concat(k).forEach(function(C,
|
|
341
|
-
o.isCharacterAFormat(
|
|
338
|
+
if (j) {
|
|
339
|
+
var k = t.substr(g), A = {}, y = [];
|
|
340
|
+
[].concat(k).forEach(function(C, V) {
|
|
341
|
+
o.isCharacterAFormat(V + g, t) ? A[V] = C : V > O.length - 1 && y.push(C);
|
|
342
342
|
}), Object.keys(A).forEach(function(C) {
|
|
343
|
-
|
|
344
|
-
}), r = t.substr(0,
|
|
343
|
+
y.length > C ? y.splice(C, 0, A[C]) : y.push(A[C]);
|
|
344
|
+
}), r = t.substr(0, g) + y.join("");
|
|
345
345
|
}
|
|
346
346
|
if (!i) {
|
|
347
347
|
var D = this.removeFormatting(r), U = z(
|
|
348
348
|
D,
|
|
349
349
|
n
|
|
350
350
|
), ee = U.beforeDecimal, te = U.afterDecimal, re = U.addNegation, ae = e < r.indexOf(d) + 1;
|
|
351
|
-
if (D.length <
|
|
351
|
+
if (D.length < v.length && ae && ee === "" && !parseFloat(te))
|
|
352
352
|
return re ? "-" : "";
|
|
353
353
|
}
|
|
354
354
|
return r;
|
|
@@ -358,8 +358,8 @@ var Ne = {
|
|
|
358
358
|
var s = e.source, i = e.event, n = e.numAsString, l = e.caretPos, p = this.props, c = p.onValueChange, h = this.state, m = h.value;
|
|
359
359
|
if (r) {
|
|
360
360
|
if (l === void 0 && o) {
|
|
361
|
-
var d = e.inputValue || r.value,
|
|
362
|
-
r.value = t, l = this.getCaretPosition(d, t,
|
|
361
|
+
var d = e.inputValue || r.value, v = J(r);
|
|
362
|
+
r.value = t, l = this.getCaretPosition(d, t, v);
|
|
363
363
|
}
|
|
364
364
|
r.value = t, o && this.setPatchedCaretPosition(r, l, t);
|
|
365
365
|
}
|
|
@@ -379,7 +379,7 @@ var Ne = {
|
|
|
379
379
|
}, f.prototype.onBlur = function(e) {
|
|
380
380
|
var t = this, r = t.props, o = t.state, s = r.format, i = r.onBlur, n = r.allowLeadingZeros, l = o.numAsString, p = o.value;
|
|
381
381
|
if (this.focusedElm = null, clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout), !s) {
|
|
382
|
-
isNaN(parseFloat(l)) && (l = ""), n || (l =
|
|
382
|
+
isNaN(parseFloat(l)) && (l = ""), n || (l = ge(l));
|
|
383
383
|
var c = this.formatNumString(l);
|
|
384
384
|
if (c !== p) {
|
|
385
385
|
this.updateValue({
|
|
@@ -397,38 +397,38 @@ var Ne = {
|
|
|
397
397
|
}, f.prototype.onKeyDown = function(e) {
|
|
398
398
|
var t = e.target, r = e.key, o = t.selectionStart, s = t.selectionEnd, i = t.value;
|
|
399
399
|
i === void 0 && (i = "");
|
|
400
|
-
var n, l = this.props, p = l.decimalScale, c = l.fixedDecimalScale, h = l.prefix, m = l.suffix, d = l.format,
|
|
400
|
+
var n, l = this.props, p = l.decimalScale, c = l.fixedDecimalScale, h = l.prefix, m = l.suffix, d = l.format, v = l.onKeyDown, x = p !== void 0 && c, b = this.getNumberRegex(!1, x), w = new RegExp("-"), P = typeof d == "string";
|
|
401
401
|
if (this.selectionBeforeInput = {
|
|
402
402
|
selectionStart: o,
|
|
403
403
|
selectionEnd: s
|
|
404
404
|
}, r === "ArrowLeft" || r === "Backspace" ? n = o - 1 : r === "ArrowRight" ? n = o + 1 : r === "Delete" && (n = o), n === void 0 || o !== s) {
|
|
405
|
-
|
|
405
|
+
v(e);
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
var
|
|
408
|
+
var g = n, N = P ? d.indexOf("#") : h.length, F = P ? d.lastIndexOf("#") + 1 : i.length - m.length;
|
|
409
409
|
if (r === "ArrowLeft" || r === "ArrowRight") {
|
|
410
|
-
var
|
|
411
|
-
|
|
412
|
-
} else if (r === "Delete" && !
|
|
413
|
-
for (; !
|
|
414
|
-
|
|
415
|
-
else if (r === "Backspace" && !
|
|
410
|
+
var T = r === "ArrowLeft" ? "left" : "right";
|
|
411
|
+
g = this.correctCaretPosition(i, n, T);
|
|
412
|
+
} else if (r === "Delete" && !b.test(i[n]) && !w.test(i[n]))
|
|
413
|
+
for (; !b.test(i[g]) && g < F; )
|
|
414
|
+
g++;
|
|
415
|
+
else if (r === "Backspace" && !b.test(i[n])) {
|
|
416
416
|
if (o <= N + 1 && i[0] === "-" && typeof d > "u") {
|
|
417
|
-
var
|
|
417
|
+
var $ = i.substring(1);
|
|
418
418
|
this.updateValue({
|
|
419
|
-
formattedValue:
|
|
420
|
-
caretPos:
|
|
419
|
+
formattedValue: $,
|
|
420
|
+
caretPos: g,
|
|
421
421
|
input: t,
|
|
422
422
|
event: e,
|
|
423
423
|
source: "event"
|
|
424
424
|
});
|
|
425
425
|
} else if (!w.test(i[n])) {
|
|
426
|
-
for (; !
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
for (; !b.test(i[g - 1]) && g > N; )
|
|
427
|
+
g--;
|
|
428
|
+
g = this.correctCaretPosition(i, g, "left");
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
(
|
|
431
|
+
(g !== n || n < N || n > F) && (e.preventDefault(), this.setPatchedCaretPosition(t, g, i)), e.isUnitTestRun && this.setPatchedCaretPosition(t, g, i), v(e);
|
|
432
432
|
}, f.prototype.onMouseUp = function(e) {
|
|
433
433
|
var t = e.target, r = t.selectionStart, o = t.selectionEnd, s = t.value;
|
|
434
434
|
if (s === void 0 && (s = ""), r === o) {
|
|
@@ -447,7 +447,7 @@ var Ne = {
|
|
|
447
447
|
}, f.prototype.render = function() {
|
|
448
448
|
var e = this.props, t = e.type, r = e.displayType, o = e.customInput, s = e.renderText, i = e.getInputRef, n = e.format;
|
|
449
449
|
e.thousandSeparator, e.decimalSeparator, e.allowedDecimalSeparators, e.thousandsGroupStyle, e.decimalScale, e.fixedDecimalScale, e.prefix, e.suffix, e.removeFormatting, e.mask, e.defaultValue, e.isNumericString, e.allowNegative, e.allowEmptyFormatting, e.allowLeadingZeros, e.onValueChange, e.isAllowed, e.customNumerals, e.onChange, e.onKeyDown, e.onMouseUp, e.onFocus, e.onBlur, e.value;
|
|
450
|
-
var l = be(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "thousandSeparator", "decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "decimalScale", "fixedDecimalScale", "prefix", "suffix", "removeFormatting", "mask", "defaultValue", "isNumericString", "allowNegative", "allowEmptyFormatting", "allowLeadingZeros", "onValueChange", "isAllowed", "customNumerals", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value"]), p = l, c = this.state, h = c.value, m = c.mounted, d = m && xe(n) ? "numeric" : void 0,
|
|
450
|
+
var l = be(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "thousandSeparator", "decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "decimalScale", "fixedDecimalScale", "prefix", "suffix", "removeFormatting", "mask", "defaultValue", "isNumericString", "allowNegative", "allowEmptyFormatting", "allowLeadingZeros", "onValueChange", "isAllowed", "customNumerals", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value"]), p = l, c = this.state, h = c.value, m = c.mounted, d = m && xe(n) ? "numeric" : void 0, v = Object.assign({ inputMode: d }, p, {
|
|
451
451
|
type: t,
|
|
452
452
|
value: h,
|
|
453
453
|
onChange: this.onChange,
|
|
@@ -457,25 +457,25 @@ var Ne = {
|
|
|
457
457
|
onBlur: this.onBlur
|
|
458
458
|
});
|
|
459
459
|
if (r === "text")
|
|
460
|
-
return s ? s(h, p) || null :
|
|
460
|
+
return s ? s(h, p) || null : B.createElement(
|
|
461
461
|
"span",
|
|
462
462
|
Object.assign({}, p, { ref: i }),
|
|
463
463
|
h
|
|
464
464
|
);
|
|
465
465
|
if (o) {
|
|
466
|
-
var
|
|
467
|
-
return
|
|
466
|
+
var x = o;
|
|
467
|
+
return B.createElement(x, Object.assign({}, v, { ref: i }));
|
|
468
468
|
}
|
|
469
|
-
return
|
|
469
|
+
return B.createElement("input", Object.assign({}, v, { ref: i }));
|
|
470
470
|
}, f;
|
|
471
|
-
}(
|
|
471
|
+
}(B.Component);
|
|
472
472
|
X.defaultProps = Ne;
|
|
473
473
|
const we = G.div`
|
|
474
474
|
display: flex;
|
|
475
475
|
align-items: center;
|
|
476
476
|
|
|
477
|
-
min-height: ${(a) =>
|
|
478
|
-
max-height: ${(a) =>
|
|
477
|
+
min-height: ${(a) => M(a.theme, a.size)};
|
|
478
|
+
max-height: ${(a) => M(a.theme, a.size)};
|
|
479
479
|
background-color: ${(a) => R(
|
|
480
480
|
a.theme,
|
|
481
481
|
"Input",
|
|
@@ -512,8 +512,8 @@ const we = G.div`
|
|
|
512
512
|
width: 100%;
|
|
513
513
|
|
|
514
514
|
${(a) => ce(a.theme, "Input", a.size, "enabled")}
|
|
515
|
-
min-height: ${(a) =>
|
|
516
|
-
max-height: ${(a) =>
|
|
515
|
+
min-height: ${(a) => M(a.theme, a.size)};
|
|
516
|
+
max-height: ${(a) => M(a.theme, a.size)};
|
|
517
517
|
color: ${(a) => R(
|
|
518
518
|
a.theme,
|
|
519
519
|
"Input",
|
|
@@ -571,31 +571,31 @@ const we = G.div`
|
|
|
571
571
|
onBlur: m,
|
|
572
572
|
onFocus: d,
|
|
573
573
|
//----------------
|
|
574
|
-
className:
|
|
575
|
-
style:
|
|
576
|
-
size:
|
|
574
|
+
className: v = "",
|
|
575
|
+
style: x = {},
|
|
576
|
+
size: b = "small",
|
|
577
577
|
color: w = "primary",
|
|
578
578
|
...P
|
|
579
|
-
} = a,
|
|
580
|
-
fe((
|
|
579
|
+
} = a, g = pe(), [N, F] = ne(!1), T = se(
|
|
580
|
+
fe((y, D) => $(y, D), t),
|
|
581
581
|
[c]
|
|
582
|
-
),
|
|
583
|
-
c && (c == null || c(
|
|
584
|
-
},
|
|
585
|
-
|
|
586
|
-
},
|
|
587
|
-
F(!0), d == null || d(
|
|
588
|
-
}, A = (
|
|
589
|
-
F(!1), m == null || m(
|
|
582
|
+
), $ = (y, D) => {
|
|
583
|
+
c && (c == null || c(y, D));
|
|
584
|
+
}, O = (y, D) => {
|
|
585
|
+
T(D.event, y == null ? void 0 : y.floatValue);
|
|
586
|
+
}, j = () => n < 0 ? 0 : n > 17 ? 17 : n, k = (y) => {
|
|
587
|
+
F(!0), d == null || d(y);
|
|
588
|
+
}, A = (y) => {
|
|
589
|
+
F(!1), m == null || m(y);
|
|
590
590
|
};
|
|
591
591
|
return /* @__PURE__ */ ie(
|
|
592
592
|
we,
|
|
593
593
|
{
|
|
594
|
-
style:
|
|
595
|
-
className:
|
|
596
|
-
theme:
|
|
594
|
+
style: x,
|
|
595
|
+
className: v,
|
|
596
|
+
theme: g,
|
|
597
597
|
color: w,
|
|
598
|
-
size:
|
|
598
|
+
size: b,
|
|
599
599
|
prefix: r,
|
|
600
600
|
suffix: o,
|
|
601
601
|
focused: N,
|
|
@@ -605,7 +605,7 @@ const we = G.div`
|
|
|
605
605
|
r && /* @__PURE__ */ K(
|
|
606
606
|
Y,
|
|
607
607
|
{
|
|
608
|
-
theme:
|
|
608
|
+
theme: g,
|
|
609
609
|
color: w,
|
|
610
610
|
focused: N,
|
|
611
611
|
className: "lnc-input-prefix",
|
|
@@ -621,19 +621,19 @@ const we = G.div`
|
|
|
621
621
|
readOnly: e,
|
|
622
622
|
thousandSeparator: s,
|
|
623
623
|
decimalSeparator: i,
|
|
624
|
-
decimalScale:
|
|
624
|
+
decimalScale: j(),
|
|
625
625
|
fixedDecimalScale: l,
|
|
626
626
|
allowNegative: p,
|
|
627
627
|
onFocus: k,
|
|
628
628
|
onBlur: A,
|
|
629
|
-
onValueChange:
|
|
629
|
+
onValueChange: O,
|
|
630
630
|
...P
|
|
631
631
|
}
|
|
632
632
|
),
|
|
633
633
|
o && /* @__PURE__ */ K(
|
|
634
634
|
De,
|
|
635
635
|
{
|
|
636
|
-
theme:
|
|
636
|
+
theme: g,
|
|
637
637
|
color: w,
|
|
638
638
|
focused: N,
|
|
639
639
|
className: "lnc-input-suffix",
|
package/dist/Modal.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),y=require("react"),o=require("./index-BIlhCoy2.cjs"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),y=require("react"),o=require("./index-BIlhCoy2.cjs"),C=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),D=require("./Icon.cjs"),j=require("./utils-DTAPpJXU.cjs"),V=require("./index-Ct1N7fF4.cjs"),L=require("./motion-Oud-wpUz.cjs"),G=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),I=require("./index-BP5r5zGN.cjs"),x="5rem",h="3.8rem",i="1.5rem",W=(e,r,n)=>r&&n?e=="FULL"?`calc(100dvh - ${h} - ${x})`:`calc(100dvh - ${h} - ${x} - ${i})`:r?e=="FULL"?`calc(100dvh - ${h})`:`calc(100dvh - ${h} - ${i})`:n?e=="FULL"?`calc(100dvh - ${x})`:`calc(100dvh - ${x} - ${i})`:e=="FULL"?"100dvh":`calc(100dvh - ${i})`,X=e=>e=="FULL"?"100vw":`calc(100vw - ${i})`,J=(e,r,n)=>e=="FULL"?"0":`${r?"0":"16px"} 0 ${n?"0":"16px"} 0`,K=C.newStyled(L.motion.div)`
|
|
2
2
|
position: ${e=>e.scrollOverlay==!0?"absolute":"fixed"};
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
background: ${e=>e.scrollOverlay===!0?"transparent":e.overlayColor};
|
|
8
8
|
z-index: ${e=>e.zIndex};
|
|
9
9
|
display: flex;
|
|
10
|
-
`,
|
|
10
|
+
`,Q=C.newStyled(L.motion.div)`
|
|
11
11
|
position: relative;
|
|
12
12
|
width: 50%;
|
|
13
13
|
background-color: white;
|
|
14
14
|
${e=>e.scrollOverlay==!1?"position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);":"height: fit-content; margin-right: auto; margin-left: auto;"}
|
|
15
|
-
background-color: ${e=>
|
|
15
|
+
background-color: ${e=>j.getColorRgbaValue(e.theme,"Modal","default","enabled","bg")};
|
|
16
16
|
z-index: ${e=>e.zIndex};
|
|
17
|
-
width: ${e=>
|
|
18
|
-
max-width: ${e=>
|
|
17
|
+
width: ${e=>ee[e.size.toUpperCase()]};
|
|
18
|
+
max-width: ${e=>X(e.size.toUpperCase())};
|
|
19
19
|
box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
20
20
|
0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
21
21
|
border-radius: ${e=>e.size.toUpperCase()!="FULL"?"16px":"0"};
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
& .lnc-modal-header {
|
|
27
27
|
max-height: ${h};
|
|
28
28
|
overflow: hidden;
|
|
29
|
-
padding: ${
|
|
29
|
+
padding: ${i} ${i} 0 ${i};
|
|
30
30
|
}
|
|
31
31
|
& .lnc-modal-header > h1,
|
|
32
32
|
h2,
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
flex-direction: column;
|
|
46
46
|
justify-content: space-between;
|
|
47
47
|
scrollbar-width: thin;
|
|
48
|
-
${e=>e.scrollOverlay==!1&&`max-height: ${
|
|
48
|
+
${e=>e.scrollOverlay==!1&&`max-height: ${W(e.size.toUpperCase(),e.header,e.footer)};`}
|
|
49
49
|
overflow: auto;
|
|
50
|
-
margin: ${e=>
|
|
51
|
-
padding: 0 ${
|
|
50
|
+
margin: ${e=>J(e.size,e.header,e.footer)};
|
|
51
|
+
padding: 0 ${i} 0 ${i};
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,Y=C.newStyled.div`
|
|
54
54
|
position: absolute;
|
|
55
55
|
cursor: pointer;
|
|
56
56
|
top: 1.375rem;
|
|
57
57
|
right: 1.375rem;
|
|
58
|
-
color: ${e=>
|
|
58
|
+
color: ${e=>j.getColorRgbaValue(e.theme,"Modal","primary","enabled","cancelButton")};
|
|
59
59
|
height: 1.5rem;
|
|
60
60
|
width: 1.5rem;
|
|
61
61
|
display: flex;
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
&:hover {
|
|
70
|
-
background-color: ${e=>
|
|
70
|
+
background-color: ${e=>j.getColorRgbaValue(e.theme,"Modal","primary","hover","cancelBtnBg","cancelBtnBgOpacity")};
|
|
71
71
|
}
|
|
72
72
|
&:focus {
|
|
73
|
-
background-color: ${e=>
|
|
73
|
+
background-color: ${e=>j.getColorRgbaValue(e.theme,"Modal","primary","focus","cancelBtnBg","cancelBtnBgOpacity")};
|
|
74
74
|
}
|
|
75
|
-
`,
|
|
75
|
+
`,Z=C.newStyled(L.motion.div)`
|
|
76
76
|
display: ${e=>e.scrollOverlay===!0?"block":"none"};
|
|
77
77
|
position: fixed;
|
|
78
78
|
top: 0;
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
width: 100%;
|
|
82
82
|
background-color: ${e=>e.overlayColor};
|
|
83
83
|
z-index: 3;
|
|
84
|
-
`,N=y.forwardRef((e,r)=>{const{portalElement:n=document.body,isOpen:s=!1,header:d,footer:
|
|
84
|
+
`,N=y.forwardRef((e,r)=>{const{portalElement:n=document.body,isOpen:s=!1,header:d,footer:l,scrollOverlay:a=!1,overlay:c=!0,overlayColor:p="rgba(0, 0, 0, 0.3)",showCloseButton:u=!0,onOpen:f=()=>{},onClose:g=()=>{},zIndex:O=1e3,size:$="fluid",clickOutsideToClose:v=!0,className:b="",style:A={},overlayProps:P,overlayAnimation:F={animate:{opacity:1},exit:{opacity:0},initial:{opacity:0},transition:{type:"spring",duration:.6}},modalAnimation:U={animate:{opacity:1},exit:{opacity:0},initial:{opacity:0},transition:{type:"spring",duration:.6}},onFinishOpen:H=()=>{},children:z,rest:M}=e,R=y.useRef(),[T,k]=y.useState(s);let B={theme:G.useTheme(),size:$,zIndex:O,className:b,style:A};const S=m=>{m.target===m.currentTarget&&v&&w(m)};y.useImperativeHandle(r,()=>({open(){_()},close(){w()},isOpen(){return T}}));const _=m=>{k(!0),f(m)},w=m=>{k(!1),g(m)};return y.useEffect(()=>{T===!0&&H()},[T]),t.jsx(t.Fragment,{children:T&&t.jsx(t.Fragment,{children:n?t.jsx(t.Fragment,{children:V.reactDomExports.createPortal(t.jsx(q,{ref:R,overlay:c,scrollOverlay:a,onClickOutsideModal:S,overlayColor:p,overlayProps:P,overlayAnimation:F,modalAnimation:U,themeProps:B,showCloseButton:u,close:w,header:d,footer:l,isOpen:s,...M,children:z}),n)}):t.jsx(q,{ref:R,overlay:c,scrollOverlay:a,onClickOutsideModal:S,overlayColor:p,overlayProps:P,overlayAnimation:F,modalAnimation:U,themeProps:B,showCloseButton:u,close:w,header:d,footer:l,isOpen:s,...M,children:z})})})}),q=y.forwardRef(({overlay:e,scrollOverlay:r,onClickOutsideModal:n,overlayColor:s,overlayProps:d,overlayAnimation:l,modalAnimation:a,themeProps:c,showCloseButton:p,header:u,footer:f,close:g,isOpen:O,children:$,...v},b)=>t.jsx(I.AnimatePresence,{children:e?t.jsxs(t.Fragment,{children:[t.jsx(Z,{scrollOverlay:r,onClick:n,overlayColor:s,...d,...l}),t.jsx(K,{...c,onClick:n,scrollOverlay:r,overlayColor:s,isOpen:O,...d,...l,children:t.jsx(E,{ref:b,themeProps:c,scrollOverlay:r,modalAnimation:a,showCloseButton:p,close:g,header:u,footer:f,...v,children:$})})]}):t.jsx(E,{ref:b,themeProps:c,modalAnimation:a,showCloseButton:p,close:g,header:u,footer:f,...v,children:$})})),E=y.forwardRef(({themeProps:e,scrollOverlay:r,modalAnimation:n,showCloseButton:s,close:d,header:l,footer:a,children:c,...p},u)=>t.jsx(I.AnimatePresence,{children:t.jsxs(Q,{ref:u,...e,...n,header:l,footer:a,scrollOverlay:r,...p,className:`modal-lnc-container ${e==null?void 0:e.className}`,children:[s&&t.jsx(Y,{...e,className:"modal-lnc-times",onClick:d,children:t.jsx(D,{icon:"times"})}),l&&t.jsx("div",{className:"lnc-modal-header",children:l}),t.jsx("div",{className:"lnc-modal-content",children:c}),a&&t.jsx("div",{className:"lnc-modal-footer",children:a})]})}));N.propTypes={portalElement:o.PropTypes.any,isOpen:o.PropTypes.bool,header:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.element]),footer:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.element]),showCloseButton:o.PropTypes.bool,overlay:o.PropTypes.bool,scrollOverlay:o.PropTypes.bool,onOpen:o.PropTypes.func,onClose:o.PropTypes.func,zIndex:o.PropTypes.number,clickOutsideToClose:o.PropTypes.bool,overlayColor:o.PropTypes.string,overlayAnimation:o.PropTypes.object,modalAnimation:o.PropTypes.object,className:o.PropTypes.string,style:o.PropTypes.object,size:o.PropTypes.oneOf(["fluid","xs","s","m","l","xl","full"]),overlayProps:o.PropTypes.any};const ee={FLUID:"max-content",XS:"320px",S:"412px",M:"672px",L:"1112px",XL:"1376px",FULL:"100vw"};module.exports=N;
|
package/dist/Modal.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as t, Fragment as L, jsxs as D } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as z, useRef as X, useState as V, useImperativeHandle as q, useEffect as J } from "react";
|
|
3
3
|
import { P as o } from "./index-BYnWp42a.js";
|
|
4
|
-
import { n as
|
|
5
|
-
import
|
|
6
|
-
import { a as
|
|
7
|
-
import { r as
|
|
8
|
-
import { m as
|
|
9
|
-
import { u as
|
|
4
|
+
import { n as C } from "./emotion-styled.browser.esm-BiK8DcgW.js";
|
|
5
|
+
import K from "./Icon.js";
|
|
6
|
+
import { a as w } from "./utils-C52T57HO.js";
|
|
7
|
+
import { r as Q } from "./index--Kmch3aI.js";
|
|
8
|
+
import { m as M } from "./motion-ecIGZGwI.js";
|
|
9
|
+
import { u as Y } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
|
|
10
10
|
import { A as R } from "./index-BUChtubz.js";
|
|
11
|
-
const f = "5rem", h = "3.8rem", a = "1.5rem",
|
|
11
|
+
const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, n, r) => n && r ? e == "FULL" ? `calc(100dvh - ${h} - ${f})` : `calc(100dvh - ${h} - ${f} - ${a})` : n ? e == "FULL" ? `calc(100dvh - ${h})` : `calc(100dvh - ${h} - ${a})` : r ? e == "FULL" ? `calc(100dvh - ${f})` : `calc(100dvh - ${f} - ${a})` : e == "FULL" ? "100dvh" : `calc(100dvh - ${a})`, P = (e) => e == "FULL" ? "100vw" : `calc(100vw - ${a})`, ee = (e, n, r) => e == "FULL" ? "0" : `${n ? "0" : "16px"} 0 ${r ? "0" : "16px"} 0`, oe = C(M.div)`
|
|
12
12
|
position: ${(e) => e.scrollOverlay == !0 ? "absolute" : "fixed"};
|
|
13
13
|
top: 0;
|
|
14
14
|
left: 0;
|
|
@@ -17,15 +17,15 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
17
17
|
background: ${(e) => e.scrollOverlay === !0 ? "transparent" : e.overlayColor};
|
|
18
18
|
z-index: ${(e) => e.zIndex};
|
|
19
19
|
display: flex;
|
|
20
|
-
`,
|
|
20
|
+
`, te = C(M.div)`
|
|
21
21
|
position: relative;
|
|
22
22
|
width: 50%;
|
|
23
23
|
background-color: white;
|
|
24
24
|
${(e) => e.scrollOverlay == !1 ? "position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);" : "height: fit-content; margin-right: auto; margin-left: auto;"}
|
|
25
|
-
background-color: ${(e) =>
|
|
25
|
+
background-color: ${(e) => w(e.theme, "Modal", "default", "enabled", "bg")};
|
|
26
26
|
z-index: ${(e) => e.zIndex};
|
|
27
|
-
width: ${(e) =>
|
|
28
|
-
max-width: ${(e) =>
|
|
27
|
+
width: ${(e) => le[e.size.toUpperCase()]};
|
|
28
|
+
max-width: ${(e) => P(e.size.toUpperCase())};
|
|
29
29
|
box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
30
30
|
0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
31
31
|
border-radius: ${(e) => e.size.toUpperCase() != "FULL" ? "16px" : "0"};
|
|
@@ -55,21 +55,21 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
55
55
|
flex-direction: column;
|
|
56
56
|
justify-content: space-between;
|
|
57
57
|
scrollbar-width: thin;
|
|
58
|
-
${(e) => e.scrollOverlay == !1 && `max-height: ${
|
|
58
|
+
${(e) => e.scrollOverlay == !1 && `max-height: ${Z(
|
|
59
59
|
e.size.toUpperCase(),
|
|
60
60
|
e.header,
|
|
61
61
|
e.footer
|
|
62
62
|
)};`}
|
|
63
63
|
overflow: auto;
|
|
64
|
-
margin: ${(e) =>
|
|
64
|
+
margin: ${(e) => ee(e.size, e.header, e.footer)};
|
|
65
65
|
padding: 0 ${a} 0 ${a};
|
|
66
66
|
}
|
|
67
|
-
`,
|
|
67
|
+
`, ne = C.div`
|
|
68
68
|
position: absolute;
|
|
69
69
|
cursor: pointer;
|
|
70
70
|
top: 1.375rem;
|
|
71
71
|
right: 1.375rem;
|
|
72
|
-
color: ${(e) =>
|
|
72
|
+
color: ${(e) => w(
|
|
73
73
|
e.theme,
|
|
74
74
|
"Modal",
|
|
75
75
|
"primary",
|
|
@@ -87,7 +87,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
&:hover {
|
|
90
|
-
background-color: ${(e) =>
|
|
90
|
+
background-color: ${(e) => w(
|
|
91
91
|
e.theme,
|
|
92
92
|
"Modal",
|
|
93
93
|
"primary",
|
|
@@ -97,7 +97,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
97
97
|
)};
|
|
98
98
|
}
|
|
99
99
|
&:focus {
|
|
100
|
-
background-color: ${(e) =>
|
|
100
|
+
background-color: ${(e) => w(
|
|
101
101
|
e.theme,
|
|
102
102
|
"Modal",
|
|
103
103
|
"primary",
|
|
@@ -106,7 +106,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
106
106
|
"cancelBtnBgOpacity"
|
|
107
107
|
)};
|
|
108
108
|
}
|
|
109
|
-
`,
|
|
109
|
+
`, re = C(M.div)`
|
|
110
110
|
display: ${(e) => e.scrollOverlay === !0 ? "block" : "none"};
|
|
111
111
|
position: fixed;
|
|
112
112
|
top: 0;
|
|
@@ -115,9 +115,9 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
115
115
|
width: 100%;
|
|
116
116
|
background-color: ${(e) => e.overlayColor};
|
|
117
117
|
z-index: 3;
|
|
118
|
-
`,
|
|
118
|
+
`, ae = z((e, n) => {
|
|
119
119
|
const {
|
|
120
|
-
portalElement:
|
|
120
|
+
portalElement: r = document.body,
|
|
121
121
|
isOpen: c = !1,
|
|
122
122
|
header: d,
|
|
123
123
|
footer: l,
|
|
@@ -129,12 +129,12 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
129
129
|
},
|
|
130
130
|
onClose: x = () => {
|
|
131
131
|
},
|
|
132
|
-
zIndex:
|
|
132
|
+
zIndex: U = 1e3,
|
|
133
133
|
size: y = "fluid",
|
|
134
134
|
clickOutsideToClose: $ = !0,
|
|
135
135
|
className: v = "",
|
|
136
136
|
style: G = {},
|
|
137
|
-
overlayProps:
|
|
137
|
+
overlayProps: F,
|
|
138
138
|
overlayAnimation: k = {
|
|
139
139
|
animate: { opacity: 1 },
|
|
140
140
|
exit: { opacity: 0 },
|
|
@@ -143,7 +143,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
143
143
|
},
|
|
144
144
|
transition: { type: "spring", duration: 0.6 }
|
|
145
145
|
},
|
|
146
|
-
modalAnimation:
|
|
146
|
+
modalAnimation: B = {
|
|
147
147
|
animate: { opacity: 1 },
|
|
148
148
|
exit: { opacity: 0 },
|
|
149
149
|
initial: {
|
|
@@ -151,78 +151,82 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
151
151
|
},
|
|
152
152
|
transition: { type: "spring", duration: 0.6 }
|
|
153
153
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
onFinishOpen: _ = () => {
|
|
155
|
+
},
|
|
156
|
+
children: T,
|
|
157
|
+
rest: I
|
|
158
|
+
} = e, E = X(), [b, N] = V(c);
|
|
159
|
+
let j = { theme: Y(), size: y, zIndex: U, className: v, style: G };
|
|
158
160
|
const A = (u) => {
|
|
159
|
-
u.target === u.currentTarget && $ &&
|
|
161
|
+
u.target === u.currentTarget && $ && O(u);
|
|
160
162
|
};
|
|
161
|
-
|
|
163
|
+
q(n, () => ({
|
|
162
164
|
open() {
|
|
163
|
-
|
|
165
|
+
W();
|
|
164
166
|
},
|
|
165
167
|
close() {
|
|
166
|
-
|
|
168
|
+
O();
|
|
167
169
|
},
|
|
168
170
|
isOpen() {
|
|
169
|
-
return
|
|
171
|
+
return b;
|
|
170
172
|
}
|
|
171
173
|
}));
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
|
|
174
|
+
const W = (u) => {
|
|
175
|
+
N(!0), g(u);
|
|
176
|
+
}, O = (u) => {
|
|
177
|
+
N(!1), x(u);
|
|
176
178
|
};
|
|
177
|
-
return
|
|
179
|
+
return J(() => {
|
|
180
|
+
b === !0 && _();
|
|
181
|
+
}, [b]), /* @__PURE__ */ t(L, { children: b && /* @__PURE__ */ t(L, { children: r ? /* @__PURE__ */ t(L, { children: Q.createPortal(
|
|
178
182
|
/* @__PURE__ */ t(
|
|
179
183
|
H,
|
|
180
184
|
{
|
|
181
|
-
ref:
|
|
185
|
+
ref: E,
|
|
182
186
|
overlay: s,
|
|
183
187
|
scrollOverlay: i,
|
|
184
188
|
onClickOutsideModal: A,
|
|
185
189
|
overlayColor: m,
|
|
186
|
-
overlayProps:
|
|
190
|
+
overlayProps: F,
|
|
187
191
|
overlayAnimation: k,
|
|
188
|
-
modalAnimation:
|
|
192
|
+
modalAnimation: B,
|
|
189
193
|
themeProps: j,
|
|
190
194
|
showCloseButton: p,
|
|
191
|
-
close:
|
|
195
|
+
close: O,
|
|
192
196
|
header: d,
|
|
193
197
|
footer: l,
|
|
194
198
|
isOpen: c,
|
|
195
|
-
...
|
|
196
|
-
children:
|
|
199
|
+
...I,
|
|
200
|
+
children: T
|
|
197
201
|
}
|
|
198
202
|
),
|
|
199
|
-
|
|
203
|
+
r
|
|
200
204
|
) }) : /* @__PURE__ */ t(
|
|
201
205
|
H,
|
|
202
206
|
{
|
|
203
|
-
ref:
|
|
207
|
+
ref: E,
|
|
204
208
|
overlay: s,
|
|
205
209
|
scrollOverlay: i,
|
|
206
210
|
onClickOutsideModal: A,
|
|
207
211
|
overlayColor: m,
|
|
208
|
-
overlayProps:
|
|
212
|
+
overlayProps: F,
|
|
209
213
|
overlayAnimation: k,
|
|
210
|
-
modalAnimation:
|
|
214
|
+
modalAnimation: B,
|
|
211
215
|
themeProps: j,
|
|
212
216
|
showCloseButton: p,
|
|
213
|
-
close:
|
|
217
|
+
close: O,
|
|
214
218
|
header: d,
|
|
215
219
|
footer: l,
|
|
216
220
|
isOpen: c,
|
|
217
|
-
...
|
|
218
|
-
children:
|
|
221
|
+
...I,
|
|
222
|
+
children: T
|
|
219
223
|
}
|
|
220
224
|
) }) });
|
|
221
|
-
}), H =
|
|
225
|
+
}), H = z(
|
|
222
226
|
({
|
|
223
227
|
overlay: e,
|
|
224
|
-
scrollOverlay:
|
|
225
|
-
onClickOutsideModal:
|
|
228
|
+
scrollOverlay: n,
|
|
229
|
+
onClickOutsideModal: r,
|
|
226
230
|
overlayColor: c,
|
|
227
231
|
overlayProps: d,
|
|
228
232
|
overlayAnimation: l,
|
|
@@ -232,28 +236,28 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
232
236
|
header: p,
|
|
233
237
|
footer: g,
|
|
234
238
|
close: x,
|
|
235
|
-
isOpen:
|
|
239
|
+
isOpen: U,
|
|
236
240
|
children: y,
|
|
237
241
|
...$
|
|
238
242
|
}, v) => /* @__PURE__ */ t(R, { children: e ? /* @__PURE__ */ D(L, { children: [
|
|
239
243
|
/* @__PURE__ */ t(
|
|
240
|
-
|
|
244
|
+
re,
|
|
241
245
|
{
|
|
242
|
-
scrollOverlay:
|
|
243
|
-
onClick:
|
|
246
|
+
scrollOverlay: n,
|
|
247
|
+
onClick: r,
|
|
244
248
|
overlayColor: c,
|
|
245
249
|
...d,
|
|
246
250
|
...l
|
|
247
251
|
}
|
|
248
252
|
),
|
|
249
253
|
/* @__PURE__ */ t(
|
|
250
|
-
|
|
254
|
+
oe,
|
|
251
255
|
{
|
|
252
256
|
...s,
|
|
253
|
-
onClick:
|
|
254
|
-
scrollOverlay:
|
|
257
|
+
onClick: r,
|
|
258
|
+
scrollOverlay: n,
|
|
255
259
|
overlayColor: c,
|
|
256
|
-
isOpen:
|
|
260
|
+
isOpen: U,
|
|
257
261
|
...d,
|
|
258
262
|
...l,
|
|
259
263
|
children: /* @__PURE__ */ t(
|
|
@@ -261,7 +265,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
261
265
|
{
|
|
262
266
|
ref: v,
|
|
263
267
|
themeProps: s,
|
|
264
|
-
scrollOverlay:
|
|
268
|
+
scrollOverlay: n,
|
|
265
269
|
modalAnimation: i,
|
|
266
270
|
showCloseButton: m,
|
|
267
271
|
close: x,
|
|
@@ -287,11 +291,11 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
287
291
|
children: y
|
|
288
292
|
}
|
|
289
293
|
) })
|
|
290
|
-
), S =
|
|
294
|
+
), S = z(
|
|
291
295
|
({
|
|
292
296
|
themeProps: e,
|
|
293
|
-
scrollOverlay:
|
|
294
|
-
modalAnimation:
|
|
297
|
+
scrollOverlay: n,
|
|
298
|
+
modalAnimation: r,
|
|
295
299
|
showCloseButton: c,
|
|
296
300
|
close: d,
|
|
297
301
|
header: l,
|
|
@@ -299,24 +303,24 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
299
303
|
children: s,
|
|
300
304
|
...m
|
|
301
305
|
}, p) => /* @__PURE__ */ t(R, { children: /* @__PURE__ */ D(
|
|
302
|
-
|
|
306
|
+
te,
|
|
303
307
|
{
|
|
304
308
|
ref: p,
|
|
305
309
|
...e,
|
|
306
|
-
...
|
|
310
|
+
...r,
|
|
307
311
|
header: l,
|
|
308
312
|
footer: i,
|
|
309
|
-
scrollOverlay:
|
|
313
|
+
scrollOverlay: n,
|
|
310
314
|
...m,
|
|
311
315
|
className: `modal-lnc-container ${e == null ? void 0 : e.className}`,
|
|
312
316
|
children: [
|
|
313
317
|
c && /* @__PURE__ */ t(
|
|
314
|
-
|
|
318
|
+
ne,
|
|
315
319
|
{
|
|
316
320
|
...e,
|
|
317
321
|
className: "modal-lnc-times",
|
|
318
322
|
onClick: d,
|
|
319
|
-
children: /* @__PURE__ */ t(
|
|
323
|
+
children: /* @__PURE__ */ t(K, { icon: "times" })
|
|
320
324
|
}
|
|
321
325
|
),
|
|
322
326
|
l && /* @__PURE__ */ t("div", { className: "lnc-modal-header", children: l }),
|
|
@@ -326,7 +330,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Q = (e, r, n) => r && n ? e == "FU
|
|
|
326
330
|
}
|
|
327
331
|
) })
|
|
328
332
|
);
|
|
329
|
-
|
|
333
|
+
ae.propTypes = {
|
|
330
334
|
/**
|
|
331
335
|
* If the value is given modal will use createPortal to be rendered in portalElement
|
|
332
336
|
*/
|
|
@@ -358,7 +362,7 @@ re.propTypes = {
|
|
|
358
362
|
size: o.oneOf(["fluid", "xs", "s", "m", "l", "xl", "full"]),
|
|
359
363
|
overlayProps: o.any
|
|
360
364
|
};
|
|
361
|
-
const
|
|
365
|
+
const le = {
|
|
362
366
|
FLUID: "max-content",
|
|
363
367
|
XS: "320px",
|
|
364
368
|
S: "412px",
|
|
@@ -368,5 +372,5 @@ const ne = {
|
|
|
368
372
|
FULL: "100vw"
|
|
369
373
|
};
|
|
370
374
|
export {
|
|
371
|
-
|
|
375
|
+
ae as default
|
|
372
376
|
};
|