@lanaco/lnc-react-ui 4.0.199 → 4.0.201
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/Accordion.cjs +5 -5
- package/dist/Accordion.js +45 -56
- package/dist/AccordionDetails.cjs +3 -3
- package/dist/AccordionDetails.js +11 -25
- package/dist/AccordionSummary.cjs +4 -4
- package/dist/AccordionSummary.js +34 -44
- package/dist/ActionsToolbar.cjs +2 -3
- package/dist/ActionsToolbar.js +83 -135
- package/dist/Alert.cjs +10 -10
- package/dist/Alert.js +32 -64
- package/dist/Avatar.cjs +9 -9
- package/dist/Avatar.js +33 -72
- package/dist/Badge.cjs +6 -6
- package/dist/Badge.js +22 -47
- package/dist/BannerSectionCarousel.cjs +4 -4
- package/dist/BannerSectionCarousel.js +51 -542
- package/dist/BlogCardsSponsoredSection.cjs +1 -1
- package/dist/BlogCardsSponsoredSection.js +1 -1
- package/dist/BlogCategoryCardsSection.cjs +1 -1
- package/dist/BlogCategoryCardsSection.js +12 -14
- package/dist/BlogExploreSection.cjs +1 -1
- package/dist/BlogExploreSection.js +1 -1
- package/dist/BlogListSection.cjs +1 -1
- package/dist/BlogListSection.js +1 -1
- package/dist/BlogsSectionDetailed.cjs +1 -1
- package/dist/BlogsSectionDetailed.js +1 -1
- package/dist/BlogsSectionSimple.cjs +1 -1
- package/dist/BlogsSectionSimple.js +1 -1
- package/dist/BlogsSectionWithFilters.cjs +1 -1
- package/dist/BlogsSectionWithFilters.js +2 -2
- package/dist/Breadcrumbs.cjs +5 -5
- package/dist/Breadcrumbs.js +57 -87
- package/dist/Button.cjs +11 -11
- package/dist/Button.js +126 -173
- package/dist/ButtonGroup.cjs +8 -8
- package/dist/ButtonGroup.js +37 -49
- package/dist/CalorieCalculatorSection.cjs +8 -8
- package/dist/CalorieCalculatorSection.js +90 -97
- package/dist/CheckBoxInput.cjs +1 -1
- package/dist/CheckBoxInput.js +2 -5
- package/dist/Chip.cjs +14 -14
- package/dist/Chip.js +73 -111
- package/dist/ConfirmationForm.cjs +6 -6
- package/dist/ConfirmationForm.js +67 -109
- package/dist/ContactSection.cjs +1 -0
- package/dist/ContactSection.js +1 -0
- package/dist/Content.cjs +1 -1
- package/dist/Content.js +7 -15
- package/dist/{DailyMotion-ByXblnua.js → DailyMotion-BBcJkMo_.js} +1 -1
- package/dist/{DailyMotion-BaFUcQKQ.cjs → DailyMotion-CpZExcrg.cjs} +1 -1
- package/dist/DataView.cjs +1 -1
- package/dist/DataView.js +30 -50
- package/dist/DateInput.cjs +4 -4
- package/dist/DateInput.js +1347 -1383
- package/dist/DecimalInput.cjs +6 -6
- package/dist/DecimalInput.js +210 -263
- package/dist/DecimalInputV2.cjs +23 -23
- package/dist/DecimalInputV2.js +119 -176
- package/dist/DetailedProductsInfinitiveSection.cjs +1 -1
- package/dist/DetailedProductsInfinitiveSection.js +1 -1
- package/dist/DetailedProductsSection.cjs +1 -1
- package/dist/DetailedProductsSection.js +2 -2
- package/dist/DetailsView.cjs +9 -9
- package/dist/DetailsView.js +111 -162
- package/dist/DoubleRangeSlider.cjs +22 -22
- package/dist/DoubleRangeSlider.js +70 -95
- package/dist/DragAndDropFile.cjs +10 -10
- package/dist/DragAndDropFile.js +347 -402
- package/dist/DragDropFiles.cjs +4 -4
- package/dist/DragDropFiles.js +70 -124
- package/dist/Drawer.cjs +5 -5
- package/dist/Drawer.js +97 -135
- package/dist/Dropdown.cjs +1 -1
- package/dist/Dropdown.js +44 -213
- package/dist/DropdownItem.cjs +14 -14
- package/dist/DropdownItem.js +106 -142
- package/dist/DropdownLookup.cjs +1 -1
- package/dist/DropdownLookup.js +61 -242
- package/dist/DropdownMenu.cjs +4 -4
- package/dist/DropdownMenu.js +87 -149
- package/dist/EditableTable.cjs +10 -10
- package/dist/EditableTable.js +165 -331
- package/dist/{Facebook-BCqiOWZO.js → Facebook-BSWPEXjA.js} +1 -1
- package/dist/{Facebook-D9wwecSW.cjs → Facebook-DoKw-XxT.cjs} +1 -1
- package/dist/FaqSection.cjs +3 -3
- package/dist/FaqSection.js +119 -153
- package/dist/FileInput.cjs +7 -7
- package/dist/FileInput.js +66 -94
- package/dist/{FilePlayer-ktaNhf3p.js → FilePlayer-BtGpIWnK.js} +1 -1
- package/dist/{FilePlayer-DB6jnpeC.cjs → FilePlayer-D9az_lc_.cjs} +1 -1
- package/dist/FlexBox.cjs +6 -6
- package/dist/FlexBox.js +28 -63
- package/dist/FlexGrid.cjs +1 -1
- package/dist/FlexGrid.js +27 -67
- package/dist/FlexGridItem.cjs +6 -6
- package/dist/FlexGridItem.js +34 -62
- package/dist/Footer.cjs +1 -1
- package/dist/Footer.js +7 -15
- package/dist/FormField.cjs +7 -7
- package/dist/FormField.js +22 -47
- package/dist/FormView.cjs +6 -6
- package/dist/FormView.js +148 -195
- package/dist/GiftCardsSection.cjs +1 -1
- package/dist/GiftCardsSection.js +1 -1
- package/dist/Grid.cjs +2 -2
- package/dist/Grid.js +40 -65
- package/dist/GridItem.cjs +2 -2
- package/dist/GridItem.js +47 -80
- package/dist/Header.cjs +1 -1
- package/dist/Header.js +7 -15
- package/dist/HelpBannerSection.cjs +3 -3
- package/dist/HelpBannerSection.js +9 -15
- package/dist/Icon.cjs +4 -4
- package/dist/Icon.js +29 -55
- package/dist/IconButton.cjs +9 -9
- package/dist/IconButton.js +89 -127
- package/dist/{Kaltura-CvlN0HDg.js → Kaltura-BDqlEQpd.js} +1 -1
- package/dist/{Kaltura-CCdXLzOa.cjs → Kaltura-CK6JHUZC.cjs} +1 -1
- package/dist/Kanban.cjs +7 -7
- package/dist/Kanban.js +2033 -2098
- package/dist/KanbanActionsToolbar.cjs +4 -5
- package/dist/KanbanActionsToolbar.js +61 -96
- package/dist/KanbanCard-B9V9EjVE.js +137 -0
- package/dist/KanbanCard-DihrKn-I.cjs +30 -0
- package/dist/KanbanCard.cjs +1 -1
- package/dist/KanbanCard.js +2 -3
- package/dist/KanbanFooter.cjs +3 -3
- package/dist/KanbanFooter.js +37 -55
- package/dist/KanbanHeader.cjs +4 -4
- package/dist/KanbanHeader.js +49 -81
- package/dist/KanbanView.cjs +2 -2
- package/dist/KanbanView.js +106 -173
- package/dist/Link.cjs +7 -7
- package/dist/Link.js +20 -37
- package/dist/LocationSearchSection.cjs +1 -1
- package/dist/LocationSearchSection.js +1 -1
- package/dist/MasonryGeneralCardsSection.cjs +1 -1
- package/dist/MasonryGeneralCardsSection.js +1 -1
- package/dist/MenuItem.cjs +13 -13
- package/dist/MenuItem.js +101 -139
- package/dist/{Mixcloud-nG_VyBNt.cjs → Mixcloud-C1Boh2Bm.cjs} +1 -1
- package/dist/{Mixcloud-Bb8MTclI.js → Mixcloud-zAh6j7Ha.js} +1 -1
- package/dist/Modal.cjs +18 -19
- package/dist/Modal.js +131 -166
- package/dist/MultiSelectDropdown.cjs +1 -1
- package/dist/MultiSelectDropdown.js +25 -196
- package/dist/MultiSelectDropdownLookup.cjs +1 -1
- package/dist/MultiSelectDropdownLookup.js +27 -209
- package/dist/{Mux-DfYpGTiP.js → Mux-BGTG_Tvc.js} +1 -1
- package/dist/{Mux-BgB2a8kM.cjs → Mux-C6TwZeaq.cjs} +1 -1
- package/dist/NestedDropdownItem.cjs +3 -3
- package/dist/NestedDropdownItem.js +45 -67
- package/dist/NestedMenuItem.cjs +5 -5
- package/dist/NestedMenuItem.js +51 -78
- package/dist/NotificationContainer.cjs +10 -10
- package/dist/NotificationContainer.js +46 -79
- package/dist/NotificationMessage.cjs +2 -2
- package/dist/NotificationMessage.js +47 -64
- package/dist/NumberInput.cjs +23 -23
- package/dist/NumberInput.js +89 -149
- package/dist/PageLayout.cjs +2 -2
- package/dist/PageLayout.js +20 -28
- package/dist/Pagination.cjs +3 -3
- package/dist/Pagination.js +102 -185
- package/dist/PartnerBrandsSection.cjs +62 -0
- package/dist/PartnerBrandsSection.js +154 -0
- package/dist/PartnerStatsSection.cjs +100 -0
- package/dist/PartnerStatsSection.js +124 -0
- package/dist/PasswordInput.cjs +23 -23
- package/dist/PasswordInput.js +108 -137
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +7 -32
- package/dist/PopoverContent.cjs +5 -5
- package/dist/PopoverContent.js +22 -28
- package/dist/PopoverTrigger.cjs +1 -1
- package/dist/PopoverTrigger.js +7 -12
- package/dist/ProductsWithBannerSection.cjs +1 -1
- package/dist/ProductsWithBannerSection.js +1 -1
- package/dist/ProgressBar.cjs +8 -8
- package/dist/ProgressBar.js +32 -59
- package/dist/RadioGroup.cjs +3 -3
- package/dist/RadioGroup.js +41 -72
- package/dist/RadioInput.cjs +28 -28
- package/dist/RadioInput.js +78 -123
- package/dist/RangeSlider.cjs +19 -19
- package/dist/RangeSlider.js +92 -119
- package/dist/ReviewsSection.cjs +13 -13
- package/dist/ReviewsSection.js +81 -101
- package/dist/SalesCampaignsSection.cjs +38 -28
- package/dist/SalesCampaignsSection.js +297 -325
- package/dist/SearchBar.cjs +10 -10
- package/dist/SearchBar.js +168 -188
- package/dist/SearchSection-B94YN_6P.cjs +161 -0
- package/dist/{SearchSection-DDQ_K98T.js → SearchSection-DAaMecR4.js} +337 -359
- package/dist/SearchSection.cjs +1 -1
- package/dist/SearchSection.js +2 -3
- package/dist/Separator.cjs +3 -3
- package/dist/Separator.js +14 -19
- package/dist/Sidebar.cjs +4 -5
- package/dist/Sidebar.js +33 -56
- package/dist/SimpleCategoriesSection.cjs +2 -2
- package/dist/SimpleCategoriesSection.js +2 -2
- package/dist/{SoundCloud-C86xwUG6.cjs → SoundCloud-C6R6E6Zc.cjs} +1 -1
- package/dist/{SoundCloud-DG91z39R.js → SoundCloud-lO8wg_0s.js} +1 -1
- package/dist/Spinner.cjs +18 -18
- package/dist/Spinner.js +37 -54
- package/dist/StatsSection.cjs +6 -6
- package/dist/StatsSection.js +15 -25
- package/dist/{Streamable-4uAnb3WN.cjs → Streamable-DZO95CiT.cjs} +1 -1
- package/dist/{Streamable-BAIWLgyD.js → Streamable-Dwa5ZEK4.js} +1 -1
- package/dist/Surface.cjs +4 -4
- package/dist/Surface.js +19 -34
- package/dist/SwipeableDrawer.cjs +8 -8
- package/dist/SwipeableDrawer.js +84 -136
- package/dist/TabItem.cjs +11 -11
- package/dist/TabItem.js +83 -118
- package/dist/Table.cjs +65 -65
- package/dist/Table.js +786 -1167
- package/dist/TableView.cjs +2 -2
- package/dist/TableView.js +113 -197
- package/dist/Tabs.cjs +4 -4
- package/dist/Tabs.js +41 -60
- package/dist/TextAreaInput.cjs +14 -14
- package/dist/TextAreaInput.js +131 -181
- package/dist/TextInput.cjs +23 -23
- package/dist/TextInput.js +78 -126
- package/dist/ThemeProvider.cjs +5 -5
- package/dist/ThemeProvider.js +35 -39
- package/dist/TimeInput.cjs +7 -7
- package/dist/TimeInput.js +46 -72
- package/dist/Toggle.cjs +20 -20
- package/dist/Toggle.js +78 -109
- package/dist/ToggleSection.cjs +5 -5
- package/dist/ToggleSection.js +48 -55
- package/dist/TreeMenu.cjs +5 -5
- package/dist/TreeMenu.js +43 -67
- package/dist/TreeMenuSeparator.cjs +3 -3
- package/dist/TreeMenuSeparator.js +12 -20
- package/dist/{Twitch-CVAj24ti.cjs → Twitch-B17oKtD0.cjs} +1 -1
- package/dist/{Twitch-DfXeW5Xs.js → Twitch-C73-dwWo.js} +1 -1
- package/dist/UploadedFile.cjs +11 -11
- package/dist/UploadedFile.js +73 -99
- package/dist/{Vidyard-De3pges0.js → Vidyard-B6GdBHsM.js} +1 -1
- package/dist/{Vidyard-DaCcaaH4.cjs → Vidyard-s1MMcaRm.cjs} +1 -1
- package/dist/{Vimeo-8wXdCXGs.cjs → Vimeo-J1l_SU2E.cjs} +1 -1
- package/dist/{Vimeo-N6I2qi_h.js → Vimeo-kzHz4Gco.js} +1 -1
- package/dist/{Wistia-BrUzHQoq.cjs → Wistia-CudQyDHM.cjs} +1 -1
- package/dist/{Wistia-dlV6n6tO.js → Wistia-w4jnqd7y.js} +1 -1
- package/dist/{YouTube-Cfsj4ZaP.cjs → YouTube-BAYKouHS.cjs} +1 -1
- package/dist/{YouTube-DNJxWqRm.js → YouTube-BKyipPZx.js} +1 -1
- package/dist/index-BdKi2ogu.js +39 -0
- package/dist/index-BppfjY8h.js +497 -0
- package/dist/index-CRk3vcd4.cjs +95 -0
- package/dist/index-CX2A-q39.cjs +4 -0
- package/dist/{index-CWALXP1T.js → index-CwMCk9wV.js} +118 -145
- package/dist/index-DeS-oqJB.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -21
- package/dist/{style-CkcozOY6.cjs → style-B4kAj6YU.cjs} +38 -8
- package/dist/{style-Cmlod7oq.js → style-neMbLWE6.js} +42 -11
- package/dist/{tag-BtS5lWJ0.js → tag-Dm8CW4TM.js} +21 -27
- package/dist/{tag-CmeZsPQt.cjs → tag-UQjq2_Ba.cjs} +7 -7
- package/package.json +4 -2
- package/vite.config.js +8 -0
- package/dist/KanbanCard-68kSAXL6.js +0 -175
- package/dist/KanbanCard-BDvoqTDS.cjs +0 -30
- package/dist/SearchSection-BcbHP6QF.cjs +0 -161
- package/dist/index-Be-_NM9Q.cjs +0 -4
- package/dist/index-C0LcDEqa.js +0 -47
- package/dist/index-CSNxZFTX.cjs +0 -95
package/dist/DecimalInput.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";const k=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const k=require("react/jsx-runtime"),F=require("react"),te=require("./index-Cp66dWMi.cjs"),K=require("./emotion-styled.browser.esm-BtEseadx.cjs"),S=require("./utils-RnrgDDZP.cjs"),re=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs");function $(){}function ae(){return!0}function T(r){return!!(r||"").match(/\d/)}function W(r){return r==null}function z(r){return r.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function ie(r){switch(r){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 oe(r,s,f){var e=ie(f),t=r.search(/[1-9]/);return t=t===-1?r.length:t,r.substring(0,t)+r.substring(t,r.length).replace(e,"$1"+s)}function L(r,s){s===void 0&&(s=!0);var f=r[0]==="-",e=f&&s;r=r.replace("-","");var t=r.split("."),a=t[0],o=t[1]||"";return{beforeDecimal:a,afterDecimal:o,hasNagation:f,addNegation:e}}function ne(r){if(!r)return r;var s=r[0]==="-";s&&(r=r.substring(1,r.length));var f=r.split("."),e=f[0].replace(/^0+/,"")||"0",t=f[1]||"";return(s?"-":"")+e+(t?"."+t:"")}function Z(r,s,f){for(var e="",t=f?"0":"",a=0;a<=s-1;a++)e+=r[a]||t;return e}function q(r,s){return Array(s+1).join(r)}function se(r){r+="";var s=r[0]==="-"?"-":"";s&&(r=r.substring(1));var f=r.split(/[eE]/g),e=f[0],t=f[1];if(t=Number(t),!t)return s+e;e=e.replace(".","");var a=1+t,o=e.length;return a<0?e="0."+q("0",Math.abs(a))+e:a>=o?e=e+q("0",a-o):e=(e.substring(0,a)||"0")+"."+e.substring(a),s+e}function le(r,s,f){if(["","-"].indexOf(r)!==-1)return r;var e=r.indexOf(".")!==-1&&s,t=L(r),a=t.beforeDecimal,o=t.afterDecimal,l=t.hasNagation,i=parseFloat("0."+(o||"0")),n=o.length<=s?"0."+o:i.toFixed(s),u=n.split("."),d=a.split("").reverse().reduce(function(m,v,b){return m.length>b?(Number(m[0])+Number(v)).toString()+m.substring(1,m.length):v+m},u[0]),c=Z(u[1]||"",Math.min(s,o.length),f),p=l?"-":"",h=e?".":"";return""+p+d+h+c}function G(r,s){if(r.value=r.value,r!==null){if(r.createTextRange){var f=r.createTextRange();return f.move("character",s),f.select(),!0}return r.selectionStart||r.selectionStart===0?(r.focus(),r.setSelectionRange(s,s),!0):(r.focus(),!1)}}function ue(r,s){for(var f=0,e=0,t=r.length,a=s.length;r[f]===s[f]&&f<t;)f++;for(;r[t-1-e]===s[a-1-e]&&a-e>f&&t-e>f;)e++;return{start:f,end:t-e}}function U(r,s,f){return Math.min(Math.max(r,s),f)}function _(r){return Math.max(r.selectionStart,r.selectionEnd)}function fe(r){return r||typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function ce(r,s){var f={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&s.indexOf(e)===-1&&(f[e]=r[e]);return f}var de={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:$,onChange:$,onKeyDown:$,onMouseUp:$,onFocus:$,onBlur:$,isAllowed:ae},H=function(r){function s(f){r.call(this,f);var e=f.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 r&&(s.__proto__=r),s.prototype=Object.create(r&&r.prototype),s.prototype.constructor=s,s.prototype.componentDidMount=function(){this.setState({mounted:!0})},s.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},s.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},s.prototype.updateValueIfRequired=function(e){var t=this,a=t.props,o=t.state,l=t.focusedElm,i=o.value,n=o.numAsString;if(n===void 0&&(n=""),e!==a){this.validateProps();var u=this.formatNumString(n),d=W(a.value)?u:this.formatValueProp(),c=this.removeFormatting(d),p=parseFloat(c),h=parseFloat(n);((!isNaN(p)||!isNaN(h))&&p!==h||u!==i||l===null&&d!==i)&&this.updateValue({formattedValue:d,numAsString:c,input:l,source:"prop",event:null})}},s.prototype.getFloatString=function(e){e===void 0&&(e="");var t=this.props,a=t.decimalScale,o=this.getSeparators(),l=o.decimalSeparator,i=this.getNumberRegex(!0),n=e[0]==="-";n&&(e=e.replace("-","")),l&&a===0&&(e=e.split(l)[0]),e=(e.match(i)||[]).join("").replace(l,".");var u=e.indexOf(".");return u!==-1&&(e=e.substring(0,u)+"."+e.substring(u+1,e.length).replace(new RegExp(z(l),"g"),"")),n&&(e="-"+e),e},s.prototype.getNumberRegex=function(e,t){var a=this.props,o=a.format,l=a.decimalScale,i=a.customNumerals,n=this.getSeparators(),u=n.decimalSeparator;return new RegExp("[0-9"+(i?i.join(""):"")+"]"+(u&&l!==0&&!t&&!o?"|"+z(u):""),e?"g":void 0)},s.prototype.getSeparators=function(){var e=this.props,t=e.decimalSeparator,a=this.props,o=a.thousandSeparator,l=a.allowedDecimalSeparators;return o===!0&&(o=","),l||(l=[t,"."]),{decimalSeparator:t,thousandSeparator:o,allowedDecimalSeparators:l}},s.prototype.getMaskAtIndex=function(e){var t=this.props,a=t.mask;return a===void 0&&(a=" "),typeof a=="string"?a:a[e]||" "},s.prototype.getValueObject=function(e,t){var a=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(a)?void 0:a}},s.prototype.validateProps=function(){var e=this.props,t=e.mask,a=this.getSeparators(),o=a.decimalSeparator,l=a.thousandSeparator;if(o===l)throw new Error(`
|
|
2
2
|
Decimal separator can't be same as thousand separator.
|
|
3
3
|
thousandSeparator: `+l+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
4
|
-
decimalSeparator: `+
|
|
5
|
-
`);if(t){var
|
|
4
|
+
decimalSeparator: `+o+` (default value for decimalSeparator is .)
|
|
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
|
-
`)}},s.prototype.setPatchedCaretPosition=function(e,t,a){
|
|
7
|
+
`)}},s.prototype.setPatchedCaretPosition=function(e,t,a){G(e,t),this.caretPositionTimeout=setTimeout(function(){e.value===a&&G(e,t)},0)},s.prototype.correctCaretPosition=function(e,t,a){var o=this.props,l=o.prefix,i=o.suffix,n=o.format;if(e==="")return 0;if(t=U(t,0,e.length),!n){var u=e[0]==="-";return U(t,l.length+(u?1:0),e.length-i.length)}if(typeof n=="function"||n[t]==="#"&&T(e[t])||n[t-1]==="#"&&T(e[t-1]))return t;var d=n.indexOf("#"),c=n.lastIndexOf("#");t=U(t,d,c+1);for(var p=n.substring(t,n.length).indexOf("#"),h=t,m=t+(p===-1?0:p);h>d&&(n[h]!=="#"||!T(e[h]));)h-=1;var v=!T(e[m])||a==="left"&&t!==d||t-h<m-t;return v?T(e[h])?h+1:h:m},s.prototype.getCaretPosition=function(e,t,a){var o=this.props,l=o.format,i=this.state.value,n=this.getNumberRegex(!0),u=(e.match(n)||[]).join(""),d=(t.match(n)||[]).join(""),c,p;for(c=0,p=0;p<a;p++){var h=e[p]||"",m=t[c]||"";if(!(!h.match(n)&&h!==m)&&!(h==="0"&&m.match(n)&&m!=="0"&&u.length!==d.length)){for(;h!==t[c]&&c<t.length;)c++;c++}}return typeof l=="string"&&!i&&(c=t.length),c=this.correctCaretPosition(t,c),c},s.prototype.removePrefixAndSuffix=function(e){var t=this.props,a=t.format,o=t.prefix,l=t.suffix;if(!a&&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(l);e=l&&n!==-1&&n===e.length-l.length?e.substring(0,n):e,i&&(e="-"+e)}return e},s.prototype.removePatternFormatting=function(e){for(var t=this.props,a=t.format,o=a.split("#").filter(function(p){return p!==""}),l=0,i="",n=0,u=o.length;n<=u;n++){var d=o[n]||"",c=n===u?e.length:e.indexOf(d,l);if(c===-1){i=e;break}else i+=e.substring(l,c),l=c+d.length}return(i.match(this.getNumberRegex(!0))||[]).join("")},s.prototype.removeFormatting=function(e){var t=this.props,a=t.format,o=t.removeFormatting;return e&&(a?typeof a=="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)},s.prototype.formatWithPattern=function(e){for(var t=this.props,a=t.format,o=0,l=a.split(""),i=0,n=a.length;i<n;i++)a[i]==="#"&&(l[i]=e[o]||this.getMaskAtIndex(o),o+=1);return l.join("")},s.prototype.formatAsNumber=function(e){var t=this.props,a=t.decimalScale,o=t.fixedDecimalScale,l=t.prefix,i=t.suffix,n=t.allowNegative,u=t.thousandsGroupStyle,d=this.getSeparators(),c=d.thousandSeparator,p=d.decimalSeparator,h=e.indexOf(".")!==-1||a&&o,m=L(e,n),v=m.beforeDecimal,b=m.afterDecimal,y=m.addNegation;return a!==void 0&&(b=Z(b,a,o)),c&&(v=oe(v,c,u)),l&&(v=l+v),i&&(b=b+i),y&&(v="-"+v),e=v+(h&&p||"")+b,e},s.prototype.formatNumString=function(e){e===void 0&&(e="");var t=this.props,a=t.format,o=t.allowEmptyFormatting,l=t.customNumerals,i=e;if(l&&l.length===10){var n=new RegExp("["+l.join("")+"]","g");i=e.replace(n,function(u){return l.indexOf(u).toString()})}return e===""&&!o?i="":e==="-"&&!a?i="-":typeof a=="string"?i=this.formatWithPattern(i):typeof a=="function"?i=a(i):i=this.formatAsNumber(i),i},s.prototype.formatValueProp=function(e){var t=this.props,a=t.format,o=t.decimalScale,l=t.fixedDecimalScale,i=t.allowEmptyFormatting,n=this.props,u=n.value,d=n.isNumericString;u=W(u)?e:u;var c=!u&&u!==0;if(c&&i&&(u=""),c&&!i)return"";typeof u=="number"&&(u=se(u),d=!0),u==="Infinity"&&d&&(u=""),d&&!a&&typeof o=="number"&&(u=le(u,o,l));var p=d?this.formatNumString(u):this.formatInput(u);return p},s.prototype.formatNegation=function(e){e===void 0&&(e="");var t=this.props,a=t.allowNegative,o=new RegExp("(-)"),l=new RegExp("(-)(.)*(-)"),i=o.test(e),n=l.test(e);return e=e.replace(/-/g,""),i&&!n&&a&&(e="-"+e),e},s.prototype.formatInput=function(e){e===void 0&&(e="");var t=this.props,a=t.format;return a||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},s.prototype.isCharacterAFormat=function(e,t){var a=this.props,o=a.format,l=a.prefix,i=a.suffix,n=a.decimalScale,u=a.fixedDecimalScale,d=this.getSeparators(),c=d.decimalSeparator;return!!(typeof o=="string"&&o[e]!=="#"||!o&&(e<l.length||e>=t.length-i.length||n&&u&&t[e]===c))},s.prototype.correctInputValue=function(e,t,a){var o=this,l=this.props,i=l.format,n=l.allowNegative,u=l.prefix,d=l.suffix,c=l.decimalScale,p=this.getSeparators(),h=p.allowedDecimalSeparators,m=p.decimalSeparator,v=this.state.numAsString||"",b=this.selectionBeforeInput,y=b.selectionStart,w=b.selectionEnd,R=ue(t,a),g=R.start,N=R.end;if(!i&&g===N&&h.indexOf(a[y])!==-1){var V=c===0?"":m;return a.substr(0,y)+V+a.substr(y+1,a.length)}var A=i?0:u.length,E=t.length-(i?0:d.length);if(a.length>t.length||!a.length||g===N||y===0&&w===t.length||g===0&&N===t.length||y===A&&w===E)return a;var O=t.substr(g,N-g),j=!![].concat(O).find(function(C,I){return o.isCharacterAFormat(I+g,t)});if(j){var B=t.substr(g),P={},x=[];[].concat(B).forEach(function(C,I){o.isCharacterAFormat(I+g,t)?P[I]=C:I>O.length-1&&x.push(C)}),Object.keys(P).forEach(function(C){x.length>C?x.splice(C,0,P[C]):x.push(P[C])}),a=t.substr(0,g)+x.join("")}if(!i){var D=this.removeFormatting(a),M=L(D,n),Q=M.beforeDecimal,X=M.afterDecimal,Y=M.addNegation,ee=e<a.indexOf(m)+1;if(D.length<v.length&&ee&&Q===""&&!parseFloat(X))return Y?"-":""}return a},s.prototype.updateValue=function(e){var t=e.formattedValue,a=e.input,o=e.setCaretPosition;o===void 0&&(o=!0);var l=e.source,i=e.event,n=e.numAsString,u=e.caretPos,d=this.props,c=d.onValueChange,p=this.state,h=p.value;if(a){if(u===void 0&&o){var m=e.inputValue||a.value,v=_(a);a.value=t,u=this.getCaretPosition(m,t,v)}a.value=t,o&&this.setPatchedCaretPosition(a,u,t)}n===void 0&&(n=this.removeFormatting(t)),t!==h&&(this.setState({value:t,numAsString:n}),c(this.getValueObject(t,n),{event:i,source:l}))},s.prototype.onChange=function(e){var t=e.target,a=t.value,o=this,l=o.state,i=o.props,n=i.isAllowed,u=l.value||"",d=_(t);a=this.correctInputValue(d,u,a);var c=this.formatInput(a)||"",p=this.removeFormatting(c),h=this.getValueObject(c,p),m=n(h);m||(c=u),this.updateValue({formattedValue:c,numAsString:p,inputValue:a,input:t,event:e,source:"event"}),m&&i.onChange(e)},s.prototype.onBlur=function(e){var t=this,a=t.props,o=t.state,l=a.format,i=a.onBlur,n=a.allowLeadingZeros,u=o.numAsString,d=o.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!l){isNaN(parseFloat(u))&&(u=""),n||(u=ne(u));var c=this.formatNumString(u);if(c!==d){this.updateValue({formattedValue:c,numAsString:u,input:e.target,setCaretPosition:!1,event:e,source:"event"}),i(e);return}}i(e)},s.prototype.onKeyDown=function(e){var t=e.target,a=e.key,o=t.selectionStart,l=t.selectionEnd,i=t.value;i===void 0&&(i="");var n,u=this.props,d=u.decimalScale,c=u.fixedDecimalScale,p=u.prefix,h=u.suffix,m=u.format,v=u.onKeyDown,b=d!==void 0&&c,y=this.getNumberRegex(!1,b),w=new RegExp("-"),R=typeof m=="string";if(this.selectionBeforeInput={selectionStart:o,selectionEnd:l},a==="ArrowLeft"||a==="Backspace"?n=o-1:a==="ArrowRight"?n=o+1:a==="Delete"&&(n=o),n===void 0||o!==l){v(e);return}var g=n,N=R?m.indexOf("#"):p.length,V=R?m.lastIndexOf("#")+1:i.length-h.length;if(a==="ArrowLeft"||a==="ArrowRight"){var A=a==="ArrowLeft"?"left":"right";g=this.correctCaretPosition(i,n,A)}else if(a==="Delete"&&!y.test(i[n])&&!w.test(i[n]))for(;!y.test(i[g])&&g<V;)g++;else if(a==="Backspace"&&!y.test(i[n])){if(o<=N+1&&i[0]==="-"&&typeof m>"u"){var E=i.substring(1);this.updateValue({formattedValue:E,caretPos:g,input:t,event:e,source:"event"})}else if(!w.test(i[n])){for(;!y.test(i[g-1])&&g>N;)g--;g=this.correctCaretPosition(i,g,"left")}}(g!==n||n<N||n>V)&&(e.preventDefault(),this.setPatchedCaretPosition(t,g,i)),e.isUnitTestRun&&this.setPatchedCaretPosition(t,g,i),v(e)},s.prototype.onMouseUp=function(e){var t=e.target,a=t.selectionStart,o=t.selectionEnd,l=t.value;if(l===void 0&&(l=""),a===o){var i=this.correctCaretPosition(l,a);i!==a&&this.setPatchedCaretPosition(t,i,l)}this.props.onMouseUp(e)},s.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout(function(){var a=e.target,o=a.selectionStart,l=a.selectionEnd,i=a.value;i===void 0&&(i="");var n=t.correctCaretPosition(i,o);n!==o&&!(o===0&&l===i.length)&&t.setPatchedCaretPosition(a,n,i),t.props.onFocus(e)},0)},s.prototype.render=function(){var e=this.props,t=e.type,a=e.displayType,o=e.customInput,l=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 u=ce(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"]),d=u,c=this.state,p=c.value,h=c.mounted,m=h&&fe(n)?"numeric":void 0,v=Object.assign({inputMode:m},d,{type:t,value:p,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if(a==="text")return l?l(p,d)||null:F.createElement("span",Object.assign({},d,{ref:i}),p);if(o){var b=o;return F.createElement(b,Object.assign({},v,{ref:i}))}return F.createElement("input",Object.assign({},v,{ref:i}))},s}(F.Component);H.defaultProps=de;const pe=K.styled.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
& input::placeholder {
|
|
53
53
|
color: ${r=>S.getColorRgbaValue(r.theme,"Input",r.color,"enabled","placeholder")};
|
|
54
54
|
}
|
|
55
|
-
`,
|
|
55
|
+
`,J=K.styled.span`
|
|
56
56
|
padding: 0 12px;
|
|
57
57
|
color: ${r=>S.getColorRgbaValue(r.theme,"Input",r.focused===!0?"primary":r.color,"enabled","prefix")};
|
|
58
|
-
`,
|
|
58
|
+
`,me=K.styled(J)``,he=F.forwardRef((r,s)=>{const{disabled:f,readOnly:e,debounceTime:t=0,prefix:a,suffix:o,thousandSeparator:l=".",decimalSeparator:i=",",decimalScale:n=2,fixedDecimalScale:u=!0,allowNegative:d=!0,onChange:c,onBlur:p,onFocus:h,onInputChange:m,className:v="",style:b={},size:y="small",color:w="primary",...R}=r,g=re.useTheme(),[N,V]=F.useState(!1),A=F.useCallback(te.debounce((x,D)=>E(x,D),t),[c]),E=(x,D)=>{c&&(c==null||c(x,D)),m==null||m(x,D)},O=(x,D)=>{A(D.event,x==null?void 0:x.floatValue)},j=()=>n<0?0:n>17?17:n,B=x=>{V(!0),h==null||h(x)},P=x=>{V(!1),p==null||p(x)};return k.jsxs(pe,{style:b,className:v,theme:g,color:w,size:y,prefix:a,suffix:o,focused:N,disabled:f,readOnly:e,children:[a&&k.jsx(J,{theme:g,color:w,focused:N,className:"lnc-input-prefix",children:a}),k.jsx(H,{getInputRef:s,className:"lnc-decimal-input",disabled:f,readOnly:e,thousandSeparator:l,decimalSeparator:i,decimalScale:j(),fixedDecimalScale:u,allowNegative:d,onFocus:B,onBlur:P,onValueChange:O,...R}),o&&k.jsx(me,{theme:g,color:w,focused:N,className:"lnc-input-suffix",children:o})]})});module.exports=he;
|