@delightui/components 0.1.162-alpha.3 → 0.1.162-alpha.5
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/cjs/components/organisms/Form/index.d.ts +5 -1
- package/dist/cjs/components/organisms/Form/useAutosave.d.ts +2 -2
- package/dist/cjs/components/organisms/Form/useForm.d.ts +53 -0
- package/dist/cjs/library.js +1 -1
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/organisms/Form/index.d.ts +5 -1
- package/dist/esm/components/organisms/Form/useAutosave.d.ts +2 -2
- package/dist/esm/components/organisms/Form/useForm.d.ts +53 -0
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +55 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ImgHTMLAttributes, SyntheticEvent, HTMLAttributes, ReactNode, MouseEvent, InputHTMLAttributes, TextareaHTMLAttributes, ComponentType, LiHTMLAttributes, CSSProperties, FormHTMLAttributes, TableHTMLAttributes, TdHTMLAttributes, ReactElement, AriaRole, KeyboardEventHandler, Ref } from 'react';
|
|
4
|
+
import * as react_hook_form from 'react-hook-form';
|
|
4
5
|
import { FieldValues, Path, PathValue, UseFormProps } from 'react-hook-form';
|
|
5
6
|
import { LinkProps } from 'react-router-dom';
|
|
6
7
|
import { Plugin } from 'flatpickr/dist/types/options';
|
|
@@ -2533,7 +2534,59 @@ declare const Form: <TFormValues extends FieldValues = FieldValues>(props: FormP
|
|
|
2533
2534
|
* Note: Uses formState.isDirty to detect changes instead of watching all values
|
|
2534
2535
|
* for better performance
|
|
2535
2536
|
*/
|
|
2536
|
-
declare const useAutosave: <TFormValues extends FieldValues>(enabled: boolean, onSubmit: FormSubmitHandler<TFormValues> | undefined, delayMs?: number) => void;
|
|
2537
|
+
declare const useAutosave: <TFormValues extends FieldValues>(enabled: boolean, onSubmit: FormSubmitHandler<TFormValues> | LegacyFormSubmitHandler<TFormValues> | undefined, delayMs?: number) => void;
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* @deprecated This hook is deprecated and maintained for backwards compatibility only.
|
|
2541
|
+
* Use react-hook-form hooks directly instead:
|
|
2542
|
+
* - `useFormContext()` for setValue, setError, reset, handleSubmit
|
|
2543
|
+
* - `useWatch()` for form values
|
|
2544
|
+
* - `useFormState()` for errors, isDirty, isValid, etc.
|
|
2545
|
+
*
|
|
2546
|
+
* @example
|
|
2547
|
+
* ```tsx
|
|
2548
|
+
* // Old API (deprecated)
|
|
2549
|
+
* const { formState, formErrors, updateFieldValue, resetForm } = useForm();
|
|
2550
|
+
*
|
|
2551
|
+
* // New API (recommended)
|
|
2552
|
+
* import { useFormContext, useWatch, useFormState } from 'react-hook-form';
|
|
2553
|
+
* const { setValue, setError, reset } = useFormContext();
|
|
2554
|
+
* const formValues = useWatch();
|
|
2555
|
+
* const { errors } = useFormState();
|
|
2556
|
+
* ```
|
|
2557
|
+
*/
|
|
2558
|
+
declare const useForm: <T extends FieldValues = FieldValues>() => {
|
|
2559
|
+
/** Current form values */
|
|
2560
|
+
formState: T;
|
|
2561
|
+
/** Current form errors as { fieldName: "error message" } */
|
|
2562
|
+
formErrors: Record<keyof T, string>;
|
|
2563
|
+
/** Update a field value */
|
|
2564
|
+
updateFieldValue: (name: keyof T | string, value: FieldValue) => void;
|
|
2565
|
+
/** Set an error for a field */
|
|
2566
|
+
updateFieldError: (name: keyof T | string, errorMessage: string) => void;
|
|
2567
|
+
/** Reset form to initial values */
|
|
2568
|
+
resetForm: () => void;
|
|
2569
|
+
/** Submit handler (wrap your submit function) */
|
|
2570
|
+
onFormSubmit: react_hook_form.UseFormHandleSubmit<T, T>;
|
|
2571
|
+
};
|
|
2572
|
+
/**
|
|
2573
|
+
* @deprecated Use useForm instead, or better yet, use react-hook-form hooks directly.
|
|
2574
|
+
* Type-safe version of useForm that returns properly typed form context
|
|
2575
|
+
*/
|
|
2576
|
+
declare const useFormTyped: <T extends FieldValues>() => {
|
|
2577
|
+
/** Current form values */
|
|
2578
|
+
formState: T;
|
|
2579
|
+
/** Current form errors as { fieldName: "error message" } */
|
|
2580
|
+
formErrors: Record<keyof T, string>;
|
|
2581
|
+
/** Update a field value */
|
|
2582
|
+
updateFieldValue: (name: string | keyof T, value: FieldValue) => void;
|
|
2583
|
+
/** Set an error for a field */
|
|
2584
|
+
updateFieldError: (name: string | keyof T, errorMessage: string) => void;
|
|
2585
|
+
/** Reset form to initial values */
|
|
2586
|
+
resetForm: () => void;
|
|
2587
|
+
/** Submit handler (wrap your submit function) */
|
|
2588
|
+
onFormSubmit: react_hook_form.UseFormHandleSubmit<T, T>;
|
|
2589
|
+
};
|
|
2537
2590
|
|
|
2538
2591
|
type TableProps = TableHTMLAttributes<HTMLTableElement> & {
|
|
2539
2592
|
/**
|
|
@@ -2894,4 +2947,4 @@ declare const NotificationContext: React__default.Context<NotificationContextVal
|
|
|
2894
2947
|
declare const NotificationProvider: React__default.FC<NotificationProviderProps>;
|
|
2895
2948
|
declare const useNotification: () => NotificationContextValue;
|
|
2896
2949
|
|
|
2897
|
-
export { type AccessibilityActions, type AccessibilityProps, Accordion, AccordionDetails, AccordionGroup, AccordionSummary, ActionCard, type ActionCardProps, ActionImage, type ActionImageProps, type AsyncFieldValidationFunction, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Breakpoint, type BreakpointProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, CheckboxItem, type CheckboxItemProps, type CheckboxLabelAlignmentEnum, type CheckboxProps, type CheckboxSizeEnum, type CheckboxTypeEnum, Chip, ChipInput, type ChipInputProps, type ChipProps, ConditionalView, type ConditionalViewProps, ContextMenu, type ContextMenuProps, type ControlledFormComponentProps, type CustomTimePickerConfig, CustomToggle, type CustomToggleProps, DateInput, type DateInputProps, DatePicker, type DatePickerProps, SortableItem as DraggableItem, SortableTrigger as DraggableItemTrigger, Dropzone, DropzoneClear, DropzoneContent, type DropzoneContentProps, type DropzoneContentTypeEnum, DropzoneFilename, DropzoneFilename as DropzonePreview, type DropzoneProps, DropzoneSupportedFormats as DropzoneReject, DropzoneTrigger as DropzoneRoot, DropzoneSupportedFormats, DropzoneTrigger, type FieldValidationFunction, type FieldValue, Form, FormField, type FormFieldProps, type FormProps, type FormProviderProps, type FormSubmitHandler, Grid, GridItem, type GridItemProps, GridList, type GridListProps, type GridProps, Icon, IconButton, type IconButtonProps, type IconButtonStyleEnum, type IconProps, type IconSizeEnum, type IconStyleEnum, Image, type ImageFitEnum, type ImageProps, Input, type InputProps, type InputTypeEnum, type LegacyAsyncFieldValidationFunction, type LegacyFieldValidationFunction, List, ListItem, type ListItemProps$1 as ListItemProps, type ListProps, Modal, type ModalComponentProps, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, ModalProvider, type ModalProviderProps, Nav, NavItem, type NavItemProps, NavLink, type NavLinkProps, type NavProps, type Notification, type NotificationContainerProps, NotificationContext, type NotificationOffset, type NotificationPosition, NotificationProvider, type NotificationTrigger, Option, type OptionLike, type OptionLikeKey, type OptionProps, type OverlayDirectionEnum, Pagination, PaginationNumberField, type PaginationNumberFieldProps, type PaginationProps, Password, Popover, type PopoverHandle, type PopoverProps, ProgressBar, type ProgressBarProps, RadioButton, RadioButtonItem, type RadioButtonItemProps, type RadioButtonLabelAlignmentEnum, type RadioButtonProps, type RadioButtonSizeEnum, RadioGroup, type RadioGroupProps, RenderStateView, type RenderStateViewProps, RepeaterList, type RepeaterListProps, ResponsiveComponent, type ResponsiveComponentProps, Search, type SearchCallback, type SearchStyleEnum as SearchModeEnum, type SearchProps, Select, SelectListItem, type SelectListItemProps, type SelectProps, SelectProvider, SlideOutPanel, type SlideOutPanelDirectionEnum, type SlideOutPanelProps, type SlideOutPanelSizeEnum, Slider, type SliderProps, Spinner, type SpinnerProps, type StandaloneFieldProps, TabContent, type TabContentProps, TabItem, type TabItemProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, type TextDecorationEnum, type TextProps, type TextTypeEnum, type TextWeightEnum, ThemeContext, type ThemeContextType, ThemeProvider, type ThemeProviderProps, Toggle, ToggleButton, type ToggleButtonProps, type ToggleLabelAlignmentEnum, type ToggleProps, Tooltip, type TooltipProps, type TriggerNotificationPayload, type UploadedFileMetadata, type UseModalReturn, WrapTextNodes, type WrapTextNodesProps, applyPropsToChildren, getClickAccessibilityProps, mergeRefs, useAutosave, useDebounce, useDropzoneContext, useInflateView, useModal, useNotification, useSelectContext, useTab };
|
|
2950
|
+
export { type AccessibilityActions, type AccessibilityProps, Accordion, AccordionDetails, AccordionGroup, AccordionSummary, ActionCard, type ActionCardProps, ActionImage, type ActionImageProps, type AsyncFieldValidationFunction, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Breakpoint, type BreakpointProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, CheckboxItem, type CheckboxItemProps, type CheckboxLabelAlignmentEnum, type CheckboxProps, type CheckboxSizeEnum, type CheckboxTypeEnum, Chip, ChipInput, type ChipInputProps, type ChipProps, ConditionalView, type ConditionalViewProps, ContextMenu, type ContextMenuProps, type ControlledFormComponentProps, type CustomTimePickerConfig, CustomToggle, type CustomToggleProps, DateInput, type DateInputProps, DatePicker, type DatePickerProps, SortableItem as DraggableItem, SortableTrigger as DraggableItemTrigger, Dropzone, DropzoneClear, DropzoneContent, type DropzoneContentProps, type DropzoneContentTypeEnum, DropzoneFilename, DropzoneFilename as DropzonePreview, type DropzoneProps, DropzoneSupportedFormats as DropzoneReject, DropzoneTrigger as DropzoneRoot, DropzoneSupportedFormats, DropzoneTrigger, type FieldValidationFunction, type FieldValue, Form, FormField, type FormFieldProps, type FormProps, type FormProviderProps, type FormStateChangeHandler, type FormSubmitHandler, type FormValidator, Grid, GridItem, type GridItemProps, GridList, type GridListProps, type GridProps, Icon, IconButton, type IconButtonProps, type IconButtonStyleEnum, type IconProps, type IconSizeEnum, type IconStyleEnum, Image, type ImageFitEnum, type ImageProps, Input, type InputProps, type InputTypeEnum, type LegacyAsyncFieldValidationFunction, type LegacyFieldValidationFunction, type LegacyFormSubmitHandler, List, ListItem, type ListItemProps$1 as ListItemProps, type ListProps, Modal, type ModalComponentProps, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, ModalProvider, type ModalProviderProps, Nav, NavItem, type NavItemProps, NavLink, type NavLinkProps, type NavProps, type Notification, type NotificationContainerProps, NotificationContext, type NotificationOffset, type NotificationPosition, NotificationProvider, type NotificationTrigger, Option, type OptionLike, type OptionLikeKey, type OptionProps, type OverlayDirectionEnum, Pagination, PaginationNumberField, type PaginationNumberFieldProps, type PaginationProps, Password, Popover, type PopoverHandle, type PopoverProps, ProgressBar, type ProgressBarProps, RadioButton, RadioButtonItem, type RadioButtonItemProps, type RadioButtonLabelAlignmentEnum, type RadioButtonProps, type RadioButtonSizeEnum, RadioGroup, type RadioGroupProps, RenderStateView, type RenderStateViewProps, RepeaterList, type RepeaterListProps, ResponsiveComponent, type ResponsiveComponentProps, Search, type SearchCallback, type SearchStyleEnum as SearchModeEnum, type SearchProps, Select, SelectListItem, type SelectListItemProps, type SelectProps, SelectProvider, SlideOutPanel, type SlideOutPanelDirectionEnum, type SlideOutPanelProps, type SlideOutPanelSizeEnum, Slider, type SliderProps, Spinner, type SpinnerProps, type StandaloneFieldProps, TabContent, type TabContentProps, TabItem, type TabItemProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, type TextDecorationEnum, type TextProps, type TextTypeEnum, type TextWeightEnum, ThemeContext, type ThemeContextType, ThemeProvider, type ThemeProviderProps, Toggle, ToggleButton, type ToggleButtonProps, type ToggleLabelAlignmentEnum, type ToggleProps, Tooltip, type TooltipProps, type TriggerNotificationPayload, type UploadedFileMetadata, type UseModalReturn, WrapTextNodes, type WrapTextNodesProps, applyPropsToChildren, getClickAccessibilityProps, mergeRefs, useAutosave, useDebounce, useDropzoneContext, useForm, useFormTyped, useInflateView, useModal, useNotification, useSelectContext, useTab };
|