@true-tech-team/react-components 0.0.9 → 0.0.10

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 (36) hide show
  1. package/README.md +958 -959
  2. package/index.css +1 -1
  3. package/index.d.ts +15 -0
  4. package/index.js +1 -1
  5. package/index.mjs +10655 -8201
  6. package/lib/components/display/Accordion/index.d.ts +1 -1
  7. package/lib/components/display/Table/TableRow.d.ts +1 -1
  8. package/lib/components/display/Tabs/index.d.ts +1 -1
  9. package/lib/components/dnd/KanbanBoard/index.d.ts +1 -1
  10. package/lib/components/filters/index.d.ts +2 -2
  11. package/lib/components/inputs/Input/index.d.ts +1 -1
  12. package/lib/components/overlays/Alert/AlertProvider.d.ts +1 -1
  13. package/lib/components/overlays/Alert/index.d.ts +4 -4
  14. package/lib/components/overlays/Dialog/DialogProvider.d.ts +1 -1
  15. package/lib/components/overlays/Dialog/index.d.ts +3 -3
  16. package/lib/components/overlays/Toast/index.d.ts +2 -2
  17. package/lib/hooks/index.d.ts +16 -1
  18. package/lib/hooks/useClipboard/index.d.ts +2 -0
  19. package/lib/hooks/useClipboard/useClipboard.d.ts +67 -0
  20. package/lib/hooks/useIntersectionObserver/index.d.ts +2 -0
  21. package/lib/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +103 -0
  22. package/lib/hooks/useInterval/index.d.ts +2 -0
  23. package/lib/hooks/useInterval/useInterval.d.ts +82 -0
  24. package/lib/hooks/useLocalStorage/index.d.ts +2 -0
  25. package/lib/hooks/useLocalStorage/useLocalStorage.d.ts +56 -0
  26. package/lib/hooks/useMediaQuery/index.d.ts +2 -0
  27. package/lib/hooks/useMediaQuery/useMediaQuery.d.ts +45 -0
  28. package/lib/hooks/usePopoverPosition/index.d.ts +1 -1
  29. package/lib/hooks/usePrevious/index.d.ts +1 -0
  30. package/lib/hooks/usePrevious/usePrevious.d.ts +35 -0
  31. package/lib/hooks/useTimeout/index.d.ts +2 -0
  32. package/lib/hooks/useTimeout/useTimeout.d.ts +70 -0
  33. package/lib/hooks/useUrlState/index.d.ts +2 -0
  34. package/lib/hooks/useUrlState/useUrlState.d.ts +83 -0
  35. package/lib/utils/index.d.ts +2 -2
  36. package/package.json +54 -55
@@ -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;
@@ -1,5 +1,5 @@
1
1
  export { getThemeValue, getColorValue, setThemeValue, applyThemeValues, pxToRem, gridSpacing, isDarkMode, getThemeMode, } from './theme-utils';
2
- export { getElementBounds, getViewportSize, getScrollPosition, isElementInViewport, } from './dom';
2
+ export { getElementBounds, getViewportSize, getScrollPosition, isElementInViewport } from './dom';
3
3
  export type { ElementBounds, ViewportSize, ScrollPosition } from './dom';
4
- export { calculatePopoverPosition, findBestPosition, } from './positioning';
4
+ export { calculatePopoverPosition, findBestPosition } from './positioning';
5
5
  export type { PopoverPosition, PositionCoordinates, PositionOptions, PopoverSize, PopoverWidth, } from './positioning';
package/package.json CHANGED
@@ -1,55 +1,54 @@
1
- {
2
- "name": "@true-tech-team/react-components",
3
- "version": "0.0.9",
4
- "description": "React TypeScript component library",
5
- "main": "./index.js",
6
- "types": "./index.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./index.d.ts",
10
- "import": "./index.mjs",
11
- "require": "./index.js"
12
- }
13
- },
14
- "scripts": {
15
- "build": "nx build ui-components",
16
- "test": "nx test ui-components",
17
- "test:watch": "nx test ui-components --watch",
18
- "test:coverage": "nx test ui-components --coverage",
19
- "lint": "nx lint ui-components",
20
- "lint:fix": "nx lint ui-components --fix",
21
- "storybook": "nx storybook ui-components",
22
- "storybook:build": "nx build-storybook ui-components",
23
- "typecheck": "tsc --noEmit -p tsconfig.lib.json"
24
- },
25
- "peerDependencies": {
26
- "react": ">=18.0.0",
27
- "react-dom": ">=18.0.0"
28
- },
29
- "files": [
30
- "index.js",
31
- "index.mjs",
32
- "index.d.ts",
33
- "**/*.js",
34
- "**/*.mjs",
35
- "**/*.d.ts",
36
- "**/*.css",
37
- "**/*.scss"
38
- ],
39
- "publishConfig": {
40
- "access": "public"
41
- },
42
- "repository": {
43
- "type": "git",
44
- "directory": "libs/ui-components"
45
- },
46
- "keywords": [
47
- "react",
48
- "components",
49
- "typescript",
50
- "ui",
51
- "library"
52
- ],
53
- "license": "MIT"
54
- }
55
-
1
+ {
2
+ "name": "@true-tech-team/react-components",
3
+ "version": "0.0.10",
4
+ "description": "React TypeScript component library",
5
+ "main": "./index.js",
6
+ "types": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "import": "./index.mjs",
11
+ "require": "./index.js"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "nx build ui-components",
16
+ "test": "nx test ui-components",
17
+ "test:watch": "nx test ui-components --watch",
18
+ "test:coverage": "nx test ui-components --coverage",
19
+ "lint": "nx lint ui-components",
20
+ "lint:fix": "nx lint ui-components --fix",
21
+ "storybook": "nx storybook ui-components",
22
+ "storybook:build": "nx build-storybook ui-components",
23
+ "typecheck": "tsc --noEmit -p tsconfig.lib.json"
24
+ },
25
+ "peerDependencies": {
26
+ "react": ">=18.0.0",
27
+ "react-dom": ">=18.0.0"
28
+ },
29
+ "files": [
30
+ "index.js",
31
+ "index.mjs",
32
+ "index.d.ts",
33
+ "**/*.js",
34
+ "**/*.mjs",
35
+ "**/*.d.ts",
36
+ "**/*.css",
37
+ "**/*.scss"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "directory": "libs/ui-components"
45
+ },
46
+ "keywords": [
47
+ "react",
48
+ "components",
49
+ "typescript",
50
+ "ui",
51
+ "library"
52
+ ],
53
+ "license": "MIT"
54
+ }