@t007/input 0.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/dist/index.global.js +426 -0
- package/dist/index.js +307 -0
- package/package.json +57 -0
- package/src/css/index.css +779 -0
- package/src/ts/types/index.d.ts +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import "@t007/utils";
|
|
2
|
+
|
|
3
|
+
export interface FieldOptions extends Partial<
|
|
4
|
+
Omit<HTMLInputElement, "type" | "className" | "children">
|
|
5
|
+
> {
|
|
6
|
+
isWrapper?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
custom?: string;
|
|
11
|
+
minSize?: number;
|
|
12
|
+
maxSize?: number;
|
|
13
|
+
minTotalSize?: number;
|
|
14
|
+
maxTotalSize?: number;
|
|
15
|
+
options?: Array<string | { value: string; option: string }>;
|
|
16
|
+
indeterminate?: boolean;
|
|
17
|
+
eyeToggler?: boolean;
|
|
18
|
+
passwordMeter?: boolean;
|
|
19
|
+
helperText?: false | Record<string, string>;
|
|
20
|
+
className?: string;
|
|
21
|
+
fieldClassName?: string;
|
|
22
|
+
children?: HTMLElement;
|
|
23
|
+
// startIcon?: string;
|
|
24
|
+
endIcon?: string;
|
|
25
|
+
nativeIcon?: string;
|
|
26
|
+
passwordVisibleIcon?: string;
|
|
27
|
+
passwordHiddenIcon?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface T007FormManager {
|
|
31
|
+
forms: HTMLCollectionOf<HTMLFormElement>;
|
|
32
|
+
violationKeys: string[];
|
|
33
|
+
init(): void;
|
|
34
|
+
observeDOMForFields(): void;
|
|
35
|
+
getFilesHelper(
|
|
36
|
+
files: FileList | File[],
|
|
37
|
+
opts: any,
|
|
38
|
+
): { violation: string | null; message: string };
|
|
39
|
+
formatSize(size: number, decimals?: number, base?: number): string;
|
|
40
|
+
togglePasswordType(input: HTMLInputElement): void;
|
|
41
|
+
toggleFilled(input: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): void;
|
|
42
|
+
setFallbackHelper(field: HTMLElement): void;
|
|
43
|
+
setFieldListeners(field: HTMLElement): void;
|
|
44
|
+
setUpField(field: HTMLElement): void;
|
|
45
|
+
field(options: FieldOptions): HTMLElement;
|
|
46
|
+
handleFormValidation(form: HTMLFormElement): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// BUNDLE EXPORTS & GLOBAL DECLARATIONS
|
|
50
|
+
export const T007_Form_Manager: T007FormManager;
|
|
51
|
+
export const field = T007FormManager["field"];
|
|
52
|
+
export const handleFormValidation = T007FormManager["handleFormValidation"];
|
|
53
|
+
|
|
54
|
+
declare global {
|
|
55
|
+
interface T007Namespace {
|
|
56
|
+
FM: T007FormManager;
|
|
57
|
+
field?: T007FormManager["field"];
|
|
58
|
+
handleFormValidation?: T007FormManager["handleFormValidation"];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface Window {
|
|
62
|
+
T007_INPUT_CSS_SRC?: string;
|
|
63
|
+
T007_INPUT_JS_SRC?: string;
|
|
64
|
+
|
|
65
|
+
field?: T007Namespace["field"];
|
|
66
|
+
handleFormValidation?: T007Namespace["handleFormValidation"];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface HTMLFormElement {
|
|
70
|
+
onSubmit?(): void;
|
|
71
|
+
validateOnClient?(): boolean;
|
|
72
|
+
validateOnServer?(): Promise<boolean>;
|
|
73
|
+
toggleGlobalError?(bool: boolean): void;
|
|
74
|
+
}
|
|
75
|
+
}
|