kui-complex 0.0.10 → 0.0.11

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.
@@ -807,81 +804,6 @@ InputPhoneWithForm.defaultProps = {
807
804
  name: "phone",
808
805
  };
809
806
 
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
807
  exports.Avatar = Avatar;
886
808
  exports.ButtonTab = ButtonTab;
887
809
  exports.ButtonsPanel = ButtonsPanel;
@@ -893,6 +815,7 @@ exports.DesktopMenuPanel = DesktopMenuPanel;
893
815
  exports.InputDropdown = InputDropdown;
894
816
  exports.InputForDatepicker = InputForDatepicker;
895
817
  exports.InputPassword = InputPassword;
818
+ exports.InputPhoneWithForm = InputPhoneWithForm;
896
819
  exports.InputSelect = InputSelect;
897
820
  exports.InputSelectDropdown = InputSelectDropdown;
898
821
  exports.InputTextAreaMobile = InputTextAreaMobile;
@@ -909,6 +832,5 @@ exports.PassportStrengthBar = PassportStrengthBar;
909
832
  exports.SelectMonth = SelectMonth;
910
833
  exports.SelectYear = SelectYear;
911
834
  exports.Switch = Switch;
912
- exports.TestForm = TestForm;
913
835
  exports.UndefinedAvatar = UndefinedAvatar;
914
836
  //# sourceMappingURL=index.js.map