blimpui 0.0.16 → 0.0.18

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,27 @@
1
+ import * as React from "react";
2
+ import { View } from "react-native";
3
+ import { type ButtonProps } from "../../../$/components/ui/button";
4
+ declare const Pagination: React.ForwardRefExoticComponent<import("react-native").ViewProps & React.RefAttributes<View>>;
5
+ declare const PaginationContent: React.ForwardRefExoticComponent<import("react-native").ViewProps & React.RefAttributes<View>>;
6
+ declare const PaginationItem: React.ForwardRefExoticComponent<import("react-native").ViewProps & React.RefAttributes<View>>;
7
+ type PaginationLinkProps = {
8
+ isActive?: boolean;
9
+ } & ButtonProps;
10
+ declare const PaginationLink: {
11
+ ({ className, isActive, size, ...props }: PaginationLinkProps): import("react/jsx-runtime").JSX.Element;
12
+ displayName: string;
13
+ };
14
+ declare const PaginationPrevious: {
15
+ ({ className, ...props }: React.ComponentProps<typeof PaginationLink>): import("react/jsx-runtime").JSX.Element;
16
+ displayName: string;
17
+ };
18
+ declare const PaginationNext: {
19
+ ({ className, ...props }: React.ComponentProps<typeof PaginationLink>): import("react/jsx-runtime").JSX.Element;
20
+ displayName: string;
21
+ };
22
+ declare const PaginationEllipsis: {
23
+ ({ className, ...props }: React.ComponentPropsWithoutRef<typeof View>): import("react/jsx-runtime").JSX.Element;
24
+ displayName: string;
25
+ };
26
+ export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
27
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../$/components/primitives/pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAQ,MAAM,cAAc,CAAC;AAG1C,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,UAAU,+FAcd,CAAC;AAGH,QAAA,MAAM,iBAAiB,+FASrB,CAAC;AAGH,QAAA,MAAM,cAAc,+FAKlB,CAAC;AAGH,KAAK,mBAAmB,GAAG;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAAC;AAEhB,QAAA,MAAM,cAAc;8CAKjB,mBAAmB;;CAQrB,CAAC;AAGF,QAAA,MAAM,kBAAkB;8BAGrB,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC;;CAS7C,CAAC;AAGF,QAAA,MAAM,cAAc;8BAGjB,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC;;CAS7C,CAAC;AAGF,QAAA,MAAM,kBAAkB;8BAGrB,KAAK,CAAC,wBAAwB,CAAC,OAAO,IAAI,CAAC;;CAS7C,CAAC;AAGF,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,GAClB,CAAC"}
@@ -0,0 +1,64 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from "react";
25
+ import { View, Text } from "react-native";
26
+ import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react-native";
27
+ import { cn } from "../../../$/lib/utils";
28
+ import { Button, } from "../../../$/components/ui/button";
29
+ var Pagination = React.forwardRef(function (_a, ref) {
30
+ var className = _a.className, props = __rest(_a, ["className"]);
31
+ return (_jsx(View, __assign({ ref: ref, role: "navigation", "aria-label": "pagination", className: cn("mx-auto flex-row items-center justify-center gap-1", className) }, props)));
32
+ });
33
+ Pagination.displayName = "Pagination";
34
+ var PaginationContent = React.forwardRef(function (_a, ref) {
35
+ var className = _a.className, props = __rest(_a, ["className"]);
36
+ return (_jsx(View, __assign({ ref: ref, className: cn("flex-row items-center gap-1", className) }, props)));
37
+ });
38
+ PaginationContent.displayName = "PaginationContent";
39
+ var PaginationItem = React.forwardRef(function (_a, ref) {
40
+ var className = _a.className, props = __rest(_a, ["className"]);
41
+ return (_jsx(View, __assign({ ref: ref, className: cn("", className) }, props)));
42
+ });
43
+ PaginationItem.displayName = "PaginationItem";
44
+ var PaginationLink = function (_a) {
45
+ var className = _a.className, isActive = _a.isActive, _b = _a.size, size = _b === void 0 ? "icon" : _b, props = __rest(_a, ["className", "isActive", "size"]);
46
+ return (_jsx(Button, __assign({ "aria-current": isActive ? "page" : undefined, variant: isActive ? "default" : "ghost", size: size, className: cn("rounded-full", className) }, props)));
47
+ };
48
+ PaginationLink.displayName = "PaginationLink";
49
+ var PaginationPrevious = function (_a) {
50
+ var className = _a.className, props = __rest(_a, ["className"]);
51
+ return (_jsx(PaginationLink, __assign({ "aria-label": "Go to previous page", size: "default", className: cn("gap-1 px-2.5 rounded-full", className) }, props, { children: _jsx(ChevronLeft, { className: "h-4 w-4 text-foreground", size: 16 }) })));
52
+ };
53
+ PaginationPrevious.displayName = "PaginationPrevious";
54
+ var PaginationNext = function (_a) {
55
+ var className = _a.className, props = __rest(_a, ["className"]);
56
+ return (_jsx(PaginationLink, __assign({ "aria-label": "Go to next page", size: "default", className: cn("gap-1 px-2.5 rounded-full", className) }, props, { children: _jsx(ChevronRight, { className: "h-4 w-4 text-foreground", size: 16 }) })));
57
+ };
58
+ PaginationNext.displayName = "PaginationNext";
59
+ var PaginationEllipsis = function (_a) {
60
+ var className = _a.className, props = __rest(_a, ["className"]);
61
+ return (_jsxs(View, __assign({ "aria-hidden": true, className: cn("flex h-9 w-9 items-center justify-center", className) }, props, { children: [_jsx(MoreHorizontal, { className: "h-4 w-4 text-foreground", size: 16 }), _jsx(Text, { className: "sr-only", children: "More pages" })] })));
62
+ };
63
+ PaginationEllipsis.displayName = "PaginationEllipsis";
64
+ export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
@@ -0,0 +1,10 @@
1
+ export interface PaginationProps {
2
+ totalPages: number;
3
+ currentPage: number;
4
+ onPageChange: (page: number) => void;
5
+ siblingCount?: number;
6
+ className?: string;
7
+ showPreviousNext?: boolean;
8
+ }
9
+ export declare const Pagination: ({ totalPages, currentPage, onPageChange, siblingCount, className, showPreviousNext, }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../$/components/ui/pagination.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AA+ED,eAAO,MAAM,UAAU,GAAI,uFAOxB,eAAe,4CAqEjB,CAAC"}
@@ -0,0 +1,97 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import * as React from "react";
12
+ import * as PaginationPrimitive from "../primitives/pagination";
13
+ import { cn } from "../../lib/utils";
14
+ var DOTS = "...";
15
+ var range = function (start, end) {
16
+ var length = end - start + 1;
17
+ return Array.from({ length: length }, function (_, idx) { return idx + start; });
18
+ };
19
+ var usePaginationRange = function (_a) {
20
+ var totalPages = _a.totalPages, currentPage = _a.currentPage, _b = _a.siblingCount, siblingCount = _b === void 0 ? 1 : _b;
21
+ var paginationRange = React.useMemo(function () {
22
+ // Pages count is determined as siblingCount + firstPage + lastPage + currentPage + 2*DOTS
23
+ var totalPageNumbers = siblingCount + 5;
24
+ /*
25
+ Case 1:
26
+ If the number of pages is less than the page numbers we want to show in our
27
+ paginationComponent, we return the range [1..totalPages]
28
+ */
29
+ if (totalPageNumbers >= totalPages) {
30
+ return range(1, totalPages);
31
+ }
32
+ /*
33
+ Calculate left and right sibling index and make sure they are within range 1 and totalPages
34
+ */
35
+ var leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
36
+ var rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages);
37
+ /*
38
+ We do not show dots just when there is just one page number to be inserted between the extremes of sibling and the page limits i.e 1 and totalPages. Hence we are using leftSiblingIndex > 2 and rightSiblingIndex < totalPages - 2
39
+ */
40
+ var shouldShowLeftDots = leftSiblingIndex > 2;
41
+ var shouldShowRightDots = rightSiblingIndex < totalPages - 2;
42
+ var firstPageIndex = 1;
43
+ var lastPageIndex = totalPages;
44
+ /*
45
+ Case 2: No left dots to show, but rights dots to be shown
46
+ */
47
+ if (!shouldShowLeftDots && shouldShowRightDots) {
48
+ var leftItemCount = 3 + 2 * siblingCount;
49
+ var leftRange = range(1, leftItemCount);
50
+ return __spreadArray(__spreadArray([], leftRange, true), [DOTS, totalPages], false);
51
+ }
52
+ /*
53
+ Case 3: No right dots to show, but left dots to be shown
54
+ */
55
+ if (shouldShowLeftDots && !shouldShowRightDots) {
56
+ var rightItemCount = 3 + 2 * siblingCount;
57
+ var rightRange = range(totalPages - rightItemCount + 1, totalPages);
58
+ return __spreadArray([firstPageIndex, DOTS], rightRange, true);
59
+ }
60
+ /*
61
+ Case 4: Both left and right dots to be shown
62
+ */
63
+ if (shouldShowLeftDots && shouldShowRightDots) {
64
+ var middleRange = range(leftSiblingIndex, rightSiblingIndex);
65
+ return __spreadArray(__spreadArray([firstPageIndex, DOTS], middleRange, true), [DOTS, lastPageIndex], false);
66
+ }
67
+ return [];
68
+ }, [totalPages, siblingCount, currentPage]);
69
+ return paginationRange;
70
+ };
71
+ export var Pagination = function (_a) {
72
+ var totalPages = _a.totalPages, currentPage = _a.currentPage, onPageChange = _a.onPageChange, _b = _a.siblingCount, siblingCount = _b === void 0 ? 1 : _b, className = _a.className, _c = _a.showPreviousNext, showPreviousNext = _c === void 0 ? true : _c;
73
+ var paginationRange = usePaginationRange({
74
+ currentPage: currentPage,
75
+ totalPages: totalPages,
76
+ siblingCount: siblingCount,
77
+ });
78
+ if (currentPage === 0 || paginationRange.length < 2) {
79
+ return null;
80
+ }
81
+ var onNext = function () {
82
+ if (currentPage < totalPages) {
83
+ onPageChange(currentPage + 1);
84
+ }
85
+ };
86
+ var onPrevious = function () {
87
+ if (currentPage > 1) {
88
+ onPageChange(currentPage - 1);
89
+ }
90
+ };
91
+ return (_jsx(PaginationPrimitive.Pagination, { className: cn(className), children: _jsxs(PaginationPrimitive.PaginationContent, { children: [showPreviousNext && (_jsx(PaginationPrimitive.PaginationItem, { children: _jsx(PaginationPrimitive.PaginationPrevious, { onPress: onPrevious, disabled: currentPage === 1, className: cn(currentPage === 1 && "opacity-50") }) })), paginationRange.map(function (pageNumber, idx) {
92
+ if (pageNumber === DOTS) {
93
+ return (_jsx(PaginationPrimitive.PaginationItem, { children: _jsx(PaginationPrimitive.PaginationEllipsis, {}) }, "dots-".concat(idx)));
94
+ }
95
+ return (_jsx(PaginationPrimitive.PaginationItem, { children: _jsx(PaginationPrimitive.PaginationLink, { onPress: function () { return onPageChange(pageNumber); }, isActive: pageNumber === currentPage, children: pageNumber }) }, pageNumber));
96
+ }), showPreviousNext && (_jsx(PaginationPrimitive.PaginationItem, { children: _jsx(PaginationPrimitive.PaginationNext, { onPress: onNext, disabled: currentPage === totalPages, className: cn(currentPage === totalPages && "opacity-50") }) }))] }) }));
97
+ };
@@ -0,0 +1,5 @@
1
+ import { TableProps } from "./types";
2
+ export declare function DesktopTable<T>({ data, columns, handlePress, keyExtractor, className, headerRowClassName, rowClassName, bodyClassName, totalPages, currentPage, onPageChange, paginationProps, }: Pick<TableProps<T>, "data" | "columns" | "keyExtractor" | "className" | "headerRowClassName" | "rowClassName" | "bodyClassName" | "totalPages" | "currentPage" | "onPageChange" | "paginationProps"> & {
3
+ handlePress?: (row: T) => void;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=DesktopTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesktopTable.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/DesktopTable.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC/B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,EACZ,eAAe,GACf,EAAE,IAAI,CACN,UAAU,CAAC,CAAC,CAAC,EACX,MAAM,GACN,SAAS,GACT,cAAc,GACd,WAAW,GACX,oBAAoB,GACpB,cAAc,GACd,eAAe,GACf,YAAY,GACZ,aAAa,GACb,cAAc,GACd,iBAAiB,CACnB,GAAG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B,2CA8EA"}
@@ -0,0 +1,33 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Text, View } from "react-native";
14
+ import { cn } from "../../../lib/utils";
15
+ import * as TablePrimitive from "../../primitives/table";
16
+ import { Pagination } from "../pagination";
17
+ import { TableCellRenderer } from "./TableCellRenderer";
18
+ export function DesktopTable(_a) {
19
+ var data = _a.data, columns = _a.columns, handlePress = _a.handlePress, keyExtractor = _a.keyExtractor, className = _a.className, headerRowClassName = _a.headerRowClassName, rowClassName = _a.rowClassName, bodyClassName = _a.bodyClassName, totalPages = _a.totalPages, currentPage = _a.currentPage, onPageChange = _a.onPageChange, paginationProps = _a.paginationProps;
20
+ return (_jsxs(View, { className: cn("w-full overflow-hidden not-sm:rounded-md", className), children: [_jsxs(TablePrimitive.Root, { children: [_jsx(TablePrimitive.Header, { children: _jsx(TablePrimitive.Row, { className: cn("flex-row border-b-0 bg-muted/50 hover:bg-muted/50", headerRowClassName), children: columns.map(function (col, index) {
21
+ var _a;
22
+ return (_jsx(TablePrimitive.Head, { className: cn("flex-1 py-4 justify-center px-4", col.className, col.headerClassName), children: typeof col.header === "string" ? (_jsx(Text, { className: "text-muted-foreground text-sm font-medium", children: col.header })) : (col.header) }, col.id || ((_a = col.accessorKey) === null || _a === void 0 ? void 0 : _a.toString()) || index));
23
+ }) }) }), _jsx(TablePrimitive.Body, { className: bodyClassName, children: data.map(function (row, rowIndex) { return (_jsx(TablePrimitive.Row, { className: cn("flex-row border-b border-border text-foreground transition-colors hover:bg-muted/50", handlePress && "cursor-pointer", typeof rowClassName === "function"
24
+ ? rowClassName(row, rowIndex)
25
+ : rowClassName), onPress: handlePress ? function () { return handlePress(row); } : undefined, children: columns.map(function (col, colIndex) {
26
+ var _a;
27
+ return (_jsx(TablePrimitive.Cell, { className: cn("flex-1 justify-center p-4", col.className, col.cellClassName), children: _jsx(TableCellRenderer, { row: row, column: col }) }, col.id || ((_a = col.accessorKey) === null || _a === void 0 ? void 0 : _a.toString()) || colIndex));
28
+ }) }, keyExtractor
29
+ ? keyExtractor(row, rowIndex)
30
+ : rowIndex)); }) })] }), totalPages !== undefined &&
31
+ currentPage !== undefined &&
32
+ onPageChange !== undefined && (_jsx(View, { className: "border-t border-border p-4", children: _jsx(Pagination, __assign({ totalPages: totalPages, currentPage: currentPage, onPageChange: onPageChange }, paginationProps)) }))] }));
33
+ }
@@ -0,0 +1,5 @@
1
+ import { TableProps } from "./types";
2
+ export declare function MobileTable<T>({ data, columns, handlePress, keyExtractor, bodyClassName, rowClassName, mobileCardClassName, mobileHeaderClassName, mobileBodyClassName, onEndReached, onEndReachedThreshold, }: Pick<TableProps<T>, "data" | "columns" | "keyExtractor" | "bodyClassName" | "rowClassName" | "mobileCardClassName" | "mobileHeaderClassName" | "mobileBodyClassName" | "onEndReached" | "onEndReachedThreshold"> & {
3
+ handlePress?: (row: T) => void;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=MobileTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileTable.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/MobileTable.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAC9B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,GACrB,EAAE,IAAI,CACN,UAAU,CAAC,CAAC,CAAC,EACX,MAAM,GACN,SAAS,GACT,cAAc,GACd,eAAe,GACf,cAAc,GACd,qBAAqB,GACrB,uBAAuB,GACvB,qBAAqB,GACrB,cAAc,GACd,uBAAuB,CACzB,GAAG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B,2CA6EA"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LegendList } from "@legendapp/list";
3
+ import { Pressable, Text, View } from "react-native";
4
+ import { cn } from "../../../lib/utils";
5
+ import { TableCellRenderer } from "./TableCellRenderer";
6
+ export function MobileTable(_a) {
7
+ var data = _a.data, columns = _a.columns, handlePress = _a.handlePress, keyExtractor = _a.keyExtractor, bodyClassName = _a.bodyClassName, rowClassName = _a.rowClassName, mobileCardClassName = _a.mobileCardClassName, mobileHeaderClassName = _a.mobileHeaderClassName, mobileBodyClassName = _a.mobileBodyClassName, onEndReached = _a.onEndReached, onEndReachedThreshold = _a.onEndReachedThreshold;
8
+ return (_jsx(LegendList, { data: data, estimatedItemSize: 200, keyExtractor: keyExtractor, className: bodyClassName, onEndReached: onEndReached, onEndReachedThreshold: onEndReachedThreshold, renderItem: function (_a) {
9
+ var item = _a.item, index = _a.index;
10
+ var headerColumns = columns.filter(function (col) { var _a; return (_a = col.meta) === null || _a === void 0 ? void 0 : _a.isMobileHeader; });
11
+ var bodyColumns = columns.filter(function (col) { var _a; return !((_a = col.meta) === null || _a === void 0 ? void 0 : _a.isMobileHeader); });
12
+ var cardContent = (_jsxs(View, { className: cn("mb-4 rounded-xl border border-border bg-card p-4", mobileCardClassName, item && typeof rowClassName === "function"
13
+ ? rowClassName(item, index)
14
+ : rowClassName), children: [headerColumns.length > 0 && (_jsx(View, { className: cn("mb-4 flex-row items-center justify-between border-b border-border pb-4", mobileHeaderClassName), children: headerColumns.map(function (col, idx) {
15
+ var _a, _b;
16
+ return (_jsx(View, { className: cn((_a = col.meta) === null || _a === void 0 ? void 0 : _a.mobileClassName, col.className), children: _jsx(TableCellRenderer, { row: item, column: col }) }, col.id || ((_b = col.accessorKey) === null || _b === void 0 ? void 0 : _b.toString()) || idx));
17
+ }) })), _jsx(View, { className: cn("gap-4", mobileBodyClassName), children: bodyColumns.map(function (col, idx) {
18
+ var _a, _b;
19
+ return (_jsxs(View, { className: "flex-row items-center justify-between", children: [_jsx(Text, { className: "text-muted-foreground text-sm font-medium", children: ((_a = col.meta) === null || _a === void 0 ? void 0 : _a.mobileLabel) || col.header }), _jsx(View, { className: cn("flex-1 items-end pl-4", col.className, col.cellClassName), children: _jsx(TableCellRenderer, { row: item, column: col }) })] }, col.id || ((_b = col.accessorKey) === null || _b === void 0 ? void 0 : _b.toString()) || idx));
20
+ }) })] }));
21
+ if (handlePress) {
22
+ return (_jsx(Pressable, { onPress: function () { return handlePress(item); }, children: cardContent }));
23
+ }
24
+ return cardContent;
25
+ } }));
26
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { TableColumn } from "./types";
3
+ export declare const getCellValue: <T>(row: T, column: TableColumn<T>) => T[keyof T];
4
+ export declare const TableCellRenderer: <T>({ row, column, }: {
5
+ row: T;
6
+ column: TableColumn<T>;
7
+ }) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>>;
8
+ //# sourceMappingURL=TableCellRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCellRenderer.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/TableCellRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,YAAY,GAAI,CAAC,EAAG,KAAK,CAAC,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,eAK9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAG,kBAGnC;IACF,GAAG,EAAE,CAAC,CAAC;IACP,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACvB,oRAUA,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Text } from "react-native";
3
+ export var getCellValue = function (row, column) {
4
+ if (column.accessorKey) {
5
+ return row[column.accessorKey];
6
+ }
7
+ return null;
8
+ };
9
+ export var TableCellRenderer = function (_a) {
10
+ var row = _a.row, column = _a.column;
11
+ var value = getCellValue(row, column);
12
+ if (column.cell) {
13
+ return column.cell({ row: row, value: value });
14
+ }
15
+ return (_jsx(Text, { className: "text-foreground text-sm font-medium", children: value }));
16
+ };
@@ -0,0 +1,4 @@
1
+ import { TableProps } from "./types";
2
+ export declare function Table<T>({ data, columns, mobileBreakpoint, onRowPress, onItemPress, totalPages, currentPage, onPageChange, paginationProps, onEndReached, onEndReachedThreshold, ...props }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ export * from "./types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,KAAK,CAAC,CAAC,EAAE,EACxB,IAAI,EACJ,OAAO,EACP,gBAAsB,EACtB,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,GAAG,KAAK,EACR,EAAE,UAAU,CAAC,CAAC,CAAC,2CA8Bf;AAED,cAAc,SAAS,CAAC"}
@@ -0,0 +1,37 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { useWindowDimensions } from "react-native";
25
+ import { DesktopTable } from "./DesktopTable";
26
+ import { MobileTable } from "./MobileTable";
27
+ export function Table(_a) {
28
+ var data = _a.data, columns = _a.columns, _b = _a.mobileBreakpoint, mobileBreakpoint = _b === void 0 ? 768 : _b, onRowPress = _a.onRowPress, onItemPress = _a.onItemPress, totalPages = _a.totalPages, currentPage = _a.currentPage, onPageChange = _a.onPageChange, paginationProps = _a.paginationProps, onEndReached = _a.onEndReached, onEndReachedThreshold = _a.onEndReachedThreshold, props = __rest(_a, ["data", "columns", "mobileBreakpoint", "onRowPress", "onItemPress", "totalPages", "currentPage", "onPageChange", "paginationProps", "onEndReached", "onEndReachedThreshold"]);
29
+ var width = useWindowDimensions().width;
30
+ var isMobile = width < mobileBreakpoint;
31
+ var handlePress = onItemPress || onRowPress;
32
+ if (isMobile) {
33
+ return (_jsx(MobileTable, __assign({ data: data, columns: columns, handlePress: handlePress, onEndReached: onEndReached, onEndReachedThreshold: onEndReachedThreshold }, props)));
34
+ }
35
+ return (_jsx(DesktopTable, __assign({ data: data, columns: columns, handlePress: handlePress, totalPages: totalPages, currentPage: currentPage, onPageChange: onPageChange, paginationProps: paginationProps }, props)));
36
+ }
37
+ export * from "./types";
@@ -0,0 +1,41 @@
1
+ import * as React from "react";
2
+ import { PaginationProps } from "../pagination";
3
+ export interface TableColumn<T> {
4
+ header: string | React.ReactNode;
5
+ accessorKey?: keyof T;
6
+ cell?: (info: {
7
+ row: T;
8
+ value: any;
9
+ }) => React.ReactNode;
10
+ id?: string;
11
+ meta?: {
12
+ isMobileHeader?: boolean;
13
+ mobileLabel?: string;
14
+ mobileClassName?: string;
15
+ };
16
+ className?: string;
17
+ headerClassName?: string;
18
+ cellClassName?: string;
19
+ }
20
+ export interface TableProps<T> {
21
+ data: T[];
22
+ columns: TableColumn<T>[];
23
+ mobileBreakpoint?: number;
24
+ className?: string;
25
+ onRowPress?: (row: T) => void;
26
+ onItemPress?: (row: T) => void;
27
+ keyExtractor?: (item: T, index: number) => string;
28
+ headerRowClassName?: string;
29
+ rowClassName?: string | ((row: T, index: number) => string);
30
+ bodyClassName?: string;
31
+ mobileCardClassName?: string;
32
+ mobileHeaderClassName?: string;
33
+ mobileBodyClassName?: string;
34
+ totalPages?: number;
35
+ currentPage?: number;
36
+ onPageChange?: (page: number) => void;
37
+ paginationProps?: Partial<PaginationProps>;
38
+ onEndReached?: () => void;
39
+ onEndReachedThreshold?: number;
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;IACtB,IAAI,CAAC,EA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CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAG3C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -28,6 +28,8 @@ export * from "./$/components/ui/label";
28
28
  export * from "./$/components/ui/list";
29
29
  export * from "./$/components/ui/toast";
30
30
  export * from "./$/components/ui/menubar";
31
+ export * from "./$/components/ui/table";
32
+ export * from "./$/components/primitives/pagination";
31
33
  export * from "./$/components/ui/popover";
32
34
  export * from "./$/components/ui/picker";
33
35
  export * from "./$/components/ui/progress";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAEhD,cAAc,8BAA8B,CAAC;AAE7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB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AAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAEhD,cAAc,8BAA8B,CAAC;AAE7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,yBAAyB,CAAC;AAExC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AAErD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAElD,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -28,6 +28,8 @@ export * from "./$/components/ui/label";
28
28
  export * from "./$/components/ui/list";
29
29
  export * from "./$/components/ui/toast";
30
30
  export * from "./$/components/ui/menubar";
31
+ export * from "./$/components/ui/table";
32
+ export * from "./$/components/primitives/pagination";
31
33
  export * from "./$/components/ui/popover";
32
34
  export * from "./$/components/ui/picker";
33
35
  export * from "./$/components/ui/progress";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blimpui",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",