@hi-ui/input 4.0.0-alpha.2 → 4.0.0-alpha.24
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/lib/cjs/Input.js +77 -74
- package/lib/cjs/Input.js.map +1 -1
- package/lib/cjs/MockInput.js +151 -0
- package/lib/cjs/MockInput.js.map +1 -0
- package/lib/cjs/TextArea.js +102 -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 +98 -0
- package/lib/cjs/use-input.js.map +1 -0
- package/lib/esm/Input.js +77 -73
- package/lib/esm/Input.js.map +1 -1
- package/lib/esm/MockInput.js +129 -0
- package/lib/esm/MockInput.js.map +1 -0
- package/lib/esm/TextArea.js +81 -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 +89 -0
- package/lib/esm/use-input.js.map +1 -0
- package/lib/types/Input.d.ts +9 -27
- package/lib/types/MockInput.d.ts +134 -0
- package/lib/types/TextArea.d.ts +22 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/use-input.d.ts +70 -0
- package/package.json +12 -9
@@ -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>.
|
@@ -12,7 +12,7 @@
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
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";
|
15
|
+
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-outline {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-mock-input--appearance-outline:not(.disabled):hover {\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-mock-input--appearance-outline: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-outline:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-outline:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\n.hi-v4-mock-input--appearance-outline: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-outline.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-outline.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 -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\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-outline .hi-v4-input__inner {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-outline .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-outline .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-outline .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-outline .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-outline .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-outline .hi-v4-input__prepend,\n .hi-v4-input--appearance-outline .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-outline .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-outline {\n border-color: #dfe2e8;\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\ntextarea.hi-v4-input--appearance-outline:not(.disabled):hover {\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\ntextarea.hi-v4-input--appearance-outline: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-outline:not(.disabled).invalid {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-outline:not(.disabled).invalid.hover {\n border-color: #ff5959;\n border-color: var(--hi-v4-color-red-500, #ff5959); }\ntextarea.hi-v4-input--appearance-outline: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-outline.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";
|
16
16
|
|
17
17
|
var __styleInject__ = require('style-inject/dist/style-inject.es.js')["default"];
|
18
18
|
|
@@ -0,0 +1,98 @@
|
|
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
|
+
'use strict';
|
11
|
+
|
12
|
+
Object.defineProperty(exports, '__esModule', {
|
13
|
+
value: true
|
14
|
+
});
|
15
|
+
|
16
|
+
var React = require('react');
|
17
|
+
|
18
|
+
var useUncontrolledState = require('@hi-ui/use-uncontrolled-state');
|
19
|
+
|
20
|
+
var useLatest = require('@hi-ui/use-latest');
|
21
|
+
|
22
|
+
var domUtils = require('@hi-ui/dom-utils');
|
23
|
+
|
24
|
+
var useInput = function useInput(_ref) {
|
25
|
+
var name = _ref.name,
|
26
|
+
_ref$autoFocus = _ref.autoFocus,
|
27
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
28
|
+
_ref$disabled = _ref.disabled,
|
29
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
30
|
+
_ref$readOnly = _ref.readOnly,
|
31
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
32
|
+
maxLength = _ref.maxLength,
|
33
|
+
placeholder = _ref.placeholder,
|
34
|
+
_ref$defaultValue = _ref.defaultValue,
|
35
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
36
|
+
valueProp = _ref.value,
|
37
|
+
onChange = _ref.onChange,
|
38
|
+
onFocus = _ref.onFocus,
|
39
|
+
onBlur = _ref.onBlur,
|
40
|
+
_ref$trimValueOnBlur = _ref.trimValueOnBlur,
|
41
|
+
trimValueOnBlur = _ref$trimValueOnBlur === void 0 ? false : _ref$trimValueOnBlur;
|
42
|
+
|
43
|
+
var _useUncontrolledState = useUncontrolledState.useUncontrolledState(defaultValue, valueProp, onChange),
|
44
|
+
value = _useUncontrolledState[0],
|
45
|
+
tryChangeValue = _useUncontrolledState[1];
|
46
|
+
|
47
|
+
var handleChange = React.useCallback(function (evt) {
|
48
|
+
var nextValue = evt.target.value;
|
49
|
+
tryChangeValue(nextValue, evt);
|
50
|
+
}, [tryChangeValue]);
|
51
|
+
|
52
|
+
var _useState = React.useState(autoFocus),
|
53
|
+
focused = _useState[0],
|
54
|
+
setFocused = _useState[1];
|
55
|
+
|
56
|
+
var handleFocus = useLatest.useLatestCallback(function (evt) {
|
57
|
+
setFocused(true);
|
58
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(evt);
|
59
|
+
});
|
60
|
+
var handleBlur = useLatest.useLatestCallback(function (event) {
|
61
|
+
setFocused(false);
|
62
|
+
|
63
|
+
if (trimValueOnBlur) {
|
64
|
+
var nextValue = event.target.value;
|
65
|
+
tryChangeValue(nextValue.trim(), event);
|
66
|
+
}
|
67
|
+
|
68
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
69
|
+
});
|
70
|
+
var nativeInputProps = React.useMemo(function () {
|
71
|
+
return {
|
72
|
+
name: name,
|
73
|
+
disabled: disabled,
|
74
|
+
readOnly: readOnly,
|
75
|
+
autoFocus: autoFocus,
|
76
|
+
placeholder: placeholder,
|
77
|
+
maxLength: maxLength,
|
78
|
+
'data-focused': domUtils.setAttrStatus(focused)
|
79
|
+
};
|
80
|
+
}, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);
|
81
|
+
var getInputProps = React.useCallback(function () {
|
82
|
+
return Object.assign(Object.assign({}, nativeInputProps), {
|
83
|
+
value: value,
|
84
|
+
onChange: handleChange,
|
85
|
+
onFocus: handleFocus,
|
86
|
+
onBlur: handleBlur
|
87
|
+
});
|
88
|
+
}, [value, handleChange, handleFocus, handleBlur, nativeInputProps]);
|
89
|
+
return {
|
90
|
+
focused: focused,
|
91
|
+
value: value,
|
92
|
+
tryChangeValue: tryChangeValue,
|
93
|
+
getInputProps: getInputProps
|
94
|
+
};
|
95
|
+
};
|
96
|
+
|
97
|
+
exports.useInput = useInput;
|
98
|
+
//# 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","useUncontrolledState","tryChangeValue","handleChange","useCallback","evt","nextValue","target","useState","focused","setFocused","handleFocus","useLatestCallback","handleBlur","event","trim","nativeInputProps","useMemo","setAttrStatus","getInputProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;IAKaA,QAAQ,GAAG,SAAXA,QAAW,KAAA;MACtBC,YAAAA;4BACAC;MAAAA,wCAAY;2BACZC;MAAAA,sCAAW;2BACXC;MAAAA,sCAAW;MACXC,iBAAAA;MACAC,mBAAAA;+BACAC;MAAAA,8CAAe;MACRC,iBAAPC;MACAC,gBAAAA;MACAC,eAAAA;MACAC,cAAAA;kCACAC;MAAAA,oDAAkB;;8BAEcC,yCAAAA,CAAqBP,YAArBO,EAAmCN,SAAnCM,EAA8CJ,QAA9CI;MAAzBL,KAAP;MAAcM,cAAd;;MAEMC,YAAY,GAAGC,iBAAAA,CACnB,UAACC,GAAD;QACQC,SAAS,GAAGD,GAAG,CAACE,MAAJF,CAAWT;AAC7BM,IAAAA,cAAc,CAACI,SAAD,EAAYD,GAAZ,CAAdH;AAH4B,GAAXE,EAKnB,CAACF,cAAD,CALmBE;;kBAQSI,cAAAA,CAASnB,SAATmB;MAAvBC,OAAP;MAAgBC,UAAhB;;MAEMC,WAAW,GAAGC,2BAAAA,CAClB,UAACP,GAAD;AACEK,IAAAA,UAAU,CAAC,IAAD,CAAVA;AACAZ,IAAAA,OAAO,SAAPA,IAAAA,OAAO,WAAPA,S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,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>.
|
@@ -8,15 +8,14 @@
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
10
|
import { __rest } from 'tslib';
|
11
|
-
import React, { forwardRef, useRef, useCallback, useState
|
11
|
+
import React, { forwardRef, useMemo, isValidElement, useRef, useCallback, useState } from 'react';
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
14
|
-
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
15
14
|
import { useMergeRefs } from '@hi-ui/use-merge-refs';
|
16
15
|
import { CloseCircleFilled } from '@hi-ui/icons';
|
17
|
-
|
16
|
+
import { useInput } from './use-input.js';
|
18
17
|
|
19
|
-
var _prefix = getPrefixCls(
|
18
|
+
var _prefix = getPrefixCls('input');
|
20
19
|
/**
|
21
20
|
* TODO: What is Input
|
22
21
|
*/
|
@@ -26,94 +25,102 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
26
25
|
var _a$prefixCls = _a.prefixCls,
|
27
26
|
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
28
27
|
_a$role = _a.role,
|
29
|
-
role = _a$role === void 0 ?
|
28
|
+
role = _a$role === void 0 ? 'input' : _a$role,
|
30
29
|
className = _a.className,
|
31
30
|
style = _a.style,
|
32
|
-
_a$autoFocus = _a.autoFocus,
|
33
|
-
autoFocus = _a$autoFocus === void 0 ? false : _a$autoFocus,
|
34
|
-
_a$disabled = _a.disabled,
|
35
|
-
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
36
|
-
_a$readOnly = _a.readOnly,
|
37
|
-
readOnly = _a$readOnly === void 0 ? false : _a$readOnly,
|
38
|
-
name = _a.name,
|
39
|
-
maxLength = _a.maxLength,
|
40
31
|
_a$type = _a.type,
|
41
32
|
type = _a$type === void 0 ? 'text' : _a$type,
|
42
33
|
_a$size = _a.size,
|
43
|
-
size = _a$size === void 0 ? '
|
34
|
+
size = _a$size === void 0 ? 'md' : _a$size,
|
44
35
|
_a$appearance = _a.appearance,
|
45
36
|
appearance = _a$appearance === void 0 ? 'outline' : _a$appearance,
|
46
|
-
placeholder = _a.placeholder,
|
47
37
|
prepend = _a.prepend,
|
48
38
|
append = _a.append,
|
49
39
|
prefix = _a.prefix,
|
50
40
|
suffix = _a.suffix,
|
51
|
-
_a$defaultValue = _a.defaultValue,
|
52
|
-
defaultValue = _a$defaultValue === void 0 ? '' : _a$defaultValue,
|
53
|
-
valueProp = _a.value,
|
54
|
-
onChange = _a.onChange,
|
55
|
-
onFocus = _a.onFocus,
|
56
|
-
onBlur = _a.onBlur,
|
57
41
|
_a$clearableTrigger = _a.clearableTrigger,
|
58
42
|
clearableTrigger = _a$clearableTrigger === void 0 ? 'hover' : _a$clearableTrigger,
|
59
43
|
_a$clearable = _a.clearable,
|
60
44
|
clearable = _a$clearable === void 0 ? false : _a$clearable,
|
61
|
-
|
45
|
+
_a$invalid = _a.invalid,
|
46
|
+
invalid = _a$invalid === void 0 ? false : _a$invalid,
|
47
|
+
name = _a.name,
|
48
|
+
autoFocus = _a.autoFocus,
|
49
|
+
disabled = _a.disabled,
|
50
|
+
readOnly = _a.readOnly,
|
51
|
+
maxLength = _a.maxLength,
|
52
|
+
placeholder = _a.placeholder,
|
53
|
+
defaultValue = _a.defaultValue,
|
54
|
+
valueProp = _a.value,
|
55
|
+
onChange = _a.onChange,
|
56
|
+
onFocus = _a.onFocus,
|
57
|
+
onBlur = _a.onBlur,
|
58
|
+
trimValueOnBlur = _a.trimValueOnBlur,
|
59
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "style", "type", "size", "appearance", "prepend", "append", "prefix", "suffix", "clearableTrigger", "clearable", "invalid", "name", "autoFocus", "disabled", "readOnly", "maxLength", "placeholder", "defaultValue", "value", "onChange", "onFocus", "onBlur", "trimValueOnBlur"]); // @TODO: 临时方案,后面迁移至 InputGroup
|
60
|
+
|
61
|
+
|
62
|
+
var _useMemo = useMemo(function () {
|
63
|
+
var shouldUnset = [false, false]; // @ts-ignore
|
64
|
+
// @ts-ignore
|
65
|
+
|
66
|
+
if ( /*#__PURE__*/isValidElement(prepend) && ['Select', 'Button'].includes(prepend.type.HiName)) {
|
67
|
+
shouldUnset[0] = true;
|
68
|
+
} // @ts-ignore
|
69
|
+
// @ts-ignore
|
70
|
+
|
62
71
|
|
63
|
-
|
72
|
+
if ( /*#__PURE__*/isValidElement(append) && ['Select', 'Button'].includes(append.type.HiName)) {
|
73
|
+
shouldUnset[1] = true;
|
74
|
+
}
|
75
|
+
|
76
|
+
return shouldUnset;
|
77
|
+
}, [prepend, append]),
|
78
|
+
unsetPrepend = _useMemo[0],
|
79
|
+
unsetAppend = _useMemo[1];
|
80
|
+
|
81
|
+
var inputElementRef = useRef(null);
|
64
82
|
var proxyOnChange = useCallback(function (value, evt) {
|
65
83
|
if (!onChange) return;
|
66
|
-
onChangeMock(onChange, evt,
|
84
|
+
onChangeMock(onChange, evt, inputElementRef.current, value);
|
67
85
|
}, [onChange]);
|
68
86
|
|
69
|
-
var
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
89
|
-
}, [onBlur]);
|
87
|
+
var _useInput = useInput({
|
88
|
+
name: name,
|
89
|
+
autoFocus: autoFocus,
|
90
|
+
disabled: disabled,
|
91
|
+
readOnly: readOnly,
|
92
|
+
maxLength: maxLength,
|
93
|
+
placeholder: placeholder,
|
94
|
+
defaultValue: defaultValue,
|
95
|
+
value: valueProp,
|
96
|
+
onChange: proxyOnChange,
|
97
|
+
onFocus: onFocus,
|
98
|
+
onBlur: onBlur,
|
99
|
+
trimValueOnBlur: trimValueOnBlur
|
100
|
+
}),
|
101
|
+
tryChangeValue = _useInput.tryChangeValue,
|
102
|
+
focused = _useInput.focused,
|
103
|
+
value = _useInput.value,
|
104
|
+
getInputProps = _useInput.getInputProps;
|
105
|
+
|
90
106
|
var focus = useCallback(function () {
|
91
107
|
var _a;
|
92
108
|
|
93
|
-
(_a =
|
109
|
+
(_a = inputElementRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
94
110
|
}, []);
|
95
111
|
var handleReset = useCallback(function (evt) {
|
96
112
|
tryChangeValue('', evt);
|
97
113
|
focus();
|
98
114
|
}, [tryChangeValue, focus]);
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
readOnly: readOnly,
|
104
|
-
autoFocus: autoFocus,
|
105
|
-
placeholder: placeholder,
|
106
|
-
maxLength: maxLength
|
107
|
-
};
|
108
|
-
}, [disabled, readOnly, autoFocus, placeholder, maxLength, name]);
|
109
|
-
|
110
|
-
var _useState2 = useState(false),
|
111
|
-
hover = _useState2[0],
|
112
|
-
setHover = _useState2[1]; // 在开启 clearable 下展示 清除内容按钮,可点击进行内容清楚
|
115
|
+
|
116
|
+
var _useState = useState(false),
|
117
|
+
hover = _useState[0],
|
118
|
+
setHover = _useState[1]; // 在开启 clearable 下展示 清除内容按钮,可点击进行内容清楚
|
113
119
|
|
114
120
|
|
115
121
|
var showClearableIcon = clearable && !!value && !disabled;
|
116
|
-
var
|
122
|
+
var mergedRef = useMergeRefs(ref, inputElementRef);
|
123
|
+
var cls = cx(className, prefixCls + "__outer", prepend && prefixCls + "__outer--prepend", prepend && unsetPrepend && prefixCls + "__outer--prepend-unset", append && prefixCls + "__outer--append", append && unsetAppend && prefixCls + "__outer--append-unset", prefixCls + "--appearance-" + appearance, prefixCls + "--size-" + size);
|
117
124
|
return /*#__PURE__*/React.createElement("div", {
|
118
125
|
role: role,
|
119
126
|
className: cls,
|
@@ -121,7 +128,8 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
121
128
|
}, prepend ? /*#__PURE__*/React.createElement("div", {
|
122
129
|
className: prefixCls + "__prepend"
|
123
130
|
}, prepend) : null, /*#__PURE__*/React.createElement("div", {
|
124
|
-
className: cx(prefixCls + "__inner", prefix && prefixCls + "__inner--prefix", suffix && prefixCls + "__inner--suffix",
|
131
|
+
className: cx(prefixCls + "__inner", prefix && prefixCls + "__inner--prefix", suffix && prefixCls + "__inner--suffix", // TODO: bem规范统一
|
132
|
+
focused && "focused", disabled && 'disabled', readOnly && 'readonly', invalid && 'invalid'),
|
125
133
|
onMouseOver: function onMouseOver(e) {
|
126
134
|
setHover(true);
|
127
135
|
},
|
@@ -131,14 +139,10 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
131
139
|
}, prefix ? /*#__PURE__*/React.createElement("span", {
|
132
140
|
className: prefixCls + "__prefix"
|
133
141
|
}, prefix) : null, /*#__PURE__*/React.createElement("input", Object.assign({
|
134
|
-
ref:
|
142
|
+
ref: mergedRef,
|
135
143
|
className: cx(prefixCls, focused && "focused", disabled && 'disabled', readOnly && 'readonly'),
|
136
|
-
type: type
|
137
|
-
|
138
|
-
onChange: handleChange,
|
139
|
-
onFocus: handleFocus,
|
140
|
-
onBlur: handleBlur
|
141
|
-
}, rest, nativeInputProps)), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
144
|
+
type: type
|
145
|
+
}, getInputProps(), rest)), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
142
146
|
className: prefixCls + "__suffix"
|
143
147
|
}, showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
144
148
|
className: cx(prefixCls + "__clear", (clearableTrigger === 'always' || hover) && 'active'),
|
@@ -154,7 +158,7 @@ if (__DEV__) {
|
|
154
158
|
Input.displayName = 'Input';
|
155
159
|
}
|
156
160
|
/**
|
157
|
-
*
|
161
|
+
* 模拟伪装目标事件 target
|
158
162
|
*
|
159
163
|
* @param target
|
160
164
|
* @param evt
|
@@ -165,9 +169,9 @@ if (__DEV__) {
|
|
165
169
|
|
166
170
|
|
167
171
|
function onChangeMock(onChange, evt, target, targetValue) {
|
168
|
-
var event = evt; // 点击 clearIcon
|
172
|
+
var event = evt; // 点击 clearIcon 或者 失焦 trim 时,都会代理 onChange 的事件对象 target 指向 input.target
|
169
173
|
|
170
|
-
if (evt.type
|
174
|
+
if (evt.type !== 'change') {
|
171
175
|
if (!target) return;
|
172
176
|
var originalTargetValue = target.value;
|
173
177
|
event = Object.create(evt);
|
package/lib/esm/Input.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../src/Input.tsx"],"sourcesContent":[null],"names":["
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../src/Input.tsx"],"sourcesContent":[null],"names":["_prefix","getPrefixCls","Input","forwardRef","_a","ref","prefixCls","role","className","style","type","size","appearance","prepend","append","prefix","suffix","clearableTrigger","clearable","invalid","name","autoFocus","disabled","readOnly","maxLength","placeholder","defaultValue","valueProp","value","onChange","onFocus","onBlur","trimValueOnBlur","rest","useMemo","shouldUnset","isValidElement","includes","HiName","unsetPrepend","unsetAppend","inputElementRef","useRef","proxyOnChange","useCallback","evt","onChangeMock","current","useInput","tryChangeValue","focused","getInputProps","focus","handleReset","useState","hover","setHover","showClearableIcon","mergedRef","useMergeRefs","cls","cx","React","onMouseOver","e","onMouseLeave","tabIndex","onClick","CloseCircleFilled","__DEV__","displayName","target","targetValue","event","originalTargetValue","Object","create","currentTarget"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAMA,OAAO,GAAGC,YAAY,CAAC,OAAD,CAA5B;AAEA;;;;;IAGaC,KAAK,gBAAGC,UAAU,CAC7B,UACEC,EADF,EA+BEC,GA/BF;wBAEIC;MAAAA,sCAAYN;mBACZO;MAA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CAAR5C;;;"}
|
@@ -0,0 +1,129 @@
|
|
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 { __rest } from 'tslib';
|
11
|
+
import React, { forwardRef, useMemo, useCallback, useState } from 'react';
|
12
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
13
|
+
import { __DEV__ } from '@hi-ui/env';
|
14
|
+
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
15
|
+
import { CloseCircleFilled } from '@hi-ui/icons';
|
16
|
+
var _role = 'mock-input';
|
17
|
+
|
18
|
+
var _prefix = getPrefixCls(_role);
|
19
|
+
|
20
|
+
var NOOP_VALUE = '';
|
21
|
+
var NOOP_ARRAY = [];
|
22
|
+
/**
|
23
|
+
* 支持自定义渲染输入框内容,暂时仅供内部 Picker 类组件使用,不对外提供
|
24
|
+
*/
|
25
|
+
|
26
|
+
var MockInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
27
|
+
var _a$prefixCls = _a.prefixCls,
|
28
|
+
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
29
|
+
_a$role = _a.role,
|
30
|
+
role = _a$role === void 0 ? _role : _a$role,
|
31
|
+
className = _a.className,
|
32
|
+
_a$data = _a.data,
|
33
|
+
data = _a$data === void 0 ? NOOP_ARRAY : _a$data,
|
34
|
+
_a$defaultValue = _a.defaultValue,
|
35
|
+
defaultValue = _a$defaultValue === void 0 ? NOOP_VALUE : _a$defaultValue,
|
36
|
+
valueProp = _a.value,
|
37
|
+
onChange = _a.onChange,
|
38
|
+
placeholder = _a.placeholder,
|
39
|
+
_a$disabled = _a.disabled,
|
40
|
+
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
41
|
+
_a$clearable = _a.clearable,
|
42
|
+
clearable = _a$clearable === void 0 ? false : _a$clearable,
|
43
|
+
_a$focused = _a.focused,
|
44
|
+
focused = _a$focused === void 0 ? false : _a$focused,
|
45
|
+
_a$invalid = _a.invalid,
|
46
|
+
invalid = _a$invalid === void 0 ? false : _a$invalid,
|
47
|
+
_a$readOnly = _a.readOnly,
|
48
|
+
readOnly = _a$readOnly === void 0 ? false : _a$readOnly,
|
49
|
+
_a$size = _a.size,
|
50
|
+
size = _a$size === void 0 ? 'md' : _a$size,
|
51
|
+
_a$appearance = _a.appearance,
|
52
|
+
appearance = _a$appearance === void 0 ? 'outline' : _a$appearance,
|
53
|
+
_a$clearableTrigger = _a.clearableTrigger,
|
54
|
+
clearableTrigger = _a$clearableTrigger === void 0 ? 'hover' : _a$clearableTrigger,
|
55
|
+
displayRender = _a.displayRender,
|
56
|
+
suffix = _a.suffix,
|
57
|
+
_onMouseOver = _a.onMouseOver,
|
58
|
+
_onMouseLeave = _a.onMouseLeave,
|
59
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "data", "defaultValue", "value", "onChange", "placeholder", "disabled", "clearable", "focused", "invalid", "readOnly", "size", "appearance", "clearableTrigger", "displayRender", "suffix", "onMouseOver", "onMouseLeave"]);
|
60
|
+
|
61
|
+
var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, onChange),
|
62
|
+
value = _useUncontrolledState[0],
|
63
|
+
tryChangeValue = _useUncontrolledState[1];
|
64
|
+
|
65
|
+
var displayValue = useMemo(function () {
|
66
|
+
if (value === '') return null;
|
67
|
+
var displayItem = data.find(function (item) {
|
68
|
+
return item.id === value;
|
69
|
+
});
|
70
|
+
if (!displayItem) return null;
|
71
|
+
|
72
|
+
if (displayRender) {
|
73
|
+
return displayRender(displayItem);
|
74
|
+
}
|
75
|
+
|
76
|
+
return displayItem.title;
|
77
|
+
}, [data, value, displayRender]);
|
78
|
+
var handleClear = useCallback(function (evt) {
|
79
|
+
if (disabled) return;
|
80
|
+
evt.stopPropagation();
|
81
|
+
tryChangeValue(NOOP_VALUE);
|
82
|
+
}, [tryChangeValue, disabled]);
|
83
|
+
|
84
|
+
var _useState = useState(false),
|
85
|
+
hover = _useState[0],
|
86
|
+
setHover = _useState[1];
|
87
|
+
|
88
|
+
var trySetHover = useCallback(function (hovered) {
|
89
|
+
if (disabled) return;
|
90
|
+
setHover(hovered);
|
91
|
+
}, [disabled]);
|
92
|
+
var hasValue = !!displayValue; // 在开启 clearable 下展示 清除内容按钮,可点击进行内容清除
|
93
|
+
|
94
|
+
var showClearableIcon = useMemo(function () {
|
95
|
+
return clearable && hasValue && !disabled && (clearableTrigger === 'always' || hover);
|
96
|
+
}, [clearable, hasValue, disabled, clearableTrigger, hover]);
|
97
|
+
var cls = cx(prefixCls, className, prefixCls + "--appearance-" + appearance, prefixCls + "--size-" + size, focused && "focused", disabled && 'disabled', readOnly && 'readonly', invalid && 'invalid');
|
98
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
99
|
+
ref: ref,
|
100
|
+
role: role,
|
101
|
+
className: cls,
|
102
|
+
onMouseOver: function onMouseOver(evt) {
|
103
|
+
trySetHover(true);
|
104
|
+
_onMouseOver === null || _onMouseOver === void 0 ? void 0 : _onMouseOver(evt);
|
105
|
+
},
|
106
|
+
onMouseLeave: function onMouseLeave(evt) {
|
107
|
+
trySetHover(false);
|
108
|
+
_onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(evt);
|
109
|
+
}
|
110
|
+
}, rest), hasValue ? /*#__PURE__*/React.createElement("span", {
|
111
|
+
className: prefixCls + "__value"
|
112
|
+
}, displayValue) : /*#__PURE__*/React.createElement("span", {
|
113
|
+
className: prefixCls + "__placeholder"
|
114
|
+
}, placeholder), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
115
|
+
className: prefixCls + "__suffix"
|
116
|
+
}, showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
117
|
+
role: "button",
|
118
|
+
tabIndex: -1,
|
119
|
+
className: cx(prefixCls + "__clear", 'active'),
|
120
|
+
onClick: handleClear
|
121
|
+
}, /*#__PURE__*/React.createElement(CloseCircleFilled, null)) : suffix) : null);
|
122
|
+
});
|
123
|
+
|
124
|
+
if (__DEV__) {
|
125
|
+
MockInput.displayName = 'MockInput';
|
126
|
+
}
|
127
|
+
|
128
|
+
export { MockInput };
|
129
|
+
//# sourceMappingURL=MockInput.js.map
|