@true-tech-team/react-components 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.
Files changed (108) hide show
  1. package/README.md +586 -0
  2. package/index.css +1 -0
  3. package/index.d.ts +15 -0
  4. package/index.js +1 -0
  5. package/index.mjs +5224 -0
  6. package/lib/assets/icons/index.d.ts +105 -0
  7. package/lib/components/buttons/Button/Button.d.ts +49 -0
  8. package/lib/components/buttons/Button/index.d.ts +3 -0
  9. package/lib/components/buttons/IconButton/IconButton.d.ts +48 -0
  10. package/lib/components/buttons/IconButton/index.d.ts +3 -0
  11. package/lib/components/buttons/index.d.ts +2 -0
  12. package/lib/components/display/Icon/Icon.d.ts +43 -0
  13. package/lib/components/display/Icon/index.d.ts +3 -0
  14. package/lib/components/display/index.d.ts +1 -0
  15. package/lib/components/forms/FormBuilder/FormBuilder.d.ts +109 -0
  16. package/lib/components/forms/FormBuilder/hooks/index.d.ts +2 -0
  17. package/lib/components/forms/FormBuilder/hooks/useFormState.d.ts +5 -0
  18. package/lib/components/forms/FormBuilder/hooks/useFormValidation.d.ts +11 -0
  19. package/lib/components/forms/FormBuilder/index.d.ts +4 -0
  20. package/lib/components/forms/FormBuilder/types.d.ts +193 -0
  21. package/lib/components/forms/index.d.ts +1 -0
  22. package/lib/components/index.d.ts +50 -0
  23. package/lib/components/inputs/Autocomplete/Autocomplete.d.ts +109 -0
  24. package/lib/components/inputs/Autocomplete/index.d.ts +2 -0
  25. package/lib/components/inputs/Checkbox/Checkbox.d.ts +85 -0
  26. package/lib/components/inputs/Checkbox/index.d.ts +2 -0
  27. package/lib/components/inputs/ColorPicker/ColorPicker.d.ts +82 -0
  28. package/lib/components/inputs/ColorPicker/index.d.ts +2 -0
  29. package/lib/components/inputs/DatePicker/DatePicker.d.ts +81 -0
  30. package/lib/components/inputs/DatePicker/index.d.ts +2 -0
  31. package/lib/components/inputs/DateRangePicker/DateRangePicker.d.ts +115 -0
  32. package/lib/components/inputs/DateRangePicker/index.d.ts +2 -0
  33. package/lib/components/inputs/FilePicker/FilePicker.d.ts +101 -0
  34. package/lib/components/inputs/FilePicker/index.d.ts +2 -0
  35. package/lib/components/inputs/Input/Input.d.ts +171 -0
  36. package/lib/components/inputs/Input/index.d.ts +3 -0
  37. package/lib/components/inputs/NumberInput/NumberInput.d.ts +18 -0
  38. package/lib/components/inputs/NumberInput/index.d.ts +2 -0
  39. package/lib/components/inputs/PhoneInput/PhoneInput.d.ts +87 -0
  40. package/lib/components/inputs/PhoneInput/index.d.ts +2 -0
  41. package/lib/components/inputs/Radio/Radio.d.ts +45 -0
  42. package/lib/components/inputs/Radio/RadioGroup.d.ts +88 -0
  43. package/lib/components/inputs/Radio/index.d.ts +4 -0
  44. package/lib/components/inputs/Rating/Rating.d.ts +22 -0
  45. package/lib/components/inputs/Rating/index.d.ts +2 -0
  46. package/lib/components/inputs/Select/Select.d.ts +142 -0
  47. package/lib/components/inputs/Select/index.d.ts +2 -0
  48. package/lib/components/inputs/Slider/Slider.d.ts +29 -0
  49. package/lib/components/inputs/Slider/index.d.ts +2 -0
  50. package/lib/components/inputs/TagInput/TagInput.d.ts +101 -0
  51. package/lib/components/inputs/TagInput/index.d.ts +2 -0
  52. package/lib/components/inputs/Textarea/Textarea.d.ts +90 -0
  53. package/lib/components/inputs/Textarea/index.d.ts +2 -0
  54. package/lib/components/inputs/Toggle/Toggle.d.ts +69 -0
  55. package/lib/components/inputs/Toggle/index.d.ts +2 -0
  56. package/lib/components/inputs/index.d.ts +16 -0
  57. package/lib/components/overlays/Dropdown/Dropdown.d.ts +84 -0
  58. package/lib/components/overlays/Dropdown/index.d.ts +2 -0
  59. package/lib/components/overlays/Menu/Menu.d.ts +70 -0
  60. package/lib/components/overlays/Menu/MenuContext.d.ts +68 -0
  61. package/lib/components/overlays/Menu/MenuDivider.d.ts +10 -0
  62. package/lib/components/overlays/Menu/MenuGroup.d.ts +20 -0
  63. package/lib/components/overlays/Menu/MenuItem.d.ts +42 -0
  64. package/lib/components/overlays/Menu/MenuList.d.ts +16 -0
  65. package/lib/components/overlays/Menu/index.d.ts +12 -0
  66. package/lib/components/overlays/Popover/Popover.d.ts +74 -0
  67. package/lib/components/overlays/Popover/index.d.ts +2 -0
  68. package/lib/components/overlays/Portal/Portal.d.ts +24 -0
  69. package/lib/components/overlays/Portal/index.d.ts +2 -0
  70. package/lib/components/overlays/Tooltip/Tooltip.d.ts +51 -0
  71. package/lib/components/overlays/Tooltip/index.d.ts +2 -0
  72. package/lib/components/overlays/index.d.ts +5 -0
  73. package/lib/contexts/ThemeContext/ThemeContext.d.ts +40 -0
  74. package/lib/contexts/ThemeContext/index.d.ts +2 -0
  75. package/lib/contexts/index.d.ts +2 -0
  76. package/lib/decorators/ComponentDecorator/ComponentDecorator.d.ts +57 -0
  77. package/lib/decorators/ComponentDecorator/index.d.ts +3 -0
  78. package/lib/decorators/index.d.ts +2 -0
  79. package/lib/hooks/index.d.ts +11 -0
  80. package/lib/hooks/useClickOutside/index.d.ts +1 -0
  81. package/lib/hooks/useClickOutside/useClickOutside.d.ts +9 -0
  82. package/lib/hooks/useDebounce/index.d.ts +1 -0
  83. package/lib/hooks/useDebounce/useDebounce.d.ts +10 -0
  84. package/lib/hooks/useEscapeKey/index.d.ts +1 -0
  85. package/lib/hooks/useEscapeKey/useEscapeKey.d.ts +9 -0
  86. package/lib/hooks/useFocusTrap/index.d.ts +1 -0
  87. package/lib/hooks/useFocusTrap/useFocusTrap.d.ts +8 -0
  88. package/lib/hooks/useHover/index.d.ts +2 -0
  89. package/lib/hooks/useHover/useHover.d.ts +59 -0
  90. package/lib/hooks/usePopoverPosition/index.d.ts +2 -0
  91. package/lib/hooks/usePopoverPosition/usePopoverPosition.d.ts +58 -0
  92. package/lib/hooks/usePortal/index.d.ts +2 -0
  93. package/lib/hooks/usePortal/usePortal.d.ts +23 -0
  94. package/lib/hooks/useTheme/index.d.ts +1 -0
  95. package/lib/providers/GlobalProvider/GlobalProvider.d.ts +56 -0
  96. package/lib/providers/GlobalProvider/index.d.ts +3 -0
  97. package/lib/providers/index.d.ts +2 -0
  98. package/lib/types/component.types.d.ts +129 -0
  99. package/lib/types/index.d.ts +2 -0
  100. package/lib/types/theme.types.d.ts +139 -0
  101. package/lib/utils/colorUtils.d.ts +71 -0
  102. package/lib/utils/dateUtils.d.ts +91 -0
  103. package/lib/utils/dom.d.ts +50 -0
  104. package/lib/utils/index.d.ts +5 -0
  105. package/lib/utils/positioning.d.ts +59 -0
  106. package/lib/utils/theme-utils.d.ts +105 -0
  107. package/lib/utils/validation.d.ts +120 -0
  108. package/package.json +55 -0
