@classytic/fluid 0.2.4 → 0.3.3

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -62
  3. package/dist/api-pagination-CJ0vR_w6.d.mts +34 -0
  4. package/dist/api-pagination-DBTE0yk4.mjs +190 -0
  5. package/dist/chunk-DQk6qfdC.mjs +18 -0
  6. package/dist/client/calendar.d.mts +105 -0
  7. package/dist/client/calendar.mjs +202 -0
  8. package/dist/client/core.d.mts +1614 -0
  9. package/dist/client/core.mjs +2779 -0
  10. package/dist/client/error.d.mts +125 -0
  11. package/dist/client/error.mjs +166 -0
  12. package/dist/client/hooks.d.mts +162 -0
  13. package/dist/client/hooks.mjs +447 -0
  14. package/dist/client/table.d.mts +84 -0
  15. package/dist/client/table.mjs +373 -0
  16. package/dist/client/theme.d.mts +6 -0
  17. package/dist/client/theme.mjs +65 -0
  18. package/dist/command.d.mts +134 -0
  19. package/dist/command.mjs +132 -0
  20. package/dist/compact.d.mts +359 -0
  21. package/dist/compact.mjs +892 -0
  22. package/dist/dashboard.d.mts +778 -0
  23. package/dist/dashboard.mjs +1617 -0
  24. package/dist/filter-utils-DqMmy_v-.mjs +72 -0
  25. package/dist/filter-utils-IZ0GtuPo.d.mts +40 -0
  26. package/dist/forms.d.mts +1549 -0
  27. package/dist/forms.mjs +3740 -0
  28. package/dist/index.d.mts +296 -0
  29. package/dist/index.mjs +432 -0
  30. package/dist/layouts.d.mts +215 -0
  31. package/dist/layouts.mjs +460 -0
  32. package/dist/search-context-DR7DBs7S.mjs +19 -0
  33. package/dist/search.d.mts +254 -0
  34. package/dist/search.mjs +523 -0
  35. package/dist/sheet-wrapper-C13Y-Q6w.mjs +211 -0
  36. package/dist/use-base-search-BGgWnWaF.d.mts +35 -0
  37. package/dist/use-debounce-xmZucz5e.mjs +53 -0
  38. package/dist/use-keyboard-shortcut-Bl6YM5Q7.mjs +82 -0
  39. package/dist/use-keyboard-shortcut-_mRCh3QO.d.mts +24 -0
  40. package/dist/use-media-query-BnVNIKT4.mjs +17 -0
  41. package/dist/use-mobile-BX3SQVo2.mjs +20 -0
  42. package/dist/use-scroll-detection-CsgsQYvy.mjs +43 -0
  43. package/dist/utils-CDue7cEt.d.mts +6 -0
  44. package/dist/utils-DQ5SCVoW.mjs +10 -0
  45. package/package.json +85 -45
  46. package/styles.css +2 -2
  47. package/dist/chunk-GUHK2DTW.js +0 -15
  48. package/dist/chunk-GUHK2DTW.js.map +0 -1
  49. package/dist/chunk-H3NFL3GJ.js +0 -57
  50. package/dist/chunk-H3NFL3GJ.js.map +0 -1
  51. package/dist/chunk-J2YRTQE4.js +0 -293
  52. package/dist/chunk-J2YRTQE4.js.map +0 -1
  53. package/dist/compact.d.ts +0 -217
  54. package/dist/compact.js +0 -986
  55. package/dist/compact.js.map +0 -1
  56. package/dist/dashboard.d.ts +0 -387
  57. package/dist/dashboard.js +0 -1032
  58. package/dist/dashboard.js.map +0 -1
  59. package/dist/index.d.ts +0 -2140
  60. package/dist/index.js +0 -6422
  61. package/dist/index.js.map +0 -1
  62. package/dist/layout.d.ts +0 -25
  63. package/dist/layout.js +0 -4
  64. package/dist/layout.js.map +0 -1
  65. package/dist/search.d.ts +0 -172
  66. package/dist/search.js +0 -341
  67. package/dist/search.js.map +0 -1
  68. package/dist/use-base-search-AS5Z3SAy.d.ts +0 -64
  69. package/dist/utils-Cbsgs0XP.d.ts +0 -5
