@geneui/components 2.11.1
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/ActionableList.js +1761 -0
- package/AdvancedSearch.js +872 -0
- package/Alert.js +98 -0
- package/Avatar.js +77 -0
- package/Badge.js +76 -0
- package/Breadcrumb.js +128 -0
- package/BusyLoader.js +69 -0
- package/Button.js +130 -0
- package/CHANGELOG.md +424 -0
- package/Card.js +513 -0
- package/CardList.js +705 -0
- package/CellMeasurerCache-c11cec83.js +229 -0
- package/Charts.js +99 -0
- package/Checkbox.js +232 -0
- package/CheckboxGroup.js +206 -0
- package/CheckboxGroupWithSearch.js +279 -0
- package/Collapse.js +196 -0
- package/ColorPicker.js +210 -0
- package/ComboBox.js +99 -0
- package/Counter.js +99 -0
- package/DateFilter.js +179 -0
- package/DatePicker.js +1231 -0
- package/DatePickerInput.js +30 -0
- package/Divider.js +56 -0
- package/Drawer.js +264 -0
- package/Dropdown.js +99 -0
- package/Editor.js +22965 -0
- package/Empty.js +132 -0
- package/ExtendedInput.js +578 -0
- package/Form.js +116 -0
- package/FormContainer.js +189 -0
- package/FormableCheckbox.js +27 -0
- package/FormableDatePicker.js +39 -0
- package/FormableDropdown.js +105 -0
- package/FormableEditor.js +24 -0
- package/FormableHOC-21051057.js +83 -0
- package/FormableMultiSelectDropdown.js +105 -0
- package/FormableNumberInput.js +31 -0
- package/FormableRadio.js +23 -0
- package/FormableSwitcher.js +23 -0
- package/FormableTextInput.js +31 -0
- package/FormableUploader.js +40 -0
- package/GeneUIProvider.js +256 -0
- package/Grid.js +166 -0
- package/Holder.js +99 -0
- package/Icon.js +63 -0
- package/Image.js +130 -0
- package/ImagePreview.js +99 -0
- package/KeyValue.js +63 -0
- package/Label.js +58 -0
- package/LinkButton.js +104 -0
- package/Menu.js +277 -0
- package/MobileNavigation.js +95 -0
- package/MobilePopup.js +180 -0
- package/Modal.js +251 -0
- package/ModuleTitle.js +99 -0
- package/NavigationMenu.js +212 -0
- package/Notification.js +120 -0
- package/Option.js +186 -0
- package/Overlay.js +99 -0
- package/Overspread.js +343 -0
- package/Pagination.js +258 -0
- package/Paper.js +97 -0
- package/Popover-f4d1cac0.js +411 -0
- package/Popover.js +20 -0
- package/PopoverV2.js +19 -0
- package/Portal.js +58 -0
- package/Products.js +115 -0
- package/Profile.js +99 -0
- package/Progress.js +200 -0
- package/QRCode.js +816 -0
- package/README.md +90 -0
- package/Radio.js +152 -0
- package/RadioGroup.js +105 -0
- package/Range.js +14 -0
- package/RichEditor-b7928765.js +228 -0
- package/RichEditor.js +13 -0
- package/Scrollbar.js +1587 -0
- package/Search.js +72 -0
- package/SearchWithDropdown.js +195 -0
- package/Section.js +62 -0
- package/SkeletonLoader.js +82 -0
- package/Slider.js +256 -0
- package/Status.js +104 -0
- package/Steps.js +312 -0
- package/SuggestionList.js +15 -0
- package/Switcher.js +194 -0
- package/Table.js +102 -0
- package/TableCompositions.js +17028 -0
- package/Tabs.js +236 -0
- package/Tag.js +103 -0
- package/TextLink.js +22 -0
- package/Textarea.js +239 -0
- package/Time.js +63 -0
- package/TimePicker.js +99 -0
- package/Timeline.js +114 -0
- package/Title.js +66 -0
- package/Toaster.js +116 -0
- package/Tooltip.js +157 -0
- package/TransferList.js +502 -0
- package/Uploader.js +32 -0
- package/ValidatableCheckbox.js +126 -0
- package/ValidatableDatePicker.js +312 -0
- package/ValidatableDropdown.js +99 -0
- package/ValidatableElements.js +99 -0
- package/ValidatableMultiSelectDropdown.js +99 -0
- package/ValidatableNumberInput.js +194 -0
- package/ValidatableRadio.js +117 -0
- package/ValidatableSwitcher.js +94 -0
- package/ValidatableTextInput.js +164 -0
- package/ValidatableTimeInput.js +171 -0
- package/ValidatableUploader.js +94 -0
- package/Widget.js +99 -0
- package/_commonjsHelpers-24198af3.js +35 -0
- package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
- package/checkTimeValidation-e56771be.js +16 -0
- package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
- package/clsx.m-2bb6df4b.js +3 -0
- package/configs-91c86664.js +96 -0
- package/configs.js +131 -0
- package/dateValidation-67caec66.js +225 -0
- package/debounce-4419bc2f.js +17 -0
- package/globalStyling-9c60a159.js +4 -0
- package/guid-8ddf77b3.js +16 -0
- package/index-00fe8887.js +193 -0
- package/index-0cf65939.js +30991 -0
- package/index-122432cd.js +270 -0
- package/index-262edd7a.js +77 -0
- package/index-5cea9a7d.js +407 -0
- package/index-5e722d91.js +867 -0
- package/index-67f4d4d1.js +6568 -0
- package/index-6ff23041.js +66 -0
- package/index-702bf24a.js +1938 -0
- package/index-a4635754.js +329 -0
- package/index-a59530cd.js +4 -0
- package/index-ac59cb10.js +169 -0
- package/index-b7a33c58.js +11 -0
- package/index-d9e8a888.js +987 -0
- package/index-e0af0caf.js +1182 -0
- package/index-e8776f3d.js +807 -0
- package/index.js +128 -0
- package/localization-4ba17032.js +46 -0
- package/objectWithoutPropertiesLoose-299691d8.js +78 -0
- package/package.json +190 -0
- package/rangeAndSlider-20599da4.js +8839 -0
- package/react-beautiful-dnd.esm-38c37304.js +10117 -0
- package/style-inject.es-746bb8ed.js +28 -0
- package/useClickOutside-5183e396.js +25 -0
- package/useDeviceType-dd51db38.js +15 -0
- package/useEllipsisDetection-ef536015.js +23 -0
- package/useKeyDown-38102ae7.js +21 -0
- package/useMount-6fef51a5.js +9 -0
- package/useWidth-9f4647f8.js +15 -0
- package/useWindowSize-80369d76.js +33 -0
package/ExtendedInput.js
ADDED
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
|
+
import React__default, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { c as classnames } from './index-6ff23041.js';
|
|
4
|
+
import { p as propTypesExports } from './index-e0af0caf.js';
|
|
5
|
+
import { i as inputConfig, s as screenTypes } from './configs-91c86664.js';
|
|
6
|
+
import { n as noop, s as stopEvent } from './index-ac59cb10.js';
|
|
7
|
+
import { u as useDeviceType } from './useDeviceType-dd51db38.js';
|
|
8
|
+
import { S as SuggestionList } from './index-5cea9a7d.js';
|
|
9
|
+
import Icon from './Icon.js';
|
|
10
|
+
import Tooltip from './Tooltip.js';
|
|
11
|
+
import './globalStyling-9c60a159.js';
|
|
12
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
13
|
+
import './dateValidation-67caec66.js';
|
|
14
|
+
import './_commonjsHelpers-24198af3.js';
|
|
15
|
+
import 'react-dom';
|
|
16
|
+
import './useWindowSize-80369d76.js';
|
|
17
|
+
import './useKeyDown-38102ae7.js';
|
|
18
|
+
import './useClickOutside-5183e396.js';
|
|
19
|
+
import './Scrollbar.js';
|
|
20
|
+
import './Popover-f4d1cac0.js';
|
|
21
|
+
import './GeneUIProvider.js';
|
|
22
|
+
|
|
23
|
+
var css_248z = "[data-gene-ui-version=\"2.11.0\"] .input-holder{--input-message-padding-side:2rem;--input-element-padding-side:0.5rem;--input-element-height:3.6rem;--textarea-height:21.5rem;--number-actions-holder-padding:0 0.5rem;--swap-label-color:inherit;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-width:100%;position:relative;transition:opacity .3s;-webkit-user-select:none;user-select:none}[data-gene-ui-version=\"2.11.0\"] .input-holder.disabled{opacity:.5}[data-gene-ui-version=\"2.11.0\"] .input-holder.read-only{cursor:inherit;-webkit-user-select:text;user-select:text}[data-gene-ui-version=\"2.11.0\"] .input-holder:not(.f-content-size){width:100%}[data-gene-ui-version=\"2.11.0\"] .input-holder.s-big{--input-element-height:4.2rem;--textarea-height:52rem}[data-gene-ui-version=\"2.11.0\"] .input-holder.s-small{--input-element-height:3.2rem;--textarea-height:14.8rem}[data-gene-ui-version=\"2.11.0\"] .input-holder.id-start .validation-icon{margin-inline-end:-.5rem}[data-gene-ui-version=\"2.11.0\"] .input-holder.id-end{--direction:row-reverse}[data-gene-ui-version=\"2.11.0\"] .input-holder.id-end .validation-icon{margin-inline-start:-.5rem}[data-gene-ui-version=\"2.11.0\"] .input-holder.cr-smooth-radius{--input-element-border-radius:0.4rem;--textarea-border-radius:0.4rem}[data-gene-ui-version=\"2.11.0\"] .input-holder .end-add-on{align-items:center;border-radius:0 var(--input-element-border-radius,4.2rem) var(--input-element-border-radius,4.2rem) 0;display:flex;font:600 1.4rem/1.5 var(--font-family);height:var(--input-element-height);justify-content:center;margin:1px 0;margin-inline-end:calc(var(--input-structure-padding, 1.5rem)*-1 + 1px);margin-inline-start:var(--input-structure-padding,1.5rem);padding:0 var(--input-structure-padding,1.5rem);transition:background .3s,border-color .3s,opacity .3s}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-outline{--input-element-border-color:rgba(var(--background-sc-rgb),0.2)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-outline:not(.t-textarea) .end-add-on{background:rgba(var(--background-sc-rgb),.03);border-inline-start:1px solid var(--input-element-border-color,#0000);height:calc(var(--input-element-height) - .2rem)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-outline.read-only{--input-element-border-color:rgba(var(--background-sc-rgb),0.05)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-outline.filled:not(:focus-within){--input-element-border-color:rgba(var(--background-sc-rgb),0.3)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-outline:not(.read-only):focus-within{--input-element-border-color:var(--hero);--swap-label-color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal{--input-element-background:rgba(var(--background-sc-rgb),0.02)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.read-only{--input-element-background:rgba(var(--background-sc-rgb),0.01)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.filled:not(:focus-within),[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal:not(.read-only):focus-within{--input-element-background:rgba(var(--background-sc-rgb),0.03)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.s-small{--input-message-padding-side:0.7rem;--input-element-background:rgba(var(--background-sc-rgb),0.03);--input-element-padding-side:0.3rem;--number-actions-holder-padding:0;--input-structure-padding:0.4rem}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.s-small.read-only{--input-element-background:rgba(var(--background-sc-rgb),0.01)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.s-small.filled:not(:focus-within){--input-element-background:rgba(var(--background-sc-rgb),0.03)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.s-small:not(.read-only):focus-within{--input-element-background:#0000;--input-element-border-color:var(--hero);--swap-label-color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-light:not(.read-only):focus-within{--input-element-background:rgba(var(--background-sc-rgb),0.05)}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .input-holder.a-light:hover{--input-element-background:rgba(var(--background-sc-rgb),0.05)}}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-light.popover-opened{--input-element-background:rgba(var(--background-sc-rgb),0.05)}[data-gene-ui-version=\"2.11.0\"] .input-holder.error-color,[data-gene-ui-version=\"2.11.0\"] .input-holder.success-color{--input-element-background:#0000!important}[data-gene-ui-version=\"2.11.0\"] .input-holder.error-color{--input-element-border-color:var(--danger)!important}[data-gene-ui-version=\"2.11.0\"] .input-holder.error-color:not(.read-only):focus-within{--swap-label-color:var(--danger)!important}[data-gene-ui-version=\"2.11.0\"] .input-holder.success-color{--input-element-border-color:var(--confirm)!important}[data-gene-ui-version=\"2.11.0\"] .input-holder.success-color:not(.read-only):focus-within{--swap-label-color:var(--confirm)!important}[data-gene-ui-version=\"2.11.0\"] .input-holder.t-textarea .end-add-on{align-self:flex-end}[data-gene-ui-version=\"2.11.0\"] .input-structure{align-items:center;display:flex;flex-direction:var(--direction,row);padding:0 var(--input-structure-padding,1.5rem);position:relative;width:100%}[data-gene-ui-version=\"2.11.0\"] .input-structure>*{flex-shrink:0}[data-gene-ui-version=\"2.11.0\"] .input-structure>:not(label){position:relative;z-index:1}[data-gene-ui-version=\"2.11.0\"] .input-holder.a-minimal.s-small .input-structure>:not(label){margin:0 .3rem}[data-gene-ui-version=\"2.11.0\"] .input-structure>:not(label).bc-icon-clear{border-radius:100%;transition:background .4s,color .4s}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .input-structure>:not(label).bc-icon-clear:hover{background:rgba(var(--background-sc-rgb),.03);color:var(--hero)}}[data-gene-ui-version=\"2.11.0\"] .input-structure>label{cursor:inherit;display:block;flex:auto;overflow:hidden}[data-gene-ui-version=\"2.11.0\"] .input-structure .icon{align-items:center;display:flex;justify-content:center;transition:color .3s,background .3s;z-index:10}[data-gene-ui-version=\"2.11.0\"] .input-structure .icon-holder{order:-1;z-index:2}[data-gene-ui-version=\"2.11.0\"] .input-structure .icon-holder-disabled{pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .input-element-back{background:var(--input-element-background,var(--background));border:1px solid var(--input-element-border-color,#0000);border-radius:var(--input-element-border-radius,4.2rem);bottom:0;height:100%;left:0;position:absolute;right:0;top:0;transition:background .3s,border-color .3s,opacity .3s;width:100%}[data-gene-ui-version=\"2.11.0\"] .t-textarea .input-element-back{border-radius:var(--textarea-border-radius,1rem)}[data-gene-ui-version=\"2.11.0\"] .read-only .input-element-back:empty{opacity:0}[data-gene-ui-version=\"2.11.0\"] .fit-content-hack{height:0;opacity:0;overflow:hidden;pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .input-element-relative{position:relative;width:100%;z-index:1}[data-gene-ui-version=\"2.11.0\"] .input-element{color:rgba(var(--background-sc-rgb),.75);font:600 1.4rem var(--font-family);height:var(--input-element-height);overflow:hidden;padding:0 var(--input-element-padding-side);position:relative;resize:none;text-overflow:ellipsis;transition:opacity .15s;white-space:nowrap;width:100%}[data-gene-ui-version=\"2.11.0\"] .input-element:-webkit-autofill{-webkit-text-fill-color:var(--background-sc);-webkit-background-clip:text;background-clip:text}[data-gene-ui-version=\"2.11.0\"] .input-element:-webkit-autofill::selection{-webkit-text-fill-color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .input-element.hide{opacity:0}[data-gene-ui-version=\"2.11.0\"] .input-element::input-placeholder{color:rgba(var(--background-sc-rgb),.375);font-size:1.4rem;font-weight:600;transition:color .15s}[data-gene-ui-version=\"2.11.0\"] .input-element:placeholder{color:rgba(var(--background-sc-rgb),.375);font-size:1.4rem;font-weight:600;transition:color .15s}[data-gene-ui-version=\"2.11.0\"] .input-element::placeholder{color:rgba(var(--background-sc-rgb),.375);font-size:1.4rem;font-weight:600;transition:color .15s}[data-gene-ui-version=\"2.11.0\"] .input-element:input-placeholder{color:rgba(var(--background-sc-rgb),.375);font-size:1.4rem;font-weight:600;transition:color .15s}[data-gene-ui-version=\"2.11.0\"] .input-element.read-only:not(.textarea-element){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-gene-ui-version=\"2.11.0\"] .textarea-element,[data-gene-ui-version=\"2.11.0\"] textarea.input-element{border:1px solid #0000;cursor:auto;height:var(--textarea-height);overflow:auto;padding:1rem var(--input-element-padding-side);padding-right:70px!important;text-overflow:unset;white-space:normal}[data-gene-ui-version=\"2.11.0\"] .textarea-element.read-only,[data-gene-ui-version=\"2.11.0\"] textarea.input-element.read-only{height:auto}[data-gene-ui-version=\"2.11.0\"] .textarea-element::-webkit-scrollbar,[data-gene-ui-version=\"2.11.0\"] textarea.input-element::-webkit-scrollbar{height:1.6rem;width:1.6rem}[data-gene-ui-version=\"2.11.0\"] .textarea-element::-webkit-scrollbar-thumb,[data-gene-ui-version=\"2.11.0\"] textarea.input-element::-webkit-scrollbar-thumb{background:rgba(var(--background-sc-rgb),.05);border:.4rem solid var(--background);border-radius:1.6rem}[data-gene-ui-version=\"2.11.0\"] div.input-element{align-items:center;display:flex;justify-content:flex-start}[data-gene-ui-version=\"2.11.0\"] div.input-element:not([readonly]).placeholder{color:rgba(var(--background-sc-rgb),.375)}[data-gene-ui-version=\"2.11.0\"] div.input-element:not([readonly]).placeholder:focus{color:rgba(var(--background-sc-rgb),0)}[data-gene-ui-version=\"2.11.0\"] .input-element[readonly]{cursor:inherit}[data-gene-ui-version=\"2.11.0\"] .input-element[readonly]::selection{background:#0000;color:inherit}[data-gene-ui-version=\"2.11.0\"] .input-element[type=date],[data-gene-ui-version=\"2.11.0\"] .input-element[type=datetime-local],[data-gene-ui-version=\"2.11.0\"] .input-element[type=time]{line-height:var(--input-element-height)}[data-gene-ui-version=\"2.11.0\"] .input-fake-placeholder{align-items:center;color:rgba(var(--background-sc-rgb),.375);display:flex;font:600 1.4rem/1.8rem var(--font-family);height:100%;left:0;padding:0 var(--input-element-padding-side);pointer-events:none;position:absolute;top:0;transition:opacity .15s;-webkit-user-select:none;user-select:none;width:100%}[data-gene-ui-version=\"2.11.0\"] .input-fake-placeholder.hide{opacity:0}[data-gene-ui-version=\"2.11.0\"] .input-swap-label{display:flex;font:600 1rem/1.8rem var(--font-family);left:0;max-width:100%;padding:0 var(--input-message-padding-side);position:absolute;top:-.9rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;z-index:5}[data-gene-ui-version=\"2.11.0\"] .input-swap-label .icon{font-size:1.8rem;transition:none}[data-gene-ui-version=\"2.11.0\"] .input-swap{max-width:100%;overflow:hidden}[data-gene-ui-version=\"2.11.0\"] .input-swap-animate{align-items:center;background:var(--background);box-shadow:inset 0 -.8rem 0 var(--input-element-background);color:var(--swap-label-color);display:flex;max-width:100%;padding:0 .4rem;transition:transform .3s,opacity .3s .1s,color .3s}[data-gene-ui-version=\"2.11.0\"] .input-swap-animate>*+*{margin-inline-start:.5rem}[data-gene-ui-version=\"2.11.0\"] .input-swap-animate.hide{opacity:0;transform:translateY(100%)}[data-gene-ui-version=\"2.11.0\"] .number-actions-holder{padding:var(--number-actions-holder-padding)}[data-gene-ui-version=\"2.11.0\"] .number-actions-holder>ul{background:var(--background);border:1px solid rgba(var(--background-sc-rgb),.1);border-radius:.7rem;color:inherit;font-size:1rem;width:1.5rem}[data-gene-ui-version=\"2.11.0\"] .number-actions-holder>ul>li{cursor:pointer;transition:color .3s,background .3s,opacity .3s}[data-gene-ui-version=\"2.11.0\"] .number-actions-holder>ul>li:first-child{border-radius:.7rem .7rem 0 0}[data-gene-ui-version=\"2.11.0\"] .number-actions-holder>ul>li:last-child{border-radius:0 0 .7rem .7rem}[data-gene-ui-version=\"2.11.0\"] .number-actions-holder>ul>li.disabled{opacity:.5;pointer-events:none}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .number-actions-holder>ul>li:hover{background:rgba(var(--background-sc-rgb),.03);color:var(--hero)}}[data-gene-ui-version=\"2.11.0\"] .information-message{cursor:default;font:600 1.2rem/1.42 var(--font-family);margin:.6rem 0 0;padding:0 var(--input-message-padding-side);width:100%}[data-gene-ui-version=\"2.11.0\"] .information-message:empty{display:none}[data-gene-ui-version=\"2.11.0\"] .input-description{cursor:default;font:600 1.4rem/2rem var(--font-family);margin:1rem 0 0;max-width:100%;opacity:.7}[data-gene-ui-version=\"2.11.0\"] .input-structure~.input-description{padding:0 1rem}[data-gene-ui-version=\"2.11.0\"] .input-title{align-items:center;cursor:default;display:flex;font:600 1.4rem/2rem var(--font-family);margin:0 0 .4rem;max-width:100%;opacity:.5;padding:0 var(--input-message-padding-side)}[data-gene-ui-version=\"2.11.0\"] .input-title>*+*{margin-inline-start:.5rem}";
|
|
24
|
+
styleInject(css_248z);
|
|
25
|
+
|
|
26
|
+
function replaceBetween(start, end, initial, what) {
|
|
27
|
+
return initial.substring(0, start) + what + initial.substring(end);
|
|
28
|
+
}
|
|
29
|
+
function createCustomInputEvent(ref) {
|
|
30
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
31
|
+
const event = new Event('input', {
|
|
32
|
+
bubbles: true
|
|
33
|
+
});
|
|
34
|
+
ref.value = String(value);
|
|
35
|
+
ref.dispatchEvent(event);
|
|
36
|
+
return event;
|
|
37
|
+
}
|
|
38
|
+
const ExtendedInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
39
|
+
var _textareaRef$current;
|
|
40
|
+
const {
|
|
41
|
+
max,
|
|
42
|
+
min,
|
|
43
|
+
icon,
|
|
44
|
+
type,
|
|
45
|
+
step,
|
|
46
|
+
value,
|
|
47
|
+
label,
|
|
48
|
+
onBlur,
|
|
49
|
+
onFocus,
|
|
50
|
+
onClear,
|
|
51
|
+
isValid,
|
|
52
|
+
onClick,
|
|
53
|
+
canClear,
|
|
54
|
+
disabled,
|
|
55
|
+
onChange,
|
|
56
|
+
required,
|
|
57
|
+
readOnly,
|
|
58
|
+
className,
|
|
59
|
+
errorText,
|
|
60
|
+
inputSize,
|
|
61
|
+
maxLength,
|
|
62
|
+
isDropdown,
|
|
63
|
+
appearance,
|
|
64
|
+
screenType,
|
|
65
|
+
placeholder,
|
|
66
|
+
flexibility,
|
|
67
|
+
description,
|
|
68
|
+
onIconClick,
|
|
69
|
+
withInfoIcon,
|
|
70
|
+
colorOnValid,
|
|
71
|
+
defaultValue,
|
|
72
|
+
cornerRadius,
|
|
73
|
+
showErrorIcon,
|
|
74
|
+
clickableIcon,
|
|
75
|
+
infoIconTitle,
|
|
76
|
+
writeProtected,
|
|
77
|
+
showNumberIcon,
|
|
78
|
+
itemsDirection,
|
|
79
|
+
showIconOnValid,
|
|
80
|
+
labelAppearance,
|
|
81
|
+
colorBorderOnError,
|
|
82
|
+
showRemainingLength,
|
|
83
|
+
showErrorWithTooltip,
|
|
84
|
+
showClickableTooltipOnError,
|
|
85
|
+
startAdornment,
|
|
86
|
+
tooltipText,
|
|
87
|
+
endAdornment,
|
|
88
|
+
suggestionData,
|
|
89
|
+
...restProps
|
|
90
|
+
} = props;
|
|
91
|
+
const {
|
|
92
|
+
isMobile
|
|
93
|
+
} = useDeviceType(screenType);
|
|
94
|
+
const inputRef = useRef();
|
|
95
|
+
const textareaRef = useRef();
|
|
96
|
+
const iconRef = useRef();
|
|
97
|
+
const [localValue, setLocalValue] = useState(defaultValue);
|
|
98
|
+
const [focused, setFocused] = useState(false);
|
|
99
|
+
const [isBlurInitiatorIcon, setIsBlurInitiatorIcon] = useState(false);
|
|
100
|
+
const isControlled = 'value' in props && typeof value !== 'undefined';
|
|
101
|
+
// non strict equality is needed for covering 'undefined' case also
|
|
102
|
+
const inputValue = isControlled ? value != null ? value : '' : localValue;
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
isControlled && value && value !== inputValue && setLocalValue(value);
|
|
105
|
+
}, [value, isControlled, inputValue]);
|
|
106
|
+
const hasError = !isValid;
|
|
107
|
+
const showTooltip = tooltipText && isValid || showErrorWithTooltip && hasError && errorText;
|
|
108
|
+
const handleChange = e => {
|
|
109
|
+
const {
|
|
110
|
+
value
|
|
111
|
+
} = e.target;
|
|
112
|
+
!isControlled && setLocalValue(value);
|
|
113
|
+
onChange(e);
|
|
114
|
+
};
|
|
115
|
+
const handleFocus = useCallback(e => {
|
|
116
|
+
setFocused(true);
|
|
117
|
+
onFocus(e);
|
|
118
|
+
}, [onFocus]);
|
|
119
|
+
const handleIconClick = useCallback(e => {
|
|
120
|
+
// We will remove this later, when get report who use this
|
|
121
|
+
if (clickableIcon) {
|
|
122
|
+
onClick(e);
|
|
123
|
+
onIconClick(e, isBlurInitiatorIcon);
|
|
124
|
+
if (isBlurInitiatorIcon) {
|
|
125
|
+
iconRef.current.blur();
|
|
126
|
+
setIsBlurInitiatorIcon(false);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, [clickableIcon, onClick, onIconClick, isBlurInitiatorIcon]);
|
|
130
|
+
const handleBlur = useCallback(e => {
|
|
131
|
+
setFocused(false);
|
|
132
|
+
setIsBlurInitiatorIcon(iconRef.current === e.relatedTarget);
|
|
133
|
+
onBlur(e);
|
|
134
|
+
}, [onBlur]);
|
|
135
|
+
const handleDropdownIconClick = useCallback(e => {
|
|
136
|
+
if (isDropdown) {
|
|
137
|
+
onClick(e);
|
|
138
|
+
if (!readOnly) {
|
|
139
|
+
stopEvent(e, true);
|
|
140
|
+
focused ? inputRef.current.blur() : inputRef.current.focus();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, [isDropdown, onClick, focused, inputRef.current]);
|
|
144
|
+
const handleStepUp = e => {
|
|
145
|
+
const number = Math.floor(inputValue) + step;
|
|
146
|
+
const nextValue = number < min ? min : number > max ? max : number;
|
|
147
|
+
const event = createCustomInputEvent(inputRef.current, nextValue);
|
|
148
|
+
handleChange(event);
|
|
149
|
+
};
|
|
150
|
+
const handleStepDown = e => {
|
|
151
|
+
const number = Math.ceil(inputValue) - step;
|
|
152
|
+
const nextValue = number < min ? min : number > max ? max : number;
|
|
153
|
+
const event = createCustomInputEvent(inputRef.current, nextValue);
|
|
154
|
+
handleChange(event);
|
|
155
|
+
};
|
|
156
|
+
const handleClear = () => {
|
|
157
|
+
const event = createCustomInputEvent(type === 'textarea' ? textareaRef.current : inputRef.current);
|
|
158
|
+
handleChange(event);
|
|
159
|
+
onClear(event);
|
|
160
|
+
};
|
|
161
|
+
const handleRef = val => {
|
|
162
|
+
if (ref) {
|
|
163
|
+
ref.current = val;
|
|
164
|
+
}
|
|
165
|
+
if (type !== 'textarea') {
|
|
166
|
+
inputRef.current = val;
|
|
167
|
+
} else {
|
|
168
|
+
textareaRef.current = val;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const fieldStep = type === 'number' ? {
|
|
172
|
+
step
|
|
173
|
+
} : {};
|
|
174
|
+
const numberedValue = Number(inputValue);
|
|
175
|
+
const inputLabel = label || placeholder;
|
|
176
|
+
const asterisk = required ? '*' : '';
|
|
177
|
+
const inputPlaceholder = !readOnly && placeholder ? "".concat(asterisk, " ").concat(placeholder) : '';
|
|
178
|
+
const hasFakePlaceholder = type === 'date' || type === 'time' || type === 'datetime-local';
|
|
179
|
+
const sharedProps = {
|
|
180
|
+
onClick,
|
|
181
|
+
required,
|
|
182
|
+
ref: handleRef,
|
|
183
|
+
onBlur: handleBlur,
|
|
184
|
+
onFocus: handleFocus,
|
|
185
|
+
onChange: handleChange,
|
|
186
|
+
disabled,
|
|
187
|
+
maxLength,
|
|
188
|
+
placeholder: inputPlaceholder,
|
|
189
|
+
readOnly: readOnly || writeProtected,
|
|
190
|
+
className: classnames('input-element', {
|
|
191
|
+
'read-only': readOnly,
|
|
192
|
+
placeholder: !inputValue,
|
|
193
|
+
'write-protected': writeProtected,
|
|
194
|
+
'textarea-element': type === 'textarea',
|
|
195
|
+
hide: !inputValue && hasFakePlaceholder
|
|
196
|
+
}),
|
|
197
|
+
...restProps
|
|
198
|
+
};
|
|
199
|
+
const onChangeSuggestionData = useCallback(_ref => {
|
|
200
|
+
let {
|
|
201
|
+
from,
|
|
202
|
+
to,
|
|
203
|
+
data
|
|
204
|
+
} = _ref;
|
|
205
|
+
const {
|
|
206
|
+
value
|
|
207
|
+
} = data;
|
|
208
|
+
const input = textareaRef.current;
|
|
209
|
+
const lastValue = input.value;
|
|
210
|
+
input.value = replaceBetween(from, to, inputValue, value);
|
|
211
|
+
const event = new Event('input', {
|
|
212
|
+
bubbles: true
|
|
213
|
+
});
|
|
214
|
+
const tracker = input._valueTracker;
|
|
215
|
+
tracker && tracker.setValue(lastValue);
|
|
216
|
+
input.dispatchEvent(event);
|
|
217
|
+
}, [inputValue]);
|
|
218
|
+
const onAddPlaceholder = useCallback(_ref2 => {
|
|
219
|
+
let {
|
|
220
|
+
from,
|
|
221
|
+
to,
|
|
222
|
+
data
|
|
223
|
+
} = _ref2;
|
|
224
|
+
const {
|
|
225
|
+
value
|
|
226
|
+
} = data;
|
|
227
|
+
textareaRef.current.value = replaceBetween(from, to, inputValue, value);
|
|
228
|
+
}, [inputValue]);
|
|
229
|
+
const maxMinValidator = useCallback((num, type) => disabled || (num === null || num === void 0 ? void 0 : num.toString().length) && (Math.ceil(num) === 0 || Math.ceil(num)) && (type === 'max' ? numberedValue >= num : numberedValue <= num), [max, min, numberedValue]);
|
|
230
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
231
|
+
position: "bottom",
|
|
232
|
+
title: showTooltip ? errorText || tooltipText : ''
|
|
233
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
234
|
+
className: classnames('input-holder', "a-".concat(appearance), "s-".concat(inputSize), "id-".concat(itemsDirection), "f-".concat(flexibility), "cr-".concat(cornerRadius), "t-".concat(type), className, {
|
|
235
|
+
disabled,
|
|
236
|
+
'read-only': readOnly,
|
|
237
|
+
'error-color': hasError && colorBorderOnError,
|
|
238
|
+
'success-color': isValid && colorOnValid,
|
|
239
|
+
filled: inputValue
|
|
240
|
+
})
|
|
241
|
+
}, type === 'textarea' && !readOnly && !isDropdown && !isMobile && suggestionData && Array.isArray(suggestionData) && /*#__PURE__*/React__default.createElement(SuggestionList, {
|
|
242
|
+
elemRef: textareaRef,
|
|
243
|
+
onChange: onChangeSuggestionData,
|
|
244
|
+
onHover: onAddPlaceholder,
|
|
245
|
+
data: suggestionData
|
|
246
|
+
}), labelAppearance === inputConfig.labelAppearance[1] && /*#__PURE__*/React__default.createElement("div", {
|
|
247
|
+
className: "input-title ellipsis-text"
|
|
248
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
249
|
+
position: "auto",
|
|
250
|
+
title: "".concat(asterisk, " ").concat(inputLabel)
|
|
251
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
252
|
+
className: "ellipsis-text"
|
|
253
|
+
}, asterisk, " ", inputLabel)), withInfoIcon && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
254
|
+
position: "auto",
|
|
255
|
+
title: infoIconTitle
|
|
256
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
257
|
+
type: "bc-icon-info"
|
|
258
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
259
|
+
className: "input-structure"
|
|
260
|
+
}, startAdornment, icon && /*#__PURE__*/React__default.createElement("span", {
|
|
261
|
+
ref: iconRef,
|
|
262
|
+
tabIndex: "0",
|
|
263
|
+
className: classnames('icon-holder', {
|
|
264
|
+
'icon-holder-disabled': disabled
|
|
265
|
+
})
|
|
266
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
267
|
+
type: icon,
|
|
268
|
+
onClick: handleIconClick,
|
|
269
|
+
onMouseDown: handleDropdownIconClick
|
|
270
|
+
})), /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("div", {
|
|
271
|
+
className: "input-element-relative"
|
|
272
|
+
}, readOnly || isDropdown && isMobile ? /*#__PURE__*/React__default.createElement("div", sharedProps, /*#__PURE__*/React__default.createElement("div", {
|
|
273
|
+
className: type === 'textarea' ? 'textarea-element-content' : 'ellipsis-text'
|
|
274
|
+
}, typeof inputValue === 'number' ? inputValue : inputValue || inputPlaceholder)) : type !== 'textarea' ? /*#__PURE__*/React__default.createElement("input", _extends({}, sharedProps, fieldStep, {
|
|
275
|
+
max: max,
|
|
276
|
+
min: min,
|
|
277
|
+
type: type,
|
|
278
|
+
size: flexibility === 'content-size' ? 1 : null,
|
|
279
|
+
value: inputValue
|
|
280
|
+
})) : /*#__PURE__*/React__default.createElement("textarea", _extends({}, sharedProps, {
|
|
281
|
+
value: (_textareaRef$current = textareaRef.current) !== null && _textareaRef$current !== void 0 && _textareaRef$current.isSuggestionListOpen ? textareaRef.current.value : inputValue
|
|
282
|
+
})), hasFakePlaceholder && /*#__PURE__*/React__default.createElement("div", {
|
|
283
|
+
className: classnames('input-fake-placeholder', {
|
|
284
|
+
hide: inputValue
|
|
285
|
+
})
|
|
286
|
+
}, inputPlaceholder && /*#__PURE__*/React__default.createElement("div", {
|
|
287
|
+
className: "ellipsis-text"
|
|
288
|
+
}, inputPlaceholder))), flexibility === 'content-size' && /*#__PURE__*/React__default.createElement("div", {
|
|
289
|
+
className: "fit-content-hack"
|
|
290
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
291
|
+
className: "input-element"
|
|
292
|
+
}, asterisk, " ", placeholder.length > "".concat(inputValue).length ? placeholder : inputValue)), /*#__PURE__*/React__default.createElement("div", {
|
|
293
|
+
className: "input-element-back"
|
|
294
|
+
}, labelAppearance === inputConfig.labelAppearance[2] && /*#__PURE__*/React__default.createElement("div", {
|
|
295
|
+
className: "input-swap-label"
|
|
296
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
297
|
+
className: "input-swap"
|
|
298
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
299
|
+
className: classnames('input-swap-animate ellipsis-text', {
|
|
300
|
+
hide: !inputValue && inputValue !== 0
|
|
301
|
+
})
|
|
302
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
303
|
+
className: "ellipsis-text"
|
|
304
|
+
}, asterisk, " ", inputLabel), withInfoIcon && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
305
|
+
position: "auto",
|
|
306
|
+
title: infoIconTitle
|
|
307
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
308
|
+
type: "bc-icon-info"
|
|
309
|
+
}))))))), canClear && !!inputValue && !readOnly && /*#__PURE__*/React__default.createElement(Icon, {
|
|
310
|
+
type: "bc-icon-clear",
|
|
311
|
+
disabled: disabled,
|
|
312
|
+
onClick: handleClear,
|
|
313
|
+
className: "cursor-pointer"
|
|
314
|
+
}), isDropdown && /*#__PURE__*/React__default.createElement(Icon, {
|
|
315
|
+
type: "bc-icon-arrow-down",
|
|
316
|
+
onMouseDown: handleDropdownIconClick
|
|
317
|
+
}), type === 'number' && showNumberIcon && !readOnly && /*#__PURE__*/React__default.createElement("div", {
|
|
318
|
+
className: "number-actions-holder"
|
|
319
|
+
}, /*#__PURE__*/React__default.createElement("ul", null, /*#__PURE__*/React__default.createElement("li", {
|
|
320
|
+
className: classnames('number-action', 'bc-icon-input-number-up', {
|
|
321
|
+
disabled: maxMinValidator(max, 'max')
|
|
322
|
+
}),
|
|
323
|
+
onClick: handleStepUp
|
|
324
|
+
}), /*#__PURE__*/React__default.createElement("li", {
|
|
325
|
+
className: classnames('number-action', 'bc-icon-input-number-down', {
|
|
326
|
+
disabled: maxMinValidator(min, 'min')
|
|
327
|
+
}),
|
|
328
|
+
onClick: handleStepDown
|
|
329
|
+
}))), hasError && showErrorIcon && /*#__PURE__*/React__default.createElement(Icon, {
|
|
330
|
+
className: "validation-icon pointer-events-none color-danger",
|
|
331
|
+
type: "bc-icon-error-info"
|
|
332
|
+
}), isValid && showIconOnValid && /*#__PURE__*/React__default.createElement(Icon, {
|
|
333
|
+
className: "validation-icon pointer-events-none color-confirm",
|
|
334
|
+
type: "bc-icon-validated"
|
|
335
|
+
}), showRemainingLength && !!maxLength && /*#__PURE__*/React__default.createElement("div", {
|
|
336
|
+
className: "end-add-on"
|
|
337
|
+
}, maxLength - "".concat(inputValue).length), endAdornment), !showErrorWithTooltip && hasError && errorText && /*#__PURE__*/React__default.createElement("div", {
|
|
338
|
+
className: "information-message color-danger"
|
|
339
|
+
}, errorText), description && /*#__PURE__*/React__default.createElement("div", {
|
|
340
|
+
className: "input-description"
|
|
341
|
+
}, description)));
|
|
342
|
+
});
|
|
343
|
+
ExtendedInput.propTypes = {
|
|
344
|
+
/**
|
|
345
|
+
* Additional className
|
|
346
|
+
*/
|
|
347
|
+
className: propTypesExports.string,
|
|
348
|
+
/**
|
|
349
|
+
* Control ExtendedInput disabled state with this prop
|
|
350
|
+
*/
|
|
351
|
+
disabled: propTypesExports.bool,
|
|
352
|
+
/**
|
|
353
|
+
* Borders will be colored on when "isValid" and this props are set to "true"
|
|
354
|
+
*/
|
|
355
|
+
colorBorderOnError: propTypesExports.bool,
|
|
356
|
+
/**
|
|
357
|
+
* Shows an icon to clear ExtendedInput's value when set to "true"
|
|
358
|
+
*/
|
|
359
|
+
showClearIcon: propTypesExports.bool,
|
|
360
|
+
/**
|
|
361
|
+
* Use this props in combo with "icon" prop. This will fire on icon click when set to "true"
|
|
362
|
+
*/
|
|
363
|
+
clickableIcon: propTypesExports.bool,
|
|
364
|
+
/**
|
|
365
|
+
* Shows an error icon when "isValid" is set to "false" and this prop is set to "true"
|
|
366
|
+
*/
|
|
367
|
+
showErrorIcon: propTypesExports.bool,
|
|
368
|
+
/**
|
|
369
|
+
* Shows an "Icon" for number inputs, when "type" is set to "number" and this prop is et to "true"
|
|
370
|
+
*/
|
|
371
|
+
showNumberIcon: propTypesExports.bool,
|
|
372
|
+
/**
|
|
373
|
+
*.
|
|
374
|
+
*/
|
|
375
|
+
showClickableTooltipOnError: propTypesExports.bool,
|
|
376
|
+
/**
|
|
377
|
+
* ExtendedInput borders are colored when "isValid" and this props are set to "true"
|
|
378
|
+
*/
|
|
379
|
+
colorOnValid: propTypesExports.bool,
|
|
380
|
+
/**
|
|
381
|
+
* ExtendedInput will display an icon when "isValid" and this props are set to "true"
|
|
382
|
+
*/
|
|
383
|
+
showIconOnValid: propTypesExports.bool,
|
|
384
|
+
/**
|
|
385
|
+
* Shows the "errorText" value in "Tooltip" when set to "true"
|
|
386
|
+
*/
|
|
387
|
+
showErrorWithTooltip: propTypesExports.bool,
|
|
388
|
+
/**
|
|
389
|
+
* Control ExtendedInput validation. For more info see "ValidatableNumberInput", "ValidatableTextInput"(integrated ExtendedInputs with "Form" organism).
|
|
390
|
+
*/
|
|
391
|
+
isValid: propTypesExports.bool,
|
|
392
|
+
/**
|
|
393
|
+
* Use this prop to specify error message. This will be displayed when "isValid" is set to "false"
|
|
394
|
+
*/
|
|
395
|
+
errorText: propTypesExports.string,
|
|
396
|
+
/**
|
|
397
|
+
* Use this prop to specify tooltip message.
|
|
398
|
+
*/
|
|
399
|
+
tooltipText: propTypesExports.string,
|
|
400
|
+
/**
|
|
401
|
+
* Specify increment or decrement value, when arrow up or down are clicked
|
|
402
|
+
*/
|
|
403
|
+
step: propTypesExports.number,
|
|
404
|
+
/**
|
|
405
|
+
* Valid values are same as "Icon" type
|
|
406
|
+
*/
|
|
407
|
+
icon: propTypesExports.string,
|
|
408
|
+
/**
|
|
409
|
+
* ExtendedInput placeholder
|
|
410
|
+
*/
|
|
411
|
+
placeholder: propTypesExports.string,
|
|
412
|
+
/**
|
|
413
|
+
* Control items direction
|
|
414
|
+
*/
|
|
415
|
+
itemsDirection: propTypesExports.oneOf(inputConfig.itemsDirection),
|
|
416
|
+
/**
|
|
417
|
+
* Use this prop to control ExtendedInput state. Note that when you specify this prop, the ExtendedInput will not functionate itself
|
|
418
|
+
*/
|
|
419
|
+
value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number]),
|
|
420
|
+
/**
|
|
421
|
+
* ExtendedInput type
|
|
422
|
+
*/
|
|
423
|
+
type: propTypesExports.oneOf(inputConfig.type).isRequired,
|
|
424
|
+
/**
|
|
425
|
+
* ExtendedInput appearance
|
|
426
|
+
*/
|
|
427
|
+
appearance: propTypesExports.oneOf(inputConfig.appearance),
|
|
428
|
+
/**
|
|
429
|
+
* ExtendedInput size
|
|
430
|
+
*/
|
|
431
|
+
inputSize: propTypesExports.oneOf(inputConfig.size),
|
|
432
|
+
/**
|
|
433
|
+
* ExtendedInput corner radius
|
|
434
|
+
*/
|
|
435
|
+
cornerRadius: propTypesExports.oneOf(inputConfig.cornerRadius),
|
|
436
|
+
/**
|
|
437
|
+
* Will make ExtendedInput readonly when set to "true"
|
|
438
|
+
*/
|
|
439
|
+
readOnly: propTypesExports.bool,
|
|
440
|
+
/**
|
|
441
|
+
* How to display inscription in relation to it's parent in ExtendedInput
|
|
442
|
+
*/
|
|
443
|
+
flexibility: propTypesExports.oneOf(inputConfig.flexibility),
|
|
444
|
+
/**
|
|
445
|
+
* This prop will only applied once as defaultState for "value" when ExtendedInput mounts.
|
|
446
|
+
* Note that specifying this prop is not mean controlling it.
|
|
447
|
+
*/
|
|
448
|
+
defaultValue: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number]),
|
|
449
|
+
/**
|
|
450
|
+
* Shows an "Icon" to remove ExtendedInput's value
|
|
451
|
+
*/
|
|
452
|
+
canClear: propTypesExports.bool,
|
|
453
|
+
/**
|
|
454
|
+
* Fires an event on clear "Icon" click((element: Element) => void)
|
|
455
|
+
*/
|
|
456
|
+
onClear: propTypesExports.func,
|
|
457
|
+
/**
|
|
458
|
+
* Fires an event on ExtendedInput change((event: Event) => void)
|
|
459
|
+
*/
|
|
460
|
+
onChange: propTypesExports.func,
|
|
461
|
+
/**
|
|
462
|
+
* Specify a label for ExtendedInput
|
|
463
|
+
*/
|
|
464
|
+
label: propTypesExports.string,
|
|
465
|
+
/**
|
|
466
|
+
* Specify a "label" appearance
|
|
467
|
+
*/
|
|
468
|
+
labelAppearance: propTypesExports.oneOf(inputConfig.labelAppearance),
|
|
469
|
+
/**
|
|
470
|
+
* Will add an additional description field
|
|
471
|
+
*/
|
|
472
|
+
description: propTypesExports.node,
|
|
473
|
+
/**
|
|
474
|
+
* Property is needed for "Dropdown" organism usage
|
|
475
|
+
*/
|
|
476
|
+
isDropdown: propTypesExports.bool,
|
|
477
|
+
/**
|
|
478
|
+
* Fires an event on ExtendInput <input /> click((event: Event => void))
|
|
479
|
+
*/
|
|
480
|
+
onClick: propTypesExports.func,
|
|
481
|
+
/**
|
|
482
|
+
* Typing will be blocked when set to "true". Note design is different from "readonly" prop's design
|
|
483
|
+
*/
|
|
484
|
+
writeProtected: propTypesExports.bool,
|
|
485
|
+
/**
|
|
486
|
+
* Input field maximum value
|
|
487
|
+
*/
|
|
488
|
+
max: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number]),
|
|
489
|
+
/**
|
|
490
|
+
* Input field minimum value
|
|
491
|
+
*/
|
|
492
|
+
min: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number]),
|
|
493
|
+
/**
|
|
494
|
+
* Callback fires when input is focused
|
|
495
|
+
*/
|
|
496
|
+
onFocus: propTypesExports.func,
|
|
497
|
+
/**
|
|
498
|
+
* Callback fires when input loose focus
|
|
499
|
+
*/
|
|
500
|
+
onBlur: propTypesExports.func,
|
|
501
|
+
/**
|
|
502
|
+
* Callback fires when clicked the icon </br>
|
|
503
|
+
* as a first parameter passed native event </br>
|
|
504
|
+
* as a second parameter passed is blur function </br>
|
|
505
|
+
* initiated by icon click
|
|
506
|
+
*/
|
|
507
|
+
onIconClick: propTypesExports.func,
|
|
508
|
+
/**
|
|
509
|
+
* Define is input required or no.
|
|
510
|
+
*/
|
|
511
|
+
required: propTypesExports.bool,
|
|
512
|
+
/**
|
|
513
|
+
* The switch between mobile and desktop version
|
|
514
|
+
*/
|
|
515
|
+
screenType: propTypesExports.oneOf(screenTypes),
|
|
516
|
+
/**
|
|
517
|
+
* Define is need input info icon required.
|
|
518
|
+
*/
|
|
519
|
+
withInfoIcon: propTypesExports.bool,
|
|
520
|
+
/**
|
|
521
|
+
* ExtendedInput info icon title.
|
|
522
|
+
*/
|
|
523
|
+
infoIconTitle: propTypesExports.string,
|
|
524
|
+
/**
|
|
525
|
+
* Max Length of input Value
|
|
526
|
+
*/
|
|
527
|
+
maxLength: propTypesExports.number,
|
|
528
|
+
/**
|
|
529
|
+
* Show Remaining Length of input value, works only with maxLength
|
|
530
|
+
*/
|
|
531
|
+
showRemainingLength: propTypesExports.bool,
|
|
532
|
+
/**
|
|
533
|
+
* Decoration that can be added to the inner input field at the start
|
|
534
|
+
*/
|
|
535
|
+
startAdornment: propTypesExports.oneOfType([propTypesExports.element, propTypesExports.string, propTypesExports.number, propTypesExports.node]),
|
|
536
|
+
/**
|
|
537
|
+
* Decoration that can be added to the inner input field at the end
|
|
538
|
+
*/
|
|
539
|
+
endAdornment: propTypesExports.oneOfType([propTypesExports.element, propTypesExports.string, propTypesExports.number, propTypesExports.node])
|
|
540
|
+
};
|
|
541
|
+
ExtendedInput.defaultProps = {
|
|
542
|
+
step: 1,
|
|
543
|
+
placeholder: '',
|
|
544
|
+
itemsDirection: inputConfig.itemsDirection[0],
|
|
545
|
+
type: inputConfig.type[0],
|
|
546
|
+
appearance: inputConfig.appearance[0],
|
|
547
|
+
inputSize: inputConfig.size[1],
|
|
548
|
+
cornerRadius: inputConfig.cornerRadius[0],
|
|
549
|
+
clickableIcon: false,
|
|
550
|
+
readOnly: false,
|
|
551
|
+
flexibility: inputConfig.flexibility[0],
|
|
552
|
+
colorBorderOnError: true,
|
|
553
|
+
showErrorIcon: false,
|
|
554
|
+
showNumberIcon: true,
|
|
555
|
+
showClickableTooltipOnError: true,
|
|
556
|
+
showErrorWithTooltip: false,
|
|
557
|
+
colorOnValid: false,
|
|
558
|
+
showIconOnValid: false,
|
|
559
|
+
canClear: false,
|
|
560
|
+
isValid: true,
|
|
561
|
+
onChange: noop,
|
|
562
|
+
onClick: noop,
|
|
563
|
+
onClear: noop,
|
|
564
|
+
onFocus: noop,
|
|
565
|
+
onBlur: noop,
|
|
566
|
+
onIconClick: noop,
|
|
567
|
+
withInfoIcon: false,
|
|
568
|
+
infoIconTitle: '',
|
|
569
|
+
label: '',
|
|
570
|
+
labelAppearance: inputConfig.labelAppearance[0],
|
|
571
|
+
description: '',
|
|
572
|
+
isDropdown: false,
|
|
573
|
+
writeProtected: false,
|
|
574
|
+
defaultValue: '',
|
|
575
|
+
screenType: screenTypes[0]
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
export { ExtendedInput as default };
|