@mw-kit/mw-ui 1.7.42 → 1.7.44
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.
|
@@ -24,6 +24,9 @@ export interface PhoneProps extends Omit<InputProps, 'type' | 'mask' | 'placehol
|
|
|
24
24
|
type: 'phone';
|
|
25
25
|
setValue: (value: string) => void;
|
|
26
26
|
value?: string;
|
|
27
|
+
placeholder?: Partial<{
|
|
28
|
+
[k in keyof Countries]: string;
|
|
29
|
+
}>;
|
|
27
30
|
}
|
|
28
31
|
export interface Details {
|
|
29
32
|
country: Country;
|
package/dist/index.js
CHANGED
|
@@ -15203,7 +15203,10 @@ var Component = React__default.forwardRef(function (props, ref) {
|
|
|
15203
15203
|
var value = props.value,
|
|
15204
15204
|
setValue = props.setValue;
|
|
15205
15205
|
|
|
15206
|
-
var _useState = React.useState('')
|
|
15206
|
+
var _useState = React.useState(!value ? '' : function () {
|
|
15207
|
+
var details = getPhoneDetails(value);
|
|
15208
|
+
return details ? details.masked : '';
|
|
15209
|
+
}),
|
|
15207
15210
|
inputValue = _useState[0],
|
|
15208
15211
|
setInputValue = _useState[1];
|
|
15209
15212
|
|
|
@@ -15262,13 +15265,14 @@ var Component = React__default.forwardRef(function (props, ref) {
|
|
|
15262
15265
|
var v = inputValue.replace(/\D+/g, '').substring(0, country.charLimit);
|
|
15263
15266
|
setValue(country.ddi + " " + v);
|
|
15264
15267
|
}, [inputValue]);
|
|
15268
|
+
var placeholder = props.placeholder && props.placeholder[country.iso] ? props.placeholder[country.iso] : country.placeholder;
|
|
15265
15269
|
return React__default.createElement(RelativeContainer$3, {
|
|
15266
15270
|
ref: useOnClickOut(function () {
|
|
15267
15271
|
return setOpen(false);
|
|
15268
15272
|
})
|
|
15269
15273
|
}, React__default.createElement(Input$1, Object.assign({}, props, {
|
|
15270
15274
|
type: 'text',
|
|
15271
|
-
placeholder:
|
|
15275
|
+
placeholder: placeholder,
|
|
15272
15276
|
mask: mask,
|
|
15273
15277
|
value: inputValue,
|
|
15274
15278
|
setValue: setInputValue,
|