@saas-ui/forms 2.5.1 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @saas-ui/forms
2
2
 
3
+ ## 2.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - ca911e4: Removed lost console.log
8
+ - 0a218fd: Added time Field type
9
+ - 0a218fd: Fixed issue where Field types would not be inferred
10
+ - Updated dependencies [20c7175]
11
+ - Updated dependencies [ca911e4]
12
+ - @saas-ui/core@2.4.4
13
+
14
+ ## 2.5.2
15
+
16
+ ### Patch Changes
17
+
18
+ - d77a5b3: Fixed circular dependency issue
19
+ - Updated dependencies [d77a5b3]
20
+ - @saas-ui/core@2.4.3
21
+
3
22
  ## 2.5.1
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -9,6 +9,7 @@ import { NumberInputProps as NumberInputProps$1, NumberInputFieldProps as Number
9
9
  import { UseStepperReturn, UseStepperProps, StepsProps, StepsItemProps } from '@saas-ui/core';
10
10
  import { FocusableElement } from '@chakra-ui/utils';
11
11
  import { MaybeRenderProp } from '@chakra-ui/react-utils';
12
+ import * as src from 'src';
12
13
 
13
14
  interface NumberInputOptions {
14
15
  /**
@@ -156,49 +157,50 @@ interface InputFieldProps extends InputProps {
156
157
  leftAddon?: React$1.ReactNode;
157
158
  rightAddon?: React$1.ReactNode;
158
159
  }
159
- declare const InputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
160
+ declare const InputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
160
161
  interface NumberInputFieldProps extends NumberInputProps {
161
162
  type: 'number';
162
163
  }
163
- declare const NumberInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
164
- declare const PasswordInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
164
+ declare const NumberInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
165
+ declare const PasswordInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
165
166
  interface TextareaFieldProps extends TextareaProps {
166
167
  }
167
- declare const TextareaField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
168
+ declare const TextareaField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
168
169
  interface SwitchFieldProps extends SwitchProps {
169
170
  }
170
- declare const SwitchField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
171
+ declare const SwitchField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
171
172
  interface SelectFieldProps extends SelectProps {
172
173
  buttonProps?: SelectButtonProps;
173
174
  listProps?: SelectListProps;
174
175
  }
175
- declare const SelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
176
+ declare const SelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
176
177
  type CheckboxFieldProps = CheckboxProps;
177
- declare const CheckboxField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
178
+ declare const CheckboxField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
178
179
  type RadioFieldProps = RadioInputProps;
179
- declare const RadioField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
180
+ declare const RadioField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
180
181
  type NativeSelectFieldProps = NativeSelectProps;
181
- declare const NativeSelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
182
+ declare const NativeSelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
182
183
  interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
183
184
  pinLength?: number;
184
185
  pinType?: 'alphanumeric' | 'number';
185
186
  spacing?: SystemProps['margin'];
186
187
  }
187
- declare const PinField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
188
+ declare const PinField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
188
189
  declare const defaultFieldTypes: {
189
- text: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
190
- email: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
191
- url: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
192
- phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
193
- number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
194
- password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
195
- textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
196
- switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
197
- select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
198
- checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
199
- radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
200
- pin: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
201
- 'native-select': React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
190
+ text: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
191
+ email: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
192
+ url: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
193
+ phone: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
194
+ time: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
195
+ number: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
196
+ password: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
197
+ textarea: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
198
+ switch: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
199
+ select: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
200
+ checkbox: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
201
+ radio: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
202
+ pin: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
203
+ 'native-select': React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
202
204
  };
203
205
  type DefaultFields = typeof defaultFieldTypes;
204
206
 
@@ -497,7 +499,9 @@ type FieldPathWithArray<TFieldValues extends FieldValues, TName extends FieldPat
497
499
  type MergeFieldProps<FieldDefs, TFieldValues extends FieldValues = FieldValues, TExtraFieldProps extends object = object, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ValueOf<{
498
500
  [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props> ? {
499
501
  type?: K;
500
- } & ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>> & TExtraFieldProps : never;
502
+ } & ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>> & {
503
+ [key in keyof TExtraFieldProps]: TExtraFieldProps[key];
504
+ } : never;
501
505
  }>;
502
506
  type FieldProps<TFieldValues extends FieldValues = FieldValues, TExtraFieldProps extends object = object> = MergeFieldProps<DefaultFields, TFieldValues, TExtraFieldProps>;
503
507
  type FormChildren<FieldDefs, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TExtraFieldProps extends object = object> = MaybeRenderProp<FormRenderContext<TFieldValues, TContext, MergeFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues, TExtraFieldProps>>>;
@@ -813,10 +817,10 @@ interface FieldsContextValue {
813
817
  getBaseField?: GetBaseField<any>;
814
818
  }
815
819
  declare const FieldsProvider: React__default.FC<{
816
- value: Partial<FieldsContextValue>;
820
+ value: FieldsContextValue;
817
821
  children: React__default.ReactNode;
818
822
  }>;
819
- declare const useField: (type: string) => React__default.FC<any>;
823
+ declare const useField: (type: string, fallback: React__default.FC<any>) => React__default.FC<any>;
820
824
 
821
825
  type FormProviderProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = FormProviderProps$1<TFieldValues, TContext> & {
822
826
  fieldResolver?: FieldResolver;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import { NumberInputProps as NumberInputProps$1, NumberInputFieldProps as Number
9
9
  import { UseStepperReturn, UseStepperProps, StepsProps, StepsItemProps } from '@saas-ui/core';
10
10
  import { FocusableElement } from '@chakra-ui/utils';
11
11
  import { MaybeRenderProp } from '@chakra-ui/react-utils';
12
+ import * as src from 'src';
12
13
 
13
14
  interface NumberInputOptions {
14
15
  /**
@@ -156,49 +157,50 @@ interface InputFieldProps extends InputProps {
156
157
  leftAddon?: React$1.ReactNode;
157
158
  rightAddon?: React$1.ReactNode;
158
159
  }
159
- declare const InputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
160
+ declare const InputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
160
161
  interface NumberInputFieldProps extends NumberInputProps {
161
162
  type: 'number';
162
163
  }
163
- declare const NumberInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
164
- declare const PasswordInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
164
+ declare const NumberInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
165
+ declare const PasswordInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
165
166
  interface TextareaFieldProps extends TextareaProps {
166
167
  }
167
- declare const TextareaField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
168
+ declare const TextareaField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
168
169
  interface SwitchFieldProps extends SwitchProps {
169
170
  }
170
- declare const SwitchField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
171
+ declare const SwitchField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
171
172
  interface SelectFieldProps extends SelectProps {
172
173
  buttonProps?: SelectButtonProps;
173
174
  listProps?: SelectListProps;
174
175
  }
175
- declare const SelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
176
+ declare const SelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
176
177
  type CheckboxFieldProps = CheckboxProps;
177
- declare const CheckboxField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
178
+ declare const CheckboxField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
178
179
  type RadioFieldProps = RadioInputProps;
179
- declare const RadioField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
180
+ declare const RadioField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
180
181
  type NativeSelectFieldProps = NativeSelectProps;
181
- declare const NativeSelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
182
+ declare const NativeSelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
182
183
  interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
183
184
  pinLength?: number;
184
185
  pinType?: 'alphanumeric' | 'number';
185
186
  spacing?: SystemProps['margin'];
186
187
  }
187
- declare const PinField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
188
+ declare const PinField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
188
189
  declare const defaultFieldTypes: {
189
- text: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
190
- email: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
191
- url: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
192
- phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
193
- number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
194
- password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
195
- textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
196
- switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
197
- select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
198
- checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
199
- radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
200
- pin: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
201
- 'native-select': React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
190
+ text: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
191
+ email: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
192
+ url: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
193
+ phone: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
194
+ time: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
195
+ number: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
196
+ password: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
197
+ textarea: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
198
+ switch: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
199
+ select: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
200
+ checkbox: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
201
+ radio: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
202
+ pin: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
203
+ 'native-select': React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
202
204
  };
203
205
  type DefaultFields = typeof defaultFieldTypes;
204
206
 
@@ -497,7 +499,9 @@ type FieldPathWithArray<TFieldValues extends FieldValues, TName extends FieldPat
497
499
  type MergeFieldProps<FieldDefs, TFieldValues extends FieldValues = FieldValues, TExtraFieldProps extends object = object, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ValueOf<{
498
500
  [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props> ? {
499
501
  type?: K;
500
- } & ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>> & TExtraFieldProps : never;
502
+ } & ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>> & {
503
+ [key in keyof TExtraFieldProps]: TExtraFieldProps[key];
504
+ } : never;
501
505
  }>;
502
506
  type FieldProps<TFieldValues extends FieldValues = FieldValues, TExtraFieldProps extends object = object> = MergeFieldProps<DefaultFields, TFieldValues, TExtraFieldProps>;
503
507
  type FormChildren<FieldDefs, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TExtraFieldProps extends object = object> = MaybeRenderProp<FormRenderContext<TFieldValues, TContext, MergeFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues, TExtraFieldProps>>>;
@@ -813,10 +817,10 @@ interface FieldsContextValue {
813
817
  getBaseField?: GetBaseField<any>;
814
818
  }
815
819
  declare const FieldsProvider: React__default.FC<{
816
- value: Partial<FieldsContextValue>;
820
+ value: FieldsContextValue;
817
821
  children: React__default.ReactNode;
818
822
  }>;
819
- declare const useField: (type: string) => React__default.FC<any>;
823
+ declare const useField: (type: string, fallback: React__default.FC<any>) => React__default.FC<any>;
820
824
 
821
825
  type FormProviderProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = FormProviderProps$1<TFieldValues, TContext> & {
822
826
  fieldResolver?: FieldResolver;