@true-tech-team/react-components 0.0.9 → 1.0.0
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 +0 -1
- package/index.css +1 -1
- package/index.d.ts +15 -0
- package/index.js +1 -1
- package/index.mjs +16311 -14302
- package/lib/components/buttons/Button/Button.d.ts +3 -1
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroup.d.ts +3 -1
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupItem.d.ts +3 -1
- package/lib/components/buttons/IconButton/IconButton.d.ts +3 -1
- package/lib/components/buttons/ToggleButton/ToggleButton.d.ts +3 -1
- package/lib/components/display/Accordion/Accordion.d.ts +3 -1
- package/lib/components/display/Accordion/index.d.ts +1 -1
- package/lib/components/display/Avatar/Avatar.d.ts +3 -1
- package/lib/components/display/Badge/Badge.d.ts +3 -1
- package/lib/components/display/Card/Card.d.ts +3 -1
- package/lib/components/display/Carousel/Carousel.d.ts +3 -1
- package/lib/components/display/Chip/Chip.d.ts +3 -1
- package/lib/components/display/CircularProgress/CircularProgress.d.ts +3 -1
- package/lib/components/display/Collapse/Collapse.d.ts +3 -1
- package/lib/components/display/CountUp/CountUp.d.ts +3 -1
- package/lib/components/display/FlipCard/FlipCard.d.ts +3 -1
- package/lib/components/display/KPI/KPI.d.ts +3 -1
- package/lib/components/display/List/List.d.ts +2 -2
- package/lib/components/display/List/ListEmpty.d.ts +0 -3
- package/lib/components/display/List/ListGroup.d.ts +2 -5
- package/lib/components/display/List/ListHeader.d.ts +0 -3
- package/lib/components/display/List/ListItem.d.ts +1 -1
- package/lib/components/display/List/ListSearch.d.ts +0 -3
- package/lib/components/display/List/ListSkeleton.d.ts +0 -3
- package/lib/components/display/OverflowText/OverflowText.d.ts +3 -1
- package/lib/components/display/PageMessages/PageMessages.d.ts +3 -1
- package/lib/components/display/Pill/Pill.d.ts +3 -1
- package/lib/components/display/ProgressBar/ProgressBar.d.ts +3 -1
- package/lib/components/display/Reveal/Reveal.d.ts +3 -1
- package/lib/components/display/ScrollArea/ScrollArea.d.ts +3 -1
- package/lib/components/display/Skeleton/Skeleton.d.ts +3 -1
- package/lib/components/display/Spinner/Spinner.d.ts +3 -1
- package/lib/components/display/StatusIndicator/StatusIndicator.d.ts +3 -1
- package/lib/components/display/Table/Table.d.ts +2 -2
- package/lib/components/display/Table/TableBody.d.ts +0 -3
- package/lib/components/display/Table/TableCell.d.ts +0 -3
- package/lib/components/display/Table/TableHeader.d.ts +0 -3
- package/lib/components/display/Table/TableRow.d.ts +1 -4
- package/lib/components/display/Table/TableSearch.d.ts +0 -3
- package/lib/components/display/Table/TableSkeleton.d.ts +0 -3
- package/lib/components/display/Table/hooks/useInfiniteScroll.d.ts +1 -1
- package/lib/components/display/Tabs/Tab.d.ts +3 -1
- package/lib/components/display/Tabs/TabList.d.ts +3 -1
- package/lib/components/display/Tabs/TabPanel.d.ts +3 -1
- package/lib/components/display/Tabs/Tabs.d.ts +3 -1
- package/lib/components/display/Tabs/index.d.ts +1 -1
- package/lib/components/display/Tag/Tag.d.ts +3 -1
- package/lib/components/display/TruncatedList/TruncatedList.d.ts +1 -1
- package/lib/components/dnd/DragHandle/DragHandle.d.ts +3 -1
- package/lib/components/dnd/DragOverlay/DragOverlay.d.ts +1 -1
- package/lib/components/dnd/KanbanBoard/KanbanBoard.d.ts +0 -3
- package/lib/components/dnd/KanbanBoard/KanbanCard.d.ts +3 -1
- package/lib/components/dnd/KanbanBoard/KanbanColumn.d.ts +3 -1
- package/lib/components/dnd/KanbanBoard/index.d.ts +1 -1
- package/lib/components/dnd/ResizablePanels/ResizablePanel.d.ts +6 -1
- package/lib/components/dnd/ResizablePanels/ResizeHandle.d.ts +3 -1
- package/lib/components/dnd/SortableGrid/SortableGrid.d.ts +0 -3
- package/lib/components/dnd/SortableGrid/SortableGridItem.d.ts +3 -1
- package/lib/components/dnd/SortableList/SortableItem.d.ts +3 -1
- package/lib/components/dnd/SortableList/SortableList.d.ts +0 -3
- package/lib/components/filters/core/ActiveFilters/ActiveFilters.d.ts +3 -1
- package/lib/components/filters/core/FilterField/FilterField.d.ts +3 -1
- package/lib/components/filters/core/FilterSection/FilterSection.d.ts +3 -1
- package/lib/components/filters/fields/CheckboxFilter.d.ts +3 -1
- package/lib/components/filters/fields/DateFilter.d.ts +3 -1
- package/lib/components/filters/fields/DateRangeFilter.d.ts +3 -1
- package/lib/components/filters/fields/ListSelectFilter.d.ts +3 -1
- package/lib/components/filters/fields/MultiSelectFilter.d.ts +3 -1
- package/lib/components/filters/fields/NumberFilter.d.ts +3 -1
- package/lib/components/filters/fields/NumberRangeFilter.d.ts +3 -1
- package/lib/components/filters/fields/RatingFilter.d.ts +3 -1
- package/lib/components/filters/fields/SelectFilter.d.ts +3 -1
- package/lib/components/filters/fields/TextFilter.d.ts +3 -1
- package/lib/components/filters/fields/ToggleFilter.d.ts +3 -1
- package/lib/components/filters/index.d.ts +2 -2
- package/lib/components/filters/layouts/FilterAccordion/FilterAccordion.d.ts +3 -1
- package/lib/components/filters/layouts/FilterBar/FilterBar.d.ts +3 -1
- package/lib/components/filters/layouts/FilterModal/FilterModal.d.ts +3 -1
- package/lib/components/filters/layouts/FilterPopover/FilterPopover.d.ts +3 -1
- package/lib/components/filters/layouts/FilterSidebar/FilterSidebar.d.ts +3 -1
- package/lib/components/forms/FormBuilder/FormBuilder.d.ts +3 -1
- package/lib/components/forms/FormBuilder/hooks/useFormValidation.d.ts +2 -2
- package/lib/components/forms/FormBuilder/types.d.ts +3 -0
- package/lib/components/inputs/Autocomplete/Autocomplete.d.ts +1 -1
- package/lib/components/inputs/Checkbox/Checkbox.d.ts +3 -1
- package/lib/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +3 -1
- package/lib/components/inputs/CheckboxGroup/CheckboxGroupItem.d.ts +3 -1
- package/lib/components/inputs/ColorPicker/ColorPicker.d.ts +3 -1
- package/lib/components/inputs/DatePicker/DatePicker.d.ts +3 -1
- package/lib/components/inputs/DateRangePicker/DateRangePicker.d.ts +3 -1
- package/lib/components/inputs/FilePicker/FilePicker.d.ts +3 -1
- package/lib/components/inputs/Input/Input.d.ts +3 -1
- package/lib/components/inputs/Input/index.d.ts +1 -1
- package/lib/components/inputs/NumberInput/NumberInput.d.ts +3 -1
- package/lib/components/inputs/PhoneInput/PhoneInput.d.ts +3 -1
- package/lib/components/inputs/Radio/Radio.d.ts +3 -1
- package/lib/components/inputs/Radio/RadioGroup.d.ts +3 -1
- package/lib/components/inputs/Rating/Rating.d.ts +3 -1
- package/lib/components/inputs/Select/Select.d.ts +3 -1
- package/lib/components/inputs/Slider/Slider.d.ts +3 -1
- package/lib/components/inputs/TagInput/TagInput.d.ts +3 -1
- package/lib/components/inputs/Textarea/Textarea.d.ts +3 -1
- package/lib/components/inputs/Toggle/Toggle.d.ts +3 -1
- package/lib/components/layout/AdaptiveGrid/AdaptiveGrid.d.ts +3 -1
- package/lib/components/layout/MasonryLayout/MasonryLayout.d.ts +3 -1
- package/lib/components/layout/Panes/Pane.d.ts +3 -1
- package/lib/components/layout/Panes/Panes.d.ts +3 -1
- package/lib/components/layout/ResponsiveStack/ResponsiveStack.d.ts +3 -1
- package/lib/components/navigation/BottomNavigation/BottomNavigation.d.ts +3 -1
- package/lib/components/navigation/BottomNavigation/BottomNavigationItem.d.ts +3 -1
- package/lib/components/navigation/Breadcrumbs/BreadcrumbItem.d.ts +3 -1
- package/lib/components/navigation/Breadcrumbs/BreadcrumbSeparator.d.ts +3 -1
- package/lib/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +3 -1
- package/lib/components/navigation/CollapsibleSidebar/CollapsibleSidebar.d.ts +3 -1
- package/lib/components/navigation/NavLink/NavLink.d.ts +3 -1
- package/lib/components/navigation/Navbar/Navbar.d.ts +3 -1
- package/lib/components/navigation/Navbar/NavbarActions.d.ts +3 -1
- package/lib/components/navigation/Navbar/NavbarBrand.d.ts +3 -1
- package/lib/components/navigation/Navbar/NavbarCollapse.d.ts +3 -1
- package/lib/components/navigation/Navbar/NavbarNav.d.ts +3 -1
- package/lib/components/navigation/Navbar/NavbarToggle.d.ts +3 -1
- package/lib/components/navigation/Pagination/Pagination.d.ts +3 -1
- package/lib/components/navigation/SideNav/SideNav.d.ts +3 -1
- package/lib/components/navigation/SideNav/SideNavDivider.d.ts +3 -1
- package/lib/components/navigation/SideNav/SideNavGroup.d.ts +3 -1
- package/lib/components/navigation/SideNav/SideNavItem.d.ts +3 -1
- package/lib/components/navigation/Stepper/Step.d.ts +3 -1
- package/lib/components/navigation/Stepper/Stepper.d.ts +3 -1
- package/lib/components/overlays/Alert/Alert.d.ts +3 -1
- package/lib/components/overlays/Alert/AlertProvider.d.ts +1 -4
- package/lib/components/overlays/Alert/index.d.ts +4 -4
- package/lib/components/overlays/Dialog/Dialog.d.ts +3 -1
- package/lib/components/overlays/Dialog/DialogProvider.d.ts +1 -4
- package/lib/components/overlays/Dialog/index.d.ts +3 -3
- package/lib/components/overlays/LoadingOverlay/LoadingOverlay.d.ts +3 -1
- package/lib/components/overlays/Popover/Popover.d.ts +1 -1
- package/lib/components/overlays/Toast/ToastProvider.d.ts +0 -3
- package/lib/components/overlays/Toast/index.d.ts +2 -2
- package/lib/decorators/ComponentDecorator/ComponentDecorator.d.ts +7 -2
- package/lib/hooks/index.d.ts +16 -1
- package/lib/hooks/useClickOutside/useClickOutside.d.ts +1 -1
- package/lib/hooks/useClipboard/index.d.ts +2 -0
- package/lib/hooks/useClipboard/useClipboard.d.ts +67 -0
- package/lib/hooks/useFocusTrap/useFocusTrap.d.ts +1 -1
- package/lib/hooks/useIntersectionObserver/index.d.ts +2 -0
- package/lib/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +103 -0
- package/lib/hooks/useInterval/index.d.ts +2 -0
- package/lib/hooks/useInterval/useInterval.d.ts +82 -0
- package/lib/hooks/useLocalStorage/index.d.ts +2 -0
- package/lib/hooks/useLocalStorage/useLocalStorage.d.ts +56 -0
- package/lib/hooks/useMediaQuery/index.d.ts +2 -0
- package/lib/hooks/useMediaQuery/useMediaQuery.d.ts +45 -0
- package/lib/hooks/usePopoverPosition/index.d.ts +1 -1
- package/lib/hooks/usePopoverPosition/usePopoverPosition.d.ts +2 -2
- package/lib/hooks/usePrevious/index.d.ts +1 -0
- package/lib/hooks/usePrevious/usePrevious.d.ts +35 -0
- package/lib/hooks/useTimeout/index.d.ts +2 -0
- package/lib/hooks/useTimeout/useTimeout.d.ts +70 -0
- package/lib/hooks/useUrlState/index.d.ts +2 -0
- package/lib/hooks/useUrlState/useUrlState.d.ts +83 -0
- package/lib/types/component.types.d.ts +1 -1
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/validation.d.ts +3 -3
- package/package.json +3 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for media query hook
|
|
3
|
+
*/
|
|
4
|
+
export interface UseMediaQueryOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Default value for SSR or when media query can't be evaluated
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Callback when media query match changes
|
|
12
|
+
*/
|
|
13
|
+
onChange?: (matches: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Return type for media query hook
|
|
17
|
+
*/
|
|
18
|
+
export interface UseMediaQueryReturn {
|
|
19
|
+
/**
|
|
20
|
+
* Whether the media query currently matches
|
|
21
|
+
*/
|
|
22
|
+
matches: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook that reacts to CSS media query changes
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Responsive breakpoints
|
|
30
|
+
* const { matches: isMobile } = useMediaQuery('(max-width: 768px)');
|
|
31
|
+
* const { matches: isTablet } = useMediaQuery('(min-width: 769px) and (max-width: 1024px)');
|
|
32
|
+
* const { matches: isDesktop } = useMediaQuery('(min-width: 1025px)');
|
|
33
|
+
*
|
|
34
|
+
* // User preferences
|
|
35
|
+
* const { matches: prefersDark } = useMediaQuery('(prefers-color-scheme: dark)');
|
|
36
|
+
* const { matches: prefersReducedMotion } = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
37
|
+
*
|
|
38
|
+
* // With callback
|
|
39
|
+
* const { matches } = useMediaQuery('(max-width: 768px)', {
|
|
40
|
+
* onChange: (isMobile) => console.log('Mobile:', isMobile),
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function useMediaQuery(query: string, options?: UseMediaQueryOptions): UseMediaQueryReturn;
|
|
45
|
+
export default useMediaQuery;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { usePopoverPosition } from './usePopoverPosition';
|
|
2
|
-
export type { UsePopoverPositionOptions, UsePopoverPositionReturn
|
|
2
|
+
export type { UsePopoverPositionOptions, UsePopoverPositionReturn } from './usePopoverPosition';
|
|
@@ -36,11 +36,11 @@ export interface UsePopoverPositionReturn {
|
|
|
36
36
|
/**
|
|
37
37
|
* Ref to attach to popover element
|
|
38
38
|
*/
|
|
39
|
-
popoverRef: RefObject<HTMLDivElement>;
|
|
39
|
+
popoverRef: RefObject<HTMLDivElement | null>;
|
|
40
40
|
/**
|
|
41
41
|
* Ref to attach to trigger element
|
|
42
42
|
*/
|
|
43
|
-
triggerRef: RefObject<HTMLElement>;
|
|
43
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
44
44
|
/**
|
|
45
45
|
* Style object to apply to popover
|
|
46
46
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePrevious, default } from './usePrevious';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns the previous value of a state or prop
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* function Counter({ count }: { count: number }) {
|
|
7
|
+
* const prevCount = usePrevious(count);
|
|
8
|
+
*
|
|
9
|
+
* return (
|
|
10
|
+
* <div>
|
|
11
|
+
* Current: {count}, Previous: {prevCount ?? 'N/A'}
|
|
12
|
+
* {prevCount !== undefined && count > prevCount && ' (increased)'}
|
|
13
|
+
* </div>
|
|
14
|
+
* );
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* function UserProfile({ userId }: { userId: string }) {
|
|
21
|
+
* const prevUserId = usePrevious(userId);
|
|
22
|
+
*
|
|
23
|
+
* useEffect(() => {
|
|
24
|
+
* if (prevUserId && prevUserId !== userId) {
|
|
25
|
+
* // User changed, reset form or fetch new data
|
|
26
|
+
* resetForm();
|
|
27
|
+
* }
|
|
28
|
+
* }, [userId, prevUserId]);
|
|
29
|
+
*
|
|
30
|
+
* return <Profile userId={userId} />;
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function usePrevious<T>(value: T): T | undefined;
|
|
35
|
+
export default usePrevious;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for timeout hook
|
|
3
|
+
*/
|
|
4
|
+
export interface UseTimeoutOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Callback to execute after delay
|
|
7
|
+
*/
|
|
8
|
+
callback: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Delay in milliseconds (null to pause/disable)
|
|
11
|
+
*/
|
|
12
|
+
delay: number | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Return type for timeout hook
|
|
16
|
+
*/
|
|
17
|
+
export interface UseTimeoutReturn {
|
|
18
|
+
/**
|
|
19
|
+
* Reset the timeout (restart from beginning)
|
|
20
|
+
*/
|
|
21
|
+
reset: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Clear the timeout (stop without executing)
|
|
24
|
+
*/
|
|
25
|
+
clear: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Declarative timeout hook with cleanup
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Auto-hide notification
|
|
33
|
+
* function Notification({ message, onClose }: Props) {
|
|
34
|
+
* useTimeout({
|
|
35
|
+
* callback: onClose,
|
|
36
|
+
* delay: 5000,
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* return <div>{message}</div>;
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // Conditional timeout
|
|
46
|
+
* const [showHint, setShowHint] = useState(false);
|
|
47
|
+
*
|
|
48
|
+
* useTimeout({
|
|
49
|
+
* callback: () => setShowHint(true),
|
|
50
|
+
* delay: isNewUser ? 3000 : null, // null disables
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* // With controls
|
|
57
|
+
* const { reset, clear } = useTimeout({
|
|
58
|
+
* callback: () => setIdle(true),
|
|
59
|
+
* delay: 30000,
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Reset on user activity
|
|
63
|
+
* useEffect(() => {
|
|
64
|
+
* window.addEventListener('mousemove', reset);
|
|
65
|
+
* return () => window.removeEventListener('mousemove', reset);
|
|
66
|
+
* }, [reset]);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function useTimeout(options: UseTimeoutOptions): UseTimeoutReturn;
|
|
70
|
+
export default useTimeout;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializer/deserializer for URL state values
|
|
3
|
+
*/
|
|
4
|
+
export interface UrlStateSerializer<T> {
|
|
5
|
+
/**
|
|
6
|
+
* Serialize value to URL string
|
|
7
|
+
*/
|
|
8
|
+
serialize: (value: T) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Deserialize URL string to value
|
|
11
|
+
*/
|
|
12
|
+
deserialize: (value: string | null, defaultValue: T) => T;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options for URL state hook
|
|
16
|
+
*/
|
|
17
|
+
export interface UseUrlStateOptions<T> {
|
|
18
|
+
/**
|
|
19
|
+
* Default value when parameter is not present in URL
|
|
20
|
+
*/
|
|
21
|
+
defaultValue: T;
|
|
22
|
+
/**
|
|
23
|
+
* Custom serializer/deserializer for the value
|
|
24
|
+
* @default Inferred from defaultValue type
|
|
25
|
+
*/
|
|
26
|
+
serializer?: UrlStateSerializer<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to replace history entry instead of push
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
replace?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Debounce delay for URL updates (ms)
|
|
34
|
+
* @default 0
|
|
35
|
+
*/
|
|
36
|
+
debounce?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Return type for URL state hook
|
|
40
|
+
*/
|
|
41
|
+
export type UseUrlStateReturn<T> = [
|
|
42
|
+
/** Current value */
|
|
43
|
+
T,
|
|
44
|
+
/** Setter function (like useState) */
|
|
45
|
+
(value: T | ((prev: T) => T)) => void,
|
|
46
|
+
/** Clear the parameter from URL */
|
|
47
|
+
() => void
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* Built-in serializers for common types
|
|
51
|
+
*/
|
|
52
|
+
export declare const urlStateSerializers: {
|
|
53
|
+
string: UrlStateSerializer<string>;
|
|
54
|
+
number: UrlStateSerializer<number>;
|
|
55
|
+
boolean: UrlStateSerializer<boolean>;
|
|
56
|
+
json: <T>() => UrlStateSerializer<T>;
|
|
57
|
+
array: <T extends string>() => UrlStateSerializer<T[]>;
|
|
58
|
+
numberArray: () => UrlStateSerializer<number[]>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Hook that synchronizes React state with URL search parameters
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // Basic string parameter
|
|
66
|
+
* const [search, setSearch] = useUrlState('q', { defaultValue: '' });
|
|
67
|
+
*
|
|
68
|
+
* // Number parameter with debounce
|
|
69
|
+
* const [page, setPage] = useUrlState('page', {
|
|
70
|
+
* defaultValue: 1,
|
|
71
|
+
* serializer: urlStateSerializers.number,
|
|
72
|
+
* debounce: 300,
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // Array parameter
|
|
76
|
+
* const [tags, setTags] = useUrlState('tags', {
|
|
77
|
+
* defaultValue: [],
|
|
78
|
+
* serializer: urlStateSerializers.array(),
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function useUrlState<T>(paramName: string, options: UseUrlStateOptions<T>): UseUrlStateReturn<T>;
|
|
83
|
+
export default useUrlState;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getThemeValue, getColorValue, setThemeValue, applyThemeValues, pxToRem, gridSpacing, isDarkMode, getThemeMode, } from './theme-utils';
|
|
2
|
-
export { getElementBounds, getViewportSize, getScrollPosition, isElementInViewport
|
|
2
|
+
export { getElementBounds, getViewportSize, getScrollPosition, isElementInViewport } from './dom';
|
|
3
3
|
export type { ElementBounds, ViewportSize, ScrollPosition } from './dom';
|
|
4
|
-
export { calculatePopoverPosition, findBestPosition
|
|
4
|
+
export { calculatePopoverPosition, findBestPosition } from './positioning';
|
|
5
5
|
export type { PopoverPosition, PositionCoordinates, PositionOptions, PopoverSize, PopoverWidth, } from './positioning';
|
|
@@ -73,7 +73,7 @@ export declare const validators: {
|
|
|
73
73
|
* @param otherValue Value to match against
|
|
74
74
|
* @param message Custom error message
|
|
75
75
|
*/
|
|
76
|
-
matches: (otherValue:
|
|
76
|
+
matches: (otherValue: unknown, message?: string) => Validator;
|
|
77
77
|
/**
|
|
78
78
|
* Validates file size
|
|
79
79
|
* @param maxSize Maximum size in bytes
|
|
@@ -99,14 +99,14 @@ export declare const combineValidators: (...validators: Validator[]) => Validato
|
|
|
99
99
|
* @param validator Single validator or array of validators
|
|
100
100
|
* @returns ValidationResult object
|
|
101
101
|
*/
|
|
102
|
-
export declare const validate: (value:
|
|
102
|
+
export declare const validate: (value: unknown, validator: Validator | Validator[]) => ValidationResult;
|
|
103
103
|
/**
|
|
104
104
|
* Validates multiple fields
|
|
105
105
|
* @param values Object with field values
|
|
106
106
|
* @param validators Object with field validators
|
|
107
107
|
* @returns Object with validation results
|
|
108
108
|
*/
|
|
109
|
-
export declare const validateForm: (values: Record<string,
|
|
109
|
+
export declare const validateForm: (values: Record<string, unknown>, validators: Record<string, Validator | Validator[]>) => Record<string, ValidationResult>;
|
|
110
110
|
/**
|
|
111
111
|
* Checks if all validation results are valid
|
|
112
112
|
* @param results Validation results object
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@true-tech-team/react-components",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "React TypeScript component library",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"typecheck": "tsc --noEmit -p tsconfig.lib.json"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"react": "
|
|
27
|
-
"react-dom": "
|
|
26
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
27
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"index.js",
|
|
@@ -52,4 +52,3 @@
|
|
|
52
52
|
],
|
|
53
53
|
"license": "MIT"
|
|
54
54
|
}
|
|
55
|
-
|