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.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { RefObject, ReactNode } from 'react';
4
4
  import * as kui_basic from 'kui-basic';
5
- import { InputWithAdornmentsProps, GridProps, SwitchProps, CaptionProps } from 'kui-basic';
5
+ import { InputWithAdornmentsProps, GridProps, SwitchProps, CaptionProps, InputWithCountryDropdownProps } from 'kui-basic';
6
6
  import { UseFormReturn, FieldValues } from 'react-hook-form';
7
7
  import * as react_datepicker from 'react-datepicker';
8
8
  import { ReactDatePickerProps } from 'react-datepicker';
@@ -244,6 +244,13 @@ type UndefinedAvatarProps = {
244
244
 
245
245
  declare const UndefinedAvatar: ({ label, ...otherProps }: UndefinedAvatarProps) => JSX.Element;
246
246
 
247
- declare const TestForm: () => JSX.Element;
247
+ interface InputPhoneWithFormProps<T>
248
+ extends Omit<InputWithCountryDropdownProps, "form"> {
249
+ form: UseFormReturn<T>
250
+ name?: string
251
+ error?: string | null
252
+ }
253
+
254
+ declare const InputPhoneWithForm: React__default.ForwardRefExoticComponent<Pick<InputPhoneWithFormProps<FieldValues>, "label" | "size" | "color" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "form" | "pattern" | "height" | "width" | "list" | "step" | "alt" | "crossOrigin" | "src" | "type" | "endIcon" | "startIcon" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "error" | "inputRef" | "cornerLabel" | "isTextArea" | "inputStyles" | "labelStyles" | "messageClassName" | "labelInlineStyles" | "errorMessage" | "inputValue" | "accept" | "autoComplete" | "capture" | "checked" | "enterKeyHint" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "onSelectCountry" | "hiddenInputProps"> & React__default.RefAttributes<HTMLInputElement>>;
248
255
 
249
- export { Avatar, ButtonTab, ButtonsPanel, CalendarHeaderWithSelect, CalendarStandardContainer, CalendarStandardHeader, DesktopInputWithMonthPicker, DesktopMenuPanel, InputDropdown, InputForDatepicker, InputPassword, InputSelect, InputSelectDropdown, InputTextAreaMobile, InputWithController, InputWithDatePicker, InputWithMonthPicker, MenuItem, MenuPanel, MobileInputWithMonthPicker, MobileMenuPanel, MonthPickerContainer, MonthPickerHeader, PassportStrengthBar, SelectMonth, SelectYear, Switch, TestForm, UndefinedAvatar };
256
+ export { Avatar, ButtonTab, ButtonsPanel, CalendarHeaderWithSelect, CalendarStandardContainer, CalendarStandardHeader, DesktopInputWithMonthPicker, DesktopMenuPanel, InputDropdown, InputForDatepicker, InputPassword, InputPhoneWithForm, InputSelect, InputSelectDropdown, InputTextAreaMobile, InputWithController, InputWithDatePicker, InputWithMonthPicker, MenuItem, MenuPanel, MobileInputWithMonthPicker, MobileMenuPanel, MonthPickerContainer, MonthPickerHeader, PassportStrengthBar, SelectMonth, SelectYear, Switch, UndefinedAvatar };
package/dist/index.es.js CHANGED
@@ -4,21 +4,19 @@ import { jsx as jsx$1, jsxs, Fragment } from '@emotion/react/jsx-runtime';
4
4
  import styled from '@emotion/styled';
5
5
  import { css } from '@emotion/react';
6
6
  import { jsx, jsxs as jsxs$1, Fragment as Fragment$1 } from 'react/jsx-runtime';
7
- import { theme, Caption, Button, Container, Grid, InputWithAdornments, Heading, IconButton, LinearProgress, Divider, Modal, Switch as Switch$1, InputWithCountryDropdown, InputWithMask as InputWithMask$1 } from 'kui-basic';
7
+ import { theme, Caption, Button, Container, Grid, InputWithAdornments, Heading, IconButton, LinearProgress, Divider, Modal, Switch as Switch$1, InputWithCountryDropdown } from 'kui-basic';
8
8
  import * as React from 'react';
9
9
  import { useEffect, useRef, forwardRef, useState } from 'react';
10
10
  import { useHistory } from 'react-router-dom';
11
11
  import { HalfArrowIcon, PrevArrowIcon, NextArrowIcon, CalendarIcon, ArrowBackIcon, ArrowNextIcon, ClosedEyeIcon, OpenEyeIcon, CheckIcon } from 'kui-icon';
12
12
  import _ from 'lodash';
13
13
  import DatePicker, { registerLocale } from 'react-datepicker';
14
- import { Controller, useController, useForm } from 'react-hook-form';
14
+ import { Controller, useController } from 'react-hook-form';
15
15
  import InputMask from 'react-input-mask';
16
16
  import { scroller, Events, Link, animateScroll, Element } from 'react-scroll';
17
17
  import ru from 'date-fns/locale/ru';
18
18
  import { DateTime } from 'luxon';
19
19
  import Swiper from 'react-id-swiper';
20
- import * as yup from 'yup';
21
- import { yupResolver } from '@hookform/resolvers/yup';
22
20
 
23
21
  /******************************************************************************
24
22
  Copyright (c) Microsoft Corporation.
@@ -775,80 +773,5 @@ InputPhoneWithForm.defaultProps = {
775
773
  name: "phone",
776
774
  };
777
775
 
778
- var InputWithMask = forwardRef(function (_a, ref) {
779
- var form = _a.form, name = _a.name, error = _a.error, inputProps = __rest(_a, ["form", "name", "error"]);
780
- var handleChange = function (e, field) {
781
- field.onChange(e);
782
- if (inputProps.onChange) {
783
- inputProps.onChange(e);
784
- }
785
- };
786
- var forwardedRef = function (elem, field) {
787
- if (ref) {
788
- // eslint-disable-next-line no-param-reassign
789
- // @ts-ignore
790
- ref.current = elem;
791
- }
792
- field.ref(elem);
793
- };
794
- var getError = function (fieldState) {
795
- var _a;
796
- return typeof error !== "undefined" && String(error).length > 0
797
- ? error
798
- : (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
799
- };
800
- return (jsx(Controller, { control: form === null || form === void 0 ? void 0 : form.control, name: name, render: function (_a) {
801
- var field = _a.field, fieldState = _a.fieldState;
802
- return (jsx(InputWithMask$1, __assign({ errorMessage: getError(fieldState) }, field, inputProps, { onChange: function (e) {
803
- return handleChange(e, field);
804
- }, value: field.value || "", ref: function (e) { return forwardedRef(e, field); } })));
805
- } }));
806
- });
807
-
808
- var Schema = yup.object().shape({
809
- fields: yup.object({
810
- basic: yup.string().required("basic"),
811
- withMask: yup.string().required("withMask"),
812
- select: yup.string().required("select"),
813
- withDatepicker: yup
814
- .date()
815
- .max(new Date("2022-10-15"), "date")
816
- .required("withDatepicker")
817
- .nullable(),
818
- withMonthpicker: yup.date().required("withMonthpicker"),
819
- phone: yup.object({
820
- phoneNumber: yup.string().required("phone"),
821
- }),
822
- password: yup.string().required("password"),
823
- }),
824
- });
825
- var TestForm = function () {
826
- var form = useForm({
827
- defaultValues: {
828
- fields: {
829
- basic: "Basic input",
830
- withMask: "565-632",
831
- select: "second",
832
- withDatepicker: new Date(),
833
- withMonthpicker: new Date(),
834
- phone: {
835
- phoneNumber: "9123456987",
836
- phoneCode: "93",
837
- },
838
- switch: true,
839
- password: "password",
840
- },
841
- },
842
- resolver: yupResolver(Schema),
843
- });
844
- var handleSubmit = function (data) {
845
- console.log(data);
846
- };
847
- return (jsxs$1("form", __assign({ onSubmit: form.handleSubmit(handleSubmit, handleSubmit) }, { children: [jsx("button", __assign({ type: "submit" }, { children: "Submit" })), jsx(InputWithController, { form: form, name: "fields.basic", label: "Basic" }), jsx(InputWithMask, { mask: "999-999", form: form, name: "fields.withMask", label: "With mask" }), jsx(InputSelect, { form: form, name: "fields.select", label: "Select", options: [
848
- { label: "First", value: "first" },
849
- { label: "Second", value: "second" },
850
- ] }), jsx(InputWithDatePicker, { form: form, name: "fields.withDatepicker", label: "With Datepicker" }), jsx(InputWithMonthPicker, { form: form, name: "fields.withMonthpicker", label: "With Monthpicker" }), jsx(InputPhoneWithForm, { form: form, name: "fields.phone", label: "Phone" }), jsx(Switch, { form: form, name: "fields.switch", label: "Switch" }), jsx(InputPassword, { form: form, name: "fields.password", label: "Password" })] })));
851
- };
852
-
853
- export { Avatar, ButtonTab, ButtonsPanel, CalendarHeaderWithSelect, CalendarStandardContainer, CalendarStandardHeader, DesktopInputWithMonthPicker, DesktopMenuPanel, InputDropdown, InputForDatepicker, InputPassword, InputSelect, InputSelectDropdown, InputTextAreaMobile, InputWithController, InputWithDatePicker, InputWithMonthPicker, MenuItem, MenuPanel, MobileInputWithMonthPicker, MobileMenuPanel, MonthPickerContainer, MonthPickerHeader, PassportStrengthBar, SelectMonth, SelectYear, Switch, TestForm, UndefinedAvatar };
776
+ export { Avatar, ButtonTab, ButtonsPanel, CalendarHeaderWithSelect, CalendarStandardContainer, CalendarStandardHeader, DesktopInputWithMonthPicker, DesktopMenuPanel, InputDropdown, InputForDatepicker, InputPassword, InputPhoneWithForm, InputSelect, InputSelectDropdown, InputTextAreaMobile, InputWithController, InputWithDatePicker, InputWithMonthPicker, MenuItem, MenuPanel, MobileInputWithMonthPicker, MobileMenuPanel, MonthPickerContainer, MonthPickerHeader, PassportStrengthBar, SelectMonth, SelectYear, Switch, UndefinedAvatar };
854
777
  //# sourceMappingURL=index.es.js.map