@classytic/fluid 0.1.1 → 0.2.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.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Filter utilities for building URL parameters
3
+ * Simplified approach since backend handles all operator parsing
4
+ */
5
+ interface FilterConfig {
6
+ paramName: string;
7
+ type?: "array" | "string" | "number" | "boolean";
8
+ defaultValue?: unknown;
9
+ }
10
+ interface SearchConfig {
11
+ basePath: string;
12
+ searchFields?: Record<string, string>;
13
+ filterFields?: Record<string, FilterConfig>;
14
+ defaultSearchType?: string;
15
+ }
16
+ /**
17
+ * Build URL parameters from filters object
18
+ */
19
+ declare function buildFilterParams(filters: Record<string, unknown>, filterConfig: Record<string, FilterConfig>): URLSearchParams;
20
+ /**
21
+ * Build search parameters from search state
22
+ */
23
+ declare function buildSearchParams(searchType: string, searchValue: string, searchFields: Record<string, string>): URLSearchParams;
24
+ /**
25
+ * Build listing status parameters (inventory-specific)
26
+ */
27
+ declare function buildListingStatusParams(listingStatus: Record<string, boolean | undefined>): URLSearchParams;
28
+ /**
29
+ * Clear specific parameter types from URLSearchParams
30
+ */
31
+ declare function clearSearchAndFilterParams(params: URLSearchParams, config: SearchConfig): void;
32
+ /**
33
+ * Get API-ready parameters from URL
34
+ */
35
+ declare function getApiParams(searchParams: URLSearchParams): Record<string, string>;
36
+
37
+ interface UseBaseSearchConfig {
38
+ basePath: string;
39
+ searchFields?: Record<string, string>;
40
+ filterFields?: Record<string, FilterConfig>;
41
+ defaultSearchType?: string;
42
+ }
43
+ interface UseBaseSearchReturn {
44
+ searchType: string;
45
+ setSearchType: (type: string) => void;
46
+ searchValue: string;
47
+ setSearchValue: (value: string) => void;
48
+ filters: Record<string, unknown>;
49
+ setFilters: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
50
+ updateFilter: (key: string, value: unknown) => void;
51
+ handleSearch: () => void;
52
+ clearSearch: () => void;
53
+ getSearchParams: () => Record<string, string>;
54
+ hasActiveSearch: boolean;
55
+ hasActiveFilters: boolean;
56
+ }
57
+ /**
58
+ * Base search hook that provides common search functionality
59
+ * Can be extended by specific search hooks for different entities
60
+ * Supports bracket syntax: field[operator]=value
61
+ */
62
+ declare function useBaseSearch(config: UseBaseSearchConfig): UseBaseSearchReturn;
63
+
64
+ export { type FilterConfig as F, type SearchConfig as S, type UseBaseSearchReturn as U, buildSearchParams as a, buildFilterParams as b, buildListingStatusParams as c, clearSearchAndFilterParams as d, type UseBaseSearchConfig as e, getApiParams as g, useBaseSearch as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classytic/fluid",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Fluid UI - Custom components built on shadcn/ui and base ui by Classytic",
6
6
  "main": "./dist/index.js",
@@ -18,11 +18,21 @@
18
18
  "types": "./dist/dashboard.d.ts",
19
19
  "import": "./dist/dashboard.js"
20
20
  },
21
- "./styles.css": "./styles.css"
21
+ "./compact": {
22
+ "types": "./dist/compact.d.ts",
23
+ "import": "./dist/compact.js"
24
+ },
25
+ "./search": {
26
+ "types": "./dist/search.d.ts",
27
+ "import": "./dist/search.js"
28
+ },
29
+ "./styles.css": "./styles.css",
30
+ "./animations.css": "./animations.css"
22
31
  },
23
32
  "files": [
24
33
  "dist",
25
- "styles.css"
34
+ "styles.css",
35
+ "animations.css"
26
36
  ],
27
37
  "scripts": {
28
38
  "build": "tsup && node scripts/add-use-client.js",
@@ -32,18 +42,18 @@
32
42
  "prepublishOnly": "npm run build"
33
43
  },
34
44
  "peerDependencies": {
35
- "react": ">=18.0.0",
36
- "react-dom": ">=18.0.0",
37
- "lucide-react": ">=0.300.0",
45
+ "react": ">=19.0.0",
46
+ "react-dom": ">=19.0.0",
47
+ "lucide-react": "^0.460.0",
38
48
  "class-variance-authority": ">=0.7.0",
39
- "clsx": ">=2.0.0",
40
- "tailwind-merge": ">=2.0.0",
41
- "@tanstack/react-table": ">=8.0.0",
42
- "@radix-ui/react-slider": ">=1.0.0",
43
- "next": ">=14.0.0",
44
- "next-themes": ">=0.3.0",
45
- "react-hook-form": ">=7.0.0",
46
- "date-fns": ">=3.0.0"
49
+ "clsx": "^2.1.0",
50
+ "tailwind-merge": "^2.2.0",
51
+ "@tanstack/react-table": "^8.21.0",
52
+ "@radix-ui/react-slider": "^1.3.0",
53
+ "next": ">=15.0.0",
54
+ "next-themes": "^0.4.0",
55
+ "react-hook-form": "^7.54.0",
56
+ "date-fns": "^4.1.0"
47
57
  },
48
58
  "peerDependenciesMeta": {
49
59
  "@tanstack/react-table": {
@@ -52,6 +62,9 @@
52
62
  "@radix-ui/react-slider": {
53
63
  "optional": true
54
64
  },
65
+ "next": {
66
+ "optional": true
67
+ },
55
68
  "next-themes": {
56
69
  "optional": true
57
70
  },
@@ -66,18 +79,18 @@
66
79
  "@types/node": "^22.0.0",
67
80
  "@types/react": "^19.0.0",
68
81
  "@types/react-dom": "^19.0.0",
69
- "react": "^19.0.0",
70
- "react-dom": "^19.0.0",
82
+ "react": ">=19.0.0",
83
+ "react-dom": ">=19.0.0",
71
84
  "tsup": "^8.5.0",
72
85
  "typescript": "^5.7.0",
73
86
  "rimraf": "^5.0.0",
74
87
  "lucide-react": "^0.460.0",
75
- "class-variance-authority": "^0.7.0",
88
+ "class-variance-authority": ">=0.7.0",
76
89
  "clsx": "^2.1.0",
77
90
  "tailwind-merge": "^2.2.0",
78
91
  "@tanstack/react-table": "^8.21.0",
79
92
  "@radix-ui/react-slider": "^1.3.0",
80
- "next": "^15.0.0",
93
+ "next": ">=15.0.0",
81
94
  "next-themes": "^0.4.0",
82
95
  "react-hook-form": "^7.54.0",
83
96
  "date-fns": "^4.1.0"
@@ -104,7 +117,7 @@
104
117
  "classytic"
105
118
  ],
106
119
  "author": "Classytic",
107
- "license": "UNLICENSED",
120
+ "license": "MIT",
108
121
  "sideEffects": [
109
122
  "*.css"
110
123
  ]
package/styles.css CHANGED
@@ -10,3 +10,6 @@
10
10
 
11
11
  /* Scan fluid dist folder for Tailwind classes */
12
12
  @source "./dist";
13
+
14
+ /* Animation tokens, keyframes & reduced-motion */
15
+ @import "./animations.css";