@@ -0,0 +1,72 @@
1
+ //#region src/lib/filter-utils.ts
2
+ /**
3
+ * Build URL parameters from filters object
4
+ */
5
+ function buildFilterParams(filters, filterConfig) {
6
+ const params = new URLSearchParams();
7
+ Object.entries(filters).forEach(([key, value]) => {
8
+ const config = filterConfig[key];
9
+ if (!config || value === void 0 || value === null || value === "") return;
10
+ if (Array.isArray(value) && value.length === 0) return;
11
+ if (value === config.defaultValue) return;
12
+ if (Array.isArray(value) && Array.isArray(config.defaultValue) && value.length === config.defaultValue.length && value.every((v, i) => v === config.defaultValue[i])) return;
13
+ if (config.type === "array" && Array.isArray(value)) {
14
+ if (value.length > 1) params.set(`${config.paramName}[in]`, value.join(","));
15
+ else if (value.length === 1) params.set(config.paramName, value[0]);
16
+ } else params.set(config.paramName, String(value));
17
+ });
18
+ return params;
19
+ }
20
+ /**
21
+ * Build search parameters from search state
22
+ */
23
+ function buildSearchParams(searchType, searchValue, searchFields) {
24
+ const params = new URLSearchParams();
25
+ if (searchValue.trim() && searchFields[searchType]) {
26
+ const paramName = searchFields[searchType];
27
+ params.set(paramName, searchValue.trim());
28
+ }
29
+ return params;
30
+ }
31
+ /**
32
+ * Build listing status parameters (inventory-specific)
33
+ */
34
+ function buildListingStatusParams(listingStatus) {
35
+ const params = new URLSearchParams();
36
+ Object.entries(listingStatus).forEach(([platform, hasListings]) => {
37
+ if (hasListings !== void 0) {
38
+ const operator = hasListings ? "gt" : "eq";
39
+ params.set(`total_list.${platform}[${operator}]`, "0");
40
+ }
41
+ });
42
+ return params;
43
+ }
44
+ /**
45
+ * Clear specific parameter types from URLSearchParams
46
+ */
47
+ function clearSearchAndFilterParams(params, config) {
48
+ const { searchFields = {}, filterFields = {} } = config;
49
+ Object.values(searchFields).forEach((paramName) => {
50
+ params.delete(paramName);
51
+ });
52
+ Object.values(filterFields).forEach((fieldConfig) => {
53
+ params.delete(fieldConfig.paramName);
54
+ const baseField = fieldConfig.paramName.replace(/\[.*\]$/, "");
55
+ params.delete(`${baseField}[in]`);
56
+ });
57
+ const keysToDelete = [];
58
+ for (const [key] of params.entries()) if (key.startsWith("total_list.")) keysToDelete.push(key);
59
+ keysToDelete.forEach((key) => params.delete(key));
60
+ params.delete("page");
61
+ }
62
+ /**
63
+ * Get API-ready parameters from URL
64
+ */
65
+ function getApiParams(searchParams) {
66
+ const params = {};
67
+ for (const [key, value] of searchParams.entries()) params[key] = value;
68
+ return params;
69
+ }
70
+
71
+ //#endregion
72
+ export { getApiParams as a, clearSearchAndFilterParams as i, buildListingStatusParams as n, buildSearchParams as r, buildFilterParams as t };
@@ -0,0 +1,40 @@
1
+ //#region src/lib/filter-utils.d.ts
2
+ /**
3
+ * Filter utilities for building URL parameters
4
+ * Simplified approach since backend handles all operator parsing
5
+ */
6
+ interface FilterConfig {
7
+ paramName: string;
8
+ type?: "array" | "string" | "number" | "boolean";
9
+ defaultValue?: unknown;
10
+ /** Display label for ActiveFilters pills (falls back to key if omitted) */
11
+ label?: string;
12
+ }
13
+ interface SearchConfig {
14
+ basePath: string;
15
+ searchFields?: Record<string, string>;
16
+ filterFields?: Record<string, FilterConfig>;
17
+ defaultSearchType?: string;
18
+ }
19
+ /**
20
+ * Build URL parameters from filters object
21
+ */
22
+ declare function buildFilterParams(filters: Record<string, unknown>, filterConfig: Record<string, FilterConfig>): URLSearchParams;
23
+ /**
24
+ * Build search parameters from search state
25
+ */
26
+ declare function buildSearchParams(searchType: string, searchValue: string, searchFields: Record<string, string>): URLSearchParams;
27
+ /**
28
+ * Build listing status parameters (inventory-specific)
29
+ */
30
+ declare function buildListingStatusParams(listingStatus: Record<string, boolean | undefined>): URLSearchParams;
31
+ /**
32
+ * Clear specific parameter types from URLSearchParams
33
+ */
34
+ declare function clearSearchAndFilterParams(params: URLSearchParams, config: SearchConfig): void;
35
+ /**
36
+ * Get API-ready parameters from URL
37
+ */
38
+ declare function getApiParams(searchParams: URLSearchParams): Record<string, string>;
39
+ //#endregion
40
+ export { buildSearchParams as a, buildListingStatusParams as i, SearchConfig as n, clearSearchAndFilterParams as o, buildFilterParams as r, getApiParams as s, FilterConfig as t };