formstack-ui 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/CHANGELOG.md +206 -0
- package/LICENSE +21 -0
- package/README.md +341 -0
- package/dist/bin/index.js +1077 -0
- package/dist/bin/registry.js +105 -0
- package/dist/components/FormikSchemaForm.d.ts +11 -0
- package/dist/components/SchemaForm.d.ts +26 -0
- package/dist/components/ThemeSwitcher.d.ts +1 -0
- package/dist/components/builder/FormBuilder.d.ts +1 -0
- package/dist/components/demo/Documentation.d.ts +1 -0
- package/dist/components/demo/StatesGallery.d.ts +1 -0
- package/dist/components/form/FormRenderer.d.ts +9 -0
- package/dist/components/layout/GridContainer.d.ts +8 -0
- package/dist/components/layout/GridItem.d.ts +8 -0
- package/dist/components/pages/ChangelogPage.d.ts +1 -0
- package/dist/components/pages/DemoPage.d.ts +6 -0
- package/dist/components/pages/GuidePage.d.ts +1 -0
- package/dist/components/pages/Home.d.ts +1 -0
- package/dist/components/pages/ReadmePage.d.ts +1 -0
- package/dist/components/pages/TasksPage.d.ts +1 -0
- package/dist/components/pages/ThemeOverridesPage.d.ts +1 -0
- package/dist/components/playground/ComponentPlayground.d.ts +8 -0
- package/dist/components/playground/PlaygroundPage.d.ts +1 -0
- package/dist/components/playground/components-config.d.ts +10 -0
- package/dist/components/playground/types.d.ts +14 -0
- package/dist/components/theme/ThemeContext.d.ts +16 -0
- package/dist/components/theme/defaultTheme.d.ts +2 -0
- package/dist/components/theme/types.d.ts +38 -0
- package/dist/components/ui/Checkbox.d.ts +6 -0
- package/dist/components/ui/FileInput.d.ts +12 -0
- package/dist/components/ui/Grid.d.ts +18 -0
- package/dist/components/ui/RadioGroup.d.ts +16 -0
- package/dist/components/ui/Select.d.ts +9 -0
- package/dist/components/ui/Switch.d.ts +6 -0
- package/dist/components/ui/TextInput.d.ts +6 -0
- package/dist/components/ui/Textarea.d.ts +10 -0
- package/dist/components/ui/date/Calendar.d.ts +16 -0
- package/dist/components/ui/date/DatePicker.d.ts +12 -0
- package/dist/components/ui/date/DateRangePicker.d.ts +18 -0
- package/dist/components/ui/date/DateTimePicker.d.ts +12 -0
- package/dist/components/ui/date/TimePicker.d.ts +12 -0
- package/dist/components/ui/date/TimeView.d.ts +7 -0
- package/dist/components/ui/date/index.d.ts +4 -0
- package/dist/components/ui/field/BaseField.d.ts +16 -0
- package/dist/components/ui/field/ErrorTooltip.d.ts +6 -0
- package/dist/components/ui/field/LabelWrapper.d.ts +14 -0
- package/dist/components/ui/field/types.d.ts +15 -0
- package/dist/components/ui/select/Autocomplete.d.ts +15 -0
- package/dist/components/ui/select/Chip.d.ts +7 -0
- package/dist/components/ui/select/types.d.ts +5 -0
- package/dist/context/ThemeContext.d.ts +14 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useForm.d.ts +28 -0
- package/dist/index.js +11801 -0
- package/dist/lib/demo-schemas.d.ts +2 -0
- package/dist/lib/index.d.ts +17 -0
- package/dist/lib/schema-helpers.d.ts +29 -0
- package/dist/types/schema.d.ts +136 -0
- package/dist/utils/date-utils.d.ts +10 -0
- package/dist/utils/dependencies.d.ts +2 -0
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/yup-validation.d.ts +7 -0
- package/dist/vite.svg +1 -0
- package/package.json +130 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const COMPONENTS_BASE_PATH = "src/components/ui";
|
|
2
|
+
const THEME_BASE_PATH = "src/components/theme";
|
|
3
|
+
export const registry = {
|
|
4
|
+
// CORE UTILS (Theme System)
|
|
5
|
+
"theme-core": {
|
|
6
|
+
name: "theme-core",
|
|
7
|
+
files: [
|
|
8
|
+
`${THEME_BASE_PATH}/ThemeContext.tsx`,
|
|
9
|
+
`${THEME_BASE_PATH}/defaultTheme.ts`,
|
|
10
|
+
`${THEME_BASE_PATH}/types.ts`,
|
|
11
|
+
"src/utils/validation.ts",
|
|
12
|
+
"src/utils/yup-validation.ts",
|
|
13
|
+
"src/components/SchemaForm.tsx",
|
|
14
|
+
"src/components/FormikSchemaForm.tsx",
|
|
15
|
+
],
|
|
16
|
+
dependencies: ["clsx", "tailwind-merge", "zod", "yup", "formik"],
|
|
17
|
+
type: "core",
|
|
18
|
+
},
|
|
19
|
+
// FORM INPUTS
|
|
20
|
+
"text-input": {
|
|
21
|
+
name: "text-input",
|
|
22
|
+
files: [`${COMPONENTS_BASE_PATH}/TextInput.tsx`],
|
|
23
|
+
internalDependencies: ["theme-core"],
|
|
24
|
+
},
|
|
25
|
+
textarea: {
|
|
26
|
+
name: "textarea",
|
|
27
|
+
files: [`${COMPONENTS_BASE_PATH}/Textarea.tsx`],
|
|
28
|
+
internalDependencies: ["theme-core"],
|
|
29
|
+
},
|
|
30
|
+
select: {
|
|
31
|
+
name: "select",
|
|
32
|
+
files: [`${COMPONENTS_BASE_PATH}/Select.tsx`],
|
|
33
|
+
internalDependencies: ["theme-core"],
|
|
34
|
+
},
|
|
35
|
+
checkbox: {
|
|
36
|
+
name: "checkbox",
|
|
37
|
+
files: [`${COMPONENTS_BASE_PATH}/Checkbox.tsx`],
|
|
38
|
+
internalDependencies: ["theme-core"],
|
|
39
|
+
},
|
|
40
|
+
"radio-group": {
|
|
41
|
+
name: "radio-group",
|
|
42
|
+
files: [`${COMPONENTS_BASE_PATH}/RadioGroup.tsx`],
|
|
43
|
+
internalDependencies: ["theme-core"],
|
|
44
|
+
},
|
|
45
|
+
switch: {
|
|
46
|
+
name: "switch",
|
|
47
|
+
files: [`${COMPONENTS_BASE_PATH}/Switch.tsx`],
|
|
48
|
+
internalDependencies: ["theme-core"],
|
|
49
|
+
},
|
|
50
|
+
"file-input": {
|
|
51
|
+
name: "file-input",
|
|
52
|
+
files: [`${COMPONENTS_BASE_PATH}/FileInput.tsx`],
|
|
53
|
+
internalDependencies: ["theme-core"],
|
|
54
|
+
},
|
|
55
|
+
// COMPLEX COMPONENTS
|
|
56
|
+
autocomplete: {
|
|
57
|
+
name: "autocomplete",
|
|
58
|
+
files: [
|
|
59
|
+
`${COMPONENTS_BASE_PATH}/select/Autocomplete.tsx`,
|
|
60
|
+
`${COMPONENTS_BASE_PATH}/select/Chip.tsx`,
|
|
61
|
+
`${COMPONENTS_BASE_PATH}/select/types.ts`,
|
|
62
|
+
],
|
|
63
|
+
internalDependencies: ["theme-core"],
|
|
64
|
+
},
|
|
65
|
+
"date-picker": {
|
|
66
|
+
name: "date-picker",
|
|
67
|
+
files: [
|
|
68
|
+
`${COMPONENTS_BASE_PATH}/date/DatePicker.tsx`,
|
|
69
|
+
`${COMPONENTS_BASE_PATH}/date/Calendar.tsx`,
|
|
70
|
+
],
|
|
71
|
+
dependencies: ["date-fns"],
|
|
72
|
+
internalDependencies: ["theme-core"],
|
|
73
|
+
},
|
|
74
|
+
"date-range-picker": {
|
|
75
|
+
name: "date-range-picker",
|
|
76
|
+
files: [
|
|
77
|
+
`${COMPONENTS_BASE_PATH}/date/DateRangePicker.tsx`,
|
|
78
|
+
`${COMPONENTS_BASE_PATH}/date/Calendar.tsx`,
|
|
79
|
+
],
|
|
80
|
+
dependencies: ["date-fns"],
|
|
81
|
+
internalDependencies: ["theme-core"],
|
|
82
|
+
},
|
|
83
|
+
"date-time-picker": {
|
|
84
|
+
name: "date-time-picker",
|
|
85
|
+
files: [
|
|
86
|
+
`${COMPONENTS_BASE_PATH}/date/DateTimePicker.tsx`,
|
|
87
|
+
`${COMPONENTS_BASE_PATH}/date/Calendar.tsx`,
|
|
88
|
+
`${COMPONENTS_BASE_PATH}/date/TimeView.tsx`,
|
|
89
|
+
],
|
|
90
|
+
dependencies: ["date-fns"],
|
|
91
|
+
internalDependencies: ["theme-core"],
|
|
92
|
+
},
|
|
93
|
+
"time-picker": {
|
|
94
|
+
name: "time-picker",
|
|
95
|
+
files: [
|
|
96
|
+
`${COMPONENTS_BASE_PATH}/date/TimePicker.tsx`,
|
|
97
|
+
`${COMPONENTS_BASE_PATH}/date/TimeView.tsx`,
|
|
98
|
+
],
|
|
99
|
+
dependencies: ["date-fns"],
|
|
100
|
+
internalDependencies: ["theme-core"],
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export const getComponent = (name) => {
|
|
104
|
+
return registry[name];
|
|
105
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormSchema } from "../types/schema";
|
|
2
|
+
import type { FormTheme } from "./theme/types";
|
|
3
|
+
interface FormikSchemaFormProps {
|
|
4
|
+
schema: FormSchema;
|
|
5
|
+
onSubmit: (values: any) => void;
|
|
6
|
+
initialValues?: any;
|
|
7
|
+
validationLib?: "zod" | "yup";
|
|
8
|
+
theme?: FormTheme;
|
|
9
|
+
}
|
|
10
|
+
export declare const FormikSchemaForm: ({ schema, onSubmit, initialValues, validationLib, theme, }: FormikSchemaFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FormSchema } from "../types/schema";
|
|
2
|
+
import type { FormTheme } from "./theme/types";
|
|
3
|
+
interface SchemaFormProps {
|
|
4
|
+
schema: FormSchema;
|
|
5
|
+
onSubmit: (values: any) => void;
|
|
6
|
+
initialValues?: any;
|
|
7
|
+
className?: string;
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
breakpoint?: "mobile" | "tablet" | "desktop";
|
|
10
|
+
hideTitle?: boolean;
|
|
11
|
+
id?: string;
|
|
12
|
+
onValidate?: (values: any) => Record<string, string>;
|
|
13
|
+
onValuesChange?: (values: any) => void;
|
|
14
|
+
validationLib?: "zod" | "yup";
|
|
15
|
+
/**
|
|
16
|
+
* Optional theme override for this form.
|
|
17
|
+
* If provided, all fields within this form will use this theme.
|
|
18
|
+
*/
|
|
19
|
+
theme?: FormTheme;
|
|
20
|
+
}
|
|
21
|
+
export interface SchemaFormHandle {
|
|
22
|
+
submit: () => void;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const SchemaForm: import("react").ForwardRefExoticComponent<SchemaFormProps & import("react").RefAttributes<SchemaFormHandle>>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ThemeSwitcher: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FormBuilder: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Documentation: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StatesGallery: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FormSchema } from "@/types/schema";
|
|
2
|
+
interface FormRendererProps {
|
|
3
|
+
schema: FormSchema;
|
|
4
|
+
initialData?: Record<string, unknown>;
|
|
5
|
+
onSubmit?: (data: Record<string, unknown>) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const FormRenderer: ({ schema, initialData, onSubmit, className, }: FormRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface GridContainerProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
gap?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const GridContainer: ({ children, className, gap, }: GridContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface GridItemProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
colSpan?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const GridItem: ({ children, colSpan, className, }: GridItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChangelogPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GuidePage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Home: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ReadmePage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TasksPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ThemeOverridesPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PropConfig } from "./types";
|
|
2
|
+
interface ComponentPlaygroundProps {
|
|
3
|
+
component: React.ComponentType<any>;
|
|
4
|
+
propDefinitions: Record<string, PropConfig>;
|
|
5
|
+
defaultProps: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export declare const ComponentPlayground: ({ component: Component, propDefinitions, defaultProps, }: ComponentPlaygroundProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PlaygroundPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PropConfig } from "./types";
|
|
2
|
+
export interface ComponentConfig {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
icon: any;
|
|
6
|
+
component: React.ComponentType<any>;
|
|
7
|
+
defaultProps: Record<string, any>;
|
|
8
|
+
propDefinitions: Record<string, PropConfig>;
|
|
9
|
+
}
|
|
10
|
+
export declare const COMPONENTS: Record<string, ComponentConfig>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type PropType = "string" | "boolean" | "number" | "select" | "color" | "json";
|
|
2
|
+
export interface PropConfig {
|
|
3
|
+
type: PropType;
|
|
4
|
+
label?: string;
|
|
5
|
+
options?: string[];
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PlaygroundConfig {
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
component: React.ComponentType<any>;
|
|
12
|
+
propDefinitions: Record<string, PropConfig>;
|
|
13
|
+
defaultProps: Record<string, any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormTheme, ComponentTheme, ComponentState } from "./types";
|
|
2
|
+
export declare const ThemeProvider: import("react").Provider<FormTheme>;
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access the full theme object.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFormTheme: () => FormTheme;
|
|
7
|
+
/**
|
|
8
|
+
* Hook to resolve styles for a specific component.
|
|
9
|
+
*
|
|
10
|
+
* @param componentName The key of the component in the theme object (e.g. 'textInput')
|
|
11
|
+
* @param state The current state of the component (error, focused, etc.)
|
|
12
|
+
* @param overrideClasses Optional overrides passed directly to the component props
|
|
13
|
+
*
|
|
14
|
+
* @returns An object containing the resolved generic class strings for each slot.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useComponentTheme: <K extends keyof FormTheme>(componentName: K, state: ComponentState, overrideClasses?: Partial<Record<keyof ComponentTheme, string>>, globalOverride?: boolean) => Record<keyof ComponentTheme, string>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface ComponentState {
|
|
2
|
+
error?: boolean | string;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
focused?: boolean;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
value?: any;
|
|
7
|
+
variant?: "outline" | "filled" | "standard" | "floating";
|
|
8
|
+
}
|
|
9
|
+
export type StyleOrFn = string | ((state: ComponentState) => string);
|
|
10
|
+
export interface ComponentTheme {
|
|
11
|
+
root?: StyleOrFn;
|
|
12
|
+
label?: StyleOrFn;
|
|
13
|
+
input?: StyleOrFn;
|
|
14
|
+
helperText?: StyleOrFn;
|
|
15
|
+
errorText?: StyleOrFn;
|
|
16
|
+
wrapper?: StyleOrFn;
|
|
17
|
+
icon?: StyleOrFn;
|
|
18
|
+
track?: StyleOrFn;
|
|
19
|
+
thumb?: StyleOrFn;
|
|
20
|
+
list?: StyleOrFn;
|
|
21
|
+
item?: StyleOrFn;
|
|
22
|
+
tag?: StyleOrFn;
|
|
23
|
+
}
|
|
24
|
+
export interface FormTheme {
|
|
25
|
+
global?: ComponentTheme;
|
|
26
|
+
textInput: ComponentTheme;
|
|
27
|
+
textarea: ComponentTheme;
|
|
28
|
+
select: ComponentTheme;
|
|
29
|
+
checkbox: ComponentTheme;
|
|
30
|
+
radio: ComponentTheme;
|
|
31
|
+
switch: ComponentTheme;
|
|
32
|
+
autocomplete: ComponentTheme;
|
|
33
|
+
fileInput: ComponentTheme;
|
|
34
|
+
datePicker: ComponentTheme;
|
|
35
|
+
dateRangePicker: ComponentTheme;
|
|
36
|
+
dateTimePicker: ComponentTheme;
|
|
37
|
+
timePicker: ComponentTheme;
|
|
38
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./field/types";
|
|
3
|
+
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "id">, BaseFieldProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./field/types";
|
|
3
|
+
interface FileInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "id">, BaseFieldProps {
|
|
4
|
+
value?: File | null;
|
|
5
|
+
onChange?: (file: File | null) => void;
|
|
6
|
+
maxSize?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const FileInput: {
|
|
9
|
+
({ id, label, error, required, disabled, className, fullWidth, value, onChange, startAdornment, endAdornment, accept, multiple, maxSize, globalOverRide, ...props }: FileInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface GridContainerProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
gap?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const GridContainer: ({ children, gap, className, }: GridContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
interface GridItemProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
colSpan?: number;
|
|
11
|
+
xs?: number;
|
|
12
|
+
sm?: number;
|
|
13
|
+
md?: number;
|
|
14
|
+
lg?: number;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const GridItem: ({ children, colSpan, xs, sm, md, lg, className, }: GridItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { FieldDirection, ResponsiveDirection } from "../../types/schema";
|
|
3
|
+
import type { BaseFieldProps } from "./field/types";
|
|
4
|
+
interface RadioOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
}
|
|
8
|
+
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "id">, BaseFieldProps {
|
|
9
|
+
name: string;
|
|
10
|
+
value?: string | number;
|
|
11
|
+
onChange?: (value: string | number) => void;
|
|
12
|
+
options: RadioOption[];
|
|
13
|
+
direction?: FieldDirection | ResponsiveDirection;
|
|
14
|
+
}
|
|
15
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./field/types";
|
|
3
|
+
import type { SelectOption } from "@/types/schema";
|
|
4
|
+
interface SelectProps extends BaseFieldProps, Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "id"> {
|
|
5
|
+
options?: SelectOption[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./field/types";
|
|
3
|
+
interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "id">, BaseFieldProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./field/types";
|
|
3
|
+
interface TextInputProps extends BaseFieldProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, "id" | "required"> {
|
|
4
|
+
}
|
|
5
|
+
export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./field/types";
|
|
3
|
+
interface TextareaProps extends BaseFieldProps, Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "id"> {
|
|
4
|
+
rows?: number;
|
|
5
|
+
minRows?: number;
|
|
6
|
+
maxRows?: number;
|
|
7
|
+
resize?: "none" | "vertical" | "horizontal" | "both";
|
|
8
|
+
}
|
|
9
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface CalendarProps {
|
|
3
|
+
value?: Date | null;
|
|
4
|
+
startDate?: Date | null;
|
|
5
|
+
endDate?: Date | null;
|
|
6
|
+
onChange?: (date: Date) => void;
|
|
7
|
+
onRangeChange?: (range: {
|
|
8
|
+
start: Date | null;
|
|
9
|
+
end: Date | null;
|
|
10
|
+
}) => void;
|
|
11
|
+
minDate?: Date;
|
|
12
|
+
maxDate?: Date;
|
|
13
|
+
isRange?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Calendar: React.FC<CalendarProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "../field/types";
|
|
3
|
+
interface DatePickerProps extends BaseFieldProps {
|
|
4
|
+
value?: Date | null;
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
min?: Date;
|
|
7
|
+
max?: Date;
|
|
8
|
+
format?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DatePicker: React.FC<DatePickerProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "../field/types";
|
|
3
|
+
interface DateRangeValue {
|
|
4
|
+
start: Date | null;
|
|
5
|
+
end: Date | null;
|
|
6
|
+
}
|
|
7
|
+
interface DateRangePickerProps extends Omit<BaseFieldProps, "value" | "onChange"> {
|
|
8
|
+
value?: DateRangeValue;
|
|
9
|
+
onChange?: (value: DateRangeValue) => void;
|
|
10
|
+
min?: Date;
|
|
11
|
+
max?: Date;
|
|
12
|
+
format?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
allowReverse?: boolean;
|
|
15
|
+
showTime?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "../field/types";
|
|
3
|
+
interface DateTimePickerProps extends BaseFieldProps {
|
|
4
|
+
value?: Date | null;
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
min?: Date;
|
|
7
|
+
max?: Date;
|
|
8
|
+
format?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DateTimePicker: React.FC<DateTimePickerProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BaseFieldProps } from "../field/types";
|
|
3
|
+
interface TimePickerProps extends BaseFieldProps {
|
|
4
|
+
value?: Date | null;
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
min?: Date;
|
|
7
|
+
max?: Date;
|
|
8
|
+
format?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const TimePicker: React.FC<TimePickerProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
import type { BaseFieldProps } from "./types";
|
|
3
|
+
interface BaseFieldInternalProps extends BaseFieldProps {
|
|
4
|
+
children: (props: {
|
|
5
|
+
hasValue: boolean;
|
|
6
|
+
isFocused: boolean;
|
|
7
|
+
onFocus: (e?: any) => void;
|
|
8
|
+
onBlur: (e?: any) => void;
|
|
9
|
+
id: string;
|
|
10
|
+
style: React.CSSProperties;
|
|
11
|
+
}) => ReactNode;
|
|
12
|
+
value?: any;
|
|
13
|
+
defaultValue?: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const BaseField: ({ id, label, error, required, disabled, startAdornment, endAdornment, className, fullWidth, children, value, defaultValue, onClear, }: BaseFieldInternalProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface LabelWrapperProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
hasValue: boolean;
|
|
6
|
+
isFocused: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
startAdornmentWidth?: number;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const LabelWrapper: ({ id, label, hasValue, isFocused, error, required, disabled, startAdornmentWidth, children, }: LabelWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface BaseFieldProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
startAdornment?: ReactNode;
|
|
10
|
+
endAdornment?: ReactNode;
|
|
11
|
+
onClear?: () => void;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
globalOverRide?: boolean;
|
|
14
|
+
variant?: "outline" | "filled" | "standard" | "floating";
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseFieldProps } from "../field/types";
|
|
2
|
+
import type { Option } from "./types";
|
|
3
|
+
interface AutocompleteProps extends Omit<BaseFieldProps, "value" | "onChange"> {
|
|
4
|
+
options: Option[];
|
|
5
|
+
value?: string | number | (string | number)[];
|
|
6
|
+
onChange?: (value: string | number | (string | number)[] | null) => void;
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
limitTags?: number;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
loadOptions?: (query: string) => Promise<Option[]>;
|
|
12
|
+
onClear?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const Autocomplete: ({ id, label, error, required, disabled, className, startAdornment, endAdornment, fullWidth, options: initialOptions, value, onChange, multiple, limitTags, placeholder, loading: externalLoading, loadOptions, onClear, globalOverRide, variant, }: AutocompleteProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Theme = "light" | "dark" | "system";
|
|
3
|
+
interface ThemeProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
defaultTheme?: Theme;
|
|
6
|
+
storageKey?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ThemeProviderState {
|
|
9
|
+
theme: Theme;
|
|
10
|
+
setTheme: (theme: Theme) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ThemeProvider({ children, defaultTheme, storageKey, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const useTheme: () => ThemeProviderState;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useForm Hook
|
|
3
|
+
* Strictly keeps state FLAT (keys can contain dots like "account.username")
|
|
4
|
+
*/
|
|
5
|
+
export declare function useForm<T extends Record<string, any>>({ initialValues, schema, onSubmit, validate: externalValidate, mode, }: {
|
|
6
|
+
initialValues: T;
|
|
7
|
+
schema?: any;
|
|
8
|
+
onSubmit?: (values: T) => void;
|
|
9
|
+
validate?: (values: T) => Record<string, string>;
|
|
10
|
+
mode?: "onSubmit" | "onChange" | "onBlur";
|
|
11
|
+
}): {
|
|
12
|
+
values: T;
|
|
13
|
+
errors: Record<string, string>;
|
|
14
|
+
touched: Record<string, boolean>;
|
|
15
|
+
setFieldValue: (path: string, value: any, shouldValidate?: boolean) => void;
|
|
16
|
+
reset: () => void;
|
|
17
|
+
handleBlur: (path: string) => void;
|
|
18
|
+
handleSubmit: (e?: React.FormEvent) => void;
|
|
19
|
+
isSubmitting: boolean;
|
|
20
|
+
isSubmitted: boolean;
|
|
21
|
+
register: (path: string) => {
|
|
22
|
+
value: any;
|
|
23
|
+
onChange: (val: any) => void;
|
|
24
|
+
onBlur: () => void;
|
|
25
|
+
error: string;
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
};
|