form-input-fields 1.0.8 → 1.0.10

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.
@@ -1,15 +1,27 @@
1
+ import { default as React } from 'react';
2
+ import { FieldProps } from 'formik';
3
+ import { SwitchProps } from '@mui/material/Switch';
1
4
  export interface FormSwitchProps {
2
5
  id: string;
3
- checked: boolean;
4
6
  /**
5
7
  * Label text displayed next to the switch
6
8
  */
7
9
  label?: string;
10
+ /**
11
+ * Position of the label relative to the switch
12
+ * @default 'end'
13
+ */
14
+ labelPlacement?: 'top' | 'start' | 'bottom' | 'end';
8
15
  /**
9
16
  * Color of the switch when checked
10
17
  * @default 'primary'
11
18
  */
12
19
  color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default';
20
+ /**
21
+ * Size of the switch
22
+ * @default 'medium'
23
+ */
24
+ size?: 'small' | 'medium';
13
25
  /**
14
26
  * Whether the switch is disabled
15
27
  * @default false
@@ -23,7 +35,14 @@ export interface FormSwitchProps {
23
35
  /**
24
36
  * Custom onChange handler with additional switch-related data
25
37
  */
26
- onChange: () => void;
38
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, context: {
39
+ fieldName: string;
40
+ formikValue: boolean;
41
+ }) => void;
42
+ /**
43
+ * Custom onBlur handler
44
+ */
45
+ onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
27
46
  /**
28
47
  * Helper text to display below the switch
29
48
  */
@@ -37,6 +56,6 @@ export interface FormSwitchProps {
37
56
  */
38
57
  className?: string;
39
58
  }
40
- export type FormSwitchComponentProps = FormSwitchProps;
59
+ export type FormSwitchComponentProps = FieldProps & SwitchProps & FormSwitchProps;
41
60
  export declare const FormSwitch: (props: FormSwitchComponentProps) => import("react/jsx-runtime").JSX.Element;
42
61
  //# sourceMappingURL=FormSwitch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormSwitch.d.ts","sourceRoot":"","sources":["../../../src/contro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