@@ -0,0 +1,105 @@
1
+ import { default as Calendar } from './calendar.svg?react';
2
+ import { default as ChevronDown } from './chevron-down.svg?react';
3
+ import { default as ChevronUp } from './chevron-up.svg?react';
4
+ import { default as ChevronLeft } from './chevron-left.svg?react';
5
+ import { default as ChevronRight } from './chevron-right.svg?react';
6
+ import { default as Close } from './close.svg?react';
7
+ import { default as Check } from './check.svg?react';
8
+ import { default as Minus } from './minus.svg?react';
9
+ import { default as Plus } from './plus.svg?react';
10
+ import { default as Info } from './info.svg?react';
11
+ import { default as Help } from './help.svg?react';
12
+ import { default as Warning } from './warning.svg?react';
13
+ import { default as Error } from './error.svg?react';
14
+ import { default as Eye } from './eye.svg?react';
15
+ import { default as EyeOff } from './eye-off.svg?react';
16
+ import { default as Edit } from './edit.svg?react';
17
+ import { default as Copy } from './copy.svg?react';
18
+ import { default as Delete } from './delete.svg?react';
19
+ import { default as Settings } from './settings.svg?react';
20
+ import { default as Profile } from './profile.svg?react';
21
+ import { default as Preferences } from './preferences.svg?react';
22
+ import { default as Account } from './account.svg?react';
23
+ import { default as Logout } from './logout.svg?react';
24
+ /**
25
+ * Icon registry mapping icon names to SVG components
26
+ */
27
+ export declare const iconRegistry: {
28
+ readonly calendar: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
29
+ title?: string;
30
+ }>;
31
+ readonly 'chevron-down': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
32
+ title?: string;
33
+ }>;
34
+ readonly 'chevron-up': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
35
+ title?: string;
36
+ }>;
37
+ readonly 'chevron-left': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
38
+ title?: string;
39
+ }>;
40
+ readonly 'chevron-right': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
41
+ title?: string;
42
+ }>;
43
+ readonly close: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
44
+ title?: string;
45
+ }>;
46
+ readonly check: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
47
+ title?: string;
48
+ }>;
49
+ readonly minus: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
50
+ title?: string;
51
+ }>;
52
+ readonly plus: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
53
+ title?: string;
54
+ }>;
55
+ readonly info: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
56
+ title?: string;
57
+ }>;
58
+ readonly help: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
59
+ title?: string;
60
+ }>;
61
+ readonly warning: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
62
+ title?: string;
63
+ }>;
64
+ readonly error: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
65
+ title?: string;
66
+ }>;
67
+ readonly eye: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
68
+ title?: string;
69
+ }>;
70
+ readonly 'eye-off': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
71
+ title?: string;
72
+ }>;
73
+ readonly edit: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
74
+ title?: string;
75
+ }>;
76
+ readonly copy: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
77
+ title?: string;
78
+ }>;
79
+ readonly delete: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
80
+ title?: string;
81
+ }>;
82
+ readonly settings: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
83
+ title?: string;
84
+ }>;
85
+ readonly profile: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
86
+ title?: string;
87
+ }>;
88
+ readonly preferences: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
89
+ title?: string;
90
+ }>;
91
+ readonly account: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
92
+ title?: string;
93
+ }>;
94
+ readonly logout: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement> & {
95
+ title?: string;
96
+ }>;
97
+ };
98
+ /**
99
+ * Available icon names
100
+ */
101
+ export type IconName = keyof typeof iconRegistry;
102
+ /**
103
+ * Named exports for direct import
104
+ */
105
+ export { Calendar, ChevronDown, ChevronUp, ChevronLeft, ChevronRight, Close, Check, Minus, Plus, Info, Help, Warning, Error, Eye, EyeOff, Edit, Copy, Delete, Settings, Profile, Preferences, Account, Logout, };
@@ -0,0 +1,49 @@
1
+ import { default as React } from 'react';
2
+ import { ExtendedComponentSize, ComponentVariant, BaseComponentProps } from '../../../types';
3
+ import { IconName } from '../../../assets/icons';
4
+ export interface ButtonProps extends BaseComponentProps {
5
+ /**
6
+ * Button variant
7
+ * @default 'primary'
8
+ */
9
+ variant?: ComponentVariant;
10
+ /**
11
+ * Button size
12
+ * @default 'md'
13
+ */
14
+ size?: ExtendedComponentSize;
15
+ /**
16
+ * Whether the button is disabled
17
+ * @default false
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Button type attribute
22
+ * @default 'button'
23
+ */
24
+ type?: 'button' | 'submit' | 'reset';
25
+ /**
26
+ * Click handler
27
+ */
28
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
29
+ /**
30
+ * Whether the button should take full width
31
+ * @default false
32
+ */
33
+ fullWidth?: boolean;
34
+ /**
35
+ * Icon to display before the text
36
+ * Can be an icon name or a React component
37
+ */
38
+ startIcon?: React.ReactNode | IconName;
39
+ /**
40
+ * Icon to display after the text
41
+ * Can be an icon name or a React component
42
+ */
43
+ endIcon?: React.ReactNode | IconName;
44
+ }
45
+ /**
46
+ * Button component with multiple variants and sizes
47
+ */
48
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
49
+ export default Button;
@@ -0,0 +1,3 @@
1
+ export { Button } from './Button';
2
+ export type { ButtonProps } from './Button';
3
+ export { default } from './Button';
@@ -0,0 +1,48 @@
1
+ import { default as React } from 'react';
2
+ import { ComponentVariant, BaseComponentProps, ExtendedComponentSize } from '../../../types';
3
+ import { IconName } from '../../../assets/icons';
4
+ export interface IconButtonProps extends BaseComponentProps {
5
+ /**
6
+ * Icon to display (required)
7
+ */
8
+ icon: IconName;
9
+ /**
10
+ * Button variant
11
+ * @default 'ghost'
12
+ */
13
+ variant?: ComponentVariant;
14
+ /**
15
+ * Button size
16
+ * @default 'md'
17
+ */
18
+ size?: ExtendedComponentSize;
19
+ /**
20
+ * Whether the button is disabled
21
+ * @default false
22
+ */
23
+ disabled?: boolean;
24
+ /**
25
+ * Button type attribute
26
+ * @default 'button'
27
+ */
28
+ type?: 'button' | 'submit' | 'reset';
29
+ /**
30
+ * Click handler
31
+ */
32
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
33
+ /**
34
+ * Accessible label (REQUIRED for icon-only buttons)
35
+ */
36
+ 'aria-label': string;
37
+ }
38
+ /**
39
+ * IconButton component - a button that displays only an icon
40
+ *
41
+ * This component is specifically designed for icon-only buttons with:
42
+ * - Extended size range (xs through xl)
43
+ * - Icon size automatically matched to button size
44
+ * - Default ghost variant for minimal UI
45
+ * - Required aria-label for accessibility
46
+ */
47
+ export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
48
+ export default IconButton;
@@ -0,0 +1,3 @@
1
+ export { IconButton } from './IconButton';
2
+ export type { IconButtonProps } from './IconButton';
3
+ export { default } from './IconButton';
@@ -0,0 +1,2 @@
1
+ export * from './Button';
2
+ export * from './IconButton';
@@ -0,0 +1,43 @@
1
+ import { IconName } from '../../../assets/icons';
2
+ import { BaseComponentProps, ExtendedComponentSize } from '../../../types';
3
+ /**
4
+ * Maps ExtendedComponentSize to pixel values for icons
5
+ */
6
+ export declare const ICON_SIZE_MAP: Record<ExtendedComponentSize, number>;
7
+ /**
8
+ * Converts ExtendedComponentSize to pixel value
9
+ */
10
+ export declare function getIconSize(size: ExtendedComponentSize | number | string): number | string;
11
+ export interface IconProps extends Omit<BaseComponentProps, 'children'> {
12
+ /**
13
+ * Name of the icon from the icon registry
14
+ */
15
+ name: IconName;
16
+ /**
17
+ * Size of the icon
18
+ * Can be:
19
+ * - ExtendedComponentSize: 'xs' | 'sm' | 'md' | 'lg' | 'xl' (mapped to pixels)
20
+ * - number: pixel value
21
+ * - string: CSS size value
22
+ * @default 'lg' (24px)
23
+ */
24
+ size?: ExtendedComponentSize | number | string;
25
+ /**
26
+ * Color of the icon (CSS color value or theme variable)
27
+ * @default 'currentColor'
28
+ */
29
+ color?: string;
30
+ /**
31
+ * Accessible label for screen readers
32
+ */
33
+ 'aria-label'?: string;
34
+ /**
35
+ * Title for the icon (shown on hover)
36
+ */
37
+ title?: string;
38
+ }
39
+ /**
40
+ * Icon component for rendering SVG icons
41
+ */
42
+ export declare function Icon({ name, size, color, className, 'aria-label': ariaLabel, 'data-testid': testId, title, style, }: IconProps): import("react/jsx-runtime").JSX.Element | null;
43
+ export default Icon;
@@ -0,0 +1,3 @@
1
+ export { Icon } from './Icon';
2
+ export type { IconProps } from './Icon';
3
+ export { default } from './Icon';
@@ -0,0 +1 @@
1
+ export * from './Icon';
@@ -0,0 +1,109 @@
1
+ import { default as React } from 'react';
2
+ import { ComponentVariant, ComponentSize, BaseComponentProps } from '../../../types';
3
+ import { FormFieldConfig, FormContext as FormContextType } from './types';
4
+ /**
5
+ * Hook to access form context
6
+ */
7
+ export declare const useFormContext: () => FormContextType;
8
+ export interface FormBuilderProps extends Omit<BaseComponentProps, 'children'> {
9
+ /**
10
+ * Visual style variant
11
+ */
12
+ variant?: ComponentVariant;
13
+ /**
14
+ * Size of form components
15
+ */
16
+ size?: ComponentSize;
17
+ /**
18
+ * Field configurations (config mode)
19
+ */
20
+ fields?: FormFieldConfig[];
21
+ /**
22
+ * Form children (children mode)
23
+ */
24
+ children?: React.ReactNode;
25
+ /**
26
+ * Initial form values
27
+ */
28
+ defaultValues?: Record<string, any>;
29
+ /**
30
+ * Callback when form is submitted
31
+ */
32
+ onSubmit?: (values: Record<string, any>) => void | Promise<void>;
33
+ /**
34
+ * Callback when form values change
35
+ */
36
+ onChange?: (values: Record<string, any>) => void;
37
+ /**
38
+ * Callback when validation changes
39
+ */
40
+ onValidate?: (errors: Record<string, string>) => void;
41
+ /**
42
+ * When to validate fields
43
+ */
44
+ validateOn?: 'change' | 'blur' | 'submit';
45
+ /**
46
+ * Show submit button
47
+ */
48
+ showSubmitButton?: boolean;
49
+ /**
50
+ * Submit button text
51
+ */
52
+ submitButtonText?: string;
53
+ /**
54
+ * Submit button variant
55
+ */
56
+ submitButtonVariant?: ComponentVariant;
57
+ /**
58
+ * Show reset button
59
+ */
60
+ showResetButton?: boolean;
61
+ /**
62
+ * Reset button text
63
+ */
64
+ resetButtonText?: string;
65
+ /**
66
+ * Form layout
67
+ */
68
+ layout?: 'vertical' | 'horizontal' | 'grid';
69
+ /**
70
+ * Number of columns (for grid layout)
71
+ */
72
+ columns?: number;
73
+ /**
74
+ * Gap between fields
75
+ */
76
+ gap?: number;
77
+ /**
78
+ * Loading state (disables form)
79
+ */
80
+ loading?: boolean;
81
+ /**
82
+ * Disabled state
83
+ */
84
+ disabled?: boolean;
85
+ }
86
+ /**
87
+ * FormBuilder component - Build forms from config or React children
88
+ *
89
+ * @example
90
+ * Config mode:
91
+ * ```tsx
92
+ * <FormBuilder
93
+ * fields={[
94
+ * { name: 'email', type: 'input', label: 'Email', validation: { required: true } },
95
+ * { name: 'password', type: 'input', label: 'Password', props: { type: 'password' } }
96
+ * ]}
97
+ * onSubmit={(values) => console.log(values)}
98
+ * />
99
+ * ```
100
+ *
101
+ * Children mode:
102
+ * ```tsx
103
+ * <FormBuilder onSubmit={(values) => console.log(values)}>
104
+ * <Input name="email" label="Email" required />
105
+ * <Input name="password" type="password" label="Password" />
106
+ * </FormBuilder>
107
+ * ```
108
+ */
109
+ export declare const FormBuilder: React.ForwardRefExoticComponent<FormBuilderProps & React.RefAttributes<HTMLFormElement>>;
@@ -0,0 +1,2 @@
1
+ export { useFormState } from './useFormState';
2
+ export { useFormValidation, validateField } from './useFormValidation';
@@ -0,0 +1,5 @@
1
+ import { UseFormStateOptions, FormContext } from '../types';
2
+ /**
3
+ * Hook for managing form state
4
+ */
5
+ export declare const useFormState: (options?: UseFormStateOptions) => FormContext;
@@ -0,0 +1,11 @@
1
+ import { FormFieldValidation, FormValues } from '../types';
2
+ /**
3
+ * Validate a field value against validation rules
4
+ */
5
+ export declare const validateField: (value: any, validation: FormFieldValidation, allValues?: FormValues) => string | null;
6
+ /**
7
+ * Hook for form validation utilities
8
+ */
9
+ export declare const useFormValidation: () => {
10
+ validateField: (value: any, validation: FormFieldValidation, allValues?: FormValues) => string | null;
11
+ };
@@ -0,0 +1,4 @@
1
+ export { FormBuilder, useFormContext } from './FormBuilder';
2
+ export type { FormBuilderProps } from './FormBuilder';
3
+ export { useFormState, useFormValidation } from './hooks';
4
+ export type { FormFieldType, FormFieldConfig, FormFieldValidation, FormFieldDependency, FormValues, FormErrors, FormTouched, FormState, FormActions, FormContext, UseFormStateOptions, } from './types';
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Type definitions for FormBuilder component
3
+ */
4
+ export type FormFieldType = 'input' | 'textarea' | 'toggle' | 'checkbox' | 'radio' | 'select' | 'slider' | 'rating' | 'number' | 'phone' | 'tag' | 'file' | 'color' | 'date' | 'daterange';
5
+ export interface FormFieldValidation {
6
+ /**
7
+ * Field is required
8
+ */
9
+ required?: boolean;
10
+ /**
11
+ * Pattern validation (regex)
12
+ */
13
+ pattern?: RegExp;
14
+ /**
15
+ * Minimum length (for strings)
16
+ */
17
+ minLength?: number;
18
+ /**
19
+ * Maximum length (for strings)
20
+ */
21
+ maxLength?: number;
22
+ /**
23
+ * Minimum value (for numbers)
24
+ */
25
+ min?: number;
26
+ /**
27
+ * Maximum value (for numbers)
28
+ */
29
+ max?: number;
30
+ /**
31
+ * Custom validation function
32
+ */
33
+ custom?: (value: any, allValues: Record<string, any>) => string | null;
34
+ /**
35
+ * Custom error messages
36
+ */
37
+ messages?: {
38
+ required?: string;
39
+ pattern?: string;
40
+ minLength?: string;
41
+ maxLength?: string;
42
+ min?: string;
43
+ max?: string;
44
+ };
45
+ }
46
+ export interface FormFieldDependency {
47
+ /**
48
+ * Field name to depend on
49
+ */
50
+ field: string;
51
+ /**
52
+ * Condition to check
53
+ */
54
+ condition: (value: any) => boolean;
55
+ /**
56
+ * Action to take when condition is met
57
+ */
58
+ action: 'show' | 'hide' | 'enable' | 'disable';
59
+ }
60
+ export interface FormFieldConfig {
61
+ /**
62
+ * Unique field name (used as key in form values)
63
+ */
64
+ name: string;
65
+ /**
66
+ * Field type
67
+ */
68
+ type: FormFieldType;
69
+ /**
70
+ * Field label
71
+ */
72
+ label?: string;
73
+ /**
74
+ * Default value
75
+ */
76
+ defaultValue?: any;
77
+ /**
78
+ * Validation rules
79
+ */
80
+ validation?: FormFieldValidation;
81
+ /**
82
+ * Additional props to pass to the field component
83
+ */
84
+ props?: Record<string, any>;
85
+ /**
86
+ * Field dependencies
87
+ */
88
+ dependencies?: FormFieldDependency[];
89
+ /**
90
+ * Helper text
91
+ */
92
+ helperText?: string;
93
+ }
94
+ export interface FormValues {
95
+ [key: string]: any;
96
+ }
97
+ export interface FormErrors {
98
+ [key: string]: string;
99
+ }
100
+ export interface FormTouched {
101
+ [key: string]: boolean;
102
+ }
103
+ export interface FormState {
104
+ /**
105
+ * Current form values
106
+ */
107
+ values: FormValues;
108
+ /**
109
+ * Form errors
110
+ */
111
+ errors: FormErrors;
112
+ /**
113
+ * Touched fields
114
+ */
115
+ touched: FormTouched;
116
+ /**
117
+ * Whether the form is dirty (has unsaved changes)
118
+ */
119
+ isDirty: boolean;
120
+ /**
121
+ * Whether the form is submitting
122
+ */
123
+ isSubmitting: boolean;
124
+ /**
125
+ * Whether the form is valid
126
+ */
127
+ isValid: boolean;
128
+ }
129
+ export interface FormActions {
130
+ /**
131
+ * Set a field value
132
+ */
133
+ setFieldValue: (name: string, value: any) => void;
134
+ /**
135
+ * Set a field error
136
+ */
137
+ setFieldError: (name: string, error: string) => void;
138
+ /**
139
+ * Set a field touched state
140
+ */
141
+ setFieldTouched: (name: string, touched: boolean) => void;
142
+ /**
143
+ * Validate a single field
144
+ */
145
+ validateField: (name: string) => string | null;
146
+ /**
147
+ * Validate all fields
148
+ */
149
+ validateForm: () => FormErrors;
150
+ /**
151
+ * Submit the form
152
+ */
153
+ submitForm: () => Promise<void>;
154
+ /**
155
+ * Reset the form
156
+ */
157
+ resetForm: () => void;
158
+ /**
159
+ * Register a field
160
+ */
161
+ registerField: (name: string, config?: FormFieldConfig) => void;
162
+ /**
163
+ * Unregister a field
164
+ */
165
+ unregisterField: (name: string) => void;
166
+ }
167
+ export type FormContext = FormState & FormActions;
168
+ export interface UseFormStateOptions {
169
+ /**
170
+ * Initial form values
171
+ */
172
+ initialValues?: FormValues;
173
+ /**
174
+ * Field configurations (for config mode)
175
+ */
176
+ fields?: FormFieldConfig[];
177
+ /**
178
+ * When to validate fields
179
+ */
180
+ validateOn?: 'change' | 'blur' | 'submit';
181
+ /**
182
+ * Callback when form is submitted
183
+ */
184
+ onSubmit?: (values: FormValues) => void | Promise<void>;
185
+ /**
186
+ * Callback when form values change
187
+ */
188
+ onChange?: (values: FormValues) => void;
189
+ /**
190
+ * Callback when form validation state changes
191
+ */
192
+ onValidate?: (errors: FormErrors) => void;
193
+ }
@@ -0,0 +1 @@
1
+ export * from './FormBuilder';
@@ -0,0 +1,50 @@
1
+ export { Button } from './buttons/Button';
2
+ export type { ButtonProps } from './buttons/Button';
3
+ export { Icon } from './display/Icon';
4
+ export type { IconProps } from './display/Icon';
5
+ export { Portal } from './overlays/Portal';
6
+ export type { PortalProps } from './overlays/Portal';
7
+ export { Popover } from './overlays/Popover';
8
+ export type { PopoverProps } from './overlays/Popover';
9
+ export { Tooltip } from './overlays/Tooltip';
10
+ export type { TooltipProps } from './overlays/Tooltip';
11
+ export { Menu, MenuList, MenuItem, MenuDivider, MenuGroup, MenuContext, useMenuContext, } from './overlays/Menu';
12
+ export type { MenuProps, MenuListProps, MenuItemProps, MenuDividerProps, MenuGroupProps, MenuContextValue, SelectionMode, } from './overlays/Menu';
13
+ export { Dropdown } from './overlays/Dropdown';
14
+ export type { DropdownProps } from './overlays/Dropdown';
15
+ export { Input } from './inputs/Input';
16
+ export type { InputProps, ValidationResult, FormatMask, ValidationTiming, InputType } from './inputs/Input';
17
+ export { Autocomplete } from './inputs/Autocomplete';
18
+ export type { AutocompleteProps, AutocompleteOption } from './inputs/Autocomplete';
19
+ export { Toggle } from './inputs/Toggle';
20
+ export type { ToggleProps } from './inputs/Toggle';
21
+ export { Checkbox } from './inputs/Checkbox';
22
+ export type { CheckboxProps } from './inputs/Checkbox';
23
+ export { Radio, RadioGroup, useRadioGroup, RadioGroupContext } from './inputs/Radio';
24
+ export type { RadioProps, RadioGroupProps, RadioGroupContextValue } from './inputs/Radio';
25
+ export { Textarea } from './inputs/Textarea';
26
+ export type { TextareaProps } from './inputs/Textarea';
27
+ export { Select } from './inputs/Select';
28
+ export type { SelectProps, SelectOption } from './inputs/Select';
29
+ export { Slider } from './inputs/Slider';
30
+ export type { SliderProps, Mark } from './inputs/Slider';
31
+ export { Rating } from './inputs/Rating';
32
+ export type { RatingProps } from './inputs/Rating';
33
+ export { NumberInput } from './inputs/NumberInput';
34
+ export type { NumberInputProps } from './inputs/NumberInput';
35
+ export { PhoneInput } from './inputs/PhoneInput';
36
+ export type { PhoneInputProps, Country } from './inputs/PhoneInput';
37
+ export { TagInput } from './inputs/TagInput';
38
+ export type { TagInputProps } from './inputs/TagInput';
39
+ export { FilePicker } from './inputs/FilePicker';
40
+ export type { FilePickerProps, FileError } from './inputs/FilePicker';
41
+ export { ColorPicker } from './inputs/ColorPicker';
42
+ export type { ColorPickerProps, ColorFormat } from './inputs/ColorPicker';
43
+ export { DatePicker } from './inputs/DatePicker';
44
+ export type { DatePickerProps } from './inputs/DatePicker';
45
+ export { DateRangePicker } from './inputs/DateRangePicker';
46
+ export type { DateRangePickerProps, DateRangePreset } from './inputs/DateRangePicker';
47
+ export { FormBuilder, useFormContext } from './forms/FormBuilder';
48
+ export type { FormBuilderProps } from './forms/FormBuilder';
49
+ export { useFormState, useFormValidation } from './forms/FormBuilder';
50
+ export type { FormFieldType, FormFieldConfig, FormFieldValidation, FormFieldDependency, FormValues, FormErrors, FormTouched, FormState, FormActions, FormContext, UseFormStateOptions, } from './forms/FormBuilder';