@uxf/form 11.12.0 → 11.13.0

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.
Files changed (45) hide show
  1. package/avatar-file-input/avatar-file-input.d.ts +5 -6
  2. package/avatar-file-input/avatar-file-input.js +0 -1
  3. package/checkbox-button/checkbox-button.d.ts +4 -6
  4. package/checkbox-button/checkbox-button.js +0 -1
  5. package/checkbox-input/checkbox-input.d.ts +4 -6
  6. package/checkbox-input/checkbox-input.js +0 -1
  7. package/color-radio-group/color-radio-group.d.ts +5 -7
  8. package/color-radio-group/color-radio-group.js +0 -1
  9. package/combobox/combobox.d.ts +4 -6
  10. package/combobox/combobox.js +0 -1
  11. package/date-picker-input/date-picker-input.d.ts +3 -2
  12. package/date-picker-input/date-picker-input.js +0 -1
  13. package/date-range-picker-input/date-range-picker-input.d.ts +3 -2
  14. package/date-range-picker-input/date-range-picker-input.js +0 -1
  15. package/datetime-picker-input/datetime-picker-input.d.ts +3 -2
  16. package/datetime-picker-input/datetime-picker-input.js +0 -1
  17. package/dropzone/dropzone-input.d.ts +4 -7
  18. package/dropzone/dropzone-input.js +2 -2
  19. package/dropzone/dropzone-list.d.ts +4 -7
  20. package/file-input/file-input.d.ts +5 -6
  21. package/file-input/file-input.js +0 -1
  22. package/gps-input/gps-input.d.ts +3 -2
  23. package/gps-input/gps-input.js +0 -1
  24. package/multi-combobox/multi-combobox.d.ts +4 -6
  25. package/multi-combobox/multi-combobox.js +0 -1
  26. package/multi-select/multi-select.d.ts +4 -6
  27. package/multi-select/multi-select.js +0 -1
  28. package/number-input/number-input.d.ts +3 -2
  29. package/number-input/number-input.js +1 -2
  30. package/package.json +2 -2
  31. package/radio-group/radio-group.d.ts +4 -6
  32. package/radio-group/radio-group.js +0 -1
  33. package/select/select.d.ts +5 -7
  34. package/select/select.js +0 -1
  35. package/text-input/text-input.d.ts +4 -6
  36. package/text-input/text-input.js +0 -1
  37. package/text-input/text-input.stories.js +1 -1
  38. package/textarea/textarea.d.ts +4 -6
  39. package/textarea/textarea.js +0 -1
  40. package/time-picker-input/time-picker-input.d.ts +3 -2
  41. package/time-picker-input/time-picker-input.js +0 -1
  42. package/toggle/toggle.d.ts +4 -6
  43. package/toggle/toggle.js +0 -1
  44. package/types.d.ts +4 -0
  45. package/types.js +2 -0
@@ -1,10 +1,10 @@
1
1
  import { AvatarFileInputProps as UIAvatarFileInputProps } from "@uxf/ui/avatar-file-input";
2
- import { FileResponse, FormControlProps } from "@uxf/ui/types";
2
+ import { FileResponse } from "@uxf/ui/types";
3
3
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<FileResponse | null>["onChange"];
6
- export type AvatarFileInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIAvatarFileInputProps, "isInvalid" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
4
+ import { FieldValues } from "react-hook-form";
5
+ import { ControlProps } from "../types";
6
+ export type AvatarFileInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIAvatarFileInputProps, "isInvalid" | "onChange" | "value"> & {
7
+ onChange?: UIAvatarFileInputProps["onChange"];
8
8
  requiredMessage?: string;
9
9
  };
10
10
  export type AvatarFileInputValue = FileResponse | null;
