form-input-fields 1.0.1
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/README.md +826 -0
- package/dist/controls/FormDateField.d.ts +33 -0
- package/dist/controls/FormDateField.d.ts.map +1 -0
- package/dist/controls/FormMaskField.d.ts +42 -0
- package/dist/controls/FormMaskField.d.ts.map +1 -0
- package/dist/controls/FormMaskFiledUtils.d.ts +10 -0
- package/dist/controls/FormMaskFiledUtils.d.ts.map +1 -0
- package/dist/controls/date.d.ts +13 -0
- package/dist/controls/date.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +27769 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +228 -0
- package/dist/index.js.map +1 -0
- package/dist/test/FormDateField.spec.d.ts +2 -0
- package/dist/test/FormDateField.spec.d.ts.map +1 -0
- package/dist/test/FormMaskField.spec.d.ts +2 -0
- package/dist/test/FormMaskField.spec.d.ts.map +1 -0
- package/dist/test/FormMaskFiledUtils.spec.d.ts +2 -0
- package/dist/test/FormMaskFiledUtils.spec.d.ts.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material';
|
|
2
|
+
import { FieldProps } from 'formik';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
export interface FormDateFieldProps {
|
|
5
|
+
/**
|
|
6
|
+
* Date format string for display
|
|
7
|
+
* Uses dayjs format tokens (e.g., 'YYYY-MM-DD', 'DD/MM/YYYY')
|
|
8
|
+
* Default: FORM_DATE_FORMAT.short
|
|
9
|
+
*/
|
|
10
|
+
format?: string;
|
|
11
|
+
/** Minimum selectable date */
|
|
12
|
+
minDate?: Dayjs;
|
|
13
|
+
/** Maximum selectable date */
|
|
14
|
+
maxDate?: Dayjs;
|
|
15
|
+
/** Disable past dates */
|
|
16
|
+
disablePast?: boolean;
|
|
17
|
+
/** Disable future dates */
|
|
18
|
+
disableFuture?: boolean;
|
|
19
|
+
/** Show today button in the picker */
|
|
20
|
+
showTodayButton?: boolean;
|
|
21
|
+
/** Make the field read-only */
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
/** Custom onChange handler with additional date-related data */
|
|
24
|
+
onChange?: (value: Dayjs | null, context: {
|
|
25
|
+
validationError: string | null;
|
|
26
|
+
formattedValue: string;
|
|
27
|
+
}) => void;
|
|
28
|
+
/** Show the date format as helper text (default: false) */
|
|
29
|
+
showDateFormat?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type FormDateFieldComponentProps = FieldProps & TextFieldProps & FormDateFieldProps;
|
|
32
|
+
export declare const FormDateField: (props: FormDateFieldComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=FormDateField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDateField.d.ts","sourceRoot":"","sources":["../../src/controls/FormDateField.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAS,MAAM,QAAQ,CAAC;AAC3C,OAAc,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAMrC,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB,yBAAyB;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,sCAAsC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,OAAO,EAAE;QACP,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,cAAc,EAAE,MAAM,CAAC;KACxB,KACE,IAAI,CAAC;IAEV,2DAA2D;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,2BAA2B,GAAG,UAAU,GAClD,cAAc,GACd,kBAAkB,CAAC;AAErB,eAAO,MAAM,aAAa,GAAI,OAAO,2BAA2B,4CAsG/D,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FieldProps } from 'formik';
|
|
3
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
+
export interface FormMaskFieldProps {
|
|
5
|
+
/**
|
|
6
|
+
* Mask pattern string where:
|
|
7
|
+
* - '9' = digit (0-9)
|
|
8
|
+
* - 'A' = letter (a-z, A-Z)
|
|
9
|
+
* - '*' = alphanumeric (a-z, A-Z, 0-9)
|
|
10
|
+
* - 'a' = lowercase letter (a-z)
|
|
11
|
+
* - 'Z' = uppercase letter (A-Z)
|
|
12
|
+
* - '#' = hexadecimal (0-9, A-F, a-f)
|
|
13
|
+
* - Any other character = literal character
|
|
14
|
+
*
|
|
15
|
+
* Example: "99/99/9999" for date, "AAA-999" for code
|
|
16
|
+
*/
|
|
17
|
+
mask?: string;
|
|
18
|
+
/** Character to show in placeholder for mask positions (default: '_') */
|
|
19
|
+
placeholderChar?: string;
|
|
20
|
+
/** Convert input to uppercase automatically */
|
|
21
|
+
toUpperCase?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* If true, Formik field value will contain only the input characters without mask literals
|
|
24
|
+
* If false, Formik field value will contain the full masked value
|
|
25
|
+
*/
|
|
26
|
+
returnCleanValue?: boolean;
|
|
27
|
+
/** Custom onChange handler with additional mask-related data */
|
|
28
|
+
onChange?: (event: {
|
|
29
|
+
target: {
|
|
30
|
+
value: string;
|
|
31
|
+
cleanValue: string;
|
|
32
|
+
rawValue: string;
|
|
33
|
+
};
|
|
34
|
+
} & React.ChangeEvent<HTMLInputElement>) => void;
|
|
35
|
+
/** Show the mask pattern as helper text (default: false) */
|
|
36
|
+
showMaskPattern?: boolean;
|
|
37
|
+
/** Show the placeholder text (default: false) */
|
|
38
|
+
showPlaceholder?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type FormMaskFieldComponentProps = FieldProps & TextFieldProps & FormMaskFieldProps;
|
|
41
|
+
export declare const FormMaskField: (props: FormMaskFieldComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
//# sourceMappingURL=FormMaskField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormMaskField.d.ts","sourceRoot":"","sources":["../../src/controls/FormMaskField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAS,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAS9D,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE;QACL,MAAM,EAAE;YACN,KAAK,EAAE,MAAM,CAAC;YACd,UAAU,EAAE,MAAM,CAAC;YACnB,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,GAAG,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KACpC,IAAI,CAAC;IAEV,4DAA4D;IAC5D,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,iDAAiD;IACjD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,2BAA2B,GAAG,UAAU,GAClD,cAAc,GACd,kBAAkB,CAAC;AAErB,eAAO,MAAM,aAAa,GAAI,OAAO,2BAA2B,4CAmI/D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface MaskConfig {
|
|
2
|
+
mask: (RegExp | string)[];
|
|
3
|
+
placeholderChar: string;
|
|
4
|
+
pattern: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const createMask: (pattern: string, placeholderChar?: string) => MaskConfig;
|
|
7
|
+
export declare const applyMask: (value: string, maskConfig: MaskConfig | null, toUpperCase?: boolean) => string;
|
|
8
|
+
export declare const removeMask: (value: string, maskConfig: MaskConfig | null) => string;
|
|
9
|
+
export declare const generatePlaceholder: (maskConfig: MaskConfig | null) => string;
|
|
10
|
+
//# sourceMappingURL=FormMaskFiledUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormMaskFiledUtils.d.ts","sourceRoot":"","sources":["../../src/controls/FormMaskFiledUtils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,wBAAqB,KAAG,UAanE,CAAC;AAEF,eAAO,MAAM,SAAS,GACpB,OAAO,MAAM,EACb,YAAY,UAAU,GAAG,IAAI,EAC7B,qBAAmB,KAClB,MA6CF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,YAAY,UAAU,GAAG,IAAI,KAAG,MAgBzE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,UAAU,GAAG,IAAI,KAAG,MAkBnE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const DATE_PICKER_DATE_FORMAT: {
|
|
2
|
+
short: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const FORM_DATE_FORMAT: {
|
|
5
|
+
short: string;
|
|
6
|
+
long: string;
|
|
7
|
+
custom: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const DATE_PICKER_MONTH_YEAR_FORMAT: {
|
|
10
|
+
short: string;
|
|
11
|
+
long: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/controls/date.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;CAEnC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;CAGzC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FormMaskField, type FormMaskFieldProps, } from './controls/FormMaskField';
|
|
2
|
+
export { createMask, applyMask, removeMask, generatePlaceholder, type MaskConfig, } from './controls/FormMaskFiledUtils';
|
|
3
|
+
export { FormDateField, type FormDateFieldProps, } from './controls/FormDateField';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,KAAK,UAAU,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,0BAA0B,CAAC"}
|