next-data-kit 0.0.1

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +478 -0
  3. package/dist/client/components/data-kit-table.d.ts +29 -0
  4. package/dist/client/components/data-kit.d.ts +19 -0
  5. package/dist/client/components/index.d.ts +3 -0
  6. package/dist/client/components/ui/button.d.ts +14 -0
  7. package/dist/client/components/ui/checkbox.d.ts +5 -0
  8. package/dist/client/components/ui/dropdown-menu.d.ts +28 -0
  9. package/dist/client/components/ui/index.d.ts +9 -0
  10. package/dist/client/components/ui/pagination.d.ts +14 -0
  11. package/dist/client/components/ui/popover.d.ts +10 -0
  12. package/dist/client/components/ui/select.d.ts +18 -0
  13. package/dist/client/components/ui/switch.d.ts +5 -0
  14. package/dist/client/components/ui/table.d.ts +11 -0
  15. package/dist/client/context/index.d.ts +22 -0
  16. package/dist/client/hooks/index.d.ts +7 -0
  17. package/dist/client/hooks/useDataKit.d.ts +9 -0
  18. package/dist/client/hooks/usePagination.d.ts +18 -0
  19. package/dist/client/hooks/useSelection.d.ts +13 -0
  20. package/dist/client/index.d.ts +11 -0
  21. package/dist/client/utils/cn.d.ts +10 -0
  22. package/dist/client/utils/index.d.ts +60 -0
  23. package/dist/client.d.ts +7 -0
  24. package/dist/index.d.cts +652 -0
  25. package/dist/index.d.ts +652 -0
  26. package/dist/react-data-kit-DmTzxNTc.d.cts +225 -0
  27. package/dist/react-data-kit-DmTzxNTc.d.ts +225 -0
  28. package/dist/server.cjs +222 -0
  29. package/dist/server.cjs.map +1 -0
  30. package/dist/server.d.cts +68 -0
  31. package/dist/server.d.ts +68 -0
  32. package/dist/server.js +216 -0
  33. package/dist/server.js.map +1 -0
  34. package/dist/types/component.d.ts +106 -0
  35. package/dist/types/database/mongo.d.ts +129 -0
  36. package/dist/types/hook.d.ts +100 -0
  37. package/dist/types/index.cjs +15 -0
  38. package/dist/types/index.cjs.map +1 -0
  39. package/dist/types/index.d.cts +252 -0
  40. package/dist/types/index.d.ts +12 -0
  41. package/dist/types/index.js +13 -0
  42. package/dist/types/index.js.map +1 -0
  43. package/dist/types/react-data-kit.d.ts +95 -0
  44. package/dist/types/selectable.d.ts +43 -0
  45. package/package.json +127 -0
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ declare function Table({ className, ...props }: React.ComponentProps<'table'>): import("react/jsx-runtime").JSX.Element;
3
+ declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): import("react/jsx-runtime").JSX.Element;
4
+ declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): import("react/jsx-runtime").JSX.Element;
5
+ declare function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>): import("react/jsx-runtime").JSX.Element;
6
+ declare function TableRow({ className, ...props }: React.ComponentProps<'tr'>): import("react/jsx-runtime").JSX.Element;
7
+ declare function TableHead({ className, ...props }: React.ComponentProps<'th'>): import("react/jsx-runtime").JSX.Element;
8
+ declare function TableCell({ className, ...props }: React.ComponentProps<'td'>): import("react/jsx-runtime").JSX.Element;
9
+ declare function TableCaption({ className, ...props }: React.ComponentProps<'caption'>): import("react/jsx-runtime").JSX.Element;
10
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
11
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * react-data-kit - DataKitContext
3
+ *
4
+ * React context for sharing react-data-kit state across components.
5
+ */
6
+ import { type ReactNode } from 'react';
7
+ import type { TUseDataKitReturn } from '../../types';
8
+ export type TDataKitContextValue<T = unknown, R = unknown> = TUseDataKitReturn<T, R>;
9
+ export declare const createDataKitContext: <T = unknown, R = unknown>() => {
10
+ DataKitProvider: (props: Readonly<{
11
+ value: TDataKitContextValue<T, R>;
12
+ children: ReactNode;
13
+ }>) => import("react/jsx-runtime").JSX.Element;
14
+ useDataKitContext: () => TDataKitContextValue<T, R>;
15
+ Context: import("react").Context<TDataKitContextValue<T, R> | null>;
16
+ };
17
+ declare const DefaultDataKitProvider: (props: Readonly<{
18
+ value: TDataKitContextValue<unknown, unknown>;
19
+ children: ReactNode;
20
+ }>) => import("react/jsx-runtime").JSX.Element, useDefaultDataKitContext: () => TDataKitContextValue<unknown, unknown>, DefaultDataKitContext: import("react").Context<TDataKitContextValue<unknown, unknown> | null>;
21
+ export { DefaultDataKitProvider as DataKitProvider, useDefaultDataKitContext as useDataKitContext, DefaultDataKitContext as DataKitContext, };
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * react-data-kit - Hooks Exports
3
+ */
4
+ export { useDataKit, type TDataKitControllerOptions } from './useDataKit';
5
+ export { useSelection, useSelectionWithTotal } from './useSelection';
6
+ export { usePagination, type TUsePaginationReturn } from './usePagination';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * react-data-kit - useDataKit Hook
3
+ *
4
+ * React hook for managing react-data-kit state and actions.
5
+ */
6
+ import type { TDataKitControllerOptions, TUseDataKitReturn } from '../../types';
7
+ export declare const useDataKit: <T = unknown, R = unknown>(props: Readonly<TDataKitControllerOptions<T, R>>) => TUseDataKitReturn<T, R>;
8
+ export type { TDataKitControllerOptions };
9
+ //# sourceMappingURL=useDataKit.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * react-data-kit - usePagination Hook
3
+ *
4
+ * React hook for calculating pagination state.
5
+ */
6
+ import type { TPaginationInfo } from '../../types';
7
+ export type TUsePaginationReturn = TPaginationInfo & {
8
+ pages: (number | 'ellipsis')[];
9
+ firstPage: number;
10
+ lastPage: number;
11
+ };
12
+ export declare const usePagination: (props: Readonly<{
13
+ page: number;
14
+ limit: number;
15
+ total: number;
16
+ siblingCount?: number;
17
+ }>) => TUsePaginationReturn;
18
+ //# sourceMappingURL=usePagination.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * react-data-kit - useSelection Hook
3
+ *
4
+ * React hook for managing table row selection.
5
+ */
6
+ import type { TUseSelectionReturn } from '../../types';
7
+ export declare const useSelection: <T = string>(initialSelected?: T[]) => TUseSelectionReturn<T>;
8
+ export declare const useSelectionWithTotal: <T = string>(totalItems: T[], initialSelected?: T[]) => Omit<TUseSelectionReturn<T>, "toggleAll"> & {
9
+ isAllSelected: boolean;
10
+ isIndeterminate: boolean;
11
+ toggleAll: () => void;
12
+ };
13
+ //# sourceMappingURL=useSelection.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * react-data-kit - Client Exports
3
+ *
4
+ * Client-side utilities, hooks, and components for react-data-kit.
5
+ */
6
+ export { useDataKit, useSelection, useSelectionWithTotal, usePagination, type TDataKitControllerOptions, type TUsePaginationReturn, } from './hooks';
7
+ export { createDataKitContext, DataKitProvider, useDataKitContext, DataKitContext, type TDataKitContextValue, } from './context';
8
+ export { DataKitTable, DataKit } from './components';
9
+ export { getColumnValue, getSortValue, getNextSortValue, formatNumber, debounce, throttle, sortEntriesToKey, keyToSortEntries, } from './utils';
10
+ export type { TDataKitState, TDataKitActions, TUseDataKitReturn, TDataKitColumn, TSortEntry, TFilterConfig, TPaginationInfo, TSelectionState, TSelectionActions, TUseSelectionReturn, TSelectionMode, TSelectable, TExtractDataKitItemType, TDataKitComponentColumn, TDataKitFilterItem, TDataKitBulkAction, TDataKitComponentController, TDataKitSelectableItem, TDataKitStateMode, } from '../types';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ type ClassPrimitive = string | number | boolean | null | undefined;
2
+ type ClassDictionary = Record<string, boolean | undefined | null>;
3
+ type ClassArray = ClassValue[];
4
+ export type ClassValue = ClassPrimitive | ClassDictionary | ClassArray;
5
+ /**
6
+ * Minimal `cn` helper (shadcn-style) without external deps.
7
+ */
8
+ export declare const cn: (...inputs: ClassValue[]) => string;
9
+ export {};
10
+ //# sourceMappingURL=cn.d.ts.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * react-data-kit - Utility Functions
3
+ *
4
+ * Helper utilities for client-side operations.
5
+ */
6
+ import type { TDataKitColumn, TSortEntry } from '../../types';
7
+ export { cn, type ClassValue } from './cn';
8
+ /**
9
+ * Get the value from an item using a column accessor
10
+ */
11
+ export declare const getColumnValue: <T>(item: T, column: TDataKitColumn<T>) => unknown;
12
+ /**
13
+ * Get the sort value for a column
14
+ */
15
+ export declare const getSortValue: (sorts: TSortEntry[], path: string) => 1 | -1 | null;
16
+ /**
17
+ * Get the next sort value in the cycle: null -> 1 -> -1 -> null
18
+ */
19
+ export declare const getNextSortValue: (current: 1 | -1 | null) => 1 | -1 | null;
20
+ /**
21
+ * Format a number with commas
22
+ */
23
+ export declare const formatNumber: (num: number) => string;
24
+ /**
25
+ * Debounce a function
26
+ */
27
+ export declare const debounce: <T extends (...args: unknown[]) => unknown>(fn: T, delay: number) => ((...args: Parameters<T>) => void);
28
+ /**
29
+ * Throttle a function
30
+ */
31
+ export declare const throttle: <T extends (...args: unknown[]) => unknown>(fn: T, limit: number) => ((...args: Parameters<T>) => void);
32
+ /**
33
+ * Create a stable object key from sort entries
34
+ */
35
+ export declare const sortEntriesToKey: (sorts: TSortEntry[]) => string;
36
+ /**
37
+ * Parse a sort key back to sort entries
38
+ */
39
+ export declare const keyToSortEntries: (key: string) => TSortEntry[];
40
+ /**
41
+ * Parse URL search params into tabler state
42
+ */
43
+ export declare const parseUrlParams: (search: string) => {
44
+ page?: number;
45
+ limit?: number;
46
+ sorts?: TSortEntry[];
47
+ filter?: Record<string, unknown>;
48
+ query?: Record<string, unknown>;
49
+ };
50
+ /**
51
+ * Convert tabler state to URL search params
52
+ */
53
+ export declare const stateToUrlParams: (state: {
54
+ page?: number;
55
+ limit?: number;
56
+ sorts?: TSortEntry[];
57
+ filter?: Record<string, unknown>;
58
+ query?: Record<string, unknown>;
59
+ }) => URLSearchParams;
60
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * react-data-kit/client
3
+ *
4
+ * Client-side entry point for react-data-kit.
5
+ */
6
+ export * from './client/index';
7
+ //# sourceMappingURL=client.d.ts.map