kui-complex 0.0.10 → 0.0.12

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/dist/index.js CHANGED
@@ -20,8 +20,6 @@ var reactScroll = require('react-scroll');
20
20
  var ru = require('date-fns/locale/ru');
21
21
  var luxon = require('luxon');
22
22
  var Swiper = require('react-id-swiper');
23
- var yup = require('yup');
24
- var yup$1 = require('@hookform/resolvers/yup');
25
23
 
26
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
25
 
@@ -50,7 +48,6 @@ var DatePicker__default = /*#__PURE__*/_interopDefaultLegacy(DatePicker);
50
48
  var InputMask__default = /*#__PURE__*/_interopDefaultLegacy(InputMask);
51
49
  var ru__default = /*#__PURE__*/_interopDefaultLegacy(ru);
52
50
  var Swiper__default = /*#__PURE__*/_interopDefaultLegacy(Swiper);
53
- var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
54
51
 
55
52
  /******************************************************************************
56
53
  Copyright (c) Microsoft Corporation.
@@ -801,87 +798,14 @@ var InputPhoneWithForm = React.forwardRef(function (props, ref) {
801
798
  }
802
799
  phoneRegister.field.ref(elem);
803
800
  };
804
- return (jsxRuntime.jsx(kuiBasic.InputWithCountryDropdown, __assign({ errorMessage: errorMessage, hiddenInputProps: __assign(__assign({}, codeRegister.field), hiddenInputProps), onSelectCountry: handleCountryChange }, phoneRegister.field, other, { onChange: handleChange, ref: forwardedRef, autoComplete: "false" })));
801
+ return (jsxRuntime.jsx(kuiBasic.InputWithCountryDropdown, __assign({ errorMessage: errorMessage,
802
+ // @ts-ignore
803
+ hiddenInputProps: __assign(__assign({}, codeRegister.field), hiddenInputProps), onSelectCountry: handleCountryChange }, phoneRegister.field, other, { onChange: handleChange, ref: forwardedRef, autoComplete: "false" })));
805
804
  });
806
805
  InputPhoneWithForm.defaultProps = {
807
806
  name: "phone",
808
807
  };
809
808
 
810
- var InputWithMask = React.forwardRef(function (_a, ref) {
811
- var form = _a.form, name = _a.name, error = _a.error, inputProps = __rest(_a, ["form", "name", "error"]);
812
- var handleChange = function (e, field) {
813
- field.onChange(e);
814
- if (inputProps.onChange) {
815
- inputProps.onChange(e);
816
- }
817
- };
818
- var forwardedRef = function (elem, field) {
819
- if (ref) {
820
- // eslint-disable-next-line no-param-reassign
821
- // @ts-ignore
822
- ref.current = elem;
823
- }
824
- field.ref(elem);
825
- };
826
- var getError = function (fieldState) {
827
- var _a;
828
- return typeof error !== "undefined" && String(error).length > 0
829
- ? error
830
- : (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
831
- };
832
- return (jsxRuntime.jsx(reactHookForm.Controller, { control: form === null || form === void 0 ? void 0 : form.control, name: name, render: function (_a) {
833
- var field = _a.field, fieldState = _a.fieldState;
834
- return (jsxRuntime.jsx(kuiBasic.InputWithMask, __assign({ errorMessage: getError(fieldState) }, field, inputProps, { onChange: function (e) {
835
- return handleChange(e, field);
836
- }, value: field.value || "", ref: function (e) { return forwardedRef(e, field); } })));
837
- } }));
838
- });
839
-
840
- var Schema = yup__namespace.object().shape({
841
- fields: yup__namespace.object({
842
- basic: yup__namespace.string().required("basic"),
843
- withMask: yup__namespace.string().required("withMask"),
844
- select: yup__namespace.string().required("select"),
845
- withDatepicker: yup__namespace
846
- .date()
847
- .max(new Date("2022-10-15"), "date")
848
- .required("withDatepicker")
849
- .nullable(),
850
- withMonthpicker: yup__namespace.date().required("withMonthpicker"),
851
- phone: yup__namespace.object({
852
- phoneNumber: yup__namespace.string().required("phone"),
853
- }),
854
- password: yup__namespace.string().required("password"),
855
- }),
856
- });
857
- var TestForm = function () {
858
- var form = reactHookForm.useForm({
859
- defaultValues: {
860
- fields: {
861
- basic: "Basic input",
862
- withMask: "565-632",
863
- select: "second",
864
- withDatepicker: new Date(),
865
- withMonthpicker: new Date(),
866
- phone: {
867
- phoneNumber: "9123456987",
868
- phoneCode: "93",
869
- },
870
- switch: true,
871
- password: "password",
872
- },
873
- },
874
- resolver: yup$1.yupResolver(Schema),
875
- });
876
- var handleSubmit = function (data) {
877
- console.log(data);
878
- };
879
- return (jsxRuntime.jsxs("form", __assign({ onSubmit: form.handleSubmit(handleSubmit, handleSubmit) }, { children: [jsxRuntime.jsx("button", __assign({ type: "submit" }, { children: "Submit" })), jsxRuntime.jsx(InputWithController, { form: form, name: "fields.basic", label: "Basic" }), jsxRuntime.jsx(InputWithMask, { mask: "999-999", form: form, name: "fields.withMask", label: "With mask" }), jsxRuntime.jsx(InputSelect, { form: form, name: "fields.select", label: "Select", options: [
880
- { label: "First", value: "first" },
881
- { label: "Second", value: "second" },
882
- ] }), jsxRuntime.jsx(InputWithDatePicker, { form: form, name: "fields.withDatepicker", label: "With Datepicker" }), jsxRuntime.jsx(InputWithMonthPicker, { form: form, name: "fields.withMonthpicker", label: "With Monthpicker" }), jsxRuntime.jsx(InputPhoneWithForm, { form: form, name: "fields.phone", label: "Phone" }), jsxRuntime.jsx(Switch, { form: form, name: "fields.switch", label: "Switch" }), jsxRuntime.jsx(InputPassword, { form: form, name: "fields.password", label: "Password" })] })));
883
- };
884
-
885
809
  exports.Avatar = Avatar;
886
810
  exports.ButtonTab = ButtonTab;
887
811
  exports.ButtonsPanel = ButtonsPanel;
@@ -893,6 +817,7 @@ exports.DesktopMenuPanel = DesktopMenuPanel;
893
817
  exports.InputDropdown = InputDropdown;
894
818
  exports.InputForDatepicker = InputForDatepicker;
895
819
  exports.InputPassword = InputPassword;
820
+ exports.InputPhoneWithForm = InputPhoneWithForm;
896
821
  exports.InputSelect = InputSelect;
897
822
  exports.InputSelectDropdown = InputSelectDropdown;
898
823
  exports.InputTextAreaMobile = InputTextAreaMobile;
@@ -909,6 +834,5 @@ exports.PassportStrengthBar = PassportStrengthBar;
909
834
  exports.SelectMonth = SelectMonth;
910
835
  exports.SelectYear = SelectYear;
911
836
  exports.Switch = Switch;
912
- exports.TestForm = TestForm;
913
837
  exports.UndefinedAvatar = UndefinedAvatar;
914
838
  //# sourceMappingURL=index.js.map