kui-complex 0.0.49 → 0.0.50
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/InputPassword/cjs/index.js +8 -56
- package/InputPassword/cjs/index.js.map +1 -1
- package/InputPassword/index.js +1 -31
- package/InputPassword/index.js.map +1 -1
- package/InputTextAreaMobile/cjs/index.js +4 -52
- package/InputTextAreaMobile/cjs/index.js.map +1 -1
- package/InputTextAreaMobile/index.js +1 -31
- package/InputTextAreaMobile/index.js.map +1 -1
- package/InputWithController/cjs/index.js +3 -52
- package/InputWithController/cjs/index.js.map +1 -1
- package/InputWithController/index.d.ts +1 -1
- package/InputWithController/index.js +1 -31
- package/InputWithController/index.js.map +1 -1
- package/TestForm/cjs/index.js +42 -72
- package/TestForm/cjs/index.js.map +1 -1
- package/TestForm/index.js +1 -31
- package/TestForm/index.js.map +1 -1
- package/cjs/index.js +1 -30
- package/cjs/index.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -30
- package/index.js.map +1 -1
- package/package.json +1 -1
package/TestForm/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import { jsx, jsxs as jsxs$1, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Controller, useController, useForm } from 'react-hook-form';
|
|
3
3
|
import * as yup from 'yup';
|
|
4
4
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
5
|
-
import * as React from 'react';
|
|
6
5
|
import { forwardRef, useRef, useEffect, useState } from 'react';
|
|
7
6
|
import { InputWithAdornments, Grid, theme, Caption, Divider, Button, Modal, IconButton, InputWithCountryDropdown, Switch as Switch$1, LinearProgress, InputWithMask as InputWithMask$1 } from 'kui-basic';
|
|
8
7
|
import { jsx as jsx$1, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
@@ -58,31 +57,6 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
58
57
|
return cooked;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
function setRef(ref, value) {
|
|
62
|
-
if (typeof ref === "function") {
|
|
63
|
-
ref(value);
|
|
64
|
-
}
|
|
65
|
-
else if (ref) {
|
|
66
|
-
ref.current = value;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function useForkRef() {
|
|
70
|
-
var refs = [];
|
|
71
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
72
|
-
refs[_i] = arguments[_i];
|
|
73
|
-
}
|
|
74
|
-
return React.useMemo(function () {
|
|
75
|
-
if (refs.every(function (ref) { return ref == null; })) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return function (instance) {
|
|
79
|
-
refs.forEach(function (ref) {
|
|
80
|
-
setRef(ref, instance);
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
}, refs);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
60
|
var InputWithController = forwardRef(function (_a, ref) {
|
|
87
61
|
var form = _a.form, name = _a.name, error = _a.error, value = _a.value, inputProps = __rest(_a, ["form", "name", "error", "value"]);
|
|
88
62
|
var handleChange = function (e, field) {
|
|
@@ -91,10 +65,6 @@ var InputWithController = forwardRef(function (_a, ref) {
|
|
|
91
65
|
inputProps.onChange(e);
|
|
92
66
|
}
|
|
93
67
|
};
|
|
94
|
-
var forwardedRef = function (elem, field) {
|
|
95
|
-
useForkRef(ref);
|
|
96
|
-
field.ref(elem);
|
|
97
|
-
};
|
|
98
68
|
var getError = function (fieldState) {
|
|
99
69
|
var _a;
|
|
100
70
|
return typeof error !== "undefined" && String(error).length > 0
|
|
@@ -105,7 +75,7 @@ var InputWithController = forwardRef(function (_a, ref) {
|
|
|
105
75
|
var field = _a.field, fieldState = _a.fieldState;
|
|
106
76
|
return (jsx(InputWithAdornments, __assign({ message: getError(fieldState) }, field, inputProps, { onChange: function (e) {
|
|
107
77
|
return handleChange(e, field);
|
|
108
|
-
}, value: typeof value !== "undefined" ? value : field.value || "",
|
|
78
|
+
}, value: typeof value !== "undefined" ? value : field.value || "", inputRef: ref })));
|
|
109
79
|
} }));
|
|
110
80
|
});
|
|
111
81
|
|