@@ -12,4 +12,3 @@ export declare function AvatarFileInput<FormData extends FieldValues>(props: Ava
12
12
  export declare namespace AvatarFileInput {
13
13
  var displayName: string;
14
14
  }
15
- export {};
@@ -14,7 +14,6 @@ function AvatarFileInput(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,11 +1,10 @@
1
1
  import { CheckboxButtonProps as UICheckboxButtonProps } from "@uxf/ui/checkbox-button";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<boolean | undefined>["onChange"];
6
- export type ComboProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UICheckboxButtonProps, "isInvalid" | "name" | "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UICheckboxButtonProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
6
  nullable?: boolean;
8
- onChange?: OnChangeHandler;
7
+ onChange?: UICheckboxButtonProps["onChange"];
9
8
  requiredMessage?: string;
10
9
  };
11
10
  export type CheckboxButtonValue = boolean | undefined;
@@ -13,4 +12,3 @@ export declare function CheckboxButton<FormData extends Record<string, any>>(pro
13
12
  export declare namespace CheckboxButton {
14
13
  var displayName: string;
15
14
  }
16
- export {};
@@ -14,7 +14,6 @@ function CheckboxButton(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,11 +1,10 @@
1
1
  import { CheckboxInputProps as UICheckboxInputProps } from "@uxf/ui/checkbox-input";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<boolean | undefined>["onChange"];
6
- export type ComboProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UICheckboxInputProps, "isInvalid" | "name" | "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UICheckboxInputProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
6
  nullable?: boolean;
8
- onChange?: OnChangeHandler;
7
+ onChange?: UICheckboxInputProps["onChange"];
9
8
  requiredMessage?: string;
10
9
  };
11
10
  export type CheckboxInputValue = boolean | undefined;
@@ -13,4 +12,3 @@ export declare function CheckboxInput<FormData extends Record<string, any>>(prop
13
12
  export declare namespace CheckboxInput {
14
13
  var displayName: string;
15
14
  }
16
- export {};
@@ -14,7 +14,6 @@ function CheckboxInput(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,10 +1,9 @@
1
- import { ColorRadioGroupOptionValue, ColorRadioGroupProps as UIColorRadioGroupProps } from "@uxf/ui/color-radio-group";
2
- import { FormControlProps } from "@uxf/ui/types";
1
+ import { ColorRadioGroupProps as UIColorRadioGroupProps } from "@uxf/ui/color-radio-group";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<ColorRadioGroupOptionValue | null>["onChange"];
6
- export type ColorRadioGroupProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIColorRadioGroupProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ColorRadioGroupProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIColorRadioGroupProps, "isInvalid" | "name" | "onChange" | "value"> & {
6
+ onChange?: UIColorRadioGroupProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  };
10
9
  export type ColorRadioGroupValue = `#${string}` | null;
@@ -12,4 +11,3 @@ export declare function ColorRadioGroup<FormData extends Record<string, any>>(pr
12
11
  export declare namespace ColorRadioGroup {
13
12
  var displayName: string;
14
13
  }
15
- export {};
@@ -14,7 +14,6 @@ function ColorRadioGroup(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,10 +1,9 @@
1
1
  import { ComboboxValueId, ComboboxProps as UIComboboxProps, ComboboxValue as UIComboboxValue } from "@uxf/ui/combobox";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<UIComboboxValue | null>["onChange"];
6
- export type ComboProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIComboboxProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIComboboxProps, "isInvalid" | "name" | "onChange" | "value"> & {
6
+ onChange?: UIComboboxProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  };
10
9
  export type ComboboxValue<Id extends ComboboxValueId> = UIComboboxValue<Id>;
@@ -12,4 +11,3 @@ export declare function Combobox<FormData extends Record<string, any>>(props: Co
12
11
  export declare namespace Combobox {
13
12
  var displayName: string;
14
13
  }
15
- export {};
@@ -14,7 +14,6 @@ function Combobox(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,7 +1,8 @@
1
1
  import { DatePickerInputProps as UIDatePickerInputProps } from "@uxf/ui/date-picker-input";
2
2
  import React from "react";
3
- import { FieldValues, UseControllerProps } from "react-hook-form";
4
- export type DatePickerInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIDatePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type DatePickerInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIDatePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
5
6
  onChange?: UIDatePickerInputProps["onChange"];
6
7
  requiredMessage?: string;
7
8
  minDate?: string;
@@ -41,7 +41,6 @@ function DatePickerInput(props) {
41
41
  const displayDateFormat = (_b = props.displayDateFormat) !== null && _b !== void 0 ? _b : date_picker_input_1.DISPLAY_DATE_FORMAT;
42
42
  const { field, fieldState } = (0, react_hook_form_1.useController)({
43
43
  control: props.control,
44
- defaultValue: props.defaultValue,
45
44
  name: props.name,
46
45
  rules: {
47
46
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,7 +1,8 @@
1
1
  import { DateRangePickerInputProps as UIDateRangePickerInputProps } from "@uxf/ui/date-range-picker-input";
2
2
  import React from "react";
3
- import { FieldValues, UseControllerProps } from "react-hook-form";
4
- export type DateRangePickerInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIDateRangePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type DateRangePickerInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIDateRangePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
5
6
  onChange?: UIDateRangePickerInputProps["onChange"];
6
7
  requiredMessage?: string;
7
8
  };
@@ -39,7 +39,6 @@ function DateRangePickerInput(props) {
39
39
  var _a, _b, _c, _d, _e, _f;
40
40
  const { field, fieldState } = (0, react_hook_form_1.useController)({
41
41
  control: props.control,
42
- defaultValue: props.defaultValue,
43
42
  name: props.name,
44
43
  rules: {
45
44
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,7 +1,8 @@
1
1
  import { DatetimePickerInputProps as UIDatetimePickerInputProps } from "@uxf/ui/datetime-picker-input";
2
2
  import React from "react";
3
- import { FieldValues, UseControllerProps } from "react-hook-form";
4
- export type DatetimePickerInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIDatetimePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type DatetimePickerInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIDatetimePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
5
6
  onChange?: UIDatetimePickerInputProps["onChange"];
6
7
  requiredMessage?: string;
7
8
  minDate?: string;
@@ -42,7 +42,6 @@ function DatetimePickerInput(props) {
42
42
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
43
43
  const { field, fieldState } = (0, react_hook_form_1.useController)({
44
44
  control: props.control,
45
- defaultValue: props.defaultValue,
46
45
  name: props.name,
47
46
  rules: {
48
47
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,16 +1,13 @@
1
1
  import { DropzoneInputProps as UIDropzoneProps } from "@uxf/ui/dropzone";
2
- import { DropzoneFile } from "@uxf/ui/dropzone/types";
3
- import { FormControlProps } from "@uxf/ui/types";
4
2
  import React from "react";
5
- import { FieldValues, UseControllerProps } from "react-hook-form";
6
- type OnChangeHandler = FormControlProps<DropzoneFile[] | undefined>["onChange"];
7
- export type DropzoneProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIDropzoneProps, "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type DropzoneProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIDropzoneProps, "onChange" | "value"> & {
8
6
  minFilesCount?: number;
9
- onChange?: OnChangeHandler;
7
+ onChange?: UIDropzoneProps["onChange"];
10
8
  requiredMessage?: string;
11
9
  };
12
10
  export declare function DropzoneInput<FormData extends FieldValues>(props: DropzoneProps<FormData>): React.JSX.Element;
13
11
  export declare namespace DropzoneInput {
14
12
  var displayName: string;
15
13
  }
16
- export {};
@@ -14,7 +14,7 @@ function DropzoneInput(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
17
+ disabled: props.isDisabled,
18
18
  name: props.name,
19
19
  rules: {
20
20
  ...((_b = props.rules) !== null && _b !== void 0 ? _b : {}),
@@ -52,7 +52,7 @@ function DropzoneInput(props) {
52
52
  field.onChange(value);
53
53
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
54
54
  };
55
- return (react_1.default.createElement(dropzone_1.Dropzone, { accept: props.accept, className: props.className, helperText: ((_d = fieldState.error) === null || _d === void 0 ? void 0 : _d.message) || props.helperText, id: id, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isRequired: props.isRequired, label: props.label, maxFileSize: props.maxFileSize, maxFilesCount: props.maxFilesCount, minFileSize: props.minFileSize, noClick: props.noClick, noDrag: props.noDrag, onChange: onChange, onUploadError: props.onUploadError, onUploadFile: props.onUploadFile, ref: field.ref, style: props.style, value: field.value, icon: props.icon, name: props.name }));
55
+ return (react_1.default.createElement(dropzone_1.Dropzone, { accept: props.accept, className: props.className, helperText: ((_d = fieldState.error) === null || _d === void 0 ? void 0 : _d.message) || props.helperText, icon: props.icon, id: id, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isRequired: props.isRequired, label: props.label, maxFileSize: props.maxFileSize, maxFilesCount: props.maxFilesCount, minFileSize: props.minFileSize, name: props.name, noClick: props.noClick, noDrag: props.noDrag, onChange: onChange, onUploadError: props.onUploadError, onUploadFile: props.onUploadFile, ref: field.ref, style: props.style, value: field.value }));
56
56
  }
57
57
  exports.DropzoneInput = DropzoneInput;
58
58
  DropzoneInput.displayName = "UxfFormDropzoneInput";
@@ -1,14 +1,11 @@
1
1
  import { DropzoneListProps as UIDropzoneListProps } from "@uxf/ui/dropzone";
2
- import { DropzoneFile } from "@uxf/ui/dropzone/types";
3
- import { FormControlProps } from "@uxf/ui/types";
4
2
  import React from "react";
5
- import { FieldValues, UseControllerProps } from "react-hook-form";
6
- type OnChangeHandler = FormControlProps<DropzoneFile[] | undefined>["onChange"];
7
- export interface DropzoneListProps<FormData extends FieldValues> extends Pick<UseControllerProps<FormData>, "control" | "name">, Pick<UIDropzoneListProps, "className" | "errorText" | "isDownloadableOnClick" | "onRemoveConfirm" | "renderItem" | "style"> {
8
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export interface DropzoneListProps<FormData extends FieldValues> extends Pick<ControlProps<FormData>, "control" | "name">, Pick<UIDropzoneListProps, "className" | "errorText" | "isDownloadableOnClick" | "onRemoveConfirm" | "renderItem" | "style"> {
6
+ onChange?: UIDropzoneListProps["onChange"];
9
7
  }
10
8
  export declare function DropzoneList<FormData extends FieldValues>(props: DropzoneListProps<FormData>): React.JSX.Element;
11
9
  export declare namespace DropzoneList {
12
10
  var displayName: string;
13
11
  }
14
- export {};
@@ -1,10 +1,10 @@
1
1
  import { FileInputProps as UIFileInputProps } from "@uxf/ui/file-input";
2
- import { FileResponse, FormControlProps } from "@uxf/ui/types";
2
+ import { FileResponse } from "@uxf/ui/types";
3
3
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<FileResponse | null>["onChange"];
6
- export type FileInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIFileInputProps, "isInvalid" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
4
+ import { FieldValues } from "react-hook-form";
5
+ import { ControlProps } from "../types";
6
+ export type FileInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIFileInputProps, "isInvalid" | "onChange" | "value"> & {
7
+ onChange?: UIFileInputProps["onChange"];
8
8
  requiredMessage?: string;
9
9
  };
10
10
  export type FileInputValue = FileResponse | null;
@@ -12,4 +12,3 @@ export declare function FileInput<FormData extends FieldValues>(props: FileInput
12
12
  export declare namespace FileInput {
13
13
  var displayName: string;
14
14
  }
15
- export {};
@@ -14,7 +14,6 @@ function FileInput(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,13 +1,14 @@
1
1
  import { TextInputProps as UITextInputProps } from "@uxf/ui/text-input";
2
2
  import { FormControlProps } from "@uxf/ui/types";
3
3
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
4
+ import { FieldValues } from "react-hook-form";
5
+ import { ControlProps } from "../types";
5
6
  export type Gps = {
6
7
  lat: number;
7
8
  lng: number;
8
9
  };
9
10
  type OnChangeHandler = FormControlProps<string>["onChange"];
10
- export type GpsInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UITextInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value" | "type"> & {
11
+ export type GpsInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UITextInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value" | "type"> & {
11
12
  onChange?: OnChangeHandler;
12
13
  requiredMessage?: string;
13
14
  };
@@ -93,7 +93,6 @@ function GpsInput(props) {
93
93
  const [coordsFormatError, setCoordsFormatError] = (0, react_1.useState)(false);
94
94
  const { field, fieldState } = (0, react_hook_form_1.useController)({
95
95
  control: props.control,
96
- defaultValue: props.defaultValue,
97
96
  name: props.name,
98
97
  rules: {
99
98
  ...((_b = props.rules) !== null && _b !== void 0 ? _b : {}),
@@ -1,10 +1,9 @@
1
1
  import { MultiComboboxOption, MultiComboboxProps as UIMultiComboboxProps } from "@uxf/ui/multi-combobox";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<MultiComboboxOption[] | null>["onChange"];
6
- export type ComboProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIMultiComboboxProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIMultiComboboxProps, "isInvalid" | "name" | "onChange" | "value"> & {
6
+ onChange?: UIMultiComboboxProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  };
10
9
  export type MultiComboboxValue<Id> = MultiComboboxOption<Id>[] | null;
@@ -12,4 +11,3 @@ export declare function MultiCombobox<FormData extends Record<string, any>>(prop
12
11
  export declare namespace MultiCombobox {
13
12
  var displayName: string;
14
13
  }
15
- export {};
@@ -14,7 +14,6 @@ function MultiCombobox(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,10 +1,9 @@
1
1
  import { MultiSelectOption, MultiSelectProps as UIMultiSelectProps } from "@uxf/ui/multi-select";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<MultiSelectOption[] | null>["onChange"];
6
- export type ComboProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIMultiSelectProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIMultiSelectProps, "isInvalid" | "name" | "onChange" | "value"> & {
6
+ onChange?: UIMultiSelectProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  };
10
9
  export type MultiSelectValue<Id> = MultiSelectOption<Id>[] | null;
@@ -12,4 +11,3 @@ export declare function MultiSelect<FormData extends Record<string, any>>(props:
12
11
  export declare namespace MultiSelect {
13
12
  var displayName: string;
14
13
  }
15
- export {};
@@ -14,7 +14,6 @@ function MultiSelect(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,8 +1,9 @@
1
1
  import { TextInputProps as UITextInputProps } from "@uxf/ui/text-input";
2
2
  import { FormControlProps } from "@uxf/ui/types";
3
3
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- export type NumberInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UITextInputProps, "inputMode" | "isInvalid" | "maxLength" | "minLength" | "name" | "onChange" | "value" | "type"> & {
4
+ import { FieldValues } from "react-hook-form";
5
+ import { ControlProps } from "../types";
6
+ export type NumberInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UITextInputProps, "inputMode" | "isInvalid" | "maxLength" | "minLength" | "name" | "onChange" | "value" | "type"> & {
6
7
  decimalPlaces?: number;
7
8
  onChange?: FormControlProps<number | null>["onChange"];
8
9
  requiredMessage?: string;
@@ -14,7 +14,6 @@ function NumberInput(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  max: typeof props.max === "number" && !isNaN(props.max)
@@ -42,7 +41,7 @@ function NumberInput(props) {
42
41
  const onKeyDown = (event) => {
43
42
  var _a;
44
43
  // Allow special keys
45
- const specialKeys = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
44
+ const specialKeys = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Tab"];
46
45
  // Allow keys for copy/paste/select/cut
47
46
  const controlKeys = ["v", "V", "c", "C", "x", "X", "a", "A"];
48
47
  // Allow digits and decimal point (.,)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/form",
3
- "version": "11.12.0",
3
+ "version": "11.13.0",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,7 +12,7 @@
12
12
  "author": "UX Fans s.r.o",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@uxf/ui": "11.12.0",
15
+ "@uxf/ui": "11.13.0",
16
16
  "coordinate-parser": "1.0.7",
17
17
  "dayjs": "1.11.10",
18
18
  "react-hook-form": "7.51.0"
@@ -1,10 +1,9 @@
1
1
  import { RadioGroupOptionValueId, RadioGroupProps as UIRadioGroupProps } from "@uxf/ui/radio-group";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<RadioGroupOptionValueId | null>["onChange"];
6
- export type RadioGroupProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIRadioGroupProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type RadioGroupProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIRadioGroupProps, "isInvalid" | "name" | "onChange" | "value"> & {
6
+ onChange?: UIRadioGroupProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  };
10
9
  export type RadioGroupValue<T extends RadioGroupOptionValueId> = T | null;
@@ -12,4 +11,3 @@ export declare function RadioGroup<FormData extends Record<string, any>>(props:
12
11
  export declare namespace RadioGroup {
13
12
  var displayName: string;
14
13
  }
15
- export {};
@@ -14,7 +14,6 @@ function RadioGroup(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,11 +1,10 @@
1
1
  import { SelectBaseValueId } from "@uxf/ui/_select-base";
2
- import { SelectProps as UISelectProps, SelectValue as UISelectValue } from "@uxf/ui/select";
3
- import { FormControlProps } from "@uxf/ui/types";
2
+ import { SelectProps as UISelectProps } from "@uxf/ui/select";
4
3
  import React from "react";
5
- import { FieldValues, UseControllerProps } from "react-hook-form";
6
- type OnChangeHandler = FormControlProps<UISelectValue | null>["onChange"];
7
- export type SelectProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UISelectProps, "isInvalid" | "name" | "onChange" | "value"> & {
8
- onChange?: OnChangeHandler;
4
+ import { FieldValues } from "react-hook-form";
5
+ import { ControlProps } from "../types";
6
+ export type SelectProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UISelectProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
+ onChange?: UISelectProps["onChange"];
9
8
  requiredMessage?: string;
10
9
  };
11
10
  export type SelectValue<T extends SelectBaseValueId> = T | null;
@@ -13,4 +12,3 @@ export declare function Select<FormData extends Record<string, any>>(props: Sele
13
12
  export declare namespace Select {
14
13
  var displayName: string;
15
14
  }
16
- export {};
package/select/select.js CHANGED
@@ -14,7 +14,6 @@ function Select(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,10 +1,9 @@
1
1
  import { TextInputProps as UITextInputProps } from "@uxf/ui/text-input";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<string>["onChange"];
6
- export type TextInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UITextInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value" | "type"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type TextInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UITextInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value" | "type"> & {
6
+ onChange?: UITextInputProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  } & ({
10
9
  type: "email";
@@ -24,4 +23,3 @@ export declare function TextInput<FormData extends FieldValues>(props: TextInput
24
23
  export declare namespace TextInput {
25
24
  var displayName: string;
26
25
  }
27
- export {};
@@ -16,7 +16,6 @@ function TextInput(props) {
16
16
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
17
17
  const { field, fieldState } = (0, react_hook_form_1.useController)({
18
18
  control: props.control,
19
- defaultValue: props.defaultValue,
20
19
  name: props.name,
21
20
  rules: {
22
21
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -14,7 +14,7 @@ exports.default = {
14
14
  };
15
15
  function Default() {
16
16
  const storyFormTextInputs = (control) => (react_1.default.createElement("div", { className: "space-y-4" },
17
- react_1.default.createElement(text_input_1.TextInput, { placeholder: "Zadejte...", label: "Default input", name: "default", control: control, autoComplete: "off" }),
17
+ react_1.default.createElement(text_input_1.TextInput, { placeholder: "Zadejte...", label: "Default input", name: "default", autoComplete: "off", control: control }),
18
18
  react_1.default.createElement(text_input_1.TextInput, { placeholder: "Zadejte...", label: "Required input", name: "required", control: control, isRequired: true }),
19
19
  react_1.default.createElement(text_input_1.TextInput, { placeholder: "Zadejte...", label: "E-mail required input", name: "email", type: "email", control: control, isRequired: true }),
20
20
  react_1.default.createElement(text_input_1.TextInput, { placeholder: "Zadejte...", label: "Phone required input", name: "phone", type: "tel", control: control, isRequired: true }),
@@ -1,10 +1,9 @@
1
1
  import { TextareaProps as UITextareaProps } from "@uxf/ui/textarea";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<string, HTMLTextAreaElement>["onChange"];
6
- export type TextareaProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UITextareaProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
- onChange?: OnChangeHandler;
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type TextareaProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UITextareaProps, "isInvalid" | "name" | "onChange" | "value"> & {
6
+ onChange?: UITextareaProps["onChange"];
8
7
  requiredMessage?: string;
9
8
  };
10
9
  export type TextareaValue = string | null;
@@ -12,4 +11,3 @@ export declare function Textarea<FormData extends Record<string, any>>(props: Te
12
11
  export declare namespace Textarea {
13
12
  var displayName: string;
14
13
  }
15
- export {};
@@ -34,7 +34,6 @@ function Textarea(props) {
34
34
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
35
35
  const { field, fieldState } = (0, react_hook_form_1.useController)({
36
36
  control: props.control,
37
- defaultValue: props.defaultValue,
38
37
  name: props.name,
39
38
  rules: {
40
39
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,8 +1,9 @@
1
1
  import { DatePickerInputProps as UIDatePickerInputProps } from "@uxf/ui/date-picker-input";
2
2
  import { TimePickerInputProps as UITimePickerInputProps } from "@uxf/ui/time-picker-input";
3
3
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- export type TimePickerInputProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UITimePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
4
+ import { FieldValues } from "react-hook-form";
5
+ import { ControlProps } from "../types";
6
+ export type TimePickerInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UITimePickerInputProps, "isInvalid" | "max" | "min" | "pattern" | "step" | "name" | "onChange" | "value"> & {
6
7
  onChange?: UIDatePickerInputProps["onChange"];
7
8
  requiredMessage?: string;
8
9
  };
@@ -40,7 +40,6 @@ function TimePickerInput(props) {
40
40
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
41
41
  const { field, fieldState } = (0, react_hook_form_1.useController)({
42
42
  control: props.control,
43
- defaultValue: props.defaultValue,
44
43
  name: props.name,
45
44
  rules: {
46
45
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
@@ -1,11 +1,10 @@
1
1
  import { ToggleProps as UIToggleProps } from "@uxf/ui/toggle";
2
- import { FormControlProps } from "@uxf/ui/types";
3
2
  import React from "react";
4
- import { FieldValues, UseControllerProps } from "react-hook-form";
5
- type OnChangeHandler = FormControlProps<boolean | undefined>["onChange"];
6
- export type ComboProps<FormData extends FieldValues> = UseControllerProps<FormData> & Omit<UIToggleProps, "isInvalid" | "name" | "onChange" | "value"> & {
3
+ import { FieldValues } from "react-hook-form";
4
+ import { ControlProps } from "../types";
5
+ export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIToggleProps, "isInvalid" | "name" | "onChange" | "value"> & {
7
6
  nullable?: boolean;
8
- onChange?: OnChangeHandler;
7
+ onChange?: UIToggleProps["onChange"];
9
8
  requiredMessage?: string;
10
9
  };
11
10
  export type ToggleValue = boolean | undefined;
@@ -13,4 +12,3 @@ export declare function Toggle<FormData extends Record<string, any>>(props: Comb
13
12
  export declare namespace Toggle {
14
13
  var displayName: string;
15
14
  }
16
- export {};
package/toggle/toggle.js CHANGED
@@ -14,7 +14,6 @@ function Toggle(props) {
14
14
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formId}__${props.name}`;
15
15
  const { field, fieldState } = (0, react_hook_form_1.useController)({
16
16
  control: props.control,
17
- defaultValue: props.defaultValue,
18
17
  name: props.name,
19
18
  rules: {
20
19
  required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
package/types.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { FieldValues, UseControllerProps } from "react-hook-form";
2
+ export type ControlProps<FormData extends FieldValues> = Pick<UseControllerProps<FormData>, "name" | "rules" | "shouldUnregister"> & {
3
+ control: NonNullable<UseControllerProps<FormData>["control"]>;
4
+ };
package/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });