@appcorp/stellar-solutions-modules 0.1.33 → 0.1.35
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.
- package/README.md +128 -19
- package/components/theme-switcher.d.ts +4 -0
- package/components/theme-switcher.js +60 -0
- package/components/ui/badge.d.ts +9 -0
- package/components/ui/badge.js +82 -0
- package/components/ui/button.d.ts +10 -0
- package/components/ui/button.js +91 -0
- package/components/ui/checkbox.d.ts +9 -0
- package/components/ui/checkbox.js +87 -0
- package/components/ui/drawer.d.ts +13 -0
- package/components/ui/drawer.js +115 -0
- package/components/ui/dropdown-menu.d.ts +25 -0
- package/components/ui/dropdown-menu.js +148 -0
- package/components/ui/enhanced-table-footer-action.d.ts +34 -0
- package/components/ui/enhanced-table-footer-action.js +117 -0
- package/components/ui/enhanced-table-footer-page.d.ts +32 -0
- package/components/ui/enhanced-table-footer-page.js +140 -0
- package/components/ui/enhanced-table-footer-pagination.d.ts +38 -0
- package/components/ui/enhanced-table-footer-pagination.js +122 -0
- package/components/ui/enhanced-table-header-action.d.ts +7 -0
- package/components/ui/enhanced-table-header-action.js +21 -0
- package/components/ui/enhanced-table-header-search.d.ts +12 -0
- package/components/ui/enhanced-table-header-search.js +17 -0
- package/components/ui/enhanced-table.d.ts +65 -0
- package/components/ui/enhanced-table.js +87 -0
- package/components/ui/input.d.ts +8 -0
- package/components/ui/input.js +86 -0
- package/components/ui/label.d.ts +7 -0
- package/components/ui/label.js +68 -0
- package/components/ui/popover.d.ts +7 -0
- package/components/ui/popover.js +82 -0
- package/components/ui/select.d.ts +15 -0
- package/components/ui/select.js +127 -0
- package/components/ui/sonner.d.ts +4 -0
- package/components/ui/sonner.js +54 -0
- package/components/ui/switch.d.ts +9 -0
- package/components/ui/switch.js +89 -0
- package/components/ui/table.d.ts +10 -0
- package/components/ui/table.js +101 -0
- package/global-modules/bank/actions.d.ts +200 -0
- package/global-modules/bank/actions.js +124 -0
- package/global-modules/bank/bank.d.ts +2 -0
- package/global-modules/bank/bank.js +87 -0
- package/global-modules/bank/constants.d.ts +45 -0
- package/global-modules/bank/constants.js +98 -0
- package/global-modules/bank/context.d.ts +41 -0
- package/global-modules/bank/context.js +419 -0
- package/global-modules/bank/drawer.d.ts +31 -0
- package/global-modules/bank/drawer.js +114 -0
- package/global-modules/bank/form.d.ts +22 -0
- package/global-modules/bank/form.js +68 -0
- package/global-modules/bank/reducer.d.ts +25 -0
- package/global-modules/bank/reducer.js +161 -0
- package/global-modules/bank/types.d.ts +217 -0
- package/global-modules/bank/types.js +81 -0
- package/global-modules/bank/validate.d.ts +13 -0
- package/global-modules/bank/validate.js +22 -0
- package/global-modules/branch/actions.d.ts +154 -37
- package/global-modules/branch/actions.js +148 -6
- package/global-modules/branch/branch.d.ts +2 -2
- package/global-modules/branch/branch.js +46 -32
- package/global-modules/branch/constants.d.ts +34 -24
- package/global-modules/branch/constants.js +101 -122
- package/global-modules/branch/context.d.ts +33 -2
- package/global-modules/branch/context.js +195 -164
- package/global-modules/branch/drawer.d.ts +26 -3
- package/global-modules/branch/drawer.js +101 -6
- package/global-modules/branch/form.d.ts +15 -1
- package/global-modules/branch/form.js +54 -71
- package/global-modules/branch/reducer.d.ts +23 -2
- package/global-modules/branch/reducer.js +148 -118
- package/global-modules/branch/types.d.ts +196 -69
- package/global-modules/branch/types.js +66 -7
- package/global-modules/branch/validate.d.ts +1 -1
- package/global-modules/branch/validate.js +15 -11
- package/global-modules/payment-mode/actions.d.ts +154 -37
- package/global-modules/payment-mode/actions.js +148 -6
- package/global-modules/payment-mode/constants.d.ts +34 -17
- package/global-modules/payment-mode/constants.js +90 -66
- package/global-modules/payment-mode/context.d.ts +33 -2
- package/global-modules/payment-mode/context.js +185 -163
- package/global-modules/payment-mode/drawer.d.ts +26 -3
- package/global-modules/payment-mode/drawer.js +104 -9
- package/global-modules/payment-mode/form.d.ts +16 -2
- package/global-modules/payment-mode/form.js +45 -74
- package/global-modules/payment-mode/payment-mode.d.ts +25 -2
- package/global-modules/payment-mode/payment-mode.js +90 -23
- package/global-modules/payment-mode/reducer.d.ts +23 -2
- package/global-modules/payment-mode/reducer.js +140 -114
- package/global-modules/payment-mode/types.d.ts +327 -112
- package/global-modules/payment-mode/types.js +162 -11
- package/global-modules/payment-mode/validate.d.ts +1 -1
- package/global-modules/payment-mode/validate.js +7 -5
- package/global-modules/preferences/actions.d.ts +126 -27
- package/global-modules/preferences/actions.js +128 -4
- package/global-modules/preferences/constants.d.ts +46 -31
- package/global-modules/preferences/constants.js +129 -66
- package/global-modules/preferences/context.d.ts +2 -2
- package/global-modules/preferences/context.js +43 -43
- package/global-modules/preferences/currency.js +15 -10
- package/global-modules/preferences/preferences.d.ts +2 -2
- package/global-modules/preferences/preferences.js +3 -5
- package/global-modules/preferences/validate.d.ts +1 -1
- package/global-modules/preferences/validate.js +7 -7
- package/global-modules/tax/actions.d.ts +155 -38
- package/global-modules/tax/actions.js +149 -7
- package/global-modules/tax/constants.d.ts +31 -39
- package/global-modules/tax/constants.js +83 -114
- package/global-modules/tax/context.d.ts +33 -2
- package/global-modules/tax/context.js +146 -132
- package/global-modules/tax/drawer.d.ts +26 -3
- package/global-modules/tax/drawer.js +101 -6
- package/global-modules/tax/form.d.ts +20 -3
- package/global-modules/tax/form.js +101 -74
- package/global-modules/tax/reducer.d.ts +23 -2
- package/global-modules/tax/reducer.js +143 -24
- package/global-modules/tax/tax.d.ts +25 -2
- package/global-modules/tax/tax.js +92 -28
- package/global-modules/tax/types.d.ts +332 -102
- package/global-modules/tax/types.js +179 -11
- package/global-modules/tax/validate.d.ts +1 -1
- package/global-modules/tax/validate.js +9 -8
- package/hooks/use-rtl.d.ts +44 -0
- package/hooks/use-rtl.js +75 -0
- package/lib/themes.d.ts +147 -0
- package/lib/themes.js +150 -0
- package/lib/toast-utils.d.ts +44 -0
- package/lib/toast-utils.js +212 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +12 -0
- package/package.json +21 -4
- package/supabase/supabase.d.ts +80 -1
- package/supabase/supabase.js +281 -6
- package/global-modules/branch/form-elements.d.ts +0 -3
- package/global-modules/branch/form-elements.js +0 -41
- package/global-modules/payment-mode/form-elements.d.ts +0 -3
- package/global-modules/payment-mode/form-elements.js +0 -41
- package/global-modules/preferences/bank.d.ts +0 -2
- package/global-modules/preferences/bank.js +0 -11
- package/global-modules/preferences/branch-drawer.js +0 -36
- package/global-modules/preferences/branch-form-elements.js +0 -30
- package/global-modules/preferences/branch-form.d.ts +0 -0
- package/global-modules/preferences/branch-form.js +0 -33
- package/global-modules/preferences/branch.d.ts +0 -0
- package/global-modules/preferences/branch.js +0 -106
- package/global-modules/preferences/payment-mode-drawer.d.ts +0 -0
- package/global-modules/preferences/payment-mode-drawer.js +0 -36
- package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -0
- package/global-modules/preferences/payment-mode-form-elements.js +0 -30
- package/global-modules/preferences/payment-mode-form.d.ts +0 -0
- package/global-modules/preferences/payment-mode-form.js +0 -33
- package/global-modules/preferences/payment-mode.d.ts +0 -0
- package/global-modules/preferences/payment-mode.js +0 -94
- package/global-modules/tax/form-elements.d.ts +0 -3
- package/global-modules/tax/form-elements.js +0 -41
- /package/{global-modules/preferences/branch-drawer.d.ts → constants.d.ts} +0 -0
- /package/{global-modules/preferences/branch-form-elements.d.ts → constants.js} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.Drawer = Drawer;
|
|
60
|
+
exports.DrawerPortal = DrawerPortal;
|
|
61
|
+
exports.DrawerOverlay = DrawerOverlay;
|
|
62
|
+
exports.DrawerTrigger = DrawerTrigger;
|
|
63
|
+
exports.DrawerClose = DrawerClose;
|
|
64
|
+
exports.DrawerContent = DrawerContent;
|
|
65
|
+
exports.DrawerHeader = DrawerHeader;
|
|
66
|
+
exports.DrawerFooter = DrawerFooter;
|
|
67
|
+
exports.DrawerTitle = DrawerTitle;
|
|
68
|
+
exports.DrawerDescription = DrawerDescription;
|
|
69
|
+
var React = __importStar(require("react"));
|
|
70
|
+
var vaul_1 = require("vaul");
|
|
71
|
+
var utils_1 = require("@/lib/utils");
|
|
72
|
+
function Drawer(_a) {
|
|
73
|
+
var props = __rest(_a, []);
|
|
74
|
+
return React.createElement(vaul_1.Drawer.Root, __assign({ "data-slot": "drawer" }, props));
|
|
75
|
+
}
|
|
76
|
+
function DrawerTrigger(_a) {
|
|
77
|
+
var props = __rest(_a, []);
|
|
78
|
+
return React.createElement(vaul_1.Drawer.Trigger, __assign({ "data-slot": "drawer-trigger" }, props));
|
|
79
|
+
}
|
|
80
|
+
function DrawerPortal(_a) {
|
|
81
|
+
var props = __rest(_a, []);
|
|
82
|
+
return React.createElement(vaul_1.Drawer.Portal, __assign({ "data-slot": "drawer-portal" }, props));
|
|
83
|
+
}
|
|
84
|
+
function DrawerClose(_a) {
|
|
85
|
+
var props = __rest(_a, []);
|
|
86
|
+
return React.createElement(vaul_1.Drawer.Close, __assign({ "data-slot": "drawer-close" }, props));
|
|
87
|
+
}
|
|
88
|
+
function DrawerOverlay(_a) {
|
|
89
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
90
|
+
return (React.createElement(vaul_1.Drawer.Overlay, __assign({ "data-slot": "drawer-overlay", className: (0, utils_1.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className) }, props)));
|
|
91
|
+
}
|
|
92
|
+
function DrawerContent(_a) {
|
|
93
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
94
|
+
return (React.createElement(DrawerPortal, { "data-slot": "drawer-portal" },
|
|
95
|
+
React.createElement(DrawerOverlay, null),
|
|
96
|
+
React.createElement(vaul_1.Drawer.Content, __assign({ "data-slot": "drawer-content", className: (0, utils_1.cn)("group/drawer-content bg-background fixed z-50 flex h-auto flex-col", "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b", "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t", "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm", "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm", className) }, props),
|
|
97
|
+
React.createElement("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
|
|
98
|
+
children)));
|
|
99
|
+
}
|
|
100
|
+
function DrawerHeader(_a) {
|
|
101
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
102
|
+
return (React.createElement("div", __assign({ "data-slot": "drawer-header", className: (0, utils_1.cn)("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left", className) }, props)));
|
|
103
|
+
}
|
|
104
|
+
function DrawerFooter(_a) {
|
|
105
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
106
|
+
return (React.createElement("div", __assign({ "data-slot": "drawer-footer", className: (0, utils_1.cn)("mt-auto flex flex-col gap-2 p-4", className) }, props)));
|
|
107
|
+
}
|
|
108
|
+
function DrawerTitle(_a) {
|
|
109
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
110
|
+
return (React.createElement(vaul_1.Drawer.Title, __assign({ "data-slot": "drawer-title", className: (0, utils_1.cn)("text-foreground font-semibold", className) }, props)));
|
|
111
|
+
}
|
|
112
|
+
function DrawerDescription(_a) {
|
|
113
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
114
|
+
return (React.createElement(vaul_1.Drawer.Description, __assign({ "data-slot": "drawer-description", className: (0, utils_1.cn)("text-muted-foreground text-sm", className) }, props)));
|
|
115
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React.JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: "default" | "destructive";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): React.JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): React.JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React.JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React.JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.DropdownMenu = DropdownMenu;
|
|
60
|
+
exports.DropdownMenuPortal = DropdownMenuPortal;
|
|
61
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
62
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
63
|
+
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
64
|
+
exports.DropdownMenuLabel = DropdownMenuLabel;
|
|
65
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
66
|
+
exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
|
|
67
|
+
exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
|
|
68
|
+
exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
|
|
69
|
+
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
70
|
+
exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
71
|
+
exports.DropdownMenuSub = DropdownMenuSub;
|
|
72
|
+
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
73
|
+
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
74
|
+
var React = __importStar(require("react"));
|
|
75
|
+
var DropdownMenuPrimitive = __importStar(require("@radix-ui/react-dropdown-menu"));
|
|
76
|
+
var lucide_react_1 = require("lucide-react");
|
|
77
|
+
var utils_1 = require("@/lib/utils");
|
|
78
|
+
function DropdownMenu(_a) {
|
|
79
|
+
var props = __rest(_a, []);
|
|
80
|
+
return React.createElement(DropdownMenuPrimitive.Root, __assign({ "data-slot": "dropdown-menu" }, props));
|
|
81
|
+
}
|
|
82
|
+
function DropdownMenuPortal(_a) {
|
|
83
|
+
var props = __rest(_a, []);
|
|
84
|
+
return (React.createElement(DropdownMenuPrimitive.Portal, __assign({ "data-slot": "dropdown-menu-portal" }, props)));
|
|
85
|
+
}
|
|
86
|
+
function DropdownMenuTrigger(_a) {
|
|
87
|
+
var props = __rest(_a, []);
|
|
88
|
+
return (React.createElement(DropdownMenuPrimitive.Trigger, __assign({ "data-slot": "dropdown-menu-trigger" }, props)));
|
|
89
|
+
}
|
|
90
|
+
function DropdownMenuContent(_a) {
|
|
91
|
+
var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, props = __rest(_a, ["className", "sideOffset"]);
|
|
92
|
+
return (React.createElement(DropdownMenuPrimitive.Portal, null,
|
|
93
|
+
React.createElement(DropdownMenuPrimitive.Content, __assign({ "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: (0, utils_1.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className) }, props))));
|
|
94
|
+
}
|
|
95
|
+
function DropdownMenuGroup(_a) {
|
|
96
|
+
var props = __rest(_a, []);
|
|
97
|
+
return (React.createElement(DropdownMenuPrimitive.Group, __assign({ "data-slot": "dropdown-menu-group" }, props)));
|
|
98
|
+
}
|
|
99
|
+
function DropdownMenuItem(_a) {
|
|
100
|
+
var className = _a.className, inset = _a.inset, _b = _a.variant, variant = _b === void 0 ? "default" : _b, props = __rest(_a, ["className", "inset", "variant"]);
|
|
101
|
+
return (React.createElement(DropdownMenuPrimitive.Item, __assign({ "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props)));
|
|
102
|
+
}
|
|
103
|
+
function DropdownMenuCheckboxItem(_a) {
|
|
104
|
+
var className = _a.className, children = _a.children, checked = _a.checked, props = __rest(_a, ["className", "children", "checked"]);
|
|
105
|
+
return (React.createElement(DropdownMenuPrimitive.CheckboxItem, __assign({ "data-slot": "dropdown-menu-checkbox-item", className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked }, props),
|
|
106
|
+
React.createElement("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center" },
|
|
107
|
+
React.createElement(DropdownMenuPrimitive.ItemIndicator, null,
|
|
108
|
+
React.createElement(lucide_react_1.CheckIcon, { className: "size-4" }))),
|
|
109
|
+
children));
|
|
110
|
+
}
|
|
111
|
+
function DropdownMenuRadioGroup(_a) {
|
|
112
|
+
var props = __rest(_a, []);
|
|
113
|
+
return (React.createElement(DropdownMenuPrimitive.RadioGroup, __assign({ "data-slot": "dropdown-menu-radio-group" }, props)));
|
|
114
|
+
}
|
|
115
|
+
function DropdownMenuRadioItem(_a) {
|
|
116
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
117
|
+
return (React.createElement(DropdownMenuPrimitive.RadioItem, __assign({ "data-slot": "dropdown-menu-radio-item", className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props),
|
|
118
|
+
React.createElement("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center" },
|
|
119
|
+
React.createElement(DropdownMenuPrimitive.ItemIndicator, null,
|
|
120
|
+
React.createElement(lucide_react_1.CircleIcon, { className: "size-2 fill-current" }))),
|
|
121
|
+
children));
|
|
122
|
+
}
|
|
123
|
+
function DropdownMenuLabel(_a) {
|
|
124
|
+
var className = _a.className, inset = _a.inset, props = __rest(_a, ["className", "inset"]);
|
|
125
|
+
return (React.createElement(DropdownMenuPrimitive.Label, __assign({ "data-slot": "dropdown-menu-label", "data-inset": inset, className: (0, utils_1.cn)("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className) }, props)));
|
|
126
|
+
}
|
|
127
|
+
function DropdownMenuSeparator(_a) {
|
|
128
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
129
|
+
return (React.createElement(DropdownMenuPrimitive.Separator, __assign({ "data-slot": "dropdown-menu-separator", className: (0, utils_1.cn)("bg-border -mx-1 my-1 h-px", className) }, props)));
|
|
130
|
+
}
|
|
131
|
+
function DropdownMenuShortcut(_a) {
|
|
132
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
133
|
+
return (React.createElement("span", __assign({ "data-slot": "dropdown-menu-shortcut", className: (0, utils_1.cn)("text-muted-foreground ml-auto text-xs tracking-widest", className) }, props)));
|
|
134
|
+
}
|
|
135
|
+
function DropdownMenuSub(_a) {
|
|
136
|
+
var props = __rest(_a, []);
|
|
137
|
+
return React.createElement(DropdownMenuPrimitive.Sub, __assign({ "data-slot": "dropdown-menu-sub" }, props));
|
|
138
|
+
}
|
|
139
|
+
function DropdownMenuSubTrigger(_a) {
|
|
140
|
+
var className = _a.className, inset = _a.inset, children = _a.children, props = __rest(_a, ["className", "inset", "children"]);
|
|
141
|
+
return (React.createElement(DropdownMenuPrimitive.SubTrigger, __assign({ "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", className) }, props),
|
|
142
|
+
children,
|
|
143
|
+
React.createElement(lucide_react_1.ChevronRightIcon, { className: "ml-auto size-4" })));
|
|
144
|
+
}
|
|
145
|
+
function DropdownMenuSubContent(_a) {
|
|
146
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
147
|
+
return (React.createElement(DropdownMenuPrimitive.SubContent, __assign({ "data-slot": "dropdown-menu-sub-content", className: (0, utils_1.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className) }, props)));
|
|
148
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Table Footer Action Component
|
|
3
|
+
*
|
|
4
|
+
* Navigation buttons for table pagination with RTL/LTR support.
|
|
5
|
+
* Automatically adjusts arrow directions and button order based on locale.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - RTL/LTR arrow direction adjustment
|
|
9
|
+
* - Button order reversal for RTL layouts
|
|
10
|
+
* - Accessibility attributes
|
|
11
|
+
* - Internationalized aria labels
|
|
12
|
+
* - Disabled state handling
|
|
13
|
+
* - Loading state support
|
|
14
|
+
*/
|
|
15
|
+
import { FC } from "react";
|
|
16
|
+
interface EnhancedTableFooterActionProps {
|
|
17
|
+
/** Handler for next page navigation */
|
|
18
|
+
handleNextOnClick: () => void;
|
|
19
|
+
/** Handler for previous page navigation */
|
|
20
|
+
handlePreviousOnClick: () => void;
|
|
21
|
+
/** Whether next button should be disabled */
|
|
22
|
+
isNextDisabled?: boolean;
|
|
23
|
+
/** Whether previous button should be disabled */
|
|
24
|
+
isPreviousDisabled?: boolean;
|
|
25
|
+
/** Loading state indicator */
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/** Custom aria labels for accessibility */
|
|
28
|
+
ariaLabels?: {
|
|
29
|
+
next?: string;
|
|
30
|
+
previous?: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare const EnhancedTableFooterAction: FC<EnhancedTableFooterActionProps>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced Table Footer Action Component
|
|
4
|
+
*
|
|
5
|
+
* Navigation buttons for table pagination with RTL/LTR support.
|
|
6
|
+
* Automatically adjusts arrow directions and button order based on locale.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - RTL/LTR arrow direction adjustment
|
|
10
|
+
* - Button order reversal for RTL layouts
|
|
11
|
+
* - Accessibility attributes
|
|
12
|
+
* - Internationalized aria labels
|
|
13
|
+
* - Disabled state handling
|
|
14
|
+
* - Loading state support
|
|
15
|
+
*/
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.EnhancedTableFooterAction = void 0;
|
|
21
|
+
var react_1 = __importDefault(require("react"));
|
|
22
|
+
var lucide_react_1 = require("lucide-react");
|
|
23
|
+
var next_intl_1 = require("next-intl");
|
|
24
|
+
var button_1 = require("./button");
|
|
25
|
+
var use_rtl_1 = require("@/hooks/use-rtl");
|
|
26
|
+
var EnhancedTableFooterAction = function (_a) {
|
|
27
|
+
var handleNextOnClick = _a.handleNextOnClick, handlePreviousOnClick = _a.handlePreviousOnClick, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, loading = _a.loading, ariaLabels = _a.ariaLabels;
|
|
28
|
+
var t = (0, next_intl_1.useTranslations)();
|
|
29
|
+
var isRTL = (0, use_rtl_1.useRTL)();
|
|
30
|
+
// Get translated aria labels with fallbacks
|
|
31
|
+
var previousLabel = (ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.previous) || t("common.previousPage") || "Previous page";
|
|
32
|
+
var nextLabel = (ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.next) || t("common.nextPage") || "Next page";
|
|
33
|
+
// In RTL, arrows should be swapped:
|
|
34
|
+
// Previous should show → (ChevronRight) as it goes to the right in RTL reading order
|
|
35
|
+
// Next should show ← (ChevronLeft) as it goes to the left in RTL reading order
|
|
36
|
+
var PreviousIcon = isRTL ? lucide_react_1.ChevronRight : lucide_react_1.ChevronLeft;
|
|
37
|
+
var NextIcon = isRTL ? lucide_react_1.ChevronLeft : lucide_react_1.ChevronRight;
|
|
38
|
+
return (react_1.default.createElement("div", { className: "flex gap-1 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
39
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handlePreviousOnClick, disabled: isPreviousDisabled || loading, "aria-label": previousLabel, title: previousLabel, className: "".concat(isRTL ? "rotate-180" : "") },
|
|
40
|
+
react_1.default.createElement(PreviousIcon, { className: "h-4 w-4" })),
|
|
41
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handleNextOnClick, disabled: isNextDisabled || loading, "aria-label": nextLabel, title: nextLabel, className: "".concat(isRTL ? "rotate-180" : "") },
|
|
42
|
+
react_1.default.createElement(NextIcon, { className: "h-4 w-4" }))));
|
|
43
|
+
};
|
|
44
|
+
exports.EnhancedTableFooterAction = EnhancedTableFooterAction;
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// USAGE EXAMPLES
|
|
47
|
+
// ============================================================================
|
|
48
|
+
/*
|
|
49
|
+
Example 1: Basic usage with automatic i18n and RTL support
|
|
50
|
+
<EnhancedTableFooterAction
|
|
51
|
+
handlePreviousOnClick={() => setCurrentPage(prev => prev - 1)}
|
|
52
|
+
handleNextOnClick={() => setCurrentPage(prev => prev + 1)}
|
|
53
|
+
isPreviousDisabled={currentPage === 1}
|
|
54
|
+
isNextDisabled={currentPage === totalPages}
|
|
55
|
+
loading={false}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
Example 2: With custom aria labels
|
|
59
|
+
<EnhancedTableFooterAction
|
|
60
|
+
handlePreviousOnClick={handlePrevious}
|
|
61
|
+
handleNextOnClick={handleNext}
|
|
62
|
+
isPreviousDisabled={isPreviousDisabled}
|
|
63
|
+
isNextDisabled={isNextDisabled}
|
|
64
|
+
loading={isLoading}
|
|
65
|
+
ariaLabels={{
|
|
66
|
+
previous: "Go to previous page",
|
|
67
|
+
next: "Go to next page"
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
Example 3: Loading state
|
|
72
|
+
<EnhancedTableFooterAction
|
|
73
|
+
handlePreviousOnClick={handlePrevious}
|
|
74
|
+
handleNextOnClick={handleNext}
|
|
75
|
+
loading={true} // Both buttons will be disabled
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
RTL Behavior:
|
|
79
|
+
- In LTR languages (English): Previous (←) | Next (→)
|
|
80
|
+
- In RTL languages (Arabic/Urdu): Previous (→) | Next (←)
|
|
81
|
+
- Button order is reversed in RTL: [Next] [Previous]
|
|
82
|
+
- Arrows automatically adjust to reading direction
|
|
83
|
+
*/
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// COMPONENT ENHANCEMENTS SUMMARY
|
|
86
|
+
// ============================================================================
|
|
87
|
+
/*
|
|
88
|
+
Enhancements Applied:
|
|
89
|
+
|
|
90
|
+
1. **RTL/LTR Layout Support**
|
|
91
|
+
- Automatic arrow direction adjustment based on locale
|
|
92
|
+
- Button order reversal for RTL layouts (flex-row-reverse)
|
|
93
|
+
- Direction-aware icon selection (ChevronLeft/Right swap)
|
|
94
|
+
- Proper navigation flow for both reading directions
|
|
95
|
+
|
|
96
|
+
2. **Internationalization (i18n)**
|
|
97
|
+
- Translation support using next-intl
|
|
98
|
+
- Fallback aria labels for accessibility
|
|
99
|
+
- Custom aria label override capability
|
|
100
|
+
- Tooltip support with title attributes
|
|
101
|
+
|
|
102
|
+
3. **Accessibility Improvements**
|
|
103
|
+
- ARIA labels for screen readers
|
|
104
|
+
- Title attributes for tooltips
|
|
105
|
+
- Proper button semantics
|
|
106
|
+
- Keyboard navigation support
|
|
107
|
+
|
|
108
|
+
4. **Visual Consistency**
|
|
109
|
+
- Maintains button spacing and alignment
|
|
110
|
+
- Consistent with existing table footer components
|
|
111
|
+
- Proper disabled state handling
|
|
112
|
+
- Loading state support
|
|
113
|
+
|
|
114
|
+
Translation Keys Added:
|
|
115
|
+
- common.previousPage: "Previous page" / "پچھلا صفحہ"
|
|
116
|
+
- common.nextPage: "Next page" / "اگلا صفحہ"
|
|
117
|
+
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Table Footer Page Component
|
|
3
|
+
*
|
|
4
|
+
* Displays pagination information with internationalization and RTL/LTR support.
|
|
5
|
+
* Automatically adapts text direction and order based on locale.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Full i18n support with fallback text
|
|
9
|
+
* - RTL/LTR layout adaptation
|
|
10
|
+
* - Loading state indicator
|
|
11
|
+
* - Accessibility attributes
|
|
12
|
+
* - Custom translation overrides
|
|
13
|
+
*/
|
|
14
|
+
import { FC } from "react";
|
|
15
|
+
interface EnhancedTableFooterPageProps {
|
|
16
|
+
/** Current active page number */
|
|
17
|
+
currentPage: number;
|
|
18
|
+
/** Loading state indicator */
|
|
19
|
+
loading: boolean;
|
|
20
|
+
/** Total number of pages available */
|
|
21
|
+
totalPages: number;
|
|
22
|
+
/** Optional translation map for custom text overrides */
|
|
23
|
+
translationMap?: {
|
|
24
|
+
pageLabel?: string;
|
|
25
|
+
ofLabel?: string;
|
|
26
|
+
loadingLabel?: string;
|
|
27
|
+
};
|
|
28
|
+
/** Optional CSS classes for custom styling */
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const EnhancedTableFooterPage: FC<EnhancedTableFooterPageProps>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced Table Footer Page Component
|
|
4
|
+
*
|
|
5
|
+
* Displays pagination information with internationalization and RTL/LTR support.
|
|
6
|
+
* Automatically adapts text direction and order based on locale.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Full i18n support with fallback text
|
|
10
|
+
* - RTL/LTR layout adaptation
|
|
11
|
+
* - Loading state indicator
|
|
12
|
+
* - Accessibility attributes
|
|
13
|
+
* - Custom translation overrides
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.EnhancedTableFooterPage = void 0;
|
|
20
|
+
var react_1 = __importDefault(require("react"));
|
|
21
|
+
var next_intl_1 = require("next-intl");
|
|
22
|
+
var use_rtl_1 = require("@/hooks/use-rtl");
|
|
23
|
+
var EnhancedTableFooterPage = function (_a) {
|
|
24
|
+
var currentPage = _a.currentPage, loading = _a.loading, totalPages = _a.totalPages, translationMap = _a.translationMap, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
25
|
+
var t = (0, next_intl_1.useTranslations)();
|
|
26
|
+
var isRTL = (0, use_rtl_1.useRTL)();
|
|
27
|
+
// Get translated text with fallbacks
|
|
28
|
+
var pageLabel = (translationMap === null || translationMap === void 0 ? void 0 : translationMap.pageLabel) || t("common.page") || "Page";
|
|
29
|
+
var ofLabel = (translationMap === null || translationMap === void 0 ? void 0 : translationMap.ofLabel) || t("common.of") || "of";
|
|
30
|
+
var loadingLabel = (translationMap === null || translationMap === void 0 ? void 0 : translationMap.loadingLabel) || t("common.loading") || "Loading";
|
|
31
|
+
return (react_1.default.createElement("div", { className: "flex items-center gap-2 ".concat(isRTL ? "rtl" : "ltr", " ").concat(className), dir: isRTL ? "rtl" : "ltr", role: "status", "aria-live": "polite", "aria-label": "".concat(pageLabel, " ").concat(currentPage, " ").concat(ofLabel, " ").concat(totalPages) },
|
|
32
|
+
react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, isRTL ? (
|
|
33
|
+
// RTL layout: Numbers read right-to-left but maintain logical order
|
|
34
|
+
react_1.default.createElement("span", { className: "inline-flex items-center gap-1" },
|
|
35
|
+
react_1.default.createElement("span", null, totalPages),
|
|
36
|
+
react_1.default.createElement("span", null, ofLabel),
|
|
37
|
+
react_1.default.createElement("span", null, currentPage),
|
|
38
|
+
react_1.default.createElement("span", null, pageLabel))) : (
|
|
39
|
+
// LTR layout: "Page currentPage of totalPages"
|
|
40
|
+
react_1.default.createElement("span", { className: "inline-flex items-center gap-1" },
|
|
41
|
+
react_1.default.createElement("span", null, pageLabel),
|
|
42
|
+
react_1.default.createElement("span", null, currentPage),
|
|
43
|
+
react_1.default.createElement("span", null, ofLabel),
|
|
44
|
+
react_1.default.createElement("span", null, totalPages)))),
|
|
45
|
+
loading && (react_1.default.createElement("div", { className: "flex items-center gap-2 ".concat(isRTL ? "order-first" : "order-last"), "aria-label": loadingLabel },
|
|
46
|
+
react_1.default.createElement("div", { className: "w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin", role: "progressbar", "aria-label": loadingLabel })))));
|
|
47
|
+
};
|
|
48
|
+
exports.EnhancedTableFooterPage = EnhancedTableFooterPage;
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// USAGE EXAMPLES
|
|
51
|
+
// ============================================================================
|
|
52
|
+
/*
|
|
53
|
+
Example 1: Basic usage with automatic i18n
|
|
54
|
+
<EnhancedTableFooterPage
|
|
55
|
+
currentPage={2}
|
|
56
|
+
totalPages={10}
|
|
57
|
+
loading={false}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
Example 2: With custom translations
|
|
61
|
+
<EnhancedTableFooterPage
|
|
62
|
+
currentPage={1}
|
|
63
|
+
totalPages={5}
|
|
64
|
+
loading={true}
|
|
65
|
+
translationMap={{
|
|
66
|
+
pageLabel: "صفحہ", // Urdu for "Page"
|
|
67
|
+
ofLabel: "کا", // Urdu for "of"
|
|
68
|
+
loadingLabel: "لوڈ ہو رہا ہے" // Urdu for "Loading"
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
Example 3: With custom styling
|
|
73
|
+
<EnhancedTableFooterPage
|
|
74
|
+
currentPage={3}
|
|
75
|
+
totalPages={7}
|
|
76
|
+
loading={false}
|
|
77
|
+
className="bg-gray-50 p-2 rounded-md"
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
Translation Keys (Already Added to messages files):
|
|
81
|
+
English (en.json):
|
|
82
|
+
{
|
|
83
|
+
"common": {
|
|
84
|
+
"page": "Page",
|
|
85
|
+
"of": "of",
|
|
86
|
+
"loading": "Loading"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Urdu (ur.json):
|
|
91
|
+
{
|
|
92
|
+
"common": {
|
|
93
|
+
"page": "صفحہ",
|
|
94
|
+
"of": "کا",
|
|
95
|
+
"loading": "لوڈ ہو رہا ہے"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
RTL Layout Features:
|
|
100
|
+
- Automatic text direction detection and application
|
|
101
|
+
- Proper order of page information in RTL languages
|
|
102
|
+
- RTL-aware loading indicator positioning
|
|
103
|
+
- Accessibility attributes for screen readers
|
|
104
|
+
- Direction-specific CSS classes and DOM attributes
|
|
105
|
+
*/
|
|
106
|
+
// ============================================================================
|
|
107
|
+
// COMPONENT ENHANCEMENTS SUMMARY
|
|
108
|
+
// ============================================================================
|
|
109
|
+
/*
|
|
110
|
+
Enhancements Applied:
|
|
111
|
+
|
|
112
|
+
1. **Internationalization (i18n)**
|
|
113
|
+
- Full translation support using next-intl
|
|
114
|
+
- Fallback text for missing translations
|
|
115
|
+
- Custom translation override capability
|
|
116
|
+
|
|
117
|
+
2. **RTL/LTR Layout Support**
|
|
118
|
+
- Automatic layout detection using useRTL hook
|
|
119
|
+
- Proper text ordering for RTL languages
|
|
120
|
+
- Direction-aware CSS classes and attributes
|
|
121
|
+
- RTL-appropriate visual element positioning
|
|
122
|
+
|
|
123
|
+
3. **Accessibility Improvements**
|
|
124
|
+
- ARIA labels for screen readers
|
|
125
|
+
- Role attributes for semantic meaning
|
|
126
|
+
- Live region announcements for dynamic content
|
|
127
|
+
- Proper labeling of interactive elements
|
|
128
|
+
|
|
129
|
+
4. **Developer Experience**
|
|
130
|
+
- Comprehensive JSDoc documentation
|
|
131
|
+
- Usage examples and patterns
|
|
132
|
+
- TypeScript interface improvements
|
|
133
|
+
- Flexible customization options
|
|
134
|
+
|
|
135
|
+
5. **Code Quality**
|
|
136
|
+
- Clean, readable component structure
|
|
137
|
+
- Consistent naming conventions
|
|
138
|
+
- Performance-optimized rendering
|
|
139
|
+
- Maintainable and extensible design
|
|
140
|
+
*/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Table Footer Pagination Component
|
|
3
|
+
*
|
|
4
|
+
* Displays rows per page selector with internationalization and RTL/LTR support.
|
|
5
|
+
* Automatically adapts text direction and layout based on locale.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Full i18n support with fallback text
|
|
9
|
+
* - RTL/LTR layout adaptation
|
|
10
|
+
* - Loading state handling
|
|
11
|
+
* - Accessibility attributes
|
|
12
|
+
* - Custom translation overrides
|
|
13
|
+
* - Responsive design
|
|
14
|
+
*/
|
|
15
|
+
import { FC } from "react";
|
|
16
|
+
export interface PageLimitOption {
|
|
17
|
+
option: string;
|
|
18
|
+
}
|
|
19
|
+
interface EnhancedTableFooterPageProps {
|
|
20
|
+
/** Handler for page limit selection changes */
|
|
21
|
+
handleOnSelect: (node: string, value: object) => void;
|
|
22
|
+
/** Array of page limit options to display */
|
|
23
|
+
listOptions: PageLimitOption[];
|
|
24
|
+
/** Loading state indicator */
|
|
25
|
+
loading: boolean;
|
|
26
|
+
/** Node key for the select handler */
|
|
27
|
+
nodeSelectKey?: string;
|
|
28
|
+
/** Current page limit value */
|
|
29
|
+
pageLimit: number;
|
|
30
|
+
/** Total number of pages (unused but kept for compatibility) */
|
|
31
|
+
totalPages: number;
|
|
32
|
+
/** Optional translation override for the label text */
|
|
33
|
+
labelText?: string;
|
|
34
|
+
/** Optional CSS classes for custom styling */
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const EnhancedTableFooterPagination: FC<EnhancedTableFooterPageProps>;
|
|
38
|
+
export {};
|