@hi-ui/input 4.0.0-alpha.3 → 4.0.0-alpha.30
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/README.md +79 -7
- package/lib/cjs/Input.js +93 -80
- package/lib/cjs/Input.js.map +1 -1
- package/lib/cjs/MockInput.js +154 -0
- package/lib/cjs/MockInput.js.map +1 -0
- package/lib/cjs/TextArea.js +109 -0
- package/lib/cjs/TextArea.js.map +1 -0
- package/lib/cjs/index.js +7 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/styles/index.scss.js +2 -2
- package/lib/cjs/use-input.js +129 -0
- package/lib/cjs/use-input.js.map +1 -0
- package/lib/cjs/utils/index.js +192 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/esm/Input.js +93 -79
- package/lib/esm/Input.js.map +1 -1
- package/lib/esm/MockInput.js +132 -0
- package/lib/esm/MockInput.js.map +1 -0
- package/lib/esm/TextArea.js +88 -0
- package/lib/esm/TextArea.js.map +1 -0
- package/lib/esm/index.js +3 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/styles/index.scss.js +2 -2
- package/lib/esm/use-input.js +119 -0
- package/lib/esm/use-input.js.map +1 -0
- package/lib/esm/utils/index.js +176 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/lib/types/Input.d.ts +23 -42
- package/lib/types/MockInput.d.ts +134 -0
- package/lib/types/TextArea.d.ts +29 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/use-input.d.ts +78 -0
- package/lib/types/utils/index.d.ts +9 -1
- package/package.json +14 -11
@@ -1,5 +1,5 @@
|
|
1
1
|
/** @LICENSE
|
2
|
-
* @hi-ui/input
|
2
|
+
* @hi-ui/input
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
|
4
4
|
*
|
5
5
|
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
|
-
var css_248z = ".hi-v4-input {\n margin: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n height: inherit;\n background-color: transparent;\n cursor: text;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n display: inline-block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transition: all .3s;\n transition: all .3s;\n width: 100%;\n font-size: inherit;\n color: var(--color-black);\n line-height: 22px; }\n .hi-v4-input::-webkit-input-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input::-moz-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input::-ms-input-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input:-ms-input-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input::placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input:disabled {\n cursor: not-allowed; }\n .hi-v4-input__inner {\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n height: auto;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: inherit;\n border: 1px solid transparent;\n background-color: var(--color-white);\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n outline: 2px solid transparent; }\n .hi-v4-input__inner:not(.disabled):hover {\n z-index: 1; }\n .hi-v4-input__inner:not(.disabled).focused {\n z-index: 1; }\n .hi-v4-input__outer {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n margin: 0;\n padding: 0;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n height: auto;\n width: 100%; }\n .hi-v4-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: auto;\n font-size: 14px;\n text-align: center;\n color: var(--color-gray-50);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n visibility: hidden;\n opacity: 0; }\n .hi-v4-input__clear:hover {\n color: var(--color-black); }\n .hi-v4-input__clear.active {\n visibility: visible;\n opacity: 1; }\n .hi-v4-input__inner--suffix .hi-v4-input__clear {\n margin-right: 4px; }\n .hi-v4-input__prefix, .hi-v4-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: var(--color-black);\n font-size: inherit;\n text-align: center; }\n .hi-v4-input__prefix {\n padding-left: 11px; }\n .hi-v4-input__suffix {\n padding-right: 11px; }\n .hi-v4-input__prepend, .hi-v4-input__append {\n position: relative;\n color: var(--color-black);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n font-size: inherit;\n text-align: center;\n -webkit-transition: all .3s;\n transition: all .3s;\n padding: 0 11px;\n border: 1px solid transparent;\n white-space: nowrap; }\n .hi-v4-input__prepend, .hi-v4-input__append {\n background-color: #f8f8f8; }\n .hi-v4-input__prepend {\n border-right-width: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .hi-v4-input__append {\n border-left-width: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n .hi-v4-input--size-sm {\n font-size: 14px; }\n .hi-v4-input--size-sm .hi-v4-input {\n padding: 4px 11px; }\n .hi-v4-input--size-sm .hi-v4-input__inner {\n border-radius: 2px; }\n .hi-v4-input--size-sm .hi-v4-input__prepend {\n border-top-left-radius: 2px;\n border-bottom-left-radius: 2px; }\n .hi-v4-input--size-sm .hi-v4-input__append {\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px; }\n .hi-v4-input--size-md {\n font-size: 16px; }\n .hi-v4-input--size-md .hi-v4-input {\n padding: 8px 11px; }\n .hi-v4-input--size-md .hi-v4-input__inner {\n border-radius: 4px; }\n .hi-v4-input--size-md .hi-v4-input__prepend {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .hi-v4-input--size-md .hi-v4-input__append {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n .hi-v4-input--size-lg {\n font-size: 18px; }\n .hi-v4-input--size-lg .hi-v4-input {\n padding: 12px 11px; }\n .hi-v4-input--size-lg .hi-v4-input__inner {\n border-radius: 6px; }\n .hi-v4-input--size-lg .hi-v4-input__prepend {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px; }\n .hi-v4-input--size-lg .hi-v4-input__append {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px; }\n .hi-v4-input--appearance-outline .hi-v4-input__inner {\n border-color: var(--color-gray-30); }\n .hi-v4-input--appearance-outline .hi-v4-input__inner:not(.disabled):hover {\n border-color: var(--color-primary); }\n .hi-v4-input--appearance-outline .hi-v4-input__inner:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary); }\n .hi-v4-input--appearance-outline .hi-v4-input__inner.disabled {\n color: var(--color-gray-50);\n background-color: var(--color-gray-10); }\n .hi-v4-input--appearance-outline .hi-v4-input__prepend,\n .hi-v4-input--appearance-outline .hi-v4-input__append {\n border-color: var(--color-gray-30); }\n .hi-v4-input--appearance-unset .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\n .hi-v4-input--appearance-unset.hi-v4-input__outer--prepend .hi-v4-input,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--prefix .hi-v4-input {\n padding-left: 11px; }\n .hi-v4-input--appearance-unset.hi-v4-input__outer--append .hi-v4-input,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--suffix .hi-v4-input {\n padding-right: 11px; }\n .hi-v4-input--appearance-unset .hi-v4-input__inner {\n border-radius: 0; }\n .hi-v4-input--appearance-filled .hi-v4-input__inner {\n background-color: #f8f8f8; }\n .hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled):hover {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary); }\n .hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary);\n background-color: var(--color-white); }\n .hi-v4-input--appearance-underline .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\n .hi-v4-input--appearance-underline.hi-v4-input__outer--prepend .hi-v4-input,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--prefix .hi-v4-input {\n padding-left: 11px; }\n .hi-v4-input--appearance-underline.hi-v4-input__outer--append .hi-v4-input,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--suffix .hi-v4-input {\n padding-right: 11px; }\n .hi-v4-input--appearance-underline .hi-v4-input__inner {\n border-radius: 0; }\n .hi-v4-input--appearance-underline .hi-v4-input__inner::after {\n content: '';\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: block;\n position: absolute;\n bottom: 0;\n left: -1px;\n right: -1px;\n border-bottom: 1px solid var(--color-gray-30);\n -webkit-transition: all .3s;\n transition: all .3s; }\n .hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled):hover::after {\n border-bottom-color: var(--color-primary); }\n .hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled).focused::after {\n border-bottom-color: var(--color-primary);\n -webkit-box-shadow: 0 1px 0 0 var(--color-primary);\n box-shadow: 0 1px 0 0 var(--color-primary); }\n .hi-v4-input__outer--prepend .hi-v4-input__inner {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n .hi-v4-input__outer--append .hi-v4-input__inner {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n";
|
10
|
+
var css_248z = "@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-mock-input {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n overflow: hidden;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n width: 100%;\n height: auto;\n z-index: auto;\n font-size: inherit;\n line-height: inherit;\n color: #1f2733;\n color: var(--hi-v4-color-gray-700, #1f2733);\n border: 1px solid transparent;\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-mock-input:not(.disabled):hover {\n z-index: calc(1 + 1);\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-mock-input:not(.disabled).focused {\n z-index: calc(1 + 1);\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-mock-input.disabled {\n cursor: not-allowed; }\n.hi-v4-mock-input__suffix, .hi-v4-mock-input__placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-mock-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n width: 16px;\n height: 16px;\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n text-align: center;\n color: #929aa6;\n color: var(--hi-v4-color-gray-500, #929aa6);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n visibility: hidden;\n opacity: 0;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1)); }\n.hi-v4-mock-input__clear:hover {\n color: #000;\n color: var(--hi-v4-color-static-black, #000); }\n.hi-v4-mock-input__clear.active {\n visibility: visible;\n opacity: 1; }\n.hi-v4-mock-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6);\n font-size: 1rem;\n font-size: var(--hi-v4-text-size-lg, 1rem);\n padding-left: 8px;\n padding-left: var(--hi-v4-spacing-4, 8px);\n text-align: center; }\n.hi-v4-mock-input__value {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: inline-block;\n width: auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap; }\n.hi-v4-mock-input--size-sm {\n height: 24px;\n height: var(--hi-v4-height-xs, 24px);\n font-size: 0.75rem;\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: 1.25rem;\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px);\n padding: 1px calc(12px - 1px);\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--size-md {\n height: 32px;\n height: var(--hi-v4-height-normal, 32px);\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n line-height: 1.375rem;\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px);\n padding: 4px calc(12px - 1px);\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--size-lg {\n height: 40px;\n height: var(--hi-v4-height-xl, 40px);\n font-size: 1rem;\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: 1.5rem;\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px);\n padding: 7px calc(12px - 1px);\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--appearance-line {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-mock-input--appearance-line:not(.disabled):hover {\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-mock-input--appearance-line:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-mock-input--appearance-line:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-line:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-line:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\n.hi-v4-mock-input--appearance-unset {\n width: auto;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n border-color: transparent; }\n.hi-v4-mock-input--appearance-unset:not(.disabled):hover {\n background-color: #f2f4f7;\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-mock-input--appearance-unset:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-mock-input--appearance-unset:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-unset:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-unset:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\n.hi-v4-mock-input--appearance-filled {\n background-color: #f2f4f7;\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-mock-input--appearance-filled:not(.disabled):hover {\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-mock-input--appearance-filled:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-mock-input--appearance-filled:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-filled:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-filled:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\n.hi-v4-mock-input--appearance-line.disabled, .hi-v4-mock-input--appearance-unset.disabled, .hi-v4-mock-input--appearance-filled.disabled {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-mock-input--appearance-line.disabled, .hi-v4-mock-input--appearance-filled.disabled {\n background-color: #ebedf0;\n background-color: var(--hi-v4-color-gray-200, #ebedf0); }\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-input {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n display: inline-block;\n box-sizing: border-box;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n width: 100%;\n font-size: inherit;\n line-height: inherit;\n color: #1f2733;\n color: var(--hi-v4-color-gray-700, #1f2733); }\n.hi-v4-input::-webkit-input-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input::-moz-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input::-ms-input-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input:-ms-input-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input::placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input:disabled {\n cursor: not-allowed; }\n.hi-v4-input__inner {\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n height: auto;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: inherit;\n border: 1px solid transparent;\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff);\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n outline: none;\n z-index: auto; }\n.hi-v4-input__inner:not(.disabled):hover {\n z-index: calc(1 + 1);\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-input__inner:not(.disabled).focused {\n z-index: calc(1 + 1);\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-input__outer {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n margin: 0;\n padding: 0;\n height: auto;\n width: 100%;\n vertical-align: middle; }\n.hi-v4-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: auto;\n text-align: center;\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n color: #929aa6;\n color: var(--hi-v4-color-gray-500, #929aa6);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n visibility: hidden;\n opacity: 0; }\n.hi-v4-input__clear:hover {\n color: #1f2733;\n color: var(--hi-v4-color-gray-700, #1f2733); }\n.hi-v4-input__clear.active {\n visibility: visible;\n opacity: 1; }\n.hi-v4-input__inner--suffix .hi-v4-input__clear {\n -webkit-margin-end: 4px;\n margin-inline-end: 4px;\n -webkit-margin-end: var(--hi-v4-spacing-2, 4px);\n margin-inline-end: var(--hi-v4-spacing-2, 4px); }\n.hi-v4-input__prefix, .hi-v4-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: #1f2733;\n color: var(--hi-v4-color-gray-700, #1f2733);\n font-size: inherit;\n text-align: center; }\n.hi-v4-input__prefix {\n padding-left: calc(12px - 1px);\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input__suffix {\n padding-right: calc(12px - 1px);\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input__prepend, .hi-v4-input__append {\n position: relative;\n color: #1f2733;\n color: var(--hi-v4-color-gray-700, #1f2733);\n background-color: #f5f7fa;\n background-color: var(--hi-v4-color-gray-50, #f5f7fa);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n font-size: inherit;\n text-align: center;\n padding: 0 calc(12px - 1px);\n padding: 0 calc(var(--hi-v4-spacing-6, 12px) - 1px);\n border: 1px solid transparent;\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n white-space: nowrap;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n z-index: 1;\n z-index: var(--hi-v4-zindex-absolute, 1); }\n.hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n margin-right: -1px; }\n.hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n margin-left: -1px; }\n.hi-v4-input--size-sm {\n height: 24px;\n height: var(--hi-v4-height-xs, 24px);\n font-size: 0.75rem;\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: 1.25rem; }\n.hi-v4-input--size-sm .hi-v4-input {\n padding: 1px calc(12px - 1px);\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-sm .hi-v4-input__inner,\n .hi-v4-input--size-sm .hi-v4-input__prepend,\n .hi-v4-input--size-sm .hi-v4-input__append {\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\n.hi-v4-input--size-sm .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-sm .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--size-md {\n height: 32px;\n height: var(--hi-v4-height-normal, 32px);\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n line-height: 1.375rem; }\n.hi-v4-input--size-md .hi-v4-input {\n padding: 4px calc(12px - 1px);\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-md .hi-v4-input__inner,\n .hi-v4-input--size-md .hi-v4-input__prepend,\n .hi-v4-input--size-md .hi-v4-input__append {\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\n.hi-v4-input--size-md .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-md .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--size-lg {\n height: 40px;\n height: var(--hi-v4-height-xl, 40px);\n font-size: 1rem;\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: 1.5rem; }\n.hi-v4-input--size-lg .hi-v4-input {\n padding: 7px calc(12px - 1px);\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-lg .hi-v4-input__inner,\n .hi-v4-input--size-lg .hi-v4-input__prepend,\n .hi-v4-input--size-lg .hi-v4-input__append {\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\n.hi-v4-input--size-lg .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-lg .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--appearance-line .hi-v4-input__inner {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.disabled):hover {\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\n.hi-v4-input--appearance-line .hi-v4-input__prepend,\n .hi-v4-input--appearance-line .hi-v4-input__append {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-unset .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-input--appearance-unset.hi-v4-input__outer--prepend .hi-v4-input,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--prefix .hi-v4-input {\n padding-left: calc(12px - 1px);\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-unset.hi-v4-input__outer--append .hi-v4-input,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--suffix .hi-v4-input {\n padding-right: calc(12px - 1px);\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-unset .hi-v4-input__inner {\n border-radius: 0; }\n.hi-v4-input--appearance-filled .hi-v4-input__inner {\n background-color: #f2f4f7;\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled):hover {\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\n.hi-v4-input--appearance-underline .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-input--appearance-underline.hi-v4-input__outer--prepend .hi-v4-input,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--prefix .hi-v4-input {\n padding-left: calc(12px - 1px);\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-underline.hi-v4-input__outer--append .hi-v4-input,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--suffix .hi-v4-input {\n padding-right: calc(12px - 1px);\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner {\n border-radius: 0; }\n.hi-v4-input--appearance-underline .hi-v4-input__inner::after {\n content: '';\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: block;\n position: absolute;\n bottom: 0;\n left: -1px;\n right: -1px;\n border-bottom: 1px solid #dfe2e8;\n border-bottom: 1px solid var(--hi-v4-color-gray-300, #dfe2e8);\n -webkit-transition: all 0.3s;\n transition: all 0.3s; }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled):hover::after {\n border-bottom-color: #237ffa;\n border-bottom-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled).focused::after {\n border-bottom-color: #237ffa;\n border-bottom-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled).invalid::after {\n border-bottom-color: #ff5959;\n border-bottom-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled).invalid.hover::after {\n border-bottom-color: #ff5959;\n border-bottom-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-input--appearance-line .hi-v4-input__inner.disabled, .hi-v4-input--appearance-unset .hi-v4-input__inner.disabled, .hi-v4-input--appearance-filled .hi-v4-input__inner.disabled, .hi-v4-input--appearance-underline .hi-v4-input__inner.disabled {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6);\n background-color: #ebedf0;\n background-color: var(--hi-v4-color-gray-200, #ebedf0); }\n.hi-v4-input__outer--prepend .hi-v4-input__inner {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend {\n border: none;\n padding: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend .hi-v4-mock-input {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend .hi-v4-button {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--append .hi-v4-input__inner {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append {\n border: none;\n padding: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append .hi-v4-mock-input {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append .hi-v4-button {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\ntextarea.hi-v4-input {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n display: block;\n resize: vertical;\n overflow: auto;\n position: relative;\n width: 100%;\n z-index: auto;\n border: 1px solid transparent;\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff);\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: 200ms;\n transition-duration: 200ms;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n transition-timing-function: cubic-bezier(0.37, 0.02, 0.34, 1);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n color: #1f2733;\n color: var(--hi-v4-color-gray-700, #1f2733); }\ntextarea.hi-v4-input::-webkit-input-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\ntextarea.hi-v4-input::-moz-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\ntextarea.hi-v4-input::-ms-input-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\ntextarea.hi-v4-input:-ms-input-placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\ntextarea.hi-v4-input::placeholder {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\ntextarea.hi-v4-input:disabled {\n cursor: not-allowed; }\ntextarea.hi-v4-input:not(.disabled):hover {\n z-index: calc(1 + 1);\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\ntextarea.hi-v4-input:not(.disabled).focused {\n z-index: calc(1 + 1);\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\ntextarea.hi-v4-input--size-sm {\n height: auto;\n font-size: 0.75rem;\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: 1.25rem;\n padding: 1px calc(12px - 1px);\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px);\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\ntextarea.hi-v4-input--size-md {\n height: auto;\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n line-height: 1.375rem;\n padding: 4px calc(12px - 1px);\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px);\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\ntextarea.hi-v4-input--size-lg {\n height: auto;\n font-size: 1rem;\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: 1.5rem;\n padding: 7px calc(12px - 1px);\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px);\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\ntextarea.hi-v4-input--appearance-line {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\ntextarea.hi-v4-input--appearance-line:not(.disabled):hover {\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\ntextarea.hi-v4-input--appearance-line:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\ntextarea.hi-v4-input--appearance-line:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-line:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-line:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\ntextarea.hi-v4-input--appearance-unset {\n border-radius: 0; }\ntextarea.hi-v4-input--appearance-unset .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\ntextarea.hi-v4-input--appearance-filled {\n background-color: #f2f4f7;\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\ntextarea.hi-v4-input--appearance-filled:not(.disabled):hover {\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\ntextarea.hi-v4-input--appearance-filled:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px #bde2ff;\n box-shadow: 0 0 0 2px #bde2ff;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n box-shadow: 0 0 0 2px var(--hi-v4-color-brandblue-100, #bde2ff);\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa);\n background-color: #fff;\n background-color: var(--hi-v4-color-static-white, #fff); }\ntextarea.hi-v4-input--appearance-filled:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-filled:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-filled:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px #ffd1c9;\n box-shadow: 0 0 0 2px #ffd1c9;\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9);\n box-shadow: 0 0 0 2px var(--hi-v4-color-red-100, #ffd1c9); }\ntextarea.hi-v4-input--appearance-underline {\n padding-left: 0;\n padding-right: 0;\n border-radius: 0; }\ntextarea.hi-v4-input--appearance-underline::after {\n content: '';\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: block;\n position: absolute;\n bottom: 0;\n left: -1px;\n right: -1px;\n border-bottom: 1px solid #dfe2e8;\n border-bottom: 1px solid var(--hi-v4-color-gray-300, #dfe2e8);\n -webkit-transition: all 0.3s;\n transition: all 0.3s; }\ntextarea.hi-v4-input--appearance-underline:not(.disabled):hover::after {\n border-bottom-color: #237ffa;\n border-bottom-color: var(--hi-v4-color-brandblue-500, #237ffa); }\ntextarea.hi-v4-input--appearance-underline:not(.disabled).focused::after {\n border-bottom-color: #237ffa;\n border-bottom-color: var(--hi-v4-color-brandblue-500, #237ffa); }\ntextarea.hi-v4-input--appearance-underline:not(.disabled).invalid::after {\n border-bottom-color: #ff5959;\n border-bottom-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-underline:not(.disabled).invalid.hover::after {\n border-bottom-color: #ff5959;\n border-bottom-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-line.disabled, textarea.hi-v4-input--appearance-unset.disabled, textarea.hi-v4-input--appearance-filled.disabled, textarea.hi-v4-input--appearance-underline.disabled {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6);\n background-color: #ebedf0;\n background-color: var(--hi-v4-color-gray-200, #ebedf0); }\n";
|
11
11
|
|
12
12
|
var __styleInject__ = require('style-inject/dist/style-inject.es.js')["default"];
|
13
13
|
|
@@ -0,0 +1,119 @@
|
|
1
|
+
/** @LICENSE
|
2
|
+
* @hi-ui/input
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
|
4
|
+
*
|
5
|
+
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
+
*
|
7
|
+
* This source code is licensed under the MIT license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
import { useCallback, useState, useMemo } from 'react';
|
11
|
+
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
12
|
+
import { useLatestCallback } from '@hi-ui/use-latest';
|
13
|
+
import { setAttrStatus } from '@hi-ui/dom-utils';
|
14
|
+
import { pure, format, formatAmount } from './utils/index.js';
|
15
|
+
|
16
|
+
var useInput = function useInput(_ref) {
|
17
|
+
var name = _ref.name,
|
18
|
+
_ref$autoFocus = _ref.autoFocus,
|
19
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
20
|
+
_ref$disabled = _ref.disabled,
|
21
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
22
|
+
_ref$readOnly = _ref.readOnly,
|
23
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
24
|
+
maxLength = _ref.maxLength,
|
25
|
+
placeholder = _ref.placeholder,
|
26
|
+
_ref$defaultValue = _ref.defaultValue,
|
27
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
28
|
+
valueProp = _ref.value,
|
29
|
+
onChange = _ref.onChange,
|
30
|
+
onFocus = _ref.onFocus,
|
31
|
+
onBlur = _ref.onBlur,
|
32
|
+
_ref$trimValueOnBlur = _ref.trimValueOnBlur,
|
33
|
+
trimValueOnBlur = _ref$trimValueOnBlur === void 0 ? false : _ref$trimValueOnBlur,
|
34
|
+
_ref$type = _ref.type,
|
35
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
36
|
+
clearElementRef = _ref.clearElementRef; // Object.is 避免 trimValueOnBlur 和 点击 clearIcon 触发 2 次相同的 onCHange
|
37
|
+
|
38
|
+
var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, onChange, Object.is),
|
39
|
+
value = _useUncontrolledState[0],
|
40
|
+
tryChangeValue = _useUncontrolledState[1];
|
41
|
+
|
42
|
+
var handleChange = useCallback(function (evt, trim) {
|
43
|
+
if (trim === void 0) {
|
44
|
+
trim = false;
|
45
|
+
}
|
46
|
+
|
47
|
+
evt.persist();
|
48
|
+
var nextValue = evt.target.value;
|
49
|
+
var valueTrue = pure(nextValue, type); // 防溢出,保证 onChange 拿到的是值是最新的 formatted value
|
50
|
+
|
51
|
+
var value = format(nextValue, type);
|
52
|
+
|
53
|
+
if (trim) {
|
54
|
+
valueTrue = valueTrue.trim();
|
55
|
+
value = value.trim();
|
56
|
+
}
|
57
|
+
|
58
|
+
var event = Object.create(evt);
|
59
|
+
event.target = Object.assign(Object.assign({}, evt.target), {
|
60
|
+
value: value
|
61
|
+
});
|
62
|
+
tryChangeValue(valueTrue, event);
|
63
|
+
}, [tryChangeValue, type]);
|
64
|
+
|
65
|
+
var _useState = useState(autoFocus),
|
66
|
+
focused = _useState[0],
|
67
|
+
setFocused = _useState[1];
|
68
|
+
|
69
|
+
var handleFocus = useLatestCallback(function (evt) {
|
70
|
+
setFocused(true);
|
71
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(evt);
|
72
|
+
});
|
73
|
+
var handleBlur = useLatestCallback(function (event) {
|
74
|
+
var relatedTarget = event.relatedTarget; // 拦截 clear 情况 触发 input 失焦
|
75
|
+
|
76
|
+
if (clearElementRef && clearElementRef.current && clearElementRef.current === relatedTarget) {
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
|
80
|
+
setFocused(false); // amount 自动添加小数
|
81
|
+
|
82
|
+
if (type === 'amount') {
|
83
|
+
event.target.value = formatAmount(value, true);
|
84
|
+
handleChange(event, trimValueOnBlur);
|
85
|
+
} else if (trimValueOnBlur) {
|
86
|
+
handleChange(event, true);
|
87
|
+
}
|
88
|
+
|
89
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
90
|
+
});
|
91
|
+
var nativeInputProps = useMemo(function () {
|
92
|
+
return {
|
93
|
+
name: name,
|
94
|
+
disabled: disabled,
|
95
|
+
readOnly: readOnly,
|
96
|
+
autoFocus: autoFocus,
|
97
|
+
placeholder: placeholder,
|
98
|
+
maxLength: maxLength,
|
99
|
+
'data-focused': setAttrStatus(focused)
|
100
|
+
};
|
101
|
+
}, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);
|
102
|
+
var getInputProps = useCallback(function () {
|
103
|
+
return Object.assign(Object.assign({}, nativeInputProps), {
|
104
|
+
value: format(value, type),
|
105
|
+
onChange: handleChange,
|
106
|
+
onFocus: handleFocus,
|
107
|
+
onBlur: handleBlur
|
108
|
+
});
|
109
|
+
}, [value, type, handleChange, handleFocus, handleBlur, nativeInputProps]);
|
110
|
+
return {
|
111
|
+
focused: focused,
|
112
|
+
value: value,
|
113
|
+
tryChangeValue: tryChangeValue,
|
114
|
+
getInputProps: getInputProps
|
115
|
+
};
|
116
|
+
};
|
117
|
+
|
118
|
+
export { useInput };
|
119
|
+
//# sourceMappingURL=use-input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-input.js","sources":["../../src/use-input.ts"],"sourcesContent":[null],"names":["useInput","name","autoFocus","disabled","readOnly","maxLength","placeholder","defaultValue","valueProp","value","onChange","onFocus","onBlur","trimValueOnBlur","type","clearElementRef","useUncontrolledState","Object","is","tryChangeValue","handleChange","useCallback","evt","trim","persist","nextValue","target","valueTrue","pure","format","event","create","useState","focused","setFocused","handleFocus","useLatestCallback","handleBlur","relatedTarget","current","formatAmount","nativeInputProps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AM,CAACpB,KAAD,EAAQK,IAAR;AACbJ,MAAAA,QAAQ,EAAEU;AACVT,MAAAA,OAAO,EAAEwB;AACTvB,MAAAA,MAAM,EAAEyB;;AANqB,GAAA,EAQ9B,CAAC5B,KAAD,EAAQK,IAAR,EAAcM,YAAd,EAA4Be,WAA5B,EAAyCE,UAAzC,EAAqDI,gBAArD,CAR8B;SAU1B;AACLR,IAAAA,OAAO,EAAPA,OADK;AAELxB,IAAAA,KAAK,EAALA,KAFK;AAGLU,IAAAA,cAAc,EAAdA,cAHK;AAILyB,IAAAA,aAAa,EAAbA;AAJK;;;"}
|
@@ -0,0 +1,176 @@
|
|
1
|
+
/** @LICENSE
|
2
|
+
* @hi-ui/input
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
|
4
|
+
*
|
5
|
+
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
+
*
|
7
|
+
* This source code is licensed under the MIT license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
/**
|
12
|
+
* 格式化身份证
|
13
|
+
*/
|
14
|
+
var formatId = function formatId(val) {
|
15
|
+
val = val.replace(/[^a-zA-Z0-9]/g, '');
|
16
|
+
var len = val.length;
|
17
|
+
|
18
|
+
if (val === '' || len < 7) {
|
19
|
+
return val;
|
20
|
+
}
|
21
|
+
|
22
|
+
if (len < 11) {
|
23
|
+
return val.slice(0, 6) + ' ' + val.slice(6, 10);
|
24
|
+
} else if (len < 15) {
|
25
|
+
return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14);
|
26
|
+
} else {
|
27
|
+
return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14) + ' ' + val.slice(14, 18);
|
28
|
+
}
|
29
|
+
};
|
30
|
+
|
31
|
+
var pureId = function pureId(val) {
|
32
|
+
var tmp = val.replace(/[^\d|.]/g, '');
|
33
|
+
return tmp.slice(0, 18);
|
34
|
+
};
|
35
|
+
/**
|
36
|
+
* 格式化手机号
|
37
|
+
*/
|
38
|
+
|
39
|
+
|
40
|
+
var formatTel = function formatTel(val) {
|
41
|
+
val = val.replace(/\D/g, '');
|
42
|
+
var len = val.length;
|
43
|
+
|
44
|
+
if (val === '' || len < 4) {
|
45
|
+
return val;
|
46
|
+
}
|
47
|
+
|
48
|
+
if (len < 8) {
|
49
|
+
return val.slice(0, 3) + ' ' + val.slice(3, 7);
|
50
|
+
} else {
|
51
|
+
return val.slice(0, 3) + ' ' + val.slice(3, 7) + ' ' + val.slice(7, 11);
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
var pureTel = function pureTel(val) {
|
56
|
+
var tmp = val.replace(/[^\d|.]/g, '');
|
57
|
+
return tmp.slice(0, 11);
|
58
|
+
};
|
59
|
+
/**
|
60
|
+
* 格式化银行卡号
|
61
|
+
*/
|
62
|
+
|
63
|
+
|
64
|
+
var formatCard = function formatCard(val) {
|
65
|
+
val = val.replace(/\D/g, '');
|
66
|
+
var len = val.length;
|
67
|
+
|
68
|
+
if (val === '' || val.length < 5) {
|
69
|
+
return val;
|
70
|
+
}
|
71
|
+
|
72
|
+
if (len < 9) {
|
73
|
+
return val.slice(0, 4) + ' ' + val.slice(4, 8);
|
74
|
+
} else if (len < 13) {
|
75
|
+
return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12);
|
76
|
+
} else if (len < 17) {
|
77
|
+
return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16);
|
78
|
+
} else {
|
79
|
+
return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16) + ' ' + val.slice(16, 19);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
var pureCard = function pureCard(val) {
|
84
|
+
var tmp = val.replace(/[^\d|.]/g, '');
|
85
|
+
return tmp.slice(0, 19);
|
86
|
+
};
|
87
|
+
/**
|
88
|
+
* 金额自动生成小数
|
89
|
+
* @param {string} val 需要处理的值
|
90
|
+
*/
|
91
|
+
|
92
|
+
|
93
|
+
var formatAmount = function formatAmount(val, fill) {
|
94
|
+
if (fill === void 0) {
|
95
|
+
fill = false;
|
96
|
+
}
|
97
|
+
|
98
|
+
val = val.replace(/[^\d|.|,]/g, '').replace(/(\.\d*?)(\.|,).*/, function (_, $1) {
|
99
|
+
return $1;
|
100
|
+
});
|
101
|
+
|
102
|
+
if (fill) {
|
103
|
+
if (!val) return val;
|
104
|
+
return val.indexOf('.') > -1 ? val : val + '.00';
|
105
|
+
}
|
106
|
+
|
107
|
+
return val;
|
108
|
+
};
|
109
|
+
|
110
|
+
var pureAmount = function pureAmount(val) {
|
111
|
+
var tmp = val.replace(/[^\d|.]/g, '');
|
112
|
+
return tmp;
|
113
|
+
};
|
114
|
+
|
115
|
+
var formatEmail = function formatEmail(val) {
|
116
|
+
return val.replace(/\W/g, '');
|
117
|
+
};
|
118
|
+
|
119
|
+
var pureEmail = function pureEmail(val) {
|
120
|
+
return val;
|
121
|
+
};
|
122
|
+
/**
|
123
|
+
* 输入规则
|
124
|
+
*/
|
125
|
+
|
126
|
+
|
127
|
+
var format = function format(val, type) {
|
128
|
+
switch (type) {
|
129
|
+
case 'id':
|
130
|
+
return formatId(val);
|
131
|
+
|
132
|
+
case 'tel':
|
133
|
+
return formatTel(val);
|
134
|
+
|
135
|
+
case 'card':
|
136
|
+
return formatCard(val);
|
137
|
+
|
138
|
+
case 'email':
|
139
|
+
return formatEmail(val);
|
140
|
+
|
141
|
+
case 'amount':
|
142
|
+
return formatAmount(val);
|
143
|
+
|
144
|
+
default:
|
145
|
+
return val;
|
146
|
+
}
|
147
|
+
};
|
148
|
+
/**
|
149
|
+
* 净化规则
|
150
|
+
*/
|
151
|
+
|
152
|
+
|
153
|
+
var pure = function pure(val, type) {
|
154
|
+
switch (type) {
|
155
|
+
case 'id':
|
156
|
+
return pureId(val);
|
157
|
+
|
158
|
+
case 'tel':
|
159
|
+
return pureTel(val);
|
160
|
+
|
161
|
+
case 'card':
|
162
|
+
return pureCard(val);
|
163
|
+
|
164
|
+
case 'email':
|
165
|
+
return pureEmail(val);
|
166
|
+
|
167
|
+
case 'amount':
|
168
|
+
return pureAmount(val);
|
169
|
+
|
170
|
+
default:
|
171
|
+
return val;
|
172
|
+
}
|
173
|
+
};
|
174
|
+
|
175
|
+
export { format, formatAmount, formatCard, formatEmail, formatId, formatTel, pure, pureAmount, pureCard, pureEmail, pureId, pureTel };
|
176
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":[null],"names":["formatId","val","replace","len","length","slice","pureId","tmp","formatTel","pureTel","formatCard","pureCard","formatAmount","fill","_","$1","indexOf","pureAmount","formatEmail","pureEmail","format","type","pure"],"mappings":";;;;;;;;;;AAAA;;;IAGaA,QAAQ,GAAG,SAAXA,QAAW,CAACC,GAAD;AACtBA,EAAAA,GAAG,GAAGA,GAAG,CAACC,OAAJD,CAAY,eAAZA,EAA6B,EAA7BA,CAANA;MACME,GAAG,GAAGF,GAAG,CAACG;;MAEZH,GAAG,KAAK,EAARA,IAAcE,GAAG,GAAG,GAAG;WAClBF;;;MAGLE,GAAG,GAAG,IAAI;WACLF,GAAG,CAACI,KAAJJ,CAAU,CAAVA,EAAa,CAAbA,IAAkB,GAAlBA,GAAwBA,GAAG,CAACI,KAAJJ,CAAU,CAAVA,EAAa,EAAbA;AADjC,SAEO,IAAIE,GAAG,GAAG,EAAV,EAAc;WACZF,GAAG,CAACI,KAAJJ,CAAU,CAAVA,EAAa,CAAbA,IAAkB,GAAlBA,GAAwBA,GAAG,CAACI,KAAJJ,CAAU,CAAVA,EAAa,EAAbA,CAAxBA,GAA2C,GAA3CA,GAAiDA,GAAG,CAACI,KAAJJ,CAAU,EAAVA,EAAc,EAAdA;AADnD,GAAA,MAEA;WAEHA,GA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AG,SAAPA,IAAO,CAACrB,GAAD,EAAcoB,IAAd;UACVA;SACD;aACIf,MAAM,CAACL,GAAD;;SACV;aACIQ,OAAO,CAACR,GAAD;;SACX;aACIU,QAAQ,CAACV,GAAD;;SACZ;aACIkB,SAAS,CAAClB,GAAD;;SACb;aACIgB,UAAU,CAAChB,GAAD;;;aAEVA;;;;"}
|
package/lib/types/Input.d.ts
CHANGED
@@ -1,25 +1,17 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { HiBaseAppearanceEnum, HiBaseHTMLFieldProps } from '@hi-ui/core';
|
2
3
|
/**
|
3
|
-
*
|
4
|
+
* 输入框
|
5
|
+
*
|
6
|
+
* @TODO:
|
7
|
+
* 1. size api 确认
|
8
|
+
* 2. 修改类名结构
|
9
|
+
* 3. 支持带数字展示
|
10
|
+
* 4. InputGroup 模式支持
|
11
|
+
* 5. 手动聚焦支持额外配置
|
4
12
|
*/
|
5
13
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | null>>;
|
6
|
-
export interface InputProps {
|
7
|
-
/**
|
8
|
-
* 组件默认的选择器类
|
9
|
-
*/
|
10
|
-
prefixCls?: string;
|
11
|
-
/**
|
12
|
-
* 组件的语义化 Role 属性
|
13
|
-
*/
|
14
|
-
role?: string;
|
15
|
-
/**
|
16
|
-
* 组件的注入选择器类
|
17
|
-
*/
|
18
|
-
className?: string;
|
19
|
-
/**
|
20
|
-
* 组件的注入样式
|
21
|
-
*/
|
22
|
-
style?: React.CSSProperties;
|
14
|
+
export interface InputProps extends HiBaseHTMLFieldProps<'input'> {
|
23
15
|
/**
|
24
16
|
* 开启输入框只读
|
25
17
|
*/
|
@@ -32,10 +24,6 @@ export interface InputProps {
|
|
32
24
|
* 开启输入框自动聚焦
|
33
25
|
*/
|
34
26
|
autoFocus?: boolean;
|
35
|
-
/**
|
36
|
-
* 输入框字段名称
|
37
|
-
*/
|
38
|
-
name?: string;
|
39
27
|
/**
|
40
28
|
* 设置输入框的值
|
41
29
|
*/
|
@@ -47,17 +35,17 @@ export interface InputProps {
|
|
47
35
|
/**
|
48
36
|
* 设置输入框类型,支持原生 input 的 type 属性所有值
|
49
37
|
*/
|
50
|
-
type?: 'text' | '
|
38
|
+
type?: 'text' | 'id' | 'tel' | 'card' | 'amount' | 'email' | string;
|
51
39
|
/**
|
52
40
|
* 输入最大长度
|
53
41
|
*/
|
54
42
|
maxLength?: number;
|
55
43
|
/**
|
56
|
-
*
|
44
|
+
* 输入框前置外部内容
|
57
45
|
*/
|
58
46
|
prepend?: React.ReactNode;
|
59
47
|
/**
|
60
|
-
*
|
48
|
+
* 输入框后置外部内容
|
61
49
|
*/
|
62
50
|
append?: React.ReactNode;
|
63
51
|
/**
|
@@ -73,40 +61,33 @@ export interface InputProps {
|
|
73
61
|
*/
|
74
62
|
clearable?: boolean;
|
75
63
|
/**
|
76
|
-
*
|
64
|
+
* 开启失焦时触发对值的 trim,将触发 onChange 给用户
|
77
65
|
*/
|
78
|
-
|
66
|
+
trimValueOnBlur?: boolean;
|
79
67
|
/**
|
80
|
-
*
|
68
|
+
* 清除按钮展示的触发形态
|
81
69
|
*/
|
82
|
-
|
70
|
+
clearableTrigger?: 'always' | 'hover';
|
83
71
|
/**
|
84
72
|
* 输入框占位符
|
85
73
|
*/
|
86
74
|
placeholder?: string;
|
87
75
|
/**
|
88
76
|
* 设置展现形式
|
77
|
+
* 其中 `underline` 内部使用,不对外提供支持(风格去线型化:由线性过渡到面性)
|
89
78
|
*/
|
90
|
-
appearance?:
|
79
|
+
appearance?: HiBaseAppearanceEnum | 'underline';
|
91
80
|
/**
|
92
|
-
*
|
81
|
+
* 设置尺寸
|
93
82
|
*/
|
94
83
|
size?: 'sm' | 'md' | 'lg';
|
95
84
|
/**
|
96
85
|
* 值改变时的回调
|
97
86
|
*/
|
98
|
-
onChange?: (evt: React.ChangeEvent<HTMLInputElement
|
99
|
-
/**
|
100
|
-
* 获得焦点时的回调
|
101
|
-
*/
|
102
|
-
onFocus?: (evt: React.FocusEvent<HTMLInputElement>) => void;
|
103
|
-
/**
|
104
|
-
* 失去焦点时的回调
|
105
|
-
*/
|
106
|
-
onBlur?: (evt: React.FocusEvent<HTMLInputElement>) => void;
|
87
|
+
onChange?: (evt: React.ChangeEvent<HTMLInputElement>, value: string) => void;
|
107
88
|
}
|
108
89
|
/**
|
109
|
-
*
|
90
|
+
* 模拟伪装目标事件 target
|
110
91
|
*
|
111
92
|
* @param target
|
112
93
|
* @param evt
|
@@ -114,4 +95,4 @@ export interface InputProps {
|
|
114
95
|
* @param targetValue
|
115
96
|
* @returns
|
116
97
|
*/
|
117
|
-
export declare function onChangeMock(onChange: (event: React.ChangeEvent<HTMLInputElement
|
98
|
+
export declare function onChangeMock(onChange: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void, evt: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLElement>, target: HTMLInputElement | null, targetValue: string): void